posit-dev / py-shiny

Shiny for Python
https://shiny.posit.co/py/
MIT License
1.32k stars 81 forks source link

Follow up to #1736: correct markup generation for user role messages #1737

Closed cpsievert closed 1 month ago

cpsievert commented 1 month ago

Follow up to #1736: fixes markup generation for user startup messages:

from shiny.express import ui

chat = ui.Chat(id="chat")

chat.ui(
    messages=[
        {"content": "Foo", "role": "assistant"},
        {"content": "Bar", "role": "user"},
        {"content": "Baz", "role": "assistant"},
    ]
)

Before

Screenshot 2024-10-15 at 4 08 11 PM

After

Screenshot 2024-10-15 at 4 07 43 PM