Spaces:
Runtime error
Runtime error
justest
commited on
Commit
·
06b90de
1
Parent(s):
2c8f8ad
update
Browse files
app.py
CHANGED
@@ -137,15 +137,10 @@ with gr.Blocks() as demo:
|
|
137 |
"""
|
138 |
|
139 |
messages = []
|
140 |
-
for user_message, assistant_message in history[1
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
assistant_dict = {"role": "assistant", "content": assistant_message}
|
145 |
-
|
146 |
-
# 把用户和助理的消息字典依次添加到 chatgpt_history 中
|
147 |
-
messages.append(user_dict)
|
148 |
-
messages.append(assistant_dict)
|
149 |
|
150 |
bot_msg = g4f.ChatCompletion.create(
|
151 |
model=model_name,
|
|
|
137 |
"""
|
138 |
|
139 |
messages = []
|
140 |
+
for user_message, assistant_message in history[1:-1]:
|
141 |
+
messages.append({"role": "user", "content": user_message})
|
142 |
+
messages.append({"role": "assistant", "content": assistant_message})
|
143 |
+
messages.append({"role": "user", "content": history[-1, 0]})
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
bot_msg = g4f.ChatCompletion.create(
|
146 |
model=model_name,
|