add tooltip and docling check to disable button
This commit is contained in:
parent
2dcae5aae6
commit
02989722d7
2 changed files with 21 additions and 5 deletions
|
|
@ -86,13 +86,26 @@ function DoclingSetupDialog({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DoclingHealthBanner({ className }: DoclingHealthBannerProps) {
|
// Custom hook to check docling health status
|
||||||
|
export function useDoclingHealth() {
|
||||||
const { data: health, isLoading, isError } = useDoclingHealthQuery();
|
const { data: health, isLoading, isError } = useDoclingHealthQuery();
|
||||||
const [showDialog, setShowDialog] = useState(false);
|
|
||||||
|
|
||||||
const isHealthy = health?.status === "healthy" && !isError;
|
const isHealthy = health?.status === "healthy" && !isError;
|
||||||
const isUnhealthy = health?.status === "unhealthy" || isError;
|
const isUnhealthy = health?.status === "unhealthy" || isError;
|
||||||
|
|
||||||
|
return {
|
||||||
|
health,
|
||||||
|
isLoading,
|
||||||
|
isError,
|
||||||
|
isHealthy,
|
||||||
|
isUnhealthy,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DoclingHealthBanner({ className }: DoclingHealthBannerProps) {
|
||||||
|
const { isLoading, isHealthy, isUnhealthy } = useDoclingHealth();
|
||||||
|
const [showDialog, setShowDialog] = useState(false);
|
||||||
|
|
||||||
// Only show banner when service is unhealthy
|
// Only show banner when service is unhealthy
|
||||||
if (isLoading || isHealthy) {
|
if (isLoading || isHealthy) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import {
|
||||||
type OnboardingVariables,
|
type OnboardingVariables,
|
||||||
useOnboardingMutation,
|
useOnboardingMutation,
|
||||||
} from "@/app/api/mutations/useOnboardingMutation";
|
} from "@/app/api/mutations/useOnboardingMutation";
|
||||||
import { DoclingHealthBanner } from "@/components/docling-health-banner";
|
import { DoclingHealthBanner, useDoclingHealth } from "@/components/docling-health-banner";
|
||||||
import IBMLogo from "@/components/logo/ibm-logo";
|
import IBMLogo from "@/components/logo/ibm-logo";
|
||||||
import OllamaLogo from "@/components/logo/ollama-logo";
|
import OllamaLogo from "@/components/logo/ollama-logo";
|
||||||
import OpenAILogo from "@/components/logo/openai-logo";
|
import OpenAILogo from "@/components/logo/openai-logo";
|
||||||
|
|
@ -35,6 +35,7 @@ import { OpenAIOnboarding } from "./components/openai-onboarding";
|
||||||
function OnboardingPage() {
|
function OnboardingPage() {
|
||||||
const { data: settingsDb, isLoading: isSettingsLoading } =
|
const { data: settingsDb, isLoading: isSettingsLoading } =
|
||||||
useGetSettingsQuery();
|
useGetSettingsQuery();
|
||||||
|
const { isHealthy: isDoclingHealthy } = useDoclingHealth();
|
||||||
|
|
||||||
const redirect = "/";
|
const redirect = "/";
|
||||||
|
|
||||||
|
|
@ -115,7 +116,7 @@ function OnboardingPage() {
|
||||||
onboardingMutation.mutate(onboardingData);
|
onboardingMutation.mutate(onboardingData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isComplete = !!settings.llm_model && !!settings.embedding_model;
|
const isComplete = !!settings.llm_model && !!settings.embedding_model && isDoclingHealthy;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-dvh w-full flex gap-5 flex-col items-center justify-center bg-background relative p-4">
|
<div className="min-h-dvh w-full flex gap-5 flex-col items-center justify-center bg-background relative p-4">
|
||||||
|
|
@ -200,7 +201,9 @@ function OnboardingPage() {
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
{!isComplete && (
|
{!isComplete && (
|
||||||
<TooltipContent>
|
<TooltipContent>
|
||||||
Please fill in all required fields
|
{!!settings.llm_model && !!settings.embedding_model && !isDoclingHealthy
|
||||||
|
? "docling-serve must be running to continue"
|
||||||
|
: "Please fill in all required fields"}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
)}
|
)}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue