重构: 前端命名一致性调整(低风险·2处)
- ToolCard.vue:392 MAX→MAX_DIFF_LINES(描述性, 对齐项目常量规范) - ConversationSidebar.vue:365 BUCKET_LABELS→bucketLabels(computed用camelCase非UPPER_SNAKE) 命名审查整体一致(A95): 文件/组件/变量/类型/常量/composable/api函数/emit事件名/props全合规 留待(中高风险): store模式统一(useXxxStore vs createXxxStore跨文件) / defineEmits写法统一(14组件) / KnowledgeConfig snake_case后端契约
This commit is contained in:
@@ -389,15 +389,15 @@ const diffLines = computed(() => {
|
|||||||
const resultDiffLines = computed(() => {
|
const resultDiffLines = computed(() => {
|
||||||
const d = parsed.value?.diff
|
const d = parsed.value?.diff
|
||||||
if (!d) return []
|
if (!d) return []
|
||||||
const MAX = 120
|
const MAX_DIFF_LINES = 120
|
||||||
const lines = d.split('\n').map(line => {
|
const lines = d.split('\n').map(line => {
|
||||||
if (line === '') return null
|
if (line === '') return null
|
||||||
if (line.startsWith('+')) return { kind: 'add', text: line }
|
if (line.startsWith('+')) return { kind: 'add', text: line }
|
||||||
if (line.startsWith('-')) return { kind: 'del', text: line }
|
if (line.startsWith('-')) return { kind: 'del', text: line }
|
||||||
return { kind: 'ctx', text: line }
|
return { kind: 'ctx', text: line }
|
||||||
}).filter((x): x is { kind: string; text: string } => x !== null)
|
}).filter((x): x is { kind: string; text: string } => x !== null)
|
||||||
if (lines.length > MAX) {
|
if (lines.length > MAX_DIFF_LINES) {
|
||||||
lines.splice(MAX)
|
lines.splice(MAX_DIFF_LINES)
|
||||||
lines.push({ kind: 'ctx', text: '…' })
|
lines.push({ kind: 'ctx', text: '…' })
|
||||||
}
|
}
|
||||||
return lines
|
return lines
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ function formatTime(ts: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ── 对话分组:今天 / 昨天 / 更早 ──
|
// ── 对话分组:今天 / 昨天 / 更早 ──
|
||||||
const BUCKET_LABELS = computed<Record<string, string>>(() => ({
|
const bucketLabels = computed<Record<string, string>>(() => ({
|
||||||
today: t('aiChat.today'),
|
today: t('aiChat.today'),
|
||||||
yesterday: t('aiChat.yesterday'),
|
yesterday: t('aiChat.yesterday'),
|
||||||
earlier: t('aiChat.earlier'),
|
earlier: t('aiChat.earlier'),
|
||||||
@@ -400,7 +400,7 @@ const groupedActive = computed(() => {
|
|||||||
const groups: { key: string; label: string; items: AiConversationSummary[] }[] = []
|
const groups: { key: string; label: string; items: AiConversationSummary[] }[] = []
|
||||||
for (const key of ['today', 'yesterday', 'earlier']) {
|
for (const key of ['today', 'yesterday', 'earlier']) {
|
||||||
const items = map.get(key) || []
|
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
|
return groups
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user