if (FALSE) { # interactive()
library(shiny)
library(bslib)
library(shinychat)
ui <- page_fillable(
chat_ui("chat", fill = TRUE)
)
server <- function(input, output, session) {
observeEvent(input$chat_user_input, {
# In a real app, this would call out to a chat model or API,
# perhaps using the 'elmer' package.
response <- paste0(
"You said:\n\n",
"",
htmltools::htmlEscape(input$chat_user_input),
""
)
chat_append("chat", response)
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab