Spaces:
Sleeping
Sleeping
hashirehtisham
commited on
Commit
•
cc26619
1
Parent(s):
77c3c83
Update app.py
Browse files
app.py
CHANGED
@@ -110,10 +110,14 @@ if prompt := st.chat_input("What legal question or issue do you need help with?"
|
|
110 |
if response.choices and response.choices[0].message:
|
111 |
full_response = response.choices[0].message.content
|
112 |
|
|
|
|
|
|
|
|
|
113 |
# Stream the full response to the chat using st.write
|
114 |
with st.chat_message("assistant"):
|
115 |
st.markdown(full_response)
|
116 |
|
117 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
118 |
except Exception as e:
|
119 |
-
st.error(f"An error occurred: {e}")
|
|
|
110 |
if response.choices and response.choices[0].message:
|
111 |
full_response = response.choices[0].message.content
|
112 |
|
113 |
+
# Ensure the response does not include 'User:'
|
114 |
+
if full_response.endswith('User:'):
|
115 |
+
full_response = full_response.replace('User:', '').strip()
|
116 |
+
|
117 |
# Stream the full response to the chat using st.write
|
118 |
with st.chat_message("assistant"):
|
119 |
st.markdown(full_response)
|
120 |
|
121 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
122 |
except Exception as e:
|
123 |
+
st.error(f"An error occurred: {e}")
|