Skip to content

Commit

Permalink
Tweak suggested shiny app code
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Dec 17, 2024
1 parent 9f9b0fb commit e2a1a15
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/web-apps.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ Using Shiny's [`ui.Chat` component](https://shiny.posit.co/py/components/display
from chatlas import ChatAnthropic
from shiny.express import ui

chat_ui = ui.Chat(
chat = ui.Chat(
id="ui_chat",
messages=["Hi! How can I help you today?"],
)
chat_ui.ui()
chat.ui()

chat = ChatAnthropic()
chat_model = ChatAnthropic()

@chat_ui.on_user_submit
async def _():
response = chat.stream(chat_ui.user_input())
await chat_ui.append_message_stream(response)
async def handle_user_input():
response = chat_model.stream(chat.user_input())
await chat.append_message_stream(response)
```

## Streamlit
Expand Down

0 comments on commit e2a1a15

Please sign in to comment.