fix scroll action

This commit is contained in:
Julian Freeman
2026-04-05 13:36:56 -04:00
parent 732d1906f6
commit 984f5d73dd

View File

@@ -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();
}
}
};