Update app.py
Browse files
app.py
CHANGED
@@ -242,12 +242,13 @@ async def text_mode():
|
|
242 |
print('messages:', st.session_state['messages'])
|
243 |
for response in openai.ChatCompletion.create(
|
244 |
model=st.session_state["openai_model"],
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
251 |
stream=True,
|
252 |
):
|
253 |
full_response += response.choices[0].delta.get(
|
|
|
242 |
print('messages:', st.session_state['messages'])
|
243 |
for response in openai.ChatCompletion.create(
|
244 |
model=st.session_state["openai_model"],
|
245 |
+
messages=[
|
246 |
+
{"role": m["role"], "content": m["content"]}
|
247 |
+
for m in st.session_state.messages
|
248 |
+
], ## 这里是多轮会话。
|
249 |
+
stream=True,
|
250 |
+
# messages=[{'role': 'system', 'content': 'you are ChatGPT'}, {
|
251 |
+
# 'role': 'user', 'content': prompt}], ## 这里是单轮会话。
|
252 |
stream=True,
|
253 |
):
|
254 |
full_response += response.choices[0].delta.get(
|