These functions are deprecated as of shinychat 0.5.0. Use chat_ui() and
chat_server() instead, pairing them by id as described in Pairing with
chat_server() in chat_ui().
Usage
chat_mod_ui(
id,
...,
client = deprecated(),
messages = NULL,
allow_attachments = TRUE
)
chat_mod_server(
id,
client,
greeting = NULL,
history = TRUE,
bookmark_on_input = lifecycle::deprecated(),
bookmark_on_response = lifecycle::deprecated()
)Arguments
- id
The chat module ID.
- ...
Extra HTML attributes to include on the chat element
- client
Deprecated. The client state is now managed by
chat_server().- messages
Initial messages shown in the chat, used only when
clientdoesn't already contain turns. Passed tomessagesinchat_ui().- allow_attachments
Controls the file-attachment affordance (an attach button, plus clipboard paste and drag-and-drop) in the chat input.
NULL(default) defers tochat_server(), which enables attachments automatically. PassTRUEto accept all supported types (PNG, JPEG, GIF, WebP, PDF, and common text/code files such as Markdown, plain text, CSV, JSON, and source files),FALSEto disable, or a character vector of MIME types to restrict what is accepted (each must be one of the supported types).The shape of
input$<id>_user_inputis determined by this argument, so it is predictable for a given app. When attachments are disabled (the default), it is the typed text as a character string, exactly as before. When attachments are enabled, it is always a list of ellmer ellmer::Content objects (the typed text, if any, followed by one content object per attachment) - a list even when no files were attached. Splice the list into a chat method's...with!!!, e.g.client$stream_async(!!!input$<id>_user_input). (Norlang::inject()is needed: ellmer's chat methods collect...with dynamic dots.)The maximum combined size of all attachments in a single message is controlled globally by the
SHINYCHAT_MAX_ATTACHMENT_SIZEenvironment variable (a raw byte count; defaults to approximately 30 MB). Files that would push the total over this cap are rejected in the browser with a notice.- greeting
See
chat_server().- bookmark_on_input
See
chat_server().- bookmark_on_response
See
chat_server().
Value
chat_mod_ui()returns the UI for a shinychat module.chat_mod_server()returns the value ofchat_server().
Functions
chat_mod_server(): A Shiny module server for chat (deprecated). Usechat_server()instead.