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

This commit is contained in:
lxu75
2025-03-10 19:41:16 +08:00
parent 55dbc1e618
commit c026237e87

View File

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