captain-awesome commited on
Commit
885ec28
1 Parent(s): d0e7841

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -6,17 +6,14 @@ def get_response(user_input):
6
  return "I dont know"
7
 
8
 
9
-
10
-
11
-
12
-
13
-
14
  st.set_page_config(page_title= "Chat with Websites", page_icon="🤖")
15
-
16
  st.title("Chat with Websites")
17
- chat_history = [
 
 
 
18
  AIMessage(content = "Hello, I am a bot. How can I help you"),
19
-
20
  ]
21
 
22
 
@@ -29,8 +26,8 @@ with st.sidebar:
29
  user_query = st.chat_input("Type your message here...")
30
  if user_query is not None and user_query !="":
31
  response = get_response(user_query)
32
- chat_history.append(HumanMessage(content=user_query))
33
- chat_history.append(AIMessageMessage(content=response))
34
 
35
 
36
 
 
6
  return "I dont know"
7
 
8
 
9
+ # app config
 
 
 
 
10
  st.set_page_config(page_title= "Chat with Websites", page_icon="🤖")
 
11
  st.title("Chat with Websites")
12
+
13
+
14
+ if "chat_history" not in st.session_state:
15
+ st.session_state.chat_history = [
16
  AIMessage(content = "Hello, I am a bot. How can I help you"),
 
17
  ]
18
 
19
 
 
26
  user_query = st.chat_input("Type your message here...")
27
  if user_query is not None and user_query !="":
28
  response = get_response(user_query)
29
+ st.session_state.chat_history .append(HumanMessage(content=user_query))
30
+ st.session_state.chat_history .append(AIMessageMessage(content=response))
31
 
32
 
33