diff --git a/src/components/ToolCard.vue b/src/components/ToolCard.vue index 0b43794..edb2cb0 100644 --- a/src/components/ToolCard.vue +++ b/src/components/ToolCard.vue @@ -389,15 +389,15 @@ const diffLines = computed(() => { const resultDiffLines = computed(() => { const d = parsed.value?.diff if (!d) return [] - const MAX = 120 + const MAX_DIFF_LINES = 120 const lines = d.split('\n').map(line => { if (line === '') return null if (line.startsWith('+')) return { kind: 'add', text: line } if (line.startsWith('-')) return { kind: 'del', text: line } return { kind: 'ctx', text: line } }).filter((x): x is { kind: string; text: string } => x !== null) - if (lines.length > MAX) { - lines.splice(MAX) + if (lines.length > MAX_DIFF_LINES) { + lines.splice(MAX_DIFF_LINES) lines.push({ kind: 'ctx', text: '…' }) } return lines diff --git a/src/components/ai/ConversationSidebar.vue b/src/components/ai/ConversationSidebar.vue index b5b2e1e..15ef76c 100644 --- a/src/components/ai/ConversationSidebar.vue +++ b/src/components/ai/ConversationSidebar.vue @@ -362,7 +362,7 @@ function formatTime(ts: string): string { } // ── 对话分组:今天 / 昨天 / 更早 ── -const BUCKET_LABELS = computed>(() => ({ +const bucketLabels = computed>(() => ({ today: t('aiChat.today'), yesterday: t('aiChat.yesterday'), earlier: t('aiChat.earlier'), @@ -400,7 +400,7 @@ const groupedActive = computed(() => { const groups: { key: string; label: string; items: AiConversationSummary[] }[] = [] for (const key of ['today', 'yesterday', 'earlier']) { const items = map.get(key) || [] - if (key === 'today' || items.length) groups.push({ key, label: BUCKET_LABELS.value[key], items }) + if (key === 'today' || items.length) groups.push({ key, label: bucketLabels.value[key], items }) } return groups })