fix scroll action
This commit is contained in:
@@ -161,7 +161,11 @@ const translateMessage = async (sender: 'me' | 'partner', retranslateId?: string
|
|||||||
|
|
||||||
isTranslating.value = true;
|
isTranslating.value = true;
|
||||||
currentStreamingMessageId.value = messageId;
|
currentStreamingMessageId.value = messageId;
|
||||||
await scrollToBottom();
|
|
||||||
|
// 只有新消息才自动滚动到底部,重新翻译不滚动
|
||||||
|
if (!retranslateId) {
|
||||||
|
await scrollToBottom();
|
||||||
|
}
|
||||||
|
|
||||||
// 2. Prepare Context
|
// 2. Prepare Context
|
||||||
const historyLimit = 10;
|
const historyLimit = 10;
|
||||||
@@ -224,7 +228,11 @@ const translateMessage = async (sender: 'me' | 'partner', retranslateId?: string
|
|||||||
} finally {
|
} finally {
|
||||||
isTranslating.value = false;
|
isTranslating.value = false;
|
||||||
currentStreamingMessageId.value = null;
|
currentStreamingMessageId.value = null;
|
||||||
scrollToBottom();
|
|
||||||
|
// 只有新消息才滚动到底部
|
||||||
|
if (!retranslateId) {
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -428,7 +436,12 @@ const refineMessage = async (messageId: string) => {
|
|||||||
} finally {
|
} finally {
|
||||||
settings.updateChatMessage(activeSession.value.id, messageId, { isRefining: false, evaluation: undefined });
|
settings.updateChatMessage(activeSession.value.id, messageId, { isRefining: false, evaluation: undefined });
|
||||||
currentStreamingMessageId.value = null;
|
currentStreamingMessageId.value = null;
|
||||||
scrollToBottom();
|
|
||||||
|
// 只有当润色的是最后一条消息时才滚动到底部
|
||||||
|
const lastMsg = activeSession.value.messages[activeSession.value.messages.length - 1];
|
||||||
|
if (lastMsg && lastMsg.id === messageId) {
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user