Skip to content

Commit a571e7b

Browse files
gadenbuiechendaniely
authored andcommitted
fix: No longer need to manually calls session$ns() with shinychat (#10)
1 parent f3e3316 commit a571e7b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

r-package/DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Imports:
2323
purrr,
2424
rlang,
2525
shiny,
26-
shinychat,
26+
shinychat (>= 0.2.0),
2727
whisker,
2828
xtable
2929
Encoding: UTF-8

r-package/R/querychat.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ querychat_server <- function(id, querychat_config) {
175175
append_output <- function(...) {
176176
txt <- paste0(...)
177177
shinychat::chat_append_message(
178-
session$ns("chat"),
178+
"chat",
179179
list(role = "assistant", content = txt),
180180
chunk = TRUE,
181181
operation = "append",
@@ -259,11 +259,11 @@ querychat_server <- function(id, querychat_config) {
259259
# the chat model to see.
260260
if (!is.null(greeting)) {
261261
if (isTRUE(any(nzchar(greeting)))) {
262-
shinychat::chat_append(session$ns("chat"), greeting)
262+
shinychat::chat_append("chat", greeting)
263263
}
264264
} else {
265265
shinychat::chat_append(
266-
session$ns("chat"),
266+
"chat",
267267
chat$stream_async(
268268
"Please give me a friendly greeting. Include a few sample prompts in a two-level bulleted list."
269269
)
@@ -274,7 +274,7 @@ querychat_server <- function(id, querychat_config) {
274274
shiny::observeEvent(input$chat_user_input, {
275275
# Add user message to the chat history
276276
shinychat::chat_append(
277-
session$ns("chat"),
277+
"chat",
278278
chat$stream_async(input$chat_user_input)
279279
)
280280
})

0 commit comments

Comments
 (0)