diff --git a/modules/kbase/src/main/java/com/bytedesk/kbase/faq/FaqEventListener.java b/modules/kbase/src/main/java/com/bytedesk/kbase/faq/FaqEventListener.java index 66e886a506..2588c20277 100644 --- a/modules/kbase/src/main/java/com/bytedesk/kbase/faq/FaqEventListener.java +++ b/modules/kbase/src/main/java/com/bytedesk/kbase/faq/FaqEventListener.java @@ -2,7 +2,7 @@ * @Author: jackning 270580156@qq.com * @Date: 2024-09-07 15:42:23 * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-05-17 10:35:00 + * @LastEditTime: 2025-05-17 16:33:09 * @Description: bytedesk.com https://github.com/Bytedesk/bytedesk * Please be aware of the BSL license restrictions before installing Bytedesk IM – * selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license. @@ -78,11 +78,14 @@ public class FaqEventListener { } else { // 使用原有的EasyExcel直接导入方式 log.info("使用EasyExcel直接导入FAQ: {}", filePath); - EasyExcel.read(filePath, FaqExcel.class, new FaqExcelListener(faqRestService, + EasyExcel.read(filePath, + FaqExcel.class, + new FaqExcelListener(faqRestService, KbaseTypeEnum.LLM.name(), upload.getUid(), upload.getKbUid(), - upload.getOrgUid())).sheet().doRead(); + upload.getOrgUid()) + ).sheet().doRead(); } } } catch (Exception e) { diff --git a/modules/kbase/src/main/java/com/bytedesk/kbase/faq/batch/FaqBatchJobConfig.java b/modules/kbase/src/main/java/com/bytedesk/kbase/faq/batch/FaqBatchJobConfig.java index 875ee68c08..f1bad77c15 100644 --- a/modules/kbase/src/main/java/com/bytedesk/kbase/faq/batch/FaqBatchJobConfig.java +++ b/modules/kbase/src/main/java/com/bytedesk/kbase/faq/batch/FaqBatchJobConfig.java @@ -21,6 +21,7 @@ import org.springframework.batch.core.step.builder.StepBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.transaction.PlatformTransactionManager; @@ -71,10 +72,22 @@ public class FaqBatchJobConfig { .build(); } + /** + * 配置默认的Resource bean + * 这个是一个占位符资源,实际使用时会被替换 + */ + @Bean + public Resource defaultExcelResource() { + // 提供一个默认的资源路径,可以根据实际情况调整 + // 这里假设在classpath下有一个templates目录,里面有一个空的模板文件 + // 如果没有这个文件,在运行时会尝试找到它并报错,但应用程序会正常启动 + return new ClassPathResource("templates/faq_template.xlsx"); + } + /** * 配置FAQ Excel读取器 * - * @param resource Excel文件资源 + * @param resource Excel文件资源,如果不手动指定,则使用defaultExcelResource * @return 配置好的Excel读取器 */ @Bean