diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..60da41dd8c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# local env files +.env*.local + +# docker-compose env files +.env + +*.key +*.key.pub \ No newline at end of file diff --git a/.env.template b/.env.template index 0f4bf0e7c00..166cc4ef4e4 100644 --- a/.env.template +++ b/.env.template @@ -8,6 +8,16 @@ CODE=your-password # You can start service behind a proxy PROXY_URL=http://localhost:7890 +# (optional) +# Default: Empty +# Googel Gemini Pro API key, set if you want to use Google Gemini Pro API. +GOOGLE_API_KEY= + +# (optional) +# Default: https://generativelanguage.googleapis.com/ +# Googel Gemini Pro API url without pathname, set if you want to customize Google Gemini Pro API url. +GOOGLE_URL= + # Override openai api request base url. (optional) # Default: https://api.openai.com # Examples: http://your-openai-proxy.com @@ -15,9 +25,13 @@ BASE_URL= # Specify OpenAI organization ID.(optional) # Default: Empty -# If you do not want users to input their own API key, set this value to 1. OPENAI_ORG_ID= +# (optional) +# Default: Empty +# If you do not want users to use GPT-4, set this value to 1. +DISABLE_GPT4= + # (optional) # Default: Empty # If you do not want users to input their own API key, set this value to 1. @@ -25,10 +39,11 @@ HIDE_USER_API_KEY= # (optional) # Default: Empty -# If you do not want users to use GPT-4, set this value to 1. -DISABLE_GPT4= +# If you do want users to query balance, set this value to 1. +ENABLE_BALANCE_QUERY= # (optional) # Default: Empty -# If you do not want users to query balance, set this value to 1. -HIDE_BALANCE_QUERY= \ No newline at end of file +# If you want to disable parse settings from url, set this value to 1. +DISABLE_FAST_LINK= + diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index b928ad6c15f..aebba28f7e2 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -18,7 +18,7 @@ jobs: - name: setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: get version run: echo "PACKAGE_VERSION=$(node -p "require('./src-tauri/tauri.conf.json').package.version")" >> $GITHUB_ENV - name: create release @@ -59,7 +59,7 @@ jobs: - name: setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - name: install Rust stable uses: dtolnay/rust-toolchain@stable with: diff --git a/.github/workflows/deploy_preview.yml b/.github/workflows/deploy_preview.yml new file mode 100644 index 00000000000..02ee0f1923d --- /dev/null +++ b/.github/workflows/deploy_preview.yml @@ -0,0 +1,83 @@ +name: VercelPreviewDeployment + +on: + pull_request_target: + types: + - opened + - synchronize + +env: + VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + VERCEL_PR_DOMAIN_SUFFIX: ${{ secrets.VERCEL_PR_DOMAIN_SUFFIX }} + +permissions: + contents: read + statuses: write + pull-requests: write + +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" + id: extract_branch + + - name: Hash branch name + uses: pplanel/hash-calculator-action@v1.3.1 + id: hash_branch + with: + input: ${{ steps.extract_branch.outputs.branch }} + method: MD5 + + - name: Set Environment Variables + id: set_env + if: github.event_name == 'pull_request_target' + run: | + echo "VERCEL_ALIAS_DOMAIN=${{ github.event.pull_request.number }}-${{ github.workflow }}.${VERCEL_PR_DOMAIN_SUFFIX}" >> $GITHUB_OUTPUT + + - name: Install Vercel CLI + run: npm install --global vercel@latest + + - name: Cache dependencies + uses: actions/cache@v2 + id: cache-npm + with: + path: ~/.npm + key: npm-${{ hashFiles('package-lock.json') }} + restore-keys: npm- + + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${VERCEL_TOKEN} + + - name: Deploy Project Artifacts to Vercel + id: vercel + env: + META_TAG: ${{ steps.hash_branch.outputs.digest }}-${{ github.run_number }}-${{ github.run_attempt}} + run: | + set -e + vercel pull --yes --environment=preview --token=${VERCEL_TOKEN} + vercel build --token=${VERCEL_TOKEN} + vercel deploy --prebuilt --archive=tgz --token=${VERCEL_TOKEN} --meta base_hash=${{ env.META_TAG }} + + DEFAULT_URL=$(vercel ls --token=${VERCEL_TOKEN} --meta base_hash=${{ env.META_TAG }}) + ALIAS_URL=$(vercel alias set ${DEFAULT_URL} ${{ steps.set_env.outputs.VERCEL_ALIAS_DOMAIN }} --token=${VERCEL_TOKEN} --scope ${VERCEL_TEAM}| awk '{print $3}') + + echo "New preview URL: ${DEFAULT_URL}" + echo "New alias URL: ${ALIAS_URL}" + echo "VERCEL_URL=${ALIAS_URL}" >> "$GITHUB_OUTPUT" + + - uses: mshick/add-pr-comment@v2 + with: + message: | + Your build has completed! + + [Preview deployment](${{ steps.vercel.outputs.VERCEL_URL }}) diff --git a/.github/workflows/remove_deploy_preview.yml b/.github/workflows/remove_deploy_preview.yml new file mode 100644 index 00000000000..4846cda2d6a --- /dev/null +++ b/.github/workflows/remove_deploy_preview.yml @@ -0,0 +1,40 @@ +name: Removedeploypreview + +permissions: + contents: read + statuses: write + pull-requests: write + +env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + pull_request_target: + types: + - closed + +jobs: + delete-deployments: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + - name: Hash branch name + uses: pplanel/hash-calculator-action@v1.3.1 + id: hash_branch + with: + input: ${{ steps.extract_branch.outputs.branch }} + method: MD5 + + - name: Call the delete-deployment-preview.sh script + env: + META_TAG: ${{ steps.hash_branch.outputs.digest }} + run: | + bash ./scripts/delete-deployment-preview.sh diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index ebf5587d07c..e04e30adbd6 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -24,7 +24,7 @@ jobs: id: sync uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: - upstream_sync_repo: Yidadaa/ChatGPT-Next-Web + upstream_sync_repo: ChatGPTNextWeb/ChatGPT-Next-Web upstream_sync_branch: main target_sync_branch: main target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set diff --git a/Dockerfile b/Dockerfile index 720a0cfe959..436d39d821d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ FROM base AS builder RUN apk update && apk add --no-cache git ENV OPENAI_API_KEY="" +ENV GOOGLE_API_KEY="" ENV CODE="" WORKDIR /app @@ -31,6 +32,7 @@ RUN apk add proxychains-ng ENV PROXY_URL="" ENV OPENAI_API_KEY="" +ENV GOOGLE_API_KEY="" ENV CODE="" COPY --from=builder /app/public ./public @@ -41,22 +43,22 @@ COPY --from=builder /app/.next/server ./.next/server EXPOSE 3000 CMD if [ -n "$PROXY_URL" ]; then \ - export HOSTNAME="127.0.0.1"; \ - protocol=$(echo $PROXY_URL | cut -d: -f1); \ - host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ - port=$(echo $PROXY_URL | cut -d: -f3); \ - conf=/etc/proxychains.conf; \ - echo "strict_chain" > $conf; \ - echo "proxy_dns" >> $conf; \ - echo "remote_dns_subnet 224" >> $conf; \ - echo "tcp_read_time_out 15000" >> $conf; \ - echo "tcp_connect_time_out 8000" >> $conf; \ - echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \ - echo "localnet ::1/128" >> $conf; \ - echo "[ProxyList]" >> $conf; \ - echo "$protocol $host $port" >> $conf; \ - cat /etc/proxychains.conf; \ - proxychains -f $conf node server.js; \ + export HOSTNAME="127.0.0.1"; \ + protocol=$(echo $PROXY_URL | cut -d: -f1); \ + host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \ + port=$(echo $PROXY_URL | cut -d: -f3); \ + conf=/etc/proxychains.conf; \ + echo "strict_chain" > $conf; \ + echo "proxy_dns" >> $conf; \ + echo "remote_dns_subnet 224" >> $conf; \ + echo "tcp_read_time_out 15000" >> $conf; \ + echo "tcp_connect_time_out 8000" >> $conf; \ + echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \ + echo "localnet ::1/128" >> $conf; \ + echo "[ProxyList]" >> $conf; \ + echo "$protocol $host $port" >> $conf; \ + cat /etc/proxychains.conf; \ + proxychains -f $conf node server.js; \ else \ - node server.js; \ + node server.js; \ fi diff --git a/README.md b/README.md index 07455d00d82..3ac537abca8 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@
-icon +icon -

ChatGPT Next Web

+

NextChat (ChatGPT Next Web)

