ykl7 commited on
Commit
0d66203
·
1 Parent(s): a0baf23

show retrieved documents

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -144,6 +144,15 @@ def retriever(query: str, selected_retriever: str):
144
 
145
  corpus = '\n\n'.join(topk_documents)
146
 
 
 
 
 
 
 
 
 
 
147
  # You could return retrieved info here.
148
  return corpus
149
 
@@ -286,10 +295,6 @@ def main():
286
  if "auto_submit" in st.session_state and st.session_state.auto_submit:
287
  prompt = st.session_state.auto_submit_text
288
 
289
- # Process the message - in this example we just echo it back
290
- # In a real app, you would have more complex logic here
291
- # st.session_state.messages.append({"role": "assistant", "content": f"You said: {prompt}"})
292
-
293
  display_message = prompt + " \n"+ " \n"+ f"Retriever: {selected_retriever}, Reasoner: {selected_reasoner}"
294
  st.session_state.messages.append({"role": "user", "content": prompt})
295
  st.session_state.messages.append({"role": "summary", "content": display_message})
 
144
 
145
  corpus = '\n\n'.join(topk_documents)
146
 
147
+ display_retrieved_documents = f"Retrieved Documents: \n{corpus}"
148
+
149
+ for chunk in display_retrieved_documents.split():
150
+ text += chunk + " "
151
+ time.sleep(0.05)
152
+ # Add a blinking cursor to simulate typing
153
+ placeholder.markdown(text + "▌")
154
+ placeholder.markdown(text)
155
+
156
  # You could return retrieved info here.
157
  return corpus
158
 
 
295
  if "auto_submit" in st.session_state and st.session_state.auto_submit:
296
  prompt = st.session_state.auto_submit_text
297
 
 
 
 
 
298
  display_message = prompt + " \n"+ " \n"+ f"Retriever: {selected_retriever}, Reasoner: {selected_reasoner}"
299
  st.session_state.messages.append({"role": "user", "content": prompt})
300
  st.session_state.messages.append({"role": "summary", "content": display_message})