mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-05 04:51:51 +08:00
chore: 还原 PR #44 手写实现,准备由 Codex 按新规则重写
This commit is contained in:
1 parent
3b2887f349
commit
ba3025d04f
15 files changed
+26
-254
No files matched your search
+2
-6
@@ -300,7 +300,6 @@ export const api = {
|
||||
task: (id: string) => get<Task>(`/tasks/${encodeURIComponent(id)}`),
|
||||
createTask: (input: {
|
||||
name?: string;
|
||||
remark?: string;
|
||||
categoryId?: number;
|
||||
description: string;
|
||||
goal: string;
|
||||
@@ -311,13 +310,11 @@ export const api = {
|
||||
seedFirstIntent?: boolean;
|
||||
planHeartbeatSeconds?: number;
|
||||
coverageEnabled?: boolean;
|
||||
workerCount?: number;
|
||||
interceptRules?: AssetInterceptRuleInput[];
|
||||
schedule?: ScheduleInput;
|
||||
}) =>
|
||||
post<Task>("/tasks", {
|
||||
name: input.name ?? "",
|
||||
remark: input.remark ?? "",
|
||||
category_id: input.categoryId ?? null,
|
||||
description: input.description,
|
||||
goal: input.goal,
|
||||
@@ -328,7 +325,6 @@ export const api = {
|
||||
seed_first_intent: input.seedFirstIntent ?? false,
|
||||
plan_heartbeat_seconds: input.planHeartbeatSeconds ?? 0, // 0 = 后端归一到默认 600(10min)
|
||||
coverage_enabled: input.coverageEnabled ?? true, // 默认开;false=关闭资产覆盖度功能
|
||||
worker_count: input.workerCount ?? 0, // 0 = 用全局默认 workers
|
||||
intercept_rules: input.interceptRules ?? [], // 任务级资产拦截规则
|
||||
schedule: input.schedule ? schedulePayload(input.schedule) : undefined,
|
||||
}),
|
||||
@@ -361,11 +357,11 @@ export const api = {
|
||||
}),
|
||||
taskTemplates: () => get<{ templates: TaskTemplate[] }>("/task-templates").then((r) => arr(r.templates)),
|
||||
createTaskTemplate: (
|
||||
input: Pick<TaskTemplate, "name" | "description" | "goal" | "remark" | "category_id" | "intercept_rules" | "worker_count">,
|
||||
input: Pick<TaskTemplate, "name" | "description" | "goal" | "category_id" | "intercept_rules">,
|
||||
) => post<TaskTemplate>("/task-templates", input),
|
||||
updateTaskTemplate: (
|
||||
id: number,
|
||||
input: Partial<Pick<TaskTemplate, "name" | "description" | "goal" | "remark" | "category_id" | "intercept_rules" | "worker_count">>,
|
||||
input: Partial<Pick<TaskTemplate, "name" | "description" | "goal" | "category_id" | "intercept_rules">>,
|
||||
) => patch<TaskTemplate>(`/task-templates/${id}`, input),
|
||||
deleteTaskTemplate: (id: number) => del<{ deleted: number }>(`/task-templates/${id}`),
|
||||
updateTaskLLMProfiles: (id: string, llmProfileIds: number[], activeLLMProfileId?: number) =>
|
||||
|
||||
@@ -1182,12 +1182,10 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
const created: Task = {
|
||||
id,
|
||||
name: String(b.name ?? ""),
|
||||
remark: typeof b.remark === "string" ? b.remark.trim() : "",
|
||||
category_id: category?.id,
|
||||
category_name: category?.name,
|
||||
description: String(b.description ?? "新任务"),
|
||||
goal: String(b.goal ?? ""),
|
||||
worker_count: typeof b.worker_count === "number" ? Math.min(50, Math.max(0, Math.floor(b.worker_count))) : 0,
|
||||
status: "created",
|
||||
created_at: now.toISOString(),
|
||||
created_unix: Math.floor(now.getTime() / 1000),
|
||||
@@ -1317,10 +1315,6 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
name,
|
||||
description,
|
||||
goal,
|
||||
remark: typeof b.remark === "string" ? b.remark.trim() : "",
|
||||
category_id: typeof b.category_id === "number" ? b.category_id : null,
|
||||
intercept_rules: Array.isArray(b.intercept_rules) ? b.intercept_rules : [],
|
||||
worker_count: typeof b.worker_count === "number" ? Math.min(50, Math.max(0, Math.floor(b.worker_count))) : 0,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
};
|
||||
@@ -1344,10 +1338,6 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
template.name = name;
|
||||
template.description = description;
|
||||
template.goal = goal;
|
||||
if (typeof b.remark === "string") template.remark = b.remark.trim();
|
||||
if ("category_id" in b) template.category_id = typeof b.category_id === "number" ? b.category_id : null;
|
||||
if (Array.isArray(b.intercept_rules)) template.intercept_rules = b.intercept_rules;
|
||||
if (typeof b.worker_count === "number") template.worker_count = Math.min(50, Math.max(0, Math.floor(b.worker_count)));
|
||||
template.updated_at = new Date().toISOString();
|
||||
mockTaskTemplates.sort((a, b) => b.updated_at.localeCompare(a.updated_at) || b.id - a.id);
|
||||
return template;
|
||||
|
||||
@@ -8,7 +8,6 @@ export interface Task {
|
||||
distinct_findings?: FindingDistinctStats;
|
||||
id: string;
|
||||
remark?: string;
|
||||
worker_count?: number; // 本任务 Worker 数;0/缺省=用全局默认
|
||||
name?: string; // 可选任务名称;空/缺省=未命名,展示时回退到描述
|
||||
category_id?: number;
|
||||
category_name?: string;
|
||||
@@ -57,10 +56,8 @@ export interface TaskTemplate {
|
||||
name: string;
|
||||
description: string;
|
||||
goal: string;
|
||||
remark?: string; // 预设备注
|
||||
category_id?: number | null; // 预设分类;null/缺省=无
|
||||
intercept_rules?: AssetInterceptRuleInput[]; // 预设的任务级拦截/允许规则
|
||||
worker_count?: number; // 预设 Worker 数;0/缺省=用全局默认
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user