From 35ccfb14c25ade4320c783ff2991d3d79e199ccc Mon Sep 17 00:00:00 2001 From: pBrambi <51099204+pBrambi@users.noreply.github.com> Date: Thu, 20 Apr 2023 01:02:43 +0200 Subject: [PATCH 01/37] Create cs.ts Czech language translation --- app/locales/cs.ts | 185 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 app/locales/cs.ts diff --git a/app/locales/cs.ts b/app/locales/cs.ts new file mode 100644 index 000000000..9163ae2a6 --- /dev/null +++ b/app/locales/cs.ts @@ -0,0 +1,185 @@ +import { SubmitKey } from "../store/app"; +import type { LocaleType } from "./index"; + +const cs: LocaleType = { + WIP: "V přípravě...", + Error: { + Unauthorized: + "Neoprávněný přístup, zadejte přístupový kód na stránce nastavení.", + }, + ChatItem: { + ChatItemCount: (count: number) => `${count} zpráv`, + }, + Chat: { + SubTitle: (count: number) => `${count} zpráv s ChatGPT`, + Actions: { + ChatList: "Přejít na seznam chatů", + CompressedHistory: "Pokyn z komprimované paměti historie", + Export: "Exportovat všechny zprávy jako Markdown", + Copy: "Kopírovat", + Stop: "Zastavit", + Retry: "Zopakovat", + Delete: "Smazat", + }, + Rename: "Přejmenovat chat", + Typing: "Píše...", + Input: (submitKey: string) => { + var inputHints = `${submitKey} pro odeslání`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", Shift + Enter pro řádkování"; + } + return inputHints + ", / pro vyhledávání pokynů"; + }, + Send: "Odeslat", + }, + Export: { + Title: "Všechny zprávy", + Copy: "Kopírovat vše", + Download: "Stáhnout", + MessageFromYou: "Zpráva od vás", + MessageFromChatGPT: "Zpráva z ChatGPT", + }, + Memory: { + Title: "Pokyn z paměti", + EmptyContent: "Zatím nic.", + Send: "Odeslat paměť", + Copy: "Kopírovat paměť", + Reset: "Obnovit relaci", + ResetConfirm: + "Resetováním se vymaže historie aktuálních konverzací i paměť historie pokynů. Opravdu chcete provést obnovu?", + }, + Home: { + NewChat: "Nový chat", + DeleteChat: "Potvrzujete smazání vybrané konverzace?", + DeleteToast: "Chat smazán", + Revert: "Zvrátit", + }, + Settings: { + Title: "Nastavení", + SubTitle: "Všechna nastavení", + Actions: { + ClearAll: "Vymazat všechna data", + ResetAll: "Obnovení všech nastavení", + Close: "Zavřít", + ConfirmResetAll: { + Confirm: "Jste si jisti, že chcete obnovit veškerou konfiguraci?", + }, + ConfirmClearAll: { + Confirm: "Jste si jisti, že chcete obnovit celý chat?", + }, + }, + Lang: { + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` + Options: { + cn: "简体中文", + en: "English", + tw: "繁體中文", + es: "Español", + it: "Italiano", + tr: "Türkçe", + jp: "日本語", + de: "Deutsch", + }, + }, + Avatar: "Avatar", + FontSize: { + Title: "Velikost písma", + SubTitle: "Nastavení velikosti písma obsahu chatu", + }, + Update: { + Version: (x: string) => `Verze: ${x}`, + IsLatest: "Aktuální verze", + CheckUpdate: "Zkontrolovat aktualizace", + IsChecking: "Kontrola aktualizace...", + FoundUpdate: (x: string) => `Nalezena nová verze: ${x}`, + GoToUpdate: "Aktualizovat", + }, + SendKey: "Odeslat klíč", + Theme: "Téma", + TightBorder: "Těsné ohraničení", + SendPreviewBubble: "Náhled v chatovací bublině", + Prompt: { + Disable: { + Title: "Deaktivovat automatické dokončování", + SubTitle: "Zadejte / pro spuštění automatického dokončování", + }, + List: "Seznam pokynů", + ListCount: (builtin: number, custom: number) => + `${builtin} vestavěných, ${custom} uživatelských`, + Edit: "Upravit", + Modal: { + Title: "Seznam pokynů", + Add: "Přidat pokyn", + Search: "Hledat pokyny", + }, + }, + HistoryCount: { + Title: "Počet připojených zpráv", + SubTitle: "Počet odeslaných připojených zpráv na žádost", + }, + CompressThreshold: { + Title: "Práh pro kompresi historie", + SubTitle: + "Komprese proběhne, pokud délka nekomprimovaných zpráv přesáhne tuto hodnotu", + }, + Token: { + Title: "API klíč", + SubTitle: "Použitím klíče ignorujete omezení přístupového kódu", + Placeholder: "Klíč API OpenAI", + }, + Usage: { + Title: "Stav účtu", + SubTitle(used: any, total: any) { + return `Použito tento měsíc $${used}, předplatné $${total}`; + }, + IsChecking: "Kontroluje se...", + Check: "Zkontrolovat", + NoAccess: "Pro kontrolu zůstatku zadejte klíč API", + }, + AccessCode: { + Title: "Přístupový kód", + SubTitle: "Kontrola přístupu povolena", + Placeholder: "Potřebujete přístupový kód", + }, + Model: "Model", + Temperature: { + Title: "Teplota", + SubTitle: "Větší hodnota činí výstup náhodnějším", + }, + MaxTokens: { + Title: "Max. počet tokenů", + SubTitle: "Maximální délka vstupního tokenu a generovaných tokenů", + }, + PresencePenlty: { + Title: "Přítomnostní korekce", + SubTitle: + "Větší hodnota zvyšuje pravděpodobnost nových témat.", + }, + }, + Store: { + DefaultTopic: "Nová konverzace", + BotHello: "Ahoj! Jak mohu dnes pomoci?", + Error: "Něco se pokazilo, zkuste to prosím později.", + Prompt: { + History: (content: string) => + "Toto je shrnutí historie chatu mezi umělou inteligencí a uživatelem v podobě rekapitulace: " + + content, + Topic: + "Vytvořte prosím název o čtyřech až pěti slovech vystihující průběh našeho rozhovoru bez jakýchkoli úvodních slov, interpunkčních znamének, uvozovek, teček, symbolů nebo dalšího textu. Odstraňte uvozovky.", + Summarize: + "Krátce shrň naši diskusi v rozsahu do 200 slov a použij ji jako podnět pro budoucí kontext.", + }, + ConfirmClearAll: "Potvrďte pro vymazání všech dat chatu a nastavení?", + }, + Copy: { + Success: "Zkopírováno do schránky", + Failed: "Kopírování selhalo, prosím, povolte přístup ke schránce", + }, + Context: { + Toast: (x: any) => `Použití ${x} kontextových pokynů`, + Edit: "Kontextové a paměťové pokyny", + Add: "Přidat", + }, +}; + +export default cs; From 6a74d62e98faa224432768c73dc1273b7bb1d2d0 Mon Sep 17 00:00:00 2001 From: pBrambi <51099204+pBrambi@users.noreply.github.com> Date: Thu, 20 Apr 2023 19:26:31 +0200 Subject: [PATCH 02/37] Czech --- app/locales/cn.ts | 1 + app/locales/de.ts | 1 + app/locales/en.ts | 1 + app/locales/es.ts | 1 + app/locales/index.ts | 3 +++ app/locales/it.ts | 1 + app/locales/jp.ts | 1 + app/locales/tr.ts | 1 + app/locales/tw.ts | 1 + 9 files changed, 11 insertions(+) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 1c198195e..744c8258b 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -76,6 +76,7 @@ const cn = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "头像", diff --git a/app/locales/de.ts b/app/locales/de.ts index e71abfaf7..ee9a28dcf 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -79,6 +79,7 @@ const de: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/en.ts b/app/locales/en.ts index 20e569606..947d39089 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -79,6 +79,7 @@ const en: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/es.ts b/app/locales/es.ts index e2a9eb211..b0162835f 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -79,6 +79,7 @@ const es: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/index.ts b/app/locales/index.ts index 389304f85..eee172a23 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -6,6 +6,7 @@ import IT from "./it"; import TR from "./tr"; import JP from "./jp"; import DE from "./de"; +import DE from "./cs"; export type { LocaleType } from "./cn"; @@ -18,6 +19,7 @@ export const AllLangs = [ "tr", "jp", "de", + "cs", ] as const; type Lang = (typeof AllLangs)[number]; @@ -77,4 +79,5 @@ export default { tr: TR, jp: JP, de: DE, + cs: CS, }[getLang()] as typeof CN; diff --git a/app/locales/it.ts b/app/locales/it.ts index f0453b5c3..7881d1aca 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -79,6 +79,7 @@ const it: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index 2818820b5..ab231b357 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -78,6 +78,7 @@ const jp = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "アバター", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 04a846245..0222037b9 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -79,6 +79,7 @@ const tr: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 44c07898d..14e5406bc 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -77,6 +77,7 @@ const tw: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "大頭貼", From a1418fe33c0bd664f5cc88cb4df130026b0e7218 Mon Sep 17 00:00:00 2001 From: Crazyang Date: Tue, 9 May 2023 01:03:51 +0800 Subject: [PATCH 03/37] Update sync.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 因为 Vercel 频繁更新会失败,遂建议改为一天同步一次。 --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 15d324074..a4c14c843 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -5,7 +5,7 @@ permissions: on: schedule: - - cron: "0 * * * *" # every hour + - cron: "0 0 * * *" # every day workflow_dispatch: jobs: From 15e046b3ceee5e6a529cf03d6b52de03841cb237 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Tue, 9 May 2023 11:27:57 +0800 Subject: [PATCH 04/37] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9f54194ab..3fb13a84f 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,9 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s [@WingCH](https://github.com/WingCH) [@jtung4](https://github.com/jtung4) [@micozhu](https://github.com/micozhu) +[@jhansion](https://github.com/jhansion) +[@Sha1rholder](https://github.com/Sha1rholder) +[@AnsonHyq](https://github.com/AnsonHyq) ### Contributor From f4caa0029ef496b665e501c13202d2ef286c2801 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Tue, 9 May 2023 16:51:27 +0800 Subject: [PATCH 05/37] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3fb13a84f..7f6695bba 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel. ## 最新动态 - 🚀 v2.0 已经发布,现在你可以使用面具功能快速创建预制对话了! 了解更多: [ChatGPT 提示词高阶技能:零次、一次和少样本提示](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138)。 +- 💡 想要更方便地随时随地使用本项目?可以试下这款桌面插件:https://github.com/mushan0x0/AI0x0.com ## Get Started From 9b1f25140e861b72a3b783d52ca7f42e6bd966b2 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 9 May 2023 22:46:06 +0800 Subject: [PATCH 06/37] fix: #1359 empty line wrap count --- app/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 43ea796e5..1e34a6b3f 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -160,13 +160,13 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) { measureDom.style.width = width + "px"; measureDom.innerText = dom.value.trim().length > 0 ? dom.value : "1"; - const lineWrapCount = Math.max(0, dom.value.split("\n").length - 1); + const emptyLineWrap = Math.max(0, dom.value.split("\n\n").length - 1); const height = parseFloat(window.getComputedStyle(measureDom).height); const singleLineHeight = parseFloat( window.getComputedStyle(singleLineDom).height, ); - const rows = Math.round(height / singleLineHeight) + lineWrapCount; + const rows = Math.round(height / singleLineHeight) + emptyLineWrap; return rows; } From 2b7f72deec7dec5ccbe5583c10e81af7cf136808 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 9 May 2023 23:01:17 +0800 Subject: [PATCH 07/37] feat: close #1055 cmd/alt/ctrl + arrow up/down to switch window --- app/components/chat.tsx | 14 ++++---------- app/components/sidebar.tsx | 25 ++++++++++++++++++++++++- app/constant.ts | 2 ++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 8786877ba..54def01cf 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -53,7 +53,7 @@ import chatStyle from "./chat.module.scss"; import { ListItem, Modal, showModal } from "./ui-lib"; import { useLocation, useNavigate } from "react-router-dom"; -import { Path } from "../constant"; +import { LAST_INPUT_KEY, Path } from "../constant"; import { Avatar } from "./emoji"; import { MaskAvatar, MaskConfig } from "./mask"; import { useMaskStore } from "../store/mask"; @@ -404,7 +404,6 @@ export function Chat() { const inputRef = useRef(null); const [userInput, setUserInput] = useState(""); - const [beforeInput, setBeforeInput] = useState(""); const [isLoading, setIsLoading] = useState(false); const { submitKey, shouldSubmit } = useSubmitHandler(); const { scrollRef, setAutoScroll, scrollToBottom } = useScrollToBottom(); @@ -477,7 +476,7 @@ export function Chat() { if (userInput.trim() === "") return; setIsLoading(true); chatStore.onUserInput(userInput).then(() => setIsLoading(false)); - setBeforeInput(userInput); + localStorage.setItem(LAST_INPUT_KEY, userInput); setUserInput(""); setPromptHints([]); if (!isMobileScreen) inputRef.current?.focus(); @@ -491,9 +490,9 @@ export function Chat() { // check if should send message const onInputKeyDown = (e: React.KeyboardEvent) => { - // if ArrowUp and no userInput + // if ArrowUp and no userInput, fill with last input if (e.key === "ArrowUp" && userInput.length <= 0) { - setUserInput(beforeInput); + setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? ""); e.preventDefault(); return; } @@ -503,11 +502,6 @@ export function Chat() { } }; const onRightClick = (e: any, message: Message) => { - // auto fill user input - if (message.role === "user") { - setUserInput(message.content); - } - // copy to clipboard if (selectOrCopy(e.currentTarget, message.content)) { e.preventDefault(); diff --git a/app/components/sidebar.tsx b/app/components/sidebar.tsx index e32739259..63614ffae 100644 --- a/app/components/sidebar.tsx +++ b/app/components/sidebar.tsx @@ -32,6 +32,28 @@ const ChatList = dynamic(async () => (await import("./chat-list")).ChatList, { loading: () => null, }); +function useHotKey() { + const chatStore = useChatStore(); + + useEffect(() => { + const onKeyDown = (e: KeyboardEvent) => { + if (e.metaKey || e.altKey || e.ctrlKey) { + const n = chatStore.sessions.length; + const limit = (x: number) => (x + n) % n; + const i = chatStore.currentSessionIndex; + if (e.key === "ArrowUp") { + chatStore.selectSession(limit(i - 1)); + } else if (e.key === "ArrowDown") { + chatStore.selectSession(limit(i + 1)); + } + } + }; + + window.addEventListener("keydown", onKeyDown); + return () => window.removeEventListener("keydown", onKeyDown); + }); +} + function useDragSideBar() { const limit = (x: number) => Math.min(MAX_SIDEBAR_WIDTH, x); @@ -86,9 +108,10 @@ export function SideBar(props: { className?: string }) { // drag side bar const { onDragMouseDown, shouldNarrow } = useDragSideBar(); const navigate = useNavigate(); - const config = useAppConfig(); + useHotKey(); + return (
Date: Tue, 9 May 2023 23:20:03 +0800 Subject: [PATCH 08/37] feat: close #444 use env var to disable gpt-4 --- README.md | 8 +++++++- README_CN.md | 6 +++++- app/api/config/route.ts | 3 ++- app/config/server.ts | 2 ++ app/store/access.ts | 9 +++++++++ app/store/config.ts | 20 ++++++++++++++++++++ 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7f6695bba..90ed7d42f 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,13 @@ Specify OpenAI organization ID. > Default: Empty -If you do not want users to input their own API key, set this environment variable to 1. +If you do not want users to input their own API key, set this value to 1. + +### `DISABLE_GPT4` (optional) + +> Default: Empty + +If you do not want users to use GPT-4, set this value to 1. ## Development diff --git a/README_CN.md b/README_CN.md index 1da68f655..9601e5fda 100644 --- a/README_CN.md +++ b/README_CN.md @@ -64,7 +64,7 @@ code1,code2,code3 ## 环境变量 -> 本项目大多数配置项都通过环境变量来设置。 +> 本项目大多数配置项都通过环境变量来设置,教程:[如何修改 Vercel 环境变量](./docs/vercel-cn.md)。 ### `OPENAI_API_KEY` (必填项) @@ -94,6 +94,10 @@ OpenAI 接口代理 URL,如果你手动配置了 openai 接口代理,请填 如果你不想让用户自行填入 API Key,将此环境变量设置为 1 即可。 +### `DISABLE_GPT4` (可选) + +如果你不想让用户使用 GPT-4,将此环境变量设置为 1 即可。 + ## 开发 > 强烈不建议在本地进行开发或者部署,由于一些技术原因,很难在本地配置好 OpenAI API 代理,除非你能保证可以直连 OpenAI 服务器。 diff --git a/app/api/config/route.ts b/app/api/config/route.ts index 62c8d60fb..2b3bcbf20 100644 --- a/app/api/config/route.ts +++ b/app/api/config/route.ts @@ -1,4 +1,4 @@ -import { NextRequest, NextResponse } from "next/server"; +import { NextResponse } from "next/server"; import { getServerSideConfig } from "../../config/server"; @@ -9,6 +9,7 @@ const serverConfig = getServerSideConfig(); const DANGER_CONFIG = { needCode: serverConfig.needCode, hideUserApiKey: serverConfig.hideUserApiKey, + enableGPT4: serverConfig.enableGPT4, }; declare global { diff --git a/app/config/server.ts b/app/config/server.ts index c1cf439b7..23fec8682 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -8,6 +8,7 @@ declare global { PROXY_URL?: string; VERCEL?: string; HIDE_USER_API_KEY?: string; // disable user's api key input + DISABLE_GPT4?: string; // allow user to use gpt-4 or not } } } @@ -40,5 +41,6 @@ export const getServerSideConfig = () => { proxyUrl: process.env.PROXY_URL, isVercel: !!process.env.VERCEL, hideUserApiKey: !!process.env.HIDE_USER_API_KEY, + enableGPT4: !process.env.DISABLE_GPT4, }; }; diff --git a/app/store/access.ts b/app/store/access.ts index 51290d0a7..79b7b9900 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -2,6 +2,7 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; import { StoreKey } from "../constant"; import { BOT_HELLO } from "./chat"; +import { ALL_MODELS } from "./config"; export interface AccessControlStore { accessCode: string; @@ -60,6 +61,14 @@ export const useAccessStore = create()( console.log("[Config] got config from server", res); set(() => ({ ...res })); + if (!res.enableGPT4) { + ALL_MODELS.forEach((model) => { + if (model.name.startsWith("gpt-4")) { + (model as any).available = false; + } + }); + } + if ((res as any).botHello) { BOT_HELLO.content = (res as any).botHello; } diff --git a/app/store/config.ts b/app/store/config.ts index 926c296f4..1e960456f 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -76,6 +76,26 @@ export const ALL_MODELS = [ name: "gpt-3.5-turbo-0301", available: true, }, + { + name: "qwen-v1", // 通义千问 + available: false, + }, + { + name: "ernie", // 文心一言 + available: false, + }, + { + name: "spark", // 讯飞星火 + available: false, + }, + { + name: "llama", // llama + available: false, + }, + { + name: "chatglm", // chatglm-6b + available: false, + }, ] as const; export type ModelType = (typeof ALL_MODELS)[number]["name"]; From 6d9abf11b8a3c92a946c55af660332b06cbba822 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 9 May 2023 23:36:30 +0800 Subject: [PATCH 09/37] fix: #1363 session index after deleting --- app/components/mask.tsx | 11 ++++++++++- app/masks/en.ts | 2 +- app/store/chat.ts | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 9794c9745..b42e7efb9 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -11,10 +11,11 @@ import CloseIcon from "../icons/close.svg"; import DeleteIcon from "../icons/delete.svg"; import EyeIcon from "../icons/eye.svg"; import CopyIcon from "../icons/copy.svg"; +import ShareIcon from "../icons/share.svg"; import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask"; import { Message, ModelConfig, ROLES, useChatStore } from "../store"; -import { Input, List, ListItem, Modal, Popover, showToast } from "./ui-lib"; +import { Input, List, ListItem, Modal, Popover } from "./ui-lib"; import { Avatar, AvatarPicker } from "./emoji"; import Locale, { AllLangs, Lang } from "../locales"; import { useNavigate } from "react-router-dom"; @@ -358,6 +359,14 @@ export function MaskPage() {
+ } + text={Locale.Mask.Item.Chat} + onClick={() => { + chatStore.newSession(m); + navigate(Path.Chat); + }} + /> } text={Locale.Mask.Item.Chat} diff --git a/app/masks/en.ts b/app/masks/en.ts index 93e9bd6aa..af4f215c4 100644 --- a/app/masks/en.ts +++ b/app/masks/en.ts @@ -31,7 +31,7 @@ export const EN_MASKS: BuiltinMask[] = [ ], modelConfig: { model: "gpt-4", - temperature: 1, + temperature: 0.5, max_tokens: 2000, presence_penalty: 0, sendMemory: true, diff --git a/app/store/chat.ts b/app/store/chat.ts index c938d7879..c18aa2bc6 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -180,8 +180,9 @@ export const useChatStore = create()( const sessions = get().sessions.slice(); sessions.splice(index, 1); + const currentIndex = get().currentSessionIndex; let nextIndex = Math.min( - get().currentSessionIndex, + currentIndex - Number(index < currentIndex), sessions.length - 1, ); From e4630e6a0f5f8aeb8d2ba325bb3e2a670e4081fa Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 9 May 2023 23:38:34 +0800 Subject: [PATCH 10/37] fixup --- app/components/mask.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/components/mask.tsx b/app/components/mask.tsx index b42e7efb9..a37cfba71 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -11,7 +11,6 @@ import CloseIcon from "../icons/close.svg"; import DeleteIcon from "../icons/delete.svg"; import EyeIcon from "../icons/eye.svg"; import CopyIcon from "../icons/copy.svg"; -import ShareIcon from "../icons/share.svg"; import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask"; import { Message, ModelConfig, ROLES, useChatStore } from "../store"; @@ -359,14 +358,6 @@ export function MaskPage() {
- } - text={Locale.Mask.Item.Chat} - onClick={() => { - chatStore.newSession(m); - navigate(Path.Chat); - }} - /> } text={Locale.Mask.Item.Chat} From cb55ce084ce86cc71db12aa4e4e1f82f696e27af Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Wed, 10 May 2023 00:51:43 +0800 Subject: [PATCH 11/37] feat: add model and time info to prompts --- app/store/chat.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index c18aa2bc6..cb11087d4 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -252,9 +252,20 @@ export const useChatStore = create()( model: modelConfig.model, }); + const systemInfo = createMessage({ + role: "system", + content: `IMPRTANT: You are a virtual assistant powered by the ${ + modelConfig.model + } model, now time is ${new Date().toLocaleString()}}`, + id: botMessage.id! + 1, + }); + // get recent messages + const systemMessages = [systemInfo]; const recentMessages = get().getMessagesWithMemory(); - const sendMessages = recentMessages.concat(userMessage); + const sendMessages = systemMessages.concat( + recentMessages.concat(userMessage), + ); const sessionIndex = get().currentSessionIndex; const messageIndex = get().currentSession().messages.length + 1; From 26889141259c3cf735ad017ec07e7f77096fbce0 Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 16:47:41 -0700 Subject: [PATCH 12/37] Create cloudflare-pages-cn.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加Cloudflare Pages的部署说明。这里临时说明,Next-on-Pages有一个bug将很快修复,修复后,Build命令会修改。 --- docs/cloudflare-pages-cn.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/cloudflare-pages-cn.md diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md new file mode 100644 index 000000000..faaeeedaa --- /dev/null +++ b/docs/cloudflare-pages-cn.md @@ -0,0 +1,31 @@ +# Cloudflare Pages 的部署说明 + +## 如何新建项目 +从Github fork 本项目,然后登录dash.cloudflare.com,进入pages。 + + +1. 点击 Create a project; +2. 选择 Connect to Git; +3. 关联Cloudlfare Pages和你的GitHub账号; +4. 选中你fork的此项目; +5. 点击 Begin setup; +6. Project name, Production branch,默认即可,有需要按实际改动; +7. Build Settings下的Framework prsets要选Next.js; +8. Build command 暂时不要用默认的命令,因为有node:buffer的bug,写我给的这个: +``` +npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify +``` +9. Build output directory 用系统默认,不要改动; +10. Root Directory 不要改动; +11. Environment variables ,点击>,然后Add variable,按如下填写: + NODE_VERSION=20.1 + NEXT_TELEMETRY_DISABLE=1 + OPENAI_API_KEY=你自己的API Key + YARN_VERSION=1.22.19 + PHP_VERSION=7.4 + 下面的根据实际需要选填: + CODE= 可选填,访问密码,可以使用逗号隔开多个密码。 + OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + DISABLE_GPT4=1 可选,不让用户使用 GPT-4 +12. Save and Deploy From 652d803739277f40c79bdacc05388faea2ac57bf Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:25:00 -0700 Subject: [PATCH 13/37] Update cloudflare-pages-cn.md --- docs/cloudflare-pages-cn.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index faaeeedaa..de663cc8b 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -18,14 +18,20 @@ npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/493084 9. Build output directory 用系统默认,不要改动; 10. Root Directory 不要改动; 11. Environment variables ,点击>,然后Add variable,按如下填写: - NODE_VERSION=20.1 - NEXT_TELEMETRY_DISABLE=1 - OPENAI_API_KEY=你自己的API Key - YARN_VERSION=1.22.19 - PHP_VERSION=7.4 + -NODE_VERSION=20.1 + -NEXT_TELEMETRY_DISABLE=1 + -OPENAI_API_KEY=你自己的API Key + -YARN_VERSION=1.22.19 + -PHP_VERSION=7.4 下面的根据实际需要选填: - CODE= 可选填,访问密码,可以使用逗号隔开多个密码。 - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 -12. Save and Deploy + -CODE= 可选填,访问密码,可以使用逗号隔开多个密码 + -OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + -HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + -DISABLE_GPT4=1 可选,不让用户使用 GPT-4 +12. Save and Deploy; +13. 点Cancel deployment,因为要填 Compatibility flags; +14. 去Build settings, Functions, 找到Compatibility flags; +15. Configure Production compatibility flag 填 nodejs_compat; +16. Configure Preview compatibility flag 填 nodejs_compat; +17. 去 Deployments,点Retry depolyment. +18. Enjoy. From be58d3afb644a3a0202f1d11213a5e37295cfa9f Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:31:19 -0700 Subject: [PATCH 14/37] Update cloudflare-pages-cn.md --- docs/cloudflare-pages-cn.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index de663cc8b..ff4a3d600 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -18,16 +18,19 @@ npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/493084 9. Build output directory 用系统默认,不要改动; 10. Root Directory 不要改动; 11. Environment variables ,点击>,然后Add variable,按如下填写: - -NODE_VERSION=20.1 - -NEXT_TELEMETRY_DISABLE=1 - -OPENAI_API_KEY=你自己的API Key - -YARN_VERSION=1.22.19 - -PHP_VERSION=7.4 + + - NODE_VERSION=20.1 + - NEXT_TELEMETRY_DISABLE=1 + - OPENAI_API_KEY=你自己的API Key + - YARN_VERSION=1.22.19 + - PHP_VERSION=7.4 + 下面的根据实际需要选填: - -CODE= 可选填,访问密码,可以使用逗号隔开多个密码 - -OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - -HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - -DISABLE_GPT4=1 可选,不让用户使用 GPT-4 + + - CODE= 可选填,访问密码,可以使用逗号隔开多个密码 + - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID + - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key + - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 12. Save and Deploy; 13. 点Cancel deployment,因为要填 Compatibility flags; 14. 去Build settings, Functions, 找到Compatibility flags; From 89551774db3b42166648ac1645b7391a4b2e4668 Mon Sep 17 00:00:00 2001 From: Darth Pika <103236915+darth-pika-hu@users.noreply.github.com> Date: Tue, 9 May 2023 17:45:01 -0700 Subject: [PATCH 15/37] Re-format the Chinese version and added an English version Finally found a computer. --- docs/cloudflare-pages-cn.md | 67 ++++++++++++++++++------------------- docs/cloudflare-pages-en.md | 38 +++++++++++++++++++++ 2 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 docs/cloudflare-pages-en.md diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index ff4a3d600..2f9a99f2d 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -1,40 +1,39 @@ -# Cloudflare Pages 的部署说明 +# Cloudflare Pages 部署指南 ## 如何新建项目 -从Github fork 本项目,然后登录dash.cloudflare.com,进入pages。 +在 Github 上 fork 本项目,然后登录到 dash.cloudflare.com 并进入 Pages。 +1. 点击 "Create a project"。 +2. 选择 "Connect to Git"。 +3. 关联 Cloudflare Pages 和你的 GitHub 账号。 +4. 选中你 fork 的此项目。 +5. 点击 "Begin setup"。 +6. 对于 "Project name" 和 "Production branch",可以使用默认值,也可以根据需要进行更改。 +7. 在 "Build Settings" 中,选择 "Framework presets" 选项并选择 "Next.js"。 +8. 由于 node:buffer 的 bug,暂时不要使用默认的 "Build command"。请使用以下命令: + ``` + npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify + ``` +9. 对于 "Build output directory",使用默认值并且不要修改。 +10. 不要修改 "Root Directory"。 +11. 对于 "Environment variables",点击 ">" 然后点击 "Add variable"。按照以下信息填写: -1. 点击 Create a project; -2. 选择 Connect to Git; -3. 关联Cloudlfare Pages和你的GitHub账号; -4. 选中你fork的此项目; -5. 点击 Begin setup; -6. Project name, Production branch,默认即可,有需要按实际改动; -7. Build Settings下的Framework prsets要选Next.js; -8. Build command 暂时不要用默认的命令,因为有node:buffer的bug,写我给的这个: -``` -npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify -``` -9. Build output directory 用系统默认,不要改动; -10. Root Directory 不要改动; -11. Environment variables ,点击>,然后Add variable,按如下填写: + - `NODE_VERSION=20.1` + - `NEXT_TELEMETRY_DISABLE=1` + - `OPENAI_API_KEY=你自己的API Key` + - `YARN_VERSION=1.22.19` + - `PHP_VERSION=7.4` - - NODE_VERSION=20.1 - - NEXT_TELEMETRY_DISABLE=1 - - OPENAI_API_KEY=你自己的API Key - - YARN_VERSION=1.22.19 - - PHP_VERSION=7.4 + 根据实际需要,可以选择填写以下选项: - 下面的根据实际需要选填: - - - CODE= 可选填,访问密码,可以使用逗号隔开多个密码 - - OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID - - HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key - - DISABLE_GPT4=1 可选,不让用户使用 GPT-4 -12. Save and Deploy; -13. 点Cancel deployment,因为要填 Compatibility flags; -14. 去Build settings, Functions, 找到Compatibility flags; -15. Configure Production compatibility flag 填 nodejs_compat; -16. Configure Preview compatibility flag 填 nodejs_compat; -17. 去 Deployments,点Retry depolyment. -18. Enjoy. + - `CODE= 可选填,访问密码,可以使用逗号隔开多个密码` + - `OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID` + - `HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key` + - `DISABLE_GPT4=1 可选,不让用户使用 GPT-4` + +12. 点击 "Save and Deploy"。 +13. 点击 "Cancel deployment",因为需要填写 Compatibility flags。 +14. 前往 "Build settings"、"Functions",找到 "Compatibility flags"。 +15. 在 "Configure Production compatibility flag" 和 "Configure Preview compatibility flag" 中填写 "nodejs_compat"。 +16. 前往 "Deployments",点击 "Retry deployment"。 +17. Enjoy. \ No newline at end of file diff --git a/docs/cloudflare-pages-en.md b/docs/cloudflare-pages-en.md new file mode 100644 index 000000000..ee8ff6a6b --- /dev/null +++ b/docs/cloudflare-pages-en.md @@ -0,0 +1,38 @@ +# Cloudflare Pages Deployment Guide + +## How to create a new project +Fork this project on GitHub, then log in to dash.cloudflare.com and go to Pages. + +1. Click "Create a project". +2. Choose "Connect to Git". +3. Connect Cloudflare Pages to your GitHub account. +4. Select the forked project. +5. Click "Begin setup". +6. For "Project name" and "Production branch", use the default values or change them as needed. +7. In "Build Settings", choose the "Framework presets" option and select "Next.js". +8. Do not use the default "Build command" due to a node:buffer bug. Instead, use the following command: + ``` + npx https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/4930842298/npm-package-next-on-pages-230 --experimental-minify + ``` +9. For "Build output directory", use the default value and do not modify it. +10. Do not modify "Root Directory". +11. For "Environment variables", click ">" and then "Add variable". Fill in the following information: + - `NODE_VERSION=20.1` + - `NEXT_TELEMETRY_DISABLE=1` + - `OPENAI_API_KEY=your_own_API_key` + - `YARN_VERSION=1.22.19` + - `PHP_VERSION=7.4` + + Optionally fill in the following based on your needs: + + - `CODE= Optional, access passwords, multiple passwords can be separated by commas` + - `OPENAI_ORG_ID= Optional, specify the organization ID in OpenAI` + - `HIDE_USER_API_KEY=1 Optional, do not allow users to enter their own API key` + - `DISABLE_GPT4=1 Optional, do not allow users to use GPT-4` + +12. Click "Save and Deploy". +13. Click "Cancel deployment" because you need to fill in Compatibility flags. +14. Go to "Build settings", "Functions", and find "Compatibility flags". +15. Fill in "nodejs_compat" for both "Configure Production compatibility flag" and "Configure Preview compatibility flag". +16. Go to "Deployments" and click "Retry deployment". +17. Enjoy. \ No newline at end of file From a80dcaa1c37db621bac15dad198e3054cbae6af1 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Wed, 10 May 2023 09:27:33 +0800 Subject: [PATCH 16/37] fix: row count logic --- app/utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 1e34a6b3f..a272d5684 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -158,15 +158,15 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) { const width = getDomContentWidth(dom); measureDom.style.width = width + "px"; - measureDom.innerText = dom.value.trim().length > 0 ? dom.value : "1"; - - const emptyLineWrap = Math.max(0, dom.value.split("\n\n").length - 1); + measureDom.innerText = dom.value !== "" ? dom.value : "1"; + const endWithEmptyLine = dom.value.endsWith("\n"); const height = parseFloat(window.getComputedStyle(measureDom).height); const singleLineHeight = parseFloat( window.getComputedStyle(singleLineDom).height, ); - const rows = Math.round(height / singleLineHeight) + emptyLineWrap; + const rows = + Math.round(height / singleLineHeight) + (endWithEmptyLine ? 1 : 0); return rows; } From 96e3d3a22c57fd061cad68d374d97c5f1ec51e2f Mon Sep 17 00:00:00 2001 From: PaRaD1SE98 Date: Wed, 10 May 2023 07:14:49 +0000 Subject: [PATCH 17/37] =?UTF-8?q?=E7=BB=99=E6=89=80=E6=9C=89select?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E4=B8=8B=E6=8B=89=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/mask.tsx | 10 +++++----- app/components/model-config.tsx | 6 +++--- app/components/settings.tsx | 22 +++++++++++++++------- app/components/ui-lib.module.scss | 25 +++++++++++++++++++++++++ app/components/ui-lib.tsx | 21 +++++++++++++++++++++ app/icons/down.svg | 1 + 6 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 app/icons/down.svg diff --git a/app/components/mask.tsx b/app/components/mask.tsx index a37cfba71..13ffb9ef6 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -14,7 +14,7 @@ import CopyIcon from "../icons/copy.svg"; import { DEFAULT_MASK_AVATAR, Mask, useMaskStore } from "../store/mask"; import { Message, ModelConfig, ROLES, useChatStore } from "../store"; -import { Input, List, ListItem, Modal, Popover } from "./ui-lib"; +import { Input, List, ListItem, Modal, Popover, Select } from "./ui-lib"; import { Avatar, AvatarPicker } from "./emoji"; import Locale, { AllLangs, Lang } from "../locales"; import { useNavigate } from "react-router-dom"; @@ -116,7 +116,7 @@ function ContextPromptItem(props: { return (
{!focusingInput && ( - + )} onSearch(e.currentTarget.value)} /> - + - + - + - + - + ) {
); } + +export function Select( + props: React.DetailedHTMLProps< + React.SelectHTMLAttributes, + HTMLSelectElement + >, +) { + const { className, children, ...otherProps } = props; + return ( +
+ + +
+ ); +} diff --git a/app/icons/down.svg b/app/icons/down.svg new file mode 100644 index 000000000..cca830b8e --- /dev/null +++ b/app/icons/down.svg @@ -0,0 +1 @@ + From 71a546dd4494b4f3cc2d7a3a41869ebebf861dab Mon Sep 17 00:00:00 2001 From: crim50n Date: Wed, 10 May 2023 10:16:40 +0300 Subject: [PATCH 18/37] Adding Russian translation Adding a Russian translation and fixing other language files to make them look the same. --- app/locales/cn.ts | 3 +- app/locales/de.ts | 3 +- app/locales/en.ts | 1 + app/locales/es.ts | 7 +- app/locales/index.ts | 3 + app/locales/it.ts | 5 +- app/locales/jp.ts | 3 +- app/locales/ru.ts | 244 +++++++++++++++++++++++++++++++++++++++++++ app/locales/tr.ts | 3 +- app/locales/tw.ts | 3 +- app/locales/vi.ts | 1 + 11 files changed, 266 insertions(+), 10 deletions(-) create mode 100644 app/locales/ru.ts diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 112b3b5cf..c6f5d67fa 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -67,7 +67,7 @@ const cn = { ConfirmClearAll: "确认清除所有数据?", }, Lang: { - Name: "Language", + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` All: "所有语言", Options: { cn: "简体中文", @@ -79,6 +79,7 @@ const cn = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "头像", diff --git a/app/locales/de.ts b/app/locales/de.ts index 56202722d..7c0b94db6 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -71,7 +71,7 @@ const de: LocaleType = { }, Lang: { Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` - All: "All Languages", + All: "Alle Sprachen", Options: { cn: "简体中文", en: "English", @@ -82,6 +82,7 @@ const de: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Avatar", diff --git a/app/locales/en.ts b/app/locales/en.ts index cb97c51ce..ba6482574 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -81,6 +81,7 @@ const en: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Avatar", diff --git a/app/locales/es.ts b/app/locales/es.ts index df28075eb..9997752e8 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -69,11 +69,11 @@ const es: LocaleType = { ConfirmClearAll: "Are you sure you want to reset all chat?", }, Lang: { - Name: "Language", - All: "All Languages", + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` + All: "Todos los idiomas", Options: { cn: "简体中文", - en: "Inglés", + en: "English", tw: "繁體中文", es: "Español", it: "Italiano", @@ -81,6 +81,7 @@ const es: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Avatar", diff --git a/app/locales/index.ts b/app/locales/index.ts index dee6f795b..757c1719d 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -7,6 +7,7 @@ import TR from "./tr"; import JP from "./jp"; import DE from "./de"; import VI from "./vi"; +import RU from "./ru"; export type { LocaleType } from "./cn"; @@ -20,6 +21,7 @@ export const AllLangs = [ "jp", "de", "vi", + "ru", ] as const; export type Lang = (typeof AllLangs)[number]; @@ -82,4 +84,5 @@ export default { jp: JP, de: DE, vi: VI, + ru: RU, }[getLang()] as typeof CN; diff --git a/app/locales/it.ts b/app/locales/it.ts index abf655f0d..ddb85c948 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -69,8 +69,8 @@ const it: LocaleType = { ConfirmClearAll: "Sei sicuro vuoi cancellare tutte le chat?", }, Lang: { - Name: "Lingue", - All: "All Languages", + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` + All: "Tutte le lingue", Options: { cn: "简体中文", en: "English", @@ -81,6 +81,7 @@ const it: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Avatar", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index de03f9fdc..d34ee68a6 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -69,7 +69,7 @@ const jp: LocaleType = { ConfirmClearAll: "すべてのチャットをリセットしてもよろしいですか?", }, Lang: { - Name: "Language", + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` All: "所有语言", Options: { cn: "简体中文", @@ -81,6 +81,7 @@ const jp: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "アバター", diff --git a/app/locales/ru.ts b/app/locales/ru.ts new file mode 100644 index 000000000..dc0b149be --- /dev/null +++ b/app/locales/ru.ts @@ -0,0 +1,244 @@ +import { SubmitKey } from "../store/config"; +import type { LocaleType } from "./index"; + +const ru: LocaleType = { + WIP: "Скоро...", + Error: { + Unauthorized: + "Несанкционированный доступ. Пожалуйста, введите код доступа на странице настроек.", + }, + ChatItem: { + ChatItemCount: (count: number) => `${count} сообщений`, + }, + Chat: { + SubTitle: (count: number) => `${count} сообщений с ChatGPT`, + Actions: { + ChatList: "Перейти к списку чатов", + CompressedHistory: "Сжатая история памяти", + Export: "Экспортировать все сообщения в формате Markdown", + Copy: "Копировать", + Stop: "Остановить", + Retry: "Повторить", + Delete: "Удалить", + }, + Rename: "Переименовать чат", + Typing: "Печатает…", + Input: (submitKey: string) => { + var inputHints = `${submitKey} для отправки сообщения`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", Shift + Enter для переноса строки"; + } + return inputHints + ", / для поиска подсказок"; + }, + Send: "Отправить", + Config: { + Reset: "Сбросить настройки", + SaveAs: "Сохранить как маску", + }, + }, + Export: { + Title: "Все сообщения", + Copy: "Копировать все", + Download: "Скачать", + MessageFromYou: "Сообщение от вас", + MessageFromChatGPT: "Сообщение от ChatGPT", + }, + Memory: { + Title: "Память", + EmptyContent: "Пусто.", + Send: "Отправить память", + Copy: "Копировать память", + Reset: "Сбросить сессию", + ResetConfirm: + "При сбросе текущая история переписки и историческая память будут удалены. Вы уверены, что хотите сбросить?", + }, + Home: { + NewChat: "Новый чат", + DeleteChat: "Вы действительно хотите удалить выбранный разговор?", + DeleteToast: "Чат удален", + Revert: "Отмена", + }, + Settings: { + Title: "Настройки", + SubTitle: "Все настройки", + Actions: { + ClearAll: "Очистить все данные", + ResetAll: "Сбросить все настройки", + Close: "Закрыть", + ConfirmResetAll: "Вы уверены, что хотите сбросить все настройки?", + ConfirmClearAll: "Вы уверены, что хотите очистить все данные?", + }, + Lang: { + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` + All: "Все языки", + Options: { + cn: "简体中文", + en: "English", + tw: "繁體中文", + es: "Español", + it: "Italiano", + tr: "Türkçe", + jp: "日本語", + de: "Deutsch", + vi: "Vietnamese", + ru: "Русский", + }, + }, + Avatar: "Аватар", + FontSize: { + Title: "Размер шрифта", + SubTitle: "Настроить размер шрифта контента чата", + }, + Update: { + Version: (x: string) => `Версия: ${x}`, + IsLatest: "Последняя версия", + CheckUpdate: "Проверить обновление", + IsChecking: "Проверка обновления...", + FoundUpdate: (x: string) => `Найдена новая версия: ${x}`, + GoToUpdate: "Обновить", + }, + SendKey: "Клавиша отправки", + Theme: "Тема", + TightBorder: "Узкая граница", + SendPreviewBubble: { + Title: "Отправить предпросмотр", + SubTitle: "Предварительный просмотр markdown в пузыре", + }, + Mask: { + Title: "Экран заставки маски", + SubTitle: "Показывать экран заставки маски перед началом нового чата", + }, + Prompt: { + Disable: { + Title: "Отключить автозаполнение", + SubTitle: "Ввод / для запуска автозаполнения", + }, + List: "Список подсказок", + ListCount: (builtin: number, custom: number) => + `${builtin} встроенных, ${custom} пользовательских`, + Edit: "Редактировать", + Modal: { + Title: "Список подсказок", + Add: "Добавить", + Search: "Поиск подсказок", + }, + EditModal: { + Title: "Редактировать подсказку", + }, + }, + HistoryCount: { + Title: "Количество прикрепляемых сообщений", + SubTitle: "Количество отправляемых сообщений, прикрепляемых к каждому запросу", + }, + CompressThreshold: { + Title: "Порог сжатия истории", + SubTitle: + "Будет сжимать, если длина несжатых сообщений превышает указанное значение", + }, + Token: { + Title: "API ключ", + SubTitle: "Используйте свой ключ, чтобы игнорировать лимит доступа", + Placeholder: "API ключ OpenAI", + }, + Usage: { + Title: "Баланс аккаунта", + SubTitle(used: any, total: any) { + return `Использовано в этом месяце $${used}, подписка $${total}`; + }, + IsChecking: "Проверка...", + Check: "Проверить", + NoAccess: "Введите API ключ, чтобы проверить баланс", + }, + AccessCode: { + Title: "Код доступа", + SubTitle: "Контроль доступа включен", + Placeholder: "Требуется код доступа", + }, + Model: "Модель", + Temperature: { + Title: "Температура", + SubTitle: "Чем выше значение, тем более случайный вывод", + }, + MaxTokens: { + Title: "Максимальное количество токенов", + SubTitle: "Максимальная длина вводных и генерируемых токенов", + }, + PresencePenlty: { + Title: "Штраф за повторения", + SubTitle: + "Чем выше значение, тем больше вероятность общения на новые темы", + }, + }, + Store: { + DefaultTopic: "Новый разговор", + BotHello: "Здравствуйте! Как я могу вам помочь сегодня?", + Error: "Что-то пошло не так. Пожалуйста, попробуйте еще раз позже.", + Prompt: { + History: (content: string) => + "Это краткое содержание истории чата между ИИ и пользователем: " + + content, + Topic: + "Пожалуйста, создайте заголовок из четырех или пяти слов, который кратко описывает нашу беседу, без введения, знаков пунктуации, кавычек, точек, символов или дополнительного текста. Удалите кавычки.", + Summarize: + "Кратко изложите нашу дискуссию в 200 словах или менее для использования в будущем контексте.", + }, + }, + Copy: { + Success: "Скопировано в буфер обмена", + Failed: "Не удалось скопировать, пожалуйста, предоставьте разрешение на доступ к буферу обмена", + }, + Context: { + Toast: (x: any) => `С ${x} контекстными подсказками`, + Edit: "Контекстные и памятные подсказки", + Add: "Добавить подсказку", + }, + Plugin: { + Name: "Плагин", + }, + Mask: { + Name: "Маска", + Page: { + Title: "Шаблон подсказки", + SubTitle: (count: number) => `${count} шаблонов подсказок`, + Search: "Поиск шаблонов", + Create: "Создать", + }, + Item: { + Info: (count: number) => `${count} подсказок`, + Chat: "Чат", + View: "Просмотр", + Edit: "Редактировать", + Delete: "Удалить", + DeleteConfirm: "Подтвердить удаление?", + }, + EditModal: { + Title: (readonly: boolean) => + `Редактирование шаблона подсказки ${readonly ? "(только для чтения)" : ""}`, + Download: "Скачать", + Clone: "Клонировать", + }, + Config: { + Avatar: "Аватар бота", + Name: "Имя бота", + }, + }, + NewChat: { + Return: "Вернуться", + Skip: "Пропустить", + Title: "Выберите маску", + SubTitle: "Общайтесь с душой за маской", + More: "Найти еще", + NotShow: "Не показывать снова", + ConfirmNoShow: "Подтвердите отключение? Вы можете включить это позже в настройках.", + }, + + UI: { + Confirm: "Подтвердить", + Cancel: "Отмена", + Close: "Закрыть", + Create: "Создать", + Edit: "Редактировать", + }, +}; + +export default ru; diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 6793beb95..80d2bae71 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -70,7 +70,7 @@ const tr: LocaleType = { }, Lang: { Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` - All: "All Languages", + All: "Tüm Diller", Options: { cn: "简体中文", en: "English", @@ -81,6 +81,7 @@ const tr: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Avatar", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index c541e9724..ba54e8356 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -67,7 +67,7 @@ const tw: LocaleType = { ConfirmClearAll: "您確定要清除所有数据嗎?", }, Lang: { - Name: "Language", + Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` All: "所有语言", Options: { cn: "简体中文", @@ -79,6 +79,7 @@ const tw: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "大頭貼", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 66d4a4d58..516f57927 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -81,6 +81,7 @@ const vi: LocaleType = { jp: "日本語", de: "Deutsch", vi: "Vietnamese", + ru: "Русский", }, }, Avatar: "Ảnh đại diện", From db9084b0dccb9efe1bd5f6e9d11256a8820b5b24 Mon Sep 17 00:00:00 2001 From: Petr Branberger <51099204+pBrambi@users.noreply.github.com> Date: Wed, 10 May 2023 12:39:33 +0200 Subject: [PATCH 19/37] Fix redefined "DE" in /index.ts --- app/locales/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/locales/index.ts b/app/locales/index.ts index eee172a23..b38afc046 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -6,7 +6,7 @@ import IT from "./it"; import TR from "./tr"; import JP from "./jp"; import DE from "./de"; -import DE from "./cs"; +import CS from "./cs"; export type { LocaleType } from "./cn"; From 736869454bb5a614a2b5360b928bf403363527d5 Mon Sep 17 00:00:00 2001 From: Petr Branberger <51099204+pBrambi@users.noreply.github.com> Date: Wed, 10 May 2023 12:50:12 +0200 Subject: [PATCH 20/37] Fix /cs.ts to include the option --- app/locales/cs.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/locales/cs.ts b/app/locales/cs.ts index 9163ae2a6..2b820880e 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -79,6 +79,7 @@ const cs: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + cs: "Čeština", }, }, Avatar: "Avatar", From c4210be3c7a411b750a7dddf5672c9201deda573 Mon Sep 17 00:00:00 2001 From: Petr Branberger <51099204+pBrambi@users.noreply.github.com> Date: Wed, 10 May 2023 15:48:36 +0200 Subject: [PATCH 21/37] Czech language update --- app/locales/cn.ts | 1 + app/locales/cs.ts | 89 ++++++++++++++++++++++++++++++++++++-------- app/locales/de.ts | 1 + app/locales/en.ts | 1 + app/locales/es.ts | 1 + app/locales/index.ts | 3 ++ app/locales/it.ts | 1 + app/locales/jp.ts | 1 + app/locales/ru.ts | 1 + app/locales/tr.ts | 1 + app/locales/tw.ts | 1 + app/locales/vi.ts | 1 + 12 files changed, 87 insertions(+), 15 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index c6f5d67fa..0cf3b55ec 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -80,6 +80,7 @@ const cn = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "头像", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index 2b820880e..0446fb1ef 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -1,4 +1,4 @@ -import { SubmitKey } from "../store/app"; +import { SubmitKey } from "../store/config"; import type { LocaleType } from "./index"; const cs: LocaleType = { @@ -31,6 +31,10 @@ const cs: LocaleType = { return inputHints + ", / pro vyhledávání pokynů"; }, Send: "Odeslat", + Config: { + Reset: "Obnovit výchozí", + SaveAs: "Uložit jako Masku", + }, }, Export: { Title: "Všechny zprávy", @@ -59,18 +63,15 @@ const cs: LocaleType = { SubTitle: "Všechna nastavení", Actions: { ClearAll: "Vymazat všechna data", - ResetAll: "Obnovení všech nastavení", + ResetAll: "Obnovit veškeré nastavení", Close: "Zavřít", - ConfirmResetAll: { - Confirm: "Jste si jisti, že chcete obnovit veškerou konfiguraci?", - }, - ConfirmClearAll: { - Confirm: "Jste si jisti, že chcete obnovit celý chat?", - }, + ConfirmResetAll: "Jste si jisti, že chcete obnovit všechna nastavení?", + ConfirmClearAll: "Jste si jisti, že chcete smazat všechna data?", }, Lang: { Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` - Options: { + All: "Všechny jazyky", + Options: { cn: "简体中文", en: "English", tw: "繁體中文", @@ -79,6 +80,8 @@ const cs: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", + vi: "Vietnamese", + ru: "Русский", cs: "Čeština", }, }, @@ -98,7 +101,14 @@ const cs: LocaleType = { SendKey: "Odeslat klíč", Theme: "Téma", TightBorder: "Těsné ohraničení", - SendPreviewBubble: "Náhled v chatovací bublině", + SendPreviewBubble: { + Title: "Odesílat chatovací bublinu s náhledem", + SubTitle: "Zobrazit v náhledu bubliny", + }, + Mask: { + Title: "Úvodní obrazovka Masek", + SubTitle: "Před zahájením nového chatu zobrazte úvodní obrazovku Masek", + }, Prompt: { Disable: { Title: "Deaktivovat automatické dokončování", @@ -113,6 +123,9 @@ const cs: LocaleType = { Add: "Přidat pokyn", Search: "Hledat pokyny", }, + EditModal: { + Title: "Editovat pokyn", + }, }, HistoryCount: { Title: "Počet připojených zpráv", @@ -131,9 +144,9 @@ const cs: LocaleType = { Usage: { Title: "Stav účtu", SubTitle(used: any, total: any) { - return `Použito tento měsíc $${used}, předplatné $${total}`; + return `Použito tento měsíc $${used}, předplaceno $${total}`; }, - IsChecking: "Kontroluje se...", + IsChecking: "Kontroluji...", Check: "Zkontrolovat", NoAccess: "Pro kontrolu zůstatku zadejte klíč API", }, @@ -169,8 +182,7 @@ const cs: LocaleType = { "Vytvořte prosím název o čtyřech až pěti slovech vystihující průběh našeho rozhovoru bez jakýchkoli úvodních slov, interpunkčních znamének, uvozovek, teček, symbolů nebo dalšího textu. Odstraňte uvozovky.", Summarize: "Krátce shrň naši diskusi v rozsahu do 200 slov a použij ji jako podnět pro budoucí kontext.", - }, - ConfirmClearAll: "Potvrďte pro vymazání všech dat chatu a nastavení?", + }, }, Copy: { Success: "Zkopírováno do schránky", @@ -179,7 +191,54 @@ const cs: LocaleType = { Context: { Toast: (x: any) => `Použití ${x} kontextových pokynů`, Edit: "Kontextové a paměťové pokyny", - Add: "Přidat", + Add: "Přidat pokyn", + }, + Plugin: { + Name: "Plugin", + }, + Mask: { + Name: "Maska", + Page: { + Title: "Šablona pokynu"", + SubTitle: (count: number) => `${count} šablon pokynů`, + Search: "Hledat v šablonách", + Create: "Vytvořit", + }, + Item: { + Info: (count: number) => `${count} pokynů`, + Chat: "Chat", + View: "Zobrazit", + Edit: "Upravit", + Delete: "Smazat", + DeleteConfirm: "Potvrdit smazání?", + }, + EditModal: { + Title: (readonly: boolean) => + `Editovat šablonu pokynu ${readonly ? "(pouze ke čtení)" : ""}`, + Download: "Stáhnout", + Clone: "Duplikovat", + }, + Config: { + Avatar: "Avatar Bota", + Name: "Jméno Bota", + }, + }, + NewChat: { + Return: "Zpět", + Skip: "Přeskočit", + Title: "Vyberte Masku", + SubTitle: "Chatovat s duší za Maskou", + More: "Najít více", + NotShow: "Nezobrazovat znovu", + ConfirmNoShow: "Potvrdit zakázání?Můžete jej povolit později v nastavení.", +}, + + UI: { + Confirm: "Potvrdit", + Cancel: "Zrušit", + Close: "Zavřít", + Create: "Vytvořit", + Edit: "Upravit", }, }; diff --git a/app/locales/de.ts b/app/locales/de.ts index 7c0b94db6..8cfe3be45 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -83,6 +83,7 @@ const de: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/en.ts b/app/locales/en.ts index ba6482574..420f16905 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -82,6 +82,7 @@ const en: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/es.ts b/app/locales/es.ts index 9997752e8..5f66071ce 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -82,6 +82,7 @@ const es: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/index.ts b/app/locales/index.ts index 757c1719d..e41dfcdf7 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -8,6 +8,7 @@ import JP from "./jp"; import DE from "./de"; import VI from "./vi"; import RU from "./ru"; +import CS from "./cs"; export type { LocaleType } from "./cn"; @@ -22,6 +23,7 @@ export const AllLangs = [ "de", "vi", "ru", + "cs", ] as const; export type Lang = (typeof AllLangs)[number]; @@ -85,4 +87,5 @@ export default { de: DE, vi: VI, ru: RU, + cs: CS, }[getLang()] as typeof CN; diff --git a/app/locales/it.ts b/app/locales/it.ts index ddb85c948..f9daa7a37 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -82,6 +82,7 @@ const it: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index d34ee68a6..526574b30 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -82,6 +82,7 @@ const jp: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "アバター", diff --git a/app/locales/ru.ts b/app/locales/ru.ts index dc0b149be..437a54b2b 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -82,6 +82,7 @@ const ru: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Аватар", diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 80d2bae71..42c3f78eb 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -82,6 +82,7 @@ const tr: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Avatar", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index ba54e8356..a8dbf91a5 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -80,6 +80,7 @@ const tw: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "大頭貼", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 516f57927..d3be61058 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -82,6 +82,7 @@ const vi: LocaleType = { de: "Deutsch", vi: "Vietnamese", ru: "Русский", + cs: "Čeština", }, }, Avatar: "Ảnh đại diện", From 960aa90c32fa9c1355ab0543f100e81bf508d54e Mon Sep 17 00:00:00 2001 From: PaRaD1SE98 Date: Wed, 10 May 2023 14:09:30 +0000 Subject: [PATCH 22/37] =?UTF-8?q?=E4=BC=98=E5=8C=96Select=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/ui-lib.module.scss | 2 +- app/components/ui-lib.tsx | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/components/ui-lib.module.scss b/app/components/ui-lib.module.scss index 6296c9085..e0806d22a 100644 --- a/app/components/ui-lib.module.scss +++ b/app/components/ui-lib.module.scss @@ -209,6 +209,7 @@ max-width: fit-content; .select-with-icon-select { + height: 100%; border: var(--border-in-light); padding: 10px 25px 10px 10px; border-radius: 10px; @@ -217,7 +218,6 @@ background-color: var(--white); color: var(--black); text-align: center; - position: relative; } .select-with-icon-icon { diff --git a/app/components/ui-lib.tsx b/app/components/ui-lib.tsx index 935f0f931..5687b1c5f 100644 --- a/app/components/ui-lib.tsx +++ b/app/components/ui-lib.tsx @@ -254,11 +254,8 @@ export function Select( ) { const { className, children, ...otherProps } = props; return ( -
- {children} From c87eee1fdaecc725844d1df81f9cef18e9c6f3cc Mon Sep 17 00:00:00 2001 From: Petr Branberger <51099204+pBrambi@users.noreply.github.com> Date: Wed, 10 May 2023 16:33:22 +0200 Subject: [PATCH 23/37] Fixed typo syntax error --- app/locales/cs.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/locales/cs.ts b/app/locales/cs.ts index 0446fb1ef..ab9b39a53 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -199,7 +199,7 @@ const cs: LocaleType = { Mask: { Name: "Maska", Page: { - Title: "Šablona pokynu"", + Title: "Šablona pokynu", SubTitle: (count: number) => `${count} šablon pokynů`, Search: "Hledat v šablonách", Create: "Vytvořit", @@ -239,7 +239,7 @@ const cs: LocaleType = { Close: "Zavřít", Create: "Vytvořit", Edit: "Upravit", - }, + } }; export default cs; From cbb50c14e1fd8513d3b89cf958a12e5499a1cd01 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Thu, 11 May 2023 15:42:32 +0800 Subject: [PATCH 24/37] fix: bug #1413 input '/' when clicking icon to open prompt modal --- app/components/chat.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 54def01cf..d47673116 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -790,6 +790,7 @@ export function Chat() { hitBottom={hitBottom} showPromptHints={() => { inputRef.current?.focus(); + setUserInput("/"); onSearch(""); }} /> From 7bf74c6a5d07e5746a1299b61a3cac1bd08ec416 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Thu, 11 May 2023 16:08:34 +0800 Subject: [PATCH 25/37] fix: bug #1413 cmd/alt/ctrl should be checked for arrowUp events --- app/components/chat.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index d47673116..10f7c0025 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -230,7 +230,9 @@ export function PromptHints(props: { useEffect(() => { const onKeyDown = (e: KeyboardEvent) => { if (noPrompts) return; - + if (e.metaKey || e.altKey || e.ctrlKey) { + return; + } // arrow up / down to select prompt const changeIndex = (delta: number) => { e.stopPropagation(); @@ -491,7 +493,11 @@ export function Chat() { // check if should send message const onInputKeyDown = (e: React.KeyboardEvent) => { // if ArrowUp and no userInput, fill with last input - if (e.key === "ArrowUp" && userInput.length <= 0) { + if ( + e.key === "ArrowUp" && + userInput.length <= 0 && + !(e.metaKey || e.altKey || e.ctrlKey) + ) { setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? ""); e.preventDefault(); return; From ec19b86ade04857bf339b26c853f27b0ba2688a8 Mon Sep 17 00:00:00 2001 From: liyuze Date: Thu, 11 May 2023 18:29:25 +0800 Subject: [PATCH 26/37] fix: click the prompt button to hide hints when it's already shown --- app/components/chat.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 54def01cf..9363966c1 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -789,6 +789,12 @@ export function Chat() { scrollToBottom={scrollToBottom} hitBottom={hitBottom} showPromptHints={() => { + // Click again to close + if (promptHints.length > 0) { + setPromptHints([]); + return; + } + inputRef.current?.focus(); onSearch(""); }} From 36adfe87fb965120a208df907a609ec235437d06 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Thu, 11 May 2023 23:21:16 +0800 Subject: [PATCH 27/37] fix: #1401 try to disable zoom --- app/layout.tsx | 7 ++++--- app/requests.ts | 2 +- app/store/access.ts | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index c56341ab4..f2e765ae0 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -13,7 +13,7 @@ export const metadata = { title: "ChatGPT Next Web", statusBarStyle: "default", }, - themeColor: "#fafafa", + viewport: "width=device-width, initial-scale=1, maximum-scale=1", }; export default function RootLayout({ @@ -25,8 +25,9 @@ export default function RootLayout({ = {}; diff --git a/app/store/access.ts b/app/store/access.ts index 79b7b9900..4e870b616 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -1,6 +1,7 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; import { StoreKey } from "../constant"; +import { getHeaders } from "../requests"; import { BOT_HELLO } from "./chat"; import { ALL_MODELS } from "./config"; @@ -55,6 +56,9 @@ export const useAccessStore = create()( fetch("/api/config", { method: "post", body: null, + headers: { + ...getHeaders(), + }, }) .then((res) => res.json()) .then((res: DangerConfig) => { From 377579e80278fcad9135d500cf30f3d5f13cc117 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 12 May 2023 17:19:40 +0800 Subject: [PATCH 28/37] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 90ed7d42f..b36f4a4a7 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,7 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s [@jhansion](https://github.com/jhansion) [@Sha1rholder](https://github.com/Sha1rholder) [@AnsonHyq](https://github.com/AnsonHyq) +[@synwith](https://github.com/synwith) ### Contributor From 93c9974019002b57d8184c23d70f68390be316c0 Mon Sep 17 00:00:00 2001 From: wsw <944627549@qq.com> Date: Fri, 12 May 2023 17:54:40 +0800 Subject: [PATCH 29/37] feat: scrolling effect when switching chat windows --- app/components/chat-list.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 02ea086b2..c1365182c 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -16,6 +16,7 @@ import { Link, useNavigate } from "react-router-dom"; import { Path } from "../constant"; import { MaskAvatar } from "./mask"; import { Mask } from "../store/mask"; +import { useRef, useEffect } from "react"; export function ChatItem(props: { onClick?: () => void; @@ -29,6 +30,14 @@ export function ChatItem(props: { narrow?: boolean; mask: Mask; }) { + const draggableRef = useRef(null); + useEffect(() => { + if (props.selected && draggableRef.current) { + draggableRef.current?.scrollIntoView({ + block: "center", + }); + } + }, [props.selected]); return ( {(provided) => ( @@ -37,7 +46,10 @@ export function ChatItem(props: { props.selected && styles["chat-item-selected"] }`} onClick={props.onClick} - ref={provided.innerRef} + ref={(ele) => { + draggableRef.current = ele; + provided.innerRef(ele); + }} {...provided.draggableProps} {...provided.dragHandleProps} title={`${props.title}\n${Locale.ChatItem.ChatItemCount( From 170936a96ef9b59ac8a95d0201c34ef6d9438644 Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Fri, 12 May 2023 18:47:41 +0800 Subject: [PATCH 30/37] fix: the theme-color selector --- app/components/home.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 4c3d0a646..6b34a5a1b 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -64,17 +64,17 @@ export function useSwitchTheme() { } const metaDescriptionDark = document.querySelector( - 'meta[name="theme-color"][media]', + 'meta[name="theme-color"][media*="dark"]', ); const metaDescriptionLight = document.querySelector( - 'meta[name="theme-color"]:not([media])', + 'meta[name="theme-color"][media*="light"]', ); if (config.theme === "auto") { metaDescriptionDark?.setAttribute("content", "#151515"); metaDescriptionLight?.setAttribute("content", "#fafafa"); } else { - const themeColor = getCSSVar("--themeColor"); + const themeColor = getCSSVar("--theme-color"); metaDescriptionDark?.setAttribute("content", themeColor); metaDescriptionLight?.setAttribute("content", themeColor); } From dd5604f5d9d21a5e10f9d4609072d7f118463072 Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Fri, 12 May 2023 19:23:49 +0800 Subject: [PATCH 31/37] style: move nextjs supported meta tags to metadata --- app/layout.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index f2e765ae0..d08f87e44 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -9,11 +9,19 @@ const buildConfig = getBuildConfig(); export const metadata = { title: "ChatGPT Next Web", description: "Your personal ChatGPT Chat Bot.", + viewport: { + width: "device-width", + initialScale: 1, + maximumScale: 1, + }, + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "#fafafa" }, + { media: "(prefers-color-scheme: dark)", color: "#151515" }, + ], appleWebApp: { title: "ChatGPT Next Web", statusBarStyle: "default", }, - viewport: "width=device-width, initial-scale=1, maximum-scale=1", }; export default function RootLayout({ @@ -24,22 +32,12 @@ export default function RootLayout({ return ( - - From dc3fa6c780797b8b969e6b9b485a97e2f1ce6311 Mon Sep 17 00:00:00 2001 From: PaRaD1SE98 Date: Fri, 12 May 2023 22:46:22 +0900 Subject: [PATCH 32/37] Update settings.tsx fix: typo upater -> updater --- app/components/settings.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 2e08c251e..eb83d8905 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -573,9 +573,9 @@ export function Settings() { { + updateConfig={(updater) => { const modelConfig = { ...config.modelConfig }; - upater(modelConfig); + updater(modelConfig); config.update((config) => (config.modelConfig = modelConfig)); }} /> From a0e192b6e4ed5717e8bcd9ec787a012c73e0a9e2 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Sat, 13 May 2023 07:23:14 +0800 Subject: [PATCH 33/37] fix: show Vitenamese in it's own language --- app/locales/cn.ts | 2 +- app/locales/cs.ts | 15 ++++---- app/locales/de.ts | 2 +- app/locales/en.ts | 2 +- app/locales/es.ts | 2 +- app/locales/it.ts | 2 +- app/locales/jp.ts | 2 +- app/locales/ru.ts | 97 +++++++++++++++++++++++++---------------------- app/locales/tr.ts | 2 +- app/locales/tw.ts | 2 +- app/locales/vi.ts | 4 +- 11 files changed, 68 insertions(+), 64 deletions(-) diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 0cf3b55ec..b955a7d2b 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -78,7 +78,7 @@ const cn = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/cs.ts b/app/locales/cs.ts index ab9b39a53..6d614575e 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -70,8 +70,8 @@ const cs: LocaleType = { }, Lang: { Name: "Language", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` - All: "Všechny jazyky", - Options: { + All: "Všechny jazyky", + Options: { cn: "简体中文", en: "English", tw: "繁體中文", @@ -80,7 +80,7 @@ const cs: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, @@ -166,8 +166,7 @@ const cs: LocaleType = { }, PresencePenlty: { Title: "Přítomnostní korekce", - SubTitle: - "Větší hodnota zvyšuje pravděpodobnost nových témat.", + SubTitle: "Větší hodnota zvyšuje pravděpodobnost nových témat.", }, }, Store: { @@ -182,7 +181,7 @@ const cs: LocaleType = { "Vytvořte prosím název o čtyřech až pěti slovech vystihující průběh našeho rozhovoru bez jakýchkoli úvodních slov, interpunkčních znamének, uvozovek, teček, symbolů nebo dalšího textu. Odstraňte uvozovky.", Summarize: "Krátce shrň naši diskusi v rozsahu do 200 slov a použij ji jako podnět pro budoucí kontext.", - }, + }, }, Copy: { Success: "Zkopírováno do schránky", @@ -231,7 +230,7 @@ const cs: LocaleType = { More: "Najít více", NotShow: "Nezobrazovat znovu", ConfirmNoShow: "Potvrdit zakázání?Můžete jej povolit později v nastavení.", -}, + }, UI: { Confirm: "Potvrdit", @@ -239,7 +238,7 @@ const cs: LocaleType = { Close: "Zavřít", Create: "Vytvořit", Edit: "Upravit", - } + }, }; export default cs; diff --git a/app/locales/de.ts b/app/locales/de.ts index 8cfe3be45..02510070c 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -81,7 +81,7 @@ const de: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/en.ts b/app/locales/en.ts index 420f16905..b17408bd4 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -80,7 +80,7 @@ const en: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/es.ts b/app/locales/es.ts index 5f66071ce..b80faf23c 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -80,7 +80,7 @@ const es: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/it.ts b/app/locales/it.ts index f9daa7a37..e71121662 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -80,7 +80,7 @@ const it: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/jp.ts b/app/locales/jp.ts index 526574b30..dbb9980fe 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -80,7 +80,7 @@ const jp: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/ru.ts b/app/locales/ru.ts index 437a54b2b..6770f5213 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -80,56 +80,57 @@ const ru: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, }, - Avatar: "Аватар", - FontSize: { - Title: "Размер шрифта", - SubTitle: "Настроить размер шрифта контента чата", + Avatar: "Аватар", + FontSize: { + Title: "Размер шрифта", + SubTitle: "Настроить размер шрифта контента чата", + }, + Update: { + Version: (x: string) => `Версия: ${x}`, + IsLatest: "Последняя версия", + CheckUpdate: "Проверить обновление", + IsChecking: "Проверка обновления...", + FoundUpdate: (x: string) => `Найдена новая версия: ${x}`, + GoToUpdate: "Обновить", + }, + SendKey: "Клавиша отправки", + Theme: "Тема", + TightBorder: "Узкая граница", + SendPreviewBubble: { + Title: "Отправить предпросмотр", + SubTitle: "Предварительный просмотр markdown в пузыре", + }, + Mask: { + Title: "Экран заставки маски", + SubTitle: "Показывать экран заставки маски перед началом нового чата", + }, + Prompt: { + Disable: { + Title: "Отключить автозаполнение", + SubTitle: "Ввод / для запуска автозаполнения", }, - Update: { - Version: (x: string) => `Версия: ${x}`, - IsLatest: "Последняя версия", - CheckUpdate: "Проверить обновление", - IsChecking: "Проверка обновления...", - FoundUpdate: (x: string) => `Найдена новая версия: ${x}`, - GoToUpdate: "Обновить", + List: "Список подсказок", + ListCount: (builtin: number, custom: number) => + `${builtin} встроенных, ${custom} пользовательских`, + Edit: "Редактировать", + Modal: { + Title: "Список подсказок", + Add: "Добавить", + Search: "Поиск подсказок", }, - SendKey: "Клавиша отправки", - Theme: "Тема", - TightBorder: "Узкая граница", - SendPreviewBubble: { - Title: "Отправить предпросмотр", - SubTitle: "Предварительный просмотр markdown в пузыре", + EditModal: { + Title: "Редактировать подсказку", }, - Mask: { - Title: "Экран заставки маски", - SubTitle: "Показывать экран заставки маски перед началом нового чата", - }, - Prompt: { - Disable: { - Title: "Отключить автозаполнение", - SubTitle: "Ввод / для запуска автозаполнения", - }, - List: "Список подсказок", - ListCount: (builtin: number, custom: number) => - `${builtin} встроенных, ${custom} пользовательских`, - Edit: "Редактировать", - Modal: { - Title: "Список подсказок", - Add: "Добавить", - Search: "Поиск подсказок", - }, - EditModal: { - Title: "Редактировать подсказку", - }, - }, - HistoryCount: { - Title: "Количество прикрепляемых сообщений", - SubTitle: "Количество отправляемых сообщений, прикрепляемых к каждому запросу", + }, + HistoryCount: { + Title: "Количество прикрепляемых сообщений", + SubTitle: + "Количество отправляемых сообщений, прикрепляемых к каждому запросу", }, CompressThreshold: { Title: "Порог сжатия истории", @@ -186,7 +187,8 @@ const ru: LocaleType = { }, Copy: { Success: "Скопировано в буфер обмена", - Failed: "Не удалось скопировать, пожалуйста, предоставьте разрешение на доступ к буферу обмена", + Failed: + "Не удалось скопировать, пожалуйста, предоставьте разрешение на доступ к буферу обмена", }, Context: { Toast: (x: any) => `С ${x} контекстными подсказками`, @@ -214,7 +216,9 @@ const ru: LocaleType = { }, EditModal: { Title: (readonly: boolean) => - `Редактирование шаблона подсказки ${readonly ? "(только для чтения)" : ""}`, + `Редактирование шаблона подсказки ${ + readonly ? "(только для чтения)" : "" + }`, Download: "Скачать", Clone: "Клонировать", }, @@ -230,7 +234,8 @@ const ru: LocaleType = { SubTitle: "Общайтесь с душой за маской", More: "Найти еще", NotShow: "Не показывать снова", - ConfirmNoShow: "Подтвердите отключение? Вы можете включить это позже в настройках.", + ConfirmNoShow: + "Подтвердите отключение? Вы можете включить это позже в настройках.", }, UI: { diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 42c3f78eb..e27f28580 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -80,7 +80,7 @@ const tr: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/tw.ts b/app/locales/tw.ts index a8dbf91a5..e115a0f6a 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -78,7 +78,7 @@ const tw: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, diff --git a/app/locales/vi.ts b/app/locales/vi.ts index d3be61058..9568a125a 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -2,7 +2,7 @@ import { SubmitKey } from "../store/config"; import type { LocaleType } from "./index"; const vi: LocaleType = { - WIP: "Coming Soon...", + WIP: "Sắp ra mắt...", Error: { Unauthorized: "Truy cập chưa xác thực, vui lòng nhập mã truy cập trong trang cài đặt.", @@ -80,7 +80,7 @@ const vi: LocaleType = { tr: "Türkçe", jp: "日本語", de: "Deutsch", - vi: "Vietnamese", + vi: "Tiếng Việt", ru: "Русский", cs: "Čeština", }, From f07e4fc87fe7a53a0d0b18f3c2a07c653014e5d9 Mon Sep 17 00:00:00 2001 From: "ShengYan, Zhang" Date: Sat, 13 May 2023 09:02:15 +0800 Subject: [PATCH 34/37] docs: add supported languages to README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b36f4a4a7..a3c10a339 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel. - New in v2: create, share and debug your chat tools with prompt templates (mask) - Awesome prompts powered by [awesome-chatgpt-prompts-zh](https://github.com/PlexPt/awesome-chatgpt-prompts-zh) and [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) - Automatically compresses chat history to support long conversations while also saving your tokens -- I18n: English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch +- I18n: English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch, Tiếng Việt, Русский, Čeština ## Roadmap @@ -62,7 +62,7 @@ One-Click to deploy well-designed ChatGPT web UI on Vercel. - 预制角色功能(面具),方便地创建、分享和调试你的个性化对话 - 海量的内置 prompt 列表,来自[中文](https://github.com/PlexPt/awesome-chatgpt-prompts-zh)和[英文](https://github.com/f/awesome-chatgpt-prompts) - 自动压缩上下文聊天记录,在节省 Token 的同时支持超长对话 -- 多国语言支持:English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch +- 多国语言支持:English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch, Tiếng Việt, Русский, Čeština - 拥有自己的域名?好上加好,绑定后即可在任何地方**无障碍**快速访问 ## 开发计划 From 5b9b120fa6d7823976ff68dd6147a7e002aa7c42 Mon Sep 17 00:00:00 2001 From: InitialXKO <45725592+InitialXKO@users.noreply.github.com> Date: Sat, 13 May 2023 09:36:04 +0800 Subject: [PATCH 35/37] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E7=94=9F?= =?UTF-8?q?=E5=9B=BE=E9=9D=A2=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/masks/cn.ts | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/app/masks/cn.ts b/app/masks/cn.ts index 757a35ee9..86af414bb 100644 --- a/app/masks/cn.ts +++ b/app/masks/cn.ts @@ -1,6 +1,38 @@ import { BuiltinMask } from "./typing"; -export const CN_MASKS: BuiltinMask[] = [ +export const CN_MASKS: BuiltinMask[] = [{ + avatar:"gpt-bot", + name:"文生图", + context: [ + {role:"system", + content:"You are a useful Assistant that won't refuse to draw picture, instead, you will output specific markdown code for picture description, but don't use code block.", + date:"", + }, + {role:"user", + content:"Can you draw some pictures for me?", + date:"", + }, + {role:"assistant", + content:"Sure, what do you want me to draw?", + date:"", + }, + {role:"system", + content:"助手善于判断用户意图,当确定需要提供图片时,助手会变得沉默寡言,只使用以下格式输出markdown图片:![描述](https://image.pollinations.ai/prompt/描述),因为这个语法可以自动按照提示生成并渲染图片。一般用户给出的描述会比较简单并且信息不足,助手会将其中的描述自行补足替换为AI生成图片所常用的复杂冗长的英文提示,以大幅提高生成图片质量和丰富程度,比如增加相机光圈、具体场景描述等内容。助手会避免用代码块或原始块包围markdown标记,因为那样只会渲染出代码块或原始块而不是图片。", + date:"", + }, + ], + modelConfig:{ + model:"gpt-3.5-turbo", + temperature:1, + max_tokens:2000, + presence_penalty:0, + sendMemory:true, + historyMessageCount:32, + compressMessageLengthThreshold:1000, + }, + lang:"cn", + builtin:true, + }, { avatar: "1f638", name: "文案写手", From a9f000e7ef7f0713d474f4e8a8801ce4ee7bc19f Mon Sep 17 00:00:00 2001 From: PaRaD1SE98 Date: Sun, 14 May 2023 01:24:20 +0900 Subject: [PATCH 36/37] remove error messages in toBeSummarizedMsgs --- app/store/chat.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index cb11087d4..b8cdecb60 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -423,7 +423,10 @@ export const useChatStore = create()( let toBeSummarizedMsgs = session.messages.slice( session.lastSummarizeIndex, ); - + + // remove error messages if any + toBeSummarizedMsgs = toBeSummarizedMsgs.filter((msg) => !msg.isError); + const historyMsgLength = countMessages(toBeSummarizedMsgs); if (historyMsgLength > modelConfig?.max_tokens ?? 4000) { From ff2589c97f00abe30d389cc5e71a6b63c561a6c1 Mon Sep 17 00:00:00 2001 From: PaRaD1SE98 Date: Sun, 14 May 2023 02:34:32 +0900 Subject: [PATCH 37/37] remove error messages for chat title summary --- app/store/chat.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index b8cdecb60..d9a4af781 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -402,14 +402,17 @@ export const useChatStore = create()( summarizeSession() { const session = get().currentSession(); + + // remove error messages if any + const cleanMessages = session.messages.filter((msg) => !msg.isError); // should summarize topic after chating more than 50 words const SUMMARIZE_MIN_LEN = 50; if ( session.topic === DEFAULT_TOPIC && - countMessages(session.messages) >= SUMMARIZE_MIN_LEN + countMessages(cleanMessages) >= SUMMARIZE_MIN_LEN ) { - requestWithPrompt(session.messages, Locale.Store.Prompt.Topic, { + requestWithPrompt(cleanMessages, Locale.Store.Prompt.Topic, { model: "gpt-3.5-turbo", }).then((res) => { get().updateCurrentSession( @@ -420,12 +423,9 @@ export const useChatStore = create()( } const modelConfig = session.mask.modelConfig; - let toBeSummarizedMsgs = session.messages.slice( + let toBeSummarizedMsgs = cleanMessages.slice( session.lastSummarizeIndex, ); - - // remove error messages if any - toBeSummarizedMsgs = toBeSummarizedMsgs.filter((msg) => !msg.isError); const historyMsgLength = countMessages(toBeSummarizedMsgs);