Browse Source

流媒体 新接口

zrd 3 tháng trước cách đây
mục cha
commit
59bea6d789

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

@@ -87,7 +87,7 @@ public class AppAiController {
             List<Map<String, Object>> images = new ArrayList<>();
             Map<String, Object> variableValue = new HashMap<>();
             variableValue.put("transfer_method", "remote_url");
-            variableValue.put("url", createReqVO.getImage());
+            variableValue.put("url", minioUrl(createReqVO.getImage()));
             variableValue.put("type", "image");
             images.add(variableValue);
             inputs.put("images", images);
@@ -96,7 +96,7 @@ public class AppAiController {
             List<Map<String, Object>> docs = new ArrayList<>();
             Map<String, Object> variableValue = new HashMap<>();
             variableValue.put("transfer_method", "remote_url");
-            variableValue.put("url", createReqVO.getDoc());
+            variableValue.put("url", minioUrl(createReqVO.getDoc()));
             variableValue.put("type", "document");
             docs.add(variableValue);
             inputs.put("docs", docs);
@@ -105,6 +105,12 @@ public class AppAiController {
         return success(workflowRunService.getDifyResul(inputs, createReqVO.getType()));
     }
     
+    private String minioUrl(String url) {
+        if (StrUtil.isNotBlank(url) && StrUtil.contains(url, "https://zjkdywd.com:9014")) {
+            return url.replaceAll("https://zjkdywd.com:9014", "http://42.194.163.46:9007");
+        }
+        return "";
+    }
     @PostMapping("/difyOrcs")
     @Operation(summary = "批量图片文档识别并返回前端")
     public CommonResult<String> difyOrcs(@RequestBody WorkflowDifyFilesReqVO createReqVO) {
@@ -114,7 +120,7 @@ public class AppAiController {
             for (String image : createReqVO.getImages()) {
                 Map<String, Object> variableValue = new HashMap<>();
                 variableValue.put("transfer_method", "remote_url");
-                variableValue.put("url", image);
+                variableValue.put("url", minioUrl(image));
                 variableValue.put("type", "image");
                 images.add(variableValue);
             }
@@ -125,7 +131,7 @@ public class AppAiController {
             for (String image : createReqVO.getDocs()) {
                 Map<String, Object> variableValue = new HashMap<>();
                 variableValue.put("transfer_method", "remote_url");
-                variableValue.put("url", image);
+                variableValue.put("url", minioUrl(image));
                 variableValue.put("type", "document");
                 docs.add(variableValue);
             }
@@ -144,7 +150,7 @@ public class AppAiController {
         String apiKey = DictFrameworkUtils.parseDictDataValue("ai_key", "pdf识别");
         inputs.put("type", createReqVO.getType());
         
-        inputs.put("pdfUrl", createReqVO.getDoc());
+        inputs.put("pdfUrl", minioUrl(createReqVO.getDoc()));
         return success(workflowRunService.getDifyResul(inputs, createReqVO.getType(), apiKey));
     }
     
@@ -242,7 +248,7 @@ public class AppAiController {
     @Operation(summary = "上传文件")
     public CommonResult<FileResp> uploadNewFile(@RequestBody WorkflowRunFileReqVO files) {
         
-        return success(workflowRunService.uploadFile(files.getUrl()));
+        return success(workflowRunService.uploadFile(minioUrl(files.getUrl())));
     }
     
 }

+ 4 - 12
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/job/kefu/KefuAiJob.java

@@ -1,23 +1,14 @@
 package cn.iocoder.yudao.module.promotion.job.kefu;
 
-import cn.hutool.core.collection.CollUtil;
-import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
 import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
 import cn.iocoder.yudao.module.infra.api.ai.AiApi;
-import cn.iocoder.yudao.module.infra.api.ai.dto.DifyaiReqDTO;
-import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO;
-import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO;
-import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO;
-import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
 import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService;
 import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
-
 /**
  * 物理删除 N 天前的任务日志的 Job
  *
@@ -37,7 +28,7 @@ public class KefuAiJob implements JobHandler {
     @Override
     @TenantIgnore
     public String execute(String param) {
-        //查询有未读消息的会话
+      /*  //查询有未读消息的会话
         List<KeFuConversationDO> conversationDOList = keFuConversationService.getKefuConversationAiList();
         if (CollUtil.isNotEmpty(conversationDOList)) {
             //查询消息  并发送给ai
@@ -60,7 +51,8 @@ public class KefuAiJob implements JobHandler {
                         difyaiReqDTO.setType("整理文案");
                         String aiMessage = aiApi.ai(difyaiReqDTO);
                         AppKeFuMessageSendReqVO sendReqVO = new AppKeFuMessageSendReqVO();
-                        sendReqVO.setSenderId(conversationDO.getUserId()).setSenderType(UserTypeEnum.ADMIN.getValue()); //
+                        sendReqVO.setSenderId(conversationDO.getUserId()).setSenderType(UserTypeEnum.ADMIN.getValue()
+                        ); //
                         // 设置用户编号和类型
                         sendReqVO.setConversationId(conversationDO.getId());
                         sendReqVO.setContent(aiMessage);
@@ -69,7 +61,7 @@ public class KefuAiJob implements JobHandler {
                     }
                 }
             }
-        }
+        }*/
         return String.format("定时执行清理定时任务日志数量 %s 个", 1);
     }