diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/TestController.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/TestController.java index 8e90664..df57270 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/TestController.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/controller/TestController.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.volvo.ai.analytic.center.dto.req.CallItem; import com.volvo.ai.analytic.center.dto.req.DiFyReq; import com.volvo.ai.analytic.center.dto.req.DiffDefeatanAlysis; +import com.volvo.ai.analytic.center.dto.req.DifyImageWorkFlow; import com.volvo.ai.analytic.center.dto.resp.DiffDefeatAnalyseOutputResult; import com.volvo.ai.analytic.center.feign.DiFyFeign; import com.volvo.ai.analytic.center.service.DiFyService; @@ -45,53 +46,25 @@ public class TestController { @Autowired private RocketMQTemplate rocketMQTemplate; -/* - @PostMapping("/runWorkflows2") + @PostMapping("/runWorkflows") @ApiOperation(value = "测试Dify") public ResultMsg runWorkflows2(@RequestBody String contentStr) { //"(1)语音电话(2024-11-09 12:10:57)客服:哎,哎,姚先生,你好打扰到您了,蹦蹦沃沃赛练呢。客户:喂你好。客服:哎,对对,小明那个昨天看了车不要着急走,今天可有时间到店来接待您试驾感受一下呢。客户:我现在已经开工了,我现在没时间过去啊。客服:好的,那等你忙完这段时间好吧。客户:好的,好的,好的好,再见啊。客服:好,那这边先不打扰您,哎,好,再见。"; - Map record = new HashMap<>(); - record.put("record",contentStr); - log.info("contentStr {}", contentStr); - DiFyReq diFyReq = new DiFyReq(); - diFyReq.setUser(user); - diFyReq.setFlowId(flowId); - diFyReq.setInputs(record); - Object difyResult = diFyService.getDiFyObject(diFyReq); + //构建图片分析请求对象 + DifyImageWorkFlow diFyImageWorkFlow = new DifyImageWorkFlow(); + diFyImageWorkFlow.setImageUrl("https://newbie-assets.digitalvolvo.com/images/2025/02/21/174011708518185205a49d2aead89b9aa8918c72fe5c08dcc66777df1f9df95535d991fbc8533.1740117074777.386.png"); + + DiFyReq diFyImageReq = new DiFyReq(); + diFyImageReq.setUser("admin"); + diFyImageReq.setFlowId("app-ZcRTduhbcyu9qzXs2GAnXo0v"); + JSONObject imageInputs = new JSONObject(); + imageInputs.put("image", JSON.toJSONString(diFyImageWorkFlow)); + diFyImageReq.setInputs(imageInputs.toJSONString()); + Object difyResult = diFyService.getDiFyObject(diFyImageReq); JSONObject dify = JSONObject.parseObject(difyResult.toString()); - String resultStr = dify.getString("result").replace("\n", "").replaceAll(" ", ""); - return ResultMsg.ok(resultStr); + return ResultMsg.ok(dify); } - @PostMapping("/runWorkflows3") - @ApiOperation(value = "测试Dify") - public ResultMsg runWorkflows3(@RequestBody String contentStr) { - //[{"sessionId":"1","sourceId":"1","audioTime":"2024-11-09 12:10:57","audioBillsec":"10"},{"sessionId":"2","sourceId":"2","audioTime":"2024-11-09 12:11:57","audioBillsec":"20"}] - log.info("contentStr {}", contentStr); - List callList = JSON.parseArray(contentStr, CallItem.class); - DiffDefeatanAlysis input = new DiffDefeatanAlysis(); - input.setCallList(callList); - DiffDefeatAnalyseOutputResult diffDefeatAnalyseOutputResult = mqMessageRecordService.processChatRecord(input); - return ResultMsg.ok(diffDefeatAnalyseOutputResult); - } - - @PostMapping("/runWorkflows4") - @ApiOperation(value = "测试Dify") - public ResultMsg runWorkflows4(@RequestBody String contentStr) { - - //{"formId": "123456789","sinceType": 2,"subSinceType": 51,"data": {"businessId": "123456789","vdqwUserId": "123","vdqwCustomerId": "uuid","defeatTime": "2024-10-27 08:09:09","callList": [{"sessionId": "123456789","sourceId": "123456789","audioTime": "2024-10-27 08:09:09","audioBillsec": 1800}, {"sessionId": "123456789","sourceId": "123456789","audioTime": "2024-10-27 08:09:09","audioBillsec": 1800}]} } - //{"formId": "123456789","sinceType": 2,"subSinceType": 52,"data": {"businessId": "123456789", "approveCode": "10001", "approveResult": "审批通过", "approveOpinion": "" } } - log.info("contentStr {}", contentStr); - boolean result = mqMessageRecordService.processMessageByMQ(contentStr); - return ResultMsg.ok(result); - }*/ - - @PostMapping("/runWorkflows5") - @ApiOperation(value = "补偿处理消息") - public ResultMsg runWorkflows5() { - mqMessageRecordService.processMessageByTask(); - return ResultMsg.ok(""); - } @PostMapping("/mockMq") diff --git a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/MqMessageRecordServiceImpl.java b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/MqMessageRecordServiceImpl.java index a48c199..d4fd0b3 100644 --- a/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/MqMessageRecordServiceImpl.java +++ b/ai-analytic-center-biz/src/main/java/com/volvo/ai/analytic/center/service/impl/MqMessageRecordServiceImpl.java @@ -110,8 +110,8 @@ public class MqMessageRecordServiceImpl extends ServiceImpl