From e5954d8fb193f1d2a9cd6d661c6734e42f2622ba Mon Sep 17 00:00:00 2001 From: digua Date: Thu, 25 Jun 2026 22:43:22 +0800 Subject: [PATCH] feat(chat-record): polish viewer controls and highlights --- .../common/ChatRecord/MessageItem.vue | 18 ++--- .../common/ChatRecord/SessionTimeline.vue | 77 ++++++++++--------- .../layout/session/SessionAnalysisHeader.vue | 20 ++--- src/i18n/locales/en-US/records.json | 1 + src/i18n/locales/ja-JP/records.json | 1 + src/i18n/locales/zh-CN/records.json | 1 + src/i18n/locales/zh-TW/records.json | 1 + 7 files changed, 63 insertions(+), 56 deletions(-) diff --git a/src/components/common/ChatRecord/MessageItem.vue b/src/components/common/ChatRecord/MessageItem.vue index fe8de056..e2c40121 100644 --- a/src/components/common/ChatRecord/MessageItem.vue +++ b/src/components/common/ChatRecord/MessageItem.vue @@ -70,10 +70,8 @@ const currentColor = computed(() => colorPalette[colorIndex.value]) const avatarColor = computed(() => currentColor.value.avatar) const nameColor = computed(() => currentColor.value.name) -// 气泡颜色(Owner 使用微粉色,其他人使用微灰色) -const bubbleColor = computed(() => - isOwner.value ? 'bg-pink-50/80 dark:bg-pink-950/20' : 'bg-gray-100/80 dark:bg-gray-800/80' -) +// 气泡颜色 +const bubbleColor = 'bg-gray-100/80 dark:bg-gray-800/80' // 显示名称(包含别名) const displayName = computed(() => { @@ -116,23 +114,23 @@ const avatarLetter = computed(() => { return '?' }) +const HIGHLIGHT_MARK_CLASS = + 'bg-transparent text-inherit underline decoration-primary-500/80 underline-offset-4 dark:decoration-primary-400/80' + // 高亮关键词 function highlightContent(content: string): string { if (!props.highlightKeywords?.length || !content) return content const pattern = props.highlightKeywords.map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') const regex = new RegExp(`(${pattern})`, 'gi') - return content.replace( - regex, - '$1' - ) + return content.replace(regex, `$1`) }