hienbm commited on
Commit
3ba8a22
·
verified ·
1 Parent(s): 87b7efa

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -167,5 +167,20 @@ if user_query is not None and find_youtube_links(user_query) != "":
167
  st.write(response)
168
 
169
  st.session_state.chat_history.append(AIMessage(content=response))
170
- else:
171
- st.session_state.chat_history.append(AIMessage(content="Please drop the YouTube link related to the financial market, and I will help you summarize and provide insights."))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  st.write(response)
168
 
169
  st.session_state.chat_history.append(AIMessage(content=response))
170
+
171
+
172
+ if user_query is not None and user_query != "" and find_youtube_links(user_query) == "":
173
+ st.session_state.chat_history.append(HumanMessage(content=user_query))
174
+
175
+ with st.chat_message("Human"):
176
+ st.markdown(user_query)
177
+
178
+ response = get_response(user_query)
179
+
180
+ # Remove any unwanted prefixes from the response
181
+ response = response.replace("AI response:", "").replace("chat response:", "").replace("bot response:", "").strip()
182
+
183
+ with st.chat_message("AI"):
184
+ st.write(response)
185
+
186
+ st.session_state.chat_history.append(AIMessage(content=response))