diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 400558077..cfe0cb1a7 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -92,8 +92,8 @@ import { UNFINISHED_INPUT, } from "../constant"; import { Avatar } from "./emoji"; -import { ContextPrompts, MaskAvatar, MaskConfig } from "./mask"; -import { useMaskStore } from "../store/mask"; +// import { ContextPrompts, MaskAvatar, MaskConfig } from "./mask"; +// import { useMaskStore } from "../store/mask"; import { ChatCommandPrefix, useChatCommand, useCommand } from "../command"; import { prettyObject } from "../utils/format"; import { ExportMessageModal } from "./exporter"; @@ -114,7 +114,7 @@ const Markdown = dynamic(async () => (await import("./markdown")).Markdown, { export function SessionConfigModel(props: { onClose: () => void }) { const chatStore = useChatStore(); const session = chatStore.currentSession(); - const maskStore = useMaskStore(); + // const maskStore = useMaskStore(); const navigate = useNavigate(); return ( @@ -136,40 +136,40 @@ export function SessionConfigModel(props: { onClose: () => void }) { } }} />, - } - bordered - text={Locale.Chat.Config.SaveAs} - onClick={() => { - navigate(Path.Masks); - setTimeout(() => { - maskStore.create(session.mask); - }, 500); - }} - />, + // } + // bordered + // text={Locale.Chat.Config.SaveAs} + // onClick={() => { + // navigate(Path.Masks); + // setTimeout(() => { + // maskStore.create(session.mask); + // }, 500); + // }} + // />, ]} > - { - const mask = { ...session.mask }; - updater(mask); - chatStore.updateCurrentSession((session) => (session.mask = mask)); - }} - shouldSyncFromGlobal - extraListItems={ - session.mask.modelConfig.sendMemory ? ( - - ) : ( - <> - ) - } - > + {/* {*/} + {/* const mask = { ...session.mask };*/} + {/* updater(mask);*/} + {/* chatStore.updateCurrentSession((session) => (session.mask = mask));*/} + {/* }}*/} + {/* shouldSyncFromGlobal*/} + {/* extraListItems={*/} + {/* session.mask.modelConfig.sendMemory ? (*/} + {/* */} + {/* ) : (*/} + {/* <>*/} + {/* )*/} + {/* }*/} + {/*>*/} ); @@ -680,14 +680,14 @@ export function EditMessageModal(props: { onClose: () => void }) { > - { - const newMessages = messages.slice(); - updater(newMessages); - setMessages(newMessages); - }} - /> + {/* {*/} + {/* const newMessages = messages.slice();*/} + {/* updater(newMessages);*/} + {/* setMessages(newMessages);*/} + {/* }}*/} + {/*/>*/} ); @@ -867,10 +867,10 @@ function _Chat() { }); // auto sync mask config from global config - if (session.mask.syncGlobalConfig) { - console.log("[Mask] syncing from global, name = ", session.mask.name); - session.mask.modelConfig = { ...config.modelConfig }; - } + // if (session.mask.syncGlobalConfig) { + // console.log("[Mask] syncing from global, name = ", session.mask.name); + // session.mask.modelConfig = { ...config.modelConfig }; + // } }); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -1411,16 +1411,16 @@ function _Chat() { ) : ( <> - {["system"].includes(message.role) ? ( - - ) : ( - - )} + {/*{["system"].includes(message.role) ? (*/} + {/* */} + {/*) : (*/} + {/* */} + {/*)}*/} )} diff --git a/app/components/home.tsx b/app/components/home.tsx index b48408997..ac9f59b67 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -159,7 +159,7 @@ function Screen() { } /> } /> - } /> + {/*} />*/} } /> } /> } /> diff --git a/app/components/new-chat.tsx b/app/components/new-chat.tsx index 54c646f23..5c20d3eec 100644 --- a/app/components/new-chat.tsx +++ b/app/components/new-chat.tsx @@ -148,13 +148,13 @@ export function NewChat() {
{Locale.NewChat.SubTitle}
- navigate(Path.Masks)} - icon={} - bordered - shadow - /> + {/* navigate(Path.Masks)}*/} + {/* icon={}*/} + {/* bordered*/} + {/* shadow*/} + {/*/>*/}
- } - text={shouldNarrow ? undefined : Locale.Mask.Name} - className={styles["sidebar-bar-button"]} - onClick={() => { - if (config.dontShowMaskSplashScreen !== true) { - navigate(Path.NewChat, { state: { fromHome: true } }); - } else { - navigate(Path.Masks, { state: { fromHome: true } }); - } - }} - shadow - /> + {/*}*/} + {/* text={shouldNarrow ? undefined : Locale.Mask.Name}*/} + {/* className={styles["sidebar-bar-button"]}*/} + {/* onClick={() => {*/} + {/* if (config.dontShowMaskSplashScreen !== true) {*/} + {/* navigate(Path.NewChat, { state: { fromHome: true } });*/} + {/* } else {*/} + {/* navigate(Path.Masks, { state: { fromHome: true } });*/} + {/* }*/} + {/* }}*/} + {/* shadow*/} + {/*/>*/} } text={shouldNarrow ? undefined : "赏杯咖啡️"} diff --git a/lib/utils.ts b/lib/utils.ts index 7b5de63fe..a2ed2227d 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1,10 +1,9 @@ import bcrypt from "bcryptjs"; -import {get_encoding} from "tiktoken"; +import { get_encoding } from "tiktoken"; export function getTokenLength(input: string): number { const encoding = get_encoding("cl100k_base"); - // console.log('tokens: ', input, encoding.countTokens()) return encoding.encode(input).length; }