datacipen commited on
Commit
2ea2763
1 Parent(s): 9e7c5d1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -8
main.py CHANGED
@@ -156,13 +156,14 @@ async def on_message(message: cl.Message):
156
  cl.Text(name="Sources", content=sources_text, display="inline")
157
  )
158
 
159
- async for chunk in runnable.astream(
160
- message.content,
161
- config=RunnableConfig(callbacks=[
162
- cl.LangchainCallbackHandler(),
163
- PostMessageHandler(msg)
164
- ]),
165
- ):
166
- await msg.stream_token(chunk)
 
167
 
168
  await msg.send()
 
156
  cl.Text(name="Sources", content=sources_text, display="inline")
157
  )
158
 
159
+ async with cl.Step(type="run", name="QA Assistant"):
160
+ async for chunk in runnable.astream(
161
+ message.content,
162
+ config=RunnableConfig(callbacks=[
163
+ cl.LangchainCallbackHandler(),
164
+ PostMessageHandler(msg)
165
+ ]),
166
+ ):
167
+ await msg.stream_token(chunk)
168
 
169
  await msg.send()