File size: 696 Bytes
8773015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import chainlit as cl

@cl.on_chat_start
async def start():
    """
    This function is called when a new chat starts.
    You can use it to initialize any variables or models.
    """
    # Initialize any variables or models here
    await cl.Message(
        content="Welcome to the chatbot! How can I help you today?"
    ).send()

@cl.on_message
async def main(message: str):
    """
    This function is called every time a user inputs a message.
    Args:
        message: The user's message
    """
    # Process the user's message here
    response = f"You said: {message.content}"
    
    # Send a response back to the user
    await cl.Message(
        content=response
    ).send()