main-ruqi #1

Merged
wangwei merged 17 commits from main-ruqi into main 2026-07-02 22:05:17 +08:00
2 changed files with 35 additions and 2 deletions
Showing only changes of commit 39a51c9e83 - Show all commits
+23
View File
@@ -294,4 +294,27 @@ export interface SystemHealth {
sessions: { active: number; max: number }; sessions: { active: number; max: number };
} }
export type ModelRole = 'main_llm' | 'hyde_llm' | 'embedding' | 'reranker';
export type ModelStatus = 'ok' | 'error' | 'never_called' | 'disabled';
export interface ModelUsageEntry {
role: ModelRole;
role_label: string;
provider: string;
model: string;
enabled: boolean;
status: ModelStatus;
total_tokens: number;
call_count_ok: number;
call_count_error: number;
last_called_at: string | null;
last_latency_ms: number | null;
last_error: string | null;
shares_usage_with: ModelRole | null;
}
export interface ModelUsageResponse {
models: ModelUsageEntry[];
}
export { API_BASE_URL }; export { API_BASE_URL };
+12 -2
View File
@@ -1,4 +1,4 @@
import { fetchAPI, type SystemConfig, type SystemHealth, type SystemStats } from './index'; import { fetchAPI, type ModelUsageResponse, 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');
@@ -12,4 +12,14 @@ export async function getSystemHealth(): Promise<SystemHealth> {
return fetchAPI<SystemHealth>('/status/health'); return fetchAPI<SystemHealth>('/status/health');
} }
export type { SystemConfig, SystemHealth, SystemStats }; /** Passive read: current connection status + cumulative token usage for all 4 AI model roles. */
export async function getModelUsage(): Promise<ModelUsageResponse> {
return fetchAPI<ModelUsageResponse>('/status/models');
}
/** Active check: sends one minimal request to each enabled model, then returns fresh statuses. */
export async function pingModelConnections(): Promise<ModelUsageResponse> {
return fetchAPI<ModelUsageResponse>('/status/models/ping', { method: 'POST' });
}
export type { ModelUsageResponse, SystemConfig, SystemHealth, SystemStats };