Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,11 +32,14 @@ def chat_fn(message, history, model, system_message, max_tokens, temperature, to
|
|
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 |
-
#
|
36 |
chatbot_messages = []
|
37 |
-
for
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
|
41 |
|
42 |
def respond(
|
|
|
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 |
+
# 将历史消息直接转换为 Gradio Chatbot 格式
|
36 |
chatbot_messages = []
|
37 |
+
for user_msg, assistant_msg in messages:
|
38 |
+
if user_msg: # 添加用户消息
|
39 |
+
chatbot_messages.append([user_msg, False])
|
40 |
+
if assistant_msg: # 添加助手消息
|
41 |
+
chatbot_messages.append([assistant_msg, True])
|
42 |
+
yield chatbot_messages, messages
|
43 |
|
44 |
|
45 |
def respond(
|