mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-26 01:25:15 +02:00
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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user