mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	Merge pull request #1644 from Yidadaa/bugfix0519
feat: close #1478 new chat use global config as default
This commit is contained in:
		@@ -2,6 +2,7 @@ import { NextRequest } from "next/server";
 | 
				
			|||||||
import { getServerSideConfig } from "../config/server";
 | 
					import { getServerSideConfig } from "../config/server";
 | 
				
			||||||
import md5 from "spark-md5";
 | 
					import md5 from "spark-md5";
 | 
				
			||||||
import { ACCESS_CODE_PREFIX } from "../constant";
 | 
					import { ACCESS_CODE_PREFIX } from "../constant";
 | 
				
			||||||
 | 
					import { OPENAI_URL } from "./common";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getIP(req: NextRequest) {
 | 
					function getIP(req: NextRequest) {
 | 
				
			||||||
  let ip = req.ip ?? req.headers.get("x-real-ip");
 | 
					  let ip = req.ip ?? req.headers.get("x-real-ip");
 | 
				
			||||||
@@ -55,7 +56,7 @@ export function auth(req: NextRequest) {
 | 
				
			|||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      console.log("[Auth] admin did not provide an api key");
 | 
					      console.log("[Auth] admin did not provide an api key");
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        error: true,
 | 
					        error: serverConfig.baseUrl?.includes(OPENAI_URL),
 | 
				
			||||||
        msg: "admin did not provide an api key",
 | 
					        msg: "admin did not provide an api key",
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
import { NextRequest } from "next/server";
 | 
					import { NextRequest } from "next/server";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const OPENAI_URL = "api.openai.com";
 | 
					export const OPENAI_URL = "api.openai.com";
 | 
				
			||||||
const DEFAULT_PROTOCOL = "https";
 | 
					const DEFAULT_PROTOCOL = "https";
 | 
				
			||||||
const PROTOCOL = process.env.PROTOCOL ?? DEFAULT_PROTOCOL;
 | 
					const PROTOCOL = process.env.PROTOCOL ?? DEFAULT_PROTOCOL;
 | 
				
			||||||
const BASE_URL = process.env.BASE_URL ?? OPENAI_URL;
 | 
					const BASE_URL = process.env.BASE_URL ?? OPENAI_URL;
 | 
				
			||||||
@@ -45,8 +45,8 @@ export async function requestOpenai(req: NextRequest) {
 | 
				
			|||||||
      signal: controller.signal,
 | 
					      signal: controller.signal,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  } catch (err: unknown) {
 | 
					  } catch (err: unknown) {
 | 
				
			||||||
    if (err instanceof Error && err.name === 'AbortError') {
 | 
					    if (err instanceof Error && err.name === "AbortError") {
 | 
				
			||||||
      console.log('Fetch aborted');
 | 
					      console.log("Fetch aborted");
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      throw err;
 | 
					      throw err;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -143,6 +143,7 @@ export function SessionConfigModel(props: { onClose: () => void }) {
 | 
				
			|||||||
            updater(mask);
 | 
					            updater(mask);
 | 
				
			||||||
            chatStore.updateCurrentSession((session) => (session.mask = mask));
 | 
					            chatStore.updateCurrentSession((session) => (session.mask = mask));
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
 | 
					          shouldSyncFromGlobal
 | 
				
			||||||
          extraListItems={
 | 
					          extraListItems={
 | 
				
			||||||
            session.mask.modelConfig.sendMemory ? (
 | 
					            session.mask.modelConfig.sendMemory ? (
 | 
				
			||||||
              <ListItem
 | 
					              <ListItem
 | 
				
			||||||
@@ -505,7 +506,14 @@ export 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 };
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    // eslint-disable-next-line react-hooks/exhaustive-deps
 | 
				
			||||||
  }, []);
 | 
					  }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // check if should send message
 | 
					  // check if should send message
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,15 +13,15 @@ import EyeIcon from "../icons/eye.svg";
 | 
				
			|||||||
import CopyIcon from "../icons/copy.svg";
 | 
					import CopyIcon from "../icons/copy.svg";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask";
 | 
					import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask";
 | 
				
			||||||
import { ChatMessage, ModelConfig, useChatStore } from "../store";
 | 
					import { ChatMessage, ModelConfig, useAppConfig, useChatStore } from "../store";
 | 
				
			||||||
import { ROLES } from "../client/api";
 | 
					import { ROLES } from "../client/api";
 | 
				
			||||||
import { Input, List, ListItem, Modal, Popover, Select } from "./ui-lib";
 | 
					import { Input, List, ListItem, Modal, Popover, Select } from "./ui-lib";
 | 
				
			||||||
import { Avatar, AvatarPicker } from "./emoji";
 | 
					import { Avatar, AvatarPicker } from "./emoji";
 | 
				
			||||||
import Locale, { AllLangs, Lang } from "../locales";
 | 
					import Locale, { AllLangs, ALL_LANG_OPTIONS, Lang } from "../locales";
 | 
				
			||||||
import { useNavigate } from "react-router-dom";
 | 
					import { useNavigate } from "react-router-dom";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import chatStyle from "./chat.module.scss";
 | 
					import chatStyle from "./chat.module.scss";
 | 
				
			||||||
import { useState } from "react";
 | 
					import { useEffect, useState } from "react";
 | 
				
			||||||
import { downloadAs, readFromFile } from "../utils";
 | 
					import { downloadAs, readFromFile } from "../utils";
 | 
				
			||||||
import { Updater } from "../typing";
 | 
					import { Updater } from "../typing";
 | 
				
			||||||
import { ModelConfigList } from "./model-config";
 | 
					import { ModelConfigList } from "./model-config";
 | 
				
			||||||
@@ -41,6 +41,7 @@ export function MaskConfig(props: {
 | 
				
			|||||||
  updateMask: Updater<Mask>;
 | 
					  updateMask: Updater<Mask>;
 | 
				
			||||||
  extraListItems?: JSX.Element;
 | 
					  extraListItems?: JSX.Element;
 | 
				
			||||||
  readonly?: boolean;
 | 
					  readonly?: boolean;
 | 
				
			||||||
 | 
					  shouldSyncFromGlobal?: boolean;
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
  const [showPicker, setShowPicker] = useState(false);
 | 
					  const [showPicker, setShowPicker] = useState(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,9 +50,15 @@ export function MaskConfig(props: {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const config = { ...props.mask.modelConfig };
 | 
					    const config = { ...props.mask.modelConfig };
 | 
				
			||||||
    updater(config);
 | 
					    updater(config);
 | 
				
			||||||
    props.updateMask((mask) => (mask.modelConfig = config));
 | 
					    props.updateMask((mask) => {
 | 
				
			||||||
 | 
					      mask.modelConfig = config;
 | 
				
			||||||
 | 
					      // if user changed current session mask, it will disable auto sync
 | 
				
			||||||
 | 
					      mask.syncGlobalConfig = false;
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const globalConfig = useAppConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <>
 | 
					    <>
 | 
				
			||||||
      <ContextPrompts
 | 
					      <ContextPrompts
 | 
				
			||||||
@@ -90,10 +97,32 @@ export function MaskConfig(props: {
 | 
				
			|||||||
            type="text"
 | 
					            type="text"
 | 
				
			||||||
            value={props.mask.name}
 | 
					            value={props.mask.name}
 | 
				
			||||||
            onInput={(e) =>
 | 
					            onInput={(e) =>
 | 
				
			||||||
              props.updateMask((mask) => (mask.name = e.currentTarget.value))
 | 
					              props.updateMask((mask) => {
 | 
				
			||||||
 | 
					                mask.name = e.currentTarget.value;
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ></input>
 | 
					          ></input>
 | 
				
			||||||
        </ListItem>
 | 
					        </ListItem>
 | 
				
			||||||
 | 
					        <ListItem
 | 
				
			||||||
 | 
					          title={Locale.Mask.Config.Sync.Title}
 | 
				
			||||||
 | 
					          subTitle={Locale.Mask.Config.Sync.SubTitle}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <input
 | 
				
			||||||
 | 
					            type="checkbox"
 | 
				
			||||||
 | 
					            checked={props.mask.syncGlobalConfig}
 | 
				
			||||||
 | 
					            onChange={(e) => {
 | 
				
			||||||
 | 
					              if (
 | 
				
			||||||
 | 
					                e.currentTarget.checked &&
 | 
				
			||||||
 | 
					                confirm(Locale.Mask.Config.Sync.Confirm)
 | 
				
			||||||
 | 
					              ) {
 | 
				
			||||||
 | 
					                props.updateMask((mask) => {
 | 
				
			||||||
 | 
					                  mask.syncGlobalConfig = e.currentTarget.checked;
 | 
				
			||||||
 | 
					                  mask.modelConfig = { ...globalConfig.modelConfig };
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }}
 | 
				
			||||||
 | 
					          ></input>
 | 
				
			||||||
 | 
					        </ListItem>
 | 
				
			||||||
      </List>
 | 
					      </List>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      <List>
 | 
					      <List>
 | 
				
			||||||
@@ -330,7 +359,7 @@ export function MaskPage() {
 | 
				
			|||||||
              </option>
 | 
					              </option>
 | 
				
			||||||
              {AllLangs.map((lang) => (
 | 
					              {AllLangs.map((lang) => (
 | 
				
			||||||
                <option value={lang} key={lang}>
 | 
					                <option value={lang} key={lang}>
 | 
				
			||||||
                  {Locale.Settings.Lang.Options[lang]}
 | 
					                  {ALL_LANG_OPTIONS[lang]}
 | 
				
			||||||
                </option>
 | 
					                </option>
 | 
				
			||||||
              ))}
 | 
					              ))}
 | 
				
			||||||
            </Select>
 | 
					            </Select>
 | 
				
			||||||
@@ -358,7 +387,7 @@ export function MaskPage() {
 | 
				
			|||||||
                    <div className={styles["mask-name"]}>{m.name}</div>
 | 
					                    <div className={styles["mask-name"]}>{m.name}</div>
 | 
				
			||||||
                    <div className={styles["mask-info"] + " one-line"}>
 | 
					                    <div className={styles["mask-info"] + " one-line"}>
 | 
				
			||||||
                      {`${Locale.Mask.Item.Info(m.context.length)} / ${
 | 
					                      {`${Locale.Mask.Item.Info(m.context.length)} / ${
 | 
				
			||||||
                        Locale.Settings.Lang.Options[m.lang]
 | 
					                        ALL_LANG_OPTIONS[m.lang]
 | 
				
			||||||
                      } / ${m.modelConfig.model}`}
 | 
					                      } / ${m.modelConfig.model}`}
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,12 @@ import {
 | 
				
			|||||||
  useAppConfig,
 | 
					  useAppConfig,
 | 
				
			||||||
} from "../store";
 | 
					} from "../store";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Locale, { AllLangs, changeLang, getLang } from "../locales";
 | 
					import Locale, {
 | 
				
			||||||
 | 
					  AllLangs,
 | 
				
			||||||
 | 
					  ALL_LANG_OPTIONS,
 | 
				
			||||||
 | 
					  changeLang,
 | 
				
			||||||
 | 
					  getLang,
 | 
				
			||||||
 | 
					} from "../locales";
 | 
				
			||||||
import { copyToClipboard } from "../utils";
 | 
					import { copyToClipboard } from "../utils";
 | 
				
			||||||
import Link from "next/link";
 | 
					import Link from "next/link";
 | 
				
			||||||
import { Path, UPDATE_URL } from "../constant";
 | 
					import { Path, UPDATE_URL } from "../constant";
 | 
				
			||||||
@@ -419,7 +424,7 @@ export function Settings() {
 | 
				
			|||||||
            >
 | 
					            >
 | 
				
			||||||
              {AllLangs.map((lang) => (
 | 
					              {AllLangs.map((lang) => (
 | 
				
			||||||
                <option value={lang} key={lang}>
 | 
					                <option value={lang} key={lang}>
 | 
				
			||||||
                  {Locale.Settings.Lang.Options[lang]}
 | 
					                  {ALL_LANG_OPTIONS[lang]}
 | 
				
			||||||
                </option>
 | 
					                </option>
 | 
				
			||||||
              ))}
 | 
					              ))}
 | 
				
			||||||
            </Select>
 | 
					            </Select>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ declare global {
 | 
				
			|||||||
    interface ProcessEnv {
 | 
					    interface ProcessEnv {
 | 
				
			||||||
      OPENAI_API_KEY?: string;
 | 
					      OPENAI_API_KEY?: string;
 | 
				
			||||||
      CODE?: string;
 | 
					      CODE?: string;
 | 
				
			||||||
 | 
					      BASE_URL?: string;
 | 
				
			||||||
      PROXY_URL?: string;
 | 
					      PROXY_URL?: string;
 | 
				
			||||||
      VERCEL?: string;
 | 
					      VERCEL?: string;
 | 
				
			||||||
      HIDE_USER_API_KEY?: string; // disable user's api key input
 | 
					      HIDE_USER_API_KEY?: string; // disable user's api key input
 | 
				
			||||||
@@ -38,6 +39,7 @@ export const getServerSideConfig = () => {
 | 
				
			|||||||
    code: process.env.CODE,
 | 
					    code: process.env.CODE,
 | 
				
			||||||
    codes: ACCESS_CODES,
 | 
					    codes: ACCESS_CODES,
 | 
				
			||||||
    needCode: ACCESS_CODES.size > 0,
 | 
					    needCode: ACCESS_CODES.size > 0,
 | 
				
			||||||
 | 
					    baseUrl: process.env.BASE_URL,
 | 
				
			||||||
    proxyUrl: process.env.PROXY_URL,
 | 
					    proxyUrl: process.env.PROXY_URL,
 | 
				
			||||||
    isVercel: !!process.env.VERCEL,
 | 
					    isVercel: !!process.env.VERCEL,
 | 
				
			||||||
    hideUserApiKey: !!process.env.HIDE_USER_API_KEY,
 | 
					    hideUserApiKey: !!process.env.HIDE_USER_API_KEY,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,21 +69,6 @@ const cn = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "所有语言",
 | 
					      All: "所有语言",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "头像",
 | 
					    Avatar: "头像",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
@@ -220,6 +205,11 @@ const cn = {
 | 
				
			|||||||
    Config: {
 | 
					    Config: {
 | 
				
			||||||
      Avatar: "角色头像",
 | 
					      Avatar: "角色头像",
 | 
				
			||||||
      Name: "角色名称",
 | 
					      Name: "角色名称",
 | 
				
			||||||
 | 
					      Sync: {
 | 
				
			||||||
 | 
					        Title: "使用全局设置",
 | 
				
			||||||
 | 
					        SubTitle: "当前对话是否使用全局模型设置",
 | 
				
			||||||
 | 
					        Confirm: "当前对话的自定义设置将会被自动覆盖,确认启用全局设置?",
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  NewChat: {
 | 
					  NewChat: {
 | 
				
			||||||
@@ -247,5 +237,6 @@ type DeepPartial<T> = T extends object
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  : T;
 | 
					  : T;
 | 
				
			||||||
export type LocaleType = DeepPartial<typeof cn>;
 | 
					export type LocaleType = DeepPartial<typeof cn>;
 | 
				
			||||||
 | 
					export type RequiredLocaleType = typeof cn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default cn;
 | 
					export default cn;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const cs: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Všechny jazyky",
 | 
					      All: "Všechny jazyky",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,21 +72,6 @@ const de: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Alle Sprachen",
 | 
					      All: "Alle Sprachen",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
import { SubmitKey } from "../store/config";
 | 
					import { SubmitKey } from "../store/config";
 | 
				
			||||||
import type { LocaleType } from "./index";
 | 
					import { RequiredLocaleType } from "./index";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const en: LocaleType = {
 | 
					const en: RequiredLocaleType = {
 | 
				
			||||||
  WIP: "Coming Soon...",
 | 
					  WIP: "Coming Soon...",
 | 
				
			||||||
  Error: {
 | 
					  Error: {
 | 
				
			||||||
    Unauthorized:
 | 
					    Unauthorized:
 | 
				
			||||||
@@ -71,21 +71,6 @@ const en: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "All Languages",
 | 
					      All: "All Languages",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
@@ -223,6 +208,11 @@ const en: LocaleType = {
 | 
				
			|||||||
    Config: {
 | 
					    Config: {
 | 
				
			||||||
      Avatar: "Bot Avatar",
 | 
					      Avatar: "Bot Avatar",
 | 
				
			||||||
      Name: "Bot Name",
 | 
					      Name: "Bot Name",
 | 
				
			||||||
 | 
					      Sync: {
 | 
				
			||||||
 | 
					        Title: "Use Global Config",
 | 
				
			||||||
 | 
					        SubTitle: "Use global config in this chat",
 | 
				
			||||||
 | 
					        Confirm: "Confirm to override custom config with global config?",
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  NewChat: {
 | 
					  NewChat: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const es: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Todos los idiomas",
 | 
					      All: "Todos los idiomas",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,21 +72,6 @@ const fr: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION : si vous souhaitez ajouter une nouvelle traduction, ne traduisez pas cette valeur, laissez-la sous forme de `Language`
 | 
					      Name: "Language", // ATTENTION : si vous souhaitez ajouter une nouvelle traduction, ne traduisez pas cette valeur, laissez-la sous forme de `Language`
 | 
				
			||||||
      All: "Toutes les langues",
 | 
					      All: "Toutes les langues",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Vietnamese",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import CS from "./cs";
 | 
				
			|||||||
import KO from "./ko";
 | 
					import KO from "./ko";
 | 
				
			||||||
import { merge } from "../utils/merge";
 | 
					import { merge } from "../utils/merge";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type { LocaleType } from "./cn";
 | 
					export type { LocaleType, RequiredLocaleType } from "./cn";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const AllLangs = [
 | 
					export const AllLangs = [
 | 
				
			||||||
  "en",
 | 
					  "en",
 | 
				
			||||||
@@ -32,6 +32,22 @@ export const AllLangs = [
 | 
				
			|||||||
] as const;
 | 
					] as const;
 | 
				
			||||||
export type Lang = (typeof AllLangs)[number];
 | 
					export type Lang = (typeof AllLangs)[number];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const ALL_LANG_OPTIONS: Record<Lang, string> = {
 | 
				
			||||||
 | 
					  cn: "简体中文",
 | 
				
			||||||
 | 
					  en: "English",
 | 
				
			||||||
 | 
					  tw: "繁體中文",
 | 
				
			||||||
 | 
					  fr: "Français",
 | 
				
			||||||
 | 
					  es: "Español",
 | 
				
			||||||
 | 
					  it: "Italiano",
 | 
				
			||||||
 | 
					  tr: "Türkçe",
 | 
				
			||||||
 | 
					  jp: "日本語",
 | 
				
			||||||
 | 
					  de: "Deutsch",
 | 
				
			||||||
 | 
					  vi: "Tiếng Việt",
 | 
				
			||||||
 | 
					  ru: "Русский",
 | 
				
			||||||
 | 
					  cs: "Čeština",
 | 
				
			||||||
 | 
					  ko: "한국어",
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const LANG_KEY = "lang";
 | 
					const LANG_KEY = "lang";
 | 
				
			||||||
const DEFAULT_LANG = "en";
 | 
					const DEFAULT_LANG = "en";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const it: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Tutte le lingue",
 | 
					      All: "Tutte le lingue",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const jp: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "所有语言",
 | 
					      All: "所有语言",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "アバター",
 | 
					    Avatar: "アバター",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,27 +71,12 @@ const ko: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "All Languages",
 | 
					      All: "All Languages",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "아바타",
 | 
					    Avatar: "아바타",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
    Title: "글꼴 크기",
 | 
					      Title: "글꼴 크기",
 | 
				
			||||||
    SubTitle: "채팅 내용의 글꼴 크기 조정",
 | 
					      SubTitle: "채팅 내용의 글꼴 크기 조정",
 | 
				
			||||||
  },
 | 
					    },
 | 
				
			||||||
    Update: {
 | 
					    Update: {
 | 
				
			||||||
      Version: (x: string) => `버전: ${x}`,
 | 
					      Version: (x: string) => `버전: ${x}`,
 | 
				
			||||||
      IsLatest: "최신 버전",
 | 
					      IsLatest: "최신 버전",
 | 
				
			||||||
@@ -135,8 +120,7 @@ const ko: LocaleType = {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    CompressThreshold: {
 | 
					    CompressThreshold: {
 | 
				
			||||||
      Title: "기록 압축 임계값",
 | 
					      Title: "기록 압축 임계값",
 | 
				
			||||||
      SubTitle:
 | 
					      SubTitle: "미압축 메시지 길이가 임계값을 초과하면 압축됨",
 | 
				
			||||||
        "미압축 메시지 길이가 임계값을 초과하면 압축됨",
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Token: {
 | 
					    Token: {
 | 
				
			||||||
      Title: "API 키",
 | 
					      Title: "API 키",
 | 
				
			||||||
@@ -165,11 +149,10 @@ const ko: LocaleType = {
 | 
				
			|||||||
    MaxTokens: {
 | 
					    MaxTokens: {
 | 
				
			||||||
      Title: "최대 토큰 수 (max_tokens)",
 | 
					      Title: "최대 토큰 수 (max_tokens)",
 | 
				
			||||||
      SubTitle: "입력 토큰과 생성된 토큰의 최대 길이",
 | 
					      SubTitle: "입력 토큰과 생성된 토큰의 최대 길이",
 | 
				
			||||||
    },  
 | 
					    },
 | 
				
			||||||
    PresencePenalty: {
 | 
					    PresencePenalty: {
 | 
				
			||||||
      Title: "존재 페널티 (presence_penalty)",
 | 
					      Title: "존재 페널티 (presence_penalty)",
 | 
				
			||||||
      SubTitle:
 | 
					      SubTitle: "값이 클수록 새로운 주제에 대해 대화할 가능성이 높아집니다.",
 | 
				
			||||||
        "값이 클수록 새로운 주제에 대해 대화할 가능성이 높아집니다.",
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  Store: {
 | 
					  Store: {
 | 
				
			||||||
@@ -178,8 +161,7 @@ const ko: LocaleType = {
 | 
				
			|||||||
    Error: "문제가 발생했습니다. 나중에 다시 시도해주세요.",
 | 
					    Error: "문제가 발생했습니다. 나중에 다시 시도해주세요.",
 | 
				
			||||||
    Prompt: {
 | 
					    Prompt: {
 | 
				
			||||||
      History: (content: string) =>
 | 
					      History: (content: string) =>
 | 
				
			||||||
        "이것은 AI와 사용자 간의 대화 기록을 요약한 내용입니다: " +
 | 
					        "이것은 AI와 사용자 간의 대화 기록을 요약한 내용입니다: " + content,
 | 
				
			||||||
        content,
 | 
					 | 
				
			||||||
      Topic:
 | 
					      Topic:
 | 
				
			||||||
        "다음과 같이 대화 내용을 요약하는 4~5단어 제목을 생성해주세요. 따옴표, 구두점, 인용부호, 기호 또는 추가 텍스트를 제거하십시오. 따옴표로 감싸진 부분을 제거하십시오.",
 | 
					        "다음과 같이 대화 내용을 요약하는 4~5단어 제목을 생성해주세요. 따옴표, 구두점, 인용부호, 기호 또는 추가 텍스트를 제거하십시오. 따옴표로 감싸진 부분을 제거하십시오.",
 | 
				
			||||||
      Summarize:
 | 
					      Summarize:
 | 
				
			||||||
@@ -232,7 +214,8 @@ const ko: LocaleType = {
 | 
				
			|||||||
    SubTitle: "마스크 뒤의 영혼과 대화하세요",
 | 
					    SubTitle: "마스크 뒤의 영혼과 대화하세요",
 | 
				
			||||||
    More: "더 보기",
 | 
					    More: "더 보기",
 | 
				
			||||||
    NotShow: "다시 표시하지 않음",
 | 
					    NotShow: "다시 표시하지 않음",
 | 
				
			||||||
    ConfirmNoShow: "비활성화하시겠습니까? 나중에 설정에서 다시 활성화할 수 있습니다.",
 | 
					    ConfirmNoShow:
 | 
				
			||||||
 | 
					      "비활성화하시겠습니까? 나중에 설정에서 다시 활성화할 수 있습니다.",
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  UI: {
 | 
					  UI: {
 | 
				
			||||||
@@ -242,6 +225,6 @@ const ko: LocaleType = {
 | 
				
			|||||||
    Create: "생성",
 | 
					    Create: "생성",
 | 
				
			||||||
    Edit: "편집",
 | 
					    Edit: "편집",
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  };
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default ko;
 | 
					export default ko;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const ru: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Все языки",
 | 
					      All: "Все языки",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Аватар",
 | 
					    Avatar: "Аватар",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const tr: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Tüm Diller",
 | 
					      All: "Tüm Diller",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Avatar",
 | 
					    Avatar: "Avatar",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,21 +69,6 @@ const tw: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "所有语言",
 | 
					      All: "所有语言",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "大頭貼",
 | 
					    Avatar: "大頭貼",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -71,21 +71,6 @@ const vi: LocaleType = {
 | 
				
			|||||||
    Lang: {
 | 
					    Lang: {
 | 
				
			||||||
      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
					      Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language`
 | 
				
			||||||
      All: "Tất cả ngôn ngữ",
 | 
					      All: "Tất cả ngôn ngữ",
 | 
				
			||||||
      Options: {
 | 
					 | 
				
			||||||
        cn: "简体中文",
 | 
					 | 
				
			||||||
        en: "English",
 | 
					 | 
				
			||||||
        tw: "繁體中文",
 | 
					 | 
				
			||||||
        fr: "Français",
 | 
					 | 
				
			||||||
        es: "Español",
 | 
					 | 
				
			||||||
        it: "Italiano",
 | 
					 | 
				
			||||||
        tr: "Türkçe",
 | 
					 | 
				
			||||||
        jp: "日本語",
 | 
					 | 
				
			||||||
        de: "Deutsch",
 | 
					 | 
				
			||||||
        vi: "Tiếng Việt",
 | 
					 | 
				
			||||||
        ru: "Русский",
 | 
					 | 
				
			||||||
        cs: "Čeština",
 | 
					 | 
				
			||||||
        ko: "한국어",
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    Avatar: "Ảnh đại diện",
 | 
					    Avatar: "Ảnh đại diện",
 | 
				
			||||||
    FontSize: {
 | 
					    FontSize: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,9 +5,9 @@ import { trimTopic } from "../utils";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import Locale from "../locales";
 | 
					import Locale from "../locales";
 | 
				
			||||||
import { showToast } from "../components/ui-lib";
 | 
					import { showToast } from "../components/ui-lib";
 | 
				
			||||||
import { ModelType } from "./config";
 | 
					import { ModelType, useAppConfig } from "./config";
 | 
				
			||||||
import { createEmptyMask, Mask } from "./mask";
 | 
					import { createEmptyMask, Mask } from "./mask";
 | 
				
			||||||
import { REQUEST_TIMEOUT_MS, StoreKey } from "../constant";
 | 
					import { StoreKey } from "../constant";
 | 
				
			||||||
import { api, RequestMessage } from "../client/api";
 | 
					import { api, RequestMessage } from "../client/api";
 | 
				
			||||||
import { ChatControllerPool } from "../client/controller";
 | 
					import { ChatControllerPool } from "../client/controller";
 | 
				
			||||||
import { prettyObject } from "../utils/format";
 | 
					import { prettyObject } from "../utils/format";
 | 
				
			||||||
@@ -38,7 +38,6 @@ export interface ChatStat {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ChatSession {
 | 
					export interface ChatSession {
 | 
				
			||||||
  id: number;
 | 
					  id: number;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  topic: string;
 | 
					  topic: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  memoryPrompt: string;
 | 
					  memoryPrompt: string;
 | 
				
			||||||
@@ -69,6 +68,7 @@ function createEmptySession(): ChatSession {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    lastUpdate: Date.now(),
 | 
					    lastUpdate: Date.now(),
 | 
				
			||||||
    lastSummarizeIndex: 0,
 | 
					    lastSummarizeIndex: 0,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mask: createEmptyMask(),
 | 
					    mask: createEmptyMask(),
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -463,7 +463,7 @@ export const useChatStore = create<ChatStore>()(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (
 | 
					        if (
 | 
				
			||||||
          historyMsgLength > modelConfig.compressMessageLengthThreshold &&
 | 
					          historyMsgLength > modelConfig.compressMessageLengthThreshold &&
 | 
				
			||||||
          session.mask.modelConfig.sendMemory
 | 
					          modelConfig.sendMemory
 | 
				
			||||||
        ) {
 | 
					        ) {
 | 
				
			||||||
          api.llm.chat({
 | 
					          api.llm.chat({
 | 
				
			||||||
            messages: toBeSummarizedMsgs.concat({
 | 
					            messages: toBeSummarizedMsgs.concat({
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ export type Mask = {
 | 
				
			|||||||
  avatar: string;
 | 
					  avatar: string;
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  context: ChatMessage[];
 | 
					  context: ChatMessage[];
 | 
				
			||||||
 | 
					  syncGlobalConfig?: boolean;
 | 
				
			||||||
  modelConfig: ModelConfig;
 | 
					  modelConfig: ModelConfig;
 | 
				
			||||||
  lang: Lang;
 | 
					  lang: Lang;
 | 
				
			||||||
  builtin: boolean;
 | 
					  builtin: boolean;
 | 
				
			||||||
@@ -39,6 +40,7 @@ export const createEmptyMask = () =>
 | 
				
			|||||||
    avatar: DEFAULT_MASK_AVATAR,
 | 
					    avatar: DEFAULT_MASK_AVATAR,
 | 
				
			||||||
    name: DEFAULT_TOPIC,
 | 
					    name: DEFAULT_TOPIC,
 | 
				
			||||||
    context: [],
 | 
					    context: [],
 | 
				
			||||||
 | 
					    syncGlobalConfig: true, // use global config as default
 | 
				
			||||||
    modelConfig: { ...useAppConfig.getState().modelConfig },
 | 
					    modelConfig: { ...useAppConfig.getState().modelConfig },
 | 
				
			||||||
    lang: getLang(),
 | 
					    lang: getLang(),
 | 
				
			||||||
    builtin: false,
 | 
					    builtin: false,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user