From 984f5d73dd1b3c83280fc7387daa2a12ad5cfe35 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sun, 5 Apr 2026 13:36:56 -0400 Subject: [PATCH] fix scroll action --- src/components/ConversationView.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/ConversationView.vue b/src/components/ConversationView.vue index 77c390b..df6aa95 100644 --- a/src/components/ConversationView.vue +++ b/src/components/ConversationView.vue @@ -161,7 +161,11 @@ const translateMessage = async (sender: 'me' | 'partner', retranslateId?: string isTranslating.value = true; currentStreamingMessageId.value = messageId; - await scrollToBottom(); + + // 只有新消息才自动滚动到底部,重新翻译不滚动 + if (!retranslateId) { + await scrollToBottom(); + } // 2. Prepare Context const historyLimit = 10; @@ -224,7 +228,11 @@ const translateMessage = async (sender: 'me' | 'partner', retranslateId?: string } finally { isTranslating.value = false; currentStreamingMessageId.value = null; - scrollToBottom(); + + // 只有新消息才滚动到底部 + if (!retranslateId) { + scrollToBottom(); + } } }; @@ -428,7 +436,12 @@ const refineMessage = async (messageId: string) => { } finally { settings.updateChatMessage(activeSession.value.id, messageId, { isRefining: false, evaluation: undefined }); currentStreamingMessageId.value = null; - scrollToBottom(); + + // 只有当润色的是最后一条消息时才滚动到底部 + const lastMsg = activeSession.value.messages[activeSession.value.messages.length - 1]; + if (lastMsg && lastMsg.id === messageId) { + scrollToBottom(); + } } };