With this PR, the messages parameter of Chat.ui()/chat_ui() becomes the suggested way to provide starting messages. For example:
Express
````python
from shiny import reactive
from shiny.express import ui
chat = ui.Chat(id="chat")
chat.ui(messages=["Hello, how can I help?"])
````
Core
```python
from shiny import App, ui
app_ui = ui.page_fixed(
ui.chat_ui("chat", messages=["Hello, how are you?"]),
)
def server(input, output, session):
pass
app = App(app_ui, server)
```
This PR also reverts #1593 since waiting until flush to send is not an ideal way to support dynamic UI. As a result, this PR also closes #1735.
In the next release, we should deprecate Chat(messages=...) in favor of these new parameters. Deprecating now feels premature since it's still convenient for things like system messages. But, when we move towards recommending chatlas/LangChain for managing chat state in a future release, we'll deprecate as a part of that move.
With this PR, the
messages
parameter ofChat.ui()
/chat_ui()
becomes the suggested way to provide starting messages. For example:Express
````python from shiny import reactive from shiny.express import ui chat = ui.Chat(id="chat") chat.ui(messages=["Hello, how can I help?"]) ````Core
```python from shiny import App, ui app_ui = ui.page_fixed( ui.chat_ui("chat", messages=["Hello, how are you?"]), ) def server(input, output, session): pass app = App(app_ui, server) ```This PR also reverts #1593 since waiting until flush to send is not an ideal way to support dynamic UI. As a result, this PR also closes #1735.
In the next release, we should deprecate
Chat(messages=...)
in favor of these new parameters. Deprecating now feels premature since it's still convenient for things like system messages. But, when we move towards recommendingchatlas
/LangChain
for managing chat state in a future release, we'll deprecate as a part of that move.