olamidegoriola pvanand commited on
Commit
d8b04f9
1 Parent(s): 11182eb

Fix bot response from openai (#13)

Browse files

- Fix bot response from openai (890b409992370ce5e0352ed7cae6fe0fc6f8cda5)


Co-authored-by: Anand <[email protected]>

Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -31,7 +31,12 @@ if user_input := st.chat_input("What is up?"):
31
 
32
  # Extract assistant response
33
  if bot_reply !=[]:
34
- assistant_response = bot_reply[0]["text"]
 
 
 
 
 
35
  else:
36
  assistant_response = 'API request returned with an empty list []. Please continue with a different question'
37
 
 
31
 
32
  # Extract assistant response
33
  if bot_reply !=[]:
34
+ assistant_response = ""
35
+ if len(bot_reply)>1:
36
+ for reply in bot_reply[1:]:
37
+ assistant_response+=(" "+reply['text'])
38
+ else:
39
+ assistant_response = bot_reply[0]['text']
40
  else:
41
  assistant_response = 'API request returned with an empty list []. Please continue with a different question'
42