nickmuchi commited on
Commit
925f238
β€’
1 Parent(s): 883ae12

Update pages/3_Earnings_Semantic_Search_πŸ”Ž_.py

Browse files
pages/3_Earnings_Semantic_Search_πŸ”Ž_.py CHANGED
@@ -113,12 +113,7 @@ try:
113
  if "messages" not in st.session_state or st.sidebar.button("Clear message history"):
114
  st.session_state["messages"] = [AIMessage(content=starter_message)]
115
 
116
- for msg in st.session_state.messages:
117
- if isinstance(msg, AIMessage):
118
- st.chat_message("assistant").write(msg.content)
119
- elif isinstance(msg, HumanMessage):
120
- st.chat_message("user").write(msg.content)
121
- memory.chat_memory.add_message(msg)
122
 
123
  if user_question := st.chat_input(placeholder=starter_message):
124
  st.chat_message("user").write(user_question)
@@ -128,6 +123,13 @@ try:
128
  st_callback = StreamlitCallbackHandler(st.container())
129
 
130
  memory, agent_executor = create_memory_and_agent(user_question,docsearch)
 
 
 
 
 
 
 
131
 
132
  response = agent_executor(
133
  {"input": user_question, "history": st.session_state.messages},
 
113
  if "messages" not in st.session_state or st.sidebar.button("Clear message history"):
114
  st.session_state["messages"] = [AIMessage(content=starter_message)]
115
 
116
+
 
 
 
 
 
117
 
118
  if user_question := st.chat_input(placeholder=starter_message):
119
  st.chat_message("user").write(user_question)
 
123
  st_callback = StreamlitCallbackHandler(st.container())
124
 
125
  memory, agent_executor = create_memory_and_agent(user_question,docsearch)
126
+
127
+ for msg in st.session_state.messages:
128
+ if isinstance(msg, AIMessage):
129
+ st.chat_message("assistant").write(msg.content)
130
+ elif isinstance(msg, HumanMessage):
131
+ st.chat_message("user").write(msg.content)
132
+ memory.chat_memory.add_message(msg)
133
 
134
  response = agent_executor(
135
  {"input": user_question, "history": st.session_state.messages},