mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-11 00:20:55 +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
|
||||
|
||||
try:
|
||||
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(
|
||||
model_name=llm.config.model_name,
|
||||
|
@ -24,8 +24,8 @@ export default async function GalleryPage({
|
||||
chatSessions,
|
||||
folders,
|
||||
openedFolders,
|
||||
shouldShowWelcomeModal,
|
||||
toggleSidebar,
|
||||
shouldShowWelcomeModal,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||
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";
|
||||
import WrappedAssistantsMine from "./WrappedAssistantsMine";
|
||||
import { AssistantsProvider } from "@/components/context/AssistantsContext";
|
||||
import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
||||
|
||||
export default async function GalleryPage({
|
||||
searchParams,
|
||||
@ -24,8 +24,8 @@ export default async function GalleryPage({
|
||||
chatSessions,
|
||||
folders,
|
||||
openedFolders,
|
||||
shouldShowWelcomeModal,
|
||||
toggleSidebar,
|
||||
shouldShowWelcomeModal,
|
||||
} = data;
|
||||
|
||||
return (
|
||||
|
@ -135,7 +135,9 @@ export function ChatPage({
|
||||
|
||||
const { assistants: availableAssistants, finalAssistants } = useAssistants();
|
||||
|
||||
const [showApiKeyModal, setShowApiKeyModal] = useState(true);
|
||||
const [showApiKeyModal, setShowApiKeyModal] = useState(
|
||||
!shouldShowWelcomeModal
|
||||
);
|
||||
|
||||
const { user, isAdmin, isLoadingUser } = useUser();
|
||||
|
||||
|
@ -10,16 +10,10 @@ import { CCPairBasicInfo, DocumentSet, Tag, User } from "@/lib/types";
|
||||
import { cookies } from "next/headers";
|
||||
import { SearchType } from "@/lib/search/interfaces";
|
||||
import { Persona } from "../admin/assistants/interfaces";
|
||||
import {
|
||||
WelcomeModal,
|
||||
hasCompletedWelcomeFlowSS,
|
||||
} from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
||||
import { unstable_noStore as noStore } from "next/cache";
|
||||
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||
import { personaComparator } from "../admin/assistants/lib";
|
||||
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 {
|
||||
FetchAssistantsResponse,
|
||||
@ -38,6 +32,10 @@ import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs";
|
||||
import { LLMProviderDescriptor } from "../admin/configuration/llm/interfaces";
|
||||
import { AssistantsProvider } from "@/components/context/AssistantsContext";
|
||||
import { headers } from "next/headers";
|
||||
import {
|
||||
hasCompletedWelcomeFlowSS,
|
||||
WelcomeModal,
|
||||
} from "@/components/initialSetup/welcome/WelcomeModalWrapper";
|
||||
|
||||
export default async function Home({
|
||||
searchParams,
|
||||
@ -170,14 +168,6 @@ export default async function Home({
|
||||
ccPairs.length === 0 &&
|
||||
!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 agenticSearchToggle = cookies().get(AGENTIC_SEARCH_TYPE_COOKIE_NAME);
|
||||
|
||||
@ -192,12 +182,8 @@ export default async function Home({
|
||||
return (
|
||||
<>
|
||||
<HealthCheckBanner />
|
||||
{shouldShowWelcomeModal && <WelcomeModal user={user} />}
|
||||
<InstantSSRAutoRefresh />
|
||||
{shouldDisplayNoSourcesModal && <NoSourcesModal />}
|
||||
{shouldDisplaySourcesIncompleteModal && (
|
||||
<NoCompleteSourcesModal ccPairs={ccPairs} />
|
||||
)}
|
||||
{shouldShowWelcomeModal && <WelcomeModal user={user} />}
|
||||
{/* ChatPopup is a custom popup that displays a admin-specified message on initial user visit.
|
||||
Only used in the EE version of the app. */}
|
||||
<ChatPopup />
|
||||
|
@ -2,19 +2,31 @@ import { useProviderStatus } from "./ProviderContext";
|
||||
|
||||
export default function CredentialNotConfigured({
|
||||
showConfigureAPIKey,
|
||||
noSources,
|
||||
}: {
|
||||
showConfigureAPIKey: () => void;
|
||||
noSources?: boolean;
|
||||
}) {
|
||||
const { shouldShowConfigurationNeeded } = useProviderStatus();
|
||||
|
||||
if (!shouldShowConfigurationNeeded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{noSources ? (
|
||||
<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{" "}
|
||||
You have not yet added any sources. Please add{" "}
|
||||
<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
|
||||
onClick={showConfigureAPIKey}
|
||||
className="text-link hover:underline cursor-pointer"
|
||||
@ -23,5 +35,8 @@ export default function CredentialNotConfigured({
|
||||
</button>
|
||||
.
|
||||
</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}
|
||||
|
||||
<Modal
|
||||
onOutsideClick={() => {
|
||||
setWelcomeFlowComplete();
|
||||
router.refresh();
|
||||
}}
|
||||
title={"Welcome to Danswer!"}
|
||||
width="w-full max-h-[900px] overflow-y-scroll max-w-3xl"
|
||||
>
|
||||
|
@ -26,18 +26,17 @@ export const ApiKeyModal = ({
|
||||
}
|
||||
return (
|
||||
<Modal
|
||||
title="Set an API Key!"
|
||||
title="Configure a Generative AI Model"
|
||||
width="max-w-3xl w-full"
|
||||
onOutsideClick={() => hide()}
|
||||
>
|
||||
<>
|
||||
<div className="mb-5 text-sm text-gray-700">
|
||||
Please provide an API Key below in order to start using Danswer – you
|
||||
can always change this later.
|
||||
Please provide an API Key – you can always change this or switch
|
||||
models later.
|
||||
<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">
|
||||
{" "}
|
||||
skip this step
|
||||
</strong>
|
||||
.
|
||||
|
@ -44,6 +44,7 @@ import UnconfiguredProviderText from "../chat_search/UnconfiguredProviderText";
|
||||
import { DateRangePickerValue } from "@tremor/react";
|
||||
import { Tag } from "@/lib/types";
|
||||
import { isEqual } from "lodash";
|
||||
import { WelcomeModal } from "../initialSetup/welcome/WelcomeModalWrapper";
|
||||
|
||||
export type searchState =
|
||||
| "input"
|
||||
@ -783,6 +784,7 @@ export const SearchSection = ({
|
||||
</div>
|
||||
|
||||
<UnconfiguredProviderText
|
||||
noSources={shouldDisplayNoSources}
|
||||
showConfigureAPIKey={() => setShowApiKeyModal(true)}
|
||||
/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user