colin4554 commited on
Commit
f654f89
·
1 Parent(s): e59c60d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -38,7 +38,8 @@ if prompt := st.chat_input("What is up?"):
38
  ],
39
  stream=True,
40
  ):
41
- full_response += (response.choices[0].delta.content or "")
42
- message_placeholder.markdown(full_response + "")
 
43
  message_placeholder.markdown(full_response)
44
  st.session_state.messages.append({"role": "assistant", "content": full_response})
 
38
  ],
39
  stream=True,
40
  ):
41
+ if len(response.choices) > 0:
42
+ full_response += (response.choices[0].delta.content or "")
43
+ message_placeholder.markdown(full_response + "▌")
44
  message_placeholder.markdown(full_response)
45
  st.session_state.messages.append({"role": "assistant", "content": full_response})