Revert "fix setting style"

This reverts commit bad8dcabc346fa3ee3171472950d771ef9351b8c.
This commit is contained in:
2023-03-16 21:09:23 +08:00
parent 71dbe86520
commit f5add0b48d
2 changed files with 10 additions and 17 deletions

View File

@@ -4,7 +4,6 @@ import "./global.css";
import { Message } from "./chatgpt"; import { Message } from "./chatgpt";
import getDefaultParams from "./getDefaultParam"; import getDefaultParams from "./getDefaultParam";
import ChatBOX from "./chatbox"; import ChatBOX from "./chatbox";
import Settings from "./settings";
export interface ChatStore { export interface ChatStore {
systemMessageContent: string; systemMessageContent: string;
@@ -70,16 +69,8 @@ export function App() {
localStorage.setItem(STORAGE_NAME, JSON.stringify(allChatStore)); localStorage.setItem(STORAGE_NAME, JSON.stringify(allChatStore));
}, [allChatStore]); }, [allChatStore]);
const [showSettings, setShowSettings] = useState(false);
return ( return (
<div className="flex text-sm h-screen bg-slate-200"> <div className="flex text-sm h-screen bg-slate-200">
<Settings
chatStore={chatStore}
setChatStore={setChatStore}
show={showSettings}
setShow={setShowSettings}
/>
<div className="flex flex-col h-full p-4 border-r-indigo-500 border-2"> <div className="flex flex-col h-full p-4 border-r-indigo-500 border-2">
<div className="grow overflow-scroll"> <div className="grow overflow-scroll">
<button <button
@@ -146,11 +137,7 @@ export function App() {
DEL DEL
</button> </button>
</div> </div>
<ChatBOX <ChatBOX chatStore={chatStore} setChatStore={setChatStore} />
chatStore={chatStore}
setChatStore={setChatStore}
setShowSettings={setShowSettings}
/>
</div> </div>
); );
} }

View File

@@ -1,11 +1,11 @@
import { StateUpdater, useState } from "preact/hooks"; import { useState } from "preact/hooks";
import type { ChatStore } from "./app"; import type { ChatStore } from "./app";
import ChatGPT, { ChunkMessage } from "./chatgpt"; import ChatGPT, { ChunkMessage } from "./chatgpt";
import Settings from "./settings";
export default function ChatBOX(props: { export default function ChatBOX(props: {
chatStore: ChatStore; chatStore: ChatStore;
setChatStore: (cs: ChatStore) => void; setChatStore: (cs: ChatStore) => void;
setShowSettings: StateUpdater<boolean>;
}) { }) {
const { chatStore, setChatStore } = props; const { chatStore, setChatStore } = props;
const [inputMsg, setInputMsg] = useState(""); const [inputMsg, setInputMsg] = useState("");
@@ -127,9 +127,15 @@ export default function ChatBOX(props: {
setChatStore({ ...chatStore }); setChatStore({ ...chatStore });
}; };
const { setShowSettings } = props; const [showSettings, setShowSettings] = useState(false);
return ( return (
<div className="grow flex flex-col p-4"> <div className="grow flex flex-col p-4">
<Settings
chatStore={chatStore}
setChatStore={setChatStore}
show={showSettings}
setShow={setShowSettings}
/>
<p className="cursor-pointer" onClick={() => setShowSettings(true)}> <p className="cursor-pointer" onClick={() => setShowSettings(true)}>
<div> <div>
<button className="underline"> <button className="underline">