提交 34c1e59c 作者: obcy

Merge remote-tracking branch 'origin/master'

...@@ -75,6 +75,12 @@ public class KnowledgeController { ...@@ -75,6 +75,12 @@ public class KnowledgeController {
@GetMapping(value = "/getById") @GetMapping(value = "/getById")
public Result<?> getById(@RequestParam String id) { public Result<?> getById(@RequestParam String id) {
KnowledgeVO knowledgeVO=knowledgeService.getById(id); KnowledgeVO knowledgeVO=knowledgeService.getById(id);
if(null!=knowledgeVO.getPublishDate()&&(!knowledgeVO.getPublishDate().isEmpty())){
knowledgeVO.setPublishDate(EsDateUtil.esFieldDateMapping(knowledgeVO.getPublishDate()));
}
if(null!=knowledgeVO.getVerifyTime()&&(!knowledgeVO.getVerifyTime().isEmpty())){
knowledgeVO.setVerifyTime(EsDateUtil.esFieldDateMapping(knowledgeVO.getVerifyTime()));
}
return Result.OK(knowledgeVO); return Result.OK(knowledgeVO);
} }
...@@ -163,6 +169,7 @@ public class KnowledgeController { ...@@ -163,6 +169,7 @@ public class KnowledgeController {
@PostMapping(value = "/IntelligentQa") @PostMapping(value = "/IntelligentQa")
public Result<?> intelligentQa(@RequestBody IntelligentQaParam intelligentQaParam) throws IOException { public Result<?> intelligentQa(@RequestBody IntelligentQaParam intelligentQaParam) throws IOException {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
params.put("score_threshold",intelligentQaParam.getScoreThreshold() );
params.put("question", intelligentQaParam.getQuestion()); params.put("question", intelligentQaParam.getQuestion());
params.put("knowledge_base_id", intelligentQaParam.getKbKnowledgeIds().split(",")); params.put("knowledge_base_id", intelligentQaParam.getKbKnowledgeIds().split(","));
String result = HttpUtil.doPost(intelligentQaUrl, params, 120000); String result = HttpUtil.doPost(intelligentQaUrl, params, 120000);
......
...@@ -102,7 +102,7 @@ public class Knowledge implements Serializable { ...@@ -102,7 +102,7 @@ public class Knowledge implements Serializable {
* 知识库id * 知识库id
*/ */
private String kbKnowledgeId; private String kbKnowledgeId;
private String content; private String contentAll;
/** /**
* 类型 * 类型
*/ */
......
...@@ -21,5 +21,5 @@ public interface KnowledgeChannel { ...@@ -21,5 +21,5 @@ public interface KnowledgeChannel {
MessageChannel knowledgeContents(); MessageChannel knowledgeContents();
@Output @Output
MessageChannel knowledgeExcelContents(); MessageChannel knowledgeExcels();
} }
...@@ -50,6 +50,7 @@ public class KnowledgeMessage { ...@@ -50,6 +50,7 @@ public class KnowledgeMessage {
*/ */
private String type; private String type;
private String author; private String author;
private String contentAll;
private List<Content> contents; private List<Content> contents;
......
...@@ -36,6 +36,6 @@ public class ProduceInfo { ...@@ -36,6 +36,6 @@ public class ProduceInfo {
public void sendKnowledgeExcelContents(KnowledgeMessage knowledgeMessage) { public void sendKnowledgeExcelContents(KnowledgeMessage knowledgeMessage) {
String msg = JSON.toJSONString(knowledgeMessage); String msg = JSON.toJSONString(knowledgeMessage);
Message<String> message = MessageBuilder.withPayload(msg).build(); Message<String> message = MessageBuilder.withPayload(msg).build();
channel.knowledgeExcelContents().send(message); channel.knowledgeExcels().send(message);
} }
} }
...@@ -145,11 +145,6 @@ class KnowledgeServiceImpl implements IKnowledgeService { ...@@ -145,11 +145,6 @@ class KnowledgeServiceImpl implements IKnowledgeService {
} }
knowledge.setContents(contentList); knowledge.setContents(contentList);
knowledgeMessage.setContents(contentList); knowledgeMessage.setContents(contentList);
} else {
if (null == knowledge.getContents().get(0).getContentId()) {
knowledge.getContents().get(0).setContentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8));
}
knowledgeMessage.setContents(knowledge.getContents());
} }
//id为空表示新增 //id为空表示新增
if (null == knowledge.getId()) { if (null == knowledge.getId()) {
...@@ -518,12 +513,11 @@ class KnowledgeServiceImpl implements IKnowledgeService { ...@@ -518,12 +513,11 @@ class KnowledgeServiceImpl implements IKnowledgeService {
continue; continue;
} }
if (StringUtils.isNotEmpty(info.get(1))) { if (StringUtils.isNotEmpty(info.get(1))) {
specialInformation.setContent(info.get(1)); specialInformation.setContentAll(info.get(1));
//段落切分 // //段落切分
// specialInformation.setContents(Collections.singletonList(Content.builder()
specialInformation.setContents(Collections.singletonList(Content.builder() // .contentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8))
.contentId(codeGenerateUtil.geneIdNo(Constants.FINANCE, 8)) // .content(info.get(1)).build()));
.content(info.get(1)).build()));
} else { } else {
log.error("上传的数据{}正文为空,此条数据忽略", info.get(0)); log.error("上传的数据{}正文为空,此条数据忽略", info.get(0));
continue; continue;
......
...@@ -15,5 +15,6 @@ public class IntelligentQaParam { ...@@ -15,5 +15,6 @@ public class IntelligentQaParam {
*/ */
private String question; private String question;
private String kbKnowledgeIds; private String kbKnowledgeIds;
private Integer scoreThreshold=700;
} }
...@@ -31,6 +31,7 @@ public class KnowledgeVO { ...@@ -31,6 +31,7 @@ public class KnowledgeVO {
private String verifierName; private String verifierName;
private String origin; private String origin;
private String author; private String author;
private String contentAll;
private Integer score; private Integer score;
private Integer verifyStatus; private Integer verifyStatus;
private Integer importData; private Integer importData;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论