2026-08-03 11:37:22 +08:00
|
|
|
import { fetchAPI, type MCPStatusResponse, type ModelUsageResponse, type SystemConfig, type SystemHealth, type SystemStats } from './index';
|
2026-05-14 15:07:34 +08:00
|
|
|
|
|
|
|
|
export async function getSystemStats(): Promise<SystemStats> {
|
|
|
|
|
return fetchAPI<SystemStats>('/status/stats');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getSystemConfig(): Promise<SystemConfig> {
|
|
|
|
|
return fetchAPI<SystemConfig>('/status/config');
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-21 23:54:52 +08:00
|
|
|
export async function getSystemHealth(): Promise<SystemHealth> {
|
|
|
|
|
return fetchAPI<SystemHealth>('/status/health');
|
2026-05-14 15:07:34 +08:00
|
|
|
}
|
|
|
|
|
|
2026-07-02 17:23:43 +08:00
|
|
|
/** 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' });
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-03 11:37:22 +08:00
|
|
|
/** MCP endpoint config, advertised tools, and per-tool call counters. */
|
|
|
|
|
export async function getMCPStatus(): Promise<MCPStatusResponse> {
|
|
|
|
|
return fetchAPI<MCPStatusResponse>('/status/mcp');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type { MCPStatusResponse, ModelUsageResponse, SystemConfig, SystemHealth, SystemStats };
|