Package com.bytedesk.kbase.llm_file
Class FileChunkUtils
java.lang.Object
com.bytedesk.kbase.llm_file.FileChunkUtils
文件chunk处理工具类
提供文件处理相关的静态工具方法
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateTotalContentLength(List<org.springframework.ai.document.Document> documents) 计算文档总内容长度static booleanhasLargeDocument(List<org.springframework.ai.document.Document> documents, int threshold) 检查是否包含超大文档static booleanshouldUseAsyncProcessing(List<org.springframework.ai.document.Document> documents) 判断是否应该使用异步处理 基于文档数量和内容复杂度
-
Constructor Details
-
FileChunkUtils
public FileChunkUtils()
-
-
Method Details
-
shouldUseAsyncProcessing
public static boolean shouldUseAsyncProcessing(List<org.springframework.ai.document.Document> documents) 判断是否应该使用异步处理 基于文档数量和内容复杂度- Parameters:
documents- 文档列表- Returns:
- true 如果应该使用异步处理,false 使用同步处理
-
calculateTotalContentLength
public static int calculateTotalContentLength(List<org.springframework.ai.document.Document> documents) 计算文档总内容长度- Parameters:
documents- 文档列表- Returns:
- 总字符数
-
hasLargeDocument
public static boolean hasLargeDocument(List<org.springframework.ai.document.Document> documents, int threshold) 检查是否包含超大文档- Parameters:
documents- 文档列表threshold- 单个文档大小阈值(字符数)- Returns:
- true 如果包含超大文档
-