diff --git a/webclient/src/components/chat/MessageList.vue b/webclient/src/components/chat/MessageList.vue index a797408..dc9bf9d 100644 --- a/webclient/src/components/chat/MessageList.vue +++ b/webclient/src/components/chat/MessageList.vue @@ -7,9 +7,9 @@ v-for="(msg, msgIndex) in chat.messages" :key="msg.id" :data-msg-index="msgIndex" - :class="{ 'msg-enter': msg.animate, 'msg-flash': flashIndex === msgIndex }" + :class="{ 'msg-enter': msg.animate }" > - + @@ -44,15 +44,17 @@ const flashIndex = ref(null) let userScrolledUp = false -function scrollToMessage(index) { +function scrollToMessage(rawIndex) { const el = containerEl.value if (!el) return - const target = el.querySelector(`[data-msg-index="${index}"]`) + const msgIndex = chat.messages.findIndex(m => m.rawIndices?.includes(rawIndex)) + if (msgIndex === -1) return + const target = el.querySelector(`[data-msg-index="${msgIndex}"]`) if (!target) return target.scrollIntoView({ behavior: 'smooth', block: 'center' }) - flashIndex.value = index + flashIndex.value = msgIndex setTimeout(() => { - if (flashIndex.value === index) flashIndex.value = null + if (flashIndex.value === msgIndex) flashIndex.value = null }, 3000) } diff --git a/webclient/src/components/messages/AssistantMessage.vue b/webclient/src/components/messages/AssistantMessage.vue index ab02c3c..1687154 100644 --- a/webclient/src/components/messages/AssistantMessage.vue +++ b/webclient/src/components/messages/AssistantMessage.vue @@ -44,6 +44,7 @@ v-if="msg.text" ref="contentEl" class="msg-assistant-content" + :class="{ 'msg-flash': props.isFlashing }" v-html="renderedText" /> @@ -110,7 +111,10 @@ import { useCopy } from '@/composables/useCopy.js' import { useChatStore } from '@/stores/chat.js' -const props = defineProps({ msg: { type: Object, required: true } }) +const props = defineProps({ + msg: { type: Object, required: true }, + isFlashing: { type: Boolean, default: false } +}) const contentEl = ref(null) const chat = useChatStore() diff --git a/webclient/src/components/messages/UserMessage.vue b/webclient/src/components/messages/UserMessage.vue index ec4319d..5bc8d89 100644 --- a/webclient/src/components/messages/UserMessage.vue +++ b/webclient/src/components/messages/UserMessage.vue @@ -1,7 +1,7 @@