mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-20 00:41:51 +08:00
feat: 任务/模板备注展示与 Worker 运行数量配置
- 新建任务可填写备注;详情页头部展示备注(列表原有 RemarkEditor 保留) - 任务模板支持备注与 Worker 数量,应用/另存为模板时同步带入 - 新建任务高级设置与模板均可单独设置 Worker 运行数量(0=回落全局默认) - schema/API/引擎贯通:tasks.worker_count、task_templates.remark/worker_count
This commit is contained in:
1 parent
620ca5d96c
commit
45d4e4e67b
15 files changed
+250
-26
No files matched your search
+6
-2
@@ -300,6 +300,7 @@ export const api = {
|
||||
task: (id: string) => get<Task>(`/tasks/${encodeURIComponent(id)}`),
|
||||
createTask: (input: {
|
||||
name?: string;
|
||||
remark?: string;
|
||||
categoryId?: number;
|
||||
description: string;
|
||||
goal: string;
|
||||
@@ -310,11 +311,13 @@ 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,
|
||||
@@ -325,6 +328,7 @@ 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,
|
||||
}),
|
||||
@@ -357,11 +361,11 @@ export const api = {
|
||||
}),
|
||||
taskTemplates: () => get<{ templates: TaskTemplate[] }>("/task-templates").then((r) => arr(r.templates)),
|
||||
createTaskTemplate: (
|
||||
input: Pick<TaskTemplate, "name" | "description" | "goal" | "category_id" | "intercept_rules">,
|
||||
input: Pick<TaskTemplate, "name" | "description" | "goal" | "remark" | "category_id" | "intercept_rules" | "worker_count">,
|
||||
) => post<TaskTemplate>("/task-templates", input),
|
||||
updateTaskTemplate: (
|
||||
id: number,
|
||||
input: Partial<Pick<TaskTemplate, "name" | "description" | "goal" | "category_id" | "intercept_rules">>,
|
||||
input: Partial<Pick<TaskTemplate, "name" | "description" | "goal" | "remark" | "category_id" | "intercept_rules" | "worker_count">>,
|
||||
) => patch<TaskTemplate>(`/task-templates/${id}`, input),
|
||||
deleteTaskTemplate: (id: number) => del<{ deleted: number }>(`/task-templates/${id}`),
|
||||
updateTaskLLMProfiles: (id: string, llmProfileIds: number[], activeLLMProfileId?: number) =>
|
||||
|
||||
@@ -1182,10 +1182,12 @@ 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),
|
||||
@@ -1315,6 +1317,10 @@ 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,
|
||||
};
|
||||
@@ -1338,6 +1344,10 @@ 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,6 +8,7 @@ export interface Task {
|
||||
distinct_findings?: FindingDistinctStats;
|
||||
id: string;
|
||||
remark?: string;
|
||||
worker_count?: number; // 本任务 Worker 数;0/缺省=用全局默认
|
||||
name?: string; // 可选任务名称;空/缺省=未命名,展示时回退到描述
|
||||
category_id?: number;
|
||||
category_name?: string;
|
||||
@@ -56,8 +57,10 @@ 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