Commit c5f037d147050ad4b4ec80cfc72775cf5c2e077f
1 parent
8cb723cd
添加向量库
Showing
1 changed file
with
14 additions
and
9 deletions
src/main/java/com/xly/service/XlyErpService.java
| ... | ... | @@ -308,7 +308,7 @@ public class XlyErpService { |
| 308 | 308 | String sCleanSql = StrUtil.EMPTY; |
| 309 | 309 | if(ObjectUtil.isEmpty(cachMap)){ |
| 310 | 310 | //查询是否走向量库 还是数据库查询 |
| 311 | - isAggregation = aiAgent.routeQuery(session.getUserId(), input); | |
| 311 | +// isAggregation = aiAgent.routeQuery(session.getUserId(), input); | |
| 312 | 312 | session.setDbCach("D"); |
| 313 | 313 | bHasCach = false; |
| 314 | 314 | }else{ |
| ... | ... | @@ -317,14 +317,14 @@ public class XlyErpService { |
| 317 | 317 | bHasCach = true; |
| 318 | 318 | sCleanSql = ObjectUtil.isNotEmpty(cachMap.get("sSqlContent"))?cachMap.get("sSqlContent").toString() : StrUtil.EMPTY; |
| 319 | 319 | } |
| 320 | - if(!isAggregation){ | |
| 321 | - //获取常量库内容 | |
| 322 | - session.setDbType("X"); | |
| 323 | - sResponMessage = getMilvus(session, input, aiAgent,bHasCach); | |
| 324 | - }else { | |
| 325 | - session.setDbType("G"); | |
| 326 | - sResponMessage = getDynamicTableSql(session, input, userId, userInput,0,StrUtil.EMPTY,StrUtil.EMPTY,"0",StrUtil.EMPTY, aiAgent,sCleanSql); | |
| 327 | - } | |
| 320 | +// if(!isAggregation){ | |
| 321 | +// //获取常量库内容 | |
| 322 | +// session.setDbType("X"); | |
| 323 | +// sResponMessage = getMilvus(session, input, aiAgent,bHasCach); | |
| 324 | +// }else { | |
| 325 | + session.setDbType("G"); | |
| 326 | + sResponMessage = getDynamicTableSql(session, input, userId, userInput,0,StrUtil.EMPTY,StrUtil.EMPTY,"0",StrUtil.EMPTY, aiAgent,sCleanSql); | |
| 327 | +// } | |
| 328 | 328 | return AiResponseDTO.builder().sSceneName(sceneName).sMethodName(methodName).aiText(sResponMessage).sReturnType(ReturnTypeCode.HTML.getCode()).dbType(session.getDbType()).dbCach(session.getDbCach()).build(); |
| 329 | 329 | } else if (ObjectUtil.isNotEmpty(session.getCurrentTool())) { |
| 330 | 330 | //2.处理工具参数采集结束后业务逻辑处理 |
| ... | ... | @@ -665,6 +665,11 @@ public class XlyErpService { |
| 665 | 665 | throw e; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | + //如果查询不到数据走向量库 | |
| 669 | + if(ObjectUtil.isNotEmpty(sqlResult)){ | |
| 670 | + session.setDbType("X"); | |
| 671 | + return getMilvus(session, input, aiAgent,false); | |
| 672 | + } | |
| 668 | 673 | // 5. 调用AI服务生成自然语言解释(传入表结构,让解释更贴合业务) |
| 669 | 674 | String resultJson = JSON.toJSONString(sqlResult); |
| 670 | 675 | ... | ... |