Decorator to react to messages coming from the UI. The decorated function is called every time a new message is received.

Parameters

message
cl.Message

The message coming from the UI.

Usage

import chainlit as cl

@cl.on_message
def main(message: cl.Message):
  content = message.content
  # do something