localStorage follow
All checks were successful
Build static content / build (push) Successful in 3m8s

This commit is contained in:
2024-03-30 11:40:34 +08:00
parent f54b192616
commit f0c16a3cd1

View File

@@ -56,9 +56,19 @@ export default function ChatBOX(props: {
const [showAddToolMsg, setShowAddToolMsg] = useState(false); const [showAddToolMsg, setShowAddToolMsg] = useState(false);
const [newToolCallID, setNewToolCallID] = useState(""); const [newToolCallID, setNewToolCallID] = useState("");
const [newToolContent, setNewToolContent] = useState(""); const [newToolContent, setNewToolContent] = useState("");
const [follow, setFollow] = useState(true); let default_follow = localStorage.getItem("follow");
if (default_follow === null) {
default_follow = "true";
}
const [follow, _setFollow] = useState(default_follow === "true");
const mediaRef = createRef(); const mediaRef = createRef();
const setFollow = (follow: boolean) => {
console.log("set follow", follow);
localStorage.setItem("follow", follow.toString());
_setFollow(follow);
};
const messagesEndRef = createRef(); const messagesEndRef = createRef();
useEffect(() => { useEffect(() => {
if (follow) { if (follow) {