mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-21 13:30:59 +02:00
Dupe welcome modal logic (#2656)
This commit is contained in:
parent
bd40328a73
commit
07aeea69e7
@ -1,4 +1,3 @@
|
|||||||
import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
|
||||||
import { fetchChatData } from "@/lib/chat/fetchChatData";
|
import { fetchChatData } from "@/lib/chat/fetchChatData";
|
||||||
import { unstable_noStore as noStore } from "next/cache";
|
import { unstable_noStore as noStore } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
@ -23,7 +22,6 @@ export default async function GalleryPage({
|
|||||||
assistants,
|
assistants,
|
||||||
folders,
|
folders,
|
||||||
openedFolders,
|
openedFolders,
|
||||||
shouldShowWelcomeModal,
|
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@ import {
|
|||||||
} from "@/lib/constants";
|
} from "@/lib/constants";
|
||||||
import WrappedSearch from "./WrappedSearch";
|
import WrappedSearch from "./WrappedSearch";
|
||||||
import { SearchProvider } from "@/components/context/SearchContext";
|
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() {
|
export default async function Home() {
|
||||||
// Disable caching so we always get the up to date connector / document set / persona info
|
// 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"),
|
fetchSS("/manage/document-set"),
|
||||||
fetchAssistantsSS(),
|
fetchAssistantsSS(),
|
||||||
fetchSS("/query/valid-tags"),
|
fetchSS("/query/valid-tags"),
|
||||||
fetchSS("/search-settings/get-all-search-settings"),
|
|
||||||
fetchSS("/query/user-searches"),
|
fetchSS("/query/user-searches"),
|
||||||
|
fetchLLMProvidersSS(),
|
||||||
];
|
];
|
||||||
|
|
||||||
// catch cases where the backend is completely unreachable here
|
// catch cases where the backend is completely unreachable here
|
||||||
@ -62,8 +63,9 @@ export default async function Home() {
|
|||||||
| AuthTypeMetadata
|
| AuthTypeMetadata
|
||||||
| FullEmbeddingModelResponse
|
| FullEmbeddingModelResponse
|
||||||
| FetchAssistantsResponse
|
| FetchAssistantsResponse
|
||||||
|
| LLMProviderDescriptor[]
|
||||||
| null
|
| null
|
||||||
)[] = [null, null, null, null, null, null];
|
)[] = [null, null, null, null, null, null, null, null];
|
||||||
try {
|
try {
|
||||||
results = await Promise.all(tasks);
|
results = await Promise.all(tasks);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -76,8 +78,8 @@ export default async function Home() {
|
|||||||
const [initialAssistantsList, assistantsFetchError] =
|
const [initialAssistantsList, assistantsFetchError] =
|
||||||
results[4] as FetchAssistantsResponse;
|
results[4] as FetchAssistantsResponse;
|
||||||
const tagsResponse = results[5] as Response | null;
|
const tagsResponse = results[5] as Response | null;
|
||||||
const embeddingModelResponse = results[6] as Response | null;
|
const queryResponse = results[6] as Response | null;
|
||||||
const queryResponse = results[7] as Response | null;
|
const llmProviders = (results[7] || []) as LLMProviderDescriptor[];
|
||||||
|
|
||||||
const authDisabled = authTypeMetadata?.authType === "disabled";
|
const authDisabled = authTypeMetadata?.authType === "disabled";
|
||||||
if (!authDisabled && !user) {
|
if (!authDisabled && !user) {
|
||||||
@ -130,16 +132,6 @@ export default async function Home() {
|
|||||||
console.log(`Failed to fetch tags - ${tagsResponse?.status}`);
|
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
|
// needs to be done in a non-client side component due to nextjs
|
||||||
const storedSearchType = cookies().get("searchType")?.value as
|
const storedSearchType = cookies().get("searchType")?.value as
|
||||||
| string
|
| string
|
||||||
@ -151,7 +143,9 @@ export default async function Home() {
|
|||||||
: SearchType.SEMANTIC; // default to semantic
|
: SearchType.SEMANTIC; // default to semantic
|
||||||
|
|
||||||
const hasAnyConnectors = ccPairs.length > 0;
|
const hasAnyConnectors = ccPairs.length > 0;
|
||||||
|
|
||||||
const shouldShowWelcomeModal =
|
const shouldShowWelcomeModal =
|
||||||
|
!llmProviders.length &&
|
||||||
!hasCompletedWelcomeFlowSS() &&
|
!hasCompletedWelcomeFlowSS() &&
|
||||||
!hasAnyConnectors &&
|
!hasAnyConnectors &&
|
||||||
(!user || user.role === "admin");
|
(!user || user.role === "admin");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user