Closed
Description
Component
UI (ui.*)
Severity
P2 - Medium (workaround exists)
Shiny Version
1.3.1
Python Version
3.11
Minimal Reproducible Example
from shiny import App, ui
from typing import Any
# Create a custom message type that won't be recognized by any normalizer
class CustomMessage:
def __init__(self, content):
self.content = content
app_ui = ui.page_fillable(
ui.panel_title("Custom Normalizer Example"),
ui.chat_ui("chat"),
fillable_mobile=True,
)
def server(input, output, session):
chat = ui.Chat(id="chat")
@chat.on_user_submit
async def _():
# This will trigger the error with incorrect guidance
custom_msg = CustomMessage("Hello")
await chat.append_message(custom_msg) # Will raise error with incorrect guidance
app = App(app_ui, server)
Behavior
Current: When a user tries to use a message type that doesn't have a registered normalizer, the error message suggests registering a custom normalizer via shiny.ui._chat_types.registry.register()
, which doesn't exist.
Expected: The error message should direct users to the correct path: shiny.ui._chat_normalize.message_normalizer_registry.register()
.
Error Messages (if any)
ValueError: Could not find a normalizer for message of type <class '__main__.CustomMessage'>: <__main__.CustomMessage object at 0x7f8c1d3e5f90>.
Consider registering a custom normalizer via shiny.ui._chat_types.registry.register()
Environment
MacOS