用于响应来自 Web App 父窗口消息的装饰器。每当收到新的窗口消息时,都会调用被装饰的函数。
来自 Web App 父窗口的消息。
import chainlit as cl @cl.on_window_message def main(message: str): # do something
用于向 Web App 父窗口发送消息的函数。
要发送到 Web App 父窗口的消息。
@cl.on_message async def message(): await cl.send_window_message("Server: Hello from Chainlit")
此页面有帮助吗?