Initial commit: OmniAI Web Frontend
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { buildApiUrl, buildAuthHeaders } from "./serverConnection";
|
||||
|
||||
export interface ProviderHealthEntry {
|
||||
status: string;
|
||||
lastCheck: string | null;
|
||||
lastError: string | null;
|
||||
details: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface CallStatRow {
|
||||
provider: string;
|
||||
model: string;
|
||||
status: string;
|
||||
count: string;
|
||||
avg_ms: string | null;
|
||||
total_cost: string | null;
|
||||
}
|
||||
|
||||
export interface KeyStatRow {
|
||||
provider: string;
|
||||
total_keys: string;
|
||||
active_keys: string;
|
||||
current_load: string;
|
||||
}
|
||||
|
||||
export interface ProviderHealthResponse {
|
||||
health: Record<string, ProviderHealthEntry>;
|
||||
callStats: CallStatRow[];
|
||||
keyStats: KeyStatRow[];
|
||||
checkedAt: string;
|
||||
}
|
||||
|
||||
export const providerHealthClient = {
|
||||
async getStatus(): Promise<ProviderHealthResponse> {
|
||||
const res = await fetch(buildApiUrl("admin/providers/status"), {
|
||||
method: "GET",
|
||||
headers: buildAuthHeaders(),
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`Provider health request failed (${res.status})`);
|
||||
}
|
||||
return res.json() as Promise<ProviderHealthResponse>;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user