Commit da8c12516e954b20d7a053e88ebc33c2d7baab65

Authored by qianbao
1 parent fa60f81a

添加向量库

src/main/java/com/xly/service/XlyErpService.java
... ... @@ -250,6 +250,52 @@ public class XlyErpService {
250 250  
251 251 /***
252 252 * @Author 钱豹
  253 + * @Date 14:37 2026/4/7
  254 + * @Param [userInput, userId, sUserName, sBrandsId, sSubsidiaryId, sUserType, authorization]
  255 + * @return com.xly.entity.AiResponseDTO
  256 + * @Description 清空条件
  257 + **/
  258 + public AiResponseDTO removeCondition(String userId ,
  259 + String sUserName ,
  260 + String sBrandsId ,
  261 + String sSubsidiaryId,
  262 + String sUserType,
  263 + String authorization,
  264 + String removeCondition
  265 + ) {
  266 + String sceneName = StrUtil.EMPTY;
  267 + String methodName = StrUtil.EMPTY;
  268 + UserSceneSession session=null;
  269 + try {
  270 + // 1. 初始化用户场景会话(权限内场景)
  271 + session = userSceneSessionService.getUserSceneSession(userId,sUserName,sBrandsId,sSubsidiaryId,sUserType,authorization);
  272 + session.setAuthorization(authorization);
  273 + session.setSFunPrompts(null);
  274 + session.setDbCach(StrUtil.EMPTY);
  275 + session.setDbType(StrUtil.EMPTY);
  276 + sceneName = ObjectUtil.isNotEmpty(session.getCurrentScene())?session.getCurrentScene().getSSceneName():StrUtil.EMPTY;
  277 + Map<String, Object> args = session.getArgs();
  278 + String[] removeConditionA = removeCondition.split(",");
  279 + for(String one:removeConditionA){
  280 + args.remove(one);
  281 + }
  282 + session.setArgs(args);
  283 + String sResponMessage = dynamicToolProvider.doDynamicTool(session.getCurrentTool(),session);
  284 + return AiResponseDTO.builder().sSceneName(sceneName).sMethodName(methodName).aiText(sResponMessage).dbType(session.getDbType()).dbCach(session.getDbCach()).sReturnType(ReturnTypeCode.HTML.getCode()).build();
  285 + } catch (Exception e) {
  286 + e.printStackTrace();
  287 + return AiResponseDTO.builder().sSceneName(sceneName).sMethodName(methodName).aiText("系统异常:" + e.getMessage() + ",请稍后重试!").dbType(session.getDbType()).dbCach(session.getDbCach()).sReturnType(ReturnTypeCode.HTML.getCode()).build();
  288 + }finally {
  289 + //5.执行工具方法后,清除记忆
  290 + if(session !=null && session.getBCleanMemory()){
  291 + doCleanUserMemory(session,userId);
  292 + }
  293 + }
  294 + }
  295 +
  296 +
  297 + /***
  298 + * @Author 钱豹
253 299 * @Date 19:18 2026/1/27
254 300 * @Param [userInput, userId, sUserType]
255 301 * @return java.lang.String
... ...
src/main/java/com/xly/tool/DynamicToolProvider.java
... ... @@ -1135,10 +1135,17 @@ public class DynamicToolProvider implements ToolProvider {
1135 1135 if(ObjectUtil.isNotEmpty(argsOld.get(one.getSParam()))){
1136 1136 if(one.getSParamValue().startsWith("d")){
1137 1137 if(Double.valueOf(argsOld.get(one.getSParam()).toString())>0){
1138   - markdown.append(one.getSParam()).append(":").append(argsOld.get(one.getSParam()).toString()).append(" ");
  1138 + markdown.append("<span style=\"color: #1890ff;margin-right: 10px;position: relative;display: inline-block;padding: 0 10px;\">")
  1139 + .append(one.getSParam()).append(":").append(argsOld.get(one.getSParam()).toString()).append(" ")
  1140 + .append(" <span style=\"font-weight: bold;font-size: 22px;position: absolute;right: -5px;top: -12px;color: #ff4d4f;display: inline-block;\" data-action=\"clearSql\" data-text=\""+one.getSParam()+","+one.getSParamValue()+"\" onclick=\"clearSql('"+one.getSParam()+","+one.getSParamValue()+"')\"> × </span>")
  1141 + .append("</span>");
1139 1142 }
1140 1143 }else{
1141   - markdown.append(one.getSParam()).append(":").append(argsOld.get(one.getSParam()).toString()).append(" ");
  1144 + markdown.append("<span style=\"color: #1890ff;margin-right: 10px;position: relative;display: inline-block;padding: 0 10px;\">")
  1145 + .append(one.getSParam()).append(":").append(argsOld.get(one.getSParam()).toString()).append(" ")
  1146 + .append(" <span style=\"font-weight: bold;font-size: 22px;position: absolute;right: -5px;top: -12px;color: #ff4d4f;display: inline-block;\" data-action=\"clearSql\" data-text=\""+one.getSParam()+","+one.getSParamValue()+"\" onclick=\"clearSql('"+one.getSParam()+","+one.getSParamValue()+"')\"> × </span>")
  1147 + .append("</span>");
  1148 +// markdown.append(one.getSParam()).append(":").append(argsOld.get(one.getSParam()).toString()).append(" ");
1142 1149 }
1143 1150 }
1144 1151 }
... ...
src/main/java/com/xly/tts/bean/TTSRequestDTO.java
... ... @@ -18,6 +18,7 @@ public class TTSRequestDTO {
18 18 private Integer page;
19 19 private Integer pageCount;
20 20 private String sceneId;
  21 + private String removeCondition;
21 22  
22 23  
23 24 }
24 25 \ No newline at end of file
... ...
src/main/java/com/xly/tts/service/PythonTtsProxyService.java
... ... @@ -87,6 +87,25 @@ public class PythonTtsProxyService {
87 87 return synthesizeStreamAi(request, voiceText);
88 88 }
89 89  
  90 + /***
  91 + * @Author 钱豹
  92 + * @Date 14:35 2026/4/7
  93 + * @Param [request]
  94 + * @return org.springframework.http.ResponseEntity<com.xly.tts.bean.TTSResponseDTO>
  95 + * @Description 清空条件
  96 + **/
  97 + public ResponseEntity<TTSResponseDTO> removeCondition(TTSRequestDTO request) {
  98 + String sUserId = request.getUserid();
  99 + String sUserName = request.getUsername();
  100 + String sBrandsId = request.getBrandsid();
  101 + String sSubsidiaryId = request.getSubsidiaryid();
  102 + String sUserType = request.getUsertype();
  103 + String authorization = request.getAuthorization();
  104 + String removeCondition = request.getRemoveCondition();
  105 + AiResponseDTO voiceText = xlyErpService.removeCondition(sUserId, sUserName, sBrandsId, sSubsidiaryId, sUserType, authorization,removeCondition);
  106 + return synthesizeStreamAi(request, voiceText);
  107 + }
  108 +
90 109 /**
91 110 * 【保持原有返回类型】AI对话 + 流式TTS
92 111 */
... ...
src/main/java/com/xly/web/TTSStreamController.java
... ... @@ -89,6 +89,18 @@ public class TTSStreamController {
89 89 return pythonTtsProxyService.change(request);
90 90 }
91 91  
  92 + /***
  93 + * @Author 钱豹
  94 + * @Date 8:53 2026/4/7
  95 + * @Param [request]
  96 + * @return org.springframework.http.ResponseEntity<com.xly.tts.bean.TTSResponseDTO>
  97 + * @Description 换一换
  98 + **/
  99 + @PostMapping(value = "/stream/removeCondition", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.ALL_VALUE})
  100 + public ResponseEntity<TTSResponseDTO> removeCondition(@RequestBody TTSRequestDTO request) {
  101 + return pythonTtsProxyService.removeCondition(request);
  102 + }
  103 +
92 104 /**
93 105 * 流式合成语音(代理到Python服务)
94 106 */
... ...