Skip to content
2 changes: 1 addition & 1 deletion pkg-r/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: shinychat
Title: Chat UI Component for 'shiny'
Version: 0.2.0.9000
Version: 0.3.0
Authors@R: c(
person("Joe", "Cheng", , "[email protected]", role = "aut"),
person("Carson", "Sievert", , "[email protected]", role = "aut"),
Expand Down
8 changes: 5 additions & 3 deletions pkg-r/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# shinychat (development version)
# shinychat 0.3.0

## Breaking changes

* `chat_mod_server()` now returns a list of reactives for `last_input` and `last_turn`, as well functions to `update_user_input()`, `append()` and `clear()` the chat. (#130, #143, #145)

## New features

Expand All @@ -10,8 +14,6 @@

* Added `chat_append(icon=...)` and `chat_ui(icon_assistant=...)` for customizing the icon that appears next to assistant responses. (#88)

* `chat_mod_server()` now returns a list of reactives for `last_input` and `last_turn`, as well functions to `update_user_input()`, `append()` and `clear()` the chat. (#130, #143, #145)

## Improvements

* `chat_app()` now correctly restores the chat client state when refreshing the app, e.g. by reloading the page. (#71)
Expand Down
2 changes: 1 addition & 1 deletion pkg-r/R/contents_shinychat.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ opt_shinychat_tool_display <- function() {
#' Note that you do **not** need to create a new class or extend
#' `contents_shinychat()` to customize the tool display. Rather, you can use the
#' strategies discussed in the [Tool Calling UI
#' article](https://posit-dev.github.io/shinychat/r/article/tool-ui.html) to
#' article](https://posit-dev.github.io/shinychat/r/articles/tool-ui.html) to
#' customize the tool request and result display by providing a `display` list
#' in the `extra` argument of the tool result.
#'
Expand Down
3 changes: 1 addition & 2 deletions pkg-r/R/shinychat-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ ignore_unused_imports <- function() {

release_bullets <- function() {
c(
"Check that shinychat js assets are up-to-date (`make js-build && make r-update-dist`)",
"Set `development.mode: auto` in `pkg-r/pkgdown/_pkgdown.yml` and remove this release bullet."
"Check that shinychat js assets are up-to-date (`make js-build && make r-update-dist`)"
)
}
2 changes: 1 addition & 1 deletion pkg-r/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ shinyApp(ui, server)

## Next steps

Ready to start building a chatbot with shinychat? See [Get Started](articles/get-started.html) to learn more.
Ready to start building a chatbot with shinychat? See [Get Started](https://posit-dev.github.io/shinychat/r/articles/get-started.html) to learn more.
2 changes: 1 addition & 1 deletion pkg-r/cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## revdepcheck results

We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 3 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
2 changes: 1 addition & 1 deletion pkg-r/man/contents_shinychat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg-r/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ url: https://posit-dev.github.io/shinychat/r
destination: "../docs/r"

development:
mode: release
mode: auto

authors:
Posit Software, PBC:
Expand Down Expand Up @@ -62,3 +62,8 @@ reference:
- title: Integration with ellmer
contents:
- contents_shinychat

news:
releases:
- text: "v0.3.0"
href: https://shiny.posit.co/blog/posts/shinychat-tool-ui/
2 changes: 1 addition & 1 deletion pkg-r/revdep/cran.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## revdepcheck results

We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 3 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
Expand Down
30 changes: 13 additions & 17 deletions pkg-r/tests/testthat/test-contents_shinychat.R
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ test_that("tool_result_display rich format", {

test_that("processes a Turn object", {
# Create a turn with multiple content items
turn <- ellmer::Turn(
role = "assistant",
turn <- ellmer::AssistantTurn(
contents = list(
ellmer::ContentText("Hello"),
new_tool_request(),
Expand All @@ -361,15 +360,14 @@ test_that("processes a Turn object", {
})

test_that("consolidates adjacent turn types in a Chat object", {
chat <- ellmer::chat_openai(api_key = "boop")
withr::local_options(OPENAI_API_KEY = "boop")
chat <- ellmer::chat_openai()

chat$set_turns(list(
ellmer::Turn(
role = "assistant",
ellmer::AssistantTurn(
contents = list(ellmer::ContentText("Hello"))
),
ellmer::Turn(
role = "assistant",
ellmer::AssistantTurn(
contents = list(ellmer::ContentText("World"))
)
))
Expand All @@ -381,15 +379,14 @@ test_that("consolidates adjacent turn types in a Chat object", {
})

test_that("doesn't consolidate adjacent turns with different roles in a Chat object", {
chat <- ellmer::chat_openai(api_key = "boop")
withr::local_options(OPENAI_API_KEY = "boop")
chat <- ellmer::chat_openai()

chat$set_turns(list(
ellmer::Turn(
role = "user",
ellmer::UserTurn(
contents = list(ellmer::ContentText("Question"))
),
ellmer::Turn(
role = "assistant",
ellmer::AssistantTurn(
contents = list(ellmer::ContentText("Answer"))
)
))
Expand All @@ -401,18 +398,17 @@ test_that("doesn't consolidate adjacent turns with different roles in a Chat obj
})

test_that("drops requests and moves results to assistant turn role in a Chat object", {
chat <- ellmer::chat_openai(api_key = "boop")
withr::local_options(OPENAI_API_KEY = "boop")
chat <- ellmer::chat_openai()

chat$set_turns(list(
ellmer::Turn(
role = "assistant",
ellmer::AssistantTurn(
contents = list(
ellmer::ContentText("Hello"),
new_tool_request()
)
),
ellmer::Turn(
role = "user",
ellmer::UserTurn(
contents = list(
new_tool_result(value = "success")
)
Expand Down