Spaces:
Runtime error
Runtime error
Commit
·
c3572db
1
Parent(s):
09f2e2a
to fix the bug when NoneType occur at the end of prompt response
Browse files- streamlit_app.py +3 -2
streamlit_app.py
CHANGED
|
@@ -71,8 +71,9 @@ if st.session_state.messages[-1]["role"] != "assistant":
|
|
| 71 |
placeholder = st.empty()
|
| 72 |
full_response = ''
|
| 73 |
for chunk in response:
|
| 74 |
-
|
| 75 |
-
|
|
|
|
| 76 |
placeholder.markdown(full_response)
|
| 77 |
message = {"role": "assistant", "content": full_response}
|
| 78 |
st.session_state.messages.append(message)
|
|
|
|
| 71 |
placeholder = st.empty()
|
| 72 |
full_response = ''
|
| 73 |
for chunk in response:
|
| 74 |
+
if chunk.choices[0].delta.content is not None:
|
| 75 |
+
full_response += chunk.choices[0].delta.content
|
| 76 |
+
placeholder.markdown(full_response)
|
| 77 |
placeholder.markdown(full_response)
|
| 78 |
message = {"role": "assistant", "content": full_response}
|
| 79 |
st.session_state.messages.append(message)
|