Commit 57b527df authored by alex yao's avatar alex yao

feat:问答知识库分片 批量更新

parent db2bf986
...@@ -50,6 +50,15 @@ public interface QAKnowledgeService { ...@@ -50,6 +50,15 @@ public interface QAKnowledgeService {
*/ */
void updateKnowledgeChunkDoc(Integer kdId, String chunkRelationId, Long structId, String content); void updateKnowledgeChunkDoc(Integer kdId, String chunkRelationId, Long structId, String content);
/**
* 批量更新知识库分片内容
*
* @param kdId
* @param chunkRelationId
* @param chunkInfos
*/
void updateKnowledgeChunkDoc(Integer kdId, String chunkRelationId, List<ChunkInfo> chunkInfos);
/** /**
* 新增知识库分片 * 新增知识库分片
* *
......
...@@ -61,6 +61,13 @@ public class QAKnowledgeServiceImpl implements QAKnowledgeService { ...@@ -61,6 +61,13 @@ public class QAKnowledgeServiceImpl implements QAKnowledgeService {
demandQAKnowledgeService.updateKnowledgeChunkDoc(knowledgeId, chunkRelationId, structId, content); demandQAKnowledgeService.updateKnowledgeChunkDoc(knowledgeId, chunkRelationId, structId, content);
} }
@Override
public void updateKnowledgeChunkDoc(Integer kdId, String chunkRelationId, List<ChunkInfo> chunkInfos) {
logger.info("updateKnowledgeChunkDoc: kdId={}, chunkRelationId={}, chunkInfos={}", kdId, chunkRelationId, chunkInfos);
String knowledgeId = getKnowledgeId(kdId);
demandQAKnowledgeService.updateKnowledgeChunkDoc(knowledgeId, chunkRelationId, chunkInfos);
}
@Override @Override
public void addKnowledgeChunk(Integer kdId, List<ChunkInfo> chunkInfos, Integer chunkSort) { public void addKnowledgeChunk(Integer kdId, List<ChunkInfo> chunkInfos, Integer chunkSort) {
logger.info("addKnowledgeChunk: kdId={}, chunkInfos={}, chunkSort={}", kdId, chunkInfos, chunkSort); logger.info("addKnowledgeChunk: kdId={}, chunkInfos={}, chunkSort={}", kdId, chunkInfos, chunkSort);
......
...@@ -36,6 +36,13 @@ public interface QAKnowledgeRest extends BaseRest { ...@@ -36,6 +36,13 @@ public interface QAKnowledgeRest extends BaseRest {
*/ */
void updateKnowledgeChunkDoc(@RequestBody UpsertChunkInfoDto dto); void updateKnowledgeChunkDoc(@RequestBody UpsertChunkInfoDto dto);
/**
* 批量更新知识库分片内容
*
* @param dto
*/
void batchUpdateKnowledgeChunkDoc(@RequestBody UpsertChunkInfoDto dto);
/** /**
* 新增知识库分片 * 新增知识库分片
*/ */
......
...@@ -40,6 +40,11 @@ public class QAKnowledgeRestImpl implements QAKnowledgeRest { ...@@ -40,6 +40,11 @@ public class QAKnowledgeRestImpl implements QAKnowledgeRest {
qaKnowledgeService.updateKnowledgeChunkDoc(dto.getKdId(), dto.getChunkRelationId(), dto.getStructId(), dto.getChunkContent()); qaKnowledgeService.updateKnowledgeChunkDoc(dto.getKdId(), dto.getChunkRelationId(), dto.getStructId(), dto.getChunkContent());
} }
@Override
public void batchUpdateKnowledgeChunkDoc(UpsertChunkInfoDto dto) {
qaKnowledgeService.updateKnowledgeChunkDoc(dto.getKdId(), dto.getChunkRelationId(), dto.getChunkInfos());
}
@Override @Override
public void addKnowledgeChunk(UpsertChunkInfoDto dto) { public void addKnowledgeChunk(UpsertChunkInfoDto dto) {
qaKnowledgeService.addKnowledgeChunk(dto.getKdId(), dto.getChunkInfos(), dto.getChunkSort()); qaKnowledgeService.addKnowledgeChunk(dto.getKdId(), dto.getChunkInfos(), dto.getChunkSort());
......
...@@ -54,6 +54,16 @@ public interface DemandQAKnowledgeService { ...@@ -54,6 +54,16 @@ public interface DemandQAKnowledgeService {
*/ */
void updateKnowledgeChunkDoc(String knowledgeId, String chunkRelationId, Long structId, String content); void updateKnowledgeChunkDoc(String knowledgeId, String chunkRelationId, Long structId, String content);
/**
* 批量更新分片内容
*
* @param knowledgeId
* @param chunkRelationId
* @param chunkInfos
*/
void updateKnowledgeChunkDoc(String knowledgeId, String chunkRelationId, List<ChunkInfo> chunkInfos);
/** /**
* 新增分片 * 新增分片
* *
......
...@@ -74,6 +74,17 @@ public class DemandQAKnowledgeServiceImpl implements DemandQAKnowledgeService { ...@@ -74,6 +74,17 @@ public class DemandQAKnowledgeServiceImpl implements DemandQAKnowledgeService {
dgToolsAbstractHttpClient.doRequest(DgtoolsApiRoute.DgtoolsAI.UPDATE_QA_KNOWLEDGE_CHUNK, request, getHeaders()); dgToolsAbstractHttpClient.doRequest(DgtoolsApiRoute.DgtoolsAI.UPDATE_QA_KNOWLEDGE_CHUNK, request, getHeaders());
} }
@Override
public void updateKnowledgeChunkDoc(String knowledgeId, String chunkRelationId, List<ChunkInfo> chunkInfos) {
Assert.notBlank(knowledgeId);
Assert.notBlank(chunkRelationId);
UpsertChunkInfoRequest request = new UpsertChunkInfoRequest();
request.setKnowledgeId(knowledgeId);
request.setChunkRelationId(chunkRelationId);
request.setChunkInfos(chunkInfos);
dgToolsAbstractHttpClient.doRequest(DgtoolsApiRoute.DgtoolsAI.BATCH_UPDATE_QA_KNOWLEDGE_CHUNK, request, getHeaders());
}
@Override @Override
public void addKnowledgeChunk(String knowledgeId, List<ChunkInfo> chunkInfos, Integer sort) { public void addKnowledgeChunk(String knowledgeId, List<ChunkInfo> chunkInfos, Integer sort) {
Assert.notBlank(knowledgeId); Assert.notBlank(knowledgeId);
......
...@@ -262,6 +262,8 @@ public interface DgtoolsApiRoute { ...@@ -262,6 +262,8 @@ public interface DgtoolsApiRoute {
String UPDATE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/updateKnowledgeChunkDoc.json"; //修改分片内容 String UPDATE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/updateKnowledgeChunkDoc.json"; //修改分片内容
String BATCH_UPDATE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/batchUpdateKnowledgeChunk.json"; //批量修改分片内容
String DELETE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/deleteKnowledgeChunk.json"; //删除知识库分片 String DELETE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/deleteKnowledgeChunk.json"; //删除知识库分片
String OPEN_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/openKnowledgeChunk.json"; //开关知识库分片信息 String OPEN_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/openKnowledgeChunk.json"; //开关知识库分片信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment