feat(admin): 优化后台运维与任务管理
完善平台、基准模型、定价规则和实时负载的紧凑查询与滚动展示,并固定关键操作列。 新增管理员任务记录、批量计费结算和用户组限流、额度及模型权限维护能力,同时补充任务脱敏、查询索引与 OpenAPI 契约。 验证:pnpm openapi、Go 全量测试、pnpm lint、pnpm test、pnpm build、gofmt 与差异格式检查均通过。
This commit is contained in:
+38
-1
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
AdminGatewayTask,
|
||||
AuthResponse,
|
||||
AuthUser,
|
||||
BaseModelCatalogItem,
|
||||
@@ -59,7 +60,7 @@ import type {
|
||||
WalletRechargeRequest,
|
||||
WalletSummaryResponse,
|
||||
} from '@easyai-ai-gateway/contracts';
|
||||
import type { PlatformCreateInput, PlatformModelBindingInput, WorkspaceTaskQuery } from './types';
|
||||
import type { AdminTaskQuery, PlatformCreateInput, PlatformModelBindingInput, WorkspaceTaskQuery } from './types';
|
||||
|
||||
const API_BASE = import.meta.env.VITE_GATEWAY_API_BASE_URL ?? 'http://localhost:8088';
|
||||
export const OIDC_BROWSER_SESSION_CREDENTIAL = '__easyai_gateway_oidc_browser_session__';
|
||||
@@ -967,6 +968,42 @@ export async function listTasks(token: string, query: WorkspaceTaskQuery): Promi
|
||||
return request<ListResponse<GatewayTask>>(`/api/workspace/tasks?${search.toString()}`, { token });
|
||||
}
|
||||
|
||||
export async function listAdminTasks(token: string, query: AdminTaskQuery): Promise<ListResponse<AdminGatewayTask>> {
|
||||
const search = new URLSearchParams({
|
||||
page: String(query.page),
|
||||
pageSize: String(query.pageSize),
|
||||
});
|
||||
if (query.query) search.set('q', query.query);
|
||||
if (query.tenantId) search.set('tenantId', query.tenantId);
|
||||
if (query.userId) search.set('userId', query.userId);
|
||||
if (query.userGroupId) search.set('userGroupId', query.userGroupId);
|
||||
if (query.status) search.set('status', query.status);
|
||||
if (query.platformId) search.set('platformId', query.platformId);
|
||||
if (query.model) search.set('model', query.model);
|
||||
if (query.modelType) search.set('modelType', query.modelType);
|
||||
if (query.runMode) search.set('runMode', query.runMode);
|
||||
if (query.billingStatus) search.set('billingStatus', query.billingStatus);
|
||||
if (query.apiKey) search.set('apiKey', query.apiKey);
|
||||
if (query.createdFrom) search.set('createdFrom', query.createdFrom);
|
||||
if (query.createdTo) search.set('createdTo', query.createdTo);
|
||||
return request<ListResponse<AdminGatewayTask>>(`/api/admin/tasks?${search.toString()}`, { token });
|
||||
}
|
||||
|
||||
export async function getAdminTask(token: string, taskId: string, sensitive: 'masked' | 'full' = 'masked'): Promise<AdminGatewayTask> {
|
||||
return request<AdminGatewayTask>(`/api/admin/tasks/${taskId}?sensitive=${sensitive}`, { token });
|
||||
}
|
||||
|
||||
export async function listAdminTaskParamPreprocessing(
|
||||
token: string,
|
||||
taskId: string,
|
||||
sensitive: 'masked' | 'full' = 'masked',
|
||||
): Promise<ListResponse<GatewayTaskParamPreprocessingLog>> {
|
||||
return request<ListResponse<GatewayTaskParamPreprocessingLog>>(
|
||||
`/api/admin/tasks/${taskId}/param-preprocessing?sensitive=${sensitive}`,
|
||||
{ token },
|
||||
);
|
||||
}
|
||||
|
||||
export async function getWalletSummary(token: string): Promise<WalletSummaryResponse> {
|
||||
return request<WalletSummaryResponse>('/api/workspace/wallet', { token });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user