feat(frontend): expose chunking strategy in KB editor
Surfaces the adaptive 3-tier chunking controls in the existing "Chunking" section of the KB editor modal. Users can now pick a strategy from a dropdown without crafting JSON for the API: - Automatic (recommended) → backend profiler picks the tier - Markdown-optimized → forces heading-aware splitting - Smart structure detection → forces heuristic boundary detection - Classic → original recursive splitter (legacy) The fifth backend value `recursive` is intentionally hidden from the UI — it's functionally near `legacy` and would dilute the choice. Advanced options (collapsible, disabled when strategy=legacy): - TokenLimit (0–8192 approx tokens; 0 = char-based budget) - Languages multi-select (DE/EN/ZH; empty = auto-detect) Behaviour: - New KBs default to strategy="auto" - Existing KBs without the field render with empty strategy and keep classic behavior on save unless the user actively picks one - Overlap warning when overlap >= chunkSize/2 Wired through: - KBChunkingSettings.vue: strategy select + advanced collapsible + ChunkingConfig interface extended - KnowledgeBaseEditorModal.vue: form-state defaults, kb-load mapping, buildSubmitData (chunking_config) + updateKBConfig (documentSplitting) pass strategy/token_limit/languages - api/initialization/index.ts: types extended - i18n: en-US / zh-CN / ko-KR / ru-RU all carry strategy + advanced keys (6 keys each) https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
This commit is contained in:
@@ -50,6 +50,14 @@ export interface InitializationConfig {
|
||||
chunkSize: number;
|
||||
chunkOverlap: number;
|
||||
separators: string[];
|
||||
// Adaptive chunking strategy. Empty / "legacy" = classic recursive splitter.
|
||||
// "auto" lets the backend profiler pick a tier; "heading" / "heuristic"
|
||||
// pin the tier explicitly. See backend chunker package for details.
|
||||
strategy?: string;
|
||||
// Cap chunk size in approx tokens. 0 = char-based budget only.
|
||||
tokenLimit?: number;
|
||||
// Language hints for heuristic patterns ("de", "en", "zh"). Empty = auto-detect.
|
||||
languages?: string[];
|
||||
};
|
||||
// Frontend-only hint for storage selection UI
|
||||
storageType?: 'cos' | 'minio';
|
||||
@@ -94,6 +102,13 @@ export interface KBModelConfigRequest {
|
||||
enableParentChild?: boolean
|
||||
parentChunkSize?: number
|
||||
childChunkSize?: number
|
||||
// Adaptive chunking strategy ("auto" | "heading" | "heuristic" | "legacy").
|
||||
// Empty string keeps the existing backend default (legacy / no change).
|
||||
strategy?: string
|
||||
// Approximate token budget per chunk; 0 = char-based.
|
||||
tokenLimit?: number
|
||||
// Language hints for heuristic patterns. Empty = auto-detect.
|
||||
languages?: string[]
|
||||
}
|
||||
multimodal: {
|
||||
enabled: boolean
|
||||
|
||||
Reference in New Issue
Block a user