feat(status): add SystemHealth type and getSystemHealth() API function

This commit is contained in:
2026-05-21 23:54:52 +08:00
parent 6bf5600a26
commit 4e90b4f2da
2 changed files with 21 additions and 4 deletions

View File

@@ -239,4 +239,21 @@ export interface SystemConfig {
document_metadata_path: string; document_metadata_path: string;
} }
export interface ServiceHealth {
status: 'ok' | 'error' | 'unknown';
error?: string;
}
export interface SystemHealth {
milvus: ServiceHealth & {
connected?: boolean;
collection_name?: string;
num_entities?: number;
};
minio: ServiceHealth & { connected?: boolean };
bm25: { available: boolean };
reranker: { enabled: boolean; model?: string | null };
sessions: { active: number; max: number };
}
export { API_BASE_URL }; export { API_BASE_URL };

View File

@@ -1,4 +1,4 @@
import { fetchAPI, type SystemConfig, type SystemStats } from './index'; import { fetchAPI, type SystemConfig, type SystemHealth, type SystemStats } from './index';
export async function getSystemStats(): Promise<SystemStats> { export async function getSystemStats(): Promise<SystemStats> {
return fetchAPI<SystemStats>('/status/stats'); return fetchAPI<SystemStats>('/status/stats');
@@ -8,8 +8,8 @@ export async function getSystemConfig(): Promise<SystemConfig> {
return fetchAPI<SystemConfig>('/status/config'); return fetchAPI<SystemConfig>('/status/config');
} }
export async function getMilvusHealth(): Promise<{ connected: boolean; collections: string[] }> { export async function getSystemHealth(): Promise<SystemHealth> {
return fetchAPI('/status/milvus/health'); return fetchAPI<SystemHealth>('/status/health');
} }
export type { SystemConfig, SystemStats }; export type { SystemConfig, SystemHealth, SystemStats };