Add keyboard shortcuts to scroll to top and bottom of chat history (#4870)

* Add keybindings to scroll to top and bottom of chat history

* fix isUserScrolling flag and set scrollToBottom to be instant instead of smoothe

* fix stream scroll

* fix default export by removing unneeded constant

* Replace file-defined `isMac` variable with global util

* extract funcitonality to hooks for clarity

* patch import

---------

Co-authored-by: shatfield4 <seanhatfield5@gmail.com>
Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
Marcello Fitton
2026-01-26 14:20:08 -08:00
committed by GitHub
parent f52e2866ac
commit 39e6ccdaa3
4 changed files with 116 additions and 12 deletions

View File

@@ -22,6 +22,7 @@ import SpeechRecognition, {
} from "react-speech-recognition";
import { ChatTooltips } from "./ChatTooltips";
import { MetricsProvider } from "./ChatHistory/HistoricalMessage/Actions/RenderMetrics";
import useChatContainerQuickScroll from "@/hooks/useChatContainerQuickScroll";
export default function ChatContainer({ workspace, knownHistory = [] }) {
const { threadSlug = null } = useParams();
@@ -31,6 +32,7 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
const [socketId, setSocketId] = useState(null);
const [websocket, setWebsocket] = useState(null);
const { files, parseAttachments } = useContext(DndUploaderContext);
const { chatHistoryRef } = useChatContainerQuickScroll();
// Maintain state of message from whatever is in PromptInput
const handleMessageChange = (event) => {
@@ -308,6 +310,7 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
<DnDFileUploaderWrapper>
<MetricsProvider>
<ChatHistory
ref={chatHistoryRef}
history={chatHistory}
workspace={workspace}
sendCommand={sendCommand}