feat(frontend): 更新三种切分模式与PDF定位

This commit is contained in:
caoxiaozhu
2026-07-25 18:00:44 +08:00
parent ea08478a37
commit 9193f10e3e
10 changed files with 81 additions and 44 deletions

View File

@@ -30,15 +30,16 @@ const SMART_PREPROCESS_OPTIONS: UnstructuredPreprocessOption[] = [
]
const CHUNK_METHODS: Array<{ value: ChunkMethod; label: string }> = [
{ value: 'structure', label: '文档结构' },
{ value: 'fixed', label: '固定 Token' },
{ value: 'custom', label: '自定义分隔符' },
{ value: 'layout_hybrid', label: '版面结构混合切分' },
{ value: 'semantic', label: '语义切分' },
{ value: 'fixed', label: '固定 Token 切分' },
]
const UNSTRUCTURED_NUMBER_LIMITS = {
chunkSize: { min: 200, max: 2000 },
chunkOverlap: { min: 0, max: 500 },
minChunkSize: { min: 20, max: 500 },
semanticBreakpointPercentile: { min: 1, max: 99 },
qaPairsPerChunk: { min: 1, max: 3 },
} as const
@@ -160,7 +161,7 @@ defineExpose({ revealValidation })
<div class="section-title-row">
<div>
<h3>切分选项</h3>
<p>按文档结构固定 Token 或自定义分隔符拆分长文档</p>
<p>优先保留文档版面结构也可按主题变化或固定 Token 切分</p>
</div>
</div>
@@ -179,7 +180,9 @@ defineExpose({ revealValidation })
:value="method.value"
/>
</el-select>
<small>推荐使用文档结构按标题段落和句子边界保留完整内容块</small>
<small v-if="options.chunkMethod === 'layout_hybrid'">默认推荐按标题段落列表和表格结构切分并合并过短内容块</small>
<small v-else-if="options.chunkMethod === 'semantic'">根据相邻内容的语义变化寻找主题边界适合长文章和知识材料</small>
<small v-else>按句子边界控制固定 Token 长度速度快且结果稳定</small>
</label>
<label class="config-field">
@@ -235,17 +238,22 @@ defineExpose({ revealValidation })
<small>过短的尾部内容会尽量并入前一个切片</small>
</label>
<label v-if="options.chunkMethod === 'custom'" class="config-field">
<span class="config-field-label">自定义分隔符</span>
<el-input
:model-value="options.customDelimiter"
maxlength="40"
show-word-limit
placeholder="例如:--- 或 ###"
aria-label="自定义分隔符"
@update:model-value="updateField('customDelimiter', $event)"
/>
<small>系统会优先在分隔符位置结束当前切片</small>
<label v-if="options.chunkMethod === 'semantic'" class="config-field">
<span class="config-field-label">语义断点百分位</span>
<span class="unit-input">
<el-input-number
:model-value="options.semanticBreakpointPercentile"
:min="1"
:max="99"
:step="1"
:precision="0"
controls-position="right"
aria-label="语义断点百分位"
@update:model-value="updateUnstructuredNumber('semanticBreakpointPercentile', $event)"
/>
<span>%</span>
</span>
<small>百分位越低切片越多推荐保持 95%</small>
</label>
</div>