feat: 将滚动事件移东到组件内部

This commit is contained in:
zdl
2025-11-24 15:54:26 +08:00
parent 44ecf7e5c7
commit 3a0898634f
2 changed files with 10 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ import ChatArea from './components/ChatArea';
import RightSidebar from './components/RightSidebar';
// 自定义 Hooks
import { useAgentSessions, useAgentChat, useFileUpload, useAutoScroll } from './hooks';
import { useAgentSessions, useAgentChat, useFileUpload } from './hooks';
/**
* Agent Chat - 主组件HeroUI v3 深色主题)
@@ -82,9 +82,6 @@ const AgentChat = () => {
loadSessions,
});
// 自动滚动 Hook
const { messagesEndRef } = useAutoScroll(messages);
// ==================== 输入框引用(保留在主组件)====================
const inputRef = React.useRef(null);
@@ -134,7 +131,6 @@ const AgentChat = () => {
onToggleRightSidebar={() => setIsRightSidebarOpen(true)}
onNewSession={createNewSession}
userAvatar={user?.avatar}
// messagesEndRef={messagesEndRef}
inputRef={inputRef}
fileInputRef={fileInputRef}
/>