Spaces:
Sleeping
Sleeping
JarvisChan630
commited on
Commit
β’
a56857d
1
Parent(s):
41b582a
first commit
Browse files
chat.py
CHANGED
@@ -367,6 +367,7 @@ async def run_workflow(workflow, state):
|
|
367 |
return final_answer
|
368 |
|
369 |
|
|
|
370 |
@cl.on_message
|
371 |
async def main(message: cl.Message):
|
372 |
state: State = cl.user_session.get("state")
|
@@ -376,8 +377,10 @@ async def main(message: cl.Message):
|
|
376 |
loop = asyncio.get_running_loop()
|
377 |
state, response = await loop.run_in_executor(None, agent.run_chainlit, state, message)
|
378 |
|
|
|
379 |
await cl.Message(content=response, author="Jar3dπ©βπ»").send()
|
380 |
|
|
|
381 |
if message.content == "/end":
|
382 |
await cl.Message(
|
383 |
content="This will take some time, probably a good time for a coffee break β...",
|
|
|
367 |
return final_answer
|
368 |
|
369 |
|
370 |
+
# Everytime we sent message
|
371 |
@cl.on_message
|
372 |
async def main(message: cl.Message):
|
373 |
state: State = cl.user_session.get("state")
|
|
|
377 |
loop = asyncio.get_running_loop()
|
378 |
state, response = await loop.run_in_executor(None, agent.run_chainlit, state, message)
|
379 |
|
380 |
+
# Send back to ui user
|
381 |
await cl.Message(content=response, author="Jar3dπ©βπ»").send()
|
382 |
|
383 |
+
# When user want to end
|
384 |
if message.content == "/end":
|
385 |
await cl.Message(
|
386 |
content="This will take some time, probably a good time for a coffee break β...",
|