rcwaterman commited on
Commit
6d0779f
1 Parent(s): f1991f2

Updating message callback

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -256,6 +256,8 @@ async def main(message: cl.Message):
256
  for chunk in agent.stream(
257
  {"messages": HumanMessage(content="Can you compare the most recent financial reports of Microsoft and Nvidia?")},
258
  ):
259
- await msg.stream_token(chunk)
 
 
260
 
261
  await msg.send()
 
256
  for chunk in agent.stream(
257
  {"messages": HumanMessage(content="Can you compare the most recent financial reports of Microsoft and Nvidia?")},
258
  ):
259
+ for key in chunk:
260
+ if key == "agent" and chunk[key].get("messages")[0].content is not None:
261
+ await msg.stream_token(chunk[key].get("messages")[0].content)
262
 
263
  await msg.send()