舆情自动化上线分支

This commit is contained in:
lxu75
2025-03-18 14:36:45 +08:00
parent 594688b099
commit b88073bd09
5 changed files with 5 additions and 165 deletions

View File

@@ -1,26 +0,0 @@
package com.volvo.ai.analytic.center.controller;
import com.volvo.ai.analytic.center.exception.BizException;
import com.volvo.ai.analytic.center.service.impl.DeepSeekServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1")
public class AiCompareController {
@Autowired
private DeepSeekServiceImpl deepSeekService;
@GetMapping("/chat1")
public String chat1( @RequestParam(value = "source") String source,@RequestParam(value = "target") String tag ) {
try {
return deepSeekService.chat(source, tag);
} catch (Exception e) {
throw new BizException(e.getMessage());
}
}
}

View File

@@ -1,63 +0,0 @@
package com.volvo.ai.analytic.center.controller;
import com.alibaba.fastjson.JSONObject;
import com.obs.services.model.ObsObject;
import com.volvo.ai.analytic.center.feign.DiFyFeign;
import com.volvo.ai.analytic.center.utils.ObsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@RestController
@RequestMapping("/dms/run")
public class AiImageCompareController {
@Autowired
private DiFyFeign diFyFeign;
@PostMapping("/fileUpload")
public String fileUpload(@RequestHeader(value = "Authorization") String authorization, @RequestBody String filePath) throws IOException {
JSONObject jsonObjectResult;
try {
ObsObject obsObject = ObsUtil.downloadFile(filePath);
InputStream inputStream = obsObject.getObjectContent();
MultipartFile file = ObsUtil.getMultipartFile(inputStream, ObsUtil.getFilenameByUrl(filePath));
JSONObject jsonObjectResult1 = diFyFeign.fileUpload(authorization,file);
ObsObject obsObjectDoc = ObsUtil.downloadFile("file_test/business.docx");
InputStream inputStreamDoc = obsObjectDoc.getObjectContent();
MultipartFile fileDoc = ObsUtil.getMultipartFile(inputStreamDoc, ObsUtil.getFilenameByUrl("file_test/business.docx"));
JSONObject jsonObjectResult2 = diFyFeign.fileUpload(authorization,fileDoc);
JSONObject tpJSon = new JSONObject();
tpJSon.put("type","image");
tpJSon.put("transfer_method","local_file");
tpJSon.put("upload_file_id",jsonObjectResult1.get("id"));
JSONObject mbJsonp = new JSONObject();
mbJsonp.put("type","document");
mbJsonp.put("transfer_method","local_file");
mbJsonp.put("upload_file_id",jsonObjectResult2.get("id"));
Map<String ,Object> tpMpMap = new HashMap<>();
tpMpMap.put("tp",tpJSon);
tpMpMap.put("mb",mbJsonp);
Map<String ,Object> reqMap = new HashMap<>();
reqMap.put("inputs",tpMpMap);
reqMap.put("response_mode","blocking");
reqMap.put("user","streaming232");
JSONObject runResultJson = diFyFeign.runWorkflows(authorization,reqMap);
System.out.println("runResultJson:"+runResultJson);
return runResultJson.toJSONString();
} catch (Exception e) {
log.error("error:{}",e);
}
return "";
}
}

View File

@@ -1,46 +0,0 @@
package com.volvo.ai.analytic.center.controller;
import com.volvo.ai.analytic.center.constant.Constant;
import com.volvo.ai.analytic.center.dto.req.RunMaskingRuleInput;
import com.volvo.ai.analytic.center.entity.DataMaskingRule;
import com.volvo.ai.analytic.center.service.DataMaskingRuleService;
import com.volvo.common.core.util.ResultMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Api(tags = "ai脱敏类API")
@RequestMapping("/dataMasking")
@Slf4j
public class DataMaskingController {
@Autowired
private DataMaskingRuleService dataMaskingRuleService;
@PostMapping("/runMaskingRule")
@ApiOperation(value = "执行文字脱敏")
public ResultMsg<String> runMaskingRule(@RequestBody String contentStr) {
log.info("输入需要脱敏的文字信息为 {}", contentStr);
List<DataMaskingRule> maskingRuleItems = dataMaskingRuleService.getDataMaskingRuleListByApplicationChannel(Constant.CHANNEL_DCC);
if (CollectionUtils.isEmpty(maskingRuleItems)){
log.info("没有找到脱敏规则");
return ResultMsg.failed("没有找到脱敏规则");
}
log.info("开始脱敏 {}", contentStr);
RunMaskingRuleInput runMaskingRuleInput = new RunMaskingRuleInput();
runMaskingRuleInput.setOldStr(contentStr);
runMaskingRuleInput.setDataMaskingRules(maskingRuleItems);
String summaryText = dataMaskingRuleService.runMaskingRule(runMaskingRuleInput);
log.info("脱敏结果 {}", summaryText);
return ResultMsg.ok(summaryText);
}
}

View File

@@ -34,38 +34,9 @@ import java.util.Map;
@Slf4j
public class TestController {
@Autowired
private DiFyFeign diFyFeign;
@Autowired
private DiFyService diFyService;
@Autowired
private MqMessageRecordService mqMessageRecordService;
@Autowired
private RocketMQTemplate rocketMQTemplate;
@PostMapping("/runWorkflows")
@ApiOperation(value = "测试Dify")
public ResultMsg<Object> runWorkflows2(@RequestBody String contentStr) {
//"1语音电话2024-11-09 12:10:57客服姚先生你好打扰到您了蹦蹦沃沃赛练呢。客户喂你好。客服对对小明那个昨天看了车不要着急走今天可有时间到店来接待您试驾感受一下呢。客户我现在已经开工了我现在没时间过去啊。客服好的那等你忙完这段时间好吧。客户好的好的好的好再见啊。客服那这边先不打扰您再见。";
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", 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);
}
@PostMapping("/mockMq")

View File

@@ -1,3 +1,4 @@
/*
package com.volvo.ai.analytic.center.mq;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -15,13 +16,15 @@ import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
*/
/**
* @ClassName CorpusProcessKafkaConsumer
* @Description
* @Author renzhen
* @Date 2025-03-04 10:18
* @Version 1.0
**/
**//*
@Slf4j
@Component
@RestController
@@ -56,3 +59,4 @@ public class CorpusProcessKafkaConsumer {
}
}
}
*/