Commit a8c2eb89 authored by alex yao's avatar alex yao

perf:问答知识库批量删除

parent 757630ba
......@@ -40,6 +40,14 @@ public interface QAKnowledgeService {
*/
void deleteKnowledgeChunk(Integer kdId, String chunkRelationId);
/**
* 批量删除知识库分片
*
* @param kdId
* @param chunkRelationIds
*/
void batchDeleteKnowledgeChunk(Integer kdId, List<String> chunkRelationIds);
/**
* 更新知识库分片内容
*
......
......@@ -54,6 +54,13 @@ public class QAKnowledgeServiceImpl implements QAKnowledgeService {
demandQAKnowledgeService.deleteKnowledgeChunk(knowledgeId, chunkRelationId);
}
@Override
public void batchDeleteKnowledgeChunk(Integer kdId, List<String> chunkRelationIds) {
logger.info("batchDeleteKnowledgeChunk: kdId={}, chunkRelationIds={}", kdId, chunkRelationIds);
String knowledgeId = getKnowledgeId(kdId);
demandQAKnowledgeService.batchDeleteKnowledgeChunk(knowledgeId, chunkRelationIds);
}
@Override
public void updateKnowledgeChunkDoc(Integer kdId, String chunkRelationId, Long structId, String content) {
logger.info("updateKnowledgeChunkDoc: kdId={}, chunkRelationId={}, structId={}, content={}", kdId, chunkRelationId, structId, content);
......
......@@ -69,9 +69,7 @@ public class QAKnowledgeRestImpl implements QAKnowledgeRest {
@Override
@RedisLimit(key = "OPEN_KNOWLEDGE_CHUNK", timeout = 1, currentUser = true, count = 1)
public void batchDeleteKnowledgeChunks(Integer kdId, List<String> chunkRelationIds) {
for (String chunkRelationId : chunkRelationIds) {
qaKnowledgeService.deleteKnowledgeChunk(kdId, chunkRelationId);
}
qaKnowledgeService.batchDeleteKnowledgeChunk(kdId, chunkRelationIds);
}
@Override
......
......@@ -44,6 +44,14 @@ public interface DemandQAKnowledgeService {
*/
void deleteKnowledgeChunk(String knowledgeId, String chunkRelationId);
/**
* 批量删除知识库分片
*
* @param knowledgeId
* @param chunkRelationIds
*/
void batchDeleteKnowledgeChunk(String knowledgeId, List<String> chunkRelationIds);
/**
* 修改分片内容
*
......
......@@ -62,6 +62,16 @@ public class DemandQAKnowledgeServiceImpl implements DemandQAKnowledgeService {
dgToolsAbstractHttpClient.doRequest(DgtoolsApiRoute.DgtoolsAI.DELETE_QA_KNOWLEDGE_CHUNK, request, getHeaders());
}
@Override
public void batchDeleteKnowledgeChunk(String knowledgeId, List<String> chunkRelationIds) {
Assert.notBlank(knowledgeId);
Assert.notEmpty(chunkRelationIds);
UpsertChunkInfoRequest request = new UpsertChunkInfoRequest();
request.setKnowledgeId(knowledgeId);
request.setChunkRelationIds(chunkRelationIds);
dgToolsAbstractHttpClient.doRequest(DgtoolsApiRoute.DgtoolsAI.BATCH_DELETE_QA_KNOWLEDGE_CHUNK, request, getHeaders());
}
@Override
public void updateKnowledgeChunkDoc(String knowledgeId, String chunkRelationId, Long structId, String content) {
Assert.notBlank(knowledgeId);
......
......@@ -19,6 +19,12 @@ public class UpsertChunkInfoRequest extends AbstractRequest<AbstractResult> impl
*/
private String chunkRelationId;
/**
* 大小块关联ID列表
*/
private List<String> chunkRelationIds;
/**
* 分片内容
*/
......@@ -44,6 +50,15 @@ public class UpsertChunkInfoRequest extends AbstractRequest<AbstractResult> impl
*/
private List<ChunkInfo> chunkInfos;
public List<String> getChunkRelationIds() {
return chunkRelationIds;
}
public void setChunkRelationIds(List<String> chunkRelationIds) {
this.chunkRelationIds = chunkRelationIds;
}
public Long getStructId() {
return structId;
}
......
......@@ -266,6 +266,8 @@ public interface DgtoolsApiRoute {
String DELETE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/deleteKnowledgeChunk.json"; //删除知识库分片
String BATCH_DELETE_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/batchDeleteKnowledgeChunk.json"; //批量删除知识库分片
String OPEN_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/openKnowledgeChunk.json"; //开关知识库分片信息
String SORT_QA_KNOWLEDGE_CHUNK = "qAKnowledgeRest/updateKnowledgeChunkSort.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