AIRider commited on
Commit
af9bced
·
verified ·
1 Parent(s): 6158aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -47,15 +47,10 @@ def respond(
47
  stream=True,
48
  )
49
  partial_message = ""
50
- for response in stream:
51
- if response.token.special:
52
- continue
53
- partial_message += response.token.text
54
- chat_history = chat_history + [(message, partial_message)]
55
- yield chat_history
56
- except Exception as e:
57
- error_message = f"An error occurred: {str(e)}"
58
- chat_history.append((message, error_message))
59
  yield chat_history
60
 
61
  def clear_conversation():
 
47
  stream=True,
48
  )
49
  partial_message = ""
50
+ for response in stream:
51
+ if response.choices[0].delta.content is not None:
52
+ partial_message += response.choices[0].delta.content
53
+ chat_history = chat_history[:-1] + [(message, partial_message)]
 
 
 
 
 
54
  yield chat_history
55
 
56
  def clear_conversation():