Skip to content

Commit

Permalink
feature: add Testing mode for public page, fix suggestions color
Browse files Browse the repository at this point in the history
  • Loading branch information
cdxker authored and skeptrunedev committed Jan 2, 2025
1 parent dfe8c77 commit 9b74a41
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 2 deletions.
19 changes: 19 additions & 0 deletions clients/search-component/src/TrieveModal/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,25 @@ body {
}
}
}

.followup-questions {
.followup-question {
border-color: var(--tv-zinc-700);

&:hover {
background-color: var(--tv-zinc-800);
}
}
}
.header {
.followup-question {
border-color: var(--tv-zinc-700);

&:hover {
background-color: var(--tv-zinc-800);
}
}
}
}

.chat-footer-wrapper {
Expand Down
4 changes: 4 additions & 0 deletions clients/ts-sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -12538,6 +12538,10 @@
"type": "boolean",
"nullable": true
},
"isTestMode": {
"type": "boolean",
"nullable": true
},
"navLogoImgSrcUrl": {
"type": "string",
"nullable": true
Expand Down
1 change: 1 addition & 0 deletions clients/ts-sdk/src/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,7 @@ export type PublicPageParameters = {
headingPrefix?: (string) | null;
heroPattern?: ((HeroPattern) | null);
hideDrawnText?: (boolean) | null;
isTestMode?: (boolean) | null;
navLogoImgSrcUrl?: (string) | null;
openGraphMetadata?: ((OpenGraphMetadata) | null);
openLinksInNewTab?: (boolean) | null;
Expand Down
22 changes: 22 additions & 0 deletions frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,28 @@ const PublicPageControls = () => {
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
/>
</div>

<div class="flex gap-2">
<div class="flex items-center gap-1">
<label class="block" for="">
Enable Test Mode
</label>
<Tooltip
tooltipText="Use the unstable version of the search-component. (Mostly used for testing)"
body={
<FaRegularCircleQuestion class="h-3 w-3 text-black" />
}
/>
</div>
<input
type="checkbox"
checked={extraParams.isTestMode || false}
onChange={(e) => {
setExtraParams("isTestMode", e.currentTarget.checked);
}}
class="block w-4 rounded border border-neutral-300 px-3 py-1.5 shadow-sm placeholder:text-neutral-400 focus:outline-magenta-500 sm:text-sm sm:leading-6"
/>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="flex gap-2">
Expand Down
3 changes: 3 additions & 0 deletions server/src/data/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,9 @@ impl DatasetConfigurationDTO {
video_position: page_parameters_self
.video_position
.or(page_parameters_curr.video_position),
is_test_mode: page_parameters_self
.is_test_mode
.or(page_parameters_curr.is_test_mode),
}),
},
DISABLE_ANALYTICS: self
Expand Down
17 changes: 15 additions & 2 deletions server/src/handlers/page_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ pub struct PublicPageParameters {
pub video_link: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub video_position: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub is_test_mode: Option<bool>,
}

#[utoipa::path(
Expand Down Expand Up @@ -299,8 +301,19 @@ pub async fn public_page(
let dashboard_url =
env::var("ADMIN_DASHBOARD_URL").unwrap_or("https://dashboard.trieve.ai".to_string());

let search_component_url = std::env::var("SEARCH_COMPONENT_URL")
.unwrap_or("https://search-component.trieve.ai".to_string());
let search_component_url = if config
.clone()
.PUBLIC_DATASET
.extra_params
.unwrap_or_default()
.is_test_mode
.unwrap_or(false)
{
"https://test-search-component.trieve.ai".to_string()
} else {
std::env::var("SEARCH_COMPONENT_URL")
.unwrap_or("https://search-component.trieve.ai".to_string())
};

if config.PUBLIC_DATASET.enabled {
let templ = templates.get_template("page.html").unwrap();
Expand Down
1 change: 1 addition & 0 deletions server/src/public/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
font-size: 1rem;
@media (min-width: 640px) {
font-size: 1.25rem;
line-height: 50px;
}
}
}
Expand Down

0 comments on commit 9b74a41

Please sign in to comment.