Update app.py
Browse files
app.py
CHANGED
|
@@ -103,6 +103,7 @@ def chat_with_model(prompt, system_prompt, chatbot_display, internal_history,lan
|
|
| 103 |
prompt = prompt.replace(expected_key, "")
|
| 104 |
if lang != None:
|
| 105 |
prompt = translate_text(prompt,lang+"-en")
|
|
|
|
| 106 |
# 1. Khởi tạo nếu đây là lần chạy đầu tiên
|
| 107 |
# chatbot_display là [[user_msg, ai_msg], ...]
|
| 108 |
if chatbot_display is None:
|
|
@@ -146,7 +147,7 @@ def chat_with_model(prompt, system_prompt, chatbot_display, internal_history,lan
|
|
| 146 |
print(response_text)
|
| 147 |
# 6. Cập nhật "bộ nhớ" (gr.State) với lượt nói MỚI
|
| 148 |
internal_history.append({"role": "user", "content": prompt})
|
| 149 |
-
internal_history.append({"role": "assistant", "content":
|
| 150 |
|
| 151 |
# 7. Cập nhật lịch sử hiển thị (gr.Chatbot)
|
| 152 |
chatbot_display.append([prompt, translated])
|
|
|
|
| 103 |
prompt = prompt.replace(expected_key, "")
|
| 104 |
if lang != None:
|
| 105 |
prompt = translate_text(prompt,lang+"-en")
|
| 106 |
+
print(prompt)
|
| 107 |
# 1. Khởi tạo nếu đây là lần chạy đầu tiên
|
| 108 |
# chatbot_display là [[user_msg, ai_msg], ...]
|
| 109 |
if chatbot_display is None:
|
|
|
|
| 147 |
print(response_text)
|
| 148 |
# 6. Cập nhật "bộ nhớ" (gr.State) với lượt nói MỚI
|
| 149 |
internal_history.append({"role": "user", "content": prompt})
|
| 150 |
+
internal_history.append({"role": "assistant", "content": response_text})
|
| 151 |
|
| 152 |
# 7. Cập nhật lịch sử hiển thị (gr.Chatbot)
|
| 153 |
chatbot_display.append([prompt, translated])
|