Image 类用于创建和处理要在聊天机器人用户界面中发送和显示的图像元素。
Image
您必须提供 URL、路径或内容字节之一。
要在用户界面中显示的图像名称。
确定图像元素在用户界面中的显示方式。选项包括:“侧边”、“内联”或“页面”。
确定图像的大小。仅在 display=“inline” 时有效。选项包括:“小”、“中”(默认)或“大”。
图像源的远程 URL。
图像的本地文件路径。
图像的文件内容(字节格式)。
import chainlit as cl @cl.on_chat_start async def start(): image = cl.Image(path="./cat.jpeg", name="image1", display="inline") # Attach the image to the message await cl.Message( content="This message has an image!", elements=[image], ).send()
此页面有帮助吗?