Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,10 +31,12 @@ def chat_fn(message, history, model, system_message, max_tokens, temperature, to
|
|
31 |
history_list = history or []
|
32 |
response_generator = respond(message, history_list, model, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty)
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
38 |
|
39 |
|
40 |
def respond(
|
|
|
31 |
history_list = history or []
|
32 |
response_generator = respond(message, history_list, model, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty)
|
33 |
|
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 # yield 正确格式的消息列表
|
40 |
|
41 |
|
42 |
def respond(
|