Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,15 +76,21 @@ history = []
|
|
76 |
if "history" not in st.session_state:
|
77 |
st.session_state.history = []
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
if st.button("Send"):
|
82 |
-
if user_input:
|
83 |
-
history = st.session_state.history
|
84 |
-
response = get_streamed_response(user_input, history)
|
85 |
-
history.append((user_input, response))
|
86 |
-
st.session_state.history = history
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
if "history" not in st.session_state:
|
77 |
st.session_state.history = []
|
78 |
|
79 |
+
# Create a placeholder for the chat history
|
80 |
+
chat_placeholder = st.container()
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
# Bottom input box
|
83 |
+
user_input = st.text_input("You:", key="user_input")
|
84 |
+
send_button = st.button("Send")
|
85 |
+
|
86 |
+
if send_button and user_input:
|
87 |
+
history = st.session_state.history
|
88 |
+
response = get_streamed_response(user_input, history)
|
89 |
+
history.append((user_input, response))
|
90 |
+
st.session_state.history = history
|
91 |
+
|
92 |
+
# Display chat history
|
93 |
+
with chat_placeholder:
|
94 |
+
for human, assistant in st.session_state.history:
|
95 |
+
st.write(f"You: {human}")
|
96 |
+
st.write(f"notDave: {assistant}")
|