This commit is contained in:
k
2026-09-21 22:12:37 +02:00
parent b4cb62b490
commit 19b791493f
7 changed files with 425 additions and 10 deletions
+21
View File
@@ -42,6 +42,18 @@ export interface Report {
updated_at: number;
}
export interface ModelPolicyEntry {
enabled: boolean;
hourly: number;
daily: number;
}
export interface PolicyModel extends DriverModel {
enabled: boolean;
hourly: number;
daily: number;
}
const TOKEN_KEY = "kisassistant_token";
export function getToken(): string | null {
@@ -140,6 +152,15 @@ export const api = {
method: "POST",
body: JSON.stringify({ shadowbanned }),
}),
/** Admin: per-model access policy (kill-switch + rate limits). */
adminModelPolicy: (refresh = false) =>
req<{ models: PolicyModel[] }>(`/api/admin/model-policy${refresh ? "?refresh=1" : ""}`),
adminModelPolicyPatch: (model: string, patch: { enabled?: boolean; hourly?: number; daily?: number }) =>
req<{ model: PolicyModel }>(`/api/admin/model-policy`, {
method: "PATCH",
body: JSON.stringify({ model, ...patch }),
}),
adminPatch: (id: string, patch: { displayName?: string; avatarUrl?: string; theme?: string; email?: string }) =>
req<{ user: User }>(`/api/admin/users/${id}`, { method: "PATCH", body: JSON.stringify(patch) }),