sabssag commited on
Commit
08af185
1 Parent(s): 5eeaec9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -46,13 +46,14 @@ if submit and input_text:
46
  st.session_state['chat_history'].append(("You", input_text))
47
 
48
  st.subheader("The Response is")
49
- if isinstance(response, str): # Handle cases where response might be a string
 
 
 
 
 
50
  st.write(response)
51
  st.session_state['chat_history'].append(("Bot", response))
52
- else:
53
- for chunk in response:
54
- st.write(chunk.text)
55
- st.session_state['chat_history'].append(("Bot", chunk.text))
56
 
57
  st.subheader("The Chat History is")
58
  for role, text in st.session_state['chat_history']:
 
46
  st.session_state['chat_history'].append(("You", input_text))
47
 
48
  st.subheader("The Response is")
49
+ # If the response is a list of chunks, combine them into a single string
50
+ if isinstance(response, list):
51
+ full_response = " ".join([chunk.text for chunk in response])
52
+ st.write(full_response)
53
+ st.session_state['chat_history'].append(("Bot", full_response))
54
+ else:
55
  st.write(response)
56
  st.session_state['chat_history'].append(("Bot", response))
 
 
 
 
57
 
58
  st.subheader("The Chat History is")
59
  for role, text in st.session_state['chat_history']: