Spaces:
Running
Running
def setup_question_button_click(button, question_btn, chatbot, chat_func):
Browse files
app.py
CHANGED
@@ -854,7 +854,7 @@ def get_video_id_summary(video_id, df_string, source):
|
|
854 |
else:
|
855 |
# summary已存在,下载内容
|
856 |
print("summary已存在于GCS中")
|
857 |
-
summary_text = GCS_SERVICE.download_as_string(bucket_name,
|
858 |
summary_json = json.loads(summary_text)
|
859 |
|
860 |
elif source == "drive":
|
@@ -2950,31 +2950,24 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2950 |
outputs=[msg]
|
2951 |
)
|
2952 |
# OPENAI ASSISTANT CHATBOT 連接按鈕點擊事件
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
btn_2
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
)
|
2968 |
-
btn_3.click(
|
2969 |
-
chat_with_opan_ai_assistant,
|
2970 |
-
inputs=btn_3_chat_with_opan_ai_assistant_input,
|
2971 |
-
outputs=[msg, chatbot, thread_id],
|
2972 |
-
scroll_to_output=True
|
2973 |
-
)
|
2974 |
btn_create_question.click(
|
2975 |
change_questions,
|
2976 |
-
inputs
|
2977 |
-
outputs
|
2978 |
)
|
2979 |
|
2980 |
# 其他精靈 ai_chatbot 模式
|
|
|
854 |
else:
|
855 |
# summary已存在,下载内容
|
856 |
print("summary已存在于GCS中")
|
857 |
+
summary_text = GCS_SERVICE.download_as_string(bucket_name, summary_file_blob_name)
|
858 |
summary_json = json.loads(summary_text)
|
859 |
|
860 |
elif source == "drive":
|
|
|
2950 |
outputs=[msg]
|
2951 |
)
|
2952 |
# OPENAI ASSISTANT CHATBOT 連接按鈕點擊事件
|
2953 |
+
def setup_question_button_click(button, question_btn, chatbot, chat_func):
|
2954 |
+
inputs = [password, video_id, user_data, thread_id, trascript_state, key_moments, question_btn, chatbot, content_subject, content_grade, questions_answers_json, ai_chatbot_socratic_mode_btn]
|
2955 |
+
outputs = [msg, chatbot, thread_id]
|
2956 |
+
button.click(
|
2957 |
+
chat_func,
|
2958 |
+
inputs=inputs,
|
2959 |
+
outputs=outputs,
|
2960 |
+
scroll_to_output=True
|
2961 |
+
)
|
2962 |
+
buttons = [btn_1, btn_2, btn_3]
|
2963 |
+
for button in buttons:
|
2964 |
+
setup_question_button_click(button, button, chatbot, chat_with_opan_ai_assistant)
|
2965 |
+
|
2966 |
+
# 為生成問題按鈕設定特殊的點擊事件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2967 |
btn_create_question.click(
|
2968 |
change_questions,
|
2969 |
+
inputs=[password, df_string_output],
|
2970 |
+
outputs=buttons
|
2971 |
)
|
2972 |
|
2973 |
# 其他精靈 ai_chatbot 模式
|