diff --git a/src/app.tsx b/src/app.tsx index 6679c52..d436bda 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -4,7 +4,6 @@ import "./global.css"; import { Message } from "./chatgpt"; import getDefaultParams from "./getDefaultParam"; import ChatBOX from "./chatbox"; -import Settings from "./settings"; export interface ChatStore { systemMessageContent: string; @@ -70,16 +69,8 @@ export function App() { localStorage.setItem(STORAGE_NAME, JSON.stringify(allChatStore)); }, [allChatStore]); - const [showSettings, setShowSettings] = useState(false); - return (
-
- +
); } diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 92a6bd8..1d4a4e3 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -1,11 +1,11 @@ -import { StateUpdater, useState } from "preact/hooks"; +import { useState } from "preact/hooks"; import type { ChatStore } from "./app"; import ChatGPT, { ChunkMessage } from "./chatgpt"; +import Settings from "./settings"; export default function ChatBOX(props: { chatStore: ChatStore; setChatStore: (cs: ChatStore) => void; - setShowSettings: StateUpdater; }) { const { chatStore, setChatStore } = props; const [inputMsg, setInputMsg] = useState(""); @@ -127,9 +127,15 @@ export default function ChatBOX(props: { setChatStore({ ...chatStore }); }; - const { setShowSettings } = props; + const [showSettings, setShowSettings] = useState(false); return (
+

setShowSettings(true)}>