valeriylo commited on
Commit
8b4f654
1 Parent(s): c9cf861

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -81,21 +81,19 @@ def handle_userinput(user_question):
81
 
82
  st.session_state.retrieved_text = response['source_documents'][0]
83
 
84
- for i, message in enumerate(st.session_state.chat_history):
85
  if i % 2 == 0:
86
  st.write(user_template.replace(
87
  "{{MSG}}", message.content), unsafe_allow_html=True)
88
- else:
89
- st.write(bot_template.replace(
90
- "{{MSG}}", message.content), unsafe_allow_html=True)
91
-
92
- for i, message in enumerate(st.session_state.retrieved_text):
93
- if i % 2 == 0:
94
  st.write(user_template.replace(
95
- "{{MSG}}", message.content), unsafe_allow_html=True)
 
96
  else:
97
  st.write(bot_template.replace(
98
  "{{MSG}}", message.content), unsafe_allow_html=True)
 
 
 
99
 
100
 
101
  # main code
 
81
 
82
  st.session_state.retrieved_text = response['source_documents'][0]
83
 
84
+ for i, (message, text) in enumerate(zip(st.session_state.chat_history, st.session_state.retrieved_text):
85
  if i % 2 == 0:
86
  st.write(user_template.replace(
87
  "{{MSG}}", message.content), unsafe_allow_html=True)
 
 
 
 
 
 
88
  st.write(user_template.replace(
89
+ "{{MSG}}", text.content), unsafe_allow_html=True)
90
+
91
  else:
92
  st.write(bot_template.replace(
93
  "{{MSG}}", message.content), unsafe_allow_html=True)
94
+ st.write(bot_template.replace(
95
+ "{{MSG}}", text.content), unsafe_allow_html=True)
96
+
97
 
98
 
99
  # main code