Merge pull request #66 from iFwu/main

fix: resolve hydration error
This commit is contained in:
Yifei Zhang
2023-03-27 21:59:19 +08:00
committed by GitHub
3 changed files with 12 additions and 3 deletions

View File

@@ -470,6 +470,16 @@ function showMemoryPrompt(session: ChatSession) {
});
}
const useHasHydrated = () => {
const [hasHydrated, setHasHydrated] = useState<boolean>(false);
useEffect(() => {
setHasHydrated(true);
}, []);
return hasHydrated;
};
export function Home() {
const [createNewSession, currentIndex, removeSession] = useChatStore(
(state) => [
@@ -478,7 +488,7 @@ export function Home() {
state.removeSession,
]
);
const loading = !useChatStore?.persist?.hasHydrated();
const loading = !useHasHydrated();
const [showSideBar, setShowSideBar] = useState(true);
// setting

View File

@@ -354,7 +354,7 @@ export function Settings(props: { closeSettings: () => void }) {
<input
type="number"
min={100}
max={4000}
max={4096}
value={config.modelConfig.max_tokens}
onChange={(e) =>
updateConfig(