18586361686
2025-05-13 129a259ff8025d99df80d2f1d679084901b322ed
feat: 支持上传 excel 文件传入知识库
2个文件已修改
14 ■■■■■ 已修改文件
aiflowy-commons/aiflowy-common-ai/src/main/java/tech/aiflowy/common/ai/ExcelDocumentSplitter.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiDocumentController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aiflowy-commons/aiflowy-common-ai/src/main/java/tech/aiflowy/common/ai/ExcelDocumentSplitter.java
@@ -15,7 +15,10 @@
    private boolean includeHeader;
    public ExcelDocumentSplitter(int rowsPerChunk) {
        this(rowsPerChunk, true);
        if (rowsPerChunk <= 0) {
            throw new IllegalArgumentException("rows must be greater than 0");
        }
        this.rowsPerChunk = rowsPerChunk;
    }
    public ExcelDocumentSplitter(int rowsPerChunk, boolean includeHeader) {
aiflowy-modules/aiflowy-module-ai/src/main/java/tech/aiflowy/ai/controller/AiDocumentController.java
@@ -186,6 +186,15 @@
                         @RequestParam(name="rowsPerChunk", required = false) Integer rowsPerChunk,
                         @RequestParam(name="userWillSave") boolean userWillSave
    ) throws IOException {
        if (chunkSize == null){
            chunkSize = 100;
        }
        if (overlapSize == null){
            overlapSize = 200;
        }
        if (rowsPerChunk == null){
            rowsPerChunk = 1;
        }
        if (file.getOriginalFilename() == null){
            return Result.fail(1,"文件名不能为空");
        }