b7f52be4c9
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
22 lines
446 B
Python
22 lines
446 B
Python
import chainlit as cl
|
|
|
|
|
|
@cl.on_chat_start
|
|
async def main():
|
|
await cl.Message("Hello, this is a test message!").send()
|
|
|
|
|
|
@cl.step(type="tool")
|
|
async def tool():
|
|
await cl.sleep(5)
|
|
return "Response from the tool!"
|
|
|
|
|
|
@cl.on_message
|
|
async def on_message(message: cl.Message):
|
|
if message.content == "tool":
|
|
await tool()
|
|
else:
|
|
await cl.sleep(5)
|
|
await cl.Message(f"Received message: {message.content}").send()
|