init: 2026Technology-Competition initial commit
This commit is contained in:
@@ -0,0 +1,327 @@
|
||||
import request from '../request'
|
||||
|
||||
export interface PageResult<T> {
|
||||
items: T[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
totalPages: number
|
||||
}
|
||||
|
||||
export interface UserItem {
|
||||
id: number
|
||||
userid: string
|
||||
username: string
|
||||
email?: string
|
||||
departmentId?: number
|
||||
departmentName?: string
|
||||
isActive?: boolean
|
||||
agentAutoExecute?: boolean
|
||||
roleIds?: number[]
|
||||
roles?: string[]
|
||||
lastLoginAt?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface UserPayload {
|
||||
userid?: string
|
||||
username: string
|
||||
email?: string
|
||||
password?: string
|
||||
departmentId?: number
|
||||
roleIds?: number[]
|
||||
isActive?: boolean
|
||||
agentAutoExecute?: boolean
|
||||
}
|
||||
|
||||
export interface DeptNode {
|
||||
id: number
|
||||
name: string
|
||||
parentId?: number
|
||||
sortOrder?: number
|
||||
children?: DeptNode[]
|
||||
}
|
||||
|
||||
export interface PermissionItem {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
resource: string
|
||||
}
|
||||
|
||||
export interface RoleItem {
|
||||
id: number
|
||||
name: string
|
||||
description?: string
|
||||
dataScope?: string
|
||||
agentAutoExecute?: boolean
|
||||
permissionIds?: number[]
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface RolePayload {
|
||||
name: string
|
||||
description?: string
|
||||
dataScope?: string
|
||||
agentAutoExecute?: boolean
|
||||
permissionIds?: number[]
|
||||
}
|
||||
|
||||
export interface LogItem {
|
||||
id: number
|
||||
operator: string
|
||||
action: string
|
||||
resource: string
|
||||
detail: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface LogQuery {
|
||||
operator?: string
|
||||
actionType?: string
|
||||
keyword?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export const userApi = {
|
||||
list: (params: Record<string, unknown>) => request.get('/users', { params }),
|
||||
create: (data: UserPayload) => request.post('/users', data),
|
||||
update: (id: number, data: UserPayload) => request.put(`/users/${id}`, data),
|
||||
updateStatus: (id: number, isActive: boolean) =>
|
||||
request.put(`/users/${id}/status`, null, { params: { isActive } }),
|
||||
exportCsv: (params: Record<string, unknown>) =>
|
||||
request.get('/users/export', { params, responseType: 'blob' }),
|
||||
}
|
||||
|
||||
export const deptApi = {
|
||||
tree: () => request.get('/departments'),
|
||||
}
|
||||
|
||||
export const roleApi = {
|
||||
list: () => request.get('/roles'),
|
||||
permissions: () => request.get('/roles/permissions'),
|
||||
create: (data: RolePayload) => request.post('/roles', data),
|
||||
update: (id: number, data: RolePayload) => request.put(`/roles/${id}`, data),
|
||||
}
|
||||
|
||||
export const logApi = {
|
||||
list: (params: LogQuery) => request.get('/logs', { params }),
|
||||
}
|
||||
|
||||
export interface ImportRow {
|
||||
rowNo?: number
|
||||
title?: string
|
||||
docType?: string
|
||||
phase?: string
|
||||
priority?: string
|
||||
deadline?: string
|
||||
reviewDate?: string
|
||||
subProject?: string
|
||||
category?: string
|
||||
impactLevel?: string
|
||||
description?: string
|
||||
assigneeUserid?: string
|
||||
departmentName?: string
|
||||
status?: string
|
||||
errors?: string[]
|
||||
}
|
||||
|
||||
export interface ImportPreview {
|
||||
total: number
|
||||
validCount: number
|
||||
errorCount: number
|
||||
headerValid?: boolean
|
||||
rows: ImportRow[]
|
||||
}
|
||||
|
||||
export interface ImportRecord {
|
||||
id: number
|
||||
fileName: string
|
||||
totalCount: number
|
||||
successCount: number
|
||||
failCount: number
|
||||
status: string
|
||||
errorLog?: string
|
||||
operator?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface ImportSuggestion {
|
||||
rowNo?: number
|
||||
field?: string
|
||||
fieldName?: string
|
||||
original?: string
|
||||
suggested?: string
|
||||
reason?: string
|
||||
level?: string
|
||||
}
|
||||
|
||||
export interface AgentValidateResponse {
|
||||
usable: boolean
|
||||
usableReason?: string
|
||||
suggestions: ImportSuggestion[]
|
||||
engine: string
|
||||
}
|
||||
|
||||
export const importApi = {
|
||||
template: () =>
|
||||
request.get('/import/template', { responseType: 'blob' }),
|
||||
preview: (file: File) => {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
return request.post('/import/excel', form)
|
||||
},
|
||||
aiValidate: (rows: ImportRow[]) =>
|
||||
request.post('/import/ai-validate', rows, { timeout: 1800000 }),
|
||||
confirm: (fileName: string, rows: ImportRow[]) =>
|
||||
request.post('/import/confirm', { fileName, rows }),
|
||||
records: (page = 1, pageSize = 20) =>
|
||||
request.get('/import/records', { params: { page, pageSize } }),
|
||||
}
|
||||
|
||||
export interface AgentConfig {
|
||||
maxSteps?: number
|
||||
autoExecuteHighRisk?: boolean
|
||||
userRateLimit?: number
|
||||
}
|
||||
|
||||
export const agentApi = {
|
||||
getConfig: () => request.get('/agent/config'),
|
||||
updateConfig: (config: AgentConfig) => request.put('/agent/config', config),
|
||||
}
|
||||
|
||||
export interface PromptTemplateItem {
|
||||
id: number
|
||||
templateId: string
|
||||
name: string
|
||||
category: string
|
||||
version: number
|
||||
content: string
|
||||
variables?: string
|
||||
outputSchema?: string
|
||||
isActive?: boolean
|
||||
isDefault?: boolean
|
||||
createdAt?: string
|
||||
updatedAt?: string
|
||||
}
|
||||
|
||||
export interface PromptVersion {
|
||||
id: number
|
||||
templateId: string
|
||||
version: number
|
||||
content: string
|
||||
changeLog?: string
|
||||
createdBy?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface PromptLogItem {
|
||||
id: number
|
||||
requestId: string
|
||||
templateId: string
|
||||
templateVersion: number
|
||||
renderedPrompt: string
|
||||
executionTimeMs?: number
|
||||
llmModel?: string
|
||||
modelProvider?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface PromptStats {
|
||||
totalTemplates: number
|
||||
activeTemplates: number
|
||||
totalVersions: number
|
||||
totalRenders: number
|
||||
}
|
||||
|
||||
export const promptApi = {
|
||||
list: (params: Record<string, unknown>) => request.get('/prompts', { params }),
|
||||
detail: (templateId: string) => request.get(`/prompts/${templateId}`),
|
||||
create: (data: Record<string, unknown>) => request.post('/prompts', data),
|
||||
update: (templateId: string, data: Record<string, unknown>) =>
|
||||
request.put(`/prompts/${templateId}`, data),
|
||||
rollback: (templateId: string, version: number) =>
|
||||
request.post(`/prompts/${templateId}/rollback`, null, { params: { version } }),
|
||||
test: (templateId: string, variables: Record<string, unknown>) =>
|
||||
request.post(`/prompts/${templateId}/test`, { variables }),
|
||||
versions: (templateId: string) => request.get(`/prompts/${templateId}/versions`),
|
||||
logs: (page = 1, pageSize = 20) =>
|
||||
request.get('/prompts/logs', { params: { page, pageSize } }),
|
||||
stats: () => request.get('/prompts/stats'),
|
||||
}
|
||||
|
||||
export interface AiConfig {
|
||||
provider: string
|
||||
ollamaBaseUrl?: string
|
||||
ollamaChatModel?: string
|
||||
ollamaEmbeddingModel?: string
|
||||
deepseekModel?: string
|
||||
deepseekEmbeddingModel?: string
|
||||
deepseekApiKey?: string
|
||||
autoFallbackEnabled?: boolean
|
||||
}
|
||||
|
||||
export const aiConfigApi = {
|
||||
get: () => request.get('/ai/config'),
|
||||
update: (config: AiConfig) => request.put('/ai/config', config),
|
||||
test: () => request.post('/ai/config/test'),
|
||||
}
|
||||
|
||||
export interface AgentOverview {
|
||||
todayExecutions: number
|
||||
yesterdayExecutions: number
|
||||
growthRate: number
|
||||
todayPlans: number
|
||||
toolTotalCount: number
|
||||
toolSuccessCount: number
|
||||
toolSuccessRate: number
|
||||
pendingApprovals: number
|
||||
latestExecutions: AgentExecution[]
|
||||
trendData: { hour: string; count: number }[]
|
||||
}
|
||||
|
||||
export interface AgentExecution {
|
||||
id: number
|
||||
planId: number
|
||||
toolName: string
|
||||
status: string
|
||||
executionTimeMs?: number
|
||||
outputResult?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface AgentPlanItem {
|
||||
planId: number
|
||||
issueId: number
|
||||
issueNo: string
|
||||
issueTitle: string
|
||||
goal: string
|
||||
status: string
|
||||
requiresApproval: boolean
|
||||
approvalStatus: string
|
||||
approvalComment?: string
|
||||
toolName?: string
|
||||
toolParams?: string
|
||||
approvalReason?: string
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface AgentToolItem {
|
||||
name: string
|
||||
description: string
|
||||
isWrite: boolean
|
||||
}
|
||||
|
||||
export const agentOverviewApi = {
|
||||
getOverview: () => request.get('/agent/overview'),
|
||||
getPlans: (params: { approvalStatus?: string; page?: number; pageSize?: number }) =>
|
||||
request.get('/agent/plans', { params }),
|
||||
approvePlan: (planId: number, comment?: string) =>
|
||||
request.post(`/agent/approval/${planId}/approve`, { comment }),
|
||||
rejectPlan: (planId: number, comment?: string) =>
|
||||
request.post(`/agent/approval/${planId}/reject`, { comment }),
|
||||
getTools: () => request.get('/agent/tools'),
|
||||
}
|
||||
Reference in New Issue
Block a user