Life Cycle Hooks
on_chat_start
Hook to react to the user websocket connection event.
Usage
Code Example
from chainlit import AskUserMessage, Message, on_chat_start
@on_chat_start
async def main():
res = await AskUserMessage(content="What is your name?", timeout=30).send()
if res:
await Message(
content=f"Your name is: {res['content']}.\nChainlit installation is working!\nYou can now start building your own chainlit apps!",
).send()
Was this page helpful?