allinaigc commited on
Commit
d7fc873
·
1 Parent(s): ee9c9ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
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
- # messages=[
246
- # {"role": m["role"], "content": m["content"]}
247
- # for m in st.session_state.messages
248
- # ],
249
- messages=[{'role': 'system', 'content': 'you are ChatGPT'}, {
250
- 'role': 'user', 'content': prompt}],
 
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(