Spaces:
Sleeping
Sleeping
# 如果 chat_history 超過 10 則訊息,直接 return "對話超過上限"
Browse filesif chat_history is not None and len(chat_history) > 10:
error_msg = "此次對話超過上限"
raise gr.Error(error_msg)
app.py
CHANGED
@@ -1263,6 +1263,11 @@ def respond(password, user_message, data, chat_history, socratic_mode=False):
|
|
1263 |
def respond_with_jutor_chat(password, user_message, data, chat_history, socratic_mode=False):
|
1264 |
verify_password(password)
|
1265 |
|
|
|
|
|
|
|
|
|
|
|
1266 |
data_json = json.loads(data)
|
1267 |
for entry in data_json:
|
1268 |
entry.pop('embed_url', None) # Remove 'embed_url' if it exists
|
@@ -1361,6 +1366,11 @@ def respond_with_jutor_chat(password, user_message, data, chat_history, socratic
|
|
1361 |
def chat_with_groq(password, user_message, data, chat_history, socratic_mode=False):
|
1362 |
verify_password(password)
|
1363 |
|
|
|
|
|
|
|
|
|
|
|
1364 |
print("=== 變數:user_message ===")
|
1365 |
print(user_message)
|
1366 |
print("=== 變數:chat_history ===")
|
@@ -1640,6 +1650,12 @@ def poll_run_status(run_id, thread_id, timeout=600, poll_interval=5):
|
|
1640 |
|
1641 |
def chat_with_claude3(password, video_id, trascript, user_message, chat_history, content_subject, content_grade, socratic_mode=False):
|
1642 |
verify_password(password)
|
|
|
|
|
|
|
|
|
|
|
|
|
1643 |
trascript_json = json.loads(trascript)
|
1644 |
for entry in trascript_json:
|
1645 |
entry.pop('embed_url', None) # Remove 'embed_url' if it exists
|
|
|
1263 |
def respond_with_jutor_chat(password, user_message, data, chat_history, socratic_mode=False):
|
1264 |
verify_password(password)
|
1265 |
|
1266 |
+
# 如果 chat_history 超過 10 則訊息,直接 return "對話超過上限"
|
1267 |
+
if chat_history is not None and len(chat_history) > 10:
|
1268 |
+
error_msg = "此次對話超過上限"
|
1269 |
+
raise gr.Error(error_msg)
|
1270 |
+
|
1271 |
data_json = json.loads(data)
|
1272 |
for entry in data_json:
|
1273 |
entry.pop('embed_url', None) # Remove 'embed_url' if it exists
|
|
|
1366 |
def chat_with_groq(password, user_message, data, chat_history, socratic_mode=False):
|
1367 |
verify_password(password)
|
1368 |
|
1369 |
+
# 如果 chat_history 超過 10 則訊息,直接 return "對話超過上限"
|
1370 |
+
if chat_history is not None and len(chat_history) > 10:
|
1371 |
+
error_msg = "此次對話超過上限"
|
1372 |
+
raise gr.Error(error_msg)
|
1373 |
+
|
1374 |
print("=== 變數:user_message ===")
|
1375 |
print(user_message)
|
1376 |
print("=== 變數:chat_history ===")
|
|
|
1650 |
|
1651 |
def chat_with_claude3(password, video_id, trascript, user_message, chat_history, content_subject, content_grade, socratic_mode=False):
|
1652 |
verify_password(password)
|
1653 |
+
|
1654 |
+
# 如果 chat_history 超過 10 則訊息,直接 return "對話超過上限"
|
1655 |
+
if chat_history is not None and len(chat_history) > 10:
|
1656 |
+
error_msg = "此次對話超過上限"
|
1657 |
+
raise gr.Error(error_msg)
|
1658 |
+
|
1659 |
trascript_json = json.loads(trascript)
|
1660 |
for entry in trascript_json:
|
1661 |
entry.pop('embed_url', None) # Remove 'embed_url' if it exists
|