Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,10 +27,10 @@ def build_prompt(history, new_message):
|
|
| 27 |
return prompt
|
| 28 |
|
| 29 |
def chat(history, new_message):
|
| 30 |
-
#
|
| 31 |
if isinstance(history, str):
|
|
|
|
| 32 |
try:
|
| 33 |
-
import ast
|
| 34 |
history = ast.literal_eval(history)
|
| 35 |
except:
|
| 36 |
history = [history]
|
|
|
|
| 27 |
return prompt
|
| 28 |
|
| 29 |
def chat(history, new_message):
|
| 30 |
+
# Đảm bảo history là list (khi nhập trực tiếp trên UI đôi khi là str)
|
| 31 |
if isinstance(history, str):
|
| 32 |
+
import ast
|
| 33 |
try:
|
|
|
|
| 34 |
history = ast.literal_eval(history)
|
| 35 |
except:
|
| 36 |
history = [history]
|