fix: 发送消息时强制resetAutoScroll,解决手动上滑后新消息不自动滚动的问题
This commit is contained in:
@@ -102,6 +102,12 @@ export function scrollToBottom(): void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 发送新消息时重置自动滚动,确保新消息可见 */
|
||||||
|
export function resetAutoScroll(): void {
|
||||||
|
autoScroll = true;
|
||||||
|
if (scrollBtnEl) scrollBtnEl.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
export function renderMessages(): void {
|
export function renderMessages(): void {
|
||||||
const currentSession = state.get<ChatSession | null>(KEYS.CURRENT_SESSION);
|
const currentSession = state.get<ChatSession | null>(KEYS.CURRENT_SESSION);
|
||||||
const msgs = currentSession ? currentSession.messages : [];
|
const msgs = currentSession ? currentSession.messages : [];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { detectLanguage, truncate, escapeHtml, formatSize } from '../utils/utils
|
|||||||
import { getSelectedModel, isThinkEnabled, isVisionAvailable, isToolCallingSupported } from './model-bar.js';
|
import { getSelectedModel, isThinkEnabled, isVisionAvailable, isToolCallingSupported } from './model-bar.js';
|
||||||
import {
|
import {
|
||||||
renderMessages, clearMessagesDOM, appendAssistantPlaceholder, appendSystemMessage,
|
renderMessages, clearMessagesDOM, appendAssistantPlaceholder, appendSystemMessage,
|
||||||
updateLastAssistantMessage, clearMessages, safeMarkdown, enableAutoScroll,
|
updateLastAssistantMessage, clearMessages, safeMarkdown, enableAutoScroll, resetAutoScroll,
|
||||||
appendToolCallCardToPlaceholder, updateToolCallCardInPlaceholder, resetCurrentPlaceholder
|
appendToolCallCardToPlaceholder, updateToolCallCardInPlaceholder, resetCurrentPlaceholder
|
||||||
} from './chat-area.js';
|
} from './chat-area.js';
|
||||||
import { showToast } from './toast.js';
|
import { showToast } from './toast.js';
|
||||||
@@ -778,6 +778,7 @@ export async function sendMessage(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logInfo(`发送消息: ${model}`, text ? text.slice(0, 60) + (text.length > 60 ? '...' : '') : '[附件消息]');
|
logInfo(`发送消息: ${model}`, text ? text.slice(0, 60) + (text.length > 60 ? '...' : '') : '[附件消息]');
|
||||||
|
resetAutoScroll(); // 发送新消息时强制恢复自动滚动
|
||||||
|
|
||||||
if (pendingImages.length > 0 && !isVisionAvailable()) {
|
if (pendingImages.length > 0 && !isVisionAvailable()) {
|
||||||
appendSystemMessage('⚠️ 当前模型不支持图片分析,请移除图片后重试');
|
appendSystemMessage('⚠️ 当前模型不支持图片分析,请移除图片后重试');
|
||||||
|
|||||||
Reference in New Issue
Block a user