Artin2009 commited on
Commit
9fe4dc7
1 Parent(s): 8ea287e

Update chain_app.py

Browse files
Files changed (1) hide show
  1. chain_app.py +6 -3
chain_app.py CHANGED
@@ -2611,13 +2611,16 @@ async def main(message: cl.Message):
2611
  # await cl.Message(
2612
  # content=result.choices[0].message.content,
2613
  # ).send()
2614
- async for message in client.chat_completion(
 
2615
  messages=[{"role": "user", "content": "What is the capital of France?"}],
2616
  max_tokens=500,
2617
  stream=True,
2618
  ):
2619
- if message := part.choices[0].delta.content or "":
2620
- await msg.stream_token(message)
 
 
2621
 
2622
 
2623
  # elif chat_profile == 'Toka-353M':
 
2611
  # await cl.Message(
2612
  # content=result.choices[0].message.content,
2613
  # ).send()
2614
+ tokens_list = []
2615
+ for message in client.chat_completion(
2616
  messages=[{"role": "user", "content": "What is the capital of France?"}],
2617
  max_tokens=500,
2618
  stream=True,
2619
  ):
2620
+ tokens_list.append(message)
2621
+ async for token in tokens_list:
2622
+ if token != "":
2623
+ await msg.stream_token(token)
2624
 
2625
 
2626
  # elif chat_profile == 'Toka-353M':