feat(status): add SystemHealth type and getSystemHealth() API function
This commit is contained in:
@@ -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 };
|
||||||
|
|||||||
@@ -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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user