Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -121,20 +121,21 @@ response_container = st.container()
|
|
121 |
# container for text box
|
122 |
container = st.container()
|
123 |
|
124 |
-
|
125 |
-
with
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
138 |
|
139 |
if st.session_state['generated']:
|
140 |
with response_container:
|
|
|
121 |
# container for text box
|
122 |
container = st.container()
|
123 |
|
124 |
+
while True:
|
125 |
+
with container:
|
126 |
+
with st.form(key='my_form', clear_on_submit=True):
|
127 |
+
user_input = st.text_area("You:", key='input', height=100)
|
128 |
+
submit_button = st.form_submit_button(label='Send')
|
129 |
+
|
130 |
+
if submit_button and user_input:
|
131 |
+
for output in graph.stream([HumanMessage(content=user_input)], config=config):
|
132 |
+
if "__end__" in output:
|
133 |
+
continue
|
134 |
+
# stream() yields dictionaries with output keyed by node name
|
135 |
+
for key, value in output.items():
|
136 |
+
st.session_state['messages'].append({"role": "assistant", "content": value.content})
|
137 |
+
st.session_state['past'].append(user_input)
|
138 |
+
st.session_state['generated'].append(value.content)
|
139 |
|
140 |
if st.session_state['generated']:
|
141 |
with response_container:
|