Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,9 +34,9 @@ def chat_fn(message, history, model, system_message, max_tokens, temperature, to
|
|
| 34 |
for messages in response_generator:
|
| 35 |
# 转换 messages 为 Gradio Chatbot 接受的格式
|
| 36 |
chatbot_messages = []
|
| 37 |
-
for msg in messages:
|
| 38 |
-
chatbot_messages.append([msg["content"], msg["role"] == "assistant"])
|
| 39 |
-
yield chatbot_messages, history
|
| 40 |
|
| 41 |
|
| 42 |
def respond(
|
|
|
|
| 34 |
for messages in response_generator:
|
| 35 |
# 转换 messages 为 Gradio Chatbot 接受的格式
|
| 36 |
chatbot_messages = []
|
| 37 |
+
for msg in messages: # messages 现在是 BasicChatHistory 对象,可以直接迭代
|
| 38 |
+
chatbot_messages.append([msg["content"], msg["role"] == "assistant"])
|
| 39 |
+
yield chatbot_messages, history
|
| 40 |
|
| 41 |
|
| 42 |
def respond(
|