youngtsai commited on
Commit
201222d
ยท
1 Parent(s): 9f0e11f

- if user say hi or hello or any greeting, just say hi back and introduce yourself. Then ask user to ask question in context.

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1862,6 +1862,7 @@ def get_instructions(content_subject, content_grade, key_moments):
1862
  Method: Socratic style, guide thinking, no direct answers. this is very important, please be seriously following.
1863
  Language: Traditional Chinese ZH-TW (it's very important), suitable for {content_grade} th-grade level.
1864
  Response:
 
1865
  - Single question, under 100 characters
1866
  - include math symbols (use LaTeX $ to cover before and after, ex: $x^2$)
1867
  - hint with video timestamp which format ใ€ๅƒ่€ƒ๏ผš00:00:00ใ€‘.
@@ -2123,13 +2124,13 @@ def poll_run_status(run_id, thread_id, timeout=600, poll_interval=5):
2123
 
2124
  return run.status
2125
 
2126
- def streaming_chat_with_open_ai(user_message, chat_history, password, video_id, user_data, thread_id, trascript, key_moments, content_subject, content_grade):
2127
  verify_password(password)
2128
 
2129
  print("=====user_data=====")
2130
  print(f"user_data: {user_data}")
2131
 
2132
- print("===streaming_chat_with_open_ai===")
2133
  print(thread_id)
2134
 
2135
  # ๅ…ˆ่จˆ็ฎ— user_message ๆ˜ฏๅฆ่ถ…้Ž 500 ๅ€‹ๅญ—
@@ -2489,7 +2490,7 @@ with gr.Blocks(theme=gr.themes.Base(primary_hue=gr.themes.colors.orange, seconda
2489
  """
2490
  additional_inputs = [password, video_id, user_data, streaming_chat_thread_id_state, trascript_state, key_moments_state, content_subject_state, content_grade_state]
2491
  streaming_chat = gr.ChatInterface(
2492
- fn=streaming_chat_with_open_ai,
2493
  additional_inputs=additional_inputs,
2494
  submit_btn="้€ๅ‡บ",
2495
  retry_btn=None,
 
1862
  Method: Socratic style, guide thinking, no direct answers. this is very important, please be seriously following.
1863
  Language: Traditional Chinese ZH-TW (it's very important), suitable for {content_grade} th-grade level.
1864
  Response:
1865
+ - if user say hi or hello or any greeting, just say hi back and introduce yourself. Then ask user to ask question in context.
1866
  - Single question, under 100 characters
1867
  - include math symbols (use LaTeX $ to cover before and after, ex: $x^2$)
1868
  - hint with video timestamp which format ใ€ๅƒ่€ƒ๏ผš00:00:00ใ€‘.
 
2124
 
2125
  return run.status
2126
 
2127
+ def chat_with_opan_ai_assistant_streaming(user_message, chat_history, password, video_id, user_data, thread_id, trascript, key_moments, content_subject, content_grade):
2128
  verify_password(password)
2129
 
2130
  print("=====user_data=====")
2131
  print(f"user_data: {user_data}")
2132
 
2133
+ print("===chat_with_opan_ai_assistant_streaming===")
2134
  print(thread_id)
2135
 
2136
  # ๅ…ˆ่จˆ็ฎ— user_message ๆ˜ฏๅฆ่ถ…้Ž 500 ๅ€‹ๅญ—
 
2490
  """
2491
  additional_inputs = [password, video_id, user_data, streaming_chat_thread_id_state, trascript_state, key_moments_state, content_subject_state, content_grade_state]
2492
  streaming_chat = gr.ChatInterface(
2493
+ fn=chat_with_opan_ai_assistant_streaming,
2494
  additional_inputs=additional_inputs,
2495
  submit_btn="้€ๅ‡บ",
2496
  retry_btn=None,