Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Imports:
data.table,
futile.logger,
httr2,
rlang,
shiny,
shinyAce,
shinyjs,
Expand All @@ -29,6 +30,6 @@ Suggests:
rmarkdown
Remotes:
ollamar=hauselin/ollama-r@v1.2.2
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
URL: https://pandora-isomemo.github.io/llmModule/
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ghcr.io/pandora-isomemo/base-image:latest
FROM inwt/r-shiny:4.3.2

RUN echo "options(repos = c(getOption('repos'), PANDORA = 'https://Pandora-IsoMemo.github.io/drat/'))" >> /usr/local/lib/R/etc/Rprofile.site

ADD . .

Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ importFrom(httr2,req_perform)
importFrom(httr2,req_timeout)
importFrom(httr2,request)
importFrom(httr2,resp_body_json)
importFrom(rlang,"%||%")
importFrom(shinyAce,aceEditor)
importFrom(shinyAce,updateAceEditor)
importFrom(shinyTools,shinyTryCatch)
Expand Down
1 change: 1 addition & 0 deletions R/00-Namespace.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#'
#' @importFrom data.table data.table rbindlist
#' @importFrom httr2 req_body_json req_headers req_perform req_timeout request resp_body_json
#' @importFrom rlang %||%
#' @importFrom shinyAce aceEditor updateAceEditor
#' @importFrom shinyjs disable enable
#' @importFrom shinyTools shinyTryCatch
Expand Down
10 changes: 6 additions & 4 deletions tests/testthat/test-llm_api_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ testthat::test_that("Test llm_api_server with too short OpenAI key", {
row.names = c(NA, -1L)
)
)
testthat::expect_equal(api(), structure(list(), error = "API key appears too short."))
testthat::expect_length(api(), 0)
testthat::expect_equal(attr(api(), "error"), "API key appears too short.")
})
})

Expand All @@ -28,7 +29,7 @@ testthat::test_that("Test llm_api_server with OpenAI key", {
args = list(no_internet = NULL, exclude_pattern = ""),
{
# Arrange
print("test llm_api_server: OpenAI provider with valid key file")
print("test llm_api_server: OpenAI provider with invalid key file")

# Act
session$setInputs(
Expand All @@ -45,9 +46,10 @@ testthat::test_that("Test llm_api_server with OpenAI key", {
)
)

testthat::expect_length(api(), 0)
testthat::expect_equal(
api(),
structure(list(), error = "API request failed: Unauthorized: API key is invalid or expired.\n• OAuth error\n• realm: OpenAI API")
substr(attr(api(), "error"), 1, 64),
"API request failed: Unauthorized: API key is invalid or expired."
)
})
})