Initial commit: GovAI 政务AI平台

This commit is contained in:
freedakgmail
2026-06-15 23:48:37 +08:00
commit 0f490f72a9
245 changed files with 51669 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
"use client";
import { useCallback, useEffect, useRef } from "react";
/**
* 自动滚动到容器底部。
* 当 deps 变化时触发滚动(通常传入 messages 数组)。
*/
export function useScrollToBottom(deps: unknown[]) {
const ref = useRef<HTMLDivElement>(null);
const scrollToBottom = useCallback(() => {
ref.current?.scrollIntoView({ behavior: "smooth" });
}, []);
useEffect(() => {
scrollToBottom();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
return ref;
}