Spaces:
Sleeping
Sleeping
raise ValueError("user_message 長度超過 500 個字")
Browse files
app.py
CHANGED
@@ -995,6 +995,10 @@ def respond(user_message, data, chat_history, socratic_mode=False):
|
|
995 |
return "", chat_history
|
996 |
|
997 |
def chat_with_youtube_transcript(youtube_id, thread_id, user_message, chat_history, socratic_mode=False):
|
|
|
|
|
|
|
|
|
998 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
999 |
client = OPEN_AI_CLIENT
|
1000 |
# 根據 youtube_id 找到 file_id
|
|
|
995 |
return "", chat_history
|
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) > 500:
|
1000 |
+
raise ValueError("user_message 長度超過 500 個字")
|
1001 |
+
|
1002 |
assistant_id = "asst_kmvZLNkDUYaNkMNtZEAYxyPq"
|
1003 |
client = OPEN_AI_CLIENT
|
1004 |
# 根據 youtube_id 找到 file_id
|