From 426b3ddc5bd51b554866155d2ec8c25e36d4491f Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 15 Feb 2026 21:59:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E4=BF=AE=E5=A4=8D=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=AF=A6=E6=83=85=E5=BC=B9=E7=AA=97=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=88=87=E6=8D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改为检查 hasChunks(有实际分块数据)而非 hasIndexed(索引状态) - 当文件没有 chunks 时正确重置为 markdown 视图 --- web/src/components/FileDetailModal.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/src/components/FileDetailModal.vue b/web/src/components/FileDetailModal.vue index 0c529af1..d2da897b 100644 --- a/web/src/components/FileDetailModal.vue +++ b/web/src/components/FileDetailModal.vue @@ -25,7 +25,7 @@ -
+
@@ -141,21 +141,22 @@ const hasIndexed = computed(() => ['done', 'indexed'].includes(file.value?.statu const hasContent = computed( () => (file.value?.lines && file.value?.lines.length > 0) || file.value?.content ) +// 是否有实际的分块数据 +const hasChunks = computed(() => mappedChunks.value && mappedChunks.value.length > 0) const viewModeOptions = computed(() => { const options = [{ label: 'Markdown', value: 'markdown' }] - if (hasIndexed.value) { + // 只有当有实际的分块数据时才显示 Chunks 选项 + if (hasChunks.value) { options.push({ label: 'Chunks', value: 'chunks' }) } return options }) -// 监听文件状态变化,重置视图模式 +// 监听文件变化,如果没有 chunks 则重置为 markdown watch(file, (newFile) => { - if (newFile) { - if (!hasIndexed.value) { - viewMode.value = 'markdown' - } + if (newFile && !hasChunks.value) { + viewMode.value = 'markdown' } })