From f0cc5752e8c21e494f6fdaf608c3bed96a49aaf4 Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Tue, 15 Oct 2024 16:41:27 -0500 Subject: [PATCH] Follow up to #1736: correct markup generation for user role messages (#1737) --- shiny/ui/_chat.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shiny/ui/_chat.py b/shiny/ui/_chat.py index e388ab47f..0a1a9b187 100644 --- a/shiny/ui/_chat.py +++ b/shiny/ui/_chat.py @@ -1084,9 +1084,12 @@ def chat_ui( else: raise ValueError("Each message must be a string or a dictionary.") - message_tags.append( - Tag("shiny-chat-message", content=msg["content"], role=msg["role"]) - ) + if msg["role"] == "user": + tag_name = "shiny-user-message" + else: + tag_name = "shiny-chat-message" + + message_tags.append(Tag(tag_name, content=msg["content"])) res = Tag( "shiny-chat-container",