diff --git a/service-ai/database/20250702.sql b/service-ai/database/20250702.sql index ae11869..f7edc31 100644 --- a/service-ai/database/20250702.sql +++ b/service-ai/database/20250702.sql @@ -35,14 +35,18 @@ create table hudi_collect_build_b12.service_ai_file create table hudi_collect_build_b12.service_ai_flow_task ( - id bigint not null comment '记录唯一标记', - created_time datetime(6) comment '记录创建时间', - modified_time datetime(6) comment '记录更新时间', - error longtext comment '任务运行产生的报错', - input longtext comment '任务输入', - result longtext comment '任务运行结果', - status enum ('ERROR','FINISHED','RUNNING') not null comment '任务运行状态', - template_id bigint not null comment '流程任务对应的模板', + id bigint not null comment '记录唯一标记', + created_time datetime(6) comment '记录创建时间', + modified_time datetime(6) comment '记录更新时间', + comment text comment '任务注释,用于额外说明', + error longtext comment '任务运行产生的报错', + input longtext comment '任务输入', + result longtext comment '任务运行结果', + status enum ('ERROR','FINISHED','RUNNING') not null comment '任务运行状态', + template_description varchar(255) comment '任务对应的模板功能、内容说明', + template_flow_graph longtext not null comment '任务对应的模板前端流程图数据', + template_input_schema longtext not null comment '任务对应的模板入参Schema', + template_name varchar(255) not null comment '任务对应的模板名称', primary key (id) ) comment ='流程任务记录' charset = utf8mb4; diff --git a/service-ai/service-ai-web/src/main/java/com/lanyuanxiaoyao/service/ai/web/controller/task/TaskController.java b/service-ai/service-ai-web/src/main/java/com/lanyuanxiaoyao/service/ai/web/controller/task/TaskController.java index dd84d50..93565bc 100644 --- a/service-ai/service-ai-web/src/main/java/com/lanyuanxiaoyao/service/ai/web/controller/task/TaskController.java +++ b/service-ai/service-ai-web/src/main/java/com/lanyuanxiaoyao/service/ai/web/controller/task/TaskController.java @@ -13,7 +13,6 @@ import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.extern.slf4j.Slf4j; -import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.web.bind.annotation.GetMapping; @@ -37,17 +36,26 @@ public class TaskController extends SimpleControllerSupport getInputSchema(@PathVariable("id") Long id) throws JsonProcessingException { + public AmisResponse getInputData(@PathVariable("id") Long id) throws JsonProcessingException { var task = flowTaskService.detailOrThrow(id); return AmisResponse.responseSuccess(mapper.readValue(task.getInput(), Map.class)); } + @GetMapping("input_schema/{id}") + public AmisResponse getInputSchema(@PathVariable("id") Long id) throws JsonProcessingException { + var task = flowTaskService.detailOrThrow(id); + return AmisResponse.responseSuccess(mapper.readValue(task.getTemplateInputSchema(), Map.class)); + } + @Override protected SaveItemMapper saveItemMapper() { return item -> { FlowTask task = new FlowTask(); FlowTaskTemplate template = flowTaskTemplateService.detailOrThrow(item.getTemplateId()); - task.setTemplate(template); + task.setTemplateName(template.getName()); + task.setTemplateDescription(template.getDescription()); + task.setTemplateInputSchema(template.getInputSchema()); + task.setTemplateFlowGraph(template.getFlowGraph()); task.setInput(mapper.writeValueAsString(item.getInput())); return task; }; @@ -74,14 +82,11 @@ public class TaskController extends SimpleControllerSupport { type: 'service', schemaApi: { method: 'get', - url: `${commonInfo.baseAiUrl}/flow_task/template/input_schema/\${templateId}`, + url: `${commonInfo.baseAiUrl}/flow_task/input_schema/\${id}`, // @ts-ignore adaptor: (payload, response, api, context) => { return { @@ -131,12 +131,6 @@ const FlowTask: React.FC = () => { ], }, }, - { - type: 'action', - label: '重新执行', - level: 'link', - size: 'sm', - }, { type: 'action', label: '删除',