Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
removed isolate and added more font colors to theme utils
Browse files Browse the repository at this point in the history
  • Loading branch information
reisner committed Jul 5, 2023
1 parent c35db89 commit bf7c8f0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
3 changes: 1 addition & 2 deletions dashboard_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ get_document_summary <- function(query,
api_user,
api_password,
api_version) {
# cleaned_query = URLencode(query)
body = list(query = query)
response = api_url %>%
paste0("/embeddings_api/", api_version, "/summarize") %>%
Expand Down Expand Up @@ -545,7 +544,7 @@ format_title <- function(title_str, title_url, add_link) {
if (link_present & add_link) {
formatted_str = a(title_str, href = title_url, target = "_blank")
} else {
formatted_str = span(title_str, style = "color: #0275d8;")
formatted_str = span(title_str, style = sprintf("color: %s;", titles_color()))
}

return(formatted_str)
Expand Down
43 changes: 21 additions & 22 deletions search_results_table_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,33 +273,32 @@ searchResultsTable <- function(input, output, session,
output$summary_section = renderText({""})
})

output$summary_section = renderText({""})#NULL
# Need this?
output$summary_section = renderText({""})

observeEvent(input$summary_button, {
req(input$summary_button)
req(input$summary_button != 0)
# TODO: Do we need isolate? https://github.com/rstudio/shiny/issues/167
isolate({
shinycssloaders::showPageSpinner(caption = "🤖 Reading Text... 🤖", type = 4)
configs = get_configs()
summary = get_document_summary(display_text,
configs$embedding_api_host,
configs$embedding_api_user,
configs$embedding_api_password,
configs$embedding_api_version)
output$summary_section = renderUI({
div(
style = sprintf("width: 90%%; margin: auto; background-color: %s; border-radius: 10px; padding: 5px; font-size: 15px", secondary_div_background()),
strong("AI-Generated Text Summary"),
br(), br(),
summary,
br(), br(),
span(style = "font-size: 13px; font-style: italic", "Note: This text is automatically generated by an AI language model, and should be reviewed.")
)
})
shinyjs::hide("summary_button")
shinycssloaders::hidePageSpinner()
configs = get_configs()

shinycssloaders::showPageSpinner(caption = "🤖 Reading Text... 🤖", type = 4, color = main_text_color())
summary = get_document_summary(display_text,
configs$embedding_api_host,
configs$embedding_api_user,
configs$embedding_api_password,
configs$embedding_api_version)
output$summary_section = renderUI({
div(
style = sprintf("width: 90%%; margin: auto; background-color: %s; border-radius: 10px; padding: 5px; font-size: 15px", secondary_div_background()),
strong("AI-Generated Text Summary"),
br(), br(),
summary,
br(), br(),
span(style = "font-size: 13px; font-style: italic", "Note: This text is automatically generated by an AI language model, and should be reviewed.")
)
})
shinyjs::hide("summary_button")
shinycssloaders::hidePageSpinner()
}, ignoreInit = TRUE, once = TRUE) # https://community.rstudio.com/t/issue-with-r-shiny-modal-dialog-and-observe-event-on-action-button/9501
})

Expand Down
8 changes: 8 additions & 0 deletions theme_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ main_div_background <- function() {

secondary_div_background <- function() {
"#DFF0D3"
}

main_text_color <- function() {
"#32566F"
}

titles_color <- function() {
"#0275d8"
}
12 changes: 6 additions & 6 deletions ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ ui <- fluidPage(
column(
a(img(src = "text_depot_icon/TextDepotIcon_Image_S.jpg", width = 105, style = "float: left; padding: 10px 10px 0 0"),
href = "https://github.com/CityofEdmonton/text_depot"),
span("TEXT DEPOT", style = 'font-weight: 700;
font-size: 35px;
font-family: "Open Sans";
margin: 20px 0 20px 0;
color: #32566F'),
span("TEXT DEPOT", style = sprintf('font-weight: 700;
font-size: 35px;
font-family: "Open Sans";
margin: 20px 0 20px 0;
color: %s', main_text_color())),
br(),
span(paste0("A simplified way to search and analyze topics of interest related to ",
get_configs()$location_name),
style = "color: #32566F"),
style = sprintf("color: %s", main_text_color())),
br(),
actionLink("more_info", paste0("Click for More Info")),
width = 12
Expand Down

0 comments on commit bf7c8f0

Please sign in to comment.