feat: add ModelUsageEntry types and status API client functions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
wangwei
2026-07-02 17:23:43 +08:00
co-authored by Copilot
parent 049da2297b
commit 39a51c9e83
2 changed files with 35 additions and 2 deletions
+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> {
return fetchAPI<SystemStats>('/status/stats');
@@ -12,4 +12,14 @@ export async function getSystemHealth(): Promise<SystemHealth> {
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 };