Update main.py
Browse files
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
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
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()
|