dont run health check if still ingesting
This commit is contained in:
parent
44a54a1028
commit
f114766c31
1 changed files with 11 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
} from "@tanstack/react-query";
|
||||
import { useChat } from "@/contexts/chat-context";
|
||||
import { useGetSettingsQuery } from "./useGetSettingsQuery";
|
||||
import { useGetTasksQuery } from "./useGetTasksQuery";
|
||||
|
||||
export interface ProviderHealthDetails {
|
||||
llm_model: string;
|
||||
|
|
@ -45,6 +46,15 @@ export const useProviderHealthQuery = (
|
|||
|
||||
const { data: settings = {} } = useGetSettingsQuery();
|
||||
|
||||
// Check if there are any active ingestion tasks
|
||||
const { data: tasks = [] } = useGetTasksQuery();
|
||||
const hasActiveIngestion = tasks.some(
|
||||
(task) =>
|
||||
task.status === "pending" ||
|
||||
task.status === "running" ||
|
||||
task.status === "processing",
|
||||
);
|
||||
|
||||
async function checkProviderHealth(): Promise<ProviderHealthResponse> {
|
||||
try {
|
||||
const url = new URL("/api/provider/health", window.location.origin);
|
||||
|
|
@ -146,6 +156,7 @@ export const useProviderHealthQuery = (
|
|||
enabled:
|
||||
!!settings?.edited &&
|
||||
isOnboardingComplete &&
|
||||
!hasActiveIngestion && // Disable health checks when ingestion is happening
|
||||
options?.enabled !== false, // Only run after onboarding is complete
|
||||
...options,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue