posit-dev / py-shiny-site

The documentation website for Shiny for Python
https://shiny.posit.co/py/
MIT License
17 stars 17 forks source link

chat.ui not works #190

Closed williamlizarazo closed 3 months ago

williamlizarazo commented 4 months ago

AttributeError: module 'shiny.ui' has no attribute 'chat_ui'

gadenbuie commented 4 months ago

There's an example here that you can follow:

from shiny.express import ui

ui.page_opts(
    title="Hello Shiny Chat",
    fillable=True,
    fillable_mobile=True,
)

# Create a chat instance and display it
chat = ui.Chat(id="chat")  
chat.ui()  

# Define a callback to run when the user submits a message
@chat.on_user_submit  
async def _():  
    # Simply echo the user's input back to them
    await chat.append_message(f"You said: {chat.user_input()}")