From 07aeea69e7a02caa82f31705d81a60c9f115e327 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 1 Oct 2024 20:11:39 -0700 Subject: [PATCH] Dupe welcome modal logic (#2656) --- web/src/app/prompts/page.tsx | 2 -- web/src/app/search/page.tsx | 24 +++++++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/web/src/app/prompts/page.tsx b/web/src/app/prompts/page.tsx index 8bf104d5b..c3933e8ab 100644 --- a/web/src/app/prompts/page.tsx +++ b/web/src/app/prompts/page.tsx @@ -1,4 +1,3 @@ -import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrapper"; import { fetchChatData } from "@/lib/chat/fetchChatData"; import { unstable_noStore as noStore } from "next/cache"; import { redirect } from "next/navigation"; @@ -23,7 +22,6 @@ export default async function GalleryPage({ assistants, folders, openedFolders, - shouldShowWelcomeModal, toggleSidebar, } = data; diff --git a/web/src/app/search/page.tsx b/web/src/app/search/page.tsx index 72f52a409..c490e1971 100644 --- a/web/src/app/search/page.tsx +++ b/web/src/app/search/page.tsx @@ -34,7 +34,8 @@ import { } from "@/lib/constants"; import WrappedSearch from "./WrappedSearch"; import { SearchProvider } from "@/components/context/SearchContext"; -import { ProviderContextProvider } from "@/components/chat_search/ProviderContext"; +import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs"; +import { LLMProviderDescriptor } from "../admin/configuration/llm/interfaces"; export default async function Home() { // Disable caching so we always get the up to date connector / document set / persona info @@ -49,8 +50,8 @@ export default async function Home() { fetchSS("/manage/document-set"), fetchAssistantsSS(), fetchSS("/query/valid-tags"), - fetchSS("/search-settings/get-all-search-settings"), fetchSS("/query/user-searches"), + fetchLLMProvidersSS(), ]; // catch cases where the backend is completely unreachable here @@ -62,8 +63,9 @@ export default async function Home() { | AuthTypeMetadata | FullEmbeddingModelResponse | FetchAssistantsResponse + | LLMProviderDescriptor[] | null - )[] = [null, null, null, null, null, null]; + )[] = [null, null, null, null, null, null, null, null]; try { results = await Promise.all(tasks); } catch (e) { @@ -76,8 +78,8 @@ export default async function Home() { const [initialAssistantsList, assistantsFetchError] = results[4] as FetchAssistantsResponse; const tagsResponse = results[5] as Response | null; - const embeddingModelResponse = results[6] as Response | null; - const queryResponse = results[7] as Response | null; + const queryResponse = results[6] as Response | null; + const llmProviders = (results[7] || []) as LLMProviderDescriptor[]; const authDisabled = authTypeMetadata?.authType === "disabled"; if (!authDisabled && !user) { @@ -130,16 +132,6 @@ export default async function Home() { console.log(`Failed to fetch tags - ${tagsResponse?.status}`); } - const embeddingModelVersionInfo = - embeddingModelResponse && embeddingModelResponse.ok - ? ((await embeddingModelResponse.json()) as FullEmbeddingModelResponse) - : null; - - const currentEmbeddingModelName = - embeddingModelVersionInfo?.current_model_name; - const nextEmbeddingModelName = - embeddingModelVersionInfo?.secondary_model_name; - // needs to be done in a non-client side component due to nextjs const storedSearchType = cookies().get("searchType")?.value as | string @@ -151,7 +143,9 @@ export default async function Home() { : SearchType.SEMANTIC; // default to semantic const hasAnyConnectors = ccPairs.length > 0; + const shouldShowWelcomeModal = + !llmProviders.length && !hasCompletedWelcomeFlowSS() && !hasAnyConnectors && (!user || user.role === "admin");