Spaces:
Sleeping
Sleeping
raise gr.Error(error_msg)
Browse files
app.py
CHANGED
@@ -996,8 +996,9 @@ def respond(user_message, data, chat_history, socratic_mode=False):
|
|
996 |
|
997 |
def chat_with_youtube_transcript(youtube_id, thread_id, user_message, chat_history, socratic_mode=False):
|
998 |
# 先計算 user_message 是否超過 500 個字
|
999 |
-
if len(user_message) >
|
1000 |
-
|
|
|
1001 |
|
1002 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
1003 |
client = OPEN_AI_CLIENT
|
|
|
996 |
|
997 |
def chat_with_youtube_transcript(youtube_id, thread_id, user_message, chat_history, socratic_mode=False):
|
998 |
# 先計算 user_message 是否超過 500 個字
|
999 |
+
if len(user_message) > 1500:
|
1000 |
+
error_msg = "你的訊息太長了,請縮短訊息長度"
|
1001 |
+
raise gr.Error(error_msg)
|
1002 |
|
1003 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
1004 |
client = OPEN_AI_CLIENT
|