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..4336e02d2 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"; +const encoding = get_encoding("cl100k_base"); export function getTokenLength(input: string): number { - const encoding = get_encoding("cl100k_base"); - // console.log('tokens: ', input, encoding.countTokens()) return encoding.encode(input).length; } diff --git a/package.json b/package.json index b7026972f..d6140e629 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@fortaine/fetch-event-source": "^3.0.6", "@hello-pangea/dnd": "^16.5.0", "@next-auth/prisma-adapter": "^1.0.7", - "@next/third-parties": "^14.1.0", + "@next/third-parties": "^14.2.1", "@prisma/client": "5.12.1", "@svgr/webpack": "^8.1.0", "@vercel/analytics": "^1.1.2", @@ -35,8 +35,8 @@ "mermaid": "^10.7.0", "microsoft-cognitiveservices-speech-sdk": "^1.36.0", "nanoid": "^5.0.3", - "next": "^14.1.0", - "next-auth": "^4.24.5", + "next": "^14.2.1", + "next-auth": "^4.24.7", "node-fetch": "^3.3.1", "nodemailer": "^6.9.13", "react": "^18.2.0", @@ -72,7 +72,7 @@ "cross-env": "^7.0.3", "date-fns": "^3.6.0", "eslint": "^8.55.0", - "eslint-config-next": "^14.1.0", + "eslint-config-next": "^14.2.1", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", "husky": "^9.0.7",