feat(frontend): chunking debug panel with live preview
Adds a collapsible "Test with sample text" panel underneath the chunking settings in the KB editor. Users paste a Markdown / plain-text snippet, hit "Run preview", and see exactly how the current chunking configuration would split it — without re-uploading any document. The panel calls POST /api/v1/chunker/preview and renders: - Selected tier (heading / heuristic / recursive / legacy) as a tag, with a warning when the chain fell through to legacy fallback - Rejected tiers + reasons (so users see why "auto" picked tier X) - DocProfile stats grid: lines, chars, headings, page-breaks, chapter markers, detected languages - Chunk-size summary: count / avg / stddev / min / max - Per-chunk cards with seq, size (chars + ~tokens), position range, context header (when set), content preview (expand/collapse) The panel reads its config from the live form state so edits to strategy / chunk-size / overlap / etc. are reflected on the next preview run — no save needed. Pieces: - types/chunker.ts: TS types mirroring the backend response shape - api/chunker/index.ts: previewChunking(body) wrapper - views/knowledge/settings/KBChunkingDebug.vue: the panel component - KBChunkingSettings.vue: embeds the panel + exposes a debugConfig computed prop - i18n keys for en-US / zh-CN / ko-KR / ru-RU (8 keys each) https://claude.ai/code/session_01XADhx6mtu2ZYW3DE9Lun6k
This commit is contained in:
@@ -2163,6 +2163,30 @@ export default {
|
||||
de: 'Немецкий',
|
||||
en: 'Английский',
|
||||
zh: 'Китайский'
|
||||
},
|
||||
debug: {
|
||||
toggle: 'Проверить на примере текста',
|
||||
toggleHint: 'Запустить разбиение для примера текста без повторной загрузки',
|
||||
sampleLabel: 'Пример текста',
|
||||
samplePlaceholder: 'Вставьте фрагмент Markdown / простого текста, чтобы увидеть, как его разобьет текущая конфигурация…',
|
||||
runButton: 'Запустить предпросмотр',
|
||||
errorPrefix: 'Ошибка предпросмотра',
|
||||
selectedTier: 'Выбранная стратегия',
|
||||
rejected: 'Отклоненные уровни',
|
||||
contextHeader: 'Контекстный заголовок',
|
||||
fallbackWarning: 'Цепочка стратегий полностью исчерпана — текущие настройки не позволяют разумно разбить контент',
|
||||
profile: {
|
||||
lines: 'строк',
|
||||
chars: 'символов',
|
||||
headings: 'заголовков Markdown',
|
||||
pageBreaks: 'разрывов страниц',
|
||||
chapterMarkers: 'маркеров глав',
|
||||
languages: 'языки'
|
||||
},
|
||||
stats: {
|
||||
chunks: 'блоков',
|
||||
truncated: 'обрезано; всего {total}'
|
||||
}
|
||||
}
|
||||
},
|
||||
multimodal: {
|
||||
|
||||
Reference in New Issue
Block a user