Closed fabian-peschke closed 10 months ago
Found Message now takes id instead of parent_id and is working as expected now in rc2
TaskList and Avatar should work correctly, can you share a snippet of code to reproduce? Message no longer have children, instead a new Step
concept has been introduced.
Opened https://github.com/Chainlit/chainlit/pull/608 to fix the task list and avatars
This is the code the worked before v1 release for the avatar (now with metadata):
@cl.on_chat_start
async def start():
user = user_session.get("user")
user_data = user.metadata
user_image = user_data["image"]
if user_image:
user_image = base64.b64decode(user_image.split(',')[1])
else:
user_image = b" "
await cl.Avatar(
name=user.identifier,
content=user_image
).send()
current_path = os.path.dirname(os.path.abspath(__file__))
await cl.Avatar(
name="XX",
path=f"{current_path}/assets/XX.jpeg"
).send()
This is how the tasklist worked before:
@cl.on_message
async def main(message: cl.Message):
import asyncio
msg = cl.Message(content="Init", author="XX")
await msg.send()
task_list = cl.TaskList(name="Steps")
elements = []
actions = []
status = "Running..."
task_list.status = status
task = cl.Task(title="SOME NAME", status=cl.TaskStatus.READY)
await task_list.add_task(task)
await task_list.send()
await asyncio.sleep(5)
msg.content = "Done"
await msg.send()
task_list.status = "done"
await task_list.send()
If its not possible to append a message to a message how can I give the step a language? Like "python" or something like this?
Here are the pre release docs
Okay this helped me on figuring out the cl.step part like so:
@cl.step
async def handle_debug_info(debug: dict):
current_step = cl.context.current_step
current_step.language = "python"
return "def some_python(x: int)"
Why isn't a syntax like this not possible?:
@cl.step(language="python")
async def handle_debug_info(debug: dict):
return "def some_python(x: int)"
I think I did not want to overload the decorator with all the step field.
When using 1.0.0rc2 there are the following issues:
No bugs in terminal. Are these bugs known or has the implementation changed?