refactor(rag): 清理解析切片旧入口
This commit is contained in:
@@ -11,16 +11,4 @@ public class RagDocumentParseRequest {
|
|||||||
|
|
||||||
@Schema(description = "文档ID列表")
|
@Schema(description = "文档ID列表")
|
||||||
private List<Long> documentIds;
|
private List<Long> documentIds;
|
||||||
|
|
||||||
@Schema(description = "切片方式枚举值")
|
|
||||||
private Integer chunkStrategy;
|
|
||||||
|
|
||||||
@Schema(description = "切片长度")
|
|
||||||
private Integer chunkSize;
|
|
||||||
|
|
||||||
@Schema(description = "重叠长度")
|
|
||||||
private Integer chunkOverlap;
|
|
||||||
|
|
||||||
@Schema(description = "分隔符")
|
|
||||||
private String delimiter;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.bruce.rag.event;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文档上传完成事件,用于异步触发自动解析。
|
|
||||||
*/
|
|
||||||
public record RagDocumentUploadedEvent(List<Long> documentIds) {
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.bruce.rag.event;
|
|
||||||
|
|
||||||
import com.bruce.rag.service.IRagDocumentParseService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.context.event.EventListener;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class RagDocumentUploadedEventListener {
|
|
||||||
|
|
||||||
private final IRagDocumentParseService ragDocumentParseService;
|
|
||||||
|
|
||||||
@Async
|
|
||||||
@EventListener
|
|
||||||
public void onUploaded(RagDocumentUploadedEvent event) {
|
|
||||||
if (event == null || event.documentIds() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (Long documentId : event.documentIds()) {
|
|
||||||
try {
|
|
||||||
ragDocumentParseService.parse(documentId);
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
log.warn("RagDocumentUploadedEventListener.onUploaded parse failed, documentId={}, message={}",
|
|
||||||
documentId, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user