fix 舆情自动化图片分析代码

This commit is contained in:
lxu75
2025-03-10 19:41:16 +08:00
parent 79947f450f
commit 9e5b7c6995

View File

@@ -50,16 +50,17 @@ public class TestController {
@ApiOperation(value = "测试Dify")
public ResultMsg<Object> runWorkflows2(@RequestBody String contentStr) {
//"(1)语音电话(2024-11-09 12:10:57)客服:哎,哎,姚先生,你好打扰到您了,蹦蹦沃沃赛练呢。客户:喂你好。客服:哎,对对,小明那个昨天看了车不要着急走,今天可有时间到店来接待您试驾感受一下呢。客户:我现在已经开工了,我现在没时间过去啊。客服:好的,那等你忙完这段时间好吧。客户:好的,好的,好的好,再见啊。客服:好,那这边先不打扰您,哎,好,再见。";
//构建图片分析请求对象
DifyImageWorkFlow diFyImageWorkFlow = new DifyImageWorkFlow();
diFyImageWorkFlow.setImageUrl("https://newbie-assets.digitalvolvo.com/images/2025/02/21/174011708518185205a49d2aead89b9aa8918c72fe5c08dcc66777df1f9df95535d991fbc8533.1740117074777.386.png");
JSONObject mbJsonp = new JSONObject();
mbJsonp.put("type", "image");
mbJsonp.put("transfer_method", "remote_url");
mbJsonp.put("imageUrl", "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));
imageInputs.put("image", mbJsonp);
diFyImageReq.setInputs(imageInputs.toJSONString());
log.info("difyImageReq:{}", JSON.toJSONString(diFyImageReq));
Object difyResult = diFyService.getDiFyObject(diFyImageReq);
JSONObject dify = JSONObject.parseObject(difyResult.toString());
return ResultMsg.ok(dify);