detectChunkingStrategy function
Detect the appropriate chunking strategy based on file extension.
Implementation
ChunkingStrategy detectChunkingStrategy(String? filePath) {
if (filePath == null) return ChunkingStrategy.recursive;
final ext = filePath.split('.').lastOrNull?.toLowerCase() ?? '';
return switch (ext) {
'md' || 'markdown' => ChunkingStrategy.markdown,
_ => ChunkingStrategy.recursive,
};
}