-English / [简体中文](./README_CN.md) / [日本語](./README_JA.md) +English / [简体中文](./README_CN.md) -One-Click to get well-designed cross-platform ChatGPT web UI. +One-Click to get a well-designed cross-platform ChatGPT web UI, with GPT3, GPT4 & Gemini Pro support. -一键免费部署你的跨平台私人 ChatGPT 应用。 +一键免费部署你的跨平台私人 ChatGPT 应用, 支持 GPT3, GPT4 & Gemini Pro 模型。 [![Web][Web-image]][web-url] [![Windows][Windows-image]][download-url] [![MacOS][MacOS-image]][download-url] [![Linux][Linux-image]][download-url] -[Web App](https://chatgpt.nextweb.fun/) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Discord](https://discord.gg/YCkeafCafC) / [Twitter](https://twitter.com/mortiest_ricky) / [Buy Me a Coffee](https://www.buymeacoffee.com/yidadaa) +[Web App](https://app.nextchat.dev/) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Discord](https://discord.gg/YCkeafCafC) / [Twitter](https://twitter.com/NextChatDev) -[网页版](https://chatgpt.nextweb.fun/) / [客户端](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [QQ 群](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) +[网页版](https://app.nextchat.dev/) / [客户端](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [反馈](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) [web-url]: https://chatgpt.nextweb.fun [download-url]: https://github.com/Yidadaa/ChatGPT-Next-Web/releases @@ -25,7 +25,9 @@ One-Click to get well-designed cross-platform ChatGPT web UI. [MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple [Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&env=GOOGLE_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) + +[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/ZBUEFA) [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) @@ -37,8 +39,8 @@ One-Click to get well-designed cross-platform ChatGPT web UI. - **Deploy for free with one-click** on Vercel in under 1 minute - Compact client (~5MB) on Linux/Windows/MacOS, [download it now](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) -- Fully compatible with self-deployed llms, recommended for use with [RWKV-Runner](https://github.com/josStorer/RWKV-Runner) or [LocalAI](https://github.com/go-skynet/LocalAI) -- Privacy first, all data stored locally in the browser +- Fully compatible with self-deployed LLMs, recommended for use with [RWKV-Runner](https://github.com/josStorer/RWKV-Runner) or [LocalAI](https://github.com/go-skynet/LocalAI) +- Privacy first, all data is stored locally in the browser - Markdown support: LaTex, mermaid, code highlight, etc. - Responsive design, dark mode and PWA - Fast first screen loading speed (~100kb), support streaming response @@ -59,9 +61,11 @@ One-Click to get well-designed cross-platform ChatGPT web UI. ## What's New -- 🚀 v2.0 is released, now you can create prompt templates, turn your ideas into reality! Read this: [ChatGPT Prompt Engineering Tips: Zero, One and Few Shot Prompting](https://www.allabtai.com/prompt-engineering-tips-zero-one-and-few-shot-prompting/). -- 🚀 v2.7 let's share conversations as image, or share to ShareGPT! +- 🚀 v2.10.1 support Google Gemini Pro model. +- 🚀 v2.9.11 you can use azure endpoint now. - 🚀 v2.8 now we have a client that runs across all platforms! +- 🚀 v2.7 let's share conversations as image, or share to ShareGPT! +- 🚀 v2.0 is released, now you can create prompt templates, turn your ideas into reality! Read this: [ChatGPT Prompt Engineering Tips: Zero, One and Few Shot Prompting](https://www.allabtai.com/prompt-engineering-tips-zero-one-and-few-shot-prompting/). ## 主要功能 @@ -74,7 +78,7 @@ One-Click to get well-designed cross-platform ChatGPT web UI. - 预制角色功能(面具),方便地创建、分享和调试你的个性化对话 - 海量的内置 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, Tiếng Việt, Русский, Čeština +- 多国语言支持:English, 简体中文, 繁体中文, 日本語, Español, Italiano, Türkçe, Deutsch, Tiếng Việt, Русский, Čeština, 한국어, Indonesia - 拥有自己的域名?好上加好,绑定后即可在任何地方**无障碍**快速访问 ## 开发计划 @@ -93,6 +97,7 @@ One-Click to get well-designed cross-platform ChatGPT web UI. - 💡 想要更方便地随时随地使用本项目?可以试下这款桌面插件:https://github.com/mushan0x0/AI0x0.com - 🚀 v2.7 现在可以将会话分享为图片了,也可以分享到 ShareGPT 的在线链接。 - 🚀 v2.8 发布了横跨 Linux/Windows/MacOS 的体积极小的客户端。 +- 🚀 v2.9.11 现在可以使用自定义 Azure 服务了。 ## Get Started @@ -153,13 +158,13 @@ After adding or modifying this environment variable, please redeploy the project > [简体中文 > 如何配置 api key、访问密码、接口代理](./README_CN.md#环境变量) -### `OPENAI_API_KEY` (required) +### `CODE` (optional) -Your openai api key. +Access password, separated by comma. -### `CODE` (optional) +### `OPENAI_API_KEY` (required) -Access passsword, separated by comma. +Your openai api key, join multiple api keys with comma. ### `BASE_URL` (optional) @@ -173,6 +178,28 @@ Override openai api request base url. Specify OpenAI organization ID. +### `AZURE_URL` (optional) + +> Example: https://{azure-resource-url}/openai/deployments/{deploy-name} + +Azure deploy url. + +### `AZURE_API_KEY` (optional) + +Azure Api Key. + +### `AZURE_API_VERSION` (optional) + +Azure Api Version, find it at [Azure Documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions). + +### `GOOGLE_API_KEY` (optional) + +Google Gemini Pro Api Key. + +### `GOOGLE_URL` (optional) + +Google Gemini Pro Api Url. + ### `HIDE_USER_API_KEY` (optional) > Default: Empty @@ -185,11 +212,26 @@ If you do not want users to input their own API key, set this value to 1. If you do not want users to use GPT-4, set this value to 1. -### `HIDE_BALANCE_QUERY` (optional) +### `ENABLE_BALANCE_QUERY` (optional) + +> Default: Empty + +If you do want users to query balance, set this value to 1, or you should set it to 0. + +### `DISABLE_FAST_LINK` (optional) > Default: Empty -If you do not want users to query balance, set this value to 1. +If you want to disable parse settings from url, set this to 1. + +### `CUSTOM_MODELS` (optional) + +> Default: Empty +> Example: `+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo` means add `llama, claude-2` to model list, and remove `gpt-3.5-turbo` from list, and display `gpt-4-1106-preview` as `gpt-4-turbo`. + +To control custom models, use `+` to add a custom model, use `-` to hide a model, use `name=displayName` to customize model name, separated by comma. + +User `-all` to disable all default models, `+all` to enable all default models. ## Requirements @@ -257,6 +299,10 @@ If your proxy needs password, use: bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh) ``` +## Synchronizing Chat Records (UpStash) + +| [简体中文](./docs/synchronise-chat-logs-cn.md) | [English](./docs/synchronise-chat-logs-en.md) | [Italiano](./docs/synchronise-chat-logs-es.md) | [日本語](./docs/synchronise-chat-logs-ja.md) | [한국어](./docs/synchronise-chat-logs-ko.md) + ## Documentation > Please go to the [docs][./docs] directory for more documentation instructions. @@ -309,10 +355,17 @@ If you want to add a new translation, read this [document](./docs/translation.md [@AnsonHyq](https://github.com/AnsonHyq) [@synwith](https://github.com/synwith) [@piksonGit](https://github.com/piksonGit) +[@ouyangzhiping](https://github.com/ouyangzhiping) +[@wenjiavv](https://github.com/wenjiavv) +[@LeXwDeX](https://github.com/LeXwDeX) +[@Licoy](https://github.com/Licoy) +[@shangmin2009](https://github.com/shangmin2009) -### Contributor +### Contributors -[Contributors](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors) + + + ## LICENSE diff --git a/README_CN.md b/README_CN.md index e593e45da9c..4acefefa518 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,14 +1,16 @@
预览 -

ChatGPT Next Web

+

NextChat

-一键免费部署你的私人 ChatGPT 网页应用。 +一键免费部署你的私人 ChatGPT 网页应用,支持 GPT3, GPT4 & Gemini Pro 模型。 -[演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N) / [QQ 群](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) / [Donate](#捐赠-donate-usdt) +[演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) +[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/ZBUEFA) + [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) ![主界面](./docs/images/cover.png) @@ -19,7 +21,7 @@ 1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys); 2. 点击右侧按钮开始部署: - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登录即可,记得在环境变量页填入 API Key 和[页面访问密码](#配置页面访问密码) CODE; + [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&env=GOOGLE_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登录即可,记得在环境变量页填入 API Key 和[页面访问密码](#配置页面访问密码) CODE; 3. 部署完毕后,即可开始使用; 4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。 @@ -68,7 +70,7 @@ code1,code2,code3 ### `OPENAI_API_KEY` (必填项) -OpanAI 密钥,你在 openai 账户页面申请的 api key。 +OpanAI 密钥,你在 openai 账户页面申请的 api key,使用英文逗号隔开多个 key,这样可以随机轮询这些 key。 ### `CODE` (可选) @@ -90,6 +92,28 @@ OpenAI 接口代理 URL,如果你手动配置了 openai 接口代理,请填 指定 OpenAI 中的组织 ID。 +### `AZURE_URL` (可选) + +> 形如:https://{azure-resource-url}/openai/deployments/{deploy-name} + +Azure 部署地址。 + +### `AZURE_API_KEY` (可选) + +Azure 密钥。 + +### `AZURE_API_VERSION` (可选) + +Azure Api 版本,你可以在这里找到:[Azure 文档](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions)。 + +### `GOOGLE_API_KEY` (optional) + +Google Gemini Pro 密钥. + +### `GOOGLE_URL` (optional) + +Google Gemini Pro Api Url. + ### `HIDE_USER_API_KEY` (可选) 如果你不想让用户自行填入 API Key,将此环境变量设置为 1 即可。 @@ -98,9 +122,20 @@ OpenAI 接口代理 URL,如果你手动配置了 openai 接口代理,请填 如果你不想让用户使用 GPT-4,将此环境变量设置为 1 即可。 -### `HIDE_BALANCE_QUERY` (可选) +### `ENABLE_BALANCE_QUERY` (可选) + +如果你想启用余额查询功能,将此环境变量设置为 1 即可。 + +### `DISABLE_FAST_LINK` (可选) -如果你不想让用户查询余额,将此环境变量设置为 1 即可。 +如果你想禁用从链接解析预制设置,将此环境变量设置为 1 即可。 + +### `CUSTOM_MODELS` (可选) + +> 示例:`+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo` 表示增加 `qwen-7b-chat` 和 `glm-6b` 到模型列表,而从列表中删除 `gpt-3.5-turbo`,并将 `gpt-4-1106-preview` 模型名字展示为 `gpt-4-turbo`。 +> 如果你想先禁用所有模型,再启用指定模型,可以使用 `-all,+gpt-3.5-turbo`,则表示仅启用 `gpt-3.5-turbo` + +用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。 ## 开发 @@ -114,7 +149,7 @@ OpenAI 接口代理 URL,如果你手动配置了 openai 接口代理,请填 OPENAI_API_KEY= # 中国大陆用户,可以使用本项目自带的代理进行开发,你也可以自由选择其他代理地址 -BASE_URL=https://chatgpt2.nextweb.fun/api/proxy +BASE_URL=https://b.nextweb.fun/api/proxy ``` ### 本地开发 @@ -180,6 +215,7 @@ bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/s [见项目贡献者列表](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors) ### 相关项目 + - [one-api](https://github.com/songquanpeng/one-api): 一站式大模型额度管理平台,支持市面上所有主流大语言模型 ## 开源协议 diff --git a/README_ES.md b/README_ES.md deleted file mode 100644 index a5787a996d0..00000000000 --- a/README_ES.md +++ /dev/null @@ -1,173 +0,0 @@ -
-预览 - -

ChatGPT Next Web

- -Implemente su aplicación web privada ChatGPT de forma gratuita con un solo clic. - -[Demo demo](https://chat-gpt-next-web.vercel.app/) / [Problemas de comentarios](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Únete a Discord](https://discord.gg/zrhvHCr79N) / [Grupo QQ](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [Desarrolladores de consejos](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) / [Donar](#捐赠-donate-usdt) - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -![主界面](./docs/images/cover.png) - -
- -## Comenzar - -1. Prepara el tuyo [Clave API OpenAI](https://platform.openai.com/account/api-keys); -2. Haga clic en el botón de la derecha para iniciar la implementación: - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web), inicie sesión directamente con su cuenta de Github y recuerde completar la clave API y la suma en la página de variables de entorno[Contraseña de acceso a la página](#配置页面访问密码) CÓDIGO; -3. Una vez implementado, puede comenzar; -4. (Opcional)[Enlazar un nombre de dominio personalizado](https://vercel.com/docs/concepts/projects/domains/add-a-domain): El nombre de dominio DNS asignado por Vercel está contaminado en algunas regiones y puede conectarse directamente enlazando un nombre de dominio personalizado. - -## Manténgase actualizado - -Si sigue los pasos anteriores para implementar su proyecto con un solo clic, es posible que siempre diga "La actualización existe" porque Vercel creará un nuevo proyecto para usted de forma predeterminada en lugar de bifurcar el proyecto, lo que evitará que la actualización se detecte correctamente. -Le recomendamos que siga estos pasos para volver a implementar: - -- Eliminar el repositorio original; -- Utilice el botón de bifurcación en la esquina superior derecha de la página para bifurcar este proyecto; -- En Vercel, vuelva a seleccionar e implementar,[Echa un vistazo al tutorial detallado](./docs/vercel-cn.md#如何新建项目)。 - -### Activar actualizaciones automáticas - -> Si encuentra un error de ejecución de Upstream Sync, ¡Sync Fork manualmente una vez! - -Cuando bifurca el proyecto, debido a las limitaciones de Github, debe ir manualmente a la página Acciones de su proyecto bifurcado para habilitar Flujos de trabajo y habilitar Upstream Sync Action, después de habilitarlo, puede activar las actualizaciones automáticas cada hora: - -![自动更新](./docs/images/enable-actions.jpg) - -![启用自动更新](./docs/images/enable-actions-sync.jpg) - -### Actualizar el código manualmente - -Si desea que el manual se actualice inmediatamente, puede consultarlo [Documentación para Github](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) Aprenda a sincronizar un proyecto bifurcado con código ascendente. - -Puede destacar / ver este proyecto o seguir al autor para recibir notificaciones de nuevas actualizaciones de funciones. - -## Configurar la contraseña de acceso a la página - -> Después de configurar la contraseña, el usuario debe completar manualmente el código de acceso en la página de configuración para chatear normalmente, de lo contrario, se solicitará el estado no autorizado a través de un mensaje. - -> **advertir**: Asegúrese de establecer el número de dígitos de la contraseña lo suficientemente largo, preferiblemente más de 7 dígitos, de lo contrario[Será volado](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/518)。 - -Este proyecto proporciona control de permisos limitado, agregue el nombre al nombre en la página Variables de entorno del Panel de control del proyecto Vercel `CODE` Variables de entorno con valores para contraseñas personalizadas separadas por comas: - - code1,code2,code3 - -Después de agregar o modificar la variable de entorno, por favor**Redesplegar**proyecto para poner en vigor los cambios. - -## Variable de entorno - -> La mayoría de los elementos de configuración de este proyecto se establecen a través de variables de entorno, tutorial:[Cómo modificar las variables de entorno de Vercel](./docs/vercel-cn.md)。 - -### `OPENAI_API_KEY` (Requerido) - -OpanAI key, la clave API que solicita en la página de su cuenta openai. - -### `CODE` (Opcional) - -Las contraseñas de acceso, opcionalmente, se pueden separar por comas. - -**advertir**: Si no completa este campo, cualquiera puede usar directamente su sitio web implementado, lo que puede hacer que su token se consuma rápidamente, se recomienda completar esta opción. - -### `BASE_URL` (Opcional) - -> Predeterminado: `https://api.openai.com` - -> Ejemplos: `http://your-openai-proxy.com` - -URL del proxy de interfaz OpenAI, complete esta opción si configuró manualmente el proxy de interfaz openAI. - -> Si encuentra problemas con el certificado SSL, establezca el `BASE_URL` El protocolo se establece en http. - -### `OPENAI_ORG_ID` (Opcional) - -Especifica el identificador de la organización en OpenAI. - -### `HIDE_USER_API_KEY` (Opcional) - -Si no desea que los usuarios rellenen la clave de API ellos mismos, establezca esta variable de entorno en 1. - -### `DISABLE_GPT4` (Opcional) - -Si no desea que los usuarios utilicen GPT-4, establezca esta variable de entorno en 1. - -### `HIDE_BALANCE_QUERY` (Opcional) - -Si no desea que los usuarios consulte el saldo, establezca esta variable de entorno en 1. - -## explotación - -> No se recomienda encarecidamente desarrollar o implementar localmente, debido a algunas razones técnicas, es difícil configurar el agente API de OpenAI localmente, a menos que pueda asegurarse de que puede conectarse directamente al servidor OpenAI. - -Haga clic en el botón de abajo para iniciar el desarrollo secundario: - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -Antes de empezar a escribir código, debe crear uno nuevo en la raíz del proyecto `.env.local` archivo, lleno de variables de entorno: - - OPENAI_API_KEY= - -### Desarrollo local - -1. Instale nodejs 18 e hilo, pregunte a ChatGPT para obtener más detalles; -2. ejecutar `yarn install && yarn dev` Enlatar. ⚠️ Nota: Este comando es solo para desarrollo local, no para implementación. -3. Úselo si desea implementar localmente `yarn install && yarn start` comando, puede cooperar con pm2 a daemon para evitar ser asesinado, pregunte a ChatGPT para obtener más detalles. - -## desplegar - -### Implementación de contenedores (recomendado) - -> La versión de Docker debe ser 20 o posterior, de lo contrario se indicará que no se puede encontrar la imagen. - -> ⚠️ Nota: Las versiones de Docker están de 1 a 2 días por detrás de la última versión la mayor parte del tiempo, por lo que es normal que sigas diciendo "La actualización existe" después de la implementación. - -```shell -docker pull yidadaa/chatgpt-next-web - -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=your-password \ - yidadaa/chatgpt-next-web -``` - -También puede especificar proxy: - -```shell -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=your-password \ - --net=host \ - -e PROXY_URL=http://127.0.0.1:7890 \ - yidadaa/chatgpt-next-web -``` - -Si necesita especificar otras variables de entorno, agréguelas usted mismo en el comando anterior `-e 环境变量=环境变量值` para especificar. - -### Implementación local - -Ejecute el siguiente comando en la consola: - -```shell -bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh) -``` - -⚠️ Nota: Si tiene problemas durante la instalación, utilice la implementación de Docker. - -## Reconocimiento - -### donante - -> Ver versión en inglés. - -### Colaboradores - -[Ver la lista de colaboradores del proyecto](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors) - -## Licencia de código abierto - -[MIT](https://opensource.org/license/mit/) diff --git a/README_JA.md b/README_JA.md deleted file mode 100644 index 72a0d5373f6..00000000000 --- a/README_JA.md +++ /dev/null @@ -1,275 +0,0 @@ -
-icon - -

ChatGPT Next Web

- -[English](./README.md) / [简体中文](./README_CN.md) / 日本語 - -ワンクリックで、クロスプラットフォーム ChatGPT ウェブ UI が表示されます。 - -[![Web][Web-image]][web-url] -[![Windows][Windows-image]][download-url] -[![MacOS][MacOS-image]][download-url] -[![Linux][Linux-image]][download-url] - -[Web App](https://chatgpt.nextweb.fun/) / [Desktop App](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) / [Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Discord](https://discord.gg/YCkeafCafC) / [コーヒーをおごる](https://www.buymeacoffee.com/yidadaa) / [QQ グループ](https://github.com/Yidadaa/ChatGPT-Next-Web/discussions/1724) / [開発者への報酬](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) - -[web-url]: https://chatgpt.nextweb.fun -[download-url]: https://github.com/Yidadaa/ChatGPT-Next-Web/releases -[Web-image]: https://img.shields.io/badge/Web-PWA-orange?logo=microsoftedge -[Windows-image]: https://img.shields.io/badge/-Windows-blue?logo=windows -[MacOS-image]: https://img.shields.io/badge/-MacOS-black?logo=apple -[Linux-image]: https://img.shields.io/badge/-Linux-333?logo=ubuntu - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -![cover](./docs/images/cover.png) - -
- -## 特徴 - -- Vercel で 1 分以内に**ワンクリックで無料デプロイ**。 -- コンパクトなクライアント (~5MB) on Linux/Windows/MacOS、[今すぐダウンロード](https://github.com/Yidadaa/ChatGPT-Next-Web/releases) -- [RWKV-Runner](https://github.com/josStorer/RWKV-Runner) または [LocalAI](https://github.com/go-skynet/LocalAI) との使用をお勧めします -- プライバシー第一、すべてのデータはブラウザにローカルに保存されます -- マークダウンのサポート: LaTex、マーメイド、コードハイライトなど -- レスポンシブデザイン、ダークモード、PWA -- 最初の画面読み込み速度が速い(~100kb)、ストリーミングレスポンスをサポート -- v2 の新機能:プロンプトテンプレート(マスク)でチャットツールを作成、共有、デバッグ -- [awesome-chatgpt-prompts-zh](https://github.com/PlexPt/awesome-chatgpt-prompts-zh) と [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) による素晴らしいプロンプト -- トークンを保存しながら、長い会話をサポートするために自動的にチャット履歴を圧縮します -- 国際化: English、简体中文、繁体中文、日本語、Français、Español、Italiano、Türkçe、Deutsch、Tiếng Việt、Русский、Čeština、한국어 - -## ロードマップ - -- [x] システムプロンプト: ユーザー定義のプロンプトをシステムプロンプトとして固定 [#138](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138) -- [x] ユーザープロンプト: ユーザはカスタムプロンプトを編集し、プロンプトリストに保存することができます。 -- [x] プロンプトテンプレート: 事前に定義されたインコンテキストプロンプトで新しいチャットを作成 [#993](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/993) -- [x] イメージとして共有、ShareGPT への共有 [#1741](https://github.com/Yidadaa/ChatGPT-Next-Web/pull/1741) -- [x] tauri を使ったデスクトップアプリ -- [x] セルフホストモデル: [RWKV-Runner](https://github.com/josStorer/RWKV-Runner) と完全に互換性があり、[LocalAI](https://github.com/go-skynet/LocalAI) のサーバーデプロイも可能です: llama/gpt4all/rwkv/vicuna/koala/gpt4all-j/cerebras/falcon/dolly など -- [ ] プラグイン: ネットワーク検索、計算機、その他のAPIなどをサポート [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165) - -## 新機能 - -- 🚀 v2.0 がリリースされ、プロンプト・テンプレートが作成できるようになりました!こちらをお読みください: [ChatGPT プロンプトエンジニアリング Tips: ゼロ、一発、数発プロンプト](https://www.allabtai.com/prompt-engineering-tips-zero-one-and-few-shot-prompting/)。 -- 💡 このプロジェクトをいつでもどこでも簡単に使いたいですか?このデスクトッププラグインをお試しください: https://github.com/mushan0x0/AI0x0.com -- 🚀 v2.7 では、会話を画像として共有したり、ShareGPT に共有することができます! -- 🚀 v2.8 全てのプラットフォームで動作するクライアントができました! - -## 始める - -> [簡体字中国語 > 始め方](./README_CN.md#开始使用) - -1. [OpenAI API Key](https://platform.openai.com/account/api-keys) を取得する; -2. クリック - [![Vercel でデプロイ](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web)をクリックします。`CODE` はあなたのページのパスワードであることを忘れないでください; -3. お楽しみください :) - -## FAQ - -[簡体字中国語 > よくある質問](./docs/faq-cn.md) - -[English > FAQ](./docs/faq-en.md) - -## 更新を継続する - -> [簡体字中国語 > コードを最新の状態に保つ方法](./README_CN.md#保持更新) - -上記の手順に沿ってワンクリックで自分のプロジェクトをデプロイした場合、"Updates Available" が常に表示される問題に遭遇するかもしれません。これは、Vercel がこのプロジェクトをフォークする代わりに、デフォルトで新しいプロジェクトを作成するため、アップデートを正しく検出できないためです。 - -以下の手順で再デプロイすることをお勧めします: - -- 元のリポジトリを削除してください; -- ページの右上にあるフォークボタンを使って、このプロジェクトをフォークする; -- Vercel を選択し、再度デプロイする。[詳しいチュートリアルを参照](./docs/vercel-cn.md)。 - -### 自動アップデートを有効にする - -> Upstream Sync の実行に失敗した場合は、手動で一度フォークしてください。 - -プロジェクトをフォークした後、GitHub の制限により、フォークしたプロジェクトの Actions ページで Workflows と Upstream Sync Action を手動で有効にする必要があります。有効にすると、1 時間ごとに自動更新がスケジュールされます: - -![Automatic Updates](./docs/images/enable-actions.jpg) - -![Enable Automatic Updates](./docs/images/enable-actions-sync.jpg) - -### 手動でコードを更新する - -すぐに更新したい場合は、[GitHub ドキュメント](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) をチェックして、フォークしたプロジェクトを上流のコードと同期させる方法を学んでください。 - -このプロジェクトにスターをつけたり、ウォッチしたり、作者をフォローすることで、リリースの通知を受け取ることができます。 - -## アクセスパスワード - -> [簡体字中国語 > アクセスパスワードを増やす方法](./README_CN.md#配置页面访问密码) - -このプロジェクトではアクセス制御を制限しています。vercel の環境変数のページに `CODE` という環境変数を追加してください。その値は次のようにカンマで区切られたパスワードでなければなりません: - -``` -code1,code2,code3 -``` - -この環境変数を追加または変更した後は、変更を有効にするためにプロジェクトを再デプロイしてください。 - -## 環境変数 - -> [簡体字中国語 > API キー、アクセスパスワード、インターフェイスプロキシ設定方法](./README_CN.md#环境变量) - -### `OPENAI_API_KEY` (必須) - -OpenAI の api キー。 - -### `CODE` (オプション) - -カンマで区切られたアクセスパスワード。 - -### `BASE_URL` (オプション) - -> デフォルト: `https://api.openai.com` - -> 例: `http://your-openai-proxy.com` - -OpenAI api のリクエストベースの url をオーバーライドします。 - -### `OPENAI_ORG_ID` (オプション) - -OpenAI の組織 ID を指定します。 - -### `HIDE_USER_API_KEY` (オプション) - -> デフォルト: 空 - -ユーザーに自分の API キーを入力させたくない場合は、この値を 1 に設定する。 - -### `DISABLE_GPT4` (オプション) - -> デフォルト: 空 - -ユーザーに GPT-4 を使用させたくない場合は、この値を 1 に設定する。 - -### `HIDE_BALANCE_QUERY` (オプション) - -> デフォルト: 空 - -ユーザーに残高を照会させたくない場合は、この値を 1 に設定する。 - -## 必要条件 - -NodeJS >= 18、Docker >= 20 - -## Development - -> [簡体字中国語 > 二次開発の進め方](./README_CN.md#开发) - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -開発を始める前に、プロジェクトのルートに新しい `.env.local` ファイルを作成し、そこに api キーを置く必要があります: - -``` -OPENAI_API_KEY= - -# OpenAI サービスにアクセスできない場合は、この BASE_URL を使用してください -BASE_URL=https://chatgpt1.nextweb.fun/api/proxy -``` - -### ローカルデプロイ - -```shell -# 1. nodejs と yarn をまずインストールする -# 2. `.env.local` にローカルの env vars を設定する -# 3. 実行 -yarn install -yarn dev -``` - -## デプロイ - -> [簡体字中国語 > プライベートサーバーへのデプロイ方法](./README_CN.md#部署) - -### Docker (推奨) - -```shell -docker pull yidadaa/chatgpt-next-web - -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=your-password \ - yidadaa/chatgpt-next-web -``` - -プロキシの後ろでサービスを開始することができる: - -```shell -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=your-password \ - -e PROXY_URL=http://localhost:7890 \ - yidadaa/chatgpt-next-web -``` - -プロキシにパスワードが必要な場合: - -```shell --e PROXY_URL="http://127.0.0.1:7890 user pass" -``` - -### シェル - -```shell -bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh) -``` - -## スクリーンショット - -![Settings](./docs/images/settings.png) - -![More](./docs/images/more.png) - -## 翻訳 - -新しい翻訳を追加したい場合は、この[ドキュメント](./docs/translation.md)をお読みください。 - -## 寄付 - -[コーヒーをおごる](https://www.buymeacoffee.com/yidadaa) - -## スペシャルサンクス - -### スポンサー - -> 寄付金額が 100 元以上のユーザーのみリストアップしています - -[@mushan0x0](https://github.com/mushan0x0) -[@ClarenceDan](https://github.com/ClarenceDan) -[@zhangjia](https://github.com/zhangjia) -[@hoochanlon](https://github.com/hoochanlon) -[@relativequantum](https://github.com/relativequantum) -[@desenmeng](https://github.com/desenmeng) -[@webees](https://github.com/webees) -[@chazzhou](https://github.com/chazzhou) -[@hauy](https://github.com/hauy) -[@Corwin006](https://github.com/Corwin006) -[@yankunsong](https://github.com/yankunsong) -[@ypwhs](https://github.com/ypwhs) -[@fxxxchao](https://github.com/fxxxchao) -[@hotic](https://github.com/hotic) -[@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) -[@synwith](https://github.com/synwith) -[@piksonGit](https://github.com/piksonGit) - -### コントリビューター - -[コントリビューター達](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors) - -## ライセンス - -[MIT](https://opensource.org/license/mit/) diff --git a/README_KO.md b/README_KO.md deleted file mode 100644 index 519dd9d9bb5..00000000000 --- a/README_KO.md +++ /dev/null @@ -1,187 +0,0 @@ -
-프리뷰 - -

ChatGPT Next Web

- -개인 ChatGPT 웹 애플리케이션을 한 번의 클릭으로 무료로 배포하세요. - -[데모 Demo](https://chat-gpt-next-web.vercel.app/) / [피드백 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [Discord 참여](https://discord.gg/zrhvHCr79N) / [QQ 그룹](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [개발자에게 기부](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) / [기부 Donate](#기부-donate-usdt) - -[![Vercel로 배포하기](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web) - -[![Gitpod에서 열기](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -![메인 화면](./docs/images/cover.png) - -
- -## 사용 시작 - -1. [OpenAI API Key](https://platform.openai.com/account/api-keys)를 준비합니다. -2. 오른쪽 버튼을 클릭하여 배포를 시작하십시오: - [![Vercel로 배포하기](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web). Github 계정으로 바로 로그인하십시오. API Key와 [페이지 접근 비밀번호](#페이지-접근-비밀번호-설정) CODE를 환경 변수 페이지에 입력하십시오. -3. 배포가 완료되면 사용을 시작하십시오. -4. (선택 사항) [사용자 정의 도메인 바인딩](https://vercel.com/docs/concepts/projects/domains/add-a-domain) : Vercel에서 할당한 도메인 DNS가 일부 지역에서 오염되어 있습니다. 사용자 정의 도메인을 바인딩하면 직접 연결할 수 있습니다. - -## 업데이트 유지 - -위의 단계대로 프로젝트를 배포한 경우 "업데이트가 있습니다"라는 메시지가 항상 표시될 수 있습니다. 이는 Vercel이 기본적으로 새 프로젝트를 생성하고이 프로젝트를 포크하지 않기 때문입니다. 이 문제는 업데이트를 올바르게 감지할 수 없습니다. -아래 단계를 따라 다시 배포하십시오: - -- 기존 저장소를 삭제합니다. -- 페이지 오른쪽 상단의 포크 버튼을 사용하여 이 프로젝트를 포크합니다. -- Vercel에서 다시 선택하여 배포하십시오. [자세한 튜토리얼 보기](./docs/vercel-cn.md#새-프로젝트-만드는-방법). - -### 자동 업데이트 활성화 - -> Upstream Sync 오류가 발생한 경우 수동으로 Sync Fork를 한 번 실행하십시오! - -프로젝트를 포크한 후 GitHub의 제한으로 인해 포크한 프로젝트의 동작 페이지에서 워크플로우를 수동으로 활성화해야 합니다. Upstream Sync Action을 활성화하면 매시간마다 자동 업데이트가 활성화됩니다: - -![자동 업데이트](./docs/images/enable-actions.jpg) - -![자동 업데이트 활성화](./docs/images/enable-actions-sync.jpg) - -### 수동으로 코드 업데이트 - -수동으로 즉시 업데이트하려면 [GitHub 문서](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork)에서 포크된 프로젝트를 어떻게 원본 코드와 동기화하는지 확인하십시오. - -이 프로젝트에 별표/감시를 부여하거나 작성자를 팔로우하여 새 기능 업데이트 알림을 받을 수 있습니다. - -## 페이지 접근 비밀번호 설정 - -> 비밀번호가 설정된 후, 사용자는 설정 페이지에서 접근 코드를 수동으로 입력하여 정상적으로 채팅할 수 있습니다. 그렇지 않으면 메시지를 통해 권한이 없는 상태가 표시됩니다. - -> **경고** : 비밀번호의 길이를 충분히 길게 설정하십시오. 최소 7 자리 이상이 좋습니다. 그렇지 않으면 [해킹될 수 있습니다](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/518). - -이 프로젝트는 제한된 권한 제어 기능을 제공합니다. Vercel 프로젝트 컨트롤 패널의 환경 변수 페이지에서 `CODE`라는 환경 변수를 추가하십시오. 값은 쉼표로 구분된 사용자 정의 비밀번호로 설정됩니다. (아래 예시의 경우 `code1` `code2` `code3` 3개의 비밀번호가 생성됩니다.) - -``` -code1,code2,code3 -``` - -이 환경 변수를 추가하거나 수정한 후에는 프로젝트를 다시 배포하여 변경 사항을 적용해야 합니다. - -## 환경 변수 -> 이 프로젝트에서 대부분의 설정 요소들은 환경 변수를 통해 설정됩니다. [Vercel 환경변수 수정 방법.](./docs/vercel-ko.md)。 - -## OPENAI_API_KEY (필수 항목) - -OpenAI 키로, openai 계정 페이지에서 신청한 api key입니다. - -## CODE (선택 가능) - -접근 비밀번호로, 선택적입니다. 쉼표를 사용하여 여러 비밀번호를 구분할 수 있습니다. - -**경고** : 이 항목을 입력하지 않으면, 누구나 여러분이 배포한 웹사이트를 직접 사용할 수 있게 됩니다. 이로 인해 토큰이 빠르게 소진될 수 있으므로, 이 항목을 반드시 입력하는 것이 좋습니다. - -## BASE_URL (선택 가능) - -> 기본값: `https://api.openai.com` - -> 예시: `http://your-openai-proxy.com` - -OpenAI 인터페이스 프록시 URL입니다. 만약, 수동으로 openai 인터페이스 proxy를 설정했다면, 이 항목을 입력하셔야 합니다. - -**참고**: SSL 인증서 문제가 발생한 경우, BASE_URL의 프로토콜을 http로 설정하세요. - -## OPENAI_ORG_ID (선택 가능) - -OpenAI 내의 조직 ID를 지정합니다. - -## HIDE_USER_API_KEY (선택 가능) - -사용자가 API Key를 직접 입력하는 것을 원하지 않는 경우, 이 환경 변수를 1로 설정하세요. - -## DISABLE_GPT4 (선택 가능) - -사용자가 GPT-4를 사용하는 것을 원하지 않는 경우, 이 환경 변수를 1로 설정하세요. - -## HIDE_BALANCE_QUERY (선택 가능) - -사용자가 잔액을 조회하는 것을 원하지 않는 경우, 이 환경 변수를 1로 설정하세요. - -## 개발 - -아래 버튼을 클릭하여 개발을 시작하세요: - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web) - -코드 작성을 전, 프로젝트 루트 디렉토리에 `.env.local` 파일을 새로 만들고 해당 파일에 환경 변수를 입력해야 합니다: - -``` -OPENAI_API_KEY=<여기에 여러분의 api 키를 입력하세요> - -#중국 사용자들은 이 프로젝트에 포함된 프록시를 사용하여 개발할 수 있습니다. 또는 다른 프록시 주소를 자유롭게 선택할 수 있습니다. -BASE_URL=https://chatgpt1.nextweb.fun/api/proxy -``` - - -### 로컬 환경에서의 개발 - -1. nodejs 18과 yarn을 설치하세요. 자세한 사항은 ChatGPT에 문의하십시오. -2. `yarn install && yarn dev` 명령을 실행하세요. ⚠️ 주의: 이 명령은 로컬 개발 전용입니다. 배포용으로 사용하지 마십시오! -3. 로컬에서 배포하고 싶다면, `yarn install && yarn build && yarn start` 명령을 사용하세요. pm2와 함께 사용하여 프로세스를 보호하고, 강제 종료되지 않도록 할 수 있습니다. 자세한 내용은 ChatGPT에 문의하세요. - -## 배포 - -### 컨테이너 배포 (추천) - -> Docker 버전은 20 이상이어야 합니다. 그렇지 않으면 이미지를 찾을 수 없다는 메시지가 표시됩니다. - -> ⚠️ 주의: docker 버전은 대부분의 경우 최신 버전보다 1~2일 뒤처집니다. 따라서 배포 후 "업데이트 가능" 알림이 지속적으로 나타날 수 있으며, 이는 정상적인 현상입니다. - -```shell -docker pull yidadaa/chatgpt-next-web - -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=페이지 접근 비밀번호 \ - yidadaa/chatgpt-next-web -``` - -프록시를 지정하려면 다음을 사용하세요: - -```shell -docker run -d -p 3000:3000 \ - -e OPENAI_API_KEY=sk-xxxx \ - -e CODE=페이지 접근 비밀번호 \ - --net=host \ - -e PROXY_URL=http://127.0.0.1:7890 \ - yidadaa/chatgpt-next-web -``` - -로컬 프록시에 사용자 이름과 비밀번호가 필요한 경우, 아래와 같이 사용하세요: - -```shell --e PROXY_URL="http://127.0.0.1:7890 사용자이름 비밀번호" -``` - -다른 환경 변수를 지정해야 하는 경우, 위의 명령에 `-e 환경변수=환경변수값`을 추가하여 지정하세요. - -### 로컬 배포 - -콘솔에서 아래의 명령을 실행하세요: - -```shell -bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh) -``` - -⚠️ 주의: 설치 중 문제가 발생한 경우, docker로 배포하세요. - -## 감사의 말 - -### 기부자 - -> 영문 버전 참조. - -### 기여자 - -[프로젝트 기여자 목록 보기](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors) - -### 관련 프로젝트 -- [one-api](https://github.com/songquanpeng/one-api): 통합 대형 모델 할당 관리 플랫폼, 주요 대형 언어 모델 모두 지원 - -## 오픈소스 라이센스 - -[MIT](https://opensource.org/license/mit/) diff --git a/app/api/auth.ts b/app/api/auth.ts index e0453b2b47f..16c8034eb55 100644 --- a/app/api/auth.ts +++ b/app/api/auth.ts @@ -1,7 +1,7 @@ import { NextRequest } from "next/server"; import { getServerSideConfig } from "../config/server"; import md5 from "spark-md5"; -import { ACCESS_CODE_PREFIX } from "../constant"; +import { ACCESS_CODE_PREFIX, ModelProvider } from "../constant"; function getIP(req: NextRequest) { let ip = req.ip ?? req.headers.get("x-real-ip"); @@ -16,19 +16,19 @@ function getIP(req: NextRequest) { function parseApiKey(bearToken: string) { const token = bearToken.trim().replaceAll("Bearer ", "").trim(); - const isOpenAiKey = !token.startsWith(ACCESS_CODE_PREFIX); + const isApiKey = !token.startsWith(ACCESS_CODE_PREFIX); return { - accessCode: isOpenAiKey ? "" : token.slice(ACCESS_CODE_PREFIX.length), - apiKey: isOpenAiKey ? token : "", + accessCode: isApiKey ? "" : token.slice(ACCESS_CODE_PREFIX.length), + apiKey: isApiKey ? token : "", }; } -export function auth(req: NextRequest) { +export function auth(req: NextRequest, modelProvider: ModelProvider) { const authToken = req.headers.get("Authorization") ?? ""; // check if it is openai api key or user token - const { accessCode, apiKey: token } = parseApiKey(authToken); + const { accessCode, apiKey } = parseApiKey(authToken); const hashedCode = md5.hash(accessCode ?? "").trim(); @@ -39,19 +39,33 @@ export function auth(req: NextRequest) { console.log("[User IP] ", getIP(req)); console.log("[Time] ", new Date().toLocaleString()); - if (serverConfig.needCode && !serverConfig.codes.has(hashedCode) && !token) { + if (serverConfig.needCode && !serverConfig.codes.has(hashedCode) && !apiKey) { return { error: true, msg: !accessCode ? "empty access code" : "wrong access code", }; } + if (serverConfig.hideUserApiKey && !!apiKey) { + return { + error: true, + msg: "you are not allowed to access with your own api key", + }; + } + // if user does not provide an api key, inject system api key - if (!token) { - const apiKey = serverConfig.apiKey; - if (apiKey) { + if (!apiKey) { + const serverConfig = getServerSideConfig(); + + const systemApiKey = + modelProvider === ModelProvider.GeminiPro + ? serverConfig.googleApiKey + : serverConfig.isAzure + ? serverConfig.azureApiKey + : serverConfig.apiKey; + if (systemApiKey) { console.log("[Auth] use system api key"); - req.headers.set("Authorization", `Bearer ${apiKey}`); + req.headers.set("Authorization", `Bearer ${systemApiKey}`); } else { console.log("[Auth] admin did not provide an api key"); } diff --git a/app/api/common.ts b/app/api/common.ts index cd2936ee39f..ca8406bb361 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -1,48 +1,78 @@ import { NextRequest, NextResponse } from "next/server"; +import { getServerSideConfig } from "../config/server"; +import { DEFAULT_MODELS, OPENAI_BASE_URL, GEMINI_BASE_URL } from "../constant"; +import { collectModelTable } from "../utils/model"; +import { makeAzurePath } from "../azure"; -export const OPENAI_URL = "api.openai.com"; -const DEFAULT_PROTOCOL = "https"; -const PROTOCOL = process.env.PROTOCOL || DEFAULT_PROTOCOL; -const BASE_URL = process.env.BASE_URL || OPENAI_URL; -const DISABLE_GPT4 = !!process.env.DISABLE_GPT4; +const serverConfig = getServerSideConfig(); export async function requestOpenai(req: NextRequest) { const controller = new AbortController(); - const authValue = req.headers.get("Authorization") ?? ""; - const openaiPath = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll( + + var authValue, + authHeaderName = ""; + if (serverConfig.isAzure) { + authValue = + req.headers + .get("Authorization") + ?.trim() + .replaceAll("Bearer ", "") + .trim() ?? ""; + + authHeaderName = "api-key"; + } else { + authValue = req.headers.get("Authorization") ?? ""; + authHeaderName = "Authorization"; + } + + let path = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll( "/api/openai/", "", ); - let baseUrl = BASE_URL; + let baseUrl = + serverConfig.azureUrl || serverConfig.baseUrl || OPENAI_BASE_URL; if (!baseUrl.startsWith("http")) { - baseUrl = `${PROTOCOL}://${baseUrl}`; + baseUrl = `https://${baseUrl}`; } - if (baseUrl.endsWith('/')) { + if (baseUrl.endsWith("/")) { baseUrl = baseUrl.slice(0, -1); } - console.log("[Proxy] ", openaiPath); + console.log("[Proxy] ", path); console.log("[Base Url]", baseUrl); - - if (process.env.OPENAI_ORG_ID) { - console.log("[Org ID]", process.env.OPENAI_ORG_ID); + // this fix [Org ID] undefined in server side if not using custom point + if (serverConfig.openaiOrgId !== undefined) { + console.log("[Org ID]", serverConfig.openaiOrgId); } - const timeoutId = setTimeout(() => { - controller.abort(); - }, 10 * 60 * 1000); + const timeoutId = setTimeout( + () => { + controller.abort(); + }, + 10 * 60 * 1000, + ); - const fetchUrl = `${baseUrl}/${openaiPath}`; + if (serverConfig.isAzure) { + if (!serverConfig.azureApiVersion) { + return NextResponse.json({ + error: true, + message: `missing AZURE_API_VERSION in server env vars`, + }); + } + path = makeAzurePath(path, serverConfig.azureApiVersion); + } + + const fetchUrl = `${baseUrl}/${path}`; const fetchOptions: RequestInit = { headers: { "Content-Type": "application/json", "Cache-Control": "no-store", - Authorization: authValue, - ...(process.env.OPENAI_ORG_ID && { - "OpenAI-Organization": process.env.OPENAI_ORG_ID, + [authHeaderName]: authValue, + ...(serverConfig.openaiOrgId && { + "OpenAI-Organization": serverConfig.openaiOrgId, }), }, method: req.method, @@ -55,18 +85,23 @@ export async function requestOpenai(req: NextRequest) { }; // #1815 try to refuse gpt4 request - if (DISABLE_GPT4 && req.body) { + if (serverConfig.customModels && req.body) { try { + const modelTable = collectModelTable( + DEFAULT_MODELS, + serverConfig.customModels, + ); const clonedBody = await req.text(); fetchOptions.body = clonedBody; - const jsonBody = JSON.parse(clonedBody); + const jsonBody = JSON.parse(clonedBody) as { model?: string }; - if ((jsonBody?.model ?? "").includes("gpt-4")) { + // not undefined and is false + if (modelTable[jsonBody?.model ?? ""].available === false) { return NextResponse.json( { error: true, - message: "you are not allowed to use gpt-4 model", + message: `you are not allowed to use ${jsonBody?.model} model`, }, { status: 403, @@ -87,6 +122,12 @@ export async function requestOpenai(req: NextRequest) { // to disable nginx buffering newHeaders.set("X-Accel-Buffering", "no"); + // The latest version of the OpenAI API forced the content-encoding to be "br" in json response + // So if the streaming is disabled, we need to remove the content-encoding header + // Because Vercel uses gzip to compress the response, if we don't remove the content-encoding header + // The browser will try to decode the response with brotli and fail + newHeaders.delete("content-encoding"); + return new Response(res.body, { status: res.status, statusText: res.statusText, diff --git a/app/api/config/route.ts b/app/api/config/route.ts index 7749e6e9e28..db84fba175a 100644 --- a/app/api/config/route.ts +++ b/app/api/config/route.ts @@ -4,13 +4,15 @@ import { getServerSideConfig } from "../../config/server"; const serverConfig = getServerSideConfig(); -// Danger! Don not write any secret value here! +// Danger! Do not hard code any secret value here! // 警告!不要在这里写入任何敏感信息! const DANGER_CONFIG = { needCode: serverConfig.needCode, hideUserApiKey: serverConfig.hideUserApiKey, disableGPT4: serverConfig.disableGPT4, hideBalanceQuery: serverConfig.hideBalanceQuery, + disableFastLink: serverConfig.disableFastLink, + customModels: serverConfig.customModels, }; declare global { diff --git a/app/api/cors/[...path]/route.ts b/app/api/cors/[...path]/route.ts new file mode 100644 index 00000000000..1f70d663082 --- /dev/null +++ b/app/api/cors/[...path]/route.ts @@ -0,0 +1,43 @@ +import { NextRequest, NextResponse } from "next/server"; + +async function handle( + req: NextRequest, + { params }: { params: { path: string[] } }, +) { + if (req.method === "OPTIONS") { + return NextResponse.json({ body: "OK" }, { status: 200 }); + } + + const [protocol, ...subpath] = params.path; + const targetUrl = `${protocol}://${subpath.join("/")}`; + + const method = req.headers.get("method") ?? undefined; + const shouldNotHaveBody = ["get", "head"].includes( + method?.toLowerCase() ?? "", + ); + + const fetchOptions: RequestInit = { + headers: { + authorization: req.headers.get("authorization") ?? "", + }, + body: shouldNotHaveBody ? null : req.body, + method, + // @ts-ignore + duplex: "half", + }; + + const fetchResult = await fetch(targetUrl, fetchOptions); + + console.log("[Any Proxy]", targetUrl, { + status: fetchResult.status, + statusText: fetchResult.statusText, + }); + + return fetchResult; +} + +export const POST = handle; +export const GET = handle; +export const OPTIONS = handle; + +export const runtime = "edge"; diff --git a/app/api/google/[...path]/route.ts b/app/api/google/[...path]/route.ts new file mode 100644 index 00000000000..869bd507638 --- /dev/null +++ b/app/api/google/[...path]/route.ts @@ -0,0 +1,121 @@ +import { NextRequest, NextResponse } from "next/server"; +import { auth } from "../../auth"; +import { getServerSideConfig } from "@/app/config/server"; +import { GEMINI_BASE_URL, Google, ModelProvider } from "@/app/constant"; + +async function handle( + req: NextRequest, + { params }: { params: { path: string[] } }, +) { + console.log("[Google Route] params ", params); + + if (req.method === "OPTIONS") { + return NextResponse.json({ body: "OK" }, { status: 200 }); + } + + const controller = new AbortController(); + + const serverConfig = getServerSideConfig(); + + let baseUrl = serverConfig.googleUrl || GEMINI_BASE_URL; + + if (!baseUrl.startsWith("http")) { + baseUrl = `https://${baseUrl}`; + } + + if (baseUrl.endsWith("/")) { + baseUrl = baseUrl.slice(0, -1); + } + + let path = `${req.nextUrl.pathname}`.replaceAll("/api/google/", ""); + + console.log("[Proxy] ", path); + console.log("[Base Url]", baseUrl); + + const timeoutId = setTimeout( + () => { + controller.abort(); + }, + 10 * 60 * 1000, + ); + + const authResult = auth(req, ModelProvider.GeminiPro); + if (authResult.error) { + return NextResponse.json(authResult, { + status: 401, + }); + } + + const bearToken = req.headers.get("Authorization") ?? ""; + const token = bearToken.trim().replaceAll("Bearer ", "").trim(); + + const key = token ? token : serverConfig.googleApiKey; + + if (!key) { + return NextResponse.json( + { + error: true, + message: `missing GOOGLE_API_KEY in server env vars`, + }, + { + status: 401, + }, + ); + } + + const fetchUrl = `${baseUrl}/${path}?key=${key}`; + const fetchOptions: RequestInit = { + headers: { + "Content-Type": "application/json", + "Cache-Control": "no-store", + }, + method: req.method, + body: req.body, + // to fix #2485: https://stackoverflow.com/questions/55920957/cloudflare-worker-typeerror-one-time-use-body + redirect: "manual", + // @ts-ignore + duplex: "half", + signal: controller.signal, + }; + + try { + const res = await fetch(fetchUrl, fetchOptions); + // to prevent browser prompt for credentials + const newHeaders = new Headers(res.headers); + newHeaders.delete("www-authenticate"); + // to disable nginx buffering + newHeaders.set("X-Accel-Buffering", "no"); + + return new Response(res.body, { + status: res.status, + statusText: res.statusText, + headers: newHeaders, + }); + } finally { + clearTimeout(timeoutId); + } +} + +export const GET = handle; +export const POST = handle; + +export const runtime = "edge"; +export const preferredRegion = [ + "arn1", + "bom1", + "cdg1", + "cle1", + "cpt1", + "dub1", + "fra1", + "gru1", + "hnd1", + "iad1", + "icn1", + "kix1", + "lhr1", + "pdx1", + "sfo1", + "sin1", + "syd1", +]; diff --git a/app/api/openai/[...path]/route.ts b/app/api/openai/[...path]/route.ts index 9df005a317a..77059c151fc 100644 --- a/app/api/openai/[...path]/route.ts +++ b/app/api/openai/[...path]/route.ts @@ -1,6 +1,6 @@ import { type OpenAIListModelResponse } from "@/app/client/platforms/openai"; import { getServerSideConfig } from "@/app/config/server"; -import { OpenaiPath } from "@/app/constant"; +import { ModelProvider, OpenaiPath } from "@/app/constant"; import { prettyObject } from "@/app/utils/format"; import { NextRequest, NextResponse } from "next/server"; import { auth } from "../../auth"; @@ -45,7 +45,7 @@ async function handle( ); } - const authResult = auth(req); + const authResult = auth(req, ModelProvider.GPT); if (authResult.error) { return NextResponse.json(authResult, { status: 401, @@ -75,3 +75,22 @@ export const GET = handle; export const POST = handle; export const runtime = "edge"; +export const preferredRegion = [ + "arn1", + "bom1", + "cdg1", + "cle1", + "cpt1", + "dub1", + "fra1", + "gru1", + "hnd1", + "iad1", + "icn1", + "kix1", + "lhr1", + "pdx1", + "sfo1", + "sin1", + "syd1", +]; diff --git a/app/azure.ts b/app/azure.ts new file mode 100644 index 00000000000..48406c55ba5 --- /dev/null +++ b/app/azure.ts @@ -0,0 +1,9 @@ +export function makeAzurePath(path: string, apiVersion: string) { + // should omit /v1 prefix + path = path.replaceAll("v1/", ""); + + // should add api-key to query string + path += `${path.includes("?") ? "&" : "?"}api-version=${apiVersion}`; + + return path; +} diff --git a/app/client/api.ts b/app/client/api.ts index b04dd88b88c..56fa3299624 100644 --- a/app/client/api.ts +++ b/app/client/api.ts @@ -1,8 +1,13 @@ import { getClientConfig } from "../config/client"; -import { ACCESS_CODE_PREFIX } from "../constant"; -import { ChatMessage, ModelType, useAccessStore } from "../store"; +import { + ACCESS_CODE_PREFIX, + Azure, + ModelProvider, + ServiceProvider, +} from "../constant"; +import { ChatMessage, ModelType, useAccessStore, useChatStore } from "../store"; import { ChatGPTApi } from "./platforms/openai"; - +import { GeminiProApi } from "./platforms/google"; export const ROLES = ["system", "user", "assistant"] as const; export type MessageRole = (typeof ROLES)[number]; @@ -41,6 +46,13 @@ export interface LLMUsage { export interface LLMModel { name: string; available: boolean; + provider: LLMModelProvider; +} + +export interface LLMModelProvider { + id: string; + providerName: string; + providerType: string; } export abstract class LLMApi { @@ -73,7 +85,11 @@ interface ChatProvider { export class ClientApi { public llm: LLMApi; - constructor() { + constructor(provider: ModelProvider = ModelProvider.GPT) { + if (provider === ModelProvider.GeminiPro) { + this.llm = new GeminiProApi(); + return; + } this.llm = new ChatGPTApi(); } @@ -93,7 +109,7 @@ export class ClientApi { { from: "human", value: - "Share from [ChatGPT Next Web]: https://github.com/Yidadaa/ChatGPT-Next-Web", + "Share from [NextChat]: https://github.com/Yidadaa/ChatGPT-Next-Web", }, ]); // 敬告二开开发者们,为了开源大模型的发展,请不要修改上述消息,此消息用于后续数据清洗使用 @@ -123,26 +139,34 @@ export class ClientApi { } } -export const api = new ClientApi(); - export function getHeaders() { const accessStore = useAccessStore.getState(); - let headers: Record = { + const headers: Record = { "Content-Type": "application/json", "x-requested-with": "XMLHttpRequest", + "Accept": "application/json", }; - - const makeBearer = (token: string) => `Bearer ${token.trim()}`; + const modelConfig = useChatStore.getState().currentSession().mask.modelConfig; + const isGoogle = modelConfig.model === "gemini-pro"; + const isAzure = accessStore.provider === ServiceProvider.Azure; + const authHeader = isAzure ? "api-key" : "Authorization"; + const apiKey = isGoogle + ? accessStore.googleApiKey + : isAzure + ? accessStore.azureApiKey + : accessStore.openaiApiKey; + + const makeBearer = (s: string) => `${isAzure ? "" : "Bearer "}${s.trim()}`; const validString = (x: string) => x && x.length > 0; // use user's api key first - if (validString(accessStore.token)) { - headers.Authorization = makeBearer(accessStore.token); + if (validString(apiKey)) { + headers[authHeader] = makeBearer(apiKey); } else if ( accessStore.enabledAccessControl() && validString(accessStore.accessCode) ) { - headers.Authorization = makeBearer( + headers[authHeader] = makeBearer( ACCESS_CODE_PREFIX + accessStore.accessCode, ); } diff --git a/app/client/platforms/google.ts b/app/client/platforms/google.ts new file mode 100644 index 00000000000..f0f63659f2b --- /dev/null +++ b/app/client/platforms/google.ts @@ -0,0 +1,226 @@ +import { Google, REQUEST_TIMEOUT_MS } from "@/app/constant"; +import { ChatOptions, getHeaders, LLMApi, LLMModel, LLMUsage } from "../api"; +import { useAccessStore, useAppConfig, useChatStore } from "@/app/store"; +import { + EventStreamContentType, + fetchEventSource, +} from "@fortaine/fetch-event-source"; +import { prettyObject } from "@/app/utils/format"; +import { getClientConfig } from "@/app/config/client"; +import Locale from "../../locales"; +import { getServerSideConfig } from "@/app/config/server"; +import de from "@/app/locales/de"; +export class GeminiProApi implements LLMApi { + extractMessage(res: any) { + console.log("[Response] gemini-pro response: ", res); + + return ( + res?.candidates?.at(0)?.content?.parts.at(0)?.text || + res?.error?.message || + "" + ); + } + async chat(options: ChatOptions): Promise { + const apiClient = this; + const messages = options.messages.map((v) => ({ + role: v.role.replace("assistant", "model").replace("system", "user"), + parts: [{ text: v.content }], + })); + + // google requires that role in neighboring messages must not be the same + for (let i = 0; i < messages.length - 1; ) { + // Check if current and next item both have the role "model" + if (messages[i].role === messages[i + 1].role) { + // Concatenate the 'parts' of the current and next item + messages[i].parts = messages[i].parts.concat(messages[i + 1].parts); + // Remove the next item + messages.splice(i + 1, 1); + } else { + // Move to the next item + i++; + } + } + + const modelConfig = { + ...useAppConfig.getState().modelConfig, + ...useChatStore.getState().currentSession().mask.modelConfig, + ...{ + model: options.config.model, + }, + }; + const requestPayload = { + contents: messages, + generationConfig: { + // stopSequences: [ + // "Title" + // ], + temperature: modelConfig.temperature, + maxOutputTokens: modelConfig.max_tokens, + topP: modelConfig.top_p, + // "topK": modelConfig.top_k, + }, + safetySettings: [ + { + category: "HARM_CATEGORY_HARASSMENT", + threshold: "BLOCK_ONLY_HIGH", + }, + { + category: "HARM_CATEGORY_HATE_SPEECH", + threshold: "BLOCK_ONLY_HIGH", + }, + { + category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", + threshold: "BLOCK_ONLY_HIGH", + }, + { + category: "HARM_CATEGORY_DANGEROUS_CONTENT", + threshold: "BLOCK_ONLY_HIGH", + }, + ], + }; + + console.log("[Request] google payload: ", requestPayload); + + const shouldStream = !!options.config.stream; + const controller = new AbortController(); + options.onController?.(controller); + try { + const chatPath = this.path(Google.ChatPath); + const chatPayload = { + method: "POST", + body: JSON.stringify(requestPayload), + signal: controller.signal, + headers: getHeaders(), + }; + + // make a fetch request + const requestTimeoutId = setTimeout( + () => controller.abort(), + REQUEST_TIMEOUT_MS, + ); + if (shouldStream) { + let responseText = ""; + let remainText = ""; + let streamChatPath = chatPath.replace( + "generateContent", + "streamGenerateContent", + ); + let finished = false; + + let existingTexts: string[] = []; + const finish = () => { + finished = true; + options.onFinish(existingTexts.join("")); + }; + + // animate response to make it looks smooth + function animateResponseText() { + if (finished || controller.signal.aborted) { + responseText += remainText; + finish(); + return; + } + + if (remainText.length > 0) { + const fetchCount = Math.max(1, Math.round(remainText.length / 60)); + const fetchText = remainText.slice(0, fetchCount); + responseText += fetchText; + remainText = remainText.slice(fetchCount); + options.onUpdate?.(responseText, fetchText); + } + + requestAnimationFrame(animateResponseText); + } + + // start animaion + animateResponseText(); + fetch(streamChatPath, chatPayload) + .then((response) => { + const reader = response?.body?.getReader(); + const decoder = new TextDecoder(); + let partialData = ""; + + return reader?.read().then(function processText({ + done, + value, + }): Promise { + if (done) { + console.log("Stream complete"); + // options.onFinish(responseText + remainText); + finished = true; + return Promise.resolve(); + } + + partialData += decoder.decode(value, { stream: true }); + + try { + let data = JSON.parse(ensureProperEnding(partialData)); + + const textArray = data.reduce( + (acc: string[], item: { candidates: any[] }) => { + const texts = item.candidates.map((candidate) => + candidate.content.parts + .map((part: { text: any }) => part.text) + .join(""), + ); + return acc.concat(texts); + }, + [], + ); + + if (textArray.length > existingTexts.length) { + const deltaArray = textArray.slice(existingTexts.length); + existingTexts = textArray; + remainText += deltaArray.join(""); + } + } catch (error) { + // console.log("[Response Animation] error: ", error,partialData); + // skip error message when parsing json + } + + return reader.read().then(processText); + }); + }) + .catch((error) => { + console.error("Error:", error); + }); + } else { + const res = await fetch(chatPath, chatPayload); + clearTimeout(requestTimeoutId); + + const resJson = await res.json(); + + if (resJson?.promptFeedback?.blockReason) { + // being blocked + options.onError?.( + new Error( + "Message is being blocked for reason: " + + resJson.promptFeedback.blockReason, + ), + ); + } + const message = this.extractMessage(resJson); + options.onFinish(message); + } + } catch (e) { + console.log("[Request] failed to make a chat request", e); + options.onError?.(e as Error); + } + } + usage(): Promise { + throw new Error("Method not implemented."); + } + async models(): Promise { + return []; + } + path(path: string): string { + return "/api/google/" + path; + } +} + +function ensureProperEnding(str: string) { + if (str.startsWith("[") && !str.endsWith("]")) { + return str + "]"; + } + return str; +} diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index fd4eb59ce77..68a0fda755c 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -1,8 +1,10 @@ import { + ApiPath, DEFAULT_API_HOST, DEFAULT_MODELS, OpenaiPath, REQUEST_TIMEOUT_MS, + ServiceProvider, } from "@/app/constant"; import { useAccessStore, useAppConfig, useChatStore } from "@/app/store"; @@ -14,6 +16,7 @@ import { } from "@fortaine/fetch-event-source"; import { prettyObject } from "@/app/utils/format"; import { getClientConfig } from "@/app/config/client"; +import { makeAzurePath } from "@/app/azure"; export interface OpenAIListModelResponse { object: string; @@ -28,20 +31,35 @@ export class ChatGPTApi implements LLMApi { private disableListModels = true; path(path: string): string { - let openaiUrl = useAccessStore.getState().openaiUrl; - const apiPath = "/api/openai"; + const accessStore = useAccessStore.getState(); - if (openaiUrl.length === 0) { + const isAzure = accessStore.provider === ServiceProvider.Azure; + + if (isAzure && !accessStore.isValidAzure()) { + throw Error( + "incomplete azure config, please check it in your settings page", + ); + } + + let baseUrl = isAzure ? accessStore.azureUrl : accessStore.openaiUrl; + + if (baseUrl.length === 0) { const isApp = !!getClientConfig()?.isApp; - openaiUrl = isApp ? DEFAULT_API_HOST : apiPath; + baseUrl = isApp ? DEFAULT_API_HOST : ApiPath.OpenAI; + } + + if (baseUrl.endsWith("/")) { + baseUrl = baseUrl.slice(0, baseUrl.length - 1); } - if (openaiUrl.endsWith("/")) { - openaiUrl = openaiUrl.slice(0, openaiUrl.length - 1); + if (!baseUrl.startsWith("http") && !baseUrl.startsWith(ApiPath.OpenAI)) { + baseUrl = "https://" + baseUrl; } - if (!openaiUrl.startsWith("http") && !openaiUrl.startsWith(apiPath)) { - openaiUrl = "https://" + openaiUrl; + + if (isAzure) { + path = makeAzurePath(path, accessStore.azureApiVersion); } - return [openaiUrl, path].join("/"); + + return [baseUrl, path].join("/"); } extractMessage(res: any) { @@ -70,6 +88,8 @@ export class ChatGPTApi implements LLMApi { presence_penalty: modelConfig.presence_penalty, frequency_penalty: modelConfig.frequency_penalty, top_p: modelConfig.top_p, + // max_tokens: Math.max(modelConfig.max_tokens, 1024), + // Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore. }; console.log("[Request] openai payload: ", requestPayload); @@ -95,12 +115,35 @@ export class ChatGPTApi implements LLMApi { if (shouldStream) { let responseText = ""; + let remainText = ""; let finished = false; + // animate response to make it looks smooth + function animateResponseText() { + if (finished || controller.signal.aborted) { + responseText += remainText; + console.log("[Response Animation] finished"); + return; + } + + if (remainText.length > 0) { + const fetchCount = Math.max(1, Math.round(remainText.length / 60)); + const fetchText = remainText.slice(0, fetchCount); + responseText += fetchText; + remainText = remainText.slice(fetchCount); + options.onUpdate?.(responseText, fetchText); + } + + requestAnimationFrame(animateResponseText); + } + + // start animaion + animateResponseText(); + const finish = () => { if (!finished) { - options.onFinish(responseText); finished = true; + options.onFinish(responseText + remainText); } }; @@ -154,14 +197,19 @@ export class ChatGPTApi implements LLMApi { } const text = msg.data; try { - const json = JSON.parse(text); - const delta = json.choices[0].delta.content; + const json = JSON.parse(text) as { + choices: Array<{ + delta: { + content: string; + }; + }>; + }; + const delta = json.choices[0]?.delta?.content; if (delta) { - responseText += delta; - options.onUpdate?.(responseText, delta); + remainText += delta; } } catch (e) { - console.error("[Request] parse error", text, msg); + console.error("[Request] parse error", text); } }, onclose() { @@ -275,6 +323,11 @@ export class ChatGPTApi implements LLMApi { return chatModels.map((m) => ({ name: m.id, available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, })); } } diff --git a/app/components/auth.tsx b/app/components/auth.tsx index 1ca83dcd314..57118349bac 100644 --- a/app/components/auth.tsx +++ b/app/components/auth.tsx @@ -12,9 +12,16 @@ import { getClientConfig } from "../config/client"; export function AuthPage() { const navigate = useNavigate(); - const access = useAccessStore(); + const accessStore = useAccessStore(); const goHome = () => navigate(Path.Home); + const goChat = () => navigate(Path.Chat); + const resetAccessCode = () => { + accessStore.update((access) => { + access.openaiApiKey = ""; + access.accessCode = ""; + }); + }; // Reset access code to empty string useEffect(() => { if (getClientConfig()?.isApp) { @@ -36,19 +43,54 @@ export function AuthPage() { className={styles["auth-input"]} type="password" placeholder={Locale.Auth.Input} - value={access.accessCode} + value={accessStore.accessCode} onChange={(e) => { - access.updateCode(e.currentTarget.value); + accessStore.update( + (access) => (access.accessCode = e.currentTarget.value), + ); }} /> + {!accessStore.hideUserApiKey ? ( + <> +
{Locale.Auth.SubTips}
+ { + accessStore.update( + (access) => (access.openaiApiKey = e.currentTarget.value), + ); + }} + /> + { + accessStore.update( + (access) => (access.googleApiKey = e.currentTarget.value), + ); + }} + /> + + ) : null}
+ { + resetAccessCode(); + goHome(); + }} /> -
); diff --git a/app/components/chat-list.tsx b/app/components/chat-list.tsx index 7ba55585239..33967717d53 100644 --- a/app/components/chat-list.tsx +++ b/app/components/chat-list.tsx @@ -18,6 +18,7 @@ import { MaskAvatar } from "./mask"; import { Mask } from "../store/mask"; import { useRef, useEffect } from "react"; import { showConfirm } from "./ui-lib"; +import { useMobileScreen } from "../utils"; export function ChatItem(props: { onClick?: () => void; @@ -60,7 +61,10 @@ export function ChatItem(props: { {props.narrow ? (
- +
{props.count} @@ -80,7 +84,11 @@ export function ChatItem(props: {
{ + props.onDelete?.(); + e.preventDefault(); + e.stopPropagation(); + }} >
@@ -101,6 +109,7 @@ export function ChatList(props: { narrow?: boolean }) { ); const chatStore = useChatStore(); const navigate = useNavigate(); + const isMobileScreen = useMobileScreen(); const onDragEnd: OnDragEndResponder = (result) => { const { destination, source } = result; @@ -142,7 +151,7 @@ export function ChatList(props: { narrow?: boolean }) { }} onDelete={async () => { if ( - !props.narrow || + (!props.narrow && !isMobileScreen) || (await showConfirm(Locale.Home.DeleteChat)) ) { chatStore.deleteSession(i); diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 6fb497303eb..39abdd97b24 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -73,11 +73,10 @@ import { showPrompt, showToast, } from "./ui-lib"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { CHAT_PAGE_SIZE, LAST_INPUT_KEY, - MAX_RENDER_MSG_COUNT, Path, REQUEST_TIMEOUT_MS, UNFINISHED_INPUT, @@ -89,6 +88,7 @@ import { ChatCommandPrefix, useChatCommand, useCommand } from "../command"; import { prettyObject } from "../utils/format"; import { ExportMessageModal } from "./exporter"; import { getClientConfig } from "../config/client"; +import { useAllModels } from "../utils/hooks"; const Markdown = dynamic(async () => (await import("./markdown")).Markdown, { loading: () => , @@ -144,6 +144,7 @@ export function SessionConfigModel(props: { onClose: () => void }) { extraListItems={ session.mask.modelConfig.sendMemory ? ( @@ -430,16 +431,26 @@ export function ChatActions(props: { // switch model const currentModel = chatStore.currentSession().mask.modelConfig.model; + const allModels = useAllModels(); const models = useMemo( - () => - config - .allModels() - .filter((m) => m.available) - .map((m) => m.name), - [config], + () => allModels.filter((m) => m.available), + [allModels], ); const [showModelSelector, setShowModelSelector] = useState(false); + useEffect(() => { + // if current model is not available + // switch to first available model + const isUnavaliableModel = !models.some((m) => m.name === currentModel); + if (isUnavaliableModel && models.length > 0) { + const nextModel = models[0].name as ModelType; + chatStore.updateCurrentSession( + (session) => (session.mask.modelConfig.model = nextModel), + ); + showToast(nextModel); + } + }, [chatStore, currentModel, models]); + return (
{couldStop && ( @@ -519,8 +530,8 @@ export function ChatActions(props: { ({ - title: m, - value: m, + title: m.displayName, + value: m.name, }))} onClose={() => setShowModelSelector(false)} onSelection={(s) => { @@ -937,7 +948,7 @@ function _Chat() { const isTouchTopEdge = e.scrollTop <= edgeThreshold; const isTouchBottomEdge = bottomHeight >= e.scrollHeight - edgeThreshold; const isHitBottom = - bottomHeight >= e.scrollHeight - (isMobileScreen ? 0 : 10); + bottomHeight >= e.scrollHeight - (isMobileScreen ? 4 : 10); const prevPageMsgIndex = msgRenderIndex - CHAT_PAGE_SIZE; const nextPageMsgIndex = msgRenderIndex + CHAT_PAGE_SIZE; @@ -976,14 +987,17 @@ function _Chat() { doSubmit(text); }, code: (text) => { + if (accessStore.disableFastLink) return; console.log("[Command] got code from url: ", text); showConfirm(Locale.URLCommand.Code + `code = ${text}`).then((res) => { if (res) { - accessStore.updateCode(text); + accessStore.update((access) => (access.accessCode = text)); } }); }, settings: (text) => { + if (accessStore.disableFastLink) return; + try { const payload = JSON.parse(text) as { key?: string; @@ -999,10 +1013,12 @@ function _Chat() { ).then((res) => { if (!res) return; if (payload.key) { - accessStore.updateToken(payload.key); + accessStore.update( + (access) => (access.openaiApiKey = payload.key!), + ); } if (payload.url) { - accessStore.updateOpenAiUrl(payload.url); + accessStore.update((access) => (access.openaiUrl = payload.url!)); } }); } @@ -1155,7 +1171,18 @@ function _Chat() { {isUser ? ( ) : ( - + <> + {["system"].includes(message.role) ? ( + + ) : ( + + )} + )}
diff --git a/app/components/emoji.tsx b/app/components/emoji.tsx index 03aac05f278..a2a50320d7c 100644 --- a/app/components/emoji.tsx +++ b/app/components/emoji.tsx @@ -10,7 +10,10 @@ import BotIcon from "../icons/bot.svg"; import BlackBotIcon from "../icons/black-bot.svg"; export function getEmojiUrl(unified: string, style: EmojiStyle) { - return `https://cdn.staticfile.org/emoji-datasource-apple/14.0.0/img/${style}/64/${unified}.png`; + // Whoever owns this Content Delivery Network (CDN), I am using your CDN to serve emojis + // Old CDN broken, so I had to switch to this one + // Author: https://github.com/H0llyW00dzZ + return `https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/${style}/64/${unified}.png`; } export function AvatarPicker(props: { diff --git a/app/components/exporter.module.scss b/app/components/exporter.module.scss index c2046ffc09d..d3bfc81add1 100644 --- a/app/components/exporter.module.scss +++ b/app/components/exporter.module.scss @@ -186,7 +186,8 @@ box-shadow: var(--card-shadow); border: var(--border-in-light); - *:not(li) { + code, + pre { overflow: hidden; } } diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index 5b3e8a9a180..dff17e4abe3 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -1,5 +1,5 @@ /* eslint-disable @next/next/no-img-element */ -import { ChatMessage, useAppConfig, useChatStore } from "../store"; +import { ChatMessage, ModelType, useAppConfig, useChatStore } from "../store"; import Locale from "../locales"; import styles from "./exporter.module.scss"; import { @@ -27,12 +27,13 @@ import { Avatar } from "./emoji"; import dynamic from "next/dynamic"; import NextImage from "next/image"; -import { toBlob, toJpeg, toPng } from "html-to-image"; +import { toBlob, toPng } from "html-to-image"; import { DEFAULT_MASK_AVATAR } from "../store/mask"; -import { api } from "../client/api"; + import { prettyObject } from "../utils/format"; -import { EXPORT_MESSAGE_CLASS_NAME } from "../constant"; +import { EXPORT_MESSAGE_CLASS_NAME, ModelProvider } from "../constant"; import { getClientConfig } from "../config/client"; +import { ClientApi } from "../client/api"; const Markdown = dynamic(async () => (await import("./markdown")).Markdown, { loading: () => , @@ -41,7 +42,22 @@ const Markdown = dynamic(async () => (await import("./markdown")).Markdown, { export function ExportMessageModal(props: { onClose: () => void }) { return (
- + + {Locale.Exporter.Description.Title} +
+ } + >
@@ -149,7 +165,7 @@ export function MessageExporter() { if (exportConfig.includeContext) { ret.push(...session.mask.context); } - ret.push(...session.messages.filter((m, i) => selection.has(m.id))); + ret.push(...session.messages.filter((m) => selection.has(m.id))); return ret; }, [ exportConfig.includeContext, @@ -260,7 +276,8 @@ export function RenderExport(props: { }); props.onRender(renderMsgs); - }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); return (
@@ -285,10 +302,17 @@ export function PreviewActions(props: { }) { const [loading, setLoading] = useState(false); const [shouldExport, setShouldExport] = useState(false); - + const config = useAppConfig(); const onRenderMsgs = (msgs: ChatMessage[]) => { setShouldExport(false); + var api: ClientApi; + if (config.modelConfig.model === "gemini-pro") { + api = new ClientApi(ModelProvider.GeminiPro); + } else { + api = new ClientApi(ModelProvider.GPT); + } + api .share(msgs) .then((res) => { @@ -433,25 +457,55 @@ export function ImagePreviewer(props: { const isMobile = useMobileScreen(); - const download = () => { + const download = async () => { showToast(Locale.Export.Image.Toast); const dom = previewRef.current; if (!dom) return; - toPng(dom) - .then((blob) => { - if (!blob) return; - if (isMobile || getClientConfig()?.isApp) { - showImageModal(blob); + const isApp = getClientConfig()?.isApp; + + try { + const blob = await toPng(dom); + if (!blob) return; + + if (isMobile || (isApp && window.__TAURI__)) { + if (isApp && window.__TAURI__) { + const result = await window.__TAURI__.dialog.save({ + defaultPath: `${props.topic}.png`, + filters: [ + { + name: "PNG Files", + extensions: ["png"], + }, + { + name: "All Files", + extensions: ["*"], + }, + ], + }); + + if (result !== null) { + const response = await fetch(blob); + const buffer = await response.arrayBuffer(); + const uint8Array = new Uint8Array(buffer); + await window.__TAURI__.fs.writeBinaryFile(result, uint8Array); + showToast(Locale.Download.Success); + } else { + showToast(Locale.Download.Failed); + } } else { - const link = document.createElement("a"); - link.download = `${props.topic}.png`; - link.href = blob; - link.click(); - refreshPreview(); + showImageModal(blob); } - }) - .catch((e) => console.log("[Export Image] ", e)); + } else { + const link = document.createElement("a"); + link.download = `${props.topic}.png`; + link.href = blob; + link.click(); + refreshPreview(); + } + } catch (error) { + showToast(Locale.Download.Failed); + } }; const refreshPreview = () => { @@ -484,7 +538,7 @@ export function ImagePreviewer(props: {
-
ChatGPT Next Web
+
NextChat
github.com/Yidadaa/ChatGPT-Next-Web
@@ -574,8 +628,6 @@ export function MarkdownPreviewer(props: { ); } -// modified by BackTrackZ now it's looks better - export function JsonPreviewer(props: { messages: ChatMessage[]; topic: string; diff --git a/app/components/home.module.scss b/app/components/home.module.scss index dca20c674c8..68fe8f8fadb 100644 --- a/app/components/home.module.scss +++ b/app/components/home.module.scss @@ -6,7 +6,7 @@ color: var(--black); background-color: var(--white); min-width: 600px; - min-height: 480px; + min-height: 370px; max-width: 1200px; display: flex; diff --git a/app/components/home.tsx b/app/components/home.tsx index 745298d560e..4be7da0fbda 100644 --- a/app/components/home.tsx +++ b/app/components/home.tsx @@ -12,7 +12,7 @@ import LoadingIcon from "../icons/three-dots.svg"; import { getCSSVar, useMobileScreen } from "../utils"; import dynamic from "next/dynamic"; -import { Path, SlotID } from "../constant"; +import { ModelProvider, Path, SlotID } from "../constant"; import { ErrorBoundary } from "./error"; import { getISOLang, getLang } from "../locales"; @@ -27,7 +27,7 @@ import { SideBar } from "./sidebar"; import { useAppConfig } from "../store/config"; import { AuthPage } from "./auth"; import { getClientConfig } from "../config/client"; -import { api } from "../client/api"; +import { ClientApi } from "../client/api"; import { useAccessStore } from "../store"; export function Loading(props: { noLogo?: boolean }) { @@ -115,7 +115,10 @@ const loadAsyncGoogleFont = () => { getClientConfig()?.buildMode === "export" ? remoteFontUrl : proxyFontUrl; linkEl.rel = "stylesheet"; linkEl.href = - googleFontUrl + "/css2?family=Noto+Sans:wght@300;400;700;900&display=swap"; + googleFontUrl + + "/css2?family=" + + encodeURIComponent("Noto Sans:wght@300;400;700;900") + + "&display=swap"; document.head.appendChild(linkEl); }; @@ -125,6 +128,8 @@ function Screen() { const isHome = location.pathname === Path.Home; const isAuth = location.pathname === Path.Auth; const isMobileScreen = useMobileScreen(); + const shouldTightBorder = + getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen); useEffect(() => { loadAsyncGoogleFont(); @@ -134,11 +139,9 @@ function Screen() {
{isAuth ? ( @@ -167,6 +170,12 @@ function Screen() { export function useLoadData() { const config = useAppConfig(); + var api: ClientApi; + if (config.modelConfig.model === "gemini-pro") { + api = new ClientApi(ModelProvider.GeminiPro); + } else { + api = new ClientApi(ModelProvider.GPT); + } useEffect(() => { (async () => { const models = await api.llm.models(); diff --git a/app/components/markdown.tsx b/app/components/markdown.tsx index e7a35b8023b..f3a916cc535 100644 --- a/app/components/markdown.tsx +++ b/app/components/markdown.tsx @@ -5,13 +5,13 @@ import RemarkBreaks from "remark-breaks"; import RehypeKatex from "rehype-katex"; import RemarkGfm from "remark-gfm"; import RehypeHighlight from "rehype-highlight"; -import { useRef, useState, RefObject, useEffect } from "react"; +import { useRef, useState, RefObject, useEffect, useMemo } from "react"; import { copyToClipboard } from "../utils"; import mermaid from "mermaid"; import LoadingIcon from "../icons/three-dots.svg"; import React from "react"; -import { useDebouncedCallback, useThrottledCallback } from "use-debounce"; +import { useDebouncedCallback } from "use-debounce"; import { showImageModal } from "./ui-lib"; export function Mermaid(props: { code: string }) { @@ -99,7 +99,29 @@ export function PreCode(props: { children: any }) { ); } +function escapeDollarNumber(text: string) { + let escapedText = ""; + + for (let i = 0; i < text.length; i += 1) { + let char = text[i]; + const nextChar = text[i + 1] || " "; + + if (char === "$" && nextChar >= "0" && nextChar <= "9") { + char = "\\$"; + } + + escapedText += char; + } + + return escapedText; +} + function _MarkDownContent(props: { content: string }) { + const escapedContent = useMemo( + () => escapeDollarNumber(props.content), + [props.content], + ); + return ( - {props.content} + {escapedContent} ); } @@ -151,6 +173,7 @@ export function Markdown( ref={mdRef} onContextMenu={props.onContextMenu} onDoubleClickCapture={props.onDoubleClickCapture} + dir="auto" > {props.loading ? ( diff --git a/app/components/mask.tsx b/app/components/mask.tsx index 1ee1c239a74..3f616c3ac15 100644 --- a/app/components/mask.tsx +++ b/app/components/mask.tsx @@ -18,6 +18,7 @@ import { ChatMessage, createMessage, ModelConfig, + ModelType, useAppConfig, useChatStore, } from "../store"; @@ -58,11 +59,11 @@ function reorder(list: T[], startIndex: number, endIndex: number): T[] { return result; } -export function MaskAvatar(props: { mask: Mask }) { - return props.mask.avatar !== DEFAULT_MASK_AVATAR ? ( - +export function MaskAvatar(props: { avatar: string; model?: ModelType }) { + return props.avatar !== DEFAULT_MASK_AVATAR ? ( + ) : ( - + ); } @@ -123,7 +124,10 @@ export function MaskConfig(props: { onClick={() => setShowPicker(true)} style={{ cursor: "pointer" }} > - +
@@ -393,11 +397,13 @@ export function MaskPage() { const [searchText, setSearchText] = useState(""); const masks = searchText.length > 0 ? searchMasks : allMasks; - // simple search, will refactor later + // refactored already, now it accurate const onSearch = (text: string) => { setSearchText(text); if (text.length > 0) { - const result = allMasks.filter((m) => m.name.includes(text)); + const result = allMasks.filter((m) => + m.name.toLowerCase().includes(text.toLowerCase()), + ); setSearchMasks(result); } else { setSearchMasks(allMasks); @@ -521,7 +527,7 @@ export function MaskPage() {
- +
{m.name}
diff --git a/app/components/message-selector.module.scss b/app/components/message-selector.module.scss index b4ba1a1412a..c8defb6b027 100644 --- a/app/components/message-selector.module.scss +++ b/app/components/message-selector.module.scss @@ -58,8 +58,8 @@ } .body { - flex-grow: 1; - max-width: calc(100% - 40px); + flex: 1; + max-width: calc(100% - 80px); .date { font-size: 12px; @@ -71,6 +71,12 @@ font-size: 12px; } } + + .checkbox { + display: flex; + justify-content: flex-end; + flex: 1; + } } } } diff --git a/app/components/message-selector.tsx b/app/components/message-selector.tsx index cadf52e643e..c2015340139 100644 --- a/app/components/message-selector.tsx +++ b/app/components/message-selector.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { ChatMessage, useAppConfig, useChatStore } from "../store"; import { Updater } from "../typing"; import { IconButton } from "./button"; @@ -73,11 +73,23 @@ export function MessageSelector(props: { const chatStore = useChatStore(); const session = chatStore.currentSession(); const isValid = (m: ChatMessage) => m.content && !m.isError && !m.streaming; - const messages = session.messages.filter( - (m, i) => - m.id && // message must have id - isValid(m) && - (i >= session.messages.length - 1 || isValid(session.messages[i + 1])), + const allMessages = useMemo(() => { + let startIndex = Math.max(0, session.clearContextIndex ?? 0); + if (startIndex === session.messages.length - 1) { + startIndex = 0; + } + return session.messages.slice(startIndex); + }, [session.messages, session.clearContextIndex]); + + const messages = useMemo( + () => + allMessages.filter( + (m, i) => + m.id && // message must have id + isValid(m) && + (i >= allMessages.length - 1 || isValid(allMessages[i + 1])), + ), + [allMessages], ); const messageCount = messages.length; const config = useAppConfig(); @@ -176,6 +188,8 @@ export function MessageSelector(props: {
{messages.map((m, i) => { if (!isInSearchResult(m.id!)) return null; + const id = m.id ?? i; + const isSelected = props.selection.has(id); return (
{ props.updateSelection((selection) => { - const id = m.id ?? i; selection.has(id) ? selection.delete(id) : selection.add(id); }); onClickIndex(i); @@ -195,7 +208,10 @@ export function MessageSelector(props: { {m.role === "user" ? ( ) : ( - + )}
@@ -206,6 +222,10 @@ export function MessageSelector(props: { {m.content}
+ +
+ +
); })} diff --git a/app/components/model-config.tsx b/app/components/model-config.tsx index 63950a40d04..b9f8116747e 100644 --- a/app/components/model-config.tsx +++ b/app/components/model-config.tsx @@ -1,14 +1,15 @@ -import { ModalConfigValidator, ModelConfig, useAppConfig } from "../store"; +import { ModalConfigValidator, ModelConfig } from "../store"; import Locale from "../locales"; import { InputRange } from "./input-range"; import { ListItem, Select } from "./ui-lib"; +import { useAllModels } from "../utils/hooks"; export function ModelConfigList(props: { modelConfig: ModelConfig; updateConfig: (updater: (config: ModelConfig) => void) => void; }) { - const config = useAppConfig(); + const allModels = useAllModels(); return ( <> @@ -24,11 +25,13 @@ export function ModelConfigList(props: { ); }} > - {config.allModels().map((v, i) => ( - - ))} + {allModels + .filter((v) => v.available) + .map((v, i) => ( + + ))} props.updateConfig( @@ -88,79 +91,84 @@ export function ModelConfigList(props: { } > - - { - props.updateConfig( - (config) => - (config.presence_penalty = - ModalConfigValidator.presence_penalty( - e.currentTarget.valueAsNumber, - )), - ); - }} - > - - - { - props.updateConfig( - (config) => - (config.frequency_penalty = - ModalConfigValidator.frequency_penalty( - e.currentTarget.valueAsNumber, - )), - ); - }} - > - + {props.modelConfig.model === "gemini-pro" ? null : ( + <> + + { + props.updateConfig( + (config) => + (config.presence_penalty = + ModalConfigValidator.presence_penalty( + e.currentTarget.valueAsNumber, + )), + ); + }} + > + - - - props.updateConfig( - (config) => - (config.enableInjectSystemPrompts = e.currentTarget.checked), - ) - } - > - + + { + props.updateConfig( + (config) => + (config.frequency_penalty = + ModalConfigValidator.frequency_penalty( + e.currentTarget.valueAsNumber, + )), + ); + }} + > + - - - props.updateConfig( - (config) => (config.template = e.currentTarget.value), - ) - } - > - + + + props.updateConfig( + (config) => + (config.enableInjectSystemPrompts = + e.currentTarget.checked), + ) + } + > + + + + props.updateConfig( + (config) => (config.template = e.currentTarget.value), + ) + } + > + + + )} void }) { return (
- +
{props.mask.name}
); diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 9de603bb30e..409af64d3b9 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -12,6 +12,12 @@ import EditIcon from "../icons/edit.svg"; import EyeIcon from "../icons/eye.svg"; import DownloadIcon from "../icons/download.svg"; import UploadIcon from "../icons/upload.svg"; +import ConfigIcon from "../icons/config.svg"; +import ConfirmIcon from "../icons/confirm.svg"; + +import ConnectionIcon from "../icons/connection.svg"; +import CloudSuccessIcon from "../icons/cloud-success.svg"; +import CloudFailIcon from "../icons/cloud-fail.svg"; import { Input, @@ -44,7 +50,17 @@ import Locale, { } from "../locales"; import { copyToClipboard } from "../utils"; import Link from "next/link"; -import { Path, RELEASE_URL, UPDATE_URL } from "../constant"; +import { + Azure, + Google, + OPENAI_BASE_URL, + Path, + RELEASE_URL, + STORAGE_KEY, + ServiceProvider, + SlotID, + UPDATE_URL, +} from "../constant"; import { Prompt, SearchService, usePromptStore } from "../store/prompt"; import { ErrorBoundary } from "./error"; import { InputRange } from "./input-range"; @@ -54,6 +70,7 @@ import { getClientConfig } from "../config/client"; import { useSyncStore } from "../store/sync"; import { nanoid } from "nanoid"; import { useMaskStore } from "../store/mask"; +import { ProviderType } from "../utils/cloud"; function EditPromptModal(props: { id: string; onClose: () => void }) { const promptStore = usePromptStore(); @@ -247,12 +264,218 @@ function DangerItems() { ); } +function CheckButton() { + const syncStore = useSyncStore(); + + const couldCheck = useMemo(() => { + return syncStore.coundSync(); + }, [syncStore]); + + const [checkState, setCheckState] = useState< + "none" | "checking" | "success" | "failed" + >("none"); + + async function check() { + setCheckState("checking"); + const valid = await syncStore.check(); + setCheckState(valid ? "success" : "failed"); + } + + if (!couldCheck) return null; + + return ( + + ) : checkState === "checking" ? ( + + ) : checkState === "success" ? ( + + ) : checkState === "failed" ? ( + + ) : ( + + ) + } + > + ); +} + +function SyncConfigModal(props: { onClose?: () => void }) { + const syncStore = useSyncStore(); + + return ( +
+ props.onClose?.()} + actions={[ + , + } + bordered + text={Locale.UI.Confirm} + />, + ]} + > + + + + + + + { + syncStore.update( + (config) => (config.useProxy = e.currentTarget.checked), + ); + }} + > + + {syncStore.useProxy ? ( + + { + syncStore.update( + (config) => (config.proxyUrl = e.currentTarget.value), + ); + }} + > + + ) : null} + + + {syncStore.provider === ProviderType.WebDAV && ( + <> + + + { + syncStore.update( + (config) => + (config.webdav.endpoint = e.currentTarget.value), + ); + }} + > + + + + { + syncStore.update( + (config) => + (config.webdav.username = e.currentTarget.value), + ); + }} + > + + + { + syncStore.update( + (config) => + (config.webdav.password = e.currentTarget.value), + ); + }} + > + + + + )} + + {syncStore.provider === ProviderType.UpStash && ( + + + { + syncStore.update( + (config) => + (config.upstash.endpoint = e.currentTarget.value), + ); + }} + > + + + + { + syncStore.update( + (config) => + (config.upstash.username = e.currentTarget.value), + ); + }} + > + + + { + syncStore.update( + (config) => (config.upstash.apiKey = e.currentTarget.value), + ); + }} + > + + + )} + +
+ ); +} + function SyncItems() { const syncStore = useSyncStore(); - const webdav = syncStore.webDavConfig; const chatStore = useChatStore(); const promptStore = usePromptStore(); const maskStore = useMaskStore(); + const couldSync = useMemo(() => { + return syncStore.coundSync(); + }, [syncStore]); + + const [showSyncConfigModal, setShowSyncConfigModal] = useState(false); const stateOverview = useMemo(() => { const sessions = chatStore.sessions; @@ -267,42 +490,71 @@ function SyncItems() { }, [chatStore.sessions, maskStore.masks, promptStore.prompts]); return ( - - - } - text={Locale.UI.Sync} - onClick={() => { - showToast(Locale.WIP); - }} - /> - + <> + + +
+ } + text={Locale.UI.Config} + onClick={() => { + setShowSyncConfigModal(true); + }} + /> + {couldSync && ( + } + text={Locale.UI.Sync} + onClick={async () => { + try { + await syncStore.sync(); + showToast(Locale.Settings.Sync.Success); + } catch (e) { + showToast(Locale.Settings.Sync.Fail); + console.error("[Sync]", e); + } + }} + /> + )} +
+
- -
- } - text={Locale.UI.Export} - onClick={() => { - syncStore.export(); - }} - /> - } - text={Locale.UI.Import} - onClick={() => { - syncStore.import(); - }} - /> -
-
-
+ +
+ } + text={Locale.UI.Export} + onClick={() => { + syncStore.export(); + }} + /> + } + text={Locale.UI.Import} + onClick={() => { + syncStore.import(); + }} + /> +
+
+
+ + {showSyncConfigModal && ( + setShowSyncConfigModal(false)} /> + )} + ); } @@ -329,13 +581,28 @@ export function Settings() { console.log("[Update] remote version ", updateStore.remoteVersion); } + const accessStore = useAccessStore(); + const shouldHideBalanceQuery = useMemo(() => { + const isOpenAiUrl = accessStore.openaiUrl.includes(OPENAI_BASE_URL); + + return ( + accessStore.hideBalanceQuery || + isOpenAiUrl || + accessStore.provider === ServiceProvider.Azure + ); + }, [ + accessStore.hideBalanceQuery, + accessStore.openaiUrl, + accessStore.provider, + ]); + const usage = { used: updateStore.used, subscription: updateStore.subscription, }; const [loadingUsage, setLoadingUsage] = useState(false); function checkUsage(force = false) { - if (accessStore.hideBalanceQuery) { + if (shouldHideBalanceQuery) { return; } @@ -345,7 +612,6 @@ export function Settings() { }); } - const accessStore = useAccessStore(); const enabledAccessControl = useMemo( () => accessStore.enabledAccessControl(), // eslint-disable-next-line react-hooks/exhaustive-deps @@ -371,6 +637,12 @@ export function Settings() { navigate(Path.Home); } }; + if (clientConfig?.isApp) { + // Force to set custom endpoint to true if it's app + accessStore.update((state) => { + state.useCustomConfig = true; + }); + } document.addEventListener("keydown", keydownEvent); return () => { document.removeEventListener("keydown", keydownEvent); @@ -511,7 +783,7 @@ export function Settings() { title={`${config.fontSize ?? 14}px`} value={config.fontSize} min="12" - max="18" + max="40" step="1" onChange={(e) => updateConfig( @@ -624,57 +896,235 @@ export function Settings() {
- - {showAccessCode ? ( + + {showAccessCode && ( { - accessStore.updateCode(e.currentTarget.value); + accessStore.update( + (access) => (access.accessCode = e.currentTarget.value), + ); }} /> - ) : ( - <> )} - {!accessStore.hideUserApiKey ? ( + {!accessStore.hideUserApiKey && ( <> - - - accessStore.updateOpenAiUrl(e.currentTarget.value) - } - > - - - { - accessStore.updateToken(e.currentTarget.value); - }} - /> - + { + // Conditionally render the following ListItem based on clientConfig.isApp + !clientConfig?.isApp && ( // only show if isApp is false + + + accessStore.update( + (access) => + (access.useCustomConfig = e.currentTarget.checked), + ) + } + > + + ) + } + {accessStore.useCustomConfig && ( + <> + + + + + {accessStore.provider === "OpenAI" ? ( + <> + + + accessStore.update( + (access) => + (access.openaiUrl = e.currentTarget.value), + ) + } + > + + + { + accessStore.update( + (access) => + (access.openaiApiKey = e.currentTarget.value), + ); + }} + /> + + + ) : accessStore.provider === "Azure" ? ( + <> + + + accessStore.update( + (access) => + (access.azureUrl = e.currentTarget.value), + ) + } + > + + + { + accessStore.update( + (access) => + (access.azureApiKey = e.currentTarget.value), + ); + }} + /> + + + + accessStore.update( + (access) => + (access.azureApiVersion = + e.currentTarget.value), + ) + } + > + + + ) : accessStore.provider === "Google" ? ( + <> + + + accessStore.update( + (access) => + (access.googleUrl = e.currentTarget.value), + ) + } + > + + + { + accessStore.update( + (access) => + (access.googleApiKey = e.currentTarget.value), + ); + }} + /> + + + + accessStore.update( + (access) => + (access.googleApiVersion = + e.currentTarget.value), + ) + } + > + + + ) : null} + + )} - ) : null} + )} - {!accessStore.hideBalanceQuery ? ( + {!shouldHideBalanceQuery && !clientConfig?.isApp ? ( { - if (Date.now() < lastUpdateTime.current + 50) { - return; - } - lastUpdateTime.current = Date.now(); - const d = e.clientX - startX.current; - const nextWidth = limit(startDragWidth.current + d); - config.update((config) => (config.sidebarWidth = nextWidth)); - }); - - const handleMouseUp = useRef(() => { - startDragWidth.current = config.sidebarWidth ?? 300; - window.removeEventListener("mousemove", handleMouseMove.current); - window.removeEventListener("mouseup", handleMouseUp.current); - }); + const toggleSideBar = () => { + config.update((config) => { + if (config.sidebarWidth < MIN_SIDEBAR_WIDTH) { + config.sidebarWidth = DEFAULT_SIDEBAR_WIDTH; + } else { + config.sidebarWidth = NARROW_SIDEBAR_WIDTH; + } + }); + }; - const onDragMouseDown = (e: MouseEvent) => { + const onDragStart = (e: MouseEvent) => { + // Remembers the initial width each time the mouse is pressed startX.current = e.clientX; + startDragWidth.current = config.sidebarWidth; + const dragStartTime = Date.now(); + + const handleDragMove = (e: MouseEvent) => { + if (Date.now() < lastUpdateTime.current + 20) { + return; + } + lastUpdateTime.current = Date.now(); + const d = e.clientX - startX.current; + const nextWidth = limit(startDragWidth.current + d); + config.update((config) => { + if (nextWidth < MIN_SIDEBAR_WIDTH) { + config.sidebarWidth = NARROW_SIDEBAR_WIDTH; + } else { + config.sidebarWidth = nextWidth; + } + }); + }; + + const handleDragEnd = () => { + // In useRef the data is non-responsive, so `config.sidebarWidth` can't get the dynamic sidebarWidth + window.removeEventListener("pointermove", handleDragMove); + window.removeEventListener("pointerup", handleDragEnd); + + // if user click the drag icon, should toggle the sidebar + const shouldFireClick = Date.now() - dragStartTime < 300; + if (shouldFireClick) { + toggleSideBar(); + } + }; - window.addEventListener("mousemove", handleMouseMove.current); - window.addEventListener("mouseup", handleMouseUp.current); + window.addEventListener("pointermove", handleDragMove); + window.addEventListener("pointerup", handleDragEnd); }; + const isMobileScreen = useMobileScreen(); const shouldNarrow = !isMobileScreen && config.sidebarWidth < MIN_SIDEBAR_WIDTH; @@ -89,13 +117,13 @@ function useDragSideBar() { useEffect(() => { const barWidth = shouldNarrow ? NARROW_SIDEBAR_WIDTH - : limit(config.sidebarWidth ?? 300); + : limit(config.sidebarWidth ?? DEFAULT_SIDEBAR_WIDTH); const sideBarWidth = isMobileScreen ? "100vw" : `${barWidth}px`; document.documentElement.style.setProperty("--sidebar-width", sideBarWidth); }, [config.sidebarWidth, isMobileScreen, shouldNarrow]); return { - onDragMouseDown, + onDragStart, shouldNarrow, }; } @@ -104,9 +132,14 @@ export function SideBar(props: { className?: string }) { const chatStore = useChatStore(); // drag side bar - const { onDragMouseDown, shouldNarrow } = useDragSideBar(); + const { onDragStart, shouldNarrow } = useDragSideBar(); const navigate = useNavigate(); const config = useAppConfig(); + const isMobileScreen = useMobileScreen(); + const isIOSMobile = useMemo( + () => isIOS() && isMobileScreen, + [isMobileScreen], + ); useHotKey(); @@ -115,10 +148,14 @@ export function SideBar(props: { className?: string }) { className={`${styles.sidebar} ${props.className} ${ shouldNarrow && styles["narrow-sidebar"] }`} + style={{ + // #3016 disable transition on ios mobile screen + transition: isMobileScreen && isIOSMobile ? "none" : undefined, + }} >
- ChatGPT By SuperDeng + ChatGPT By SuperDeng
知者不惑,仁者不忧,勇者不惧。 @@ -133,7 +170,13 @@ export function SideBar(props: { className?: string }) { icon={} text={shouldNarrow ? undefined : Locale.Mask.Name} className={styles["sidebar-bar-button"]} - onClick={() => navigate(Path.NewChat, { state: { fromHome: true } })} + onClick={() => { + if (config.dontShowMaskSplashScreen !== true) { + navigate(Path.NewChat, { state: { fromHome: true } }); + } else { + navigate(Path.Masks, { state: { fromHome: true } }); + } + }} shadow />
} + icon={} onClick={async () => { if (await showConfirm(Locale.Home.DeleteChat)) { chatStore.deleteSession(chatStore.currentSessionIndex); @@ -193,7 +236,7 @@ export function SideBar(props: { className?: string }) {
onDragMouseDown(e as any)} + onPointerDown={(e) => onDragStart(e as any)} >
diff --git a/app/components/ui-lib.module.scss b/app/components/ui-lib.module.scss index 7742e9d0d9d..c67d352bee1 100644 --- a/app/components/ui-lib.module.scss +++ b/app/components/ui-lib.module.scss @@ -235,7 +235,7 @@ .select-with-icon-select { height: 100%; border: var(--border-in-light); - padding: 10px 25px 10px 10px; + padding: 10px 35px 10px 10px; border-radius: 10px; appearance: none; cursor: pointer; diff --git a/app/components/ui-lib.tsx b/app/components/ui-lib.tsx index 7025daf7e7f..f7e326fd318 100644 --- a/app/components/ui-lib.tsx +++ b/app/components/ui-lib.tsx @@ -70,14 +70,12 @@ export function ListItem(props: { ); } -export function List(props: { - children: - | Array - | JSX.Element - | null - | undefined; -}) { - return
{props.children}
; +export function List(props: { children: React.ReactNode; id?: string }) { + return ( +
+ {props.children} +
+ ); } export function Loading() { @@ -99,8 +97,9 @@ export function Loading() { interface ModalProps { title: string; children?: any; - actions?: JSX.Element[]; + actions?: React.ReactNode[]; defaultMax?: boolean; + footer?: React.ReactNode; onClose?: () => void; } export function Modal(props: ModalProps) { @@ -149,6 +148,7 @@ export function Modal(props: ModalProps) {
{props.children}
+ {props.footer}
{props.actions?.map((action, i) => (
diff --git a/app/config/server.ts b/app/config/server.ts index 6eab9ebecc0..c455d0b7336 100644 --- a/app/config/server.ts +++ b/app/config/server.ts @@ -1,18 +1,35 @@ import md5 from "spark-md5"; +import { DEFAULT_MODELS } from "../constant"; declare global { namespace NodeJS { interface ProcessEnv { + PROXY_URL?: string; // docker only + OPENAI_API_KEY?: string; CODE?: string; + BASE_URL?: string; - PROXY_URL?: string; + OPENAI_ORG_ID?: string; // openai only + VERCEL?: string; - HIDE_USER_API_KEY?: string; // disable user's api key input - DISABLE_GPT4?: string; // allow user to use gpt-4 or not BUILD_MODE?: "standalone" | "export"; BUILD_APP?: string; // is building desktop app - HIDE_BALANCE_QUERY?: string; // allow user to query balance or not + + HIDE_USER_API_KEY?: string; // disable user's api key input + DISABLE_GPT4?: string; // allow user to use gpt-4 or not + ENABLE_BALANCE_QUERY?: string; // allow user to query balance or not + DISABLE_FAST_LINK?: string; // disallow parse settings from url or not + CUSTOM_MODELS?: string; // to control custom models + + // azure only + AZURE_URL?: string; // https://{azure-url}/openai/deployments/{deploy-name} + AZURE_API_KEY?: string; + AZURE_API_VERSION?: string; + + // google only + GOOGLE_API_KEY?: string; + GOOGLE_URL?: string; } } } @@ -37,16 +54,54 @@ export const getServerSideConfig = () => { ); } + const disableGPT4 = !!process.env.DISABLE_GPT4; + let customModels = process.env.CUSTOM_MODELS ?? ""; + + if (disableGPT4) { + if (customModels) customModels += ","; + customModels += DEFAULT_MODELS.filter((m) => m.name.startsWith("gpt-4")) + .map((m) => "-" + m.name) + .join(","); + } + + const isAzure = !!process.env.AZURE_URL; + const isGoogle = !!process.env.GOOGLE_API_KEY; + + const apiKeyEnvVar = process.env.OPENAI_API_KEY ?? ""; + const apiKeys = apiKeyEnvVar.split(",").map((v) => v.trim()); + const randomIndex = Math.floor(Math.random() * apiKeys.length); + const apiKey = apiKeys[randomIndex]; + console.log( + `[Server Config] using ${randomIndex + 1} of ${apiKeys.length} api key`, + ); + return { - apiKey: process.env.OPENAI_API_KEY, + baseUrl: process.env.BASE_URL, + apiKey, + openaiOrgId: process.env.OPENAI_ORG_ID, + + isAzure, + azureUrl: process.env.AZURE_URL, + azureApiKey: process.env.AZURE_API_KEY, + azureApiVersion: process.env.AZURE_API_VERSION, + + isGoogle, + googleApiKey: process.env.GOOGLE_API_KEY, + googleUrl: process.env.GOOGLE_URL, + + gtmId: process.env.GTM_ID, + + needCode: ACCESS_CODES.size > 0, code: process.env.CODE, codes: ACCESS_CODES, - needCode: ACCESS_CODES.size > 0, - baseUrl: process.env.BASE_URL, + proxyUrl: process.env.PROXY_URL, isVercel: !!process.env.VERCEL, + hideUserApiKey: !!process.env.HIDE_USER_API_KEY, - disableGPT4: !!process.env.DISABLE_GPT4, - hideBalanceQuery: !!process.env.HIDE_BALANCE_QUERY, + disableGPT4, + hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY, + disableFastLink: !!process.env.DISABLE_FAST_LINK, + customModels, }; }; diff --git a/app/constant.ts b/app/constant.ts index bf8e7cc0c95..52d1e5c2ab2 100644 --- a/app/constant.ts +++ b/app/constant.ts @@ -7,7 +7,12 @@ export const RELEASE_URL = `${REPO_URL}/releases`; 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`; export const RUNTIME_CONFIG_DOM = "danger-runtime-config"; -export const DEFAULT_API_HOST = "https://chatgpt1.nextweb.fun/api/proxy"; + +export const DEFAULT_CORS_HOST = "https://a.nextweb.fun"; +export const DEFAULT_API_HOST = `${DEFAULT_CORS_HOST}/api/proxy`; +export const OPENAI_BASE_URL = "https://api.openai.com"; + +export const GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/"; export enum Path { Home = "/", @@ -18,8 +23,14 @@ export enum Path { Auth = "/auth", } +export enum ApiPath { + Cors = "/api/cors", + OpenAI = "/api/openai", +} + export enum SlotID { AppBody = "app-body", + CustomModel = "custom-model", } export enum FileName { @@ -37,6 +48,7 @@ export enum StoreKey { Sync = "sync", } +export const DEFAULT_SIDEBAR_WIDTH = 300; export const MAX_SIDEBAR_WIDTH = 500; export const MIN_SIDEBAR_WIDTH = 230; export const NARROW_SIDEBAR_WIDTH = 100; @@ -46,10 +58,23 @@ export const ACCESS_CODE_PREFIX = "nk-"; export const LAST_INPUT_KEY = "last-input"; export const UNFINISHED_INPUT = (id: string) => "unfinished-input-" + id; +export const STORAGE_KEY = "chatgpt-next-web"; + export const REQUEST_TIMEOUT_MS = 60000; export const EXPORT_MESSAGE_CLASS_NAME = "export-markdown"; +export enum ServiceProvider { + OpenAI = "OpenAI", + Azure = "Azure", + Google = "Google", +} + +export enum ModelProvider { + GPT = "GPT", + GeminiPro = "GeminiPro", +} + export const OpenaiPath = { ChatPath: "v1/chat/completions", UsagePath: "dashboard/billing/usage", @@ -57,59 +82,170 @@ export const OpenaiPath = { ListModelPath: "v1/models", }; +export const Azure = { + ExampleEndpoint: "https://{resource-url}/openai/deployments/{deploy-id}", +}; + +export const Google = { + ExampleEndpoint: "https://generativelanguage.googleapis.com/", + ChatPath: "v1beta/models/gemini-pro:generateContent", + + // /api/openai/v1/chat/completions +}; + export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang export const DEFAULT_SYSTEM_TEMPLATE = ` You are ChatGPT, a large language model trained by OpenAI. -Knowledge cutoff: 2021-09 +Knowledge cutoff: {{cutoff}} Current model: {{model}} -Current time: {{time}}`; +Current time: {{time}} +Latex inline: $x^2$ +Latex block: $$e=mc^2$$ +`; export const SUMMARIZE_MODEL = "gpt-3.5-turbo"; +export const KnowledgeCutOffDate: Record = { + default: "2021-09", + "gpt-4-1106-preview": "2023-04", + "gpt-4-vision-preview": "2023-04", +}; + export const DEFAULT_MODELS = [ { name: "gpt-4", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-4-0314", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-4-0613", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-4-32k", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-4-32k-0314", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-4-32k-0613", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, + { + name: "gpt-4-1106-preview", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, + { + name: "gpt-4-vision-preview", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-3.5-turbo", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-3.5-turbo-0301", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-3.5-turbo-0613", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, + { + name: "gpt-3.5-turbo-1106", + available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-3.5-turbo-16k", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, }, { name: "gpt-3.5-turbo-16k-0613", available: true, + provider: { + id: "openai", + providerName: "OpenAI", + providerType: "openai", + }, + }, + { + name: "gemini-pro", + available: true, + provider: { + id: "google", + providerName: "Google", + providerType: "google", + }, }, ] as const; diff --git a/app/global.d.ts b/app/global.d.ts index 524ce77dbc6..e0a2c3f0686 100644 --- a/app/global.d.ts +++ b/app/global.d.ts @@ -13,5 +13,17 @@ declare module "*.svg"; declare interface Window { __TAURI__?: { writeText(text: string): Promise; + invoke(command: string, payload?: Record): Promise; + dialog: { + save(options?: Record): Promise; + }; + fs: { + writeBinaryFile(path: string, data: Uint8Array): Promise; + }; + notification:{ + requestPermission(): Promise; + isPermissionGranted(): Promise; + sendNotification(options: string | Options): void; + }; }; } diff --git a/app/icons/cloud-fail.svg b/app/icons/cloud-fail.svg new file mode 100644 index 00000000000..6e6a35fe5f2 --- /dev/null +++ b/app/icons/cloud-fail.svg @@ -0,0 +1 @@ + diff --git a/app/icons/cloud-success.svg b/app/icons/cloud-success.svg new file mode 100644 index 00000000000..8c5f3d6fd14 --- /dev/null +++ b/app/icons/cloud-success.svg @@ -0,0 +1 @@ + diff --git a/app/icons/config.svg b/app/icons/config.svg new file mode 100644 index 00000000000..7e1d23a272c --- /dev/null +++ b/app/icons/config.svg @@ -0,0 +1 @@ + diff --git a/app/icons/connection.svg b/app/icons/connection.svg new file mode 100644 index 00000000000..03687302031 --- /dev/null +++ b/app/icons/connection.svg @@ -0,0 +1 @@ + diff --git a/app/layout.tsx b/app/layout.tsx index 1cb1d9734ee..0a04b58b3ea 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -4,6 +4,10 @@ import "./styles/markdown.scss"; import "./styles/highlight.scss"; import { getClientConfig } from "./config/client"; import { type Metadata } from "next"; +import { SpeedInsights } from "@vercel/speed-insights/next"; +import { getServerSideConfig } from "./config/server"; +import { GoogleTagManager } from "@next/third-parties/google"; +const serverConfig = getServerSideConfig(); export const metadata: Metadata = { title: "ChatGPT By SuperDeng", @@ -35,7 +39,19 @@ export default function RootLayout({ - {children} + + {children} + {serverConfig?.isVercel && ( + <> + + + )} + {serverConfig?.gtmId && ( + <> + + + )} + ); } diff --git a/app/locales/ar.ts b/app/locales/ar.ts index 520cb26356e..b58c3a2e8e5 100644 --- a/app/locales/ar.ts +++ b/app/locales/ar.ts @@ -10,6 +10,7 @@ const ar: PartialLocaleType = { Auth: { Title: "تحتاج إلى رمز الوصول", Tips: "يرجى إدخال رمز الوصول أدناه", + SubTips: "أو أدخل مفتاح واجهة برمجة تطبيقات OpenAI الخاص بك", Input: "رمز الوصول", Confirm: "تأكيد", Later: "لاحقًا", @@ -166,11 +167,7 @@ ${builtin} مدمجة، ${custom} تم تعريفها من قبل المستخد Title: "حد الضغط للتاريخ", SubTitle: "سيتم الضغط إذا تجاوزت طول الرسائل غير المضغوطة الحد المحدد", }, - Token: { - Title: "مفتاح API", - SubTitle: "استخدم مفتاحك لتجاوز حد رمز الوصول", - Placeholder: "مفتاح OpenAI API", - }, + Usage: { Title: "رصيد الحساب", SubTitle(used: any, total: any) { @@ -180,15 +177,7 @@ ${builtin} مدمجة، ${custom} تم تعريفها من قبل المستخد Check: "التحقق", NoAccess: "أدخل مفتاح API للتحقق من الرصيد", }, - AccessCode: { - Title: "رمز الوصول", - SubTitle: "تم تمكين التحكم في الوصول", - Placeholder: "رمز الوصول المطلوب", - }, - Endpoint: { - Title: "نقطة النهاية", - SubTitle: "يجب أن تبدأ نقطة النهاية المخصصة بـ http(s)://", - }, + Model: "النموذج", Temperature: { Title: "الحرارة", diff --git a/app/locales/bn.ts b/app/locales/bn.ts index 2d2266b3f43..6dfb0da9bc4 100644 --- a/app/locales/bn.ts +++ b/app/locales/bn.ts @@ -10,6 +10,7 @@ const bn: PartialLocaleType = { Auth: { Title: "একটি অ্যাক্সেস কোড প্রয়োজন", Tips: "নীচে অ্যাক্সেস কোড ইনপুট করুন", + SubTips: "অথবা আপনার OpenAI API কী প্রবেশ করুন", Input: "অ্যাক্সেস কোড", Confirm: "নিশ্চিত করুন", Later: "পরে", @@ -198,11 +199,7 @@ const bn: PartialLocaleType = { SubTitle: "নকুল বার্তা দৈর্ঘ্য সীমা অতিক্রান্ত হলে ঐ বার্তাটি সঙ্কুচিত হবে", }, - Token: { - Title: "অ্যাপি কী", - SubTitle: "অ্যাক্সেস কোড সীমা উপেক্ষা করতে আপনার কীটি ব্যবহার করুন", - Placeholder: "OpenAI API কী", - }, + Usage: { Title: "একাউন্ট ব্যালেন্স", SubTitle(used: any, total: any) { @@ -212,15 +209,7 @@ const bn: PartialLocaleType = { Check: "চেক", NoAccess: "ব্যালেন্স চেক করতে অ্যাপি কী ইনপুট করুন", }, - AccessCode: { - Title: "অ্যাক্সেস কোড", - SubTitle: "অ্যাক্সেস নিয়ন্ত্রণ সক্রিয়", - Placeholder: "অ্যাক্সেস কোড প্রয়োজন", - }, - Endpoint: { - Title: "ইনটারপয়েন্ট", - SubTitle: "কাস্টম এন্ডপয়েন্টটি হতে হবে http(s):// দিয়ে শুরু হতে হবে", - }, + Model: "মডেল", Temperature: { Title: "তাপমাত্রা", diff --git a/app/locales/cn.ts b/app/locales/cn.ts index a1753417aa7..4a92b63833a 100644 --- a/app/locales/cn.ts +++ b/app/locales/cn.ts @@ -13,6 +13,7 @@ const cn = { Auth: { Title: "需要密码", Tips: "管理员开启了密码验证,请在下方填入访问码", + SubTips: "或者输入你的 OpenAI 或 Google API 密钥", Input: "在此处填写访问码", Confirm: "确认", Later: "稍后再说", @@ -84,8 +85,8 @@ const cn = { Copy: "全部复制", Download: "下载文件", Share: "分享到 ShareGPT", - MessageFromYou: "来自你的消息", - MessageFromChatGPT: "来自 ChatGPT 的消息", + MessageFromYou: "用户", + MessageFromChatGPT: "ChatGPT", Format: { Title: "导出格式", SubTitle: "可以导出 Markdown 文本或者 PNG 图片", @@ -179,7 +180,42 @@ const cn = { SubTitle: "根据对话内容生成合适的标题", }, Sync: { - LastUpdate: "上次同步", + CloudState: "云端数据", + NotSyncYet: "还没有进行过同步", + Success: "同步成功", + Fail: "同步失败", + + Config: { + Modal: { + Title: "配置云同步", + Check: "检查可用性", + }, + SyncType: { + Title: "同步类型", + SubTitle: "选择喜爱的同步服务器", + }, + Proxy: { + Title: "启用代理", + SubTitle: "在浏览器中同步时,必须启用代理以避免跨域限制", + }, + ProxyUrl: { + Title: "代理地址", + SubTitle: "仅适用于本项目自带的跨域代理", + }, + + WebDav: { + Endpoint: "WebDAV 地址", + UserName: "用户名", + Password: "密码", + }, + + UpStash: { + Endpoint: "UpStash Redis REST Url", + UserName: "备份名称", + Password: "UpStash Redis REST Token", + }, + }, + LocalState: "本地数据", Overview: (overview: any) => { return `${overview.chat} 次对话,${overview.message} 条消息,${overview.prompt} 条提示词,${overview.mask} 个面具`; @@ -222,11 +258,6 @@ const cn = { Title: "历史消息长度压缩阈值", SubTitle: "当未压缩的历史消息超过该值时,将进行压缩", }, - Token: { - Title: "API Key", - SubTitle: "使用自己的 Key 可绕过密码访问限制", - Placeholder: "OpenAI API Key", - }, Usage: { Title: "余额查询", @@ -237,19 +268,73 @@ const cn = { Check: "重新检查", NoAccess: "输入 API Key 或访问密码查看余额", }, - AccessCode: { - Title: "访问密码", - SubTitle: "管理员已开启加密访问", - Placeholder: "请输入访问密码", - }, - Endpoint: { - Title: "接口地址", - SubTitle: "除默认地址外,必须包含 http(s)://", - }, - CustomModel: { - Title: "自定义模型名", - SubTitle: "增加自定义模型可选项,使用英文逗号隔开", + + Access: { + AccessCode: { + Title: "访问密码", + SubTitle: "管理员已开启加密访问", + Placeholder: "请输入访问密码", + }, + CustomEndpoint: { + Title: "自定义接口", + SubTitle: "是否使用自定义 Azure 或 OpenAI 服务", + }, + Provider: { + Title: "模型服务商", + SubTitle: "切换不同的服务商", + }, + OpenAI: { + ApiKey: { + Title: "API Key", + SubTitle: "使用自定义 OpenAI Key 绕过密码访问限制", + Placeholder: "OpenAI API Key", + }, + + Endpoint: { + Title: "接口地址", + SubTitle: "除默认地址外,必须包含 http(s)://", + }, + }, + Azure: { + ApiKey: { + Title: "接口密钥", + SubTitle: "使用自定义 Azure Key 绕过密码访问限制", + Placeholder: "Azure API Key", + }, + + Endpoint: { + Title: "接口地址", + SubTitle: "样例:", + }, + + ApiVerion: { + Title: "接口版本 (azure api version)", + SubTitle: "选择指定的部分版本", + }, + }, + Google: { + ApiKey: { + Title: "接口密钥", + SubTitle: "使用自定义 Google AI Studio API Key 绕过密码访问限制", + Placeholder: "Google AI Studio API Key", + }, + + Endpoint: { + Title: "接口地址", + SubTitle: "不包含请求路径,样例:", + }, + + ApiVerion: { + Title: "接口版本 (gemini-pro api version)", + SubTitle: "选择指定的部分版本", + }, + }, + CustomModel: { + Title: "自定义模型名", + SubTitle: "增加自定义模型可选项,使用英文逗号隔开", + }, }, + Model: "模型 (model)", Temperature: { Title: "随机性 (temperature)", @@ -279,7 +364,7 @@ const cn = { Prompt: { History: (content: string) => "这是历史聊天总结作为前情提要:" + content, Topic: - "使用四到五个字直接返回这句话的简要主题,不要解释、不要标点、不要语气词、不要多余文本,如果没有主题,请直接返回“闲聊”", + "使用四到五个字直接返回这句话的简要主题,不要解释、不要标点、不要语气词、不要多余文本,不要加粗,如果没有主题,请直接返回“闲聊”", Summarize: "简要总结一下对话内容,用作后续的上下文提示 prompt,控制在 200 字以内", }, @@ -288,6 +373,10 @@ const cn = { Success: "已写入剪切板", Failed: "复制失败,请赋予剪切板权限", }, + Download: { + Success: "内容已下载到您的目录。", + Failed: "下载失败。", + }, Context: { Toast: (x: any) => `包含 ${x} 条预设提示词`, Edit: "当前对话设置", @@ -366,8 +455,12 @@ const cn = { Export: "导出", Import: "导入", Sync: "同步", + Config: "配置", }, Exporter: { + Description: { + Title: "只有清除上下文之后的消息会被展示", + }, Model: "模型", Messages: "消息", Topic: "主题", diff --git a/app/locales/cs.ts b/app/locales/cs.ts index 57aa803e42b..c1a84430fb3 100644 --- a/app/locales/cs.ts +++ b/app/locales/cs.ts @@ -124,11 +124,7 @@ const cs: PartialLocaleType = { 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) { @@ -138,11 +134,7 @@ const cs: PartialLocaleType = { 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", diff --git a/app/locales/de.ts b/app/locales/de.ts index e0bdc52b749..2fe871bc9f0 100644 --- a/app/locales/de.ts +++ b/app/locales/de.ts @@ -124,12 +124,7 @@ const de: PartialLocaleType = { SubTitle: "Komprimierung, wenn die Länge der unkomprimierten Nachrichten den Wert überschreitet", }, - Token: { - Title: "API-Schlüssel", - SubTitle: - "Verwenden Sie Ihren Schlüssel, um das Zugangscode-Limit zu ignorieren", - Placeholder: "OpenAI API-Schlüssel", - }, + Usage: { Title: "Kontostand", SubTitle(used: any, total: any) { @@ -139,11 +134,6 @@ const de: PartialLocaleType = { Check: "Erneut prüfen", NoAccess: "API-Schlüssel eingeben, um den Kontostand zu überprüfen", }, - AccessCode: { - Title: "Zugangscode", - SubTitle: "Zugangskontrolle aktiviert", - Placeholder: "Zugangscode erforderlich", - }, Model: "Modell", Temperature: { Title: "Temperature", //Temperatur diff --git a/app/locales/en.ts b/app/locales/en.ts index e3129578728..367161d6bfd 100644 --- a/app/locales/en.ts +++ b/app/locales/en.ts @@ -15,6 +15,7 @@ const en: LocaleType = { Auth: { Title: "Need Access Code", Tips: "Please enter access code below", + SubTips: "Or enter your OpenAI or Google API Key", Input: "access code", Confirm: "Confirm", Later: "Later", @@ -181,7 +182,43 @@ const en: LocaleType = { SubTitle: "Generate a suitable title based on the conversation content", }, Sync: { - LastUpdate: "Last Update", + CloudState: "Last Update", + NotSyncYet: "Not sync yet", + Success: "Sync Success", + Fail: "Sync Fail", + + Config: { + Modal: { + Title: "Config Sync", + Check: "Check Connection", + }, + SyncType: { + Title: "Sync Type", + SubTitle: "Choose your favorite sync service", + }, + Proxy: { + Title: "Enable CORS Proxy", + SubTitle: "Enable a proxy to avoid cross-origin restrictions", + }, + ProxyUrl: { + Title: "Proxy Endpoint", + SubTitle: + "Only applicable to the built-in CORS proxy for this project", + }, + + WebDav: { + Endpoint: "WebDAV Endpoint", + UserName: "User Name", + Password: "Password", + }, + + UpStash: { + Endpoint: "UpStash Redis REST Url", + UserName: "Backup Name", + Password: "UpStash Redis REST Token", + }, + }, + LocalState: "Local Data", Overview: (overview: any) => { return `${overview.chat} chats,${overview.message} messages,${overview.prompt} prompts,${overview.mask} masks`; @@ -225,11 +262,7 @@ const en: LocaleType = { SubTitle: "Will compress if uncompressed messages length exceeds the value", }, - Token: { - Title: "API Key", - SubTitle: "Use your key to ignore access code limit", - Placeholder: "OpenAI API Key", - }, + Usage: { Title: "Account Balance", SubTitle(used: any, total: any) { @@ -239,19 +272,73 @@ const en: LocaleType = { Check: "Check", NoAccess: "Enter API Key to check balance", }, - AccessCode: { - Title: "Access Code", - SubTitle: "Access control enabled", - Placeholder: "Need Access Code", - }, - Endpoint: { - Title: "Endpoint", - SubTitle: "Custom endpoint must start with http(s)://", - }, - CustomModel: { - Title: "Custom Models", - SubTitle: "Add extra model options, separate by comma", + Access: { + AccessCode: { + Title: "Access Code", + SubTitle: "Access control Enabled", + Placeholder: "Enter Code", + }, + CustomEndpoint: { + Title: "Custom Endpoint", + SubTitle: "Use custom Azure or OpenAI service", + }, + Provider: { + Title: "Model Provider", + SubTitle: "Select Azure or OpenAI", + }, + OpenAI: { + ApiKey: { + Title: "OpenAI API Key", + SubTitle: "User custom OpenAI Api Key", + Placeholder: "sk-xxx", + }, + + Endpoint: { + Title: "OpenAI Endpoint", + SubTitle: "Must starts with http(s):// or use /api/openai as default", + }, + }, + Azure: { + ApiKey: { + Title: "Azure Api Key", + SubTitle: "Check your api key from Azure console", + Placeholder: "Azure Api Key", + }, + + Endpoint: { + Title: "Azure Endpoint", + SubTitle: "Example: ", + }, + + ApiVerion: { + Title: "Azure Api Version", + SubTitle: "Check your api version from azure console", + }, + }, + CustomModel: { + Title: "Custom Models", + SubTitle: "Custom model options, seperated by comma", + }, + Google: { + ApiKey: { + Title: "API Key", + SubTitle: + "Bypass password access restrictions using a custom Google AI Studio API Key", + Placeholder: "Google AI Studio API Key", + }, + + Endpoint: { + Title: "Endpoint Address", + SubTitle: "Example:", + }, + + ApiVerion: { + Title: "API Version (gemini-pro api version)", + SubTitle: "Select a specific part version", + }, + }, }, + Model: "Model", Temperature: { Title: "Temperature", @@ -284,7 +371,7 @@ const en: LocaleType = { History: (content: string) => "This is a summary of the chat history as a recap: " + content, Topic: - "Please generate a four to five word title summarizing our conversation without any lead-in, punctuation, quotation marks, periods, symbols, or additional text. Remove enclosing quotation marks.", + "Please generate a four to five word title summarizing our conversation without any lead-in, punctuation, quotation marks, periods, symbols, bold text, or additional text. Remove enclosing quotation marks.", Summarize: "Summarize the discussion briefly in 200 words or less to use as a prompt for future context.", }, @@ -293,6 +380,10 @@ const en: LocaleType = { Success: "Copied to clipboard", Failed: "Copy failed, please grant permission to access clipboard", }, + Download: { + Success: "Content downloaded to your directory.", + Failed: "Download failed.", + }, Context: { Toast: (x: any) => `With ${x} contextual prompts`, Edit: "Current Chat Settings", @@ -366,8 +457,12 @@ const en: LocaleType = { Export: "Export", Import: "Import", Sync: "Sync", + Config: "Config", }, Exporter: { + Description: { + Title: "Only messages after clearing the context will be displayed", + }, Model: "Model", Messages: "Messages", Topic: "Topic", diff --git a/app/locales/es.ts b/app/locales/es.ts index a6ae154f44f..7d742d536e5 100644 --- a/app/locales/es.ts +++ b/app/locales/es.ts @@ -124,11 +124,7 @@ const es: PartialLocaleType = { 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(used: any, total: any) { @@ -138,11 +134,7 @@ const es: PartialLocaleType = { Check: "Comprobar de nuevo", NoAccess: "Introduzca la clave API para comprobar el saldo", }, - AccessCode: { - Title: "Código de acceso", - SubTitle: "Control de acceso habilitado", - Placeholder: "Necesita código de acceso", - }, + Model: "Modelo", Temperature: { Title: "Temperatura", diff --git a/app/locales/fr.ts b/app/locales/fr.ts index f5200f2719c..944754d62a7 100644 --- a/app/locales/fr.ts +++ b/app/locales/fr.ts @@ -173,11 +173,7 @@ const fr: PartialLocaleType = { SubTitle: "Comprimera si la longueur des messages non compressés dépasse cette valeur", }, - Token: { - Title: "Clé API", - SubTitle: "Utilisez votre clé pour ignorer la limite du code d'accès", - Placeholder: "Clé OpenAI API", - }, + Usage: { Title: "Solde du compte", SubTitle(used: any, total: any) { @@ -187,11 +183,7 @@ const fr: PartialLocaleType = { Check: "Vérifier", NoAccess: "Entrez la clé API pour vérifier le solde", }, - AccessCode: { - Title: "Code d'accès", - SubTitle: "Contrôle d'accès activé", - Placeholder: "Code d'accès requis", - }, + Model: "Modèle", Temperature: { Title: "Température", diff --git a/app/locales/id.ts b/app/locales/id.ts index c3a2a5f8807..571156a5776 100644 --- a/app/locales/id.ts +++ b/app/locales/id.ts @@ -5,11 +5,12 @@ const id: PartialLocaleType = { WIP: "Coming Soon...", Error: { Unauthorized: - "Akses tidak diizinkan. Silakan [otorisasi](/#/auth) dengan memasukkan kode akses.", + "Akses tidak diizinkan, silakan masukkan kode akses atau masukkan kunci API OpenAI Anda. di halaman [autentikasi](/#/auth) atau di halaman [Pengaturan](/#/settings).", }, Auth: { Title: "Diperlukan Kode Akses", Tips: "Masukkan kode akses di bawah", + SubTips: "Atau masukkan kunci API OpenAI Anda", Input: "Kode Akses", Confirm: "Konfirmasi", Later: "Nanti", @@ -60,7 +61,9 @@ const id: PartialLocaleType = { if (submitKey === String(SubmitKey.Enter)) { inputHints += ", Shift + Enter untuk membalut"; } - return inputHints + ", / untuk mencari prompt, : untuk menggunakan perintah"; + return ( + inputHints + ", / untuk mencari prompt, : untuk menggunakan perintah" + ); }, Send: "Kirim", Config: { @@ -117,33 +120,35 @@ const id: PartialLocaleType = { Title: "Setel Ulang Semua Pengaturan", SubTitle: "Mengembalikan semua pengaturan ke nilai default", Action: "Setel Ulang", - Confirm: "Anda yakin ingin mengembalikan semua pengaturan ke nilai default?", + Confirm: + "Anda yakin ingin mengembalikan semua pengaturan ke nilai default?", }, Clear: { Title: "Hapus Semua Data", - SubTitle: "Menghapus semua pesan dan pengaturan", + SubTitle: "Semua data yang tersimpan secara lokal akan dihapus", Action: "Hapus", - Confirm: "Anda yakin ingin menghapus semua pesan dan pengaturan?", + Confirm: + "Apakah Anda yakin ingin menghapus semua data yang tersimpan secara lokal?", }, }, Lang: { - Name: "Bahasa", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` - All: "Semua Bahasa", - }, - Avatar: "Avatar", - FontSize: { - Title: "Ukuran Font", - SubTitle: "Ubah ukuran font konten chat", - }, - InjectSystemPrompts: { - Title: "Suntikkan Petunjuk Sistem", - SubTitle: - "Tambahkan petunjuk simulasi sistem ChatGPT di awal daftar pesan yang diminta dalam setiap permintaan", - }, - InputTemplate: { - Title: "Template Input", - SubTitle: "Pesan baru akan diisi menggunakan template ini", - }, + Name: "Bahasa", // ATTENTION: if you wanna add a new translation, please do not translate this value, leave it as `Language` + All: "Semua Bahasa", + }, + Avatar: "Avatar", + FontSize: { + Title: "Ukuran Font", + SubTitle: "Ubah ukuran font konten chat", + }, + InjectSystemPrompts: { + Title: "Suntikkan Petunjuk Sistem", + SubTitle: + "Tambahkan petunjuk simulasi sistem ChatGPT di awal daftar pesan yang diminta dalam setiap permintaan", + }, + InputTemplate: { + Title: "Template Input", + SubTitle: "Pesan baru akan diisi menggunakan template ini", + }, Update: { Version: (x: string) => `Version: ${x}`, @@ -154,9 +159,40 @@ const id: PartialLocaleType = { GoToUpdate: "Perbarui Sekarang", }, AutoGenerateTitle: { - Title: "Hasilkan Judul Otomatis", - SubTitle: "Hasilkan judul yang sesuai berdasarkan konten percakapan", + Title: "Hasilkan Judul Otomatis", + SubTitle: "Hasilkan judul yang sesuai berdasarkan konten percakapan", + }, + Sync: { + CloudState: "Pembaruan Terakhir", + NotSyncYet: "Belum disinkronkan", + Success: "Sinkronisasi Berhasil", + Fail: "Sinkronisasi Gagal", + + Config: { + Modal: { + Title: "Konfigurasi Sinkronisasi", + }, + SyncType: { + Title: "Tipe Sinkronisasi", + SubTitle: "Pilih layanan sinkronisasi favorit Anda", + }, + Proxy: { + Title: "Aktifkan Proxy CORS", + SubTitle: + "Aktifkan Proxy untuk menghindari pembatasan atau pemblokiran lintas sumber", + }, + ProxyUrl: { + Title: "Lokasi Titik Akhir Proxy CORS", + SubTitle: "Hanya berlaku untuk Proxy CORS bawaan untuk proyek ini", + }, + + WebDav: { + Endpoint: "Lokasi Titik Akhir WebDAV", + UserName: "User Pengguna", + Password: "Kata Sandi", + }, }, + }, SendKey: "Kirim", Theme: "Tema", TightBorder: "Batas Ketat", @@ -176,76 +212,65 @@ const id: PartialLocaleType = { }, }, Prompt: { - Disable: { - Title: "Nonaktifkan Otomatisasi", - SubTitle: "Aktifkan/Matikan otomatisasi", - }, - List: "Daftar Prompt", - ListCount: (builtin: number, custom: number) => - `${builtin} bawaan, ${custom} penggunaan khusus`, - Edit: "Edit", - Modal: { - Title: "Daftar Prompt", - Add: "Tambahkan", - Search: "Cari Prompt", - }, - EditModal: { - Title: "Edit Prompt", - }, - }, - HistoryCount: { - Title: "Jumlah Pesan Riwayat", - SubTitle: "Jumlah pesan yang akan dikirim setiap permintaan", - }, - CompressThreshold: { - Title: "Batas Kompresi Riwayat", - SubTitle: - "Jika panjang pesan melebihi batas yang ditentukan, pesan tersebut akan dikompresi", - }, - Token: { - Title: "Kunci API", - SubTitle: "Gunakan kunci Anda untuk melewati batas kode akses", - Placeholder: "Kunci API OpenAI", - }, - Usage: { - Title: "Saldo Akun", - SubTitle(used: any, total: any) { - return `Digunakan bulan ini: ${used}, total langganan: ${total}`; - }, - IsChecking: "Memeriksa...", - Check: "Periksa", - NoAccess: "Masukkan kunci API untuk memeriksa saldo", + Disable: { + Title: "Nonaktifkan Otomatisasi", + SubTitle: "Aktifkan/Matikan otomatisasi", }, - AccessCode: { - Title: "Kode Akses", - SubTitle: "Kontrol akses diaktifkan", - Placeholder: "Diperlukan kode akses", - }, - Endpoint: { - Title: "Endpoint", - SubTitle: "Harus dimulai dengan http(s):// untuk endpoint kustom", - }, - Model: "Model", - Temperature: { - Title: "Suhu", - SubTitle: "Semakin tinggi nilainya, semakin acak keluarannya", - }, - TopP: { - Title: "Top P", - SubTitle: "Tidak mengubah nilai dengan suhu", + List: "Daftar Prompt", + ListCount: (builtin: number, custom: number) => + `${builtin} bawaan, ${custom} penggunaan khusus`, + Edit: "Edit", + Modal: { + Title: "Daftar Prompt", + Add: "Tambahkan", + Search: "Cari Prompt", }, - MaxTokens: { - Title: "Token Maksimum", - SubTitle: "Panjang maksimum token input dan output", + EditModal: { + Title: "Edit Prompt", }, - PresencePenalty: { - Title: "Penalti Kehadiran", - SubTitle: "Semakin tinggi nilai, semakin mungkin topik baru muncul", + }, + HistoryCount: { + Title: "Jumlah Pesan Riwayat", + SubTitle: "Jumlah pesan yang akan dikirim setiap permintaan", + }, + CompressThreshold: { + Title: "Batas Kompresi Riwayat", + SubTitle: + "Jika panjang pesan melebihi batas yang ditentukan, pesan tersebut akan dikompresi", + }, + + Usage: { + Title: "Saldo Akun", + SubTitle(used: any, total: any) { + return `Digunakan bulan ini: ${used}, total langganan: ${total}`; }, - FrequencyPenalty: { - Title: "Penalti Frekuensi", - SubTitle: "Semakin tinggi nilai, semakin rendah kemungkinan penggunaan ulang baris yang sama", - }, + IsChecking: "Memeriksa...", + Check: "Periksa", + NoAccess: "Masukkan kunci API untuk memeriksa saldo", + }, + + Model: "Model", + Temperature: { + Title: "Suhu", + SubTitle: "Semakin tinggi nilainya, semakin acak keluarannya", + }, + TopP: { + Title: "Top P", + SubTitle: "Tidak mengubah nilai dengan suhu", + }, + MaxTokens: { + Title: "Token Maksimum", + SubTitle: "Panjang maksimum token input dan output", + }, + PresencePenalty: { + Title: "Penalti Kehadiran", + SubTitle: "Semakin tinggi nilai, semakin mungkin topik baru muncul", + }, + FrequencyPenalty: { + Title: "Penalti Frekuensi", + SubTitle: + "Semakin tinggi nilai, semakin rendah kemungkinan penggunaan ulang baris yang sama", + }, }, Store: { DefaultTopic: "Percakapan Baru", @@ -261,8 +286,13 @@ const id: PartialLocaleType = { }, }, Copy: { - Success: "Berhasil disalin ke clipboard", - Failed: "Gagal menyalin, berikan izin untuk memberikan izin", + Success: "Tersalin ke clipboard", + Failed: + "Gagal menyalin, mohon berikan izin untuk mengakses clipboard atau Clipboard API tidak didukung (Tauri)", + }, + Download: { + Success: "Konten berhasil diunduh ke direktori Anda.", + Failed: "Unduhan gagal.", }, Context: { Toast: (x: any) => `Dengan ${x} promp kontekstual`, @@ -338,10 +368,13 @@ const id: PartialLocaleType = { Edit: "Edit", }, Exporter: { + Description: { + Title: "Hanya pesan setelah menghapus konteks yang akan ditampilkan" + }, Model: "Model", Messages: "Pesan", Topic: "Topik", - Time: "Waktu", + Time: "Tanggal & Waktu", }, URLCommand: { Code: "Kode akses terdeteksi dari url, konfirmasi untuk mendaftar ? ", diff --git a/app/locales/index.ts b/app/locales/index.ts index 79e314facdd..6e8088a9894 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -1,5 +1,6 @@ import cn from "./cn"; import en from "./en"; +import pt from "./pt"; import tw from "./tw"; import id from "./id"; import fr from "./fr"; @@ -15,6 +16,7 @@ import cs from "./cs"; import ko from "./ko"; import ar from "./ar"; import bn from "./bn"; +import sk from "./sk"; import { merge } from "../utils/merge"; import type { LocaleType } from "./cn"; @@ -24,6 +26,7 @@ const ALL_LANGS = { cn, en, tw, + pt, jp, ko, id, @@ -38,6 +41,7 @@ const ALL_LANGS = { no, ar, bn, + sk, }; export type Lang = keyof typeof ALL_LANGS; @@ -47,6 +51,7 @@ export const AllLangs = Object.keys(ALL_LANGS) as Lang[]; export const ALL_LANG_OPTIONS: Record = { cn: "简体中文", en: "English", + pt: "Português", tw: "繁體中文", jp: "日本語", ko: "한국어", @@ -62,6 +67,7 @@ export const ALL_LANG_OPTIONS: Record = { no: "Nynorsk", ar: "العربية", bn: "বাংলা", + sk: "Slovensky", }; const LANG_KEY = "lang"; diff --git a/app/locales/it.ts b/app/locales/it.ts index bf20747b108..7f0a95846c2 100644 --- a/app/locales/it.ts +++ b/app/locales/it.ts @@ -124,12 +124,7 @@ const it: PartialLocaleType = { SubTitle: "Comprimerà se la lunghezza dei messaggi non compressi supera il valore", }, - Token: { - Title: "API Key", - SubTitle: - "Utilizzare la chiave per ignorare il limite del codice di accesso", - Placeholder: "OpenAI API Key", - }, + Usage: { Title: "Bilancio Account", SubTitle(used: any, total: any) { @@ -139,11 +134,7 @@ const it: PartialLocaleType = { Check: "Controlla ancora", NoAccess: "Inserire la chiave API per controllare il saldo", }, - AccessCode: { - Title: "Codice d'accesso", - SubTitle: "Controllo d'accesso abilitato", - Placeholder: "Inserisci il codice d'accesso", - }, + Model: "Modello GPT", Temperature: { Title: "Temperature", diff --git a/app/locales/jp.ts b/app/locales/jp.ts index b63e8ba3a56..e0ea07c755b 100644 --- a/app/locales/jp.ts +++ b/app/locales/jp.ts @@ -20,7 +20,8 @@ const jp: PartialLocaleType = { Stop: "停止", Retry: "リトライ", Pin: "ピン", - PinToastContent: "コンテキストプロンプトに1つのメッセージをピン留めしました", + PinToastContent: + "コンテキストプロンプトに1つのメッセージをピン留めしました", PinToastAction: "表示", Delete: "削除", Edit: "編集", @@ -146,11 +147,7 @@ const jp: PartialLocaleType = { SubTitle: "圧縮されていない履歴メッセージがこの値を超えた場合、圧縮が行われます。", }, - Token: { - Title: "APIキー", - SubTitle: "自分のキーを使用してパスワードアクセス制限を迂回する", - Placeholder: "OpenAI APIキー", - }, + Usage: { Title: "残高照会", SubTitle(used: any, total: any) { @@ -160,11 +157,7 @@ const jp: PartialLocaleType = { Check: "再確認", NoAccess: "APIキーまたはアクセスパスワードを入力して残高を表示", }, - AccessCode: { - Title: "アクセスパスワード", - SubTitle: "暗号化アクセスが有効になっています", - Placeholder: "アクセスパスワードを入力してください", - }, + Model: "モデル (model)", Temperature: { Title: "ランダム性 (temperature)", diff --git a/app/locales/ko.ts b/app/locales/ko.ts index 717ce30b2f8..844459fc4ea 100644 --- a/app/locales/ko.ts +++ b/app/locales/ko.ts @@ -124,11 +124,7 @@ const ko: PartialLocaleType = { Title: "기록 압축 임계값", SubTitle: "미압축 메시지 길이가 임계값을 초과하면 압축됨", }, - Token: { - Title: "API 키", - SubTitle: "액세스 코드 제한을 무시하기 위해 키 사용", - Placeholder: "OpenAI API 키", - }, + Usage: { Title: "계정 잔액", SubTitle(used: any, total: any) { @@ -138,11 +134,7 @@ const ko: PartialLocaleType = { Check: "확인", NoAccess: "잔액 확인을 위해 API 키를 입력하세요.", }, - AccessCode: { - Title: "액세스 코드", - SubTitle: "액세스 제어가 활성화됨", - Placeholder: "액세스 코드 입력", - }, + Model: "모델", Temperature: { Title: "온도 (temperature)", diff --git a/app/locales/no.ts b/app/locales/no.ts index 43c92916f3e..3a0e61107a4 100644 --- a/app/locales/no.ts +++ b/app/locales/no.ts @@ -106,12 +106,7 @@ const no: PartialLocaleType = { SubTitle: "Komprimer dersom ikke-komprimert lengde på meldinger overskrider denne verdien", }, - Token: { - Title: "API Key", - SubTitle: - "Bruk din egen API-nøkkel for å ignorere tilgangskoden begrensning", - Placeholder: "OpenAI API-nøkkel", - }, + Usage: { Title: "Saldo for konto", SubTitle(used: any, total: any) { @@ -121,11 +116,7 @@ const no: PartialLocaleType = { Check: "Sjekk", NoAccess: "Skriv inn API-nøkkelen for å sjekke saldo", }, - AccessCode: { - Title: "Tilgangskode", - SubTitle: "Tilgangskontroll på", - Placeholder: "Trenger tilgangskode", - }, + Model: "Model", Temperature: { Title: "Temperatur", diff --git a/app/locales/pt.ts b/app/locales/pt.ts new file mode 100644 index 00000000000..85226ed507d --- /dev/null +++ b/app/locales/pt.ts @@ -0,0 +1,466 @@ +import { SubmitKey } from "../store/config"; +import { PartialLocaleType } from "../locales/index"; +import { getClientConfig } from "../config/client"; + +const isApp = !!getClientConfig()?.isApp; + +const pt: PartialLocaleType = { + WIP: "Em breve...", + Error: { + Unauthorized: isApp + ? "Chave API inválida, por favor verifique em [Configurações](/#/settings)." + : "Acesso não autorizado, por favor insira o código de acesso em [auth](/#/auth) ou insira sua Chave API OpenAI.", + }, + Auth: { + Title: "Necessário Código de Acesso", + Tips: "Por favor, insira o código de acesso abaixo", + SubTips: "Ou insira sua Chave API OpenAI", + Input: "código de acesso", + Confirm: "Confirmar", + Later: "Depois", + }, + ChatItem: { + ChatItemCount: (count: number) => `${count} mensagens`, + }, + Chat: { + SubTitle: (count: number) => `${count} mensagens`, + EditMessage: { + Title: "Editar Todas as Mensagens", + Topic: { + Title: "Tópico", + SubTitle: "Mudar o tópico atual", + }, + }, + Actions: { + ChatList: "Ir Para Lista de Chat", + CompressedHistory: "Prompt de Memória Histórica Comprimida", + Export: "Exportar Todas as Mensagens como Markdown", + Copy: "Copiar", + Stop: "Parar", + Retry: "Tentar Novamente", + Pin: "Fixar", + PinToastContent: "Fixada 1 mensagem para prompts contextuais", + PinToastAction: "Visualizar", + Delete: "Deletar", + Edit: "Editar", + }, + Commands: { + new: "Iniciar um novo chat", + newm: "Iniciar um novo chat com máscara", + next: "Próximo Chat", + prev: "Chat Anterior", + clear: "Limpar Contexto", + del: "Deletar Chat", + }, + InputActions: { + Stop: "Parar", + ToBottom: "Para o Mais Recente", + Theme: { + auto: "Automático", + light: "Tema Claro", + dark: "Tema Escuro", + }, + Prompt: "Prompts", + Masks: "Máscaras", + Clear: "Limpar Contexto", + Settings: "Configurações", + }, + Rename: "Renomear Chat", + Typing: "Digitando…", + Input: (submitKey: string) => { + var inputHints = `${submitKey} para enviar`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", Shift + Enter para quebrar linha"; + } + return inputHints + ", / para buscar prompts, : para usar comandos"; + }, + Send: "Enviar", + Config: { + Reset: "Redefinir para Padrão", + SaveAs: "Salvar como Máscara", + }, + IsContext: "Prompt Contextual", + }, + Export: { + Title: "Exportar Mensagens", + Copy: "Copiar Tudo", + Download: "Baixar", + MessageFromYou: "Mensagem De Você", + MessageFromChatGPT: "Mensagem De ChatGPT", + Share: "Compartilhar para ShareGPT", + Format: { + Title: "Formato de Exportação", + SubTitle: "Markdown ou Imagem PNG", + }, + IncludeContext: { + Title: "Incluindo Contexto", + SubTitle: "Exportar prompts de contexto na máscara ou não", + }, + Steps: { + Select: "Selecionar", + Preview: "Pré-visualizar", + }, + Image: { + Toast: "Capturando Imagem...", + Modal: + "Pressione longamente ou clique com o botão direito para salvar a imagem", + }, + }, + Select: { + Search: "Buscar", + All: "Selecionar Tudo", + Latest: "Selecionar Mais Recente", + Clear: "Limpar", + }, + Memory: { + Title: "Prompt de Memória", + EmptyContent: "Nada ainda.", + Send: "Enviar Memória", + Copy: "Copiar Memória", + Reset: "Resetar Sessão", + ResetConfirm: + "Resetar irá limpar o histórico de conversa atual e a memória histórica. Você tem certeza que quer resetar?", + }, + Home: { + NewChat: "Novo Chat", + DeleteChat: "Confirmar para deletar a conversa selecionada?", + DeleteToast: "Chat Deletado", + Revert: "Reverter", + }, + Settings: { + Title: "Configurações", + SubTitle: "Todas as Configurações", + Danger: { + Reset: { + Title: "Resetar Todas as Configurações", + SubTitle: "Resetar todos os itens de configuração para o padrão", + Action: "Resetar", + Confirm: "Confirmar para resetar todas as configurações para o padrão?", + }, + Clear: { + Title: "Limpar Todos os Dados", + SubTitle: "Limpar todas as mensagens e configurações", + Action: "Limpar", + Confirm: "Confirmar para limpar todas as mensagens e configurações?", + }, + }, + Lang: { + Name: "Language", + All: "Todos os Idiomas", + }, + Avatar: "Avatar", + FontSize: { + Title: "Tamanho da Fonte", + SubTitle: "Ajustar o tamanho da fonte do conteúdo do chat", + }, + InjectSystemPrompts: { + Title: "Inserir Prompts de Sistema", + SubTitle: "Inserir um prompt de sistema global para cada requisição", + }, + InputTemplate: { + Title: "Modelo de Entrada", + SubTitle: "A mensagem mais recente será preenchida neste modelo", + }, + + Update: { + Version: (x: string) => `Versão: ${x}`, + IsLatest: "Última versão", + CheckUpdate: "Verificar Atualização", + IsChecking: "Verificando atualização...", + FoundUpdate: (x: string) => `Nova versão encontrada: ${x}`, + GoToUpdate: "Atualizar", + }, + SendKey: "Tecla de Envio", + Theme: "Tema", + TightBorder: "Borda Ajustada", + SendPreviewBubble: { + Title: "Bolha de Pré-visualização de Envio", + SubTitle: "Pré-visualizar markdown na bolha", + }, + AutoGenerateTitle: { + Title: "Gerar Título Automaticamente", + SubTitle: "Gerar um título adequado baseado no conteúdo da conversa", + }, + Sync: { + CloudState: "Última Atualização", + NotSyncYet: "Ainda não sincronizado", + Success: "Sincronização bem sucedida", + Fail: "Falha na sincronização", + + Config: { + Modal: { + Title: "Configurar Sincronização", + Check: "Verificar Conexão", + }, + SyncType: { + Title: "Tipo de Sincronização", + SubTitle: "Escolha seu serviço de sincronização favorito", + }, + Proxy: { + Title: "Habilitar Proxy CORS", + SubTitle: "Habilitar um proxy para evitar restrições de cross-origin", + }, + ProxyUrl: { + Title: "Endpoint de Proxy", + SubTitle: "Apenas aplicável ao proxy CORS embutido para este projeto", + }, + + WebDav: { + Endpoint: "Endpoint WebDAV", + UserName: "Nome de Usuário", + Password: "Senha", + }, + + UpStash: { + Endpoint: "URL REST Redis UpStash", + UserName: "Nome do Backup", + Password: "Token REST Redis UpStash", + }, + }, + + LocalState: "Dados Locais", + Overview: (overview: any) => { + return `${overview.chat} chats,${overview.message} mensagens,${overview.prompt} prompts,${overview.mask} máscaras`; + }, + ImportFailed: "Falha ao importar do arquivo", + }, + Mask: { + Splash: { + Title: "Tela de Início da Máscara", + SubTitle: + "Mostrar uma tela de início da máscara antes de iniciar novo chat", + }, + Builtin: { + Title: "Esconder Máscaras Embutidas", + SubTitle: "Esconder máscaras embutidas na lista de máscaras", + }, + }, + Prompt: { + Disable: { + Title: "Desabilitar auto-completar", + SubTitle: "Digite / para acionar auto-completar", + }, + List: "Lista de Prompts", + ListCount: (builtin: number, custom: number) => + `${builtin} embutidos, ${custom} definidos pelo usuário`, + Edit: "Editar", + Modal: { + Title: "Lista de Prompts", + Add: "Adicionar Um", + Search: "Buscar Prompts", + }, + EditModal: { + Title: "Editar Prompt", + }, + }, + HistoryCount: { + Title: "Contagem de Mensagens Anexadas", + SubTitle: "Número de mensagens enviadas anexadas por requisição", + }, + CompressThreshold: { + Title: "Limite de Compressão de Histórico", + SubTitle: + "Irá comprimir se o comprimento das mensagens não comprimidas exceder o valor", + }, + + Usage: { + Title: "Saldo da Conta", + SubTitle(used: any, total: any) { + return `Usado este mês ${used}, assinatura ${total}`; + }, + IsChecking: "Verificando...", + Check: "Verificar", + NoAccess: "Insira a Chave API para verificar o saldo", + }, + Access: { + AccessCode: { + Title: "Código de Acesso", + SubTitle: "Controle de Acesso Habilitado", + Placeholder: "Insira o Código", + }, + CustomEndpoint: { + Title: "Endpoint Personalizado", + SubTitle: "Use serviço personalizado Azure ou OpenAI", + }, + Provider: { + Title: "Provedor do Modelo", + SubTitle: "Selecione Azure ou OpenAI", + }, + OpenAI: { + ApiKey: { + Title: "Chave API OpenAI", + SubTitle: "Usar Chave API OpenAI personalizada", + Placeholder: "sk-xxx", + }, + + Endpoint: { + Title: "Endpoint OpenAI", + SubTitle: + "Deve começar com http(s):// ou usar /api/openai como padrão", + }, + }, + Azure: { + ApiKey: { + Title: "Chave API Azure", + SubTitle: "Verifique sua chave API do console Azure", + Placeholder: "Chave API Azure", + }, + + Endpoint: { + Title: "Endpoint Azure", + SubTitle: "Exemplo: ", + }, + + ApiVerion: { + Title: "Versão API Azure", + SubTitle: "Verifique sua versão API do console Azure", + }, + }, + CustomModel: { + Title: "Modelos Personalizados", + SubTitle: "Opções de modelo personalizado, separados por vírgula", + }, + }, + + Model: "Modelo", + Temperature: { + Title: "Temperatura", + SubTitle: "Um valor maior torna a saída mais aleatória", + }, + TopP: { + Title: "Top P", + SubTitle: "Não altere este valor junto com a temperatura", + }, + MaxTokens: { + Title: "Máximo de Tokens", + SubTitle: "Comprimento máximo de tokens de entrada e tokens gerados", + }, + PresencePenalty: { + Title: "Penalidade de Presença", + SubTitle: + "Um valor maior aumenta a probabilidade de falar sobre novos tópicos", + }, + FrequencyPenalty: { + Title: "Penalidade de Frequência", + SubTitle: + "Um valor maior diminui a probabilidade de repetir a mesma linha", + }, + }, + Store: { + DefaultTopic: "Nova Conversa", + BotHello: "Olá! Como posso ajudá-lo hoje?", + Error: "Algo deu errado, por favor tente novamente mais tarde.", + Prompt: { + History: (content: string) => + "Este é um resumo do histórico de chat como um recapitulativo: " + + content, + Topic: + "Por favor, gere um título de quatro a cinco palavras resumindo nossa conversa sem qualquer introdução, pontuação, aspas, períodos, símbolos ou texto adicional. Remova as aspas que o envolvem.", + Summarize: + "Resuma a discussão brevemente em 200 palavras ou menos para usar como um prompt para o contexto futuro.", + }, + }, + Copy: { + Success: "Copiado para a área de transferência", + Failed: + "Falha na cópia, por favor conceda permissão para acessar a área de transferência", + }, + Download: { + Success: "Conteúdo baixado para seu diretório.", + Failed: "Falha no download.", + }, + Context: { + Toast: (x: any) => `Com ${x} prompts contextuais`, + Edit: "Configurações do Chat Atual", + Add: "Adicionar um Prompt", + Clear: "Contexto Limpo", + Revert: "Reverter", + }, + Plugin: { + Name: "Plugin", + }, + FineTuned: { + Sysmessage: "Você é um assistente que", + }, + Mask: { + Name: "Máscara", + Page: { + Title: "Template de Prompt", + SubTitle: (count: number) => `${count} templates de prompt`, + Search: "Buscar Templates", + Create: "Criar", + }, + Item: { + Info: (count: number) => `${count} prompts`, + Chat: "Chat", + View: "Visualizar", + Edit: "Editar", + Delete: "Deletar", + DeleteConfirm: "Confirmar para deletar?", + }, + EditModal: { + Title: (readonly: boolean) => + `Editar Template de Prompt ${readonly ? "(somente leitura)" : ""}`, + Download: "Baixar", + Clone: "Clonar", + }, + Config: { + Avatar: "Avatar do Bot", + Name: "Nome do Bot", + Sync: { + Title: "Usar Configuração Global", + SubTitle: "Usar configuração global neste chat", + Confirm: + "Confirmar para substituir a configuração personalizada pela configuração global?", + }, + HideContext: { + Title: "Esconder Prompts de Contexto", + SubTitle: "Não mostrar prompts de contexto no chat", + }, + Share: { + Title: "Compartilhar Esta Máscara", + SubTitle: "Gerar um link para esta máscara", + Action: "Copiar Link", + }, + }, + }, + NewChat: { + Return: "Retornar", + Skip: "Apenas Começar", + Title: "Escolher uma Máscara", + SubTitle: "Converse com a Alma por trás da Máscara", + More: "Encontre Mais", + NotShow: "Nunca Mostrar Novamente", + ConfirmNoShow: + "Confirmar para desabilitar?Você pode habilitar nas configurações depois.", + }, + + UI: { + Confirm: "Confirmar", + Cancel: "Cancelar", + Close: "Fechar", + Create: "Criar", + Edit: "Editar", + Export: "Exportar", + Import: "Importar", + Sync: "Sincronizar", + Config: "Configurar", + }, + Exporter: { + Description: { + Title: "Apenas mensagens após a limpeza do contexto serão exibidas", + }, + Model: "Modelo", + Messages: "Mensagens", + Topic: "Tópico", + Time: "Tempo", + }, + + URLCommand: { + Code: "Código de acesso detectado a partir da url, confirmar para aplicar? ", + Settings: + "Configurações detectadas a partir da url, confirmar para aplicar?", + }, +}; + +export default pt; diff --git a/app/locales/ru.ts b/app/locales/ru.ts index bf98b4eb865..d12cf3e4258 100644 --- a/app/locales/ru.ts +++ b/app/locales/ru.ts @@ -125,11 +125,7 @@ const ru: PartialLocaleType = { SubTitle: "Будет сжимать, если длина несжатых сообщений превышает указанное значение", }, - Token: { - Title: "API ключ", - SubTitle: "Используйте свой ключ, чтобы игнорировать лимит доступа", - Placeholder: "API ключ OpenAI", - }, + Usage: { Title: "Баланс аккаунта", SubTitle(used: any, total: any) { @@ -139,11 +135,7 @@ const ru: PartialLocaleType = { Check: "Проверить", NoAccess: "Введите API ключ, чтобы проверить баланс", }, - AccessCode: { - Title: "Код доступа", - SubTitle: "Контроль доступа включен", - Placeholder: "Требуется код доступа", - }, + Model: "Модель", Temperature: { Title: "Температура", diff --git a/app/locales/sk.ts b/app/locales/sk.ts new file mode 100644 index 00000000000..66cd8f0410a --- /dev/null +++ b/app/locales/sk.ts @@ -0,0 +1,482 @@ +import { getClientConfig } from "../config/client"; +import { SubmitKey } from "../store/config"; +import { LocaleType } from "./index"; +import type { PartialLocaleType } from "./index"; + +// if you are adding a new translation, please use PartialLocaleType instead of LocaleType + +const isApp = !!getClientConfig()?.isApp; +const sk: PartialLocaleType = { + WIP: "Už čoskoro...", + Error: { + Unauthorized: isApp + ? "Neplatný API kľúč, prosím skontrolujte ho na stránke [Nastavenia](/#/settings)." + : "Neoprávnený prístup, prosím zadajte prístupový kód na stránke [auth](/#/auth), alebo zadajte váš OpenAI API kľúč.", + }, + Auth: { + Title: "Potrebný prístupový kód", + Tips: "Prosím, zadajte prístupový kód nižšie", + SubTips: "Alebo zadajte váš OpenAI alebo Google API kľúč", + Input: "prístupový kód", + Confirm: "Potvrdiť", + Later: "Neskôr", + }, + ChatItem: { + ChatItemCount: (count: number) => `${count} správ`, + }, + Chat: { + SubTitle: (count: number) => `${count} správ`, + EditMessage: { + Title: "Upraviť všetky správy", + Topic: { + Title: "Téma", + SubTitle: "Zmeniť aktuálnu tému", + }, + }, + Actions: { + ChatList: "Prejsť na zoznam chatov", + CompressedHistory: "Komprimovaná história výziev", + Export: "Exportovať všetky správy ako Markdown", + Copy: "Kopírovať", + Stop: "Zastaviť", + Retry: "Skúsiť znova", + Pin: "Pripnúť", + PinToastContent: "Pripnuté 1 správy do kontextových výziev", + PinToastAction: "Zobraziť", + Delete: "Vymazať", + Edit: "Upraviť", + }, + Commands: { + new: "Začať nový chat", + newm: "Začať nový chat s maskou", + next: "Ďalší Chat", + prev: "Predchádzajúci Chat", + clear: "Vymazať kontext", + del: "Vymazať Chat", + }, + InputActions: { + Stop: "Zastaviť", + ToBottom: "Na najnovšie", + Theme: { + auto: "Automaticky", + light: "Svetlý motív", + dark: "Tmavý motív", + }, + Prompt: "Výzvy", + Masks: "Masky", + Clear: "Vymazať kontext", + Settings: "Nastavenia", + }, + Rename: "Premenovať Chat", + Typing: "Písanie…", + Input: (submitKey: string) => { + var inputHints = `${submitKey} na odoslanie`; + if (submitKey === String(SubmitKey.Enter)) { + inputHints += ", Shift + Enter na zalomenie"; + } + return inputHints + ", / na vyhľadávanie výziev, : na použitie príkazov"; + }, + Send: "Odoslať", + Config: { + Reset: "Resetovať na predvolené", + SaveAs: "Uložiť ako masku", + }, + IsContext: "Kontextová výzva", + }, + Export: { + Title: "Export správ", + Copy: "Kopírovať všetko", + Download: "Stiahnuť", + MessageFromYou: "Správa od vás", + MessageFromChatGPT: "Správa od ChatGPT", + Share: "Zdieľať na ShareGPT", + Format: { + Title: "Formát exportu", + SubTitle: "Markdown alebo PNG obrázok", + }, + IncludeContext: { + Title: "Vrátane kontextu", + SubTitle: "Exportovať kontextové výzvy v maske alebo nie", + }, + Steps: { + Select: "Vybrať", + Preview: "Náhľad", + }, + Image: { + Toast: "Snímanie obrázka...", + Modal: + "Dlhým stlačením alebo kliknutím pravým tlačidlom myši uložte obrázok", + }, + }, + Select: { + Search: "Hľadať", + All: "Vybrať všetko", + Latest: "Vybrať najnovšie", + Clear: "Vymazať", + }, + Memory: { + Title: "Výzva pamäti", + EmptyContent: "Zatiaľ nič.", + Send: "Odoslať pamäť", + Copy: "Kopírovať pamäť", + Reset: "Resetovať reláciu", + ResetConfirm: + "Resetovaním sa vymaže aktuálna história konverzácie a historická pamäť. Ste si istí, že chcete resetovať?", + }, + Home: { + NewChat: "Nový Chat", + DeleteChat: "Potvrdiť vymazanie vybranej konverzácie?", + DeleteToast: "Chat vymazaný", + Revert: "Vrátiť späť", + }, + Settings: { + Title: "Nastavenia", + SubTitle: "Všetky nastavenia", + Danger: { + Reset: { + Title: "Resetovať všetky nastavenia", + SubTitle: "Resetovať všetky položky nastavení na predvolené", + Action: "Resetovať", + Confirm: "Potvrdiť resetovanie všetkých nastavení na predvolené?", + }, + Clear: { + Title: "Vymazať všetky údaje", + SubTitle: "Vymazať všetky správy a nastavenia", + Action: "Vymazať", + Confirm: "Potvrdiť vymazanie všetkých správ a nastavení?", + }, + }, + Lang: { + Name: "Jazyk", // POZOR: ak pridávate nový preklad, prosím neprekladajte túto hodnotu, nechajte ju ako "Jazyk" + All: "Všetky jazyky", + }, + Avatar: "Avatar", + FontSize: { + Title: "Veľkosť písma", + SubTitle: "Nastaviť veľkosť písma obsahu chatu", + }, + InjectSystemPrompts: { + Title: "Vložiť systémové výzvy", + SubTitle: "Vložiť globálnu systémovú výzvu pre každú požiadavku", + }, + InputTemplate: { + Title: "Šablóna vstupu", + SubTitle: "Najnovšia správa bude vyplnená do tejto šablóny", + }, + + Update: { + Version: (x: string) => `Verzia: ${x}`, + IsLatest: "Najnovšia verzia", + CheckUpdate: "Skontrolovať aktualizácie", + IsChecking: "Kontrola aktualizácií...", + FoundUpdate: (x: string) => `Nájdená nová verzia: ${x}`, + GoToUpdate: "Aktualizovať", + }, + SendKey: "Odoslať kľúč", + Theme: "Motív", + TightBorder: "Tesný okraj", + SendPreviewBubble: { + Title: "Bublina náhľadu odoslania", + SubTitle: "Náhľad markdownu v bubline", + }, + AutoGenerateTitle: { + Title: "Automaticky generovať názov", + SubTitle: "Generovať vhodný názov na základe obsahu konverzácie", + }, + Sync: { + CloudState: "Posledná aktualizácia", + NotSyncYet: "Zatiaľ nesynchronizované", + Success: "Synchronizácia úspešná", + Fail: "Synchronizácia zlyhala", + + Config: { + Modal: { + Title: "Konfigurácia synchronizácie", + Check: "Skontrolovať pripojenie", + }, + SyncType: { + Title: "Typ synchronizácie", + SubTitle: "Vyberte svoju obľúbenú službu synchronizácie", + }, + Proxy: { + Title: "Povoliť CORS Proxy", + SubTitle: "Povoliť proxy na obídenie obmedzení cross-origin", + }, + ProxyUrl: { + Title: "Koncový bod Proxy", + SubTitle: "Platné len pre vstavaný CORS proxy tohto projektu", + }, + + WebDav: { + Endpoint: "Koncový bod WebDAV", + UserName: "Meno používateľa", + Password: "Heslo", + }, + + UpStash: { + Endpoint: "URL REST služby UpStash Redis", + UserName: "Názov zálohy", + Password: "Token REST služby UpStash Redis", + }, + }, + + LocalState: "Lokálne údaje", + Overview: (overview: any) => { + return `${overview.chat} chaty, ${overview.message} správy, ${overview.prompt} výzvy, ${overview.mask} masky`; + }, + ImportFailed: "Import z súboru zlyhal", + }, + Mask: { + Splash: { + Title: "Úvodná obrazovka masky", + SubTitle: "Zobraziť úvodnú obrazovku masky pred začatím nového chatu", + }, + Builtin: { + Title: "Skryť vstavané masky", + SubTitle: "Skryť vstavané masky v zozname masiek", + }, + }, + Prompt: { + Disable: { + Title: "Zakázať automatické dopĺňanie", + SubTitle: "Zadajte / na spustenie automatického dopĺňania", + }, + List: "Zoznam výziev", + ListCount: (builtin: number, custom: number) => + `${builtin} vstavaných, ${custom} užívateľsky definovaných`, + Edit: "Upraviť", + Modal: { + Title: "Zoznam výziev", + Add: "Pridať jednu", + Search: "Hľadať výzvy", + }, + EditModal: { + Title: "Upraviť výzvu", + }, + }, + HistoryCount: { + Title: "Počet pripojených správ", + SubTitle: "Počet odoslaných správ pripojených na požiadavku", + }, + CompressThreshold: { + Title: "Práh kompresie histórie", + SubTitle: + "Bude komprimované, ak dĺžka nekomprimovaných správ presiahne túto hodnotu", + }, + + Usage: { + Title: "Stav účtu", + SubTitle(used: any, total: any) { + return `Tento mesiac použité ${used}, predplatné ${total}`; + }, + IsChecking: "Kontroluje sa...", + Check: "Skontrolovať", + NoAccess: "Zadajte API kľúč na skontrolovanie zostatku", + }, + Access: { + AccessCode: { + Title: "Prístupový kód", + SubTitle: "Povolený prístupový kód", + Placeholder: "Zadajte kód", + }, + CustomEndpoint: { + Title: "Vlastný koncový bod", + SubTitle: "Použiť vlastnú službu Azure alebo OpenAI", + }, + Provider: { + Title: "Poskytovateľ modelu", + SubTitle: "Vyberte Azure alebo OpenAI", + }, + OpenAI: { + ApiKey: { + Title: "API kľúč OpenAI", + SubTitle: "Použiť vlastný API kľúč OpenAI", + Placeholder: "sk-xxx", + }, + + Endpoint: { + Title: "Koncový bod OpenAI", + SubTitle: + "Musí začínať http(s):// alebo použiť /api/openai ako predvolený", + }, + }, + Azure: { + ApiKey: { + Title: "API kľúč Azure", + SubTitle: "Skontrolujte svoj API kľúč v Azure konzole", + Placeholder: "API kľúč Azure", + }, + + Endpoint: { + Title: "Koncový bod Azure", + SubTitle: "Príklad: ", + }, + + ApiVerion: { + Title: "Verzia API Azure", + SubTitle: "Skontrolujte svoju verziu API v Azure konzole", + }, + }, + CustomModel: { + Title: "Vlastné modely", + SubTitle: "Možnosti vlastného modelu, oddelené čiarkou", + }, + Google: { + ApiKey: { + Title: "API kľúč", + SubTitle: + "Obísť obmedzenia prístupu heslom pomocou vlastného API kľúča Google AI Studio", + Placeholder: "API kľúč Google AI Studio", + }, + + Endpoint: { + Title: "Adresa koncového bodu", + SubTitle: "Príklad:", + }, + + ApiVerion: { + Title: "Verzia API (gemini-pro verzia API)", + SubTitle: "Vyberte špecifickú verziu časti", + }, + }, + }, + + Model: "Model", + Temperature: { + Title: "Teplota", + SubTitle: "Vyššia hodnota robí výstup náhodnejším", + }, + TopP: { + Title: "Top P", + SubTitle: "Neupravujte túto hodnotu spolu s teplotou", + }, + MaxTokens: { + Title: "Maximálny počet tokenov", + SubTitle: "Maximálna dĺžka vstupných tokenov a generovaných tokenov", + }, + PresencePenalty: { + Title: "Penalizácia za prítomnosť", + SubTitle: + "Vyššia hodnota zvyšuje pravdepodobnosť hovorenia o nových témach", + }, + FrequencyPenalty: { + Title: "Penalizácia za frekvenciu", + SubTitle: + "Vyššia hodnota znižuje pravdepodobnosť opakovania rovnakej línie", + }, + }, + Store: { + DefaultTopic: "Nová konverzácia", + BotHello: "Ahoj! Ako vám dnes môžem pomôcť?", + Error: "Niečo sa pokazilo, skúste to prosím neskôr znova.", + Prompt: { + History: (content: string) => + "Toto je zhrnutie histórie chatu ako rekapitulácia: " + content, + Topic: + "Prosím, vygenerujte štvor- až päťslovný titul, ktorý zhrnie našu konverzáciu bez akéhokoľvek úvodu, interpunkcie, úvodzoviek, bodiek, symbolov, tučného textu alebo ďalšieho textu. Odstráňte uzatváracie úvodzovky.", + Summarize: + "Stručne zhrňte diskusiu na menej ako 200 slov, aby ste ju mohli použiť ako výzvu pre budúci kontext.", + }, + }, + Copy: { + Success: "Skopírované do schránky", + Failed: + "Kopírovanie zlyhalo, prosím udeľte povolenie na prístup k schránke", + }, + Download: { + Success: "Obsah stiahnutý do vášho adresára.", + Failed: "Stiahnutie zlyhalo.", + }, + Context: { + Toast: (x: any) => `S ${x} kontextovými výzvami`, + Edit: "Aktuálne nastavenia chatu", + Add: "Pridať výzvu", + Clear: "Kontext vyčistený", + Revert: "Vrátiť späť", + }, + Plugin: { + Name: "Plugin", + }, + FineTuned: { + Sysmessage: "Ste asistent, ktorý", + }, + Mask: { + Name: "Maska", + Page: { + Title: "Šablóna výziev", + SubTitle: (count: number) => `${count} šablón výziev`, + Search: "Hľadať šablóny", + Create: "Vytvoriť", + }, + Item: { + Info: (count: number) => `${count} výziev`, + Chat: "Chat", + View: "Zobraziť", + Edit: "Upraviť", + Delete: "Vymazať", + DeleteConfirm: "Potvrdiť vymazanie?", + }, + EditModal: { + Title: (readonly: boolean) => + `Upraviť šablónu výziev ${readonly ? "(iba na čítanie)" : ""}`, + Download: "Stiahnuť", + Clone: "Klonovať", + }, + Config: { + Avatar: "Avatar robota", + Name: "Meno robota", + Sync: { + Title: "Použiť globálne nastavenia", + SubTitle: "Použiť globálne nastavenia v tomto chate", + Confirm: "Potvrdiť prepísanie vlastného nastavenia globálnym?", + }, + HideContext: { + Title: "Skryť kontextové výzvy", + SubTitle: "Nezobrazovať kontextové výzvy v chate", + }, + Share: { + Title: "Zdieľať túto masku", + SubTitle: "Vygenerovať odkaz na túto masku", + Action: "Kopírovať odkaz", + }, + }, + }, + NewChat: { + Return: "Vrátiť sa", + Skip: "Len začať", + Title: "Vybrať masku", + SubTitle: "Chatovať s dušou za maskou", + More: "Nájsť viac", + NotShow: "Už nezobrazovať", + ConfirmNoShow: + "Potvrdiť deaktiváciu? Môžete ju neskôr znova povoliť v nastaveniach.", + }, + + UI: { + Confirm: "Potvrdiť", + Cancel: "Zrušiť", + Close: "Zavrieť", + Create: "Vytvoriť", + Edit: "Upraviť", + Export: "Exportovať", + Import: "Importovať", + Sync: "Synchronizovať", + Config: "Konfigurácia", + }, + Exporter: { + Description: { + Title: "Zobrazia sa len správy po vyčistení kontextu", + }, + Model: "Model", + Messages: "Správy", + Topic: "Téma", + Time: "Čas", + }, + + URLCommand: { + Code: "Zistený prístupový kód z URL, potvrdiť na aplikovanie?", + Settings: "Zistené nastavenia z URL, potvrdiť na aplikovanie?", + }, +}; + +export default sk; diff --git a/app/locales/tr.ts b/app/locales/tr.ts index 06996d83dac..524c1b2c546 100644 --- a/app/locales/tr.ts +++ b/app/locales/tr.ts @@ -124,11 +124,7 @@ const tr: PartialLocaleType = { SubTitle: "Sıkıştırılmamış mesajların uzunluğu bu değeri aşarsa sıkıştırılır", }, - Token: { - Title: "API Anahtarı", - SubTitle: "Erişim kodu sınırını yoksaymak için anahtarınızı kullanın", - Placeholder: "OpenAI API Anahtarı", - }, + Usage: { Title: "Hesap Bakiyesi", SubTitle(used: any, total: any) { @@ -138,11 +134,7 @@ const tr: PartialLocaleType = { Check: "Tekrar Kontrol Et", NoAccess: "Bakiyeyi kontrol etmek için API anahtarını girin", }, - AccessCode: { - Title: "Erişim Kodu", - SubTitle: "Erişim kontrolü etkinleştirme", - Placeholder: "Erişim Kodu Gerekiyor", - }, + Model: "Model", Temperature: { Title: "Gerçeklik", diff --git a/app/locales/tw.ts b/app/locales/tw.ts index 15f6648e659..af47e30ff71 100644 --- a/app/locales/tw.ts +++ b/app/locales/tw.ts @@ -7,13 +7,13 @@ const tw: PartialLocaleType = { Unauthorized: "目前您的狀態是未授權,請前往[設定頁面](/#/auth)輸入授權碼。", }, ChatItem: { - ChatItemCount: (count: number) => `${count} 條對話`, + ChatItemCount: (count: number) => `${count} 則對話`, }, Chat: { - SubTitle: (count: number) => `您已經與 ChatGPT 進行了 ${count} 條對話`, + SubTitle: (count: number) => `您已經與 ChatGPT 進行了 ${count} 則對話`, Actions: { - ChatList: "查看訊息列表", - CompressedHistory: "查看壓縮後的歷史 Prompt", + ChatList: "檢視訊息列表", + CompressedHistory: "檢視壓縮後的歷史 Prompt", Export: "匯出聊天紀錄", Copy: "複製", Stop: "停止", @@ -23,15 +23,15 @@ const tw: PartialLocaleType = { Rename: "重新命名對話", Typing: "正在輸入…", Input: (submitKey: string) => { - var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可發送`; + var inputHints = `輸入訊息後,按下 ${submitKey} 鍵即可傳送`; if (submitKey === String(SubmitKey.Enter)) { inputHints += ",Shift + Enter 鍵換行"; } return inputHints; }, - Send: "發送", + Send: "傳送", Config: { - Reset: "重置預設", + Reset: "重設", SaveAs: "另存新檔", }, }, @@ -46,7 +46,7 @@ const tw: PartialLocaleType = { Title: "上下文記憶 Prompt", EmptyContent: "尚未記憶", Copy: "複製全部", - Send: "發送記憶", + Send: "傳送記憶", Reset: "重設對話", ResetConfirm: "重設後將清除目前對話記錄以及歷史記憶,確認重設?", }, @@ -71,22 +71,22 @@ const tw: PartialLocaleType = { }, InjectSystemPrompts: { Title: "匯入系統提示", - SubTitle: "強制在每個請求的訊息列表開頭添加一個模擬 ChatGPT 的系統提示", + SubTitle: "強制在每個請求的訊息列表開頭新增一個模擬 ChatGPT 的系統提示", }, Update: { - Version: (x: string) => `當前版本:${x}`, + Version: (x: string) => `目前版本:${x}`, IsLatest: "已是最新版本", CheckUpdate: "檢查更新", IsChecking: "正在檢查更新...", FoundUpdate: (x: string) => `發現新版本:${x}`, GoToUpdate: "前往更新", }, - SendKey: "發送鍵", + SendKey: "傳送鍵", Theme: "主題", TightBorder: "緊湊邊框", SendPreviewBubble: { Title: "預覽氣泡", - SubTitle: "在預覽氣泡中預覽 Markdown 内容", + SubTitle: "在預覽氣泡中預覽 Markdown 內容", }, Mask: { Splash: { @@ -101,7 +101,7 @@ const tw: PartialLocaleType = { }, List: "自定義提示詞列表", ListCount: (builtin: number, custom: number) => - `內建 ${builtin} 條,用戶定義 ${custom} 條`, + `內建 ${builtin} 條,使用者定義 ${custom} 條`, Edit: "編輯", Modal: { Title: "提示詞列表", @@ -120,11 +120,7 @@ const tw: PartialLocaleType = { Title: "歷史訊息長度壓縮閾值", SubTitle: "當未壓縮的歷史訊息超過該值時,將進行壓縮", }, - Token: { - Title: "API Key", - SubTitle: "使用自己的 Key 可規避授權存取限制", - Placeholder: "OpenAI API Key", - }, + Usage: { Title: "帳戶餘額", SubTitle(used: any, total: any) { @@ -132,13 +128,9 @@ const tw: PartialLocaleType = { }, IsChecking: "正在檢查…", Check: "重新檢查", - NoAccess: "輸入API Key查看餘額", - }, - AccessCode: { - Title: "授權碼", - SubTitle: "目前是未授權存取狀態", - Placeholder: "請輸入授權碼", + NoAccess: "輸入 API Key 檢視餘額", }, + Model: "模型 (model)", Temperature: { Title: "隨機性 (temperature)", @@ -150,7 +142,7 @@ const tw: PartialLocaleType = { }, PresencePenalty: { Title: "話題新穎度 (presence_penalty)", - SubTitle: "值越大,越有可能擴展到新話題", + SubTitle: "值越大,越有可能拓展到新話題", }, FrequencyPenalty: { Title: "頻率懲罰度 (frequency_penalty)", @@ -163,7 +155,7 @@ const tw: PartialLocaleType = { Error: "出錯了,請稍後再嘗試", Prompt: { History: (content: string) => - "這是 AI 與用戶的歷史聊天總結,作為前情提要:" + content, + "這是 AI 與使用者的歷史聊天總結,作為前情提要:" + content, Topic: "Use the language used by the user (e.g. en for english conversation, zh-hant for chinese conversation, etc.) to generate a title (at most 6 words) summarizing our conversation without any lead-in, quotation marks, preamble like 'Title:', direct text copies, single-word replies, quotation marks, translations, or brackets. Remove enclosing quotation marks. The title should make third-party grasp the essence of the conversation in first sight.", Summarize: @@ -192,16 +184,16 @@ const tw: PartialLocaleType = { Item: { Info: (count: number) => `包含 ${count} 條預設對話`, Chat: "對話", - View: "查看", + View: "檢視", Edit: "編輯", - Delete: "删除", - DeleteConfirm: "確認删除?", + Delete: "刪除", + DeleteConfirm: "確認刪除?", }, EditModal: { Title: (readonly: boolean) => - `編輯預設面具 ${readonly ? "(只读)" : ""}`, + `編輯預設面具 ${readonly ? "(只讀)" : ""}`, Download: "下載預設", - Clone: "克隆預設", + Clone: "複製預設", }, Config: { Avatar: "角色頭像", @@ -215,7 +207,7 @@ const tw: PartialLocaleType = { SubTitle: "現在開始,與面具背後的靈魂思維碰撞", More: "搜尋更多", NotShow: "不再呈現", - ConfirmNoShow: "確認禁用?禁用後可以随時在設定中重新啟用。", + ConfirmNoShow: "確認停用?停用後可以隨時在設定中重新啟用。", }, UI: { Confirm: "確認", diff --git a/app/locales/vi.ts b/app/locales/vi.ts index 8f53a3dc1ee..3d95b566497 100644 --- a/app/locales/vi.ts +++ b/app/locales/vi.ts @@ -123,11 +123,7 @@ const vi: PartialLocaleType = { Title: "Ngưỡng nén lịch sử tin nhắn", SubTitle: "Thực hiện nén nếu số lượng tin nhắn chưa nén vượt quá ngưỡng", }, - Token: { - Title: "API Key", - SubTitle: "Sử dụng khóa của bạn để bỏ qua giới hạn mã truy cập", - Placeholder: "OpenAI API Key", - }, + Usage: { Title: "Hạn mức tài khoản", SubTitle(used: any, total: any) { @@ -137,11 +133,7 @@ const vi: PartialLocaleType = { Check: "Kiểm tra", NoAccess: "Nhập API Key để kiểm tra hạn mức", }, - AccessCode: { - Title: "Mã truy cập", - SubTitle: "Đã bật kiểm soát truy cập", - Placeholder: "Nhập mã truy cập", - }, + Model: "Mô hình", Temperature: { Title: "Tính ngẫu nhiên (temperature)", diff --git a/app/masks/en.ts b/app/masks/en.ts index 1ab40d59b03..ed130351f1e 100644 --- a/app/masks/en.ts +++ b/app/masks/en.ts @@ -35,7 +35,7 @@ export const EN_MASKS: BuiltinMask[] = [ id: "prompt-improve-0", role: "user", content: - 'Read all of the instructions below and once you understand them say "Shall we begin:"\n \nI want you to become my Prompt Creator. Your goal is to help me craft the best possible prompt for my needs. The prompt will be used by you, ChatGPT. You will follow the following process:\nYour first response will be to ask me what the prompt should be about. I will provide my answer, but we will need to improve it through continual iterations by going through the next steps.\n \nBased on my input, you will generate 3 sections.\n \nRevised Prompt (provide your rewritten prompt. it should be clear, concise, and easily understood by you)\nSuggestions (provide 3 suggestions on what details to include in the prompt to improve it)\nQuestions (ask the 3 most relevant questions pertaining to what additional information is needed from me to improve the prompt)\n \nAt the end of these sections give me a reminder of my options which are:\n \nOption 1: Read the output and provide more info or answer one or more of the questions\nOption 2: Type "Use this prompt" and I will submit this as a query for you\nOption 3: Type "Restart" to restart this process from the beginning\nOption 4: Type "Quit" to end this script and go back to a regular ChatGPT session\n \nIf I type "Option 2", "2" or "Use this prompt" then we have finsihed and you should use the Revised Prompt as a prompt to generate my request\nIf I type "option 3", "3" or "Restart" then forget the latest Revised Prompt and restart this process\nIf I type "Option 4", "4" or "Quit" then finish this process and revert back to your general mode of operation\n\n\nWe will continue this iterative process with me providing additional information to you and you updating the prompt in the Revised Prompt section until it is complete.', + 'Read all of the instructions below and once you understand them say "Shall we begin:"\n \nI want you to become my Prompt Creator. Your goal is to help me craft the best possible prompt for my needs. The prompt will be used by you, ChatGPT. You will follow the following process:\nYour first response will be to ask me what the prompt should be about. I will provide my answer, but we will need to improve it through continual iterations by going through the next steps.\n \nBased on my input, you will generate 3 sections.\n \nRevised Prompt (provide your rewritten prompt. it should be clear, concise, and easily understood by you)\nSuggestions (provide 3 suggestions on what details to include in the prompt to improve it)\nQuestions (ask the 3 most relevant questions pertaining to what additional information is needed from me to improve the prompt)\n \nAt the end of these sections give me a reminder of my options which are:\n \nOption 1: Read the output and provide more info or answer one or more of the questions\nOption 2: Type "Use this prompt" and I will submit this as a query for you\nOption 3: Type "Restart" to restart this process from the beginning\nOption 4: Type "Quit" to end this script and go back to a regular ChatGPT session\n \nIf I type "Option 2", "2" or "Use this prompt" then we have finished and you should use the Revised Prompt as a prompt to generate my request\nIf I type "option 3", "3" or "Restart" then forget the latest Revised Prompt and restart this process\nIf I type "Option 4", "4" or "Quit" then finish this process and revert back to your general mode of operation\n\n\nWe will continue this iterative process with me providing additional information to you and you updating the prompt in the Revised Prompt section until it is complete.', date: "", }, { diff --git a/app/page.tsx b/app/page.tsx index 20b503174d4..b3f169a9b74 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -10,7 +10,11 @@ export default async function App() { return ( <> - {serverConfig?.isVercel && } + {serverConfig?.isVercel && ( + <> + + + )} ); } diff --git a/app/store/access.ts b/app/store/access.ts index 9eaa81e5ea3..9e8024a6aa8 100644 --- a/app/store/access.ts +++ b/app/store/access.ts @@ -1,23 +1,46 @@ -import { DEFAULT_API_HOST, DEFAULT_MODELS, StoreKey } from "../constant"; +import { + ApiPath, + DEFAULT_API_HOST, + ServiceProvider, + StoreKey, +} from "../constant"; import { getHeaders } from "../client/api"; import { getClientConfig } from "../config/client"; import { createPersistStore } from "../utils/store"; +import { ensure } from "../utils/clone"; let fetchState = 0; // 0 not fetch, 1 fetching, 2 done const DEFAULT_OPENAI_URL = - getClientConfig()?.buildMode === "export" ? DEFAULT_API_HOST : "/api/openai/"; -console.log("[API] default openai url", DEFAULT_OPENAI_URL); + getClientConfig()?.buildMode === "export" ? DEFAULT_API_HOST : ApiPath.OpenAI; const DEFAULT_ACCESS_STATE = { - token: "", accessCode: "", + useCustomConfig: false, + + provider: ServiceProvider.OpenAI, + + // openai + openaiUrl: DEFAULT_OPENAI_URL, + openaiApiKey: "", + + // azure + azureUrl: "", + azureApiKey: "", + azureApiVersion: "2023-08-01-preview", + + // google ai studio + googleUrl: "", + googleApiKey: "", + googleApiVersion: "v1", + + // server config needCode: true, hideUserApiKey: false, hideBalanceQuery: false, disableGPT4: false, - - openaiUrl: DEFAULT_OPENAI_URL, + disableFastLink: false, + customModels: "", }; export const useAccessStore = createPersistStore( @@ -29,21 +52,29 @@ export const useAccessStore = createPersistStore( return get().needCode; }, - updateCode(code: string) { - set(() => ({ accessCode: code?.trim() })); + + isValidOpenAI() { + return ensure(get(), ["openaiApiKey"]); }, - updateToken(token: string) { - set(() => ({ token: token?.trim() })); + + isValidAzure() { + return ensure(get(), ["azureUrl", "azureApiKey", "azureApiVersion"]); }, - updateOpenAiUrl(url: string) { - set(() => ({ openaiUrl: url?.trim() })); + + isValidGoogle() { + return ensure(get(), ["googleApiKey"]); }, + isAuthorized() { this.fetch(); // has token or has code or disabled access control return ( - !!get().token || !!get().accessCode || !this.enabledAccessControl() + this.isValidOpenAI() || + this.isValidAzure() || + this.isValidGoogle() || + !this.enabledAccessControl() || + (this.enabledAccessControl() && ensure(get(), ["accessCode"])) ); }, fetch() { @@ -60,12 +91,6 @@ export const useAccessStore = createPersistStore( .then((res: DangerConfig) => { console.log("[Config] got config from server", res); set(() => ({ ...res })); - - if (res.disableGPT4) { - DEFAULT_MODELS.forEach( - (m: any) => (m.available = !m.name.startsWith("gpt-4")), - ); - } }) .catch(() => { console.error("[Config] failed to fetch config"); @@ -77,6 +102,20 @@ export const useAccessStore = createPersistStore( }), { name: StoreKey.Access, - version: 1, + version: 2, + migrate(persistedState, version) { + if (version < 2) { + const state = persistedState as { + token: string; + openaiApiKey: string; + azureApiVersion: string; + googleApiKey: string; + }; + state.openaiApiKey = state.token; + state.azureApiVersion = "2023-08-01-preview"; + } + + return persistedState as any; + }, }, ); diff --git a/app/store/chat.ts b/app/store/chat.ts index 269cc4a33c9..dff6b7bf1c6 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -1,6 +1,3 @@ -import { create } from "zustand"; -import { persist } from "zustand/middleware"; - import { trimTopic } from "../utils"; import Locale, { getLang } from "../locales"; @@ -10,10 +7,12 @@ import { createEmptyMask, Mask } from "./mask"; import { DEFAULT_INPUT_TEMPLATE, DEFAULT_SYSTEM_TEMPLATE, + KnowledgeCutOffDate, + ModelProvider, StoreKey, SUMMARIZE_MODEL, } from "../constant"; -import { api, RequestMessage } from "../client/api"; +import { ClientApi, RequestMessage } from "../client/api"; import { ChatControllerPool } from "../client/controller"; import { prettyObject } from "../utils/format"; import { estimateTokenLength } from "../utils/token"; @@ -87,39 +86,16 @@ function getSummarizeModel(currentModel: string) { return currentModel.startsWith("gpt") ? SUMMARIZE_MODEL : currentModel; } -interface ChatStore { - sessions: ChatSession[]; - currentSessionIndex: number; - clearSessions: () => void; - moveSession: (from: number, to: number) => void; - selectSession: (index: number) => void; - newSession: (mask?: Mask) => void; - deleteSession: (index: number) => void; - currentSession: () => ChatSession; - nextSession: (delta: number) => void; - onNewMessage: (message: ChatMessage) => void; - onUserInput: (content: string) => Promise; - summarizeSession: () => void; - updateStat: (message: ChatMessage) => void; - updateCurrentSession: (updater: (session: ChatSession) => void) => void; - updateMessage: ( - sessionIndex: number, - messageIndex: number, - updater: (message?: ChatMessage) => void, - ) => void; - resetSession: () => void; - getMessagesWithMemory: () => ChatMessage[]; - getMemoryPrompt: () => ChatMessage; - - clearAllData: () => void; -} - function countMessages(msgs: ChatMessage[]) { return msgs.reduce((pre, cur) => pre + estimateTokenLength(cur.content), 0); } function fillTemplateWith(input: string, modelConfig: ModelConfig) { + let cutoff = + KnowledgeCutOffDate[modelConfig.model] ?? KnowledgeCutOffDate.default; + const vars = { + cutoff, model: modelConfig.model, time: new Date().toLocaleString(), lang: getLang(), @@ -326,6 +302,13 @@ export const useChatStore = createPersistStore( ]); }); + var api: ClientApi; + if (modelConfig.model === "gemini-pro") { + api = new ClientApi(ModelProvider.GeminiPro); + } else { + api = new ClientApi(ModelProvider.GPT); + } + // make request api.llm.chat({ messages: sendMessages, @@ -403,8 +386,12 @@ export const useChatStore = createPersistStore( const contextPrompts = session.mask.context.slice(); // system prompts, to get close to OpenAI Web ChatGPT - const shouldInjectSystemPrompts = modelConfig.enableInjectSystemPrompts; - const systemPrompts = shouldInjectSystemPrompts + const shouldInjectSystemPrompts = + modelConfig.enableInjectSystemPrompts && + session.mask.modelConfig.model.startsWith("gpt-"); + + var systemPrompts: ChatMessage[] = []; + systemPrompts = shouldInjectSystemPrompts ? [ createMessage({ role: "system", @@ -498,6 +485,14 @@ export const useChatStore = createPersistStore( summarizeSession() { const config = useAppConfig.getState(); const session = get().currentSession(); + const modelConfig = session.mask.modelConfig; + + var api: ClientApi; + if (modelConfig.model === "gemini-pro") { + api = new ClientApi(ModelProvider.GeminiPro); + } else { + api = new ClientApi(ModelProvider.GPT); + } // remove error messages if any const messages = session.messages; @@ -529,8 +524,6 @@ export const useChatStore = createPersistStore( }, }); } - - const modelConfig = session.mask.modelConfig; const summarizeIndex = Math.max( session.lastSummarizeIndex, session.clearContextIndex ?? 0, @@ -582,7 +575,10 @@ export const useChatStore = createPersistStore( }, onFinish(message) { console.log("[Memory] ", message); - session.lastSummarizeIndex = lastSummarizeIndex; + get().updateCurrentSession((session) => { + session.lastSummarizeIndex = lastSummarizeIndex; + session.memoryPrompt = message; // Update the memory prompt for stored it in local storage + }); }, onError(err) { console.error("[Summarize] ", err); diff --git a/app/store/config.ts b/app/store/config.ts index 0c6ac156d54..20bf664df56 100644 --- a/app/store/config.ts +++ b/app/store/config.ts @@ -1,6 +1,12 @@ import { LLMModel } from "../client/api"; +import { isMacOS } from "../utils"; import { getClientConfig } from "../config/client"; -import { DEFAULT_INPUT_TEMPLATE, DEFAULT_MODELS, StoreKey } from "../constant"; +import { + DEFAULT_INPUT_TEMPLATE, + DEFAULT_MODELS, + DEFAULT_SIDEBAR_WIDTH, + StoreKey, +} from "../constant"; import { createPersistStore } from "../utils/store"; export type ModelType = (typeof DEFAULT_MODELS)[number]["name"]; @@ -22,14 +28,14 @@ export enum Theme { export const DEFAULT_CONFIG = { lastUpdate: Date.now(), // timestamp, to merge state - submitKey: SubmitKey.CtrlEnter as SubmitKey, - avatar: "1f468-200d-1f4bb", + submitKey: SubmitKey.Enter, + avatar: "1f603", fontSize: 14, theme: Theme.Auto as Theme, tightBorder: !!getClientConfig()?.isApp, sendPreviewBubble: true, enableAutoGenerateTitle: true, - sidebarWidth: 300, + sidebarWidth: DEFAULT_SIDEBAR_WIDTH, disablePromptHint: false, @@ -43,7 +49,7 @@ export const DEFAULT_CONFIG = { model: "gpt-3.5-turbo" as ModelType, temperature: 0.5, top_p: 1, - max_tokens: 2000, + max_tokens: 4000, presence_penalty: 0, frequency_penalty: 0, sendMemory: true, @@ -64,7 +70,7 @@ export function limitNumber( max: number, defaultValue: number, ) { - if (typeof x !== "number" || isNaN(x)) { + if (isNaN(x)) { return defaultValue; } @@ -76,7 +82,7 @@ export const ModalConfigValidator = { return x as ModelType; }, max_tokens(x: number) { - return limitNumber(x, 0, 100000, 2000); + return limitNumber(x, 0, 512000, 1024); }, presence_penalty(x: number) { return limitNumber(x, -2, 2, 0); @@ -122,15 +128,7 @@ export const useAppConfig = createPersistStore( })); }, - allModels() { - const customModels = get() - .customModels.split(",") - .filter((v) => !!v && v.length > 0) - .map((m) => ({ name: m, available: true })); - - const models = get().models.concat(customModels); - return models; - }, + allModels() {}, }), { name: StoreKey.Config, diff --git a/app/store/sync.ts b/app/store/sync.ts index 466a98cf5c3..b74f6895f6d 100644 --- a/app/store/sync.ts +++ b/app/store/sync.ts @@ -1,15 +1,19 @@ +import { getClientConfig } from "../config/client"; import { Updater } from "../typing"; -import { StoreKey } from "../constant"; +import { ApiPath, STORAGE_KEY, StoreKey } from "../constant"; import { createPersistStore } from "../utils/store"; import { AppState, getLocalAppState, + GetStoreState, mergeAppState, setLocalAppState, } from "../utils/sync"; import { downloadAs, readFromFile } from "../utils"; import { showToast } from "../components/ui-lib"; import Locale from "../locales"; +import { createSyncClient, ProviderType } from "../utils/cloud"; +import { corsPath } from "../utils/cors"; export interface WebDavConfig { server: string; @@ -17,22 +21,50 @@ export interface WebDavConfig { password: string; } -export const useSyncStore = createPersistStore( - { - webDavConfig: { - server: "", - username: "", - password: "", - }, +const isApp = !!getClientConfig()?.isApp; +export type SyncStore = GetStoreState; + +const DEFAULT_SYNC_STATE = { + provider: ProviderType.WebDAV, + useProxy: true, + proxyUrl: corsPath(ApiPath.Cors), - lastSyncTime: 0, + webdav: { + endpoint: "", + username: "", + password: "", }, + + upstash: { + endpoint: "", + username: STORAGE_KEY, + apiKey: "", + }, + + lastSyncTime: 0, + lastProvider: "", +}; + +export const useSyncStore = createPersistStore( + DEFAULT_SYNC_STATE, (set, get) => ({ + coundSync() { + const config = get()[get().provider]; + return Object.values(config).every((c) => c.toString().length > 0); + }, + + markSyncTime() { + set({ lastSyncTime: Date.now(), lastProvider: get().provider }); + }, + export() { const state = getLocalAppState(); - const fileName = `Backup-${new Date().toLocaleString()}.json`; + const datePart = isApp + ? `${new Date().toLocaleDateString().replace(/\//g, '_')} ${new Date().toLocaleTimeString().replace(/:/g, '_')}` + : new Date().toLocaleString(); + + const fileName = `Backup-${datePart}.json`; downloadAs(JSON.stringify(state), fileName); - set({ lastSyncTime: Date.now() }); }, async import() { @@ -50,46 +82,50 @@ export const useSyncStore = createPersistStore( } }, - async check() { - try { - const res = await fetch(this.path(""), { - method: "PROFIND", - headers: this.headers(), - }); - console.log(res); - return res.status === 207; - } catch (e) { - console.error("[Sync] ", e); - return false; - } + getClient() { + const provider = get().provider; + const client = createSyncClient(provider, get()); + return client; }, - path(path: string) { - let url = get().webDavConfig.server; + async sync() { + const localState = getLocalAppState(); + const provider = get().provider; + const config = get()[provider]; + const client = this.getClient(); - if (!url.endsWith("/")) { - url += "/"; + try { + const remoteState = JSON.parse( + await client.get(config.username), + ) as AppState; + mergeAppState(localState, remoteState); + setLocalAppState(localState); + } catch (e) { + console.log("[Sync] failed to get remote state", e); } - if (path.startsWith("/")) { - path = path.slice(1); - } + await client.set(config.username, JSON.stringify(localState)); - return url + path; + this.markSyncTime(); }, - headers() { - const auth = btoa( - [get().webDavConfig.username, get().webDavConfig.password].join(":"), - ); - - return { - Authorization: `Basic ${auth}`, - }; + async check() { + const client = this.getClient(); + return await client.check(); }, }), { name: StoreKey.Sync, - version: 1, + version: 1.1, + + migrate(persistedState, version) { + const newState = persistedState as typeof DEFAULT_SYNC_STATE; + + if (version < 1.1) { + newState.upstash.username = STORAGE_KEY; + } + + return newState as any; + }, }, ); diff --git a/app/store/update.ts b/app/store/update.ts index 42b86586c62..7253caffcb9 100644 --- a/app/store/update.ts +++ b/app/store/update.ts @@ -1,9 +1,19 @@ -import { FETCH_COMMIT_URL, FETCH_TAG_URL, StoreKey } from "../constant"; -import { api } from "../client/api"; +import { + FETCH_COMMIT_URL, + FETCH_TAG_URL, + ModelProvider, + StoreKey, +} from "../constant"; import { getClientConfig } from "../config/client"; import { createPersistStore } from "../utils/store"; +import ChatGptIcon from "../icons/chatgpt.png"; +import Locale from "../locales"; +import { use } from "react"; +import { useAppConfig } from "."; +import { ClientApi } from "../client/api"; const ONE_MINUTE = 60 * 1000; +const isApp = !!getClientConfig()?.isApp; function formatVersionDate(t: string) { const d = new Date(+t); @@ -80,6 +90,43 @@ export const useUpdateStore = createPersistStore( set(() => ({ remoteVersion: remoteId, })); + if (window.__TAURI__?.notification && isApp) { + // Check if notification permission is granted + await window.__TAURI__?.notification + .isPermissionGranted() + .then((granted) => { + if (!granted) { + return; + } else { + // Request permission to show notifications + window.__TAURI__?.notification + .requestPermission() + .then((permission) => { + if (permission === "granted") { + if (version === remoteId) { + // Show a notification using Tauri + window.__TAURI__?.notification.sendNotification({ + title: "NextChat", + body: `${Locale.Settings.Update.IsLatest}`, + icon: `${ChatGptIcon.src}`, + sound: "Default", + }); + } else { + const updateMessage = + Locale.Settings.Update.FoundUpdate(`${remoteId}`); + // Show a notification for the new version using Tauri + window.__TAURI__?.notification.sendNotification({ + title: "NextChat", + body: updateMessage, + icon: `${ChatGptIcon.src}`, + sound: "Default", + }); + } + } + }); + } + }); + } console.log("[Got Upstream] ", remoteId); } catch (error) { console.error("[Fetch Upstream Commit Id]", error); @@ -87,6 +134,7 @@ export const useUpdateStore = createPersistStore( }, async updateUsage(force = false) { + // only support openai for now const overOneMinute = Date.now() - get().lastUpdateUsage >= ONE_MINUTE; if (!overOneMinute && !force) return; @@ -95,6 +143,7 @@ export const useUpdateStore = createPersistStore( })); try { + const api = new ClientApi(ModelProvider.GPT); const usage = await api.llm.usage(); if (usage) { diff --git a/app/styles/globals.scss b/app/styles/globals.scss index def28680c1a..aa22b7d4fd6 100644 --- a/app/styles/globals.scss +++ b/app/styles/globals.scss @@ -357,3 +357,7 @@ pre { overflow: hidden; text-overflow: ellipsis; } + +.copyable { + user-select: text; +} diff --git a/app/utils.ts b/app/utils.ts index 37c17dd760d..ac7e80e7afd 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -3,7 +3,10 @@ import { showToast } from "./components/ui-lib"; import Locale from "./locales"; export function trimTopic(topic: string) { - return topic.replace(/[,。!?”“"、,.!?]*$/, ""); + // Fix an issue where double quotes still show in the Indonesian language + // This will remove the specified punctuation from the end of the string + // and also trim quotes from both the start and end if they exist. + return topic.replace(/^["“”]+|["“”]+$/g, "").replace(/[,。!?”“"、,.!?]*$/, ""); } export async function copyToClipboard(text: string) { @@ -31,12 +34,41 @@ export async function copyToClipboard(text: string) { } } -export function downloadAs(text: string, filename: string) { - const element = document.createElement("a"); - element.setAttribute( - "href", - "data:text/plain;charset=utf-8," + encodeURIComponent(text), - ); +export async function downloadAs(text: string, filename: string) { + if (window.__TAURI__) { + const result = await window.__TAURI__.dialog.save({ + defaultPath: `${filename}`, + filters: [ + { + name: `${filename.split('.').pop()} files`, + extensions: [`${filename.split('.').pop()}`], + }, + { + name: "All Files", + extensions: ["*"], + }, + ], + }); + + if (result !== null) { + try { + await window.__TAURI__.fs.writeBinaryFile( + result, + new Uint8Array([...text].map((c) => c.charCodeAt(0))) + ); + showToast(Locale.Download.Success); + } catch (error) { + showToast(Locale.Download.Failed); + } + } else { + showToast(Locale.Download.Failed); + } + } else { + const element = document.createElement("a"); + element.setAttribute( + "href", + "data:text/plain;charset=utf-8," + encodeURIComponent(text), + ); element.setAttribute("download", filename); element.style.display = "none"; @@ -46,7 +78,7 @@ export function downloadAs(text: string, filename: string) { document.body.removeChild(element); } - +} export function readFromFile() { return new Promise((res, rej) => { const fileInput = document.createElement("input"); @@ -173,3 +205,15 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) { export function getCSSVar(varName: string) { return getComputedStyle(document.body).getPropertyValue(varName).trim(); } + +/** + * Detects Macintosh + */ +export function isMacOS(): boolean { + if (typeof window !== "undefined") { + let userAgent = window.navigator.userAgent.toLocaleLowerCase(); + const macintosh = /iphone|ipad|ipod|macintosh/.test(userAgent) + return !!macintosh + } + return false +} diff --git a/app/utils/clone.ts b/app/utils/clone.ts index 2958b6b9c35..e4cd291111d 100644 --- a/app/utils/clone.ts +++ b/app/utils/clone.ts @@ -1,3 +1,12 @@ export function deepClone(obj: T) { return JSON.parse(JSON.stringify(obj)); } + +export function ensure( + obj: T, + keys: Array<[keyof T][number]>, +) { + return keys.every( + (k) => obj[k] !== undefined && obj[k] !== null && obj[k] !== "", + ); +} diff --git a/app/utils/cloud/index.ts b/app/utils/cloud/index.ts new file mode 100644 index 00000000000..63908249e85 --- /dev/null +++ b/app/utils/cloud/index.ts @@ -0,0 +1,33 @@ +import { createWebDavClient } from "./webdav"; +import { createUpstashClient } from "./upstash"; + +export enum ProviderType { + WebDAV = "webdav", + UpStash = "upstash", +} + +export const SyncClients = { + [ProviderType.UpStash]: createUpstashClient, + [ProviderType.WebDAV]: createWebDavClient, +} as const; + +type SyncClientConfig = { + [K in keyof typeof SyncClients]: (typeof SyncClients)[K] extends ( + _: infer C, + ) => any + ? C + : never; +}; + +export type SyncClient = { + get: (key: string) => Promise; + set: (key: string, value: string) => Promise; + check: () => Promise; +}; + +export function createSyncClient( + provider: T, + config: SyncClientConfig[T], +): SyncClient { + return SyncClients[provider](config as any) as any; +} diff --git a/app/utils/cloud/upstash.ts b/app/utils/cloud/upstash.ts new file mode 100644 index 00000000000..5f5b9fc7925 --- /dev/null +++ b/app/utils/cloud/upstash.ts @@ -0,0 +1,101 @@ +import { STORAGE_KEY } from "@/app/constant"; +import { SyncStore } from "@/app/store/sync"; +import { corsFetch } from "../cors"; +import { chunks } from "../format"; + +export type UpstashConfig = SyncStore["upstash"]; +export type UpStashClient = ReturnType; + +export function createUpstashClient(store: SyncStore) { + const config = store.upstash; + const storeKey = config.username.length === 0 ? STORAGE_KEY : config.username; + const chunkCountKey = `${storeKey}-chunk-count`; + const chunkIndexKey = (i: number) => `${storeKey}-chunk-${i}`; + + const proxyUrl = + store.useProxy && store.proxyUrl.length > 0 ? store.proxyUrl : undefined; + + return { + async check() { + try { + const res = await corsFetch(this.path(`get/${storeKey}`), { + method: "GET", + headers: this.headers(), + proxyUrl, + }); + console.log("[Upstash] check", res.status, res.statusText); + return [200].includes(res.status); + } catch (e) { + console.error("[Upstash] failed to check", e); + } + return false; + }, + + async redisGet(key: string) { + const res = await corsFetch(this.path(`get/${key}`), { + method: "GET", + headers: this.headers(), + proxyUrl, + }); + + console.log("[Upstash] get key = ", key, res.status, res.statusText); + const resJson = (await res.json()) as { result: string }; + + return resJson.result; + }, + + async redisSet(key: string, value: string) { + const res = await corsFetch(this.path(`set/${key}`), { + method: "POST", + headers: this.headers(), + body: value, + proxyUrl, + }); + + console.log("[Upstash] set key = ", key, res.status, res.statusText); + }, + + async get() { + const chunkCount = Number(await this.redisGet(chunkCountKey)); + if (!Number.isInteger(chunkCount)) return; + + const chunks = await Promise.all( + new Array(chunkCount) + .fill(0) + .map((_, i) => this.redisGet(chunkIndexKey(i))), + ); + console.log("[Upstash] get full chunks", chunks); + return chunks.join(""); + }, + + async set(_: string, value: string) { + // upstash limit the max request size which is 1Mb for “Free” and “Pay as you go” + // so we need to split the data to chunks + let index = 0; + for await (const chunk of chunks(value)) { + await this.redisSet(chunkIndexKey(index), chunk); + index += 1; + } + await this.redisSet(chunkCountKey, index.toString()); + }, + + headers() { + return { + Authorization: `Bearer ${config.apiKey}`, + }; + }, + path(path: string) { + let url = config.endpoint; + + if (!url.endsWith("/")) { + url += "/"; + } + + if (path.startsWith("/")) { + path = path.slice(1); + } + + return url + path; + }, + }; +} diff --git a/app/utils/cloud/webdav.ts b/app/utils/cloud/webdav.ts new file mode 100644 index 00000000000..3a1553c1035 --- /dev/null +++ b/app/utils/cloud/webdav.ts @@ -0,0 +1,76 @@ +import { STORAGE_KEY } from "@/app/constant"; +import { SyncStore } from "@/app/store/sync"; +import { corsFetch } from "../cors"; + +export type WebDAVConfig = SyncStore["webdav"]; +export type WebDavClient = ReturnType; + +export function createWebDavClient(store: SyncStore) { + const folder = STORAGE_KEY; + const fileName = `${folder}/backup.json`; + const config = store.webdav; + const proxyUrl = + store.useProxy && store.proxyUrl.length > 0 ? store.proxyUrl : undefined; + + return { + async check() { + try { + const res = await corsFetch(this.path(folder), { + method: "MKCOL", + headers: this.headers(), + proxyUrl, + }); + console.log("[WebDav] check", res.status, res.statusText); + return [201, 200, 404, 301, 302, 307, 308].includes(res.status); + } catch (e) { + console.error("[WebDav] failed to check", e); + } + + return false; + }, + + async get(key: string) { + const res = await corsFetch(this.path(fileName), { + method: "GET", + headers: this.headers(), + proxyUrl, + }); + + console.log("[WebDav] get key = ", key, res.status, res.statusText); + + return await res.text(); + }, + + async set(key: string, value: string) { + const res = await corsFetch(this.path(fileName), { + method: "PUT", + headers: this.headers(), + body: value, + proxyUrl, + }); + + console.log("[WebDav] set key = ", key, res.status, res.statusText); + }, + + headers() { + const auth = btoa(config.username + ":" + config.password); + + return { + authorization: `Basic ${auth}`, + }; + }, + path(path: string) { + let url = config.endpoint; + + if (!url.endsWith("/")) { + url += "/"; + } + + if (path.startsWith("/")) { + path = path.slice(1); + } + + return url + path; + }, + }; +} diff --git a/app/utils/cors.ts b/app/utils/cors.ts new file mode 100644 index 00000000000..773f152aafa --- /dev/null +++ b/app/utils/cors.ts @@ -0,0 +1,50 @@ +import { getClientConfig } from "../config/client"; +import { ApiPath, DEFAULT_CORS_HOST } from "../constant"; + +export function corsPath(path: string) { + const baseUrl = getClientConfig()?.isApp ? `${DEFAULT_CORS_HOST}` : ""; + + if (!path.startsWith("/")) { + path = "/" + path; + } + + if (!path.endsWith("/")) { + path += "/"; + } + + return `${baseUrl}${path}`; +} + +export function corsFetch( + url: string, + options: RequestInit & { + proxyUrl?: string; + }, +) { + if (!url.startsWith("http")) { + throw Error("[CORS Fetch] url must starts with http/https"); + } + + let proxyUrl = options.proxyUrl ?? corsPath(ApiPath.Cors); + if (!proxyUrl.endsWith("/")) { + proxyUrl += "/"; + } + + url = url.replace("://", "/"); + + const corsOptions = { + ...options, + method: "POST", + headers: options.method + ? { + ...options.headers, + method: options.method, + } + : options.headers, + }; + + const corsUrl = proxyUrl + url; + console.info("[CORS] target = ", corsUrl); + + return fetch(corsUrl, corsOptions); +} diff --git a/app/utils/format.ts b/app/utils/format.ts index 450d66696d9..2e8a382b95a 100644 --- a/app/utils/format.ts +++ b/app/utils/format.ts @@ -11,3 +11,18 @@ export function prettyObject(msg: any) { } return ["```json", msg, "```"].join("\n"); } + +export function* chunks(s: string, maxBytes = 1000 * 1000) { + const decoder = new TextDecoder("utf-8"); + let buf = new TextEncoder().encode(s); + while (buf.length) { + let i = buf.lastIndexOf(32, maxBytes + 1); + // If no space found, try forward search + if (i < 0) i = buf.indexOf(32, maxBytes); + // If there's no space at all, take all + if (i < 0) i = buf.length; + // This is a safe cut-off point; never half-way a multi-byte + yield decoder.decode(buf.slice(0, i)); + buf = buf.slice(i + 1); // Skip space (if any) + } +} diff --git a/app/utils/hooks.ts b/app/utils/hooks.ts new file mode 100644 index 00000000000..35d1f53a4c9 --- /dev/null +++ b/app/utils/hooks.ts @@ -0,0 +1,16 @@ +import { useMemo } from "react"; +import { useAccessStore, useAppConfig } from "../store"; +import { collectModels } from "./model"; + +export function useAllModels() { + const accessStore = useAccessStore(); + const configStore = useAppConfig(); + const models = useMemo(() => { + return collectModels( + configStore.models, + [configStore.customModels, accessStore.customModels].join(","), + ); + }, [accessStore.customModels, configStore.customModels, configStore.models]); + + return models; +} diff --git a/app/utils/model.ts b/app/utils/model.ts new file mode 100644 index 00000000000..b2a42ef022a --- /dev/null +++ b/app/utils/model.ts @@ -0,0 +1,61 @@ +import { LLMModel } from "../client/api"; + +export function collectModelTable( + models: readonly LLMModel[], + customModels: string, +) { + const modelTable: Record< + string, + { + available: boolean; + name: string; + displayName: string; + provider?: LLMModel["provider"]; // Marked as optional + } + > = {}; + + // default models + models.forEach((m) => { + modelTable[m.name] = { + ...m, + displayName: m.name, // 'provider' is copied over if it exists + }; + }); + + // server custom models + customModels + .split(",") + .filter((v) => !!v && v.length > 0) + .forEach((m) => { + const available = !m.startsWith("-"); + const nameConfig = + m.startsWith("+") || m.startsWith("-") ? m.slice(1) : m; + const [name, displayName] = nameConfig.split("="); + + // enable or disable all models + if (name === "all") { + Object.values(modelTable).forEach((model) => (model.available = available)); + } else { + modelTable[name] = { + name, + displayName: displayName || name, + available, + provider: modelTable[name]?.provider, // Use optional chaining + }; + } + }); + return modelTable; +} + +/** + * Generate full model table. + */ +export function collectModels( + models: readonly LLMModel[], + customModels: string, +) { + const modelTable = collectModelTable(models, customModels); + const allModels = Object.values(modelTable); + + return allModels; +} diff --git a/app/utils/store.ts b/app/utils/store.ts index cd151dc4925..684a1911279 100644 --- a/app/utils/store.ts +++ b/app/utils/store.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import { persist } from "zustand/middleware"; +import { combine, persist } from "zustand/middleware"; import { Updater } from "../typing"; import { deepClone } from "./clone"; @@ -23,33 +23,42 @@ type SetStoreState = ( replace?: boolean | undefined, ) => void; -export function createPersistStore( - defaultState: T, +export function createPersistStore( + state: T, methods: ( set: SetStoreState>, get: () => T & MakeUpdater, ) => M, persistOptions: SecondParam>>, ) { - return create>()( - persist((set, get) => { - return { - ...defaultState, - ...methods(set as any, get), - - lastUpdateTime: 0, - markUpdate() { - set({ lastUpdateTime: Date.now() } as Partial< - T & M & MakeUpdater - >); + return create( + persist( + combine( + { + ...state, + lastUpdateTime: 0, }, - update(updater) { - const state = deepClone(get()); - updater(state); - get().markUpdate(); - set(state); + (set, get) => { + return { + ...methods(set, get as any), + + markUpdate() { + set({ lastUpdateTime: Date.now() } as Partial< + T & M & MakeUpdater + >); + }, + update(updater) { + const state = deepClone(get()); + updater(state); + set({ + ...state, + lastUpdateTime: Date.now(), + }); + }, + } as M & MakeUpdater; }, - }; - }, persistOptions), + ), + persistOptions as any, + ), ); } diff --git a/app/utils/sync.ts b/app/utils/sync.ts index ab1f1f44918..1acfc1289de 100644 --- a/app/utils/sync.ts +++ b/app/utils/sync.ts @@ -69,6 +69,9 @@ const MergeStates: StateMerger = { localState.sessions.forEach((s) => (localSessions[s.id] = s)); remoteState.sessions.forEach((remoteSession) => { + // skip empty chats + if (remoteSession.messages.length === 0) return; + const localSession = localSessions[remoteSession.id]; if (!localSession) { // if remote session is new, just merge it diff --git a/docker-compose.yml b/docker-compose.yml index c4312cfe3f3..935b126a394 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,30 +1,38 @@ -version: '3.9' +version: "3.9" services: - chatgpt-next-web: - profiles: ["no-proxy"] + chatgpt-next-web: + profiles: [ "no-proxy" ] container_name: chatgpt-next-web image: yidadaa/chatgpt-next-web ports: - 3000:3000 environment: - OPENAI_API_KEY=$OPENAI_API_KEY + - GOOGLE_API_KEY=$GOOGLE_API_KEY - CODE=$CODE - BASE_URL=$BASE_URL - OPENAI_ORG_ID=$OPENAI_ORG_ID - HIDE_USER_API_KEY=$HIDE_USER_API_KEY - DISABLE_GPT4=$DISABLE_GPT4 + - ENABLE_BALANCE_QUERY=$ENABLE_BALANCE_QUERY + - DISABLE_FAST_LINK=$DISABLE_FAST_LINK + - OPENAI_SB=$OPENAI_SB - chatgpt-next-web-proxy: - profiles: ["proxy"] + chatgpt-next-web-proxy: + profiles: [ "proxy" ] container_name: chatgpt-next-web-proxy image: yidadaa/chatgpt-next-web ports: - 3000:3000 environment: - OPENAI_API_KEY=$OPENAI_API_KEY + - GOOGLE_API_KEY=$GOOGLE_API_KEY - CODE=$CODE - PROXY_URL=$PROXY_URL - BASE_URL=$BASE_URL - OPENAI_ORG_ID=$OPENAI_ORG_ID - HIDE_USER_API_KEY=$HIDE_USER_API_KEY - DISABLE_GPT4=$DISABLE_GPT4 + - ENABLE_BALANCE_QUERY=$ENABLE_BALANCE_QUERY + - DISABLE_FAST_LINK=$DISABLE_FAST_LINK + - OPENAI_SB=$OPENAI_SB diff --git a/docs/cloudflare-pages-cn.md b/docs/cloudflare-pages-cn.md index 2f9a99f2d41..137bb9dc328 100644 --- a/docs/cloudflare-pages-cn.md +++ b/docs/cloudflare-pages-cn.md @@ -1,6 +1,7 @@ # Cloudflare Pages 部署指南 ## 如何新建项目 + 在 Github 上 fork 本项目,然后登录到 dash.cloudflare.com 并进入 Pages。 1. 点击 "Create a project"。 @@ -12,7 +13,7 @@ 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 + npx @cloudflare/next-on-pages@1.5.0 ``` 9. 对于 "Build output directory",使用默认值并且不要修改。 10. 不要修改 "Root Directory"。 @@ -30,10 +31,12 @@ - `OPENAI_ORG_ID= 可选填,指定 OpenAI 中的组织 ID` - `HIDE_USER_API_KEY=1 可选,不让用户自行填入 API Key` - `DISABLE_GPT4=1 可选,不让用户使用 GPT-4` - + - `ENABLE_BALANCE_QUERY=1 可选,启用余额查询功能` + - `DISABLE_FAST_LINK=1 可选,禁用从链接解析预制设置` + 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 +17. Enjoy. diff --git a/docs/cloudflare-pages-en.md b/docs/cloudflare-pages-en.md index 2279ff232a4..c5d55043872 100644 --- a/docs/cloudflare-pages-en.md +++ b/docs/cloudflare-pages-en.md @@ -1,6 +1,7 @@ # 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". @@ -11,12 +12,13 @@ Fork this project on GitHub, then log in to dash.cloudflare.com and go to Pages. 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 @cloudflare/next-on-pages --experimental-minify - ``` + ``` + npx @cloudflare/next-on-pages --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` @@ -29,7 +31,10 @@ Fork this project on GitHub, then log in to dash.cloudflare.com and go to Pages. - `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` - + - `ENABLE_BALANCE_QUERY=1 Optional, allow users to query balance` + - `DISABLE_FAST_LINK=1 Optional, disable parse settings from url` + - `OPENAI_SB=1 Optional,use the third-party OpenAI-SB API` + 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". diff --git a/docs/faq-cn.md b/docs/faq-cn.md index bf79ef7d991..06a96852b7d 100644 --- a/docs/faq-cn.md +++ b/docs/faq-cn.md @@ -23,7 +23,7 @@ Docker 版本相当于稳定版,latest Docker 总是与 latest release version ## 如何修改 Vercel 环境变量 - 进入 vercel 的控制台页面; -- 选中你的 chatgpt next web 项目; +- 选中你的 NextChat 项目; - 点击页面头部的 Settings 选项; - 找到侧边栏的 Environment Variables 选项; - 修改对应的值即可。 diff --git a/docs/faq-ko.md b/docs/faq-ko.md index 9eb6bbbb259..b0d28917f56 100644 --- a/docs/faq-ko.md +++ b/docs/faq-ko.md @@ -23,7 +23,7 @@ Docker 버전은 사실상 안정된 버전과 같습니다. latest Docker는 ## Vercel 환경 변수를 어떻게 수정하나요? - Vercel의 제어판 페이지로 이동합니다. -- chatgpt next web 프로젝트를 선택합니다. +- NextChat 프로젝트를 선택합니다. - 페이지 상단의 Settings 옵션을 클릭합니다. - 사이드바의 Environment Variables 옵션을 찾습니다. - 해당 값을 수정합니다. diff --git a/docs/images/head-cover.png b/docs/images/head-cover.png new file mode 100644 index 00000000000..859d83b05d4 Binary files /dev/null and b/docs/images/head-cover.png differ diff --git a/docs/images/upstash-1.png b/docs/images/upstash-1.png new file mode 100644 index 00000000000..5813c521f3c Binary files /dev/null and b/docs/images/upstash-1.png differ diff --git a/docs/images/upstash-2.png b/docs/images/upstash-2.png new file mode 100644 index 00000000000..91078642d3b Binary files /dev/null and b/docs/images/upstash-2.png differ diff --git a/docs/images/upstash-3.png b/docs/images/upstash-3.png new file mode 100644 index 00000000000..06c53d190e1 Binary files /dev/null and b/docs/images/upstash-3.png differ diff --git a/docs/images/upstash-4.png b/docs/images/upstash-4.png new file mode 100644 index 00000000000..ae301c4d349 Binary files /dev/null and b/docs/images/upstash-4.png differ diff --git a/docs/images/upstash-5.png b/docs/images/upstash-5.png new file mode 100644 index 00000000000..728a374600f Binary files /dev/null and b/docs/images/upstash-5.png differ diff --git a/docs/images/upstash-6.png b/docs/images/upstash-6.png new file mode 100644 index 00000000000..0991c89cf80 Binary files /dev/null and b/docs/images/upstash-6.png differ diff --git a/docs/images/upstash-7.png b/docs/images/upstash-7.png new file mode 100644 index 00000000000..3b3408537ad Binary files /dev/null and b/docs/images/upstash-7.png differ diff --git a/docs/synchronise-chat-logs-cn.md b/docs/synchronise-chat-logs-cn.md new file mode 100644 index 00000000000..59f2774292e --- /dev/null +++ b/docs/synchronise-chat-logs-cn.md @@ -0,0 +1,31 @@ +# 同步聊天记录 +## 准备工作 +- GitHub账号 +- 拥有自己搭建过的ChatGPT-Next-Web的服务器 +- [UpStash](https://upstash.com) + +## 开始教程 +1. 注册UpStash账号 +2. 创建数据库 + + ![注册登录](./images/upstash-1.png) + + ![创建数据库](./images/upstash-2.png) + + ![选择服务器](./images/upstash-3.png) + +3. 找到REST API,分别复制UPSTASH_REDIS_REST_URL和UPSTASH_REDIS_REST_TOKEN(⚠切记⚠:不要泄露Token!) + + ![复制](./images/upstash-4.png) + +4. UPSTASH_REDIS_REST_URL和UPSTASH_REDIS_REST_TOKEN复制到你的同步配置,点击**检查可用性** + + ![同步1](./images/upstash-5.png) + + 如果没什么问题,那就成功了 + + ![同步可用性完成的样子](./images/upstash-6.png) + +5. Success! + + ![好耶~!](./images/upstash-7.png) diff --git a/docs/synchronise-chat-logs-en.md b/docs/synchronise-chat-logs-en.md new file mode 100644 index 00000000000..04d05607175 --- /dev/null +++ b/docs/synchronise-chat-logs-en.md @@ -0,0 +1,31 @@ +# Synchronize Chat Logs with UpStash +## Prerequisites +- GitHub account +- Your own ChatGPT-Next-Web server set up +- [UpStash](https://upstash.com) + +## Getting Started +1. Register for an UpStash account. +2. Create a database. + + ![Register and Login](./images/upstash-1.png) + + ![Create Database](./images/upstash-2.png) + + ![Select Server](./images/upstash-3.png) + +3. Find the REST API and copy UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN (⚠Important⚠: Do not share your token!) + + ![Copy](./images/upstash-4.png) + +4. Copy UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN into your synchronization configuration, then click **Check Availability**. + + ![Synchronize 1](./images/upstash-5.png) + + If everything is in order, you've successfully completed this step. + + ![Sync Availability Check Completed](./images/upstash-6.png) + +5. Success! + + ![Great job~!](./images/upstash-7.png) \ No newline at end of file diff --git a/docs/synchronise-chat-logs-es.md b/docs/synchronise-chat-logs-es.md new file mode 100644 index 00000000000..40135f1f620 --- /dev/null +++ b/docs/synchronise-chat-logs-es.md @@ -0,0 +1,31 @@ +# Sincronizzare i Log delle Chat con UpStash +## Prerequisiti +- Account GitHub +- Server ChatGPT-Next-Web di propria configurazione +- [UpStash](https://upstash.com) + +## Per iniziare +1. Registrarsi per un account UpStash. +2. Creare un database. + + ![Registrarsi ed Accedere](./images/upstash-1.png) + + ![Creare un Database](./images/upstash-2.png) + + ![Selezionare il Server](./images/upstash-3.png) + +3. Trovare l'API REST e copiare UPSTASH_REDIS_REST_URL e UPSTASH_REDIS_REST_TOKEN (⚠Importante⚠: Non condividere il token!) + + ![Copia](./images/upstash-4.png) + +4. Copiare UPSTASH_REDIS_REST_URL e UPSTASH_REDIS_REST_TOKEN nella configurazione di sincronizzazione, quindi fare clic su **Verifica la Disponibilità**. + + ![Sincronizzazione 1](./images/upstash-5.png) + + Se tutto è in ordine, hai completato con successo questa fase. + + ![Verifica la Disponibilità della Sincronizzazione Completata](./images/upstash-6.png) + +5. Successo! + + ![Ottimo lavoro~!](./images/upstash-7.png) \ No newline at end of file diff --git a/docs/synchronise-chat-logs-ja.md b/docs/synchronise-chat-logs-ja.md new file mode 100644 index 00000000000..ba75110fe68 --- /dev/null +++ b/docs/synchronise-chat-logs-ja.md @@ -0,0 +1,31 @@ +# UpStashを使用してチャットログを同期する +## 事前準備 +- GitHubアカウント +- 自分自身でChatGPT-Next-Webのサーバーをセットアップしていること +- [UpStash](https://upstash.com) + +## 始める +1. UpStashアカウントを登録します。 +2. データベースを作成します。 + + ![登録とログイン](./images/upstash-1.png) + + ![データベースの作成](./images/upstash-2.png) + + ![サーバーの選択](./images/upstash-3.png) + +3. REST APIを見つけ、UPSTASH_REDIS_REST_URLとUPSTASH_REDIS_REST_TOKENをコピーします(⚠重要⚠:トークンを共有しないでください!) + + ![コピー](./images/upstash-4.png) + +4. UPSTASH_REDIS_REST_URLとUPSTASH_REDIS_REST_TOKENを同期設定にコピーし、次に「可用性を確認」をクリックします。 + + ![同期1](./images/upstash-5.png) + + すべてが正常であれば、このステップは成功です。 + + ![同期可用性チェックが完了しました](./images/upstash-6.png) + +5. 成功! + + ![お疲れ様でした~!](./images/upstash-7.png) \ No newline at end of file diff --git a/docs/synchronise-chat-logs-ko.md b/docs/synchronise-chat-logs-ko.md new file mode 100644 index 00000000000..88e6e2dda69 --- /dev/null +++ b/docs/synchronise-chat-logs-ko.md @@ -0,0 +1,31 @@ +# UpStash를 사용하여 채팅 기록 동기화 +## 사전 준비물 +- GitHub 계정 +- 자체 ChatGPT-Next-Web 서버 설정 +- [UpStash](https://upstash.com) + +## 시작하기 +1. UpStash 계정 등록 +2. 데이터베이스 생성 + + ![등록 및 로그인](./images/upstash-1.png) + + ![데이터베이스 생성](./images/upstash-2.png) + + ![서버 선택](./images/upstash-3.png) + +3. REST API를 찾아 UPSTASH_REDIS_REST_URL 및 UPSTASH_REDIS_REST_TOKEN을 복사합니다 (⚠주의⚠: 토큰을 공유하지 마십시오!) + + ![복사](./images/upstash-4.png) + +4. UPSTASH_REDIS_REST_URL 및 UPSTASH_REDIS_REST_TOKEN을 동기화 구성에 복사한 다음 **가용성 확인**을 클릭합니다. + + ![동기화 1](./images/upstash-5.png) + + 모든 것이 정상인 경우,이 단계를 성공적으로 완료했습니다. + + ![동기화 가용성 확인 완료](./images/upstash-6.png) + +5. 성공! + + ![잘 했어요~!](./images/upstash-7.png) \ No newline at end of file diff --git a/docs/user-manual-cn.md b/docs/user-manual-cn.md index 883bbc23e33..6109fcf57a4 100644 --- a/docs/user-manual-cn.md +++ b/docs/user-manual-cn.md @@ -2,7 +2,7 @@ > No english version yet, please read this doc with ChatGPT or other translation tools. -本文档用于解释 ChatGPT Next Web 的部分功能介绍和设计原则。 +本文档用于解释 NextChat 的部分功能介绍和设计原则。 ## 面具 (Mask) @@ -22,7 +22,7 @@ 编辑步骤如下: -1. 在 ChatGPT Next Web 中配置好一个面具; +1. 在 NextChat 中配置好一个面具; 2. 使用面具编辑页面的下载按钮,将面具保存为 JSON 格式; 3. 让 ChatGPT 帮你将 json 文件格式化为对应的 ts 代码; 4. 放入对应的 .ts 文件。 diff --git a/next.config.mjs b/next.config.mjs index c8f17de8c01..4faa63e5450 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -35,27 +35,29 @@ const nextConfig = { }, }; +const CorsHeaders = [ + { key: "Access-Control-Allow-Credentials", value: "true" }, + { key: "Access-Control-Allow-Origin", value: "*" }, + { + key: "Access-Control-Allow-Methods", + value: "*", + }, + { + key: "Access-Control-Allow-Headers", + value: "*", + }, + { + key: "Access-Control-Max-Age", + value: "86400", + }, +]; + if (mode !== "export") { nextConfig.headers = async () => { return [ { source: "/api/:path*", - headers: [ - { key: "Access-Control-Allow-Credentials", value: "true" }, - { key: "Access-Control-Allow-Origin", value: "*" }, - { - key: "Access-Control-Allow-Methods", - value: "*", - }, - { - key: "Access-Control-Allow-Headers", - value: "*", - }, - { - key: "Access-Control-Max-Age", - value: "86400", - }, - ], + headers: CorsHeaders, }, ]; }; @@ -76,15 +78,6 @@ if (mode !== "export") { }, ]; - const apiUrl = process.env.API_URL; - if (apiUrl) { - console.log("[Next] using api url ", apiUrl); - ret.push({ - source: "/api/:path*", - destination: `${apiUrl}/:path*`, - }); - } - return { beforeFiles: ret, }; diff --git a/package.json b/package.json index 6610083bd0d..f28a5a6ecf2 100644 --- a/package.json +++ b/package.json @@ -17,20 +17,22 @@ }, "dependencies": { "@fortaine/fetch-event-source": "^3.0.6", - "@hello-pangea/dnd": "^16.3.0", + "@hello-pangea/dnd": "^16.5.0", + "@next/third-parties": "^14.1.0", "@svgr/webpack": "^6.5.1", "@vercel/analytics": "^0.1.11", - "emoji-picker-react": "^4.4.7", - "fuse.js": "^6.6.2", + "@vercel/speed-insights": "^1.0.2", + "emoji-picker-react": "^4.5.15", + "fuse.js": "^7.0.0", "html-to-image": "^1.11.11", - "mermaid": "^10.3.1", - "nanoid": "^4.0.2", + "mermaid": "^10.6.1", + "nanoid": "^5.0.3", "next": "^13.4.9", "node-fetch": "^3.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-markdown": "^8.0.7", - "react-router-dom": "^6.14.1", + "react-router-dom": "^6.15.0", "rehype-highlight": "^6.0.0", "rehype-katex": "^6.0.3", "remark-breaks": "^3.0.2", @@ -42,21 +44,21 @@ "zustand": "^4.3.8" }, "devDependencies": { - "@tauri-apps/cli": "^1.4.0", - "@types/node": "^20.3.3", + "@tauri-apps/cli": "1.5.7", + "@types/node": "^20.9.0", "@types/react": "^18.2.14", "@types/react-dom": "^18.2.7", "@types/react-katex": "^3.0.0", - "@types/spark-md5": "^3.0.2", + "@types/spark-md5": "^3.0.4", "cross-env": "^7.0.3", - "eslint": "^8.44.0", + "eslint": "^8.49.0", "eslint-config-next": "13.4.19", "eslint-config-prettier": "^8.8.0", "eslint-plugin-prettier": "^4.2.1", "husky": "^8.0.0", "lint-staged": "^13.2.2", "prettier": "^3.0.2", - "typescript": "4.9.5", + "typescript": "5.2.2", "webpack": "^5.88.1" }, "resolutions": { diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png index 700c48286da..b191a58acd5 100644 Binary files a/public/android-chrome-192x192.png and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png index e701ed2fb5f..c7e52c39495 100644 Binary files a/public/android-chrome-512x512.png and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png index 38730311410..b0da9531543 100644 Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differ diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png index 92f53492fd3..3f8e0a5359f 100644 Binary files a/public/favicon-16x16.png and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png index f1f439e856d..2fee10dfb21 100644 Binary files a/public/favicon-32x32.png and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico index a3737b350cd..b5e8234cd0b 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/macos.png b/public/macos.png index f1bd0e69f41..2eb110707fb 100644 Binary files a/public/macos.png and b/public/macos.png differ diff --git a/public/site.webmanifest b/public/site.webmanifest index 117f33b864e..cf77f68e4f1 100644 --- a/public/site.webmanifest +++ b/public/site.webmanifest @@ -1,21 +1,20 @@ { - "name": "ChatGPT Next Web", - "short_name": "ChatGPT", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "start_url": "/", - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" - } - \ No newline at end of file + "name": "NextChat", + "short_name": "NextChat", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "start_url": "/", + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} \ No newline at end of file diff --git a/scripts/delete-deployment-preview.sh b/scripts/delete-deployment-preview.sh new file mode 100755 index 00000000000..4f2bb34957d --- /dev/null +++ b/scripts/delete-deployment-preview.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Set the pipefail option. +set -o pipefail + +# Get the Vercel API endpoints. +GET_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v6/deployments" +DELETE_DEPLOYMENTS_ENDPOINT="https://api.vercel.com/v13/deployments" + +# Create a list of deployments. +deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_ORG_ID" -H "Authorization: Bearer $VERCEL_TOKEN ") +#deployments=$(curl -s -X GET "$GET_DEPLOYMENTS_ENDPOINT/?projectId=$VERCEL_PROJECT_ID" -H "Authorization: Bearer $VERCEL_TOKEN ") + +# Filter the deployments list by meta.base_hash === meta tag. +filtered_deployments=$(echo -E $deployments | jq --arg META_TAG "$META_TAG" '[.deployments[] | select(.meta.base_hash | type == "string" and contains($META_TAG)) | .uid] | join(",")') +filtered_deployments="${filtered_deployments//\"/}" # Remove double quotes + +# Clears the values from filtered_deployments +IFS=',' read -ra values <<<"$filtered_deployments" + +echo "META_TAG ${META_TAG}" +echo "Filtered deployments ${filtered_deployments}" + +# Iterate over the filtered deployments list. +for uid in "${values[@]}"; do + echo "Deleting ${uid}" + + delete_url="${DELETE_DEPLOYMENTS_ENDPOINT}/${uid}?teamId=${VERCEL_ORG_ID}" + echo $delete_url + + # Make DELETE a request to the /v13/deployments/{id} endpoint. + curl -X DELETE $delete_url -H "Authorization: Bearer $VERCEL_TOKEN" + + echo "Deleted!" +done diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index bb72a88e7b3..d93210fc540 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -56,6 +56,128 @@ version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", + "signal-hook", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.16", +] + +[[package]] +name = "async-task" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46" + +[[package]] +name = "async-trait" +version = "0.1.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2d0f03b3640e3a630367e40c468cb7f309529c708ed1d88597047b0e7c6ef7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.16", +] + [[package]] name = "atk" version = "0.15.1" @@ -80,6 +202,12 @@ dependencies = [ "system-deps 6.1.0", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "attohttpc" version = "0.22.0" @@ -150,6 +278,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + [[package]] name = "brotli" version = "3.3.4" @@ -358,6 +502,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "concurrent-queue" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -530,6 +683,17 @@ dependencies = [ "syn 2.0.16", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -629,6 +793,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enumflags2" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.16", +] + [[package]] name = "errno" version = "0.3.1" @@ -650,6 +835,12 @@ dependencies = [ "libc", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "1.9.0" @@ -659,6 +850,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fdeflate" version = "0.3.0" @@ -674,7 +871,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535" dependencies = [ - "memoffset", + "memoffset 0.8.0", "rustc_version", ] @@ -772,6 +969,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -783,6 +995,12 @@ dependencies = [ "syn 2.0.16", ] +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + [[package]] name = "futures-task" version = "0.3.28" @@ -796,8 +1014,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -1451,6 +1672,19 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +[[package]] +name = "mac-notification-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51fca4d74ff9dbaac16a01b924bc3693fa2bba0862c2c633abc73f9a8ea21f64" +dependencies = [ + "cc", + "dirs-next", + "objc-foundation", + "objc_id", + "time", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -1495,6 +1729,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.8.0" @@ -1504,6 +1747,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "minisign-verify" version = "0.2.1" @@ -1572,12 +1824,37 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.7.1", +] + [[package]] name = "nodrop" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +[[package]] +name = "notify-rust" +version = "4.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "827c5edfa80235ded4ab3fe8e9dc619b4f866ef16fe9b1c6b8a7f8692c0f2226" +dependencies = [ + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1757,6 +2034,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "overload" version = "0.1.1" @@ -1788,6 +2075,12 @@ dependencies = [ "system-deps 6.1.0", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1933,6 +2226,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.27" @@ -1948,7 +2252,7 @@ dependencies = [ "base64 0.21.0", "indexmap", "line-wrap", - "quick-xml", + "quick-xml 0.28.2", "serde", "time", ] @@ -1966,6 +2270,22 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2027,6 +2347,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quick-xml" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" +dependencies = [ + "memchr", +] + [[package]] name = "quick-xml" version = "0.28.2" @@ -2466,6 +2795,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.6" @@ -2486,6 +2826,25 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "simd-adler32" version = "0.3.5" @@ -2513,6 +2872,16 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "soup2" version = "0.2.1" @@ -2556,6 +2925,12 @@ dependencies = [ "loom", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_cache" version = "0.8.7" @@ -2733,6 +3108,7 @@ dependencies = [ "http", "ignore", "minisign-verify", + "notify-rust", "objc", "once_cell", "open", @@ -2915,6 +3291,16 @@ dependencies = [ "toml 0.7.3", ] +[[package]] +name = "tauri-winrt-notification" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f5bff1d532fead7c43324a0fa33643b8621a47ce2944a633be4cb6c0240898f" +dependencies = [ + "quick-xml 0.23.1", + "windows 0.39.0", +] + [[package]] name = "tempfile" version = "3.5.0" @@ -2922,7 +3308,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", - "fastrand", + "fastrand 1.9.0", "redox_syscall 0.3.5", "rustix", "windows-sys 0.45.0", @@ -3135,6 +3521,17 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uds_windows" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" +dependencies = [ + "memoffset 0.9.0", + "tempfile", + "winapi", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -3239,6 +3636,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "walkdir" version = "2.3.3" @@ -3815,6 +4218,82 @@ dependencies = [ "libc", ] +[[package]] +name = "xdg-home" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +dependencies = [ + "nix", + "winapi", +] + +[[package]] +name = "zbus" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "byteorder", + "derivative", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "once_cell", + "ordered-stream", + "rand 0.8.5", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + [[package]] name = "zip" version = "0.6.6" @@ -3825,3 +4304,41 @@ dependencies = [ "crc32fast", "crossbeam-utils", ] + +[[package]] +name = "zvariant" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ac5d04e836e..fee1c860fb9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.3.0", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.3.0", features = ["clipboard-all", "dialog-all", "shell-open", "updater", "window-close", "window-hide", "window-maximize", "window-minimize", "window-set-icon", "window-set-ignore-cursor-events", "window-set-resizable", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] } +tauri = { version = "1.3.0", features = ["notification-all", "fs-all", "clipboard-all", "dialog-all", "shell-open", "updater", "window-close", "window-hide", "window-maximize", "window-minimize", "window-set-icon", "window-set-ignore-cursor-events", "window-set-resizable", "window-show", "window-start-dragging", "window-unmaximize", "window-unminimize"] } tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" } [features] diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png index 7fee8db6e73..148479fcac1 100644 Binary files a/src-tauri/icons/128x128.png and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png index 178761b6a7b..c1a51d41fb5 100644 Binary files a/src-tauri/icons/128x128@2x.png and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png index 471cdbb6558..e06e30c4c20 100644 Binary files a/src-tauri/icons/32x32.png and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png index 241e101ba8f..6b6f4a2fd12 100644 Binary files a/src-tauri/icons/Square107x107Logo.png and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png index b27ce753da8..7c11ec3eb68 100644 Binary files a/src-tauri/icons/Square142x142Logo.png and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png index d9d58df2d3a..2da5070a4fc 100644 Binary files a/src-tauri/icons/Square150x150Logo.png and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png index 64dd15d81f8..a3b0afca3b3 100644 Binary files a/src-tauri/icons/Square284x284Logo.png and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png index c585069dbc0..9adabd622f6 100644 Binary files a/src-tauri/icons/Square30x30Logo.png and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png index 70b0b5ddb82..5d5eabec697 100644 Binary files a/src-tauri/icons/Square310x310Logo.png and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png index 6657a961708..16e472163ac 100644 Binary files a/src-tauri/icons/Square44x44Logo.png and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png index 865a99ed856..534d535477a 100644 Binary files a/src-tauri/icons/Square71x71Logo.png and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png index 4be7164307f..a817c9b63cb 100644 Binary files a/src-tauri/icons/Square89x89Logo.png and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png index 9791b7adbab..01b40ebfc9d 100644 Binary files a/src-tauri/icons/StoreLogo.png and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns index 7432486f725..131a0810a0c 100644 Binary files a/src-tauri/icons/icon.icns and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico index 59f1568eeae..93e6e8af24d 100644 Binary files a/src-tauri/icons/icon.ico and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png index 3ae7ae9bfd8..84971ce127e 100644 Binary files a/src-tauri/icons/icon.png and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 2256d5b34d9..75d6a0d0afa 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,8 +8,8 @@ "withGlobalTauri": true }, "package": { - "productName": "ChatGPT Next Web", - "version": "2.9.5" + "productName": "NextChat", + "version": "2.10.1" }, "tauri": { "allowlist": { @@ -44,6 +44,12 @@ "startDragging": true, "unmaximize": true, "unminimize": true + }, + "fs": { + "all": true + }, + "notification": { + "all": true } }, "bundle": { @@ -62,7 +68,7 @@ "icons/icon.ico" ], "identifier": "com.yida.chatgpt.next.web", - "longDescription": "ChatGPT Next Web is a cross-platform ChatGPT client, including Web/Win/Linux/OSX/PWA.", + "longDescription": "NextChat is a cross-platform ChatGPT client, including Web/Win/Linux/OSX/PWA.", "macOS": { "entitlements": null, "exceptionDomain": "", @@ -71,7 +77,7 @@ "signingIdentity": null }, "resources": [], - "shortDescription": "ChatGPT Next Web App", + "shortDescription": "NextChat App", "targets": "all", "windows": { "certificateThumbprint": null, @@ -98,11 +104,11 @@ "fullscreen": false, "height": 600, "resizable": true, - "title": "ChatGPT Next Web", + "title": "NextChat", "width": 960, "hiddenTitle": true, "titleBarStyle": "Overlay" } ] } -} +} \ No newline at end of file diff --git a/vercel.json b/vercel.json index 1890a0f7dba..0cae358a188 100644 --- a/vercel.json +++ b/vercel.json @@ -1,24 +1,5 @@ { "github": { "silent": true - }, - "headers": [ - { - "source": "/(.*)", - "headers": [ - { - "key": "X-Real-IP", - "value": "$remote_addr" - }, - { - "key": "X-Forwarded-For", - "value": "$proxy_add_x_forwarded_for" - }, - { - "key": "Host", - "value": "$http_host" - } - ] - } - ] + } } diff --git a/yarn.lock b/yarn.lock index cbce2ef174a..db6da708b8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,6 +22,14 @@ dependencies: "@babel/highlight" "^7.18.6" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + "@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.0.tgz#c241dc454e5b5917e40d37e525e2f4530c399298" @@ -58,6 +66,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -123,6 +141,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== + "@babel/helper-explode-assignable-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" @@ -138,6 +161,14 @@ "@babel/template" "^7.20.7" "@babel/types" "^7.21.0" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-hoist-variables@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" @@ -145,6 +176,13 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-member-expression-to-functions@^7.20.7", "@babel/helper-member-expression-to-functions@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz#319c6a940431a133897148515877d2f3269c3ba5" @@ -228,16 +266,33 @@ dependencies: "@babel/types" "^7.18.6" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-string-parser@^7.19.4": version "7.19.4" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== + "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + "@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" @@ -271,11 +326,25 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@babel/parser@^7.20.7", "@babel/parser@^7.21.3": version "7.21.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.3.tgz#1d285d67a19162ff9daa358d4cb41d50c06220b3" integrity sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ== +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" @@ -959,12 +1028,12 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.12.1", "@babel/runtime@^7.20.7", "@babel/runtime@^7.22.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.5.tgz#8564dd588182ce0047d55d7a75e93921107b57ec" - integrity sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA== +"@babel/runtime@^7.12.1", "@babel/runtime@^7.20.7", "@babel/runtime@^7.23.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d" + integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ== dependencies: - regenerator-runtime "^0.13.11" + regenerator-runtime "^0.14.0" "@babel/template@^7.18.10", "@babel/template@^7.20.7": version "7.20.7" @@ -975,19 +1044,28 @@ "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" -"@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.3": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.3.tgz#4747c5e7903d224be71f90788b06798331896f67" - integrity sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ== +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.21.3" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.21.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.21.3" - "@babel/types" "^7.21.3" + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" + +"@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.3": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" @@ -1000,6 +1078,15 @@ "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@braintree/sanitize-url@^6.0.1": version "6.0.4" resolved "https://registry.yarnpkg.com/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz#923ca57e173c6b232bbbb07347b1be982f03e783" @@ -1012,15 +1099,15 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": - version "4.5.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724" - integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ== +"@eslint-community/regexpp@^4.6.1": + version "4.8.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" + integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== -"@eslint/eslintrc@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" - integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== +"@eslint/eslintrc@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" + integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -1032,33 +1119,33 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.44.0": - version "8.44.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" - integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== +"@eslint/js@8.49.0": + version "8.49.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.49.0.tgz#86f79756004a97fa4df866835093f1df3d03c333" + integrity sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w== "@fortaine/fetch-event-source@^3.0.6": version "3.0.6" resolved "https://registry.npmmirror.com/@fortaine/fetch-event-source/-/fetch-event-source-3.0.6.tgz#b8552a2ca2c5202f5699b93a92be0188d422b06e" integrity sha512-621GAuLMvKtyZQ3IA6nlDWhV1V/7PGOTNIGLUifxt0KzM+dZIweJ6F3XvQF3QnqeNfS1N7WQ0Kil1Di/lhChEw== -"@hello-pangea/dnd@^16.3.0": - version "16.3.0" - resolved "https://registry.yarnpkg.com/@hello-pangea/dnd/-/dnd-16.3.0.tgz#3776212f812df4e8e69c42831ec8ab7ff3a087d6" - integrity sha512-RYQ/K8shtJoyNPvFWz0gfXIK7HF3P3mL9UZFGMuHB0ljRSXVgMjVFI/FxcZmakMzw6tO7NflWLriwTNBow/4vw== +"@hello-pangea/dnd@^16.5.0": + version "16.5.0" + resolved "https://registry.yarnpkg.com/@hello-pangea/dnd/-/dnd-16.5.0.tgz#f323ff9f813204818bc67648a383e8715f47c59c" + integrity sha512-n+am6O32jo/CFXciCysz83lPM3I3F58FJw4uS44TceieymcyxQSfzK5OhzPAKrVBZktmuOI6Zim9WABTMtXv4A== dependencies: - "@babel/runtime" "^7.22.5" + "@babel/runtime" "^7.23.2" css-box-model "^1.2.1" memoize-one "^6.0.0" raf-schd "^4.0.3" - react-redux "^8.1.1" + react-redux "^8.1.3" redux "^4.2.1" use-memo-one "^1.1.3" -"@humanwhocodes/config-array@^0.11.10": - version "0.11.10" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" - integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== +"@humanwhocodes/config-array@^0.11.11": + version "0.11.11" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" + integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -1188,6 +1275,13 @@ resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.9.tgz#0c2758164cccd61bc5a1c6cd8284fe66173e4a2b" integrity sha512-QbT03FXRNdpuL+e9pLnu+XajZdm/TtIXVYY4lA9t+9l0fLZbHXDYEKitAqxrOj37o3Vx5ufxiRAniaIebYDCgw== +"@next/third-parties@^14.1.0": + version "14.1.0" + resolved "https://registry.yarnpkg.com/@next/third-parties/-/third-parties-14.1.0.tgz#d9604fff8880e05d3804d2cf7ab42eb5430aec69" + integrity sha512-f55SdvQ1WWxi4mb5QqtYQh5wRzbm1XaeP7s39DPn4ks3re+n9VlFccbMxBRHqkE62zAyIKmvkUB2cByT/gugGA== + dependencies: + third-party-capital "1.0.20" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1221,10 +1315,10 @@ tiny-glob "^0.2.9" tslib "^2.4.0" -"@remix-run/router@1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.7.1.tgz#fea7ac35ae4014637c130011f59428f618730498" - integrity sha512-bgVQM4ZJ2u2CM8k1ey70o1ePFXsEzYVZoWghh6WjM8p59jQ7HxzbHW4SbnWFG7V9ig9chLawQxDTZ3xzOF8MkQ== +"@remix-run/router@1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.8.0.tgz#e848d2f669f601544df15ce2a313955e4bf0bafc" + integrity sha512-mrfKqIHnSZRyIzBcanNJmVQELTnX+qagEDlcKO90RgRBVOZGSGvZKeDihTRfWcqoDn5N/NkUcwWTccnpN18Tfg== "@rushstack/eslint-patch@^1.1.3": version "1.2.0" @@ -1344,71 +1438,71 @@ dependencies: tslib "^2.4.0" -"@tauri-apps/cli-darwin-arm64@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.4.0.tgz#e76bb8515ae31f03f2cbd440c1a09b237a79b3ac" - integrity sha512-nA/ml0SfUt6/CYLVbHmT500Y+ijqsuv5+s9EBnVXYSLVg9kbPUZJJHluEYK+xKuOj6xzyuT/+rZFMRapmJD3jQ== - -"@tauri-apps/cli-darwin-x64@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.4.0.tgz#dd1472460550d0aa0ec6e699b073be2d77e5b962" - integrity sha512-ov/F6Zr+dg9B0PtRu65stFo2G0ow2TUlneqYYrkj+vA3n+moWDHfVty0raDjMLQbQt3rv3uayFMXGPMgble9OA== - -"@tauri-apps/cli-linux-arm-gnueabihf@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.4.0.tgz#325e90e47d260ba71a499850ce769b5a6bdfd48d" - integrity sha512-zwjbiMncycXDV7doovymyKD7sCg53ouAmfgpUqEBOTY3vgBi9TwijyPhJOqoG5vUVWhouNBC08akGmE4dja15g== - -"@tauri-apps/cli-linux-arm64-gnu@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.4.0.tgz#b5d8f5cba3f8f7c7d44d071681f0ab0a37f2c46e" - integrity sha512-5MCBcziqXC72mMXnkZU68mutXIR6zavDxopArE2gQtK841IlE06bIgtLi0kUUhlFJk2nhPRgiDgdLbrPlyt7fw== - -"@tauri-apps/cli-linux-arm64-musl@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.4.0.tgz#f805ab2ee415875900f4b456f17dc4900d2a7911" - integrity sha512-7J3pRB6n6uNYgIfCeKt2Oz8J7oSaz2s8GGFRRH2HPxuTHrBNCinzVYm68UhVpJrL3bnGkU0ziVZLsW/iaOGfUg== - -"@tauri-apps/cli-linux-x64-gnu@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.4.0.tgz#d3f5e69c22420c7ac9e4021b7a94bce2e48cb45d" - integrity sha512-Zh5gfAJxOv5AVWxcwuueaQ2vIAhlg0d6nZui6nMyfIJ8dbf3aZQ5ZzP38sYow5h/fbvgL+3GSQxZRBIa3c2E1w== - -"@tauri-apps/cli-linux-x64-musl@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.4.0.tgz#2e7f718272ffdd9ace80f57a35023ba0c74767ad" - integrity sha512-OLAYoICU3FaYiTdBsI+lQTKnDHeMmFMXIApN0M+xGiOkoIOQcV9CConMPjgmJQ867+NHRNgUGlvBEAh9CiJodQ== - -"@tauri-apps/cli-win32-arm64-msvc@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-1.4.0.tgz#85cdb52a06feb92da785def4d02512099464525e" - integrity sha512-gZ05GENFbI6CB5MlOUsLlU0kZ9UtHn9riYtSXKT6MYs8HSPRffPHaHSL0WxsJweWh9nR5Hgh/TUU8uW3sYCzCg== - -"@tauri-apps/cli-win32-ia32-msvc@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.4.0.tgz#0b7c921204058215aec9a5a00f735e73909bd330" - integrity sha512-JsetT/lTx/Zq98eo8T5CiRyF1nKeX04RO8JlJrI3ZOYsZpp/A5RJvMd/szQ17iOzwiHdge+tx7k2jHysR6oBlQ== - -"@tauri-apps/cli-win32-x64-msvc@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.4.0.tgz#23abe3f08c0df89111c29602f91c21a23577b908" - integrity sha512-z8Olcnwp5aYhzqUAarFjqF+oELCjuYWnB2HAJHlfsYNfDCAORY5kct3Fklz8PSsubC3U2EugWn8n42DwnThurg== - -"@tauri-apps/cli@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.4.0.tgz#72732ae61e6b7d097e44a8a2ef5f211b2d01d98b" - integrity sha512-VXYr2i2iVFl98etQSQsqLzXgX96bnWiNZd1YADgatqwy/qecbd6Kl5ZAPB5R4ynsgE8A1gU7Fbzh7dCEQYFfmA== +"@tauri-apps/cli-darwin-arm64@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-1.5.7.tgz#3435f1b6c4b431e0283f94c3a0bd486be66b24ee" + integrity sha512-eUpOUhs2IOpKaLa6RyGupP2owDLfd0q2FR/AILzryjtBtKJJRDQQvuotf+LcbEce2Nc2AHeYJIqYAsB4sw9K+g== + +"@tauri-apps/cli-darwin-x64@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-1.5.7.tgz#d3d646e790067158d14a1f631a50c67dc05e3360" + integrity sha512-zfumTv1xUuR+RB1pzhRy+51tB6cm8I76g0xUBaXOfEdOJ9FqW5GW2jdnEUbpNuU65qJ1lB8LVWHKGrSWWKazew== + +"@tauri-apps/cli-linux-arm-gnueabihf@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-1.5.7.tgz#049c12980cdfd67fe9e5163762bf77f3c85f6956" + integrity sha512-JngWNqS06bMND9PhiPWp0e+yknJJuSozsSbo+iMzHoJNRauBZCUx+HnUcygUR66Cy6qM4eJvLXtsRG7ApxvWmg== + +"@tauri-apps/cli-linux-arm64-gnu@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-1.5.7.tgz#d1c143da15cba74eebfaaf1662f0734e30f97562" + integrity sha512-WyIYP9BskgBGq+kf4cLAyru8ArrxGH2eMYGBJvuNEuSaqBhbV0i1uUxvyWdazllZLAEz1WvSocUmSwLknr1+sQ== + +"@tauri-apps/cli-linux-arm64-musl@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.5.7.tgz#f79a17f5360a8ab25b90f3a8e9e6327d5378072f" + integrity sha512-OrDpihQP2MB0JY1a/wP9wsl9dDjFDpVEZOQxt4hU+UVGRCZQok7ghPBg4+Xpd1CkNkcCCuIeY8VxRvwLXpnIzg== + +"@tauri-apps/cli-linux-x64-gnu@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-1.5.7.tgz#2cbd17998dcfc8a465d61f30ac9e99ae65e2c2e8" + integrity sha512-4T7FAYVk76rZi8VkuLpiKUAqaSxlva86C1fHm/RtmoTKwZEV+MI3vIMoVg+AwhyWIy9PS55C75nF7+OwbnFnvQ== + +"@tauri-apps/cli-linux-x64-musl@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-1.5.7.tgz#d5d4ddded945cc781568d72b7eba367121f28525" + integrity sha512-LL9aMK601BmQjAUDcKWtt5KvAM0xXi0iJpOjoUD3LPfr5dLvBMTflVHQDAEtuZexLQyqpU09+60781PrI/FCTw== + +"@tauri-apps/cli-win32-arm64-msvc@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-1.5.7.tgz#05a1bd4e2bc692bad995edb9d07e616cc5682fd5" + integrity sha512-TmAdM6GVkfir3AUFsDV2gyc25kIbJeAnwT72OnmJGAECHs/t/GLP9IkFLLVcFKsiosRf8BXhVyQ84NYkSWo14w== + +"@tauri-apps/cli-win32-ia32-msvc@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-1.5.7.tgz#8c832f4dc88374255ef1cda4d2d6a6d61a921388" + integrity sha512-bqWfxwCfLmrfZy69sEU19KHm5TFEaMb8KIekd4aRq/kyOlrjKLdZxN1PyNRP8zpJA1lTiRHzfUDfhpmnZH/skg== + +"@tauri-apps/cli-win32-x64-msvc@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-1.5.7.tgz#adfcce46f796dd22ef69fb26ad8c6972a3263985" + integrity sha512-OxLHVBNdzyQ//xT3kwjQFnJTn/N5zta/9fofAkXfnL7vqmVn6s/RY1LDa3sxCHlRaKw0n3ShpygRbM9M8+sO9w== + +"@tauri-apps/cli@1.5.7": + version "1.5.7" + resolved "https://registry.yarnpkg.com/@tauri-apps/cli/-/cli-1.5.7.tgz#8f9a8bf577a39b7f7c0e5b125e7b5b3e149cfb5a" + integrity sha512-z7nXLpDAYfQqR5pYhQlWOr88DgPq1AfQyxHhGiakiVgWlaG0ikEfQxop2txrd52H0TRADG0JHR9vFrVFPv4hVQ== optionalDependencies: - "@tauri-apps/cli-darwin-arm64" "1.4.0" - "@tauri-apps/cli-darwin-x64" "1.4.0" - "@tauri-apps/cli-linux-arm-gnueabihf" "1.4.0" - "@tauri-apps/cli-linux-arm64-gnu" "1.4.0" - "@tauri-apps/cli-linux-arm64-musl" "1.4.0" - "@tauri-apps/cli-linux-x64-gnu" "1.4.0" - "@tauri-apps/cli-linux-x64-musl" "1.4.0" - "@tauri-apps/cli-win32-arm64-msvc" "1.4.0" - "@tauri-apps/cli-win32-ia32-msvc" "1.4.0" - "@tauri-apps/cli-win32-x64-msvc" "1.4.0" + "@tauri-apps/cli-darwin-arm64" "1.5.7" + "@tauri-apps/cli-darwin-x64" "1.5.7" + "@tauri-apps/cli-linux-arm-gnueabihf" "1.5.7" + "@tauri-apps/cli-linux-arm64-gnu" "1.5.7" + "@tauri-apps/cli-linux-arm64-musl" "1.5.7" + "@tauri-apps/cli-linux-x64-gnu" "1.5.7" + "@tauri-apps/cli-linux-x64-musl" "1.5.7" + "@tauri-apps/cli-win32-arm64-msvc" "1.5.7" + "@tauri-apps/cli-win32-ia32-msvc" "1.5.7" + "@tauri-apps/cli-win32-x64-msvc" "1.5.7" "@trysound/sax@0.2.0": version "0.2.0" @@ -1507,10 +1601,12 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node@*", "@types/node@^20.3.3": - version "20.3.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.3.tgz#329842940042d2b280897150e023e604d11657d6" - integrity sha512-wheIYdr4NYML61AjC8MKj/2jrR/kDQri/CIpVoZwldwhnIrD/j9jIU5bJ8yBKuB2VhpFV7Ab6G2XkBjv9r9Zzw== +"@types/node@*", "@types/node@^20.9.0": + version "20.9.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" + integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== + dependencies: + undici-types "~5.26.4" "@types/parse-json@^4.0.0": version "4.0.0" @@ -1550,10 +1646,10 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== -"@types/spark-md5@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/spark-md5/-/spark-md5-3.0.2.tgz#da2e8a778a20335fc4f40b6471c4b0d86b70da55" - integrity sha512-82E/lVRaqelV9qmRzzJ1PKTpyrpnT7mwdneKNJB9hUtypZDMggloDfFUCIqRRx3lYRxteCwXSq9c+W71Vf0QnQ== +"@types/spark-md5@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/spark-md5/-/spark-md5-3.0.4.tgz#c1221d63c069d95aba0c06a765b80661cacc12bf" + integrity sha512-qtOaDz+IXiNndPgYb6t1YoutnGvFRtWSNzpVjkAPCfB2UzTyybuD4Tjgs7VgRawum3JnJNRwNQd4N//SvrHg1Q== "@types/unist@*", "@types/unist@^2.0.0": version "2.0.6" @@ -1615,6 +1711,11 @@ resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-0.1.11.tgz#727a0ac655a4a89104cdea3e6925476470299428" integrity sha512-mj5CPR02y0BRs1tN3oZcBNAX9a8NxsIUl9vElDPcqxnMfP0RbRc9fI9Ud7+QDg/1Izvt5uMumsr+6YsmVHcyuw== +"@vercel/speed-insights@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@vercel/speed-insights/-/speed-insights-1.0.2.tgz#1bebf3e7c7046b6a911721233b263b69214ddb3e" + integrity sha512-y5HWeB6RmlyVYxJAMrjiDEz8qAIy2cit0fhBq+MD78WaUwQvuBnQlX4+5MuwVTWi46bV3klaRMq83u9zUy1KOg== + "@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5": version "1.11.6" resolved "https://registry.npmmirror.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24" @@ -1779,7 +1880,7 @@ ajv-keywords@^3.5.2: resolved "https://registry.npmmirror.com/ajv-keywords/-/ajv-keywords-3.5.2.tgz#31f29da5ab6e00d1c2d329acf7b5929614d5014d" integrity sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ== -ajv@^6.10.0, ajv@^6.12.4, ajv@^6.12.5: +ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -2051,7 +2152,7 @@ chalk@5.2.0: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2126,11 +2227,6 @@ client-only@0.0.1: resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1" integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA== -clsx@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" - integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== - color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -2762,12 +2858,10 @@ elkjs@^0.8.2: resolved "https://registry.npmmirror.com/elkjs/-/elkjs-0.8.2.tgz#c37763c5a3e24e042e318455e0147c912a7c248e" integrity sha512-L6uRgvZTH+4OF5NE/MBbzQx/WYpru1xCBE9respNj6qznEewGUIfhzmm7horWWxbNO2M0WckQypGctR8lH79xQ== -emoji-picker-react@^4.4.7: - version "4.4.8" - resolved "https://registry.yarnpkg.com/emoji-picker-react/-/emoji-picker-react-4.4.8.tgz#cd18e942720d0d01e3d488a008f5e79aa315ec87" - integrity sha512-5bbj0PCvpjB64PZj31wZ35EoebF2mKoHqEEx9u2ZLghx7sGoD1MgyDhse851rqROypjhmK9IUY15QBa7mCLP0g== - dependencies: - clsx "^1.2.1" +emoji-picker-react@^4.5.15: + version "4.5.15" + resolved "https://registry.yarnpkg.com/emoji-picker-react/-/emoji-picker-react-4.5.15.tgz#e12797c50584cb8af8aee7eb6c7c8fd953e41f7e" + integrity sha512-BTqo+pNUE8kqX8BKFTbD4fhlxcA69qfie5En4PerReLaaPfXVyRlDJ1uf85nKj2u5esUQ999iUf8YyqcPsM2Qw== emoji-regex@^8.0.0: version "8.0.0" @@ -3050,40 +3144,40 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" - integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" - integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.44.0: - version "8.44.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" - integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== +eslint@^8.49.0: + version "8.49.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.49.0.tgz#09d80a89bdb4edee2efcf6964623af1054bf6d42" + integrity sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.1.0" - "@eslint/js" "8.44.0" - "@humanwhocodes/config-array" "^0.11.10" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.2" + "@eslint/js" "8.49.0" + "@humanwhocodes/config-array" "^0.11.11" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" + ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.2.0" - eslint-visitor-keys "^3.4.1" - espree "^9.6.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -3093,7 +3187,6 @@ eslint@^8.44.0: globals "^13.19.0" graphemer "^1.4.0" ignore "^5.2.0" - import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" @@ -3105,13 +3198,12 @@ eslint@^8.44.0: natural-compare "^1.4.0" optionator "^0.9.3" strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.6.0: - version "9.6.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f" - integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A== +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: acorn "^8.9.0" acorn-jsx "^5.3.2" @@ -3308,10 +3400,10 @@ functions-have-names@^1.2.2: resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== -fuse.js@^6.6.2: - version "6.6.2" - resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-6.6.2.tgz#fe463fed4b98c0226ac3da2856a415576dc9a111" - integrity sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA== +fuse.js@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/fuse.js/-/fuse.js-7.0.0.tgz#6573c9fcd4c8268e403b4fc7d7131ffcf99a9eb2" + integrity sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q== gensync@^1.0.0-beta.2: version "1.0.0-beta.2" @@ -3635,7 +3727,7 @@ immutable@^4.0.0: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.0.tgz#eb1738f14ffb39fd068b1dbe1296117484dd34be" integrity sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg== -import-fresh@^3.0.0, import-fresh@^3.2.1: +import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -4316,10 +4408,10 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -mermaid@^10.3.1: - version "10.3.1" - resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.3.1.tgz#2f3c7e9f6bd7a8da2bef71cce2a542c8eba2a62e" - integrity sha512-hkenh7WkuRWPcob3oJtrN3W+yzrrIYuWF1OIfk/d0xGE8UWlvDhfexaHmDwwe8DKQgqMLI8DWEPwGprxkumjuw== +mermaid@^10.6.1: + version "10.6.1" + resolved "https://registry.yarnpkg.com/mermaid/-/mermaid-10.6.1.tgz#701f4160484137a417770ce757ce1887a98c00fc" + integrity sha512-Hky0/RpOw/1il9X8AvzOEChfJtVvmXm+y7JML5C//ePYMy0/9jCEmW1E1g86x9oDfW9+iVEdTV/i+M6KWRNs4A== dependencies: "@braintree/sanitize-url" "^6.0.1" "@types/d3-scale" "^4.0.3" @@ -4692,10 +4784,10 @@ nanoid@^3.3.4: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== -nanoid@^4.0.2: - version "4.0.2" - resolved "https://registry.npmmirror.com/nanoid/-/nanoid-4.0.2.tgz#140b3c5003959adbebf521c170f282c5e7f9fb9e" - integrity sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw== +nanoid@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-5.0.3.tgz#6c97f53d793a7a1de6a38ebb46f50f95bf9793c7" + integrity sha512-I7X2b22cxA4LIHXPSqbBCEQSL+1wv8TuoefejsX4HFWyC6jc5JG7CEaxOltiKjc1M+YCS2YkrZZcj4+dytw9GA== natural-compare@^1.4.0: version "1.4.0" @@ -5080,10 +5172,10 @@ react-markdown@^8.0.7: unist-util-visit "^4.0.0" vfile "^5.0.0" -react-redux@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-8.1.1.tgz#8e740f3fd864a4cd0de5ba9cdc8ad39cc9e7c81a" - integrity sha512-5W0QaKtEhj+3bC0Nj0NkqkhIv8gLADH/2kYFMTHxCVqQILiWzLv6MaLuV5wJU3BQEdHKzTfcvPN0WMS6SC1oyA== +react-redux@^8.1.3: + version "8.1.3" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-8.1.3.tgz#4fdc0462d0acb59af29a13c27ffef6f49ab4df46" + integrity sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw== dependencies: "@babel/runtime" "^7.12.1" "@types/hoist-non-react-statics" "^3.3.1" @@ -5092,20 +5184,20 @@ react-redux@^8.1.1: react-is "^18.0.0" use-sync-external-store "^1.0.0" -react-router-dom@^6.14.1: - version "6.14.1" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.14.1.tgz#0ad7ba7abdf75baa61169d49f096f0494907a36f" - integrity sha512-ssF6M5UkQjHK70fgukCJyjlda0Dgono2QGwqGvuk7D+EDGHdacEN3Yke2LTMjkrpHuFwBfDFsEjGVXBDmL+bWw== +react-router-dom@^6.15.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.15.0.tgz#6da7db61e56797266fbbef0d5e324d6ac443ee40" + integrity sha512-aR42t0fs7brintwBGAv2+mGlCtgtFQeOzK0BM1/OiqEzRejOZtpMZepvgkscpMUnKb8YO84G7s3LsHnnDNonbQ== dependencies: - "@remix-run/router" "1.7.1" - react-router "6.14.1" + "@remix-run/router" "1.8.0" + react-router "6.15.0" -react-router@6.14.1: - version "6.14.1" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.14.1.tgz#5e82bcdabf21add859dc04b1859f91066b3a5810" - integrity sha512-U4PfgvG55LdvbQjg5Y9QRWyVxIdO1LlpYT7x+tMAxd9/vmiPuJhIwdxZuIQLN/9e3O4KFDHYfR9gzGeYMasW8g== +react-router@6.15.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.15.0.tgz#bf2cb5a4a7ed57f074d4ea88db0d95033f39cac8" + integrity sha512-NIytlzvzLwJkCQj2HLefmeakxxWHWAP+02EGqWEZy+DgfHHKQMUoBBjUQLOtFInBMhWtb3hiUy6MfFgwLjXhqg== dependencies: - "@remix-run/router" "1.7.1" + "@remix-run/router" "1.8.0" react@^18.2.0: version "18.2.0" @@ -5140,10 +5232,10 @@ regenerate@^1.4.2: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== -regenerator-runtime@^0.13.11: - version "0.13.11" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" - integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== regenerator-transform@^0.15.1: version "0.15.1" @@ -5588,7 +5680,7 @@ strip-final-newline@^3.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -5695,6 +5787,11 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +third-party-capital@1.0.20: + version "1.0.20" + resolved "https://registry.yarnpkg.com/third-party-capital/-/third-party-capital-1.0.20.tgz#e218a929a35bf4d2245da9addb8ab978d2f41685" + integrity sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA== + through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -5786,10 +5883,10 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" -typescript@4.9.5: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== unbox-primitive@^1.0.2: version "1.0.2" @@ -5801,6 +5898,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"