hienbm commited on
Commit
d1ec332
·
verified ·
1 Parent(s): 4712dc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -80,17 +80,19 @@ def get_response(user_query, chat_history):
80
 
81
  return response
82
 
83
- # Initialize session state
84
- if "chat_history" not in st.session_state:
85
- st.session_state.chat_history = [
86
- AIMessage(content="Hello, how can I help you?"),
87
- ]
 
88
 
89
  # Clear chat history if button is pressed
90
- if st.button("Clear Chat"):
91
- st.session_state.chat_history = [
92
- AIMessage(content="Hello, how can I help you?"),
93
- ]
 
94
 
95
  # Display chat history
96
  for message in st.session_state.chat_history:
 
80
 
81
  return response
82
 
83
+ # Create columns for user input and clear chat button
84
+ input_col, button_col = st.columns([4, 1])
85
+
86
+ # User input
87
+ with input_col:
88
+ user_query = st.chat_input("Type your message here...")
89
 
90
  # Clear chat history if button is pressed
91
+ with button_col:
92
+ if st.button("Clear Chat"):
93
+ st.session_state.chat_history = [
94
+ AIMessage(content="Hello, how can I help you?"),
95
+ ]
96
 
97
  # Display chat history
98
  for message in st.session_state.chat_history: