diff --git a/clients/search-component/example/src/routeTree.gen.ts b/clients/search-component/example/src/routeTree.gen.ts index 740177945..25f03397c 100644 --- a/clients/search-component/example/src/routeTree.gen.ts +++ b/clients/search-component/example/src/routeTree.gen.ts @@ -1,12 +1,12 @@ -/* prettier-ignore-start */ - /* eslint-disable */ // @ts-nocheck // noinspection JSUnusedGlobalSymbols -// This file is auto-generated by TanStack Router +// This file was automatically generated by TanStack Router. +// You should NOT make any changes in this file as it will be overwritten. +// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. import { createFileRoute } from '@tanstack/react-router' @@ -22,11 +22,13 @@ const IndexLazyImport = createFileRoute('/')() // Create/Update Routes const EcommerceRoute = EcommerceImport.update({ + id: '/ecommerce', path: '/ecommerce', getParentRoute: () => rootRoute, } as any) const IndexLazyRoute = IndexLazyImport.update({ + id: '/', path: '/', getParentRoute: () => rootRoute, } as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route)) @@ -93,8 +95,6 @@ export const routeTree = rootRoute ._addFileChildren(rootRouteChildren) ._addFileTypes() -/* prettier-ignore-end */ - /* ROUTE_MANIFEST_START { "routes": { diff --git a/clients/search-component/package.json b/clients/search-component/package.json index 775f9ce34..2e1aa02ee 100644 --- a/clients/search-component/package.json +++ b/clients/search-component/package.json @@ -19,7 +19,7 @@ "import": "./dist/vanilla/index.js" } }, - "version": "0.2.71", + "version": "0.2.73", "license": "MIT", "homepage": "https://github.com/devflowinc/trieve/tree/main/clients/search-component", "scripts": { diff --git a/clients/search-component/src/TrieveModal/Chat/ChatMessage.tsx b/clients/search-component/src/TrieveModal/Chat/ChatMessage.tsx index a88a959b9..17e145e35 100644 --- a/clients/search-component/src/TrieveModal/Chat/ChatMessage.tsx +++ b/clients/search-component/src/TrieveModal/Chat/ChatMessage.tsx @@ -214,7 +214,6 @@ export const Message = ({ ) : ( )} -
{message.additional ? props.type !== "ecommerce" && ( @@ -309,6 +308,8 @@ export const Message = ({
+ {props.followupQuestions && + } ) : null} diff --git a/clients/search-component/src/utils/hooks/modal-context.tsx b/clients/search-component/src/utils/hooks/modal-context.tsx index 2562efa2a..6ebb5bc9d 100644 --- a/clients/search-component/src/utils/hooks/modal-context.tsx +++ b/clients/search-component/src/utils/hooks/modal-context.tsx @@ -63,6 +63,7 @@ export type ModalProps = { analytics?: boolean; ButtonEl?: JSX.ElementType; suggestedQueries?: boolean; + followupQuestions?: boolean; defaultSearchQueries?: string[]; defaultAiQuestions?: string[]; brandLogoImgSrcUrl?: string; @@ -124,6 +125,7 @@ const defaultProps = { analytics: true, chat: true, suggestedQueries: true, + followupQuestions: true, trieve: (() => {}) as unknown as TrieveSDK, openKeyCombination: [{ ctrl: true }, { key: "k", label: "K" }], type: "docs" as ModalTypes, diff --git a/clients/ts-sdk/openapi.json b/clients/ts-sdk/openapi.json index 67e97f33c..3dc461f2f 100644 --- a/clients/ts-sdk/openapi.json +++ b/clients/ts-sdk/openapi.json @@ -9356,7 +9356,7 @@ "FULLTEXT_ENABLED": true, "INDEXED_ONLY": false, "LLM_BASE_URL": "https://api.openai.com/v1", - "LLM_DEFAULT_MODEL": "gpt-3.5-turbo-1106", + "LLM_DEFAULT_MODEL": "gpt-4o", "LOCKED": false, "MAX_LIMIT": 10000, "MESSAGE_TO_QUERY_PROMPT": "Write a 1-2 sentence semantic search query along the lines of a hypothetical response to: \n\n", @@ -9647,7 +9647,7 @@ "FULLTEXT_ENABLED": true, "INDEXED_ONLY": false, "LLM_BASE_URL": "https://api.openai.com/v1", - "LLM_DEFAULT_MODEL": "gpt-3.5-turbo-1106", + "LLM_DEFAULT_MODEL": "gpt-4o", "LOCKED": false, "MAX_LIMIT": 10000, "MESSAGE_TO_QUERY_PROMPT": "Write a 1-2 sentence semantic search query along the lines of a hypothetical response to: \n\n", @@ -12130,8 +12130,7 @@ ], "properties": { "query": { - "type": "string", - "description": "Query to embed for the final weighted sum vector." + "$ref": "#/components/schemas/SearchModalities" }, "weight": { "type": "number", @@ -12518,6 +12517,10 @@ "type": "string", "nullable": true }, + "followupQuestions": { + "type": "boolean", + "nullable": true + }, "forBrandName": { "type": "string", "nullable": true @@ -12941,7 +12944,7 @@ "QueryTypes": { "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/SearchModalities" }, { "type": "array", @@ -14956,6 +14959,24 @@ "bm25" ] }, + "SearchModalities": { + "oneOf": [ + { + "type": "object", + "required": [ + "image_url" + ], + "properties": { + "image_url": { + "type": "string" + } + } + }, + { + "type": "string" + } + ] + }, "SearchOverGroupsReqPayload": { "type": "object", "required": [ diff --git a/clients/ts-sdk/src/types.gen.ts b/clients/ts-sdk/src/types.gen.ts index 084ed503f..5ce84014f 100644 --- a/clients/ts-sdk/src/types.gen.ts +++ b/clients/ts-sdk/src/types.gen.ts @@ -1990,10 +1990,7 @@ export type MmrOptions = { * MultiQuery allows you to construct a dense vector from multiple queries with a weighted sum. This is useful for when you want to emphasize certain features of the query. This only works with Semantic Search and is not compatible with cross encoder re-ranking or highlights. */ export type MultiQuery = { - /** - * Query to embed for the final weighted sum vector. - */ - query: string; + query: SearchModalities; /** * Float value which is applies as a multiplier to the query vector when summing. */ @@ -2089,6 +2086,7 @@ export type PublicPageParameters = { defaultSearchQueries?: Array<(string)> | null; floatingButtonPosition?: (string) | null; floatingSearchIconPosition?: (string) | null; + followupQuestions?: (boolean) | null; forBrandName?: (string) | null; headingPrefix?: (string) | null; heroPattern?: ((HeroPattern) | null); @@ -2208,7 +2206,7 @@ export type QueryCountResponse = { /** * Query is the search query. This can be any string. The query will be used to create an embedding vector and/or SPLADE vector which will be used to find the result set. You can either provide one query, or multiple with weights. Multi-query only works with Semantic Search and is not compatible with cross encoder re-ranking or highlights. */ -export type QueryTypes = string | Array; +export type QueryTypes = SearchModalities | Array; export type RAGAnalytics = { filter?: ((RAGAnalyticsFilter) | null); @@ -2694,6 +2692,10 @@ export type SearchLatencyGraph = { export type SearchMethod = 'fulltext' | 'semantic' | 'hybrid' | 'bm25'; +export type SearchModalities = { + image_url: string; +} | string; + export type SearchOverGroupsReqPayload = { filters?: ((ChunkFilter) | null); /** diff --git a/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx b/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx index 027efe603..9e786e6b2 100644 --- a/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx +++ b/frontends/dashboard/src/pages/dataset/PublicPageSettings.tsx @@ -403,6 +403,25 @@ 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" /> +
+
+ + } + /> +
+ { + setExtraParams("followupQuestions", 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" + /> +
{ setExtraParams("suggestedQueries", e.currentTarget.checked); @@ -433,7 +452,7 @@ const PublicPageControls = () => { />
{ setExtraParams("chat", e.currentTarget.checked); @@ -1071,10 +1090,10 @@ const PublicPageControls = () => {
} diff --git a/server/src/data/models.rs b/server/src/data/models.rs index 8fad7f1f1..7b1b7ab85 100644 --- a/server/src/data/models.rs +++ b/server/src/data/models.rs @@ -3148,6 +3148,9 @@ impl DatasetConfigurationDTO { suggested_queries: page_parameters_self .suggested_queries .or(page_parameters_curr.suggested_queries), + followup_questions: page_parameters_self + .followup_questions + .or(page_parameters_curr.followup_questions), responsive: page_parameters_self .responsive .or(page_parameters_curr.responsive), diff --git a/server/src/handlers/page_handler.rs b/server/src/handlers/page_handler.rs index 2bdc41319..621116623 100644 --- a/server/src/handlers/page_handler.rs +++ b/server/src/handlers/page_handler.rs @@ -183,6 +183,8 @@ pub struct PublicPageParameters { #[serde(skip_serializing_if = "Option::is_none")] pub suggested_queries: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub followup_questions: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub responsive: Option, #[serde(skip_serializing_if = "Option::is_none")] pub chat: Option, diff --git a/server/src/public/search-component-code.html b/server/src/public/search-component-code.html index 9291aa38e..cf96d0e07 100644 --- a/server/src/public/search-component-code.html +++ b/server/src/public/search-component-code.html @@ -25,9 +25,8 @@ {% if params.type -%} type: "{{ params.type }}", {% endif -%} - {% if params.suggestedQueries -%} suggestedQueries: {{ params.suggestedQueries }}, - {% endif -%} + followupQuestions: {{ params.followupQuestions }}, {% if params.analytics -%} analytics: {{ params.analytics }}, {% endif -%}