Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(knowledge): polish chunking-settings debug trigger and strategy hint

wizardchenc577d0e4742e
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.ts
index 1d03ffa4e..7689f76b8 100755
--- a/frontend/src/i18n/locales/en-US.ts
+++ b/frontend/src/i18n/locales/en-US.ts
@@ -1921,7 +1921,7 @@ export default {
childChunkSizeDescription: 'Size of the embedded chunk used for vector match (64–2048). Default 384 ≈ 80 tokens — sweet spot for sentence-transformer / BGE-style embedders.',
strategyLabel: 'Chunking Strategy',
strategyDescription: 'Choose how documents are split into chunks. The Automatic mode profiles each document and picks the best strategy.',
- strategyPlaceholder: 'Select strategy (defaults to classic recursive splitting)',
+ strategyPlaceholder: 'Select a chunking strategy (splits by length if left empty)',
strategies: {
auto: {
label: 'Automatic',
@@ -1953,7 +1953,7 @@ export default {
zh: 'Chinese'
},
debug: {
- toggle: 'Test with sample text',
+ toggle: 'Preview chunking',
toggleHint: 'Run the chunker against sample text without re-uploading',
sampleLabel: 'Sample text',
samplePlaceholder: 'Paste a Markdown / plain-text snippet to see how the current configuration would chunk it…',
diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.ts
index ad0404e45..2a72a1e5b 100755
--- a/frontend/src/i18n/locales/ko-KR.ts
+++ b/frontend/src/i18n/locales/ko-KR.ts
@@ -2530,7 +2530,7 @@ export default {
childChunkSizeDescription: "벡터 매칭에 사용되는 임베딩 청크 크기 (64-2048). 기본값 384 ≈ 80 토큰 — sentence-transformer / BGE 임베더의 최적점.",
strategyLabel: "청킹 전략",
strategyDescription: "문서를 청크로 분할하는 방법을 선택합니다. 자동 모드는 문서를 프로파일링하여 최적의 전략을 선택합니다.",
- strategyPlaceholder: "전략 선택 (기본: 클래식 재귀 분할)",
+ strategyPlaceholder: "청킹 전략 선택 (비워 두면 길이로 분할)",
strategies: {
auto: {
label: "자동",
@@ -2562,7 +2562,7 @@ export default {
zh: "중국어"
},
debug: {
- toggle: "샘플 텍스트로 테스트",
+ toggle: "청킹 결과 미리보기",
toggleHint: "재업로드 없이 샘플 텍스트에 대해 청커 실행",
sampleLabel: "샘플 텍스트",
samplePlaceholder: "현재 구성으로 어떻게 청크되는지 보려면 Markdown / 일반 텍스트 스니펫을 붙여넣으세요…",
diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.ts
index 076bc6d98..c1771d032 100755
--- a/frontend/src/i18n/locales/ru-RU.ts
+++ b/frontend/src/i18n/locales/ru-RU.ts
@@ -2133,7 +2133,7 @@ export default {
childChunkSizeDescription: 'Размер встроенного блока для векторного матчинга (64–2048). По умолчанию 384 ≈ 80 токенов — оптимум для эмбеддеров уровня sentence-transformer / BGE.',
strategyLabel: 'Стратегия разбиения',
strategyDescription: 'Выберите способ разбиения документов на блоки. Автоматический режим анализирует каждый документ и выбирает оптимальную стратегию.',
- strategyPlaceholder: 'Выберите стратегию (по умолчанию классическое рекурсивное разбиение)',
+ strategyPlaceholder: 'Выберите стратегию разбиения (по длине, если не указано)',
strategies: {
auto: {
label: 'Автоматически',
@@ -2165,7 +2165,7 @@ export default {
zh: 'Китайский'
},
debug: {
- toggle: 'Проверить на примере текста',
+ toggle: 'Проверить разбиение',
toggleHint: 'Запустить разбиение для примера текста без повторной загрузки',
sampleLabel: 'Пример текста',
samplePlaceholder: 'Вставьте фрагмент Markdown / простого текста, чтобы увидеть, как его разобьет текущая конфигурация…',
diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts
index 67f8f75ba..e139a8ff4 100755
--- a/frontend/src/i18n/locales/zh-CN.ts
+++ b/frontend/src/i18n/locales/zh-CN.ts
@@ -2489,7 +2489,7 @@ export default {
childChunkSizeDescription: "用于向量匹配的嵌入块大小(64-2048)。默认 384 ≈ 80 tokens,是 sentence-transformer / BGE 类嵌入模型的最佳点。",
strategyLabel: "分块策略",
strategyDescription: "选择文档的分块方式。自动模式会分析每个文档的结构并选择最佳策略。",
- strategyPlaceholder: "选择策略(默认使用经典递归分块)",
+ strategyPlaceholder: "选择分块策略(不填则按长度切分)",
strategies: {
auto: {
label: "自动",
@@ -2521,7 +2521,7 @@ export default {
zh: "中文"
},
debug: {
- toggle: "使用示例文本测试",
+ toggle: "测试分块效果",
toggleHint: "无需重新上传即可对示例文本运行分块器",
sampleLabel: "示例文本",
samplePlaceholder: "粘贴 Markdown / 纯文本片段以查看当前配置的分块结果…",
diff --git a/frontend/src/views/knowledge/settings/KBChunkingDebug.vue b/frontend/src/views/knowledge/settings/KBChunkingDebug.vue
index 61502428d..cedb8029c 100644
--- a/frontend/src/views/knowledge/settings/KBChunkingDebug.vue
+++ b/frontend/src/views/knowledge/settings/KBChunkingDebug.vue
@@ -1,12 +1,15 @@
<template>
<div class="kb-chunking-debug">
- <!-- Compact trigger sits inline with the section header so the test
- action stays accessible no matter how far the form has scrolled. -->
+ <!-- Inline text trigger: sits next to the strategy selector so users
+ discover the test action exactly when they're thinking about which
+ strategy to pick. Kept as a text-style button to match the project's
+ secondary-action convention (no heavy outline / filled treatment). -->
<t-button
type="button"
theme="primary"
- variant="outline"
- size="small"
+ variant="text"
+ size="medium"
+ class="debug-trigger"
@click="open = true"
>
<template #icon><play-circle-icon /></template>
@@ -356,6 +359,29 @@ const tierTheme = (tier: StrategyTier) => {
flex-shrink: 0;
}
+// TDesign's primary text-button renders a filled hover background that
+// looks out of place in this right-aligned slot — it reads as a floating
+// color block rather than a link. Strip the hover/focus/active surfaces
+// and just shift the text colour, giving the trigger a lightweight
+// "inline link" feel that matches the rest of the secondary actions.
+.debug-trigger {
+ --td-bg-color-container-hover: transparent;
+ padding-left: 0;
+ padding-right: 0;
+
+ &:hover,
+ &:focus,
+ &.t-is-active,
+ &:active {
+ background-color: transparent !important;
+ color: var(--td-brand-color-hover);
+ }
+
+ &:active {
+ color: var(--td-brand-color-active);
+ }
+}
+
.drawer-body {
display: flex;
flex-direction: column;
diff --git a/frontend/src/views/knowledge/settings/KBChunkingSettings.vue b/frontend/src/views/knowledge/settings/KBChunkingSettings.vue
index f901163e5..1f0fd67fd 100644
--- a/frontend/src/views/knowledge/settings/KBChunkingSettings.vue
+++ b/frontend/src/views/knowledge/settings/KBChunkingSettings.vue
@@ -5,9 +5,6 @@
<h2>{{ $t('knowledgeEditor.chunking.title') }}</h2>
<p class="section-description">{{ $t('knowledgeEditor.chunking.description') }}</p>
</div>
- <!-- Trigger lives next to the section title so users can sample
- anytime without scrolling to the bottom of a long form. -->
- <KBChunkingDebug :config="debugConfig" />
</div>
<div class="settings-group">
@@ -17,7 +14,7 @@
<label>{{ $t('knowledgeEditor.chunking.strategyLabel') }}</label>
<p class="desc">{{ $t('knowledgeEditor.chunking.strategyDescription') }}</p>
</div>
- <div class="setting-control">
+ <div class="setting-control strategy-control">
<t-select
v-model="localStrategy"
:options="strategyOptions"
@@ -26,6 +23,10 @@
@change="handleStrategyChange"
style="width: 280px;"
/>
+ <!-- Test trigger sits right next to the strategy picker so users
+ discover it exactly when they're deciding which strategy to
+ use on their content. -->
+ <KBChunkingDebug :config="debugConfig" />
</div>
</div>
@@ -388,18 +389,15 @@ const emitUpdate = () => {
align-items: flex-start;
justify-content: space-between;
gap: 16px;
- // Stick to the top of the scrollable section so the inline test trigger
- // stays in reach no matter how far the form has scrolled. Negative top
- // and matching negative margins compensate for content-wrapper's
- // padding (24px 32px) so the sticky band visually spans the full width
- // when stuck.
+ // Stick to the top of the scrollable section so the section title remains
+ // visible while the user scrolls through a long form. Negative top and
+ // matching negative margins compensate for content-wrapper's padding
+ // (24px 32px) so the sticky band visually spans the full width when stuck.
position: sticky;
top: -24px;
z-index: 5;
background: var(--td-bg-color-container);
- // Reserve clearance on the right so the inline trigger never sits under
- // the modal's absolutely-positioned close button.
- padding: 24px 80px 16px 32px;
+ padding: 24px 32px 16px 32px;
margin: -24px -32px 24px -32px;
border-bottom: 1px solid var(--td-component-stroke);
@@ -501,6 +499,15 @@ const emitUpdate = () => {
align-items: center;
}
+// Strategy row stacks the picker above the test trigger so the action has
+// room to breathe without competing with the select for horizontal space.
+// Both children stay right-aligned under the section's right column.
+.strategy-control {
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 6px;
+}
+
.slider-container {
display: flex;
align-items: center;