+ {restartRequired && (
+
+
+
+
+
+ {t("header.gateway.restartRequired")}
+
+
+ )}
+
{/* Gateway Start/Stop */}
-
+ {isRunning ? (
+
+
+
+
+ {t("header.gateway.action.stop")}
+
+ ) : (
+
+ )}
(null)
const [isAtBottom, setIsAtBottom] = useState(true)
+ const [hasScrolled, setHasScrolled] = useState(false)
const [input, setInput] = useState("")
const {
@@ -56,14 +57,22 @@ export function ChatPage() {
onDeletedActiveSession: newChat,
})
- const handleScroll = (e: React.UIEvent) => {
- const { scrollTop, scrollHeight, clientHeight } = e.currentTarget
+ const syncScrollState = (element: HTMLDivElement) => {
+ const { scrollTop, scrollHeight, clientHeight } = element
+ setHasScrolled(scrollTop > 0)
setIsAtBottom(scrollHeight - scrollTop <= clientHeight + 10)
}
+ const handleScroll = (e: React.UIEvent) => {
+ syncScrollState(e.currentTarget)
+ }
+
useEffect(() => {
- if (isAtBottom && scrollRef.current) {
- scrollRef.current.scrollTop = scrollRef.current.scrollHeight
+ if (scrollRef.current) {
+ if (isAtBottom) {
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight
+ }
+ syncScrollState(scrollRef.current)
}
}, [messages, isTyping, isAtBottom])
@@ -77,6 +86,9 @@ export function ChatPage() {