调试Ï
This commit is contained in:
parent
c5500e3cb6
commit
ee60016755
@ -118,9 +118,21 @@ public class ConversationServiceImpl implements ConversationService {
|
||||
|
||||
@Override
|
||||
public ChatRespVO chat(ChatReqVO chatReqVO) {
|
||||
|
||||
// 模型推理 - 模型 - 可能选择向量知识库库,选择向量知识库时先查询知识库
|
||||
if(chatReqVO.getKnowledgeId()!= null){
|
||||
|
||||
}
|
||||
//2.08 修改推理接口,先查询知识库,知识库查询为空则继续查询
|
||||
if(chatReqVO.getSystemPrompt() == null || chatReqVO.getSystemPrompt().equals("")){
|
||||
if(chatReqVO.getApplicationId() != null){
|
||||
ApplicationRespVO application = applicationService.getApplication(chatReqVO.getApplicationId());
|
||||
// 获取知识库ID
|
||||
if (application.getModelServiceId() != null){
|
||||
// 查询知识库,知识库查询结果不为空直接返回
|
||||
|
||||
}
|
||||
|
||||
List<String> messageHistoryList = stringRedisTemplate.opsForList().range(CHAT_HIStORY_REDIS_KEY + ":" + chatReqVO.getUuid(), 0, -1);
|
||||
if (CollectionUtils.isEmpty(messageHistoryList)){
|
||||
application.setChatCount(application.getChatCount() + 1);
|
||||
|
@ -4,9 +4,7 @@ package cn.iocoder.yudao.module.llm.service.http;
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.knowledgebase.KnowledgeBaseDO;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.knowledgedocuments.KnowledgeDocumentsDO;
|
||||
import cn.iocoder.yudao.module.llm.dal.mysql.knowledgebase.KnowledgeBaseMapper;
|
||||
import cn.iocoder.yudao.module.llm.dal.mysql.knowledgedocuments.KnowledgeDocumentsMapper;
|
||||
import cn.iocoder.yudao.module.llm.framework.backend.config.LLMBackendProperties;
|
||||
import cn.iocoder.yudao.module.llm.service.http.vo.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@ -45,6 +43,7 @@ public class RagHttpService {
|
||||
private LLMBackendProperties llmBackendProperties;
|
||||
@Resource
|
||||
private KnowledgeBaseMapper knowledgeBaseMapper;
|
||||
|
||||
/**
|
||||
* RAG健康检查API
|
||||
*/
|
||||
@ -222,6 +221,11 @@ public class RagHttpService {
|
||||
String ragEmbed = llmBackendProperties.getEmbed();
|
||||
log.info("url : {}", ragEmbed);
|
||||
|
||||
KnowledgeBaseDO aDo = knowledgeBaseMapper.selectById(id);
|
||||
|
||||
aDo.setKnowledgeBaseIntro(ragEmbed);
|
||||
knowledgeBaseMapper.updateById(aDo);
|
||||
|
||||
// 构建请求参数
|
||||
HttpResponse<String> response = Unirest.post(ragEmbed)
|
||||
.field("file_id", reqVO.getFileId())
|
||||
@ -232,15 +236,18 @@ public class RagHttpService {
|
||||
|
||||
JSONObject jsonObject = JSON.parseObject(body);
|
||||
|
||||
KnowledgeBaseDO aDo = knowledgeBaseMapper.selectById(id);
|
||||
|
||||
aDo.setKnowledgeBaseIntro(body);
|
||||
int updateById = knowledgeBaseMapper.updateById(aDo);
|
||||
knowledgeBaseMapper.updateById(aDo);
|
||||
|
||||
if (jsonObject.getBoolean("status")) {
|
||||
log.info(" ========= Response Body Result: {}", response.getBody());
|
||||
aDo.setKnowledgeBaseIntro("11-- success: " + ragEmbed);
|
||||
knowledgeBaseMapper.updateById(aDo);
|
||||
throw exception(new ErrorCode(10047, " ------------ 知识库上传成功"));
|
||||
|
||||
} else {
|
||||
aDo.setKnowledgeBaseIntro("11-- error: " + ragEmbed);
|
||||
knowledgeBaseMapper.updateById(aDo);
|
||||
throw exception(new ErrorCode(10047, " xxxxxxxxxxxx 知识库上传失败"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user