Skip to content

Commit

Permalink
Make WelcomeModal only appear for admins + only if no connectors are …
Browse files Browse the repository at this point in the history
…setup
  • Loading branch information
Weves committed Feb 20, 2024
1 parent db21d82 commit cc69ba0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 5 additions & 7 deletions web/src/app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ import { cookies } from "next/headers";
import { DOCUMENT_SIDEBAR_WIDTH_COOKIE_NAME } from "@/components/resizable/contants";
import { personaComparator } from "../admin/personas/lib";
import { ChatLayout } from "./ChatPage";
import {
FullEmbeddingModelResponse,
checkModelNameIsValid,
} from "../admin/models/embedding/embeddingModels";
import { SwitchModelModal } from "@/components/SwitchModelModal";
import { NoSourcesModal } from "@/components/initialSetup/search/NoSourcesModal";
import { FullEmbeddingModelResponse } from "../admin/models/embedding/embeddingModels";
import { NoCompleteSourcesModal } from "@/components/initialSetup/search/NoCompleteSourceModal";

export default async function Page({
Expand Down Expand Up @@ -156,8 +151,11 @@ export default async function Page({
? parseInt(documentSidebarCookieInitialWidth.value)
: undefined;

const shouldShowWelcomeModal = !hasCompletedWelcomeFlowSS();
const hasAnyConnectors = ccPairs.length > 0;
const shouldShowWelcomeModal =
!hasCompletedWelcomeFlowSS() &&
!hasAnyConnectors &&
(!user || user.role === "admin");
const shouldDisplaySourcesIncompleteModal =
hasAnyConnectors &&
!shouldShowWelcomeModal &&
Expand Down
6 changes: 5 additions & 1 deletion web/src/app/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export default async function Home() {
? (storedSearchType as SearchType)
: SearchType.SEMANTIC; // default to semantic

const shouldShowWelcomeModal = !hasCompletedWelcomeFlowSS();
const hasAnyConnectors = ccPairs.length > 0;
const shouldShowWelcomeModal =
!hasCompletedWelcomeFlowSS() &&
!hasAnyConnectors &&
(!user || user.role === "admin");
const shouldDisplayNoSourcesModal =
ccPairs.length === 0 && !shouldShowWelcomeModal;
const shouldDisplaySourcesIncompleteModal =
Expand Down

0 comments on commit cc69ba0

Please sign in to comment.