mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 20:38:32 +02:00
modal onboarding clarity (#2780)
This commit is contained in:
@@ -38,11 +38,13 @@ export function CustomLLMProviderUpdateForm({
|
|||||||
existingLlmProvider,
|
existingLlmProvider,
|
||||||
shouldMarkAsDefault,
|
shouldMarkAsDefault,
|
||||||
setPopup,
|
setPopup,
|
||||||
|
hideSuccess,
|
||||||
}: {
|
}: {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
existingLlmProvider?: FullLLMProvider;
|
existingLlmProvider?: FullLLMProvider;
|
||||||
shouldMarkAsDefault?: boolean;
|
shouldMarkAsDefault?: boolean;
|
||||||
setPopup?: (popup: PopupSpec) => void;
|
setPopup?: (popup: PopupSpec) => void;
|
||||||
|
hideSuccess?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { mutate } = useSWRConfig();
|
const { mutate } = useSWRConfig();
|
||||||
|
|
||||||
@@ -108,9 +110,6 @@ export function CustomLLMProviderUpdateForm({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't set groups if marked as public
|
|
||||||
const groups = values.is_public ? [] : values.groups;
|
|
||||||
|
|
||||||
// test the configuration
|
// test the configuration
|
||||||
if (!isEqual(values, initialValues)) {
|
if (!isEqual(values, initialValues)) {
|
||||||
setIsTesting(true);
|
setIsTesting(true);
|
||||||
@@ -190,7 +189,7 @@ export function CustomLLMProviderUpdateForm({
|
|||||||
const successMsg = existingLlmProvider
|
const successMsg = existingLlmProvider
|
||||||
? "Provider updated successfully!"
|
? "Provider updated successfully!"
|
||||||
: "Provider enabled successfully!";
|
: "Provider enabled successfully!";
|
||||||
if (setPopup) {
|
if (!hideSuccess && setPopup) {
|
||||||
setPopup({
|
setPopup({
|
||||||
type: "success",
|
type: "success",
|
||||||
message: successMsg,
|
message: successMsg,
|
||||||
|
@@ -25,6 +25,7 @@ export function LLMProviderUpdateForm({
|
|||||||
shouldMarkAsDefault,
|
shouldMarkAsDefault,
|
||||||
setPopup,
|
setPopup,
|
||||||
hideAdvanced,
|
hideAdvanced,
|
||||||
|
hideSuccess,
|
||||||
}: {
|
}: {
|
||||||
llmProviderDescriptor: WellKnownLLMProviderDescriptor;
|
llmProviderDescriptor: WellKnownLLMProviderDescriptor;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
@@ -32,6 +33,7 @@ export function LLMProviderUpdateForm({
|
|||||||
shouldMarkAsDefault?: boolean;
|
shouldMarkAsDefault?: boolean;
|
||||||
hideAdvanced?: boolean;
|
hideAdvanced?: boolean;
|
||||||
setPopup?: (popup: PopupSpec) => void;
|
setPopup?: (popup: PopupSpec) => void;
|
||||||
|
hideSuccess?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { mutate } = useSWRConfig();
|
const { mutate } = useSWRConfig();
|
||||||
|
|
||||||
@@ -202,7 +204,7 @@ export function LLMProviderUpdateForm({
|
|||||||
const successMsg = existingLlmProvider
|
const successMsg = existingLlmProvider
|
||||||
? "Provider updated successfully!"
|
? "Provider updated successfully!"
|
||||||
: "Provider enabled successfully!";
|
: "Provider enabled successfully!";
|
||||||
if (setPopup) {
|
if (!hideSuccess && setPopup) {
|
||||||
setPopup({
|
setPopup({
|
||||||
type: "success",
|
type: "success",
|
||||||
message: successMsg,
|
message: successMsg,
|
||||||
|
@@ -10,7 +10,7 @@ import { SettingsContext } from "@/components/settings/SettingsProvider";
|
|||||||
export function NoSourcesModal() {
|
export function NoSourcesModal() {
|
||||||
const settings = useContext(SettingsContext);
|
const settings = useContext(SettingsContext);
|
||||||
const [isHidden, setIsHidden] = useState(
|
const [isHidden, setIsHidden] = useState(
|
||||||
!settings?.settings.search_page_enabled ?? false
|
!settings?.settings.search_page_enabled
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
@@ -19,7 +19,7 @@ export function NoSourcesModal() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
className="max-w-4xl"
|
width="max-w-3xl w-full"
|
||||||
title="🧐 No sources connected"
|
title="🧐 No sources connected"
|
||||||
onOutsideClick={() => setIsHidden(true)}
|
onOutsideClick={() => setIsHidden(true)}
|
||||||
>
|
>
|
||||||
|
@@ -27,7 +27,6 @@ export function _CompletedWelcomeFlowDummyComponent() {
|
|||||||
export function _WelcomeModal({ user }: { user: User | null }) {
|
export function _WelcomeModal({ user }: { user: User | null }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const [canBegin, setCanBegin] = useState(false);
|
|
||||||
const [providerOptions, setProviderOptions] = useState<
|
const [providerOptions, setProviderOptions] = useState<
|
||||||
WellKnownLLMProviderDescriptor[]
|
WellKnownLLMProviderDescriptor[]
|
||||||
>([]);
|
>([]);
|
||||||
@@ -75,19 +74,13 @@ export function _WelcomeModal({ user }: { user: User | null }) {
|
|||||||
|
|
||||||
<div className="max-h-[900px] overflow-y-scroll">
|
<div className="max-h-[900px] overflow-y-scroll">
|
||||||
<ApiKeyForm
|
<ApiKeyForm
|
||||||
|
// Don't show success message on initial setup
|
||||||
|
hideSuccess
|
||||||
setPopup={setPopup}
|
setPopup={setPopup}
|
||||||
onSuccess={() => {
|
onSuccess={clientSetWelcomeFlowComplete}
|
||||||
router.refresh();
|
|
||||||
refreshProviderInfo();
|
|
||||||
setCanBegin(true);
|
|
||||||
}}
|
|
||||||
providerOptions={providerOptions}
|
providerOptions={providerOptions}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
|
||||||
<Button disabled={!canBegin} onClick={clientSetWelcomeFlowComplete}>
|
|
||||||
Get Started
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
@@ -9,10 +9,12 @@ export const ApiKeyForm = ({
|
|||||||
onSuccess,
|
onSuccess,
|
||||||
providerOptions,
|
providerOptions,
|
||||||
setPopup,
|
setPopup,
|
||||||
|
hideSuccess,
|
||||||
}: {
|
}: {
|
||||||
onSuccess: () => void;
|
onSuccess: () => void;
|
||||||
providerOptions: WellKnownLLMProviderDescriptor[];
|
providerOptions: WellKnownLLMProviderDescriptor[];
|
||||||
setPopup: (popup: PopupSpec) => void;
|
setPopup: (popup: PopupSpec) => void;
|
||||||
|
hideSuccess?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const defaultProvider = providerOptions[0]?.name;
|
const defaultProvider = providerOptions[0]?.name;
|
||||||
const providerNameToIndexMap = new Map<string, number>();
|
const providerNameToIndexMap = new Map<string, number>();
|
||||||
@@ -56,6 +58,7 @@ export const ApiKeyForm = ({
|
|||||||
onClose={() => onSuccess()}
|
onClose={() => onSuccess()}
|
||||||
shouldMarkAsDefault
|
shouldMarkAsDefault
|
||||||
setPopup={setPopup}
|
setPopup={setPopup}
|
||||||
|
hideSuccess={hideSuccess}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
);
|
);
|
||||||
@@ -65,6 +68,7 @@ export const ApiKeyForm = ({
|
|||||||
onClose={() => onSuccess()}
|
onClose={() => onSuccess()}
|
||||||
shouldMarkAsDefault
|
shouldMarkAsDefault
|
||||||
setPopup={setPopup}
|
setPopup={setPopup}
|
||||||
|
hideSuccess={hideSuccess}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
|
@@ -24,18 +24,16 @@ export const ApiKeyModal = ({
|
|||||||
if (!shouldShowConfigurationNeeded) {
|
if (!shouldShowConfigurationNeeded) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title="Set an API Key!"
|
title="Set an API Key!"
|
||||||
width="max-w-3xl w-full"
|
width="max-w-3xl w-full"
|
||||||
onOutsideClick={() => hide()}
|
onOutsideClick={() => hide()}
|
||||||
>
|
>
|
||||||
<div className="max-h-[75vh] overflow-y-auto flex flex-col">
|
<>
|
||||||
<div>
|
<div className="mb-5 text-sm text-gray-700">
|
||||||
<div className="mb-5 text-sm">
|
Please provide an API Key below in order to start using Danswer – you
|
||||||
Please provide an API Key below in order to start using
|
can always change this later.
|
||||||
Danswer – you can always change this later.
|
|
||||||
<br />
|
<br />
|
||||||
If you'd rather look around first, you can
|
If you'd rather look around first, you can
|
||||||
<strong onClick={() => hide()} className="text-link cursor-pointer">
|
<strong onClick={() => hide()} className="text-link cursor-pointer">
|
||||||
@@ -54,8 +52,7 @@ export const ApiKeyModal = ({
|
|||||||
}}
|
}}
|
||||||
providerOptions={providerOptions}
|
providerOptions={providerOptions}
|
||||||
/>
|
/>
|
||||||
</div>
|
</>
|
||||||
</div>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user