Bläddra i källkod

增加定时任务

zrd 3 månader sedan
förälder
incheckning
5dce866abf

+ 4 - 1
yudao-module-infra/yudao-module-infra-biz/pom.xml

@@ -46,7 +46,10 @@
             <groupId>cn.iocoder.boot</groupId>
             <artifactId>yudao-spring-boot-starter-websocket</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-job</artifactId>
+        </dependency>
         <!-- DB 相关 -->
         <dependency>
             <groupId>cn.iocoder.boot</groupId>

+ 25 - 0
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/aipromptmanagement/AiController.java

@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils;
+import cn.iocoder.yudao.module.infra.controller.app.aipromptmanagement.WorkflowDifyaiReqVO;
 import cn.iocoder.yudao.module.infra.controller.app.aipromptmanagement.vo.WorkflowDifyFilesReqVO;
 import cn.iocoder.yudao.module.infra.controller.app.aipromptmanagement.vo.WorkflowDifyReqVO;
 import cn.iocoder.yudao.module.infra.controller.app.aipromptmanagement.vo.WorkflowRunFileReqVO;
@@ -157,6 +159,29 @@ public class AiController {
         return success(resList);
     }
     
+    @PostMapping("/mdToHtml")
+    @Operation(summary = "通过ai生成html")
+    @PreAuthorize("@ss.hasPermission('infra:ai-prompt-management:query')")
+    public CommonResult<String> mdToHtml(@RequestBody WorkflowDifyaiReqVO createReqVO) {
+        Map<String, Object> inputs = new HashMap<>();
+        String apiKey = DictFrameworkUtils.parseDictDataValue("ai_key", "HTML生成");
+        inputs.put("type", createReqVO.getType());
+        
+        inputs.put("content", createReqVO.getContent());
+        return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
+    }
+    
+    @PostMapping("/ai")
+    @Operation(summary = "通过ai问答")
+    @PreAuthorize("@ss.hasPermission('infra:ai-prompt-management:query')")
+    public CommonResult<String> ai(@RequestBody WorkflowDifyaiReqVO createReqVO) {
+        Map<String, Object> inputs = new HashMap<>();
+        String apiKey = DictFrameworkUtils.parseDictDataValue("ai_key", "文本处理");
+        inputs.put("type", createReqVO.getType());
+        
+        inputs.put("content", createReqVO.getContent());
+        return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
+    }
     
     /**
      * 上传新文件

+ 22 - 0
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/aipromptmanagement/AppAiController.java

@@ -145,6 +145,28 @@ public class AppAiController {
         return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
     }
     
+    @PostMapping("/mdToHtml")
+    @Operation(summary = "通过ai生成html")
+    public CommonResult<String> mdToHtml(@RequestBody WorkflowDifyaiReqVO createReqVO) {
+        Map<String, Object> inputs = new HashMap<>();
+        String apiKey = DictFrameworkUtils.parseDictDataValue("ai_key", "HTML生成");
+        inputs.put("type", createReqVO.getType());
+        
+        inputs.put("content", createReqVO.getContent());
+        return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
+    }
+    
+    @PostMapping("/ai")
+    @Operation(summary = "通过ai问答")
+    public CommonResult<String> ai(@RequestBody WorkflowDifyaiReqVO createReqVO) {
+        Map<String, Object> inputs = new HashMap<>();
+        String apiKey = DictFrameworkUtils.parseDictDataValue("ai_key", "文本处理");
+        inputs.put("type", createReqVO.getType());
+        
+        inputs.put("content", createReqVO.getContent());
+        return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
+    }
+    
     /**
      * 上传新文件
      *

+ 21 - 0
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/aipromptmanagement/WorkflowDifyaiReqVO.java

@@ -0,0 +1,21 @@
+package cn.iocoder.yudao.module.infra.controller.app.aipromptmanagement;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "管理后台 - 工作流运行记录新增/修改 Request VO")
+@Data
+public class WorkflowDifyaiReqVO {
+    
+    
+    /**
+     * 事件类型
+     */
+    private String type;
+    /**
+     * 内容
+     */
+    private String content;
+    
+    
+}