-
Notifications
You must be signed in to change notification settings - Fork 96
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 #78 from calderonsamuel/main
Rework of the chat app
- Loading branch information
Showing
121 changed files
with
2,659 additions
and
434 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ _\.new\.png$ | |
^pkgdown$ | ||
^cran-comments\.md$ | ||
^CRAN-SUBMISSION$ | ||
diagram.svg |
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 |
---|---|---|
@@ -1,51 +1,55 @@ | ||
Package: gptstudio | ||
Type: Package | ||
Package: gptstudio | ||
Title: Use Large Language Models Directly in your Development Environment | ||
Version: 0.1.0.9000 | ||
Authors@R: | ||
c(person(given = "Michel", | ||
family = "Nivard", | ||
role = c("aut", "cph"), | ||
email = "m.g.nivard@vu.nl"), | ||
person(given = "James", | ||
family = "Wade", | ||
role = c("aut", "cre", "cph"), | ||
email = "github@jameshwade.com", | ||
comment = c(ORCID = "0000-0002-9740-1905"))) | ||
Version: 0.2.0 | ||
Authors@R: c( | ||
person("Michel", "Nivard", , "m.g.nivard@vu.nl", role = c("aut", "cph")), | ||
person("James", "Wade", , "github@jameshwade.com", role = c("aut", "cre", "cph"), | ||
comment = c(ORCID = "0000-0002-9740-1905")), | ||
person("Samuel", "Calderon", , "samuel.calderon@uarm.pe", role = c("aut"), | ||
comment = c(ORCID = "0000-0001-6847-1210")) | ||
) | ||
Maintainer: James Wade <github@jameshwade.com> | ||
Description: Large language models are readily accessible via API. This package | ||
lowers the barrier to use the API inside of your development environment. | ||
For more on the API, see <https://platform.openai.com/docs/introduction>. | ||
Description: Large language models are readily accessible via API. This | ||
package lowers the barrier to use the API inside of your development | ||
environment. For more on the API, see | ||
<https://platform.openai.com/docs/introduction>. | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
URL: https://github.com/MichelNivard/gptstudio, | ||
https://michelnivard.github.io/gptstudio/ | ||
BugReports: https://github.com/MichelNivard/gptstudio/issues | ||
Imports: | ||
assertthat, | ||
bslib (>= 0.4.2), | ||
cli, | ||
dplyr, | ||
colorspace, | ||
fontawesome, | ||
glue, | ||
grDevices, | ||
htmltools, | ||
httr, | ||
jsonlite, | ||
magrittr, | ||
purrr, | ||
rclipboard, | ||
rlang, | ||
rstudioapi (>= 0.12), | ||
shiny, | ||
usethis, | ||
RoxygenNote: 7.2.3 | ||
utils, | ||
waiter, | ||
xml2 | ||
Suggests: | ||
bslib (>= 0.4.2), | ||
covr, | ||
mockr, | ||
shinytest2, | ||
spelling, | ||
testthat (>= 3.0.0), | ||
uuid, | ||
spelling, | ||
shinytest2, | ||
waiter, | ||
withr | ||
Config/testthat/edition: 3 | ||
URL: https://github.com/MichelNivard/gptstudio, | ||
https://michelnivard.github.io/gptstudio/ | ||
BugReports: https://github.com/MichelNivard/gptstudio/issues | ||
Config/testthat/parallel: true | ||
Encoding: UTF-8 | ||
Language: en-US | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# gptstudio (development version) | ||
# gptstudio 0.2.0 | ||
|
||
# gptstudio | ||
|
||
|
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,69 @@ | ||
add_copy_btns_to_pre <- function(tag_list) { | ||
tq <- htmltools::tagQuery(tag_list) | ||
tq$ | ||
siblings("pre")$ | ||
each(add_copy_btn_before_tag)$ | ||
allTags() | ||
} | ||
|
||
add_copy_btn_before_tag <- function(tag, i) { | ||
tq <- tagQuery(tag) | ||
|
||
language <- get_code_language(tq) | ||
code_text <- get_pre_text(tag) | ||
copy_btn_div <- create_copy_btn_div(language, | ||
code_text, | ||
copy_btn_id = paste0("copy_", i)) | ||
|
||
tq$addAttrs( | ||
style = htmltools::css(`border-radius` = "0 0 5px 5px") | ||
)$before(copy_btn_div) | ||
|
||
tq$allTags() | ||
} | ||
|
||
get_code_language <- function(tq) { | ||
code_element <- tq$children("code")$selectedTags()[[1]] | ||
tagGetAttribute(code_element, "class") %||% "output" | ||
} | ||
|
||
create_copy_btn_div <- function(language, | ||
text_to_copy, | ||
copy_btn_id = "codeCopied") { | ||
tags$div( | ||
class = "d-flex justify-content-between bg-dark", | ||
style = htmltools::css(`border-radius` = "5px 5px 0 0"), | ||
tags$p( | ||
class = "px-2 py-1 m-0 text-muted small", | ||
language | ||
), | ||
create_copy_btn( | ||
class = "btn-secondary btn-sm btn-clipboard", | ||
style = htmltools::css(`border-radius` = "0 5px 0 0"), | ||
inputId = copy_btn_id, | ||
label = tags$span(fontawesome::fa("far fa-clipboard"), "Copy"), | ||
text_to_copy = text_to_copy | ||
) | ||
) | ||
} | ||
|
||
create_copy_btn <- function(inputId, label, text_to_copy, ...) { | ||
tag <- rclipboard::rclipButton( | ||
inputId = inputId, | ||
label = label, | ||
clipText = text_to_copy, | ||
... | ||
) | ||
|
||
tq <- htmltools::tagQuery(tag) | ||
|
||
tq$siblings("button")$removeClass("btn-default")$allTags() | ||
} | ||
|
||
get_pre_text <- function(pre_tag) { | ||
pre_tag |> | ||
as.character() |> | ||
xml2::read_html() |> | ||
xml2::xml_find_first("./body/*") |> | ||
xml2::xml_text(trim = TRUE) | ||
} |
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
Oops, something went wrong.