Leiyan525 commited on
Commit
f048aa1
·
1 Parent(s): 2ea8b8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -31,8 +31,10 @@ def respond(openai_apikey, chat_history):
31
  messages=re_messages,
32
  temperature=0.7
33
  )
34
-
35
- chat_history[-1][1] = ""
 
 
36
  for re_chunk in re_chat_completion.choices:
37
  chat_history[-1][1] += re_chunk.delta.get("content", "")
38
 
 
31
  messages=re_messages,
32
  temperature=0.7
33
  )
34
+ if not chat_history:
35
+ chat_history.apend([','])
36
+ if chat_history[-1][1] is None:
37
+ chat_history[-1][1] = ""
38
  for re_chunk in re_chat_completion.choices:
39
  chat_history[-1][1] += re_chunk.delta.get("content", "")
40