From 0c9add79884156e778863849bba95dd50c2b5fb0 Mon Sep 17 00:00:00 2001 From: GOWxx Date: Thu, 30 Mar 2023 18:50:58 +0800 Subject: [PATCH 01/20] feat: support history message count to zero --- app/components/settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 43d14fc47..f1de4d739 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -375,7 +375,7 @@ export function Settings(props: { closeSettings: () => void }) { type="range" title={config.historyMessageCount.toString()} value={config.historyMessageCount} - min="2" + min="0" max="25" step="2" onChange={(e) => From dea3d26335a8303daf97a476f9139202f7f3b00b Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 15:20:19 +0000 Subject: [PATCH 02/20] fix: crash caused by filter config --- app/store/app.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/store/app.ts b/app/store/app.ts index 118e9ed6c..6ab3229ac 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -89,7 +89,9 @@ export function isValidNumber(x: number, min: number, max: number) { return typeof x === "number" && x <= max && x >= min; } -export function filterConfig(config: ModelConfig): Partial { +export function filterConfig(oldConfig: ModelConfig): Partial { + const config = Object.assign({}, oldConfig); + const validator: { [k in keyof ModelConfig]: (x: ModelConfig[keyof ModelConfig]) => boolean; } = { @@ -103,7 +105,7 @@ export function filterConfig(config: ModelConfig): Partial { return isValidNumber(x as number, -2, 2); }, temperature(x) { - return isValidNumber(x as number, 0, 1); + return isValidNumber(x as number, 0, 2); }, }; From 7827b40f1798b65d84d3f59d351d35d55784e89a Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 15:25:38 +0000 Subject: [PATCH 03/20] fix: #185 input and select align center --- app/styles/globals.scss | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/styles/globals.scss b/app/styles/globals.scss index b4b25b5cd..d63c7d115 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -87,7 +87,7 @@ body { align-items: center; user-select: none; font-family: "Noto Sans SC", "SF Pro SC", "SF Pro Text", "SF Pro Icons", - "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif; + "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif; @media only screen and (max-width: 600px) { background-color: var(--second); @@ -119,6 +119,11 @@ select { cursor: pointer; background-color: var(--white); color: var(--black); + text-align: center; +} + +input { + text-align: center; } input[type="checkbox"] { From 7599ae385be260c10a3e6b784c22484b636c8576 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 15:42:54 +0000 Subject: [PATCH 04/20] fix: #244 better scroll ux --- app/components/home.tsx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index da65b1d63..6af3af13c 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -102,7 +102,7 @@ export function ChatList() { state.currentSessionIndex, state.selectSession, state.removeSession, - ] + ], ); return ( @@ -196,7 +196,7 @@ export function Chat(props: { setPromptHints(promptStore.search(text)); }, 100, - { leading: true, trailing: true } + { leading: true, trailing: true }, ); const onPromptSelect = (prompt: Prompt) => { @@ -210,7 +210,7 @@ export function Chat(props: { if (!dom) return; const paddingBottomNum: number = parseInt( window.getComputedStyle(dom).paddingBottom, - 10 + 10, ); dom.scrollTop = dom.scrollHeight - dom.offsetHeight + paddingBottomNum; }; @@ -300,7 +300,7 @@ export function Chat(props: { preview: true, }, ] - : [] + : [], ) .concat( userInput.length > 0 @@ -312,14 +312,24 @@ export function Chat(props: { preview: true, }, ] - : [] + : [], ); // auto scroll useLayoutEffect(() => { setTimeout(() => { const dom = latestMessageRef.current; - if (dom && !isIOS() && autoScroll) { + const inputDom = inputRef.current; + + // only scroll when input overlaped message body + let shouldScroll = true; + if (dom && inputDom) { + const domRect = dom.getBoundingClientRect(); + const inputRect = inputDom.getBoundingClientRect(); + shouldScroll = domRect.top > inputRect.top; + } + + if (dom && autoScroll && shouldScroll) { dom.scrollIntoView({ block: "end", }); @@ -340,7 +350,7 @@ export function Chat(props: { const newTopic = prompt(Locale.Chat.Rename, session.topic); if (newTopic && newTopic !== session.topic) { chatStore.updateCurrentSession( - (session) => (session.topic = newTopic!) + (session) => (session.topic = newTopic!), ); } }} @@ -586,7 +596,7 @@ export function Home() { state.newSession, state.currentSessionIndex, state.removeSession, - ] + ], ); const loading = !useHasHydrated(); const [showSideBar, setShowSideBar] = useState(true); From bf50ebac945ea31113dadb7ac9118929897dc4ef Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 15:50:08 +0000 Subject: [PATCH 05/20] fix: #229 disable light code theme --- app/styles/prism.scss | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/app/styles/prism.scss b/app/styles/prism.scss index 0d011ce0e..65ee8b5fc 100644 --- a/app/styles/prism.scss +++ b/app/styles/prism.scss @@ -120,33 +120,3 @@ cursor: help; } } - -@mixin light { - .markdown-body pre { - filter: invert(1) hue-rotate(90deg) brightness(1.3); - } -} - -@mixin dark { - .markdown-body pre { - filter: none; - } -} - -:root { - @include light(); -} - -.light { - @include light(); -} - -.dark { - @include dark(); -} - -@media (prefers-color-scheme: dark) { - :root { - @include dark(); - } -} From 1b140a1ed33f2fa35dbd4551563a29cb6aa9d155 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 16:20:47 +0000 Subject: [PATCH 06/20] fix: tight border on mobile style --- app/components/home.module.scss | 6 +++--- app/components/home.tsx | 12 ++++++++++-- app/components/settings.tsx | 24 +++++++++++------------- app/styles/globals.scss | 7 ++++--- app/utils.ts | 4 ++++ 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/app/components/home.module.scss b/app/components/home.module.scss index 87231feee..cef1662b5 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -26,13 +26,13 @@ @media only screen and (min-width: 600px) { .tight-container { --window-width: 100vw; - --window-height: 100vh; + --window-height: var(--full-height); --window-content-width: calc(100% - var(--sidebar-width)); @include container(); max-width: 100vw; - max-height: 100vh; + max-height: var(--full-height); border-radius: 0; } @@ -74,7 +74,7 @@ position: absolute; left: -100%; z-index: 999; - height: 100vh; + height: var(--full-height); transition: all ease 0.3s; box-shadow: none; } diff --git a/app/components/home.tsx b/app/components/home.tsx index 6af3af13c..5494bdcee 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -23,7 +23,13 @@ import DownloadIcon from "../icons/download.svg"; import { Message, SubmitKey, useChatStore, ChatSession } from "../store"; import { showModal, showToast } from "./ui-lib"; -import { copyToClipboard, downloadAs, isIOS, selectOrCopy } from "../utils"; +import { + copyToClipboard, + downloadAs, + isIOS, + isMobileScreen, + selectOrCopy, +} from "../utils"; import Locale from "../locales"; import dynamic from "next/dynamic"; @@ -614,7 +620,9 @@ export function Home() { return (
void }) { > -
- - - updateConfig( - (config) => (config.tightBorder = e.currentTarget.checked), - ) - } - > - -
+ + + updateConfig( + (config) => (config.tightBorder = e.currentTarget.checked), + ) + } + > + Date: Thu, 30 Mar 2023 16:46:17 +0000 Subject: [PATCH 07/20] feat: use tag as version number --- app/components/settings.tsx | 4 ++-- app/constant.ts | 1 + app/layout.tsx | 8 ++++---- app/store/update.ts | 20 ++++++++++---------- app/utils.ts | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/components/settings.tsx b/app/components/settings.tsx index a426afcdc..703f5ab78 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -23,7 +23,7 @@ import { import { Avatar, PromptHints } from "./home"; import Locale, { AllLangs, changeLang, getLang } from "../locales"; -import { getCurrentCommitId } from "../utils"; +import { getCurrentVersion } from "../utils"; import Link from "next/link"; import { UPDATE_URL } from "../constant"; import { SearchService, usePromptStore } from "../store/prompt"; @@ -60,7 +60,7 @@ export function Settings(props: { closeSettings: () => void }) { const updateStore = useUpdateStore(); const [checkingUpdate, setCheckingUpdate] = useState(false); - const currentId = getCurrentCommitId(); + const currentId = getCurrentVersion(); const remoteId = updateStore.remoteId; const hasNewVersion = currentId !== remoteId; diff --git a/app/constant.ts b/app/constant.ts index 818ef1fbe..fff77607e 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -3,3 +3,4 @@ export const REPO = "ChatGPT-Next-Web"; export const REPO_URL = `https://github.com/${OWNER}/${REPO}`; export const UPDATE_URL = `${REPO_URL}#%E4%BF%9D%E6%8C%81%E6%9B%B4%E6%96%B0-keep-updated`; export const FETCH_COMMIT_URL = `https://api.github.com/repos/${OWNER}/${REPO}/commits?per_page=1`; +export const FETCH_TAG_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=1`; diff --git a/app/layout.tsx b/app/layout.tsx index 3a4140460..cc8e45de3 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -8,11 +8,11 @@ import { ACCESS_CODES, IS_IN_DOCKER } from "./api/access"; let COMMIT_ID: string | undefined; try { COMMIT_ID = process - .execSync("git rev-parse --short HEAD") + .execSync("git describe --tags --abbrev=0") .toString() .trim(); } catch (e) { - console.error("No git or not from git repo.") + console.error("No git or not from git repo."); } export const metadata = { @@ -22,13 +22,13 @@ export const metadata = { title: "ChatGPT Next Web", statusBarStyle: "black-translucent", }, - themeColor: "#fafafa" + themeColor: "#fafafa", }; function Meta() { const metas = { version: COMMIT_ID ?? "unknown", - access: (ACCESS_CODES.size > 0 || IS_IN_DOCKER) ? "enabled" : "disabled", + access: ACCESS_CODES.size > 0 || IS_IN_DOCKER ? "enabled" : "disabled", }; return ( diff --git a/app/store/update.ts b/app/store/update.ts index 118ea3cea..69f6cfee5 100644 --- a/app/store/update.ts +++ b/app/store/update.ts @@ -1,7 +1,7 @@ import { create } from "zustand"; import { persist } from "zustand/middleware"; -import { FETCH_COMMIT_URL } from "../constant"; -import { getCurrentCommitId } from "../utils"; +import { FETCH_COMMIT_URL, FETCH_TAG_URL } from "../constant"; +import { getCurrentVersion } from "../utils"; export interface UpdateStore { lastUpdate: number; @@ -19,15 +19,15 @@ export const useUpdateStore = create()( remoteId: "", async getLatestCommitId(force = false) { - const overOneHour = Date.now() - get().lastUpdate > 3600 * 1000; - const shouldFetch = force || overOneHour; + const overTenMins = Date.now() - get().lastUpdate > 10 * 60 * 1000; + const shouldFetch = force || overTenMins; if (!shouldFetch) { - return getCurrentCommitId(); + return getCurrentVersion(); } try { - const data = await (await fetch(FETCH_COMMIT_URL)).json(); - const sha = data[0].sha as string; + const data = await (await fetch(FETCH_TAG_URL)).json(); + const sha = data[0].name as string; const remoteId = sha.substring(0, 7); set(() => ({ lastUpdate: Date.now(), @@ -37,13 +37,13 @@ export const useUpdateStore = create()( return remoteId; } catch (error) { console.error("[Fetch Upstream Commit Id]", error); - return getCurrentCommitId(); + return getCurrentVersion(); } }, }), { name: UPDATE_KEY, version: 1, - } - ) + }, + ), ); diff --git a/app/utils.ts b/app/utils.ts index 1ff7a064a..64120df4d 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -76,7 +76,7 @@ export function queryMeta(key: string, defaultValue?: string): string { } let currentId: string; -export function getCurrentCommitId() { +export function getCurrentVersion() { if (currentId) { return currentId; } From 802ea20ec4bc4c5cd2acb3a5de2ac4c6a1096694 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 17:04:32 +0000 Subject: [PATCH 08/20] fix: auto scroll on enter --- app/components/home.tsx | 4 +--- app/store/update.ts | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index 5494bdcee..ab9554e5b 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -290,9 +290,7 @@ export function Chat(props: { // for auto-scroll const latestMessageRef = useRef(null); - - // wont scroll while hovering messages - const [autoScroll, setAutoScroll] = useState(false); + const [autoScroll, setAutoScroll] = useState(true); // preview messages const messages = (session.messages as RenderMessage[]) diff --git a/app/store/update.ts b/app/store/update.ts index 69f6cfee5..0699369d0 100644 --- a/app/store/update.ts +++ b/app/store/update.ts @@ -27,8 +27,7 @@ export const useUpdateStore = create()( try { const data = await (await fetch(FETCH_TAG_URL)).json(); - const sha = data[0].name as string; - const remoteId = sha.substring(0, 7); + const remoteId = data[0].name as string; set(() => ({ lastUpdate: Date.now(), remoteId, From b3fdf3efecadf015d04ab4fb8a2f60d58bd4d444 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 17:08:50 +0000 Subject: [PATCH 09/20] fix: #182 prompt cannot be selected --- app/components/home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/home.tsx b/app/components/home.tsx index ab9554e5b..2f09aa273 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -489,7 +489,7 @@ export function Chat(props: { onFocus={() => setAutoScroll(true)} onBlur={() => { setAutoScroll(false); - setTimeout(() => setPromptHints([]), 100); + setTimeout(() => setPromptHints([]), 500); }} autoFocus={!props?.sideBarShowing} /> From e7e39ba56e65e7c359fabbad5fdc67a952889af7 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 17:41:43 +0000 Subject: [PATCH 10/20] fix: docker build --- Dockerfile | 8 ++------ scripts/fetch-prompts.mjs | 8 ++++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index f97618e70..6f7547b21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,9 @@ RUN apk add --no-cache libc6-compat WORKDIR /app -COPY package.json yarn.lock* package-lock.json* ./ +COPY package.json yarn.lock ./ -RUN \ - if [ -f yarn.lock ]; then yarn install --frozen-lockfile --network-timeout 100000; \ - elif [ -f package-lock.json ]; then npm ci; \ - else echo "Lockfile not found." && exit 1; \ - fi +RUN yarn install FROM base AS builder diff --git a/scripts/fetch-prompts.mjs b/scripts/fetch-prompts.mjs index daebfe7a6..3c4801443 100644 --- a/scripts/fetch-prompts.mjs +++ b/scripts/fetch-prompts.mjs @@ -1,10 +1,14 @@ import fetch from "node-fetch"; import fs from "fs/promises"; -const CN_URL = +const RAW_CN_URL = "https://raw.githubusercontent.com/PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json"; -const EN_URL = +const CN_URL = + "https://cdn.jsdelivr.net/gh/PlexPt/awesome-chatgpt-prompts-zh@main/prompts-zh.json"; +const RAW_EN_URL = "https://raw.githubusercontent.com/f/awesome-chatgpt-prompts/main/prompts.csv"; +const EN_URL = + "https://cdn.jsdelivr.net/gh/f/awesome-chatgpt-prompts@main/prompts.csv"; const FILE = "./public/prompts.json"; async function fetchCN() { From 83862eae44a3e5658b1209f3975701aa30472caa Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 31 Mar 2023 01:56:42 +0800 Subject: [PATCH 11/20] Update docker.yml --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b7e0de26d..197e2f0db 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -43,10 +43,10 @@ jobs: uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 + platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - \ No newline at end of file + From 2f2e0b6762826cc2bb0ae05b928d0f7d0920bbdd Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 18:15:49 +0000 Subject: [PATCH 12/20] fix: commit id as version id --- app/layout.tsx | 3 ++- app/store/update.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index cc8e45de3..32d3576c5 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -8,7 +8,8 @@ import { ACCESS_CODES, IS_IN_DOCKER } from "./api/access"; let COMMIT_ID: string | undefined; try { COMMIT_ID = process - .execSync("git describe --tags --abbrev=0") + // .execSync("git describe --tags --abbrev=0") + .execSync("git rev-parse --short HEAD") .toString() .trim(); } catch (e) { diff --git a/app/store/update.ts b/app/store/update.ts index 0699369d0..97fb343c3 100644 --- a/app/store/update.ts +++ b/app/store/update.ts @@ -26,8 +26,10 @@ export const useUpdateStore = create()( } try { - const data = await (await fetch(FETCH_TAG_URL)).json(); - const remoteId = data[0].name as string; + // const data = await (await fetch(FETCH_TAG_URL)).json(); + // const remoteId = data[0].name as string; + const data = await (await fetch(FETCH_COMMIT_URL)).json(); + const remoteId = (data[0].sha as string).substring(0, 7); set(() => ({ lastUpdate: Date.now(), remoteId, From df75b9973a92c6e82fbce84b9ac7834006affa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gerardo=20Rond=C3=B3n=20Garc=C3=ADa?= <61068392+DanielRondonGarcia@users.noreply.github.com> Date: Thu, 30 Mar 2023 19:48:57 -0500 Subject: [PATCH 13/20] Update: locales in spanish --- app/locales/cn.ts | 1 + app/locales/en.ts | 1 + app/locales/es.ts | 154 +++++++++++++++++++++++++++++++++++++++++++ app/locales/index.ts | 7 +- app/locales/tw.ts | 1 + 5 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 app/locales/es.ts diff --git a/app/locales/cn.ts b/app/locales/cn.ts index 239da23fa..737ccad45 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -57,6 +57,7 @@ const cn = { cn: "简体中文", en: "English", tw: "繁體中文", + es: "Español", }, }, Avatar: "头像", diff --git a/app/locales/en.ts b/app/locales/en.ts index 296992435..861fcda13 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -59,6 +59,7 @@ const en: LocaleType = { cn: "简体中文", en: "English", tw: "繁體中文", + es: "Español", }, }, Avatar: "Avatar", diff --git a/app/locales/es.ts b/app/locales/es.ts new file mode 100644 index 000000000..1f078b774 --- /dev/null +++ b/app/locales/es.ts @@ -0,0 +1,154 @@ +import { SubmitKey } from "../store/app"; +import type { LocaleType } from "./index"; + +const es: LocaleType = { + WIP: "En construcción...", + Error: { + Unauthorized: + "Acceso no autorizado, por favor ingrese el código de acceso en la página de configuración.", + }, + ChatItem: { + ChatItemCount: (count: number) => `${count} mensajes`, + }, + Chat: { + SubTitle: (count: number) => `${count} mensajes con ChatGPT`, + Actions: { + ChatList: "Ir a la lista de chats", + CompressedHistory: "Historial de memoria comprimido", + Export: "Exportar todos los mensajes como Markdown", + Copy: "Copiar", + Stop: "Detener", + Retry: "Reintentar", + }, + Rename: "Renombrar chat", + Typing: "Escribiendo...", + Input: (submitKey: string) => { + var inputHints = `Escribe algo y presiona ${submitKey} para enviar`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", presiona Shift + Enter para nueva línea"; + } + return inputHints; + }, + Send: "Enviar", + }, + Export: { + Title: "Todos los mensajes", + Copy: "Copiar todo", + Download: "Descargar", + }, + Memory: { + Title: "Historial de memoria", + EmptyContent: "Aún no hay nada.", + Copy: "Copiar todo", + }, + Home: { + NewChat: "Nuevo chat", + DeleteChat: "¿Confirmar eliminación de la conversación seleccionada?", + }, + Settings: { + Title: "Configuración", + SubTitle: "Todas las configuraciones", + Actions: { + ClearAll: "Borrar todos los datos", + ResetAll: "Restablecer todas las configuraciones", + Close: "Cerrar", + }, + Lang: { + Name: "Idioma", + Options: { + cn: "中文简体", + en: "Inglés", + tw: "中文繁體", + es: "Español", + }, + }, + Avatar: "Avatar", + FontSize: { + Title: "Tamaño de fuente", + SubTitle: "Ajustar el tamaño de fuente del contenido del chat", + }, + Update: { + Version: (x: string) => `Versión: ${x}`, + IsLatest: "Última versión", + CheckUpdate: "Buscar actualizaciones", + IsChecking: "Buscando actualizaciones...", + FoundUpdate: (x: string) => `Se encontró una nueva versión: ${x}`, + GoToUpdate: "Actualizar", + }, + SendKey: "Tecla de envío", + Theme: "Tema", + TightBorder: "Borde ajustado", + Prompt: { + Disable: { + Title: "Desactivar autocompletado", + SubTitle: "Escribe / para activar el autocompletado", + }, + List: "Lista de autocompletado", + ListCount: (builtin: number, custom: number) => + `${builtin} incorporado, ${custom} definido por el usuario`, + Edit: "Editar", + }, + HistoryCount: { + Title: "Cantidad de mensajes adjuntos", + SubTitle: "Número de mensajes enviados adjuntos por solicitud", + }, + CompressThreshold: { + Title: "Umbral de compresión de historial", + SubTitle: + "Se comprimirán los mensajes si la longitud de los mensajes no comprimidos supera el valor", + }, + Token: { + Title: "Clave de API", + SubTitle: "Utiliza tu clave para ignorar el límite de código de acceso", + Placeholder: "Clave de la API de OpenAI", + }, + Usage: { + Title: "Saldo de la cuenta", + SubTitle(granted: any, used: any) { + return `Total $${granted}, Usado $${used}`; + }, + IsChecking: "Comprobando...", + Check: "Comprobar de nuevo", + }, + AccessCode: { + Title: "Código de acceso", + SubTitle: "Control de acceso habilitado", + Placeholder: "Necesita código de acceso", + }, + Model: "Modelo", + Temperature: { + Title: "Temperatura", + SubTitle: "Un valor mayor genera una salida más aleatoria", + }, + MaxTokens: { + Title: "Máximo de tokens", + SubTitle: "Longitud máxima de tokens de entrada y tokens generados", + }, + PresencePenlty: { + Title: "Penalización de presencia", + SubTitle: + "Un valor mayor aumenta la probabilidad de hablar sobre nuevos temas", + }, + }, + Store: { + DefaultTopic: "Nueva conversación", + BotHello: "¡Hola! ¿Cómo puedo ayudarte hoy?", + Error: "Algo salió mal, por favor intenta nuevamente más tarde.", + Prompt: { + History: (content: string) => + "Este es un resumen del historial del chat entre la IA y el usuario como recapitulación: " + + content, + Topic: + "Por favor, genera un título de cuatro a cinco palabras que resuma nuestra conversación sin ningún inicio, puntuación, comillas, puntos, símbolos o texto adicional. Elimina las comillas que lo envuelven.", + Summarize: + "Resuma nuestra discusión brevemente en 50 caracteres o menos para usarlo como un recordatorio para futuros contextos.", + }, + ConfirmClearAll: "¿Confirmar para borrar todos los datos de chat y configuración?", + }, + Copy: { + Success: "Copiado al portapapeles", + Failed: "La copia falló, por favor concede permiso para acceder al portapapeles", + }, +}; + +export default es; \ No newline at end of file diff --git a/app/locales/index.ts b/app/locales/index.ts index 5e5d38fe9..eb96408c7 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -1,10 +1,11 @@ import CN from "./cn"; import EN from "./en"; import TW from "./tw"; +import ES from "./es"; export type { LocaleType } from "./cn"; -export const AllLangs = ["en", "cn", "tw"] as const; +export const AllLangs = ["en", "cn", "tw", "es"] as const; type Lang = (typeof AllLangs)[number]; const LANG_KEY = "lang"; @@ -44,6 +45,8 @@ export function getLang(): Lang { return "cn"; } else if (lang.includes("tw")) { return "tw"; + } else if (lang.includes("es")) { + return "es"; } else { return "en"; } @@ -54,4 +57,4 @@ export function changeLang(lang: Lang) { location.reload(); } -export default { en: EN, cn: CN, tw: TW }[getLang()]; +export default { en: EN, cn: CN, tw: TW, es: ES }[getLang()]; \ No newline at end of file diff --git a/app/locales/tw.ts b/app/locales/tw.ts index e63c57a6e..89bde6ca1 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -58,6 +58,7 @@ const tw: LocaleType = { cn: "简体中文", en: "English", tw: "繁體中文", + es: "Español", }, }, Avatar: "大頭貼", From be8a35063cc4df49d727359f619fe02ae5c41379 Mon Sep 17 00:00:00 2001 From: XiaoMiku01 Date: Fri, 31 Mar 2023 10:05:58 +0800 Subject: [PATCH 14/20] add auto sync fork action --- .github/workflows/sync.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 000000000..9914a603a --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,16 @@ +# .github/workflows/sync.yml +name: Sync Fork + +on: + schedule: + - cron: "0 8 * * *" # 每天0点触发 +jobs: + repo-sync: + runs-on: ubuntu-latest + steps: + - uses: TG908/fork-sync@v1.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} # 这个 token action 会默认配置, 这里只需这样写就行 + owner: Yidadaa # fork 上游项目 owner + head: main # fork 上游项目需要同步的分支 + base: main # 需要同步到本项目的目标分支 From 5a910e0f29517610285a368abd322128f1886bbc Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 31 Mar 2023 10:37:33 +0800 Subject: [PATCH 15/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5952aa33a..cd5dcc7a4 100644 --- a/README.md +++ b/README.md @@ -191,4 +191,4 @@ docker run -d -p 3000:3000 -e OPENAI_API_KEY="" -e CODE="" yidadaa/chatgpt-next- ## LICENSE -- [Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN) +[Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN) From 61eb356fd9abe57214e836d60129defcd6374996 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 31 Mar 2023 12:02:14 +0800 Subject: [PATCH 16/20] Update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cd5dcc7a4..d026e61a5 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,17 @@ One-Click to deploy your own ChatGPT web UI. - Automatically compresses chat history to support long conversations while also saving your tokens - One-click export all chat history with full Markdown support -## 使用 +## 开发计划 Roadmap +- System Prompt: pin a user defined prompt as system prompt 为每个对话设置系统 Prompt [#138](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138) +- User Prompt: user can edit and save custom prompts to prompt list 允许用户自行编辑内置 Prompt 列表 +- Self-host Model: support llama, alpaca, ChatGLM, BELLE etc. 支持自部署的大语言模型 +- Plugins: support network search, caculator, any other apis etc. 插件机制,支持联网搜索、计算器、调用其他平台 api [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) + +### 不会开发的功能 Not in Plan +- User login, accounts, cloud sync 用户登陆、账号管理、消息云同步 +- UI text customize 界面文字自定义 + +## 开始使用 1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys); 2. 点击右侧按钮开始部署: From 7f16698f0159eb4262a7a291b477125eb6c56b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gerardo=20Rond=C3=B3n=20Garc=C3=ADa?= <61068392+DanielRondonGarcia@users.noreply.github.com> Date: Thu, 30 Mar 2023 23:32:56 -0500 Subject: [PATCH 17/20] Update: language options to "Language". - Update Name option in language files to display 'Language' consistently - Fix locale issues in 'tw' and 'cn' files that were mistakenly changed --- app/locales/en.ts | 2 +- app/locales/es.ts | 6 +++--- app/locales/tw.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/locales/en.ts b/app/locales/en.ts index 861fcda13..156c03616 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -54,7 +54,7 @@ const en: LocaleType = { Close: "Close", }, Lang: { - Name: "语言", + Name: "Language", Options: { cn: "简体中文", en: "English", diff --git a/app/locales/es.ts b/app/locales/es.ts index 1f078b774..3f7ad1bc7 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -54,11 +54,11 @@ const es: LocaleType = { Close: "Cerrar", }, Lang: { - Name: "Idioma", + Name: "Language", Options: { - cn: "中文简体", + cn: "简体中文", en: "Inglés", - tw: "中文繁體", + tw: "繁體中文", es: "Español", }, }, diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 89bde6ca1..cfba7add5 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -53,7 +53,7 @@ const tw: LocaleType = { Close: "關閉", }, Lang: { - Name: "語言", + Name: "Language", Options: { cn: "简体中文", en: "English", From e5aa72af7688c5b596934ceb7f1f65be96f8cc63 Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Fri, 31 Mar 2023 18:33:26 +0800 Subject: [PATCH 18/20] fix: #277 no cache for credit query --- app/requests.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/requests.ts b/app/requests.ts index d173eb0de..f4db7a1b9 100644 --- a/app/requests.ts +++ b/app/requests.ts @@ -9,7 +9,7 @@ const makeRequestParam = ( options?: { filterBot?: boolean; stream?: boolean; - }, + } ): ChatRequest => { let sendMessages = messages.map((v) => ({ role: v.role, @@ -69,10 +69,9 @@ export async function requestChat(messages: Message[]) { } export async function requestUsage() { - const res = await requestOpenaiClient("dashboard/billing/credit_grants")( - null, - "GET", - ); + const res = await requestOpenaiClient( + "dashboard/billing/credit_grants?_vercel_no_cache=1" + )(null, "GET"); try { const response = (await res.json()) as { @@ -94,7 +93,7 @@ export async function requestChatStream( onMessage: (message: string, done: boolean) => void; onError: (error: Error) => void; onController?: (controller: AbortController) => void; - }, + } ) { const req = makeRequestParam(messages, { stream: true, @@ -189,7 +188,7 @@ export const ControllerPool = { addController( sessionIndex: number, messageIndex: number, - controller: AbortController, + controller: AbortController ) { const key = this.key(sessionIndex, messageIndex); this.controllers[key] = controller; From 5f7a264e52d8369df89842c3c362ff9e338216bf Mon Sep 17 00:00:00 2001 From: Dogtiti <499960698@qq.com> Date: Fri, 31 Mar 2023 19:21:11 +0800 Subject: [PATCH 19/20] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9C=A8?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E6=B5=8F=E8=A7=88=E5=99=A8=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/home.module.scss | 4 ---- app/styles/globals.scss | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/components/home.module.scss b/app/components/home.module.scss index cef1662b5..764805d80 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -218,7 +218,6 @@ flex: 1; overflow: auto; padding: 20px; - margin-bottom: 100px; } .chat-body-title { @@ -342,9 +341,6 @@ } .chat-input-panel { - position: absolute; - bottom: 0px; - display: flex; width: 100%; padding: 20px; box-sizing: border-box; diff --git a/app/styles/globals.scss b/app/styles/globals.scss index c514274ab..6637016a1 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -53,7 +53,7 @@ --sidebar-width: 300px; --window-content-width: calc(100% - var(--sidebar-width)); --message-max-width: 80%; - --full-height: 100vh; + --full-height: 100%; } @media only screen and (max-width: 600px) { @@ -75,6 +75,9 @@ @include dark; } } +html { + height: var(--full-height); +} body { background-color: var(--gray); From 407c9fc9c35392023d82e807792d085a68b71b20 Mon Sep 17 00:00:00 2001 From: hibobmaster <32976627+hibobmaster@users.noreply.github.com> Date: Fri, 31 Mar 2023 23:03:57 +0800 Subject: [PATCH 20/20] Update docker.yml --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 197e2f0db..a7a29644d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,7 +28,7 @@ jobs: images: yidadaa/chatgpt-next-web tags: | type=raw,value=latest - type=semver,pattern={{version}} + type=ref,event=tag - name: Set up QEMU