Spaces:
Sleeping
Sleeping
if isinstance(trascript, str):
Browse files
app.py
CHANGED
@@ -1843,11 +1843,10 @@ def streaming_chat_with_open_ai(user_message, chat_history, password, thread_id,
|
|
1843 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
1844 |
client = OPEN_AI_CLIENT
|
1845 |
# 直接安排逐字稿資料 in instructions
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
entry.pop('screenshot_path', None)
|
1851 |
trascript_text = json.dumps(trascript_json, ensure_ascii=False, indent=2)
|
1852 |
# trascript_text 移除 \n, 空白
|
1853 |
trascript_text = trascript_text.replace("\n", "").replace(" ", "")
|
@@ -1985,7 +1984,12 @@ def update_state(content_subject, content_grade, trascript, question_1, question
|
|
1985 |
# outputs=[content_subject_state, content_grade_state, trascript_state]
|
1986 |
content_subject_state = content_subject
|
1987 |
content_grade_state = content_grade
|
1988 |
-
|
|
|
|
|
|
|
|
|
|
|
1989 |
streaming_chat_thread_id_state = create_thread_id()
|
1990 |
ai_chatbot_question_1 = question_1
|
1991 |
ai_chatbot_question_2 = question_2
|
|
|
1843 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
1844 |
client = OPEN_AI_CLIENT
|
1845 |
# 直接安排逐字稿資料 in instructions
|
1846 |
+
if isinstance(trascript, str):
|
1847 |
+
trascript_json = json.loads(trascript)
|
1848 |
+
else:
|
1849 |
+
trascript_json = trascript
|
|
|
1850 |
trascript_text = json.dumps(trascript_json, ensure_ascii=False, indent=2)
|
1851 |
# trascript_text 移除 \n, 空白
|
1852 |
trascript_text = trascript_text.replace("\n", "").replace(" ", "")
|
|
|
1984 |
# outputs=[content_subject_state, content_grade_state, trascript_state]
|
1985 |
content_subject_state = content_subject
|
1986 |
content_grade_state = content_grade
|
1987 |
+
trascript_json = json.loads(trascript)
|
1988 |
+
formatted_simple_transcript = create_formatted_simple_transcript(trascript_json)
|
1989 |
+
trascript_state = formatted_simple_transcript
|
1990 |
+
print("=== update_state ===")
|
1991 |
+
print(trascript_state)
|
1992 |
+
print("=== update_state ===")
|
1993 |
streaming_chat_thread_id_state = create_thread_id()
|
1994 |
ai_chatbot_question_1 = question_1
|
1995 |
ai_chatbot_question_2 = question_2
|