mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-13 09:30:53 +02:00
Onboarding nits (#2907)
* temporary stash * welcome flow * minor update * k * minor updates to welcome flow
This commit is contained in:
parent
a1bfa7847a
commit
179dc418e0
@ -129,7 +129,19 @@ def stream_answer_objects(
|
|||||||
|
|
||||||
persona = temporary_persona if temporary_persona else chat_session.persona
|
persona = temporary_persona if temporary_persona else chat_session.persona
|
||||||
|
|
||||||
|
try:
|
||||||
llm, fast_llm = get_llms_for_persona(persona=persona)
|
llm, fast_llm = get_llms_for_persona(persona=persona)
|
||||||
|
except ValueError as e:
|
||||||
|
logger.error(
|
||||||
|
f"Failed to initialize LLMs for persona '{persona.name}': {str(e)}"
|
||||||
|
)
|
||||||
|
if "No LLM provider" in str(e):
|
||||||
|
raise ValueError(
|
||||||
|
"Please configure a Generative AI model to use this feature."
|
||||||
|
) from e
|
||||||
|
raise ValueError(
|
||||||
|
"Failed to initialize the AI model. Please check your configuration and try again."
|
||||||
|
) from e
|
||||||
|
|
||||||
llm_tokenizer = get_tokenizer(
|
llm_tokenizer = get_tokenizer(
|
||||||
model_name=llm.config.model_name,
|
model_name=llm.config.model_name,
|
||||||
|
@ -24,8 +24,8 @@ export default async function GalleryPage({
|
|||||||
chatSessions,
|
chatSessions,
|
||||||
folders,
|
folders,
|
||||||
openedFolders,
|
openedFolders,
|
||||||
shouldShowWelcomeModal,
|
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
|
shouldShowWelcomeModal,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||||
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";
|
||||||
import WrappedAssistantsMine from "./WrappedAssistantsMine";
|
import WrappedAssistantsMine from "./WrappedAssistantsMine";
|
||||||
import { AssistantsProvider } from "@/components/context/AssistantsContext";
|
import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
||||||
|
|
||||||
export default async function GalleryPage({
|
export default async function GalleryPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
@ -24,8 +24,8 @@ export default async function GalleryPage({
|
|||||||
chatSessions,
|
chatSessions,
|
||||||
folders,
|
folders,
|
||||||
openedFolders,
|
openedFolders,
|
||||||
shouldShowWelcomeModal,
|
|
||||||
toggleSidebar,
|
toggleSidebar,
|
||||||
|
shouldShowWelcomeModal,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -135,7 +135,9 @@ export function ChatPage({
|
|||||||
|
|
||||||
const { assistants: availableAssistants, finalAssistants } = useAssistants();
|
const { assistants: availableAssistants, finalAssistants } = useAssistants();
|
||||||
|
|
||||||
const [showApiKeyModal, setShowApiKeyModal] = useState(true);
|
const [showApiKeyModal, setShowApiKeyModal] = useState(
|
||||||
|
!shouldShowWelcomeModal
|
||||||
|
);
|
||||||
|
|
||||||
const { user, isAdmin, isLoadingUser } = useUser();
|
const { user, isAdmin, isLoadingUser } = useUser();
|
||||||
|
|
||||||
|
@ -10,16 +10,10 @@ import { CCPairBasicInfo, DocumentSet, Tag, User } from "@/lib/types";
|
|||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { SearchType } from "@/lib/search/interfaces";
|
import { SearchType } from "@/lib/search/interfaces";
|
||||||
import { Persona } from "../admin/assistants/interfaces";
|
import { Persona } from "../admin/assistants/interfaces";
|
||||||
import {
|
|
||||||
WelcomeModal,
|
|
||||||
hasCompletedWelcomeFlowSS,
|
|
||||||
} from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
|
||||||
import { unstable_noStore as noStore } from "next/cache";
|
import { unstable_noStore as noStore } from "next/cache";
|
||||||
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||||
import { personaComparator } from "../admin/assistants/lib";
|
import { personaComparator } from "../admin/assistants/lib";
|
||||||
import { FullEmbeddingModelResponse } from "@/components/embedding/interfaces";
|
import { FullEmbeddingModelResponse } from "@/components/embedding/interfaces";
|
||||||
import { NoSourcesModal } from "@/components/initialSetup/search/NoSourcesModal";
|
|
||||||
import { NoCompleteSourcesModal } from "@/components/initialSetup/search/NoCompleteSourceModal";
|
|
||||||
import { ChatPopup } from "../chat/ChatPopup";
|
import { ChatPopup } from "../chat/ChatPopup";
|
||||||
import {
|
import {
|
||||||
FetchAssistantsResponse,
|
FetchAssistantsResponse,
|
||||||
@ -38,6 +32,10 @@ import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs";
|
|||||||
import { LLMProviderDescriptor } from "../admin/configuration/llm/interfaces";
|
import { LLMProviderDescriptor } from "../admin/configuration/llm/interfaces";
|
||||||
import { AssistantsProvider } from "@/components/context/AssistantsContext";
|
import { AssistantsProvider } from "@/components/context/AssistantsContext";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
import {
|
||||||
|
hasCompletedWelcomeFlowSS,
|
||||||
|
WelcomeModal,
|
||||||
|
} from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
||||||
|
|
||||||
export default async function Home({
|
export default async function Home({
|
||||||
searchParams,
|
searchParams,
|
||||||
@ -170,14 +168,6 @@ export default async function Home({
|
|||||||
ccPairs.length === 0 &&
|
ccPairs.length === 0 &&
|
||||||
!shouldShowWelcomeModal;
|
!shouldShowWelcomeModal;
|
||||||
|
|
||||||
const shouldDisplaySourcesIncompleteModal =
|
|
||||||
!ccPairs.some(
|
|
||||||
(ccPair) => ccPair.has_successful_run && ccPair.docs_indexed > 0
|
|
||||||
) &&
|
|
||||||
!shouldDisplayNoSourcesModal &&
|
|
||||||
!shouldShowWelcomeModal &&
|
|
||||||
(!user || user.role == "admin");
|
|
||||||
|
|
||||||
const sidebarToggled = cookies().get(SIDEBAR_TOGGLED_COOKIE_NAME);
|
const sidebarToggled = cookies().get(SIDEBAR_TOGGLED_COOKIE_NAME);
|
||||||
const agenticSearchToggle = cookies().get(AGENTIC_SEARCH_TYPE_COOKIE_NAME);
|
const agenticSearchToggle = cookies().get(AGENTIC_SEARCH_TYPE_COOKIE_NAME);
|
||||||
|
|
||||||
@ -192,12 +182,8 @@ export default async function Home({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<HealthCheckBanner />
|
<HealthCheckBanner />
|
||||||
{shouldShowWelcomeModal && <WelcomeModal user={user} />}
|
|
||||||
<InstantSSRAutoRefresh />
|
<InstantSSRAutoRefresh />
|
||||||
{shouldDisplayNoSourcesModal && <NoSourcesModal />}
|
{shouldShowWelcomeModal && <WelcomeModal user={user} />}
|
||||||
{shouldDisplaySourcesIncompleteModal && (
|
|
||||||
<NoCompleteSourcesModal ccPairs={ccPairs} />
|
|
||||||
)}
|
|
||||||
{/* ChatPopup is a custom popup that displays a admin-specified message on initial user visit.
|
{/* ChatPopup is a custom popup that displays a admin-specified message on initial user visit.
|
||||||
Only used in the EE version of the app. */}
|
Only used in the EE version of the app. */}
|
||||||
<ChatPopup />
|
<ChatPopup />
|
||||||
|
@ -2,19 +2,31 @@ import { useProviderStatus } from "./ProviderContext";
|
|||||||
|
|
||||||
export default function CredentialNotConfigured({
|
export default function CredentialNotConfigured({
|
||||||
showConfigureAPIKey,
|
showConfigureAPIKey,
|
||||||
|
noSources,
|
||||||
}: {
|
}: {
|
||||||
showConfigureAPIKey: () => void;
|
showConfigureAPIKey: () => void;
|
||||||
|
noSources?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { shouldShowConfigurationNeeded } = useProviderStatus();
|
const { shouldShowConfigurationNeeded } = useProviderStatus();
|
||||||
|
|
||||||
if (!shouldShowConfigurationNeeded) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{noSources ? (
|
||||||
<p className="text-base text-center w-full text-subtle">
|
<p className="text-base text-center w-full text-subtle">
|
||||||
Please note that you have not yet configured an LLM provider. You can
|
You have not yet added any sources. Please add{" "}
|
||||||
configure one{" "}
|
<a
|
||||||
|
href="/admin/add-connector"
|
||||||
|
className="text-link hover:underline cursor-pointer"
|
||||||
|
>
|
||||||
|
a source
|
||||||
|
</a>{" "}
|
||||||
|
to continue.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
shouldShowConfigurationNeeded && (
|
||||||
|
<p className="text-base text-center w-full text-subtle">
|
||||||
|
Please note that you have not yet configured an LLM provider. You
|
||||||
|
can configure one{" "}
|
||||||
<button
|
<button
|
||||||
onClick={showConfigureAPIKey}
|
onClick={showConfigureAPIKey}
|
||||||
className="text-link hover:underline cursor-pointer"
|
className="text-link hover:underline cursor-pointer"
|
||||||
@ -23,5 +35,8 @@ export default function CredentialNotConfigured({
|
|||||||
</button>
|
</button>
|
||||||
.
|
.
|
||||||
</p>
|
</p>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Button, Divider, Text } from "@tremor/react";
|
|
||||||
import { Modal } from "../../Modal";
|
|
||||||
import Link from "next/link";
|
|
||||||
import { FiMessageSquare, FiShare2 } from "react-icons/fi";
|
|
||||||
import { useContext, useState } from "react";
|
|
||||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
|
||||||
|
|
||||||
export function NoSourcesModal() {
|
|
||||||
const settings = useContext(SettingsContext);
|
|
||||||
const [isHidden, setIsHidden] = useState(
|
|
||||||
!settings?.settings.search_page_enabled
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isHidden) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
width="max-w-3xl w-full"
|
|
||||||
title="🧐 No sources connected"
|
|
||||||
onOutsideClick={() => setIsHidden(true)}
|
|
||||||
>
|
|
||||||
<div className="text-base">
|
|
||||||
<div>
|
|
||||||
<Text>
|
|
||||||
Before using Search you'll need to connect at least one source.
|
|
||||||
Without any connected knowledge sources, there isn't anything
|
|
||||||
to search over.
|
|
||||||
</Text>
|
|
||||||
<Link href="/admin/add-connector">
|
|
||||||
<Button className="mt-3" size="xs" icon={FiShare2}>
|
|
||||||
Connect a Source!
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
<Divider />
|
|
||||||
<div>
|
|
||||||
<Text>
|
|
||||||
Or, if you're looking for a pure ChatGPT-like experience
|
|
||||||
without any organization specific knowledge, then you can head
|
|
||||||
over to the Chat page and start chatting with Danswer right away!
|
|
||||||
</Text>
|
|
||||||
<Link href="/chat">
|
|
||||||
<Button className="mt-3" size="xs" icon={FiMessageSquare}>
|
|
||||||
Start Chatting!
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
@ -58,6 +58,10 @@ export function _WelcomeModal({ user }: { user: User | null }) {
|
|||||||
{popup}
|
{popup}
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
|
onOutsideClick={() => {
|
||||||
|
setWelcomeFlowComplete();
|
||||||
|
router.refresh();
|
||||||
|
}}
|
||||||
title={"Welcome to Danswer!"}
|
title={"Welcome to Danswer!"}
|
||||||
width="w-full max-h-[900px] overflow-y-scroll max-w-3xl"
|
width="w-full max-h-[900px] overflow-y-scroll max-w-3xl"
|
||||||
>
|
>
|
||||||
|
@ -26,18 +26,17 @@ export const ApiKeyModal = ({
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title="Set an API Key!"
|
title="Configure a Generative AI Model"
|
||||||
width="max-w-3xl w-full"
|
width="max-w-3xl w-full"
|
||||||
onOutsideClick={() => hide()}
|
onOutsideClick={() => hide()}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
<div className="mb-5 text-sm text-gray-700">
|
<div className="mb-5 text-sm text-gray-700">
|
||||||
Please provide an API Key below in order to start using Danswer – you
|
Please provide an API Key – you can always change this or switch
|
||||||
can always change this later.
|
models later.
|
||||||
<br />
|
<br />
|
||||||
If you'd rather look around first, you can
|
If you would rather look around first, you can{" "}
|
||||||
<strong onClick={() => hide()} className="text-link cursor-pointer">
|
<strong onClick={() => hide()} className="text-link cursor-pointer">
|
||||||
{" "}
|
|
||||||
skip this step
|
skip this step
|
||||||
</strong>
|
</strong>
|
||||||
.
|
.
|
||||||
|
@ -44,6 +44,7 @@ import UnconfiguredProviderText from "../chat_search/UnconfiguredProviderText";
|
|||||||
import { DateRangePickerValue } from "@tremor/react";
|
import { DateRangePickerValue } from "@tremor/react";
|
||||||
import { Tag } from "@/lib/types";
|
import { Tag } from "@/lib/types";
|
||||||
import { isEqual } from "lodash";
|
import { isEqual } from "lodash";
|
||||||
|
import { WelcomeModal } from "../initialSetup/welcome/WelcomeModalWrapper";
|
||||||
|
|
||||||
export type searchState =
|
export type searchState =
|
||||||
| "input"
|
| "input"
|
||||||
@ -783,6 +784,7 @@ export const SearchSection = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<UnconfiguredProviderText
|
<UnconfiguredProviderText
|
||||||
|
noSources={shouldDisplayNoSources}
|
||||||
showConfigureAPIKey={() => setShowApiKeyModal(true)}
|
showConfigureAPIKey={() => setShowApiKeyModal(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user