ambrosfitz commited on
Commit
65d8d39
·
verified ·
1 Parent(s): 34b2462

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -25,8 +25,9 @@ def predict(message, history):
25
  stream=False # Set to False for simplicity in this example
26
  )
27
 
28
- if response.choices and response.choices[0].text.strip():
29
- response_text = response.choices[0].text.strip()
 
30
  history.append((message, response_text)) # Update history with the new Q&A pair
31
  return response_text
32
  else:
 
25
  stream=False # Set to False for simplicity in this example
26
  )
27
 
28
+ # Ensure response handling is correct
29
+ if response.choices and response.choices[0].message['content']:
30
+ response_text = response.choices[0].message['content'].strip()
31
  history.append((message, response_text)) # Update history with the new Q&A pair
32
  return response_text
33
  else: