Spaces:
Running
Running
create_questions_btn.click(
Browse files
app.py
CHANGED
@@ -2894,6 +2894,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
2894 |
ai_chatbot_question_1 = gr.Button("問題一")
|
2895 |
ai_chatbot_question_2 = gr.Button("問題一")
|
2896 |
ai_chatbot_question_3 = gr.Button("問題一")
|
|
|
2897 |
ai_chatbot_audio_input = gr.Audio(sources=["microphone"], type="filepath", max_length=60, label="語音輸入")
|
2898 |
with gr.Row():
|
2899 |
ai_msg = gr.Textbox(label="訊息輸入",scale=3)
|
@@ -3150,25 +3151,6 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
3150 |
inputs=[],
|
3151 |
outputs=[chatbot_select_accordion, all_chatbot_select_btn]
|
3152 |
)
|
3153 |
-
|
3154 |
-
# OPENAI ASSISTANT CHATBOT 模式
|
3155 |
-
# send_button.click(
|
3156 |
-
# chat_with_any_ai,
|
3157 |
-
# inputs=[chatbot_ai_type, password, video_id, user_data, trascript_state, key_moments, msg, chatbot, content_subject, content_grade, questions_answers_json, socratic_mode_btn, thread_id, ai_name],
|
3158 |
-
# outputs=[msg, chatbot, send_button, send_feedback_btn, thread_id],
|
3159 |
-
# scroll_to_output=True
|
3160 |
-
# )
|
3161 |
-
# send_feedback_btn.click(
|
3162 |
-
# feedback_with_ai,
|
3163 |
-
# inputs=[chatbot_ai_type, chatbot, thread_id],
|
3164 |
-
# outputs=[chatbot, send_feedback_btn],
|
3165 |
-
# scroll_to_output=True
|
3166 |
-
# )
|
3167 |
-
# openai_chatbot_audio_input.change(
|
3168 |
-
# process_open_ai_audio_to_chatbot,
|
3169 |
-
# inputs=[password, openai_chatbot_audio_input],
|
3170 |
-
# outputs=[msg]
|
3171 |
-
# )
|
3172 |
# OPENAI ASSISTANT CHATBOT 連接按鈕點擊事件
|
3173 |
def setup_question_button_click(button, inputs_list, outputs_list, chat_func, scroll_to_output=True):
|
3174 |
button.click(
|
@@ -3177,18 +3159,6 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
3177 |
outputs=outputs_list,
|
3178 |
scroll_to_output=scroll_to_output
|
3179 |
)
|
3180 |
-
# question_buttons = [btn_1, btn_2, btn_3]
|
3181 |
-
# for question_btn in question_buttons:
|
3182 |
-
# inputs_list = [chatbot_ai_type, password, video_id, user_data, trascript_state, key_moments, question_btn, chatbot, content_subject, content_grade, questions_answers_json, socratic_mode_btn, thread_id, ai_name]
|
3183 |
-
# outputs_list = [msg, chatbot, send_button, send_feedback_btn, thread_id]
|
3184 |
-
# setup_question_button_click(question_btn, inputs_list, outputs_list, chat_with_any_ai)
|
3185 |
-
|
3186 |
-
# 為生成問題按鈕設定特殊的點擊事件
|
3187 |
-
# btn_create_question.click(
|
3188 |
-
# change_questions,
|
3189 |
-
# inputs=[password, df_string_output],
|
3190 |
-
# outputs=question_buttons
|
3191 |
-
# )
|
3192 |
|
3193 |
# 其他精靈 ai_chatbot 模式
|
3194 |
ai_send_button.click(
|
@@ -3210,6 +3180,18 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
|
|
3210 |
outputs_list = [ai_msg, ai_chatbot, ai_send_button, ai_send_feedback_btn, ai_chatbot_thread_id]
|
3211 |
setup_question_button_click(question_btn, inputs_list, outputs_list, chat_with_any_ai)
|
3212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3213 |
ai_chatbot_audio_input.change(
|
3214 |
process_open_ai_audio_to_chatbot,
|
3215 |
inputs=[password, ai_chatbot_audio_input],
|
|
|
2894 |
ai_chatbot_question_1 = gr.Button("問題一")
|
2895 |
ai_chatbot_question_2 = gr.Button("問題一")
|
2896 |
ai_chatbot_question_3 = gr.Button("問題一")
|
2897 |
+
create_questions_btn = gr.Button("生成問題", variant="primary")
|
2898 |
ai_chatbot_audio_input = gr.Audio(sources=["microphone"], type="filepath", max_length=60, label="語音輸入")
|
2899 |
with gr.Row():
|
2900 |
ai_msg = gr.Textbox(label="訊息輸入",scale=3)
|
|
|
3151 |
inputs=[],
|
3152 |
outputs=[chatbot_select_accordion, all_chatbot_select_btn]
|
3153 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3154 |
# OPENAI ASSISTANT CHATBOT 連接按鈕點擊事件
|
3155 |
def setup_question_button_click(button, inputs_list, outputs_list, chat_func, scroll_to_output=True):
|
3156 |
button.click(
|
|
|
3159 |
outputs=outputs_list,
|
3160 |
scroll_to_output=scroll_to_output
|
3161 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3162 |
|
3163 |
# 其他精靈 ai_chatbot 模式
|
3164 |
ai_send_button.click(
|
|
|
3180 |
outputs_list = [ai_msg, ai_chatbot, ai_send_button, ai_send_feedback_btn, ai_chatbot_thread_id]
|
3181 |
setup_question_button_click(question_btn, inputs_list, outputs_list, chat_with_any_ai)
|
3182 |
|
3183 |
+
# 為生成問題按鈕設定特殊的點擊事件
|
3184 |
+
question_buttons = [
|
3185 |
+
ai_chatbot_question_1,
|
3186 |
+
ai_chatbot_question_2,
|
3187 |
+
ai_chatbot_question_3
|
3188 |
+
]
|
3189 |
+
create_questions_btn.click(
|
3190 |
+
change_questions,
|
3191 |
+
inputs=[password, df_string_output],
|
3192 |
+
outputs=question_buttons
|
3193 |
+
)
|
3194 |
+
|
3195 |
ai_chatbot_audio_input.change(
|
3196 |
process_open_ai_audio_to_chatbot,
|
3197 |
inputs=[password, ai_chatbot_audio_input],
|