Files
wehub-resource-sync b7f52be4c9
CI / Run CI (push) Has been cancelled
CI / check-backend (push) Has been cancelled
CI / check-frontend (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / e2e-tests (push) Has been cancelled
Copilot Setup Steps / copilot-setup-steps (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:48:47 +08:00

42 lines
1.1 KiB
Python

import os
import chainlit as cl
# Get the directory where the current script is located
current_directory = os.path.dirname(os.path.abspath(__file__))
# Construct the absolute path to the fixtures directory (two levels up from current_dir)
fixtures_directory = os.path.abspath(
os.path.join(current_directory, "..", "..", "fixtures")
)
# Construct the absolute path to the image file
cat_image_path = os.path.join(fixtures_directory, "cat.jpeg")
@cl.on_chat_start
async def start():
step_image = cl.Image(
name="image1",
path=cat_image_path,
)
msg_image = cl.Image(
name="image1",
path=cat_image_path,
)
async with cl.Step(type="tool", name="tool1") as step:
step.elements = [
step_image,
cl.Image(name="image2", path=cat_image_path),
]
step.output = "This step has an image"
await cl.Message(
content="This message has an image",
elements=[
msg_image,
cl.Image(name="image2", path=cat_image_path),
],
).send()
await msg_image.remove()
await step_image.remove()