-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from jcrodriguez1989/feature.jcr.allow_multipl…
…e_chat_sessions Feature: Allow multiple chat sessions
- Loading branch information
Showing
7 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#' Get Chat Session | ||
#' | ||
#' @param session_id The ID of the session to be used. If `NULL`, it will return an empty session. | ||
#' | ||
get_chat_session <- function(session_id = "1") { | ||
default_session <- list(list(role = "system", content = "You are a helpful assistant.")) | ||
if (is.null(session_id)) { | ||
return(default_session) | ||
} | ||
session <- get("chat_session_messages", envir = .state)[[as.character(session_id)]] | ||
# If the session was not found, then it's a new (default) session. | ||
if (is.null(session)) { | ||
session <- default_session | ||
} | ||
session | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.