Skip to content

Commit

Permalink
addin fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielKaiserQFin committed Aug 24, 2024
1 parent f875422 commit d4af405
Show file tree
Hide file tree
Showing 5 changed files with 358 additions and 16 deletions.
1 change: 1 addition & 0 deletions R/APIcall.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
APIcall <- function(prompt, ...) {

args <- list(...)

for (i in names(args)) {
assign(i, args[[i]])
}
Expand Down
2 changes: 1 addition & 1 deletion R/addins.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ execAddin_ask <- function() {
chatResponse <- ask(input$question,
model = input$model,
maxTokens = input$maxTokens,
temperature = input$temperature, returnType = 1
temperature = input$temperature, returnType = 2
)
updateTextAreaInput(session, "response", value = chatResponse)
})
Expand Down
6 changes: 3 additions & 3 deletions R/responseReturn.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' responseReturn
#'
#' @param raw the chatresponse to return
#' @param type Default is 1, which returns the output to the clipboard
#' @param type Default is 3, which returns the output to the clipboard
#' and returns TRUE, type 2 is unchanged and type 3 cats the output.
#'
#' @importFrom clipr read_clip
Expand All @@ -10,13 +10,13 @@
#'
#'
responseReturn <- function(raw, type) {
if (type == 3) {
if (type == 1) {
# Function 'cat' is used to concatenate 'raw' and return the result
return(cat(raw, sep = "\n"))
} else if (type == 2) {
# Here, 'raw' is returned without any modification
return(raw)
} else if (type == 1) {
} else if (type == 3) {
# Here, 'raw' data is written to the clipboard
clipr::write_clip(paste(raw, sep = "\n"), allow_non_interactive = TRUE)
return(TRUE)
Expand Down
Loading

0 comments on commit d4af405

Please sign in to comment.