arthurcarvalho commited on
Commit
d68b67d
·
verified ·
1 Parent(s): d44a3e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -39,8 +39,10 @@ if prompt := st.chat_input("How can I help you today?"):
39
  ],
40
  stream=True,
41
  ):
42
- full_response += response.output_text.delta.replace('\\$','$').replace('$','\\$')
43
- message_placeholder.markdown(full_response + "▌")
 
 
44
  message_placeholder.markdown(full_response)
45
  print(full_response)
46
  st.session_state.messages.append({"role": "assistant", "content": full_response})
 
39
  ],
40
  stream=True,
41
  ):
42
+ for chunk in response:
43
+ if chunk.choices[0].delta.content is not None:
44
+ full_response += chunk.choices[0].delta.content.replace('\\$','$').replace('$','\\$')
45
+ message_placeholder.markdown(full_response + "▌")
46
  message_placeholder.markdown(full_response)
47
  print(full_response)
48
  st.session_state.messages.append({"role": "assistant", "content": full_response})