mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Allow agent operators to select speech-to-text models #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -369,22 +369,28 @@ export const useScrollToBottom = (
|
||||
return () => container.removeEventListener('scroll', handleScroll);
|
||||
}, [containerRef, checkIfUserAtBottom]);
|
||||
|
||||
// Imperative scroll function
|
||||
const scrollToBottom = useCallback(() => {
|
||||
if (containerRef?.current) {
|
||||
const container = containerRef.current;
|
||||
container.scrollTo({
|
||||
top: container.scrollHeight - container.clientHeight,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}, [containerRef]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!messages) return;
|
||||
if (!containerRef?.current) return;
|
||||
requestAnimationFrame(() => {
|
||||
setTimeout(() => {
|
||||
if (isAtBottomRef.current) {
|
||||
ref.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
scrollToBottom();
|
||||
}
|
||||
}, 30);
|
||||
}, 100);
|
||||
});
|
||||
}, [messages, containerRef]);
|
||||
|
||||
// Imperative scroll function
|
||||
const scrollToBottom = useCallback(() => {
|
||||
ref.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
}, []);
|
||||
}, [messages, containerRef, scrollToBottom]);
|
||||
|
||||
return { scrollRef: ref, isAtBottom, scrollToBottom };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user