ageraustine commited on
Commit
13ac208
·
verified ·
1 Parent(s): 23a1fa8

Update app.py

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