|
|
|
@ -17,6 +17,7 @@ import com.supervision.qanything.dto.UploadResult;
|
|
|
|
|
import com.supervision.service.GeBytearrayService;
|
|
|
|
|
import com.supervision.service.KGService;
|
|
|
|
|
import com.supervision.service.KgInfoService;
|
|
|
|
|
import com.supervision.vo.kg.ChatReqVo;
|
|
|
|
|
import com.supervision.vo.kg.ChatResVo;
|
|
|
|
|
import com.supervision.vo.kg.SourceKgInfo;
|
|
|
|
|
import com.supervision.vo.kg.UploadDocResVo;
|
|
|
|
@ -75,6 +76,20 @@ public class KGServiceImpl implements KGService {
|
|
|
|
|
return chatResVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ChatResVo chat(ChatReqVo chatReqVo) throws NoSuchAlgorithmException {
|
|
|
|
|
ChatResVo chat = this.chat(chatReqVo.getQuestion());
|
|
|
|
|
if (!chat.isSuccess()
|
|
|
|
|
||CollUtil.isEmpty(chat.getSourceKgInfoList())
|
|
|
|
|
|| StrUtil.isBlank(chatReqVo.getLabel())){
|
|
|
|
|
return chat;
|
|
|
|
|
}
|
|
|
|
|
List<SourceKgInfo> sourceKgInfoList = chat.getSourceKgInfoList().stream()
|
|
|
|
|
.filter(sourceKgInfo -> chatReqVo.getLabel().equals(sourceKgInfo.getLabel())).collect(Collectors.toList());
|
|
|
|
|
chat.setSourceKgInfoList(sourceKgInfoList);
|
|
|
|
|
return chat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<SourceKgInfo> qaSource2SourceKgInfo(List<SourceDTO> sourceDTOList){
|
|
|
|
|
List<SourceKgInfo> sourceKgInfoList = CollUtil.newArrayList();
|
|
|
|
|
if (CollUtil.isEmpty(sourceDTOList)){
|
|
|
|
|