From f8cb24387d82f7aafc28e9982d66223630c86c2b Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 22 Jul 2024 15:39:42 +0800 Subject: [PATCH 01/17] =?UTF-8?q?perf:=20=E4=BF=AE=E6=94=B9cohere=20stream?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 48 ++++++++++++++++++++------------------------- dist/timestamp | 2 +- src/agent/cohere.js | 16 +++++++-------- src/agent/stream.js | 40 ++++++++++++++++++------------------- 5 files changed, 49 insertions(+), 59 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index ef6bb7d1..49120f28 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "8aa40ac", "timestamp": 1721280807} +{"sha": "418f59c", "timestamp": 1721633955} diff --git a/dist/index.js b/dist/index.js index e7396755..f9df62b0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -87,9 +87,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1721280807; + BUILD_TIMESTAMP = 1721633955; // 当前版本 commit id - BUILD_VERSION = "8aa40ac"; + BUILD_VERSION = "418f59c"; // -- 基础配置 -- /** * @type {I18n | null} @@ -802,13 +802,6 @@ var SSEDecoder = class { return [str, "", ""]; } }; -var JSONLDecoder = class { - constructor() { - } - decode(line) { - return line; - } -}; function openaiSseJsonParser(sse) { if (sse.data.startsWith("[DONE]")) { return { finish: true }; @@ -823,16 +816,20 @@ function openaiSseJsonParser(sse) { return {}; } function cohereSseJsonParser(sse) { - try { - const res = JSON.parse(sse); - return { - finish: res.is_finished, - data: res - }; - } catch (e) { - console.error(e, sse); - const finish = sse.startsWith('{"is_finished":true'); - return { finish }; + switch (sse.event) { + case "text-generation": + try { + return { data: JSON.parse(sse.data) }; + } catch (e) { + console.error(e, sse.data); + return {}; + } + case "stream-start": + return {}; + case "stream-end": + return { finish: true }; + default: + return {}; } } function anthropicSseJsonParser(sse) { @@ -1201,7 +1198,7 @@ async function requestCompletionsFromCohereAI(message, prompt, history, context, const header = { "Authorization": `Bearer ${context.USER_CONFIG.COHERE_API_KEY}`, "Content-Type": "application/json", - "Accept": "application/json" + "Accept": onStream !== null ? "text/event-stream" : "application/json" }; const roleMap = { "assistant": "CHATBOT", @@ -1224,19 +1221,16 @@ async function requestCompletionsFromCohereAI(message, prompt, history, context, } const options = {}; options.streamBuilder = function(r, c) { - return new Stream(r, c, new JSONLDecoder(), cohereSseJsonParser); + return new Stream(r, c, null, cohereSseJsonParser); }; options.contentExtractor = function(data) { - if (data?.event_type === "text-generation") { - return data?.text; - } - return null; + return data?.text; }; options.fullContentExtractor = function(data) { - return data?.text; + return data?.content?.[0].text; }; options.errorExtractor = function(data) { - return data?.message; + return data?.error?.message; }; return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/dist/timestamp b/dist/timestamp index 4318fb96..c717e2e1 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1721280807 +1721633955 diff --git a/src/agent/cohere.js b/src/agent/cohere.js index 02ad9c8b..30cfcdf8 100644 --- a/src/agent/cohere.js +++ b/src/agent/cohere.js @@ -1,5 +1,5 @@ import "../types/context.js" -import {cohereSseJsonParser, JSONLDecoder, Stream} from "./stream.js"; +import {cohereSseJsonParser, Stream} from "./stream.js"; import {requestChatCompletions} from "./request.js"; @@ -27,7 +27,7 @@ export async function requestCompletionsFromCohereAI(message, prompt, history, c const header = { 'Authorization': `Bearer ${context.USER_CONFIG.COHERE_API_KEY}`, 'Content-Type': 'application/json', - 'Accept': 'application/json', + 'Accept': onStream !== null ? 'text/event-stream' : 'application/json', }; const roleMap = { @@ -50,24 +50,22 @@ export async function requestCompletionsFromCohereAI(message, prompt, history, c if (!body.preamble) { delete body.preamble } + /** * @type {SseChatCompatibleOptions} */ const options = {} options.streamBuilder = function (r, c) { - return new Stream(r, c, new JSONLDecoder(), cohereSseJsonParser); + return new Stream(r, c, null, cohereSseJsonParser); } options.contentExtractor = function (data) { - if (data?.event_type === 'text-generation') { - return data?.text; - } - return null + return data?.text; } options.fullContentExtractor = function (data) { - return data?.text; + return data?.content?.[0].text; } options.errorExtractor = function (data) { - return data?.message; + return data?.error?.message; } return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/src/agent/stream.js b/src/agent/stream.js index 8083dca0..57923e3a 100644 --- a/src/agent/stream.js +++ b/src/agent/stream.js @@ -112,15 +112,6 @@ export class SSEDecoder { } } -export class JSONLDecoder { - constructor() { - } - - decode(line) { - return line; - } -} - export function openaiSseJsonParser(sse) { // example: @@ -141,18 +132,25 @@ export function openaiSseJsonParser(sse) { export function cohereSseJsonParser(sse) { // example: - // {} - // {} - try { - const res = JSON.parse(sse) - return { - finish: res.is_finished, - data: res - } - } catch (e) { - console.error(e, sse) - const finish = sse.startsWith('{"is_finished":true') - return {finish} + // event: text-generation + // data: {"is_finished":false,"event_type":"text-generation","text":"?"} + // + // event: stream-end + // data: {"is_finished":true,...} + switch (sse.event) { + case 'text-generation': + try { + return {data: JSON.parse(sse.data)} + } catch (e) { + console.error(e, sse.data) + return {} + } + case 'stream-start': + return {} + case 'stream-end': + return {finish: true} + default: + return {} } } From 85b81030536b8dc410e89501747f381bff7e7a61 Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 22 Jul 2024 15:41:26 +0800 Subject: [PATCH 02/17] doc: fix readme link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0831e4c2..9e0a50fd 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can customize the system initialization information so that your debugged pe ## Features - Serverless deployment -- Multi-platform deployment support (Cloudflare Workers, Vercel, Render[...](doc/en/DEPLOY.md)) +- Multi-platform deployment support (Cloudflare Workers, Vercel, Render[...](adapter)) - Adaptation to multiple AI service providers (OpenAI, Azure OpenAI, Cloudflare AI, Cohere, Anthropic, Mistral...) - Custom commands (can achieve quick switching of models, switching of robot presets) - Support for multiple Telegram bots From 11d289ae2d9e5ffe34c88f60d0909fe415b4b512 Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 22 Jul 2024 15:47:31 +0800 Subject: [PATCH 03/17] =?UTF-8?q?fix:=20cohere=20=E9=9D=9Estream=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 8 ++++---- dist/timestamp | 2 +- src/agent/cohere.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 49120f28..83539cb3 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "418f59c", "timestamp": 1721633955} +{"sha": "85b8103", "timestamp": 1721634429} diff --git a/dist/index.js b/dist/index.js index f9df62b0..ce0a8409 100644 --- a/dist/index.js +++ b/dist/index.js @@ -87,9 +87,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1721633955; + BUILD_TIMESTAMP = 1721634429; // 当前版本 commit id - BUILD_VERSION = "418f59c"; + BUILD_VERSION = "85b8103"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1227,10 +1227,10 @@ async function requestCompletionsFromCohereAI(message, prompt, history, context, return data?.text; }; options.fullContentExtractor = function(data) { - return data?.content?.[0].text; + return data?.text; }; options.errorExtractor = function(data) { - return data?.error?.message; + return data?.message; }; return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/dist/timestamp b/dist/timestamp index c717e2e1..4cd6e549 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1721633955 +1721634429 diff --git a/src/agent/cohere.js b/src/agent/cohere.js index 30cfcdf8..5f12918a 100644 --- a/src/agent/cohere.js +++ b/src/agent/cohere.js @@ -62,10 +62,10 @@ export async function requestCompletionsFromCohereAI(message, prompt, history, c return data?.text; } options.fullContentExtractor = function (data) { - return data?.content?.[0].text; + return data?.text; } options.errorExtractor = function (data) { - return data?.error?.message; + return data?.message; } return requestChatCompletions(url, header, body, context, onStream, null, options); } From 8f11aec7c2407f7408e2cc0e34e6e1b52572624b Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 22 Jul 2024 16:37:53 +0800 Subject: [PATCH 04/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96/version=20?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 41 ++++++++++++++++++----------------------- dist/timestamp | 2 +- src/agent/gemini.js | 1 - src/config/env.js | 1 - src/telegram/command.js | 36 ++++++++++++++---------------------- 6 files changed, 34 insertions(+), 49 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 83539cb3..8563c7cb 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "85b8103", "timestamp": 1721634429} +{"sha": "11d289a", "timestamp": 1721637424} diff --git a/dist/index.js b/dist/index.js index ce0a8409..fc44acf1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -87,9 +87,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1721634429; + BUILD_TIMESTAMP = 1721637424; // 当前版本 commit id - BUILD_VERSION = "85b8103"; + BUILD_VERSION = "11d289a"; // -- 基础配置 -- /** * @type {I18n | null} @@ -170,8 +170,7 @@ var API_GUARD = null; var CUSTOM_COMMAND = {}; var CONST = { PASSWORD_KEY: "chat_history_password", - GROUP_TYPES: ["group", "supergroup"], - USER_AGENT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15" + GROUP_TYPES: ["group", "supergroup"] }; var ENV_TYPES = { SYSTEM_INIT_MESSAGE: "string", @@ -1150,8 +1149,7 @@ async function requestCompletionsFromGeminiAI(message, prompt, history, context, const resp = await fetch(url, { method: "POST", headers: { - "Content-Type": "application/json", - "User-Agent": CONST.USER_AGENT + "Content-Type": "application/json" }, body: JSON.stringify({ contents }) }); @@ -1779,27 +1777,24 @@ async function commandClearUserConfig(message, command, subcommand, context) { } } async function commandFetchUpdate(message, command, subcommand, context) { - const config = { - headers: { - "User-Agent": CONST.USER_AGENT - } - }; const current = { ts: ENV.BUILD_TIMESTAMP, sha: ENV.BUILD_VERSION }; - const repo = `https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/${ENV.UPDATE_BRANCH}`; - const ts = `${repo}/dist/timestamp`; - const info = `${repo}/dist/buildinfo.json`; - let online = await fetch(info, config).then((r) => r.json()).catch(() => null); - if (!online) { - online = await fetch(ts, config).then((r) => r.text()).then((ts2) => ({ ts: Number(ts2.trim()), sha: "unknown" })).catch(() => ({ ts: 0, sha: "unknown" })); - } - if (current.ts < online.ts) { - return sendMessageToTelegramWithContext(context)(`New version detected: ${online.sha}(${online.ts}) -Current version: ${current.sha}(${current.ts})`); - } else { - return sendMessageToTelegramWithContext(context)(`Current version: ${current.sha}(${current.ts}) is up to date`); + try { + const info = `https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/${ENV.UPDATE_BRANCH}/dist/buildinfo.json`; + const online = await fetch(info).then((r) => r.json()); + const timeFormat = (ts) => { + return new Date(ts * 1e3).toLocaleString("en-US", {}); + }; + if (current.ts < online.ts) { + return sendMessageToTelegramWithContext(context)(`New version detected: ${online.sha}(${timeFormat(online.ts)}) +Current version: ${current.sha}(${timeFormat(current.ts)})`); + } else { + return sendMessageToTelegramWithContext(context)(`Current version: ${current.sha}(${timeFormat(current.ts)}) is up to date`); + } + } catch (e) { + return sendMessageToTelegramWithContext(context)(`ERROR: ${e.message}`); } } async function commandSystem(message, command, subcommand, context) { diff --git a/dist/timestamp b/dist/timestamp index 4cd6e549..6fe74ddb 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1721634429 +1721637424 diff --git a/src/agent/gemini.js b/src/agent/gemini.js index 8ceed078..1336a13f 100644 --- a/src/agent/gemini.js +++ b/src/agent/gemini.js @@ -58,7 +58,6 @@ export async function requestCompletionsFromGeminiAI(message, prompt, history, c method: 'POST', headers: { 'Content-Type': 'application/json', - 'User-Agent': CONST.USER_AGENT, }, body: JSON.stringify({contents}), }); diff --git a/src/config/env.js b/src/config/env.js index c9d89616..b0249ea5 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -207,7 +207,6 @@ export const CUSTOM_COMMAND = {}; export const CONST = { PASSWORD_KEY: 'chat_history_password', GROUP_TYPES: ['group', 'supergroup'], - USER_AGENT: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', }; const ENV_TYPES = { diff --git a/src/telegram/command.js b/src/telegram/command.js index 65b1c207..a40d86dc 100644 --- a/src/telegram/command.js +++ b/src/telegram/command.js @@ -301,33 +301,25 @@ async function commandClearUserConfig(message, command, subcommand, context) { * @return {Promise} */ async function commandFetchUpdate(message, command, subcommand, context) { - const config = { - headers: { - 'User-Agent': CONST.USER_AGENT, - }, - }; + const current = { ts: ENV.BUILD_TIMESTAMP, sha: ENV.BUILD_VERSION, }; - const repo = `https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/${ENV.UPDATE_BRANCH}`; - const ts = `${repo}/dist/timestamp`; - const info = `${repo}/dist/buildinfo.json`; - - let online = await fetch(info, config) - .then((r) => r.json()) - .catch(() => null); - if (!online) { - online = await fetch(ts, config).then((r) => r.text()) - .then((ts) => ({ts: Number(ts.trim()), sha: 'unknown'})) - .catch(() => ({ts: 0, sha: 'unknown'})); - } - - if (current.ts < online.ts) { - return sendMessageToTelegramWithContext(context)(`New version detected: ${online.sha}(${online.ts})\nCurrent version: ${current.sha}(${current.ts})`); - } else { - return sendMessageToTelegramWithContext(context)(`Current version: ${current.sha}(${current.ts}) is up to date`); + try { + const info = `https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/${ENV.UPDATE_BRANCH}/dist/buildinfo.json`; + const online = await fetch(info).then((r) => r.json()) + const timeFormat = (ts) => { + return new Date(ts * 1000).toLocaleString('en-US', {}) + } + if (current.ts < online.ts) { + return sendMessageToTelegramWithContext(context)(`New version detected: ${online.sha}(${timeFormat(online.ts)})\nCurrent version: ${current.sha}(${timeFormat(current.ts)})`); + } else { + return sendMessageToTelegramWithContext(context)(`Current version: ${current.sha}(${timeFormat(current.ts)}) is up to date`); + } + } catch (e) { + return sendMessageToTelegramWithContext(context)(`ERROR: ${e.message}`); } } From 59aa05402554f7b6ad673e0c2d488f022d6ff7ec Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 22 Jul 2024 17:17:01 +0800 Subject: [PATCH 05/17] =?UTF-8?q?feat:=20=E4=B8=BA=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=8C=87=E4=BB=A4=E6=B7=BB=E5=8A=A0=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 11 +- dist/timestamp | 2 +- doc/cn/CONFIG.md | 23 ++ doc/en/CONFIG.md | 24 ++ src/config/env.js | 3 + src/telegram/command.js | 11 +- wrangler-example.toml | 10 +- yarn.lock | 608 +++++++++++++++++++++------------------- 9 files changed, 402 insertions(+), 292 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 8563c7cb..dd11e247 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "11d289a", "timestamp": 1721637424} +{"sha": "8f11aec", "timestamp": 1721639738} diff --git a/dist/index.js b/dist/index.js index fc44acf1..04ced871 100644 --- a/dist/index.js +++ b/dist/index.js @@ -87,9 +87,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1721637424; + BUILD_TIMESTAMP = 1721639738; // 当前版本 commit id - BUILD_VERSION = "11d289a"; + BUILD_VERSION = "8f11aec"; // -- 基础配置 -- /** * @type {I18n | null} @@ -168,6 +168,7 @@ var ENV = new Environment(); var DATABASE = null; var API_GUARD = null; var CUSTOM_COMMAND = {}; +var CUSTOM_COMMAND_DESCRIPTION = {}; var CONST = { PASSWORD_KEY: "chat_history_password", GROUP_TYPES: ["group", "supergroup"] @@ -239,10 +240,12 @@ function initEnv(env, i18n2) { DATABASE = env.DATABASE; API_GUARD = env.API_GUARD; const customCommandPrefix = "CUSTOM_COMMAND_"; + const customCommandDescriptionPrefix = "COMMAND_DESCRIPTION_"; for (const key of Object.keys(env)) { if (key.startsWith(customCommandPrefix)) { const cmd = key.substring(customCommandPrefix.length); CUSTOM_COMMAND["/" + cmd] = env[key]; + CUSTOM_COMMAND_DESCRIPTION["/" + cmd] = env[customCommandDescriptionPrefix + cmd]; } } mergeEnvironment(ENV, env); @@ -1679,7 +1682,9 @@ async function commandGenerateImg(message, command, subcommand, context) { } } async function commandGetHelp(message, command, subcommand, context) { - const helpMsg = ENV.I18N.command.help.summary + Object.keys(commandHandlers).map((key) => `${key}\uFF1A${ENV.I18N.command.help[key.substring(1)]}`).join("\n"); + let helpMsg = ENV.I18N.command.help.summary + "\n"; + helpMsg += Object.keys(commandHandlers).map((key) => `${key}\uFF1A${ENV.I18N.command.help[key.substring(1)]}`).join("\n"); + helpMsg += Object.keys(CUSTOM_COMMAND).filter((key) => !!CUSTOM_COMMAND_DESCRIPTION[key]).map((key) => `${key}\uFF1A${CUSTOM_COMMAND_DESCRIPTION[key]}`).join("\n"); return sendMessageToTelegramWithContext(context)(helpMsg); } async function commandCreateNewChatContext(message, command, subcommand, context) { diff --git a/dist/timestamp b/dist/timestamp index 6fe74ddb..f6045d98 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1721637424 +1721639738 diff --git a/doc/cn/CONFIG.md b/doc/cn/CONFIG.md index 42e5e785..b2f8a812 100644 --- a/doc/cn/CONFIG.md +++ b/doc/cn/CONFIG.md @@ -180,3 +180,26 @@ CUSTOM_COMMAND_gpt4 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": " CUSTOM_COMMAND_cn2en = '/setenvs {"SYSTEM_INIT_MESSAGE": "你是一个翻译下面将我说的话都翻译成英文"}' ``` +### 为自定义指令添加帮助信息 + +如果你想为自定义指令添加帮助信息,可以使用环境变量设置 `COMMAND_DESCRIPTION_XXX`,其中`XXX`为指令名,比如`COMMAND_DESCRIPTION_azure`,值为指令描述,比如`切换AI提供商为Azure`。 这样就可以使用`/help`查看到自定义指令的帮助信息。 + +下面是一些自定义指令帮助信息例子 + +| 指令描述 | 值 | +|-----------------------------|--------------------------------| +| COMMAND_DESCRIPTION_azure | `切换AI提供商为Azure` | +| COMMAND_DESCRIPTION_workers | `切换AI提供商为Workers` | +| COMMAND_DESCRIPTION_gpt3 | `切换AI提供商为OpenAI GPT-3.5 Turbo` | +| COMMAND_DESCRIPTION_gpt4 | `切换AI提供商为OpenAI GPT-4` | +| COMMAND_DESCRIPTION_cn2en | `将对话内容翻译成英文` | + +如果你是用toml进行配置,可以使用下面的方式: + +```toml +COMMAND_DESCRIPTION_azure = '切换AI提供商为Azure' +COMMAND_DESCRIPTION_workers = '切换AI提供商为Workers' +COMMAND_DESCRIPTION_gpt3 = '切换AI提供商为OpenAI GPT-3.5 Turbo' +COMMAND_DESCRIPTION_gpt4 = '切换AI提供商为OpenAI GPT-4' +COMMAND_DESCRIPTION_cn2en = '将对话内容翻译成英文' +``` diff --git a/doc/en/CONFIG.md b/doc/en/CONFIG.md index 7c76d07d..89eb4218 100644 --- a/doc/en/CONFIG.md +++ b/doc/en/CONFIG.md @@ -180,3 +180,27 @@ CUSTOM_COMMAND_gpt4 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": " CUSTOM_COMMAND_cn2en = '/setenvs {"SYSTEM_INIT_MESSAGE": "You are a translator. Please translate everything I say below into English."}' ``` + +### Add help information for custom commands. + +If you want to add help information for a custom command, you can use environment variables to set `COMMAND_DESCRIPTION_XXX`, where `XXX` is the name of the command, such as `COMMAND_DESCRIPTION_azure`, and the value is the description of the command, such as `Switch AI provider to Azure`. This way, you can use `/help` to view the help information for the custom command. + +The following are some examples of custom command help information. + +| Command Description | Value | +|-----------------------------|----------------------------------------------------| +| COMMAND_DESCRIPTION_azure | `Switch AI provider to Azure.` | +| COMMAND_DESCRIPTION_workers | `Switch AI provider to Workers` | +| COMMAND_DESCRIPTION_gpt3 | `Switch AI provider to OpenAI GPT-3.5 Turbo` | +| COMMAND_DESCRIPTION_gpt4 | `Switch AI provider to OpenAI GPT-4` | +| COMMAND_DESCRIPTION_cn2en | `Translate the conversation content into English.` | + +If you are using TOML for configuration, you can use the following method: + +```toml +COMMAND_DESCRIPTION_azure = "Switch AI provider to Azure." +COMMAND_DESCRIPTION_workers = "Switch AI provider to Workers" +COMMAND_DESCRIPTION_gpt3 = "Switch AI provider to OpenAI GPT-3.5 Turbo" +COMMAND_DESCRIPTION_gpt4 = "Switch AI provider to OpenAI GPT-4" +COMMAND_DESCRIPTION_cn2en = "Translate the conversation content into English." +``` diff --git a/src/config/env.js b/src/config/env.js index b0249ea5..9b8cc669 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -203,6 +203,7 @@ export let DATABASE = null; export let API_GUARD = null; export const CUSTOM_COMMAND = {}; +export const CUSTOM_COMMAND_DESCRIPTION = {}; export const CONST = { PASSWORD_KEY: 'chat_history_password', @@ -290,10 +291,12 @@ export function initEnv(env, i18n) { // 绑定自定义命令 const customCommandPrefix = 'CUSTOM_COMMAND_'; + const customCommandDescriptionPrefix = 'COMMAND_DESCRIPTION_'; for (const key of Object.keys(env)) { if (key.startsWith(customCommandPrefix)) { const cmd = key.substring(customCommandPrefix.length); CUSTOM_COMMAND['/' + cmd] = env[key]; + CUSTOM_COMMAND_DESCRIPTION['/' + cmd] = env[customCommandDescriptionPrefix + cmd]; } } diff --git a/src/telegram/command.js b/src/telegram/command.js index a40d86dc..f5ce5ac1 100644 --- a/src/telegram/command.js +++ b/src/telegram/command.js @@ -1,5 +1,5 @@ import "../types/context.js" -import {CONST, CUSTOM_COMMAND, DATABASE, ENV, mergeEnvironment} from '../config/env.js'; +import {CONST, CUSTOM_COMMAND, CUSTOM_COMMAND_DESCRIPTION, DATABASE, ENV, mergeEnvironment} from '../config/env.js'; import { getChatRoleWithContext, sendChatActionToTelegramWithContext, @@ -136,11 +136,14 @@ async function commandGenerateImg(message, command, subcommand, context) { * @return {Promise} */ async function commandGetHelp(message, command, subcommand, context) { - const helpMsg = - ENV.I18N.command.help.summary + - Object.keys(commandHandlers) + let helpMsg = ENV.I18N.command.help.summary + '\n'; + helpMsg += Object.keys(commandHandlers) .map((key) => `${key}:${ENV.I18N.command.help[key.substring(1)]}`) .join('\n'); + helpMsg += Object.keys(CUSTOM_COMMAND) + .filter((key) => !!CUSTOM_COMMAND_DESCRIPTION[key]) + .map((key) => `${key}:${CUSTOM_COMMAND_DESCRIPTION[key]}`) + .join('\n'); return sendMessageToTelegramWithContext(context)(helpMsg); } diff --git a/wrangler-example.toml b/wrangler-example.toml index 3510a0d2..0849ff1a 100644 --- a/wrangler-example.toml +++ b/wrangler-example.toml @@ -178,7 +178,13 @@ OPENAI_API_KEY = 'SK-1,SK-2' #ANTHROPIC_CHAT_MODEL = 'claude-3-haiku-20240307' CUSTOM_COMMAND_azure= '/setenvs {"AI_PROVIDER": "azure"}' +COMMAND_DESCRIPTION_azure = 'Switch to Azure AI provider' + CUSTOM_COMMAND_workers = '/setenvs {"AI_PROVIDER": "workers"}' -CUSTOM_COMMAND_gpt3 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": "gpt-3.5-turbo"}' -CUSTOM_COMMAND_gpt4 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": "gpt-4"}' +COMMAND_DESCRIPTION_workers = 'Switch to Workers AI provider' + +CUSTOM_COMMAND_openai = '/setenvs {"AI_PROVIDER": "openai"}' +COMMAND_DESCRIPTION_openai = 'Switch to OpenAI AI provider' + CUSTOM_COMMAND_cn2en = '/setenvs {"SYSTEM_INIT_MESSAGE": "You are a translator. Please translate everything I say below into English."}' +COMMAND_DESCRIPTION_cn2en = 'Switch to Chinese to English translation mode' diff --git a/yarn.lock b/yarn.lock index db1a5996..e5bd4751 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,53 +2,53 @@ # yarn lockfile v1 -"@cloudflare/kv-asset-handler@0.3.2": - version "0.3.2" - resolved "https://registry.npmmirror.com/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.2.tgz#06437b75664729823ac9033b89f06a3b078e4f55" - integrity sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA== +"@cloudflare/kv-asset-handler@0.3.4": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz#5cc152847c8ae4d280ec5d7f4f6ba8c976b585c3" + integrity sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q== dependencies: mime "^3.0.0" -"@cloudflare/workerd-darwin-64@1.20240512.0": - version "1.20240512.0" - resolved "https://registry.npmmirror.com/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240512.0.tgz#9c72a4d960e1bd69a83d1917b6be54254fc93742" - integrity sha512-VMp+CsSHFALQiBzPdQ5dDI4T1qwLu0mQ0aeKVNDosXjueN0f3zj/lf+mFil5/9jBbG3t4mG0y+6MMnalP9Lobw== +"@cloudflare/workerd-darwin-64@1.20240718.0": + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240718.0.tgz#46f438fb86ccd4772c29db52fe1d076bc9e6ffb4" + integrity sha512-BsPZcSCgoGnufog2GIgdPuiKicYTNyO/Dp++HbpLRH+yQdX3x4aWx83M+a0suTl1xv76dO4g9aw7SIB6OSgIyQ== -"@cloudflare/workerd-darwin-arm64@1.20240512.0": - version "1.20240512.0" - resolved "https://registry.npmmirror.com/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240512.0.tgz#e7dba44d6eb59b13ccf8c92c089e5c6126b76e6e" - integrity sha512-lZktXGmzMrB5rJqY9+PmnNfv1HKlj/YLZwMjPfF0WVKHUFdvQbAHsi7NlKv6mW9uIvlZnS+K4sIkWc0MDXcRnA== +"@cloudflare/workerd-darwin-arm64@1.20240718.0": + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240718.0.tgz#70e1dca5de4869ef3a9b9e296e934848bca6c74f" + integrity sha512-nlr4gaOO5gcJerILJQph3+2rnas/nx/lYsuaot1ntHu4LAPBoQo1q/Pucj2cSIav4UiMzTbDmoDwPlls4Kteog== -"@cloudflare/workerd-linux-64@1.20240512.0": - version "1.20240512.0" - resolved "https://registry.npmmirror.com/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240512.0.tgz#fd226eae1d5895820111144c0b09abc0e0bdd434" - integrity sha512-wrHvqCZZqXz6Y3MUTn/9pQNsvaoNjbJpuA6vcXsXu8iCzJi911iVW2WUEBX+MpUWD+mBIP0oXni5tTlhkokOPw== +"@cloudflare/workerd-linux-64@1.20240718.0": + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240718.0.tgz#802c04a1a5729f3881c675be3d158ee06c6b1a36" + integrity sha512-LJ/k3y47pBcjax0ee4K+6ZRrSsqWlfU4lbU8Dn6u5tSC9yzwI4YFNXDrKWInB0vd7RT3w4Yqq1S6ZEbfRrqVUg== -"@cloudflare/workerd-linux-arm64@1.20240512.0": - version "1.20240512.0" - resolved "https://registry.npmmirror.com/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240512.0.tgz#64d79e06019e8fb52e82d7898d14eed4cdfdeb6b" - integrity sha512-YPezHMySL9J9tFdzxz390eBswQ//QJNYcZolz9Dgvb3FEfdpK345cE/bsWbMOqw5ws2f82l388epoenghtYvAg== +"@cloudflare/workerd-linux-arm64@1.20240718.0": + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240718.0.tgz#cebff9115d48f8d0c2649fdf86ef46b726d1841f" + integrity sha512-zBEZvy88EcAMGRGfuVtS00Yl7lJdUM9sH7i651OoL+q0Plv9kphlCC0REQPwzxrEYT1qibSYtWcD9IxQGgx2/g== -"@cloudflare/workerd-windows-64@1.20240512.0": - version "1.20240512.0" - resolved "https://registry.npmmirror.com/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240512.0.tgz#c4cd1673a690b9f7f8fb413a9ff16592cdf847f1" - integrity sha512-SxKapDrIYSscMR7lGIp/av0l6vokjH4xQ9ACxHgXh+OdOus9azppSmjaPyw4/ePvg7yqpkaNjf9o258IxWtvKQ== +"@cloudflare/workerd-windows-64@1.20240718.0": + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240718.0.tgz#940893e62df7f5a8ec895572b834c95c1e256fbd" + integrity sha512-YpCRvvT47XanFum7C3SedOZKK6BfVhqmwdAAVAQFyc4gsCdegZo0JkUkdloC/jwuWlbCACOG2HTADHOqyeolzQ== "@cspotcode/source-map-support@0.8.1": version "0.8.1" - resolved "https://registry.npmmirror.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== dependencies: "@jridgewell/trace-mapping" "0.3.9" "@esbuild-plugins/node-globals-polyfill@^0.2.3": version "0.2.3" - resolved "https://registry.npmmirror.com/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz#0e4497a2b53c9e9485e149bc92ddb228438d6bcf" + resolved "https://registry.yarnpkg.com/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz#0e4497a2b53c9e9485e149bc92ddb228438d6bcf" integrity sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw== "@esbuild-plugins/node-modules-polyfill@^0.2.2": version "0.2.2" - resolved "https://registry.npmmirror.com/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz#cefa3dc0bd1c16277a8338b52833420c94987327" + resolved "https://registry.yarnpkg.com/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz#cefa3dc0bd1c16277a8338b52833420c94987327" integrity sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA== dependencies: escape-string-regexp "^4.0.0" @@ -56,129 +56,138 @@ "@esbuild/android-arm64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== "@esbuild/android-arm@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== "@esbuild/android-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== "@esbuild/darwin-arm64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== "@esbuild/darwin-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== "@esbuild/freebsd-arm64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== "@esbuild/freebsd-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== "@esbuild/linux-arm64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== "@esbuild/linux-arm@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== "@esbuild/linux-ia32@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== "@esbuild/linux-loong64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== "@esbuild/linux-mips64el@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== "@esbuild/linux-ppc64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== "@esbuild/linux-riscv64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== "@esbuild/linux-s390x@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== "@esbuild/linux-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== "@esbuild/netbsd-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== "@esbuild/openbsd-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== "@esbuild/sunos-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== "@esbuild/win32-arm64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== "@esbuild/win32-ia32@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== "@esbuild/win32-x64@0.17.19": version "0.17.19" - resolved "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" - resolved "https://registry.npmmirror.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.6.1": - version "4.10.0" - resolved "https://registry.npmmirror.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" - integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== +"@eslint-community/regexpp@^4.11.0": + version "4.11.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" + integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== + +"@eslint/config-array@^0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.0.tgz#ff305e1ee618a00e6e5d0485454c8d92d94a860d" + integrity sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA== + dependencies: + "@eslint/object-schema" "^2.1.4" + debug "^4.3.1" + minimatch "^3.1.2" "@eslint/eslintrc@^3.1.0": version "3.1.0" - resolved "https://registry.npmmirror.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" integrity sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ== dependencies: ajv "^6.12.4" @@ -191,53 +200,44 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.3.0", "@eslint/js@^9.1.1": - version "9.3.0" - resolved "https://registry.npmmirror.com/@eslint/js/-/js-9.3.0.tgz#2e8f65c9c55227abc4845b1513c69c32c679d8fe" - integrity sha512-niBqk8iwv96+yuTwjM6bWg8ovzAPF9qkICsGtcoa5/dmqcEMfdwNAX7+/OHcJHc7wj7XqPxH98oAHytFYlw6Sw== +"@eslint/js@9.7.0", "@eslint/js@^9.1.1": + version "9.7.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.7.0.tgz#b712d802582f02b11cfdf83a85040a296afec3f0" + integrity sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng== + +"@eslint/object-schema@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.4.tgz#9e69f8bb4031e11df79e03db09f9dbbae1740843" + integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ== "@fastify/busboy@^2.0.0": version "2.1.1" - resolved "https://registry.npmmirror.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" + resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== -"@humanwhocodes/config-array@^0.13.0": - version "0.13.0" - resolved "https://registry.npmmirror.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" - integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== - dependencies: - "@humanwhocodes/object-schema" "^2.0.3" - debug "^4.3.1" - minimatch "^3.0.5" - "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" - resolved "https://registry.npmmirror.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^2.0.3": - version "2.0.3" - resolved "https://registry.npmmirror.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" - integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== - "@humanwhocodes/retry@^0.3.0": version "0.3.0" - resolved "https://registry.npmmirror.com/@humanwhocodes/retry/-/retry-0.3.0.tgz#6d86b8cb322660f03d3f0aa94b99bdd8e172d570" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.0.tgz#6d86b8cb322660f03d3f0aa94b99bdd8e172d570" integrity sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew== "@jridgewell/resolve-uri@^3.0.3": version "3.1.2" - resolved "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.15" - resolved "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" - resolved "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== dependencies: "@jridgewell/resolve-uri" "^3.0.3" @@ -245,7 +245,7 @@ "@nodelib/fs.scandir@2.1.5": version "2.1.5" - resolved "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: "@nodelib/fs.stat" "2.0.5" @@ -253,12 +253,12 @@ "@nodelib/fs.stat@2.0.5": version "2.0.5" - resolved "https://registry.npmmirror.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== "@nodelib/fs.walk@^1.2.8": version "1.2.8" - resolved "https://registry.npmmirror.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: "@nodelib/fs.scandir" "2.1.5" @@ -266,36 +266,38 @@ "@types/node-forge@^1.3.0": version "1.3.11" - resolved "https://registry.npmmirror.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da" + resolved "https://registry.yarnpkg.com/@types/node-forge/-/node-forge-1.3.11.tgz#0972ea538ddb0f4d9c2fa0ec5db5724773a604da" integrity sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ== dependencies: "@types/node" "*" "@types/node@*": - version "20.12.12" - resolved "https://registry.npmmirror.com/@types/node/-/node-20.12.12.tgz#7cbecdf902085cec634fdb362172dfe12b8f2050" - integrity sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw== + version "20.14.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" + integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== dependencies: undici-types "~5.26.4" acorn-jsx@^5.3.2: version "5.3.2" - resolved "https://registry.npmmirror.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^8.2.0: - version "8.3.2" - resolved "https://registry.npmmirror.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa" - integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" -acorn@^8.11.3, acorn@^8.8.0: - version "8.11.3" - resolved "https://registry.npmmirror.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" - integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== +acorn@^8.11.0, acorn@^8.12.0, acorn@^8.8.0: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== ajv@^6.12.4: version "6.12.6" - resolved "https://registry.npmmirror.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" @@ -305,19 +307,19 @@ ajv@^6.12.4: ansi-regex@^5.0.1: version "5.0.1" - resolved "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^4.1.0: version "4.3.0" - resolved "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" anymatch@~3.1.2: version "3.1.3" - resolved "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" @@ -325,34 +327,34 @@ anymatch@~3.1.2: argparse@^2.0.1: version "2.0.1" - resolved "https://registry.npmmirror.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== as-table@^1.0.36: version "1.0.55" - resolved "https://registry.npmmirror.com/as-table/-/as-table-1.0.55.tgz#dc984da3937745de902cea1d45843c01bdbbec4f" + resolved "https://registry.yarnpkg.com/as-table/-/as-table-1.0.55.tgz#dc984da3937745de902cea1d45843c01bdbbec4f" integrity sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ== dependencies: printable-characters "^1.0.42" balanced-match@^1.0.0: version "1.0.2" - resolved "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== binary-extensions@^2.0.0: version "2.3.0" - resolved "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== blake3-wasm@^2.1.5: version "2.1.5" - resolved "https://registry.npmmirror.com/blake3-wasm/-/blake3-wasm-2.1.5.tgz#b22dbb84bc9419ed0159caa76af4b1b132e6ba52" + resolved "https://registry.yarnpkg.com/blake3-wasm/-/blake3-wasm-2.1.5.tgz#b22dbb84bc9419ed0159caa76af4b1b132e6ba52" integrity sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g== brace-expansion@^1.1.7: version "1.1.11" - resolved "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" @@ -367,12 +369,12 @@ braces@~3.0.2: callsites@^3.0.0: version "3.1.0" - resolved "https://registry.npmmirror.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== capnp-ts@^0.7.0: version "0.7.0" - resolved "https://registry.npmmirror.com/capnp-ts/-/capnp-ts-0.7.0.tgz#16fd8e76b667d002af8fcf4bf92bf15d1a7b54a9" + resolved "https://registry.yarnpkg.com/capnp-ts/-/capnp-ts-0.7.0.tgz#16fd8e76b667d002af8fcf4bf92bf15d1a7b54a9" integrity sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g== dependencies: debug "^4.3.1" @@ -380,7 +382,7 @@ capnp-ts@^0.7.0: chalk@^4.0.0: version "4.1.2" - resolved "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" @@ -388,7 +390,7 @@ chalk@^4.0.0: chokidar@^3.5.3: version "3.6.0" - resolved "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== dependencies: anymatch "~3.1.2" @@ -403,29 +405,34 @@ chokidar@^3.5.3: color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" color-name@~1.1.4: version "1.1.4" - resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== concat-map@0.0.1: version "0.0.1" - resolved "https://registry.npmmirror.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +consola@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/consola/-/consola-3.2.3.tgz#0741857aa88cfa0d6fd53f1cff0375136e98502f" + integrity sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ== + cookie@^0.5.0: version "0.5.0" - resolved "https://registry.npmmirror.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== cross-spawn@^7.0.2: version "7.0.3" - resolved "https://registry.npmmirror.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== dependencies: path-key "^3.1.0" @@ -434,24 +441,34 @@ cross-spawn@^7.0.2: data-uri-to-buffer@^2.0.0: version "2.0.2" - resolved "https://registry.npmmirror.com/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz#d296973d5a4897a5dbe31716d118211921f04770" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz#d296973d5a4897a5dbe31716d118211921f04770" integrity sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA== +date-fns@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf" + integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww== + debug@^4.3.1, debug@^4.3.2: - version "4.3.4" - resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== dependencies: ms "2.1.2" deep-is@^0.1.3: version "0.1.4" - resolved "https://registry.npmmirror.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +defu@^6.1.4: + version "6.1.4" + resolved "https://registry.yarnpkg.com/defu/-/defu-6.1.4.tgz#4e0c9cf9ff68fe5f3d7f2765cc1a012dfdcb0479" + integrity sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg== + esbuild@0.17.19, esbuild@^0.17.11: version "0.17.19" - resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== optionalDependencies: "@esbuild/android-arm" "0.17.19" @@ -479,37 +496,37 @@ esbuild@0.17.19, esbuild@^0.17.11: escape-string-regexp@^4.0.0: version "4.0.0" - resolved "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-scope@^8.0.1: - version "8.0.1" - resolved "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-8.0.1.tgz#a9601e4b81a0b9171657c343fb13111688963cfc" - integrity sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og== +eslint-scope@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.0.2.tgz#5cbb33d4384c9136083a71190d548158fe128f94" + integrity sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" eslint-visitor-keys@^3.3.0: version "3.4.3" - resolved "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + 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-visitor-keys@^4.0.0: version "4.0.0" - resolved "https://registry.npmmirror.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== eslint@^9.1.1: - version "9.3.0" - resolved "https://registry.npmmirror.com/eslint/-/eslint-9.3.0.tgz#36a96db84592618d6ed9074d677e92f4e58c08b9" - integrity sha512-5Iv4CsZW030lpUqHBapdPo3MJetAPtejVW8B84GIcIIv8+ohFaddXsrn1Gn8uD9ijDb+kcYKFUVmC8qG8B2ORQ== + version "9.7.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.7.0.tgz#bedb48e1cdc2362a0caaa106a4c6ed943e8b09e4" + integrity sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.6.1" + "@eslint-community/regexpp" "^4.11.0" + "@eslint/config-array" "^0.17.0" "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.3.0" - "@humanwhocodes/config-array" "^0.13.0" + "@eslint/js" "9.7.0" "@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/retry" "^0.3.0" "@nodelib/fs.walk" "^1.2.8" @@ -518,10 +535,10 @@ eslint@^9.1.1: cross-spawn "^7.0.2" debug "^4.3.2" escape-string-regexp "^4.0.0" - eslint-scope "^8.0.1" + eslint-scope "^8.0.2" eslint-visitor-keys "^4.0.0" - espree "^10.0.1" - esquery "^1.4.2" + espree "^10.1.0" + esquery "^1.5.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" file-entry-cache "^8.0.0" @@ -540,74 +557,74 @@ eslint@^9.1.1: strip-ansi "^6.0.1" text-table "^0.2.0" -espree@^10.0.1: - version "10.0.1" - resolved "https://registry.npmmirror.com/espree/-/espree-10.0.1.tgz#600e60404157412751ba4a6f3a2ee1a42433139f" - integrity sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww== +espree@^10.0.1, espree@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.1.0.tgz#8788dae611574c0f070691f522e4116c5a11fc56" + integrity sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA== dependencies: - acorn "^8.11.3" + acorn "^8.12.0" acorn-jsx "^5.3.2" eslint-visitor-keys "^4.0.0" -esquery@^1.4.2: - version "1.5.0" - resolved "https://registry.npmmirror.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" - integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== +esquery@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== dependencies: estraverse "^5.1.0" esrecurse@^4.3.0: version "4.3.0" - resolved "https://registry.npmmirror.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: estraverse "^5.2.0" estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" - resolved "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== estree-walker@^0.6.1: version "0.6.1" - resolved "https://registry.npmmirror.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== esutils@^2.0.2: version "2.0.3" - resolved "https://registry.npmmirror.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== exit-hook@^2.2.1: version "2.2.1" - resolved "https://registry.npmmirror.com/exit-hook/-/exit-hook-2.2.1.tgz#007b2d92c6428eda2b76e7016a34351586934593" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-2.2.1.tgz#007b2d92c6428eda2b76e7016a34351586934593" integrity sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw== fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" - resolved "https://registry.npmmirror.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-json-stable-stringify@^2.0.0: version "2.1.0" - resolved "https://registry.npmmirror.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6: version "2.0.6" - resolved "https://registry.npmmirror.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: version "1.17.1" - resolved "https://registry.npmmirror.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" file-entry-cache@^8.0.0: version "8.0.0" - resolved "https://registry.npmmirror.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== dependencies: flat-cache "^4.0.0" @@ -621,7 +638,7 @@ fill-range@^7.1.1: find-up@^5.0.0: version "5.0.0" - resolved "https://registry.npmmirror.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: locate-path "^6.0.0" @@ -629,7 +646,7 @@ find-up@^5.0.0: flat-cache@^4.0.0: version "4.0.1" - resolved "https://registry.npmmirror.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== dependencies: flatted "^3.2.9" @@ -637,22 +654,22 @@ flat-cache@^4.0.0: flatted@^3.2.9: version "3.3.1" - resolved "https://registry.npmmirror.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== fsevents@~2.3.2: version "2.3.3" - resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.2: version "1.1.2" - resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== get-source@^2.0.12: version "2.0.12" - resolved "https://registry.npmmirror.com/get-source/-/get-source-2.0.12.tgz#0b47d57ea1e53ce0d3a69f4f3d277eb8047da944" + resolved "https://registry.yarnpkg.com/get-source/-/get-source-2.0.12.tgz#0b47d57ea1e53ce0d3a69f4f3d277eb8047da944" integrity sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w== dependencies: data-uri-to-buffer "^2.0.0" @@ -660,53 +677,53 @@ get-source@^2.0.12: glob-parent@^6.0.2: version "6.0.2" - resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: is-glob "^4.0.3" glob-parent@~5.1.2: version "5.1.2" - resolved "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob-to-regexp@^0.4.1: version "0.4.1" - resolved "https://registry.npmmirror.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== globals@^14.0.0: version "14.0.0" - resolved "https://registry.npmmirror.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" + resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== globals@^15.1.0: - version "15.3.0" - resolved "https://registry.npmmirror.com/globals/-/globals-15.3.0.tgz#619db01f88d8fb91b0ed841a820cd980299575e5" - integrity sha512-cCdyVjIUVTtX8ZsPkq1oCsOsLmGIswqnjZYMJJTGaNApj1yHtLSymKhwH51ttirREn75z3p4k051clwg7rvNKA== + version "15.8.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.8.0.tgz#e64bb47b619dd8cbf32b3c1a0a61714e33cbbb41" + integrity sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw== has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -hasown@^2.0.0: +hasown@^2.0.2: version "2.0.2" - resolved "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: function-bind "^1.1.2" ignore@^5.2.0: version "5.3.1" - resolved "https://registry.npmmirror.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== import-fresh@^3.2.1: version "3.3.0" - resolved "https://registry.npmmirror.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" @@ -714,82 +731,82 @@ import-fresh@^3.2.1: imurmurhash@^0.1.4: version "0.1.4" - resolved "https://registry.npmmirror.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== is-binary-path@~2.1.0: version "2.1.0" - resolved "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== dependencies: binary-extensions "^2.0.0" is-core-module@^2.13.0: - version "2.13.1" - resolved "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" - integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== dependencies: - hasown "^2.0.0" + hasown "^2.0.2" is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" - resolved "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" is-number@^7.0.0: version "7.0.0" - resolved "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-path-inside@^3.0.3: version "3.0.3" - resolved "https://registry.npmmirror.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== isexe@^2.0.0: version "2.0.0" - resolved "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== js-yaml@^4.1.0: version "4.1.0" - resolved "https://registry.npmmirror.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" json-buffer@3.0.1: version "3.0.1" - resolved "https://registry.npmmirror.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.npmmirror.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.npmmirror.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== keyv@^4.5.4: version "4.5.4" - resolved "https://registry.npmmirror.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== dependencies: json-buffer "3.0.1" levn@^0.4.1: version "0.4.1" - resolved "https://registry.npmmirror.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" @@ -797,32 +814,32 @@ levn@^0.4.1: locate-path@^6.0.0: version "6.0.0" - resolved "https://registry.npmmirror.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: p-locate "^5.0.0" lodash.merge@^4.6.2: version "4.6.2" - resolved "https://registry.npmmirror.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== magic-string@^0.25.3: version "0.25.9" - resolved "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== dependencies: sourcemap-codec "^1.4.8" mime@^3.0.0: version "3.0.0" - resolved "https://registry.npmmirror.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7" + resolved "https://registry.yarnpkg.com/mime/-/mime-3.0.0.tgz#b374550dca3a0c18443b0c950a6a58f1931cf7a7" integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== -miniflare@3.20240512.0: - version "3.20240512.0" - resolved "https://registry.npmmirror.com/miniflare/-/miniflare-3.20240512.0.tgz#2ca99ca04cffead8dcfe002f0d179fae1d649b55" - integrity sha512-X0PlKR0AROKpxFoJNmRtCMIuJxj+ngEcyTOlEokj2rAQ0TBwUhB4/1uiPvdI6ofW5NugPOD1uomAv+gLjwsLDQ== +miniflare@3.20240718.0: + version "3.20240718.0" + resolved "https://registry.yarnpkg.com/miniflare/-/miniflare-3.20240718.0.tgz#41561c6620b2b15803f5b3d2e903ed3af40f3b0b" + integrity sha512-TKgSeyqPBeT8TBLxbDJOKPWlq/wydoJRHjAyDdgxbw59N6wbP8JucK6AU1vXCfu21eKhrEin77ssXOpbfekzPA== dependencies: "@cspotcode/source-map-support" "0.8.1" acorn "^8.8.0" @@ -831,52 +848,57 @@ miniflare@3.20240512.0: exit-hook "^2.2.1" glob-to-regexp "^0.4.1" stoppable "^1.1.0" - undici "^5.28.2" - workerd "1.20240512.0" - ws "^8.11.0" + undici "^5.28.4" + workerd "1.20240718.0" + ws "^8.17.1" youch "^3.2.2" - zod "^3.20.6" + zod "^3.22.3" -minimatch@^3.0.5, minimatch@^3.1.2: +minimatch@^3.1.2: version "3.1.2" - resolved "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" ms@2.1.2: version "2.1.2" - resolved "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== mustache@^4.2.0: version "4.2.0" - resolved "https://registry.npmmirror.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== nanoid@^3.3.3: version "3.3.7" - resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== natural-compare@^1.4.0: version "1.4.0" - resolved "https://registry.npmmirror.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +node-fetch-native@^1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.6.4.tgz#679fc8fd8111266d47d7e72c379f1bed9acff06e" + integrity sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ== + node-forge@^1: version "1.3.1" - resolved "https://registry.npmmirror.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" + resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" - resolved "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== optionator@^0.9.3: version "0.9.4" - resolved "https://registry.npmmirror.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: deep-is "^0.1.3" @@ -888,90 +910,95 @@ optionator@^0.9.3: p-limit@^3.0.2: version "3.1.0" - resolved "https://registry.npmmirror.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: yocto-queue "^0.1.0" p-locate@^5.0.0: version "5.0.0" - resolved "https://registry.npmmirror.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== dependencies: p-limit "^3.0.2" parent-module@^1.0.0: version "1.0.1" - resolved "https://registry.npmmirror.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" path-exists@^4.0.0: version "4.0.0" - resolved "https://registry.npmmirror.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-key@^3.1.0: version "3.1.1" - resolved "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.7: version "1.0.7" - resolved "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-to-regexp@^6.2.0: version "6.2.2" - resolved "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.2.2.tgz#324377a83e5049cbecadc5554d6a63a9a4866b36" integrity sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw== +pathe@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" + integrity sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== + picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.1" - resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== prelude-ls@^1.2.1: version "1.2.1" - resolved "https://registry.npmmirror.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== printable-characters@^1.0.42: version "1.0.42" - resolved "https://registry.npmmirror.com/printable-characters/-/printable-characters-1.0.42.tgz#3f18e977a9bd8eb37fcc4ff5659d7be90868b3d8" + resolved "https://registry.yarnpkg.com/printable-characters/-/printable-characters-1.0.42.tgz#3f18e977a9bd8eb37fcc4ff5659d7be90868b3d8" integrity sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ== punycode@^2.1.0: version "2.3.1" - resolved "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== queue-microtask@^1.2.2: version "1.2.3" - resolved "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== readdirp@~3.6.0: version "3.6.0" - resolved "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== dependencies: picomatch "^2.2.1" resolve-from@^4.0.0: version "4.0.0" - resolved "https://registry.npmmirror.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve.exports@^2.0.2: version "2.0.2" - resolved "https://registry.npmmirror.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.22.8: version "1.22.8" - resolved "https://registry.npmmirror.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: is-core-module "^2.13.0" @@ -980,12 +1007,12 @@ resolve@^1.22.8: reusify@^1.0.4: version "1.0.4" - resolved "https://registry.npmmirror.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== rollup-plugin-inject@^3.0.0: version "3.0.2" - resolved "https://registry.npmmirror.com/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" + resolved "https://registry.yarnpkg.com/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz#e4233855bfba6c0c12a312fd6649dff9a13ee9f4" integrity sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w== dependencies: estree-walker "^0.6.1" @@ -994,28 +1021,28 @@ rollup-plugin-inject@^3.0.0: rollup-plugin-node-polyfills@^0.2.1: version "0.2.1" - resolved "https://registry.npmmirror.com/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz#53092a2744837164d5b8a28812ba5f3ff61109fd" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz#53092a2744837164d5b8a28812ba5f3ff61109fd" integrity sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA== dependencies: rollup-plugin-inject "^3.0.0" rollup-pluginutils@^2.8.1: version "2.8.2" - resolved "https://registry.npmmirror.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== dependencies: estree-walker "^0.6.1" run-parallel@^1.1.9: version "1.2.0" - resolved "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" selfsigned@^2.0.1: version "2.4.1" - resolved "https://registry.npmmirror.com/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" + resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-2.4.1.tgz#560d90565442a3ed35b674034cec4e95dceb4ae0" integrity sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q== dependencies: "@types/node-forge" "^1.3.0" @@ -1023,29 +1050,29 @@ selfsigned@^2.0.1: shebang-command@^2.0.0: version "2.0.0" - resolved "https://registry.npmmirror.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" - resolved "https://registry.npmmirror.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -source-map@0.6.1, source-map@^0.6.1: +source-map@^0.6.1: version "0.6.1" - resolved "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== sourcemap-codec@^1.4.8: version "1.4.8" - resolved "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== stacktracey@^2.1.8: version "2.1.8" - resolved "https://registry.npmmirror.com/stacktracey/-/stacktracey-2.1.8.tgz#bf9916020738ce3700d1323b32bd2c91ea71199d" + resolved "https://registry.yarnpkg.com/stacktracey/-/stacktracey-2.1.8.tgz#bf9916020738ce3700d1323b32bd2c91ea71199d" integrity sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw== dependencies: as-table "^1.0.36" @@ -1053,146 +1080,165 @@ stacktracey@^2.1.8: stoppable@^1.1.0: version "1.1.0" - resolved "https://registry.npmmirror.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" + resolved "https://registry.yarnpkg.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== strip-ansi@^6.0.1: version "6.0.1" - resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" strip-json-comments@^3.1.1: version "3.1.1" - resolved "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== supports-color@^7.1.0: version "7.2.0" - resolved "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" - resolved "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== text-table@^0.2.0: version "0.2.0" - resolved "https://registry.npmmirror.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== to-regex-range@^5.0.1: version "5.0.1" - resolved "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" tslib@^2.2.0: - version "2.6.2" - resolved "https://registry.npmmirror.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" - resolved "https://registry.npmmirror.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" +ufo@^1.5.3: + version "1.5.4" + resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.5.4.tgz#16d6949674ca0c9e0fbbae1fa20a71d7b1ded754" + integrity sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ== + undici-types@~5.26.4: version "5.26.5" - resolved "https://registry.npmmirror.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici@^5.28.2: +undici@^5.28.4: version "5.28.4" - resolved "https://registry.npmmirror.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== dependencies: "@fastify/busboy" "^2.0.0" +"unenv@npm:unenv-nightly@1.10.0-1717606461.a117952": + version "1.10.0-1717606461.a117952" + resolved "https://registry.yarnpkg.com/unenv-nightly/-/unenv-nightly-1.10.0-1717606461.a117952.tgz#ff0b97e1e159f84be747271e1d55263b4b3eae7e" + integrity sha512-u3TfBX02WzbHTpaEfWEKwDijDSFAHcgXkayUZ+MVDrjhLFvgAJzFGTSTmwlEhwWi2exyRQey23ah9wELMM6etg== + dependencies: + consola "^3.2.3" + defu "^6.1.4" + mime "^3.0.0" + node-fetch-native "^1.6.4" + pathe "^1.1.2" + ufo "^1.5.3" + uri-js@^4.2.2: version "4.4.1" - resolved "https://registry.npmmirror.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" which@^2.0.1: version "2.0.2" - resolved "https://registry.npmmirror.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" word-wrap@^1.2.5: version "1.2.5" - resolved "https://registry.npmmirror.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -workerd@1.20240512.0: - version "1.20240512.0" - resolved "https://registry.npmmirror.com/workerd/-/workerd-1.20240512.0.tgz#235047894d29b755effb18907fc55503930182fc" - integrity sha512-VUBmR1PscAPHEE0OF/G2K7/H1gnr9aDWWZzdkIgWfNKkv8dKFCT75H+GJtUHjfwqz3rYCzaNZmatSXOpLGpF8A== +workerd@1.20240718.0: + version "1.20240718.0" + resolved "https://registry.yarnpkg.com/workerd/-/workerd-1.20240718.0.tgz#7a397d0a159f7362dc3f7b19472190a858d96f7c" + integrity sha512-w7lOLRy0XecQTg/ujTLWBiJJuoQvzB3CdQ6/8Wgex3QxFhV9Pbnh3UbwIuUfMw3OCCPQc4o7y+1P+mISAgp6yg== optionalDependencies: - "@cloudflare/workerd-darwin-64" "1.20240512.0" - "@cloudflare/workerd-darwin-arm64" "1.20240512.0" - "@cloudflare/workerd-linux-64" "1.20240512.0" - "@cloudflare/workerd-linux-arm64" "1.20240512.0" - "@cloudflare/workerd-windows-64" "1.20240512.0" + "@cloudflare/workerd-darwin-64" "1.20240718.0" + "@cloudflare/workerd-darwin-arm64" "1.20240718.0" + "@cloudflare/workerd-linux-64" "1.20240718.0" + "@cloudflare/workerd-linux-arm64" "1.20240718.0" + "@cloudflare/workerd-windows-64" "1.20240718.0" wrangler@^3.0.0: - version "3.57.0" - resolved "https://registry.npmmirror.com/wrangler/-/wrangler-3.57.0.tgz#4c8f30e07a185ecef2c1a467323c084020c3d765" - integrity sha512-izK3AZtlFoTq8N0EZjLOQ7hqwsjaXCc1cbNKuhsLJjDX1jB1YZBDPhIhtXL4VVzkJAcH+0Zw2gguOePFCHNaxw== + version "3.65.1" + resolved "https://registry.yarnpkg.com/wrangler/-/wrangler-3.65.1.tgz#493bd92b504f9f056cd57bbe2d430797600c914b" + integrity sha512-Z5NyrbpGMQCpim/6VnI1im0/Weh5+CU1sdep1JbfFxHjn/Jt9K+MeUq+kCns5ubkkdRx2EYsusB/JKyX2JdJ4w== dependencies: - "@cloudflare/kv-asset-handler" "0.3.2" + "@cloudflare/kv-asset-handler" "0.3.4" "@esbuild-plugins/node-globals-polyfill" "^0.2.3" "@esbuild-plugins/node-modules-polyfill" "^0.2.2" blake3-wasm "^2.1.5" chokidar "^3.5.3" + date-fns "^3.6.0" esbuild "0.17.19" - miniflare "3.20240512.0" + miniflare "3.20240718.0" nanoid "^3.3.3" path-to-regexp "^6.2.0" resolve "^1.22.8" resolve.exports "^2.0.2" selfsigned "^2.0.1" - source-map "0.6.1" + source-map "^0.6.1" + unenv "npm:unenv-nightly@1.10.0-1717606461.a117952" xxhash-wasm "^1.0.1" optionalDependencies: fsevents "~2.3.2" -ws@^8.11.0: - version "8.17.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" - integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== +ws@^8.17.1: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== xxhash-wasm@^1.0.1: version "1.0.2" - resolved "https://registry.npmmirror.com/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz#ecc0f813219b727af4d5f3958ca6becee2f2f1ff" + resolved "https://registry.yarnpkg.com/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz#ecc0f813219b727af4d5f3958ca6becee2f2f1ff" integrity sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A== yocto-queue@^0.1.0: version "0.1.0" - resolved "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== youch@^3.2.2: version "3.3.3" - resolved "https://registry.npmmirror.com/youch/-/youch-3.3.3.tgz#50cfdf5bc395ce664a5073e31b712ff4a859d928" + resolved "https://registry.yarnpkg.com/youch/-/youch-3.3.3.tgz#50cfdf5bc395ce664a5073e31b712ff4a859d928" integrity sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA== dependencies: cookie "^0.5.0" mustache "^4.2.0" stacktracey "^2.1.8" -zod@^3.20.6: +zod@^3.22.3: version "3.23.8" - resolved "https://registry.npmmirror.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== From d5c12b6bf0c07c98ab9e8ca4c0bff990fff0b602 Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 10:10:41 +0800 Subject: [PATCH 06/17] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_CN.md | 2 +- doc/cn/CONFIG.md | 41 +++++++++++++++++++++++------------------ doc/en/CONFIG.md | 41 ++++++++++++++++++++++------------------- src/config/env.js | 2 ++ wrangler-example.toml | 2 ++ 6 files changed, 51 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 9e0a50fd..29c7cdbd 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ You can customize the system initialization information so that your debugged pe ## Features - Serverless deployment -- Multi-platform deployment support (Cloudflare Workers, Vercel, Render[...](adapter)) +- Multi-platform deployment support (Cloudflare Workers, Vercel, Render[...](doc/en/PLATFORM.md)) - Adaptation to multiple AI service providers (OpenAI, Azure OpenAI, Cloudflare AI, Cohere, Anthropic, Mistral...) - Custom commands (can achieve quick switching of models, switching of robot presets) - Support for multiple Telegram bots diff --git a/README_CN.md b/README_CN.md index 9033fe14..a87e8dc2 100644 --- a/README_CN.md +++ b/README_CN.md @@ -21,7 +21,7 @@ ChatGPT-Telegram-Workers ## 特性 - 无服务器部署 -- 多平台部署支持(Cloudflare Workers, Vercel, Render[...](doc/cn/DEPLOY.md)) +- 多平台部署支持(Cloudflare Workers, Vercel, Render[...](doc/cn/PLATFORM.md)) - 适配多种AI服务商(OpenAI, Azure OpenAI, Cloudflare AI, Cohere, Anthropic, Mistral...) - 自定义指令(可以实现快速切换模型,切换机器人预设) - 支持多个Telegram机器人 diff --git a/doc/cn/CONFIG.md b/doc/cn/CONFIG.md index b2f8a812..20260761 100644 --- a/doc/cn/CONFIG.md +++ b/doc/cn/CONFIG.md @@ -2,17 +2,17 @@ 推荐在Workers配置界面填写环境变量, 而不是直接修改js代码中的变量 -### KV配置 +## KV配置 | KEY | 特殊说明 | |:---------|--------------------------------------| | DATABASE | 先新建KV,新建的时候名字随意,然后绑定的时候必须设定为DATABASE | -### 系统配置 +## 系统配置 为每个用户通用的配置,只能在Workers配置界面或者toml中配置填写,不支持通过Telegram发送消息来修改。 -#### 基础配置 +### 基础配置 | KEY | 名称 | 默认值 | 描述 | |---------------------------|-----------|----------|-----------------| @@ -20,7 +20,7 @@ | UPDATE_BRANCH | 更新分支 | `master` | 检查更新的分支 | | CHAT_COMPLETE_API_TIMEOUT | 聊天完成API超时 | `0` | AI对话API的超时时间(秒) | -#### Telegram相关 +### Telegram配置 | KEY | 名称 | 默认值 | 描述 | |---------------------------|----------------|-----------------------------|-----------------------------------------| @@ -41,7 +41,7 @@ > IMPORTANT: 必须在botfather中设置`/setprivacy`为`Disable`,否则机器人无法响应`@机器人`的聊天消息。 -#### 历史记录相关 +### 历史记录配置 | KEY | 名称 | 默认值 | 描述 | |--------------------|----------|--------|--------------------| @@ -49,7 +49,7 @@ | MAX_HISTORY_LENGTH | 最大历史记录长度 | `20` | 保留的最大历史记录条数 | | MAX_TOKEN_LENGTH | 最大令牌长度 | `2048` | 历史记录的最大令牌长度 | -#### 特性开关 +### 特性开关 | KEY | 名称 | 默认值 | 描述 | |-------------------------|----------|---------|-----------------| @@ -61,11 +61,11 @@ | DEBUG_MODE | 调试模式 | `false` | 开启后会保存最新一条消息 | | DEV_MODE | 开发模式 | `false` | 开启后会展示更多调试信息 | -### 用户配置 +## 用户配置 每个用户的自定义配置,只能通过Telegram发送消息来修改,消息格式为`/setenv KEY=VALUE`, 用户配置的优先级比系统配置的更高。如果想删除配置,请使用`/delenv KEY`。 批量设置变量请使用`/setenvs {"KEY1": "VALUE1", "KEY2": "VALUE2"}` -#### 通用配置 +### 通用配置 | KEY | 名称 | 默认值 | 描述 | |--------------------------|-------------|-------------|------------------------------------------------------------------------| @@ -74,7 +74,7 @@ | SYSTEM_INIT_MESSAGE | 全局默认初始化消息 | `你是一个得力的助手` | 根据绑定的语言自动选择默认值 | | SYSTEM_INIT_MESSAGE_ROLE | 全局默认初始化消息角色 | `system` | | -#### OpenAI +### OpenAI | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -87,7 +87,11 @@ | DALL_E_IMAGE_QUALITY | DALL-E图片质量 | `standard` | | DALL_E_IMAGE_STYLE | DALL-E图片风格 | `vivid` | -#### Azure OpenAI +### Azure OpenAI + +> AZURE_COMPLETIONS_API `https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/chat/completions?api-version=VERSION_NAME` + +> AZURE_DALLE_API `https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/images/generations?api-version=VERSION_NAME` | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -95,7 +99,8 @@ | AZURE_COMPLETIONS_API | Azure Completions API | `null` | | AZURE_DALLE_API | Azure DallE API | `null` | -#### Workers + +### Workers | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -104,7 +109,7 @@ | WORKERS_CHAT_MODEL | Text Generation Model | `@cf/mistral/mistral-7b-instruct-v0.1 ` | | WORKERS_IMAGE_MODEL | Text-to-Image Model | `@cf/stabilityai/stable-diffusion-xl-base-1.0` | -#### Gemini +### Gemini cloudflare workers 暂时不支持访问 @@ -114,7 +119,7 @@ cloudflare workers 暂时不支持访问 | GOOGLE_COMPLETIONS_API | Google Gemini API | `https://generativelanguage.googleapis.com/v1beta/models/` | | GOOGLE_COMPLETIONS_MODEL | Google Gemini Model | `gemini-pro` | -#### Mistral +### Mistral | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -122,7 +127,7 @@ cloudflare workers 暂时不支持访问 | MISTRAL_API_BASE | Mistral API Base | `https://api.mistral.ai/v1` | | MISTRAL_CHAT_MODEL | Mistral API Model | `mistral-tiny` | -#### Cohere +### Cohere | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -130,7 +135,7 @@ cloudflare workers 暂时不支持访问 | COHERE_API_BASE | Cohere API Base | `https://api.cohere.com/v1` | | COHERE_CHAT_MODEL | Cohere API Model | `command-r-plus` | -#### Anthropic +### Anthropic | KEY | 名称 | 默认值 | |--------------------------|-------------------------|------------------------------------------------------------| @@ -138,7 +143,7 @@ cloudflare workers 暂时不支持访问 | ANTHROPIC_API_BASE | Anthropic API Base | `https://api.anthropic.com/v1` | | ANTHROPIC_CHAT_MODEL | Anthropic API Model | `claude-3-haiku-20240307` | -### 支持命令 +## 支持命令 | 命令 | 说明 | 示例 | |:-----------|:--------------------------|:------------------------------------------------| @@ -154,7 +159,7 @@ cloudflare workers 暂时不支持访问 | `/redo` | 修改上一个提问或者换一个回答 | `/redo 修改过的内容` 或者 `/redo` | | `/echo` | 回显消息,仅开发模式可用 | `/echo` | -### 自定义命令 +## 自定义命令 除了上述系统定义的指令,你也可以自定义快捷指令, 可以将某些较长的指令简化为一个单词的指令。 @@ -180,7 +185,7 @@ CUSTOM_COMMAND_gpt4 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": " CUSTOM_COMMAND_cn2en = '/setenvs {"SYSTEM_INIT_MESSAGE": "你是一个翻译下面将我说的话都翻译成英文"}' ``` -### 为自定义指令添加帮助信息 +## 自定义指令帮助信息 如果你想为自定义指令添加帮助信息,可以使用环境变量设置 `COMMAND_DESCRIPTION_XXX`,其中`XXX`为指令名,比如`COMMAND_DESCRIPTION_azure`,值为指令描述,比如`切换AI提供商为Azure`。 这样就可以使用`/help`查看到自定义指令的帮助信息。 diff --git a/doc/en/CONFIG.md b/doc/en/CONFIG.md index 89eb4218..f68cb35a 100644 --- a/doc/en/CONFIG.md +++ b/doc/en/CONFIG.md @@ -2,17 +2,17 @@ It is recommended to fill in environment variables in the Workers configuration interface instead of directly modifying variables in the JS code. -### KV configuration +## KV configuration | KEY | Description | |:---------|-------------------------------------------------------------------------------------------------------------------| | DATABASE | First, create a KV. When creating it, the name can be arbitrary, but when binding it, it must be set as DATABASE. | -### System Configuration +## System Configuration The configuration that is common to each user can only be configured and filled in through the Workers configuration interface or toml, and it is not supported to modify it by sending messages through Telegram. -#### Basic configuration +### Basic configuration | KEY | Name | Default | Description | |---------------------------|---------------------------|----------|-------------------------------------------| @@ -20,7 +20,7 @@ The configuration that is common to each user can only be configured and filled | UPDATE_BRANCH | Update branch | `master` | Check the branch for updates | | CHAT_COMPLETE_API_TIMEOUT | Chat complete API timeout | `0` | Timeout for AI conversation API (seconds) | -#### Telegram configuration +### Telegram configuration | KEY | Name | Default | Description | |---------------------------|--------------------------------|--------------------------------------------|---------------------------------------------------------------------------------------------------------------| @@ -41,7 +41,7 @@ The configuration that is common to each user can only be configured and filled > IMPORTANT: You must set `/setprivacy` to `Disable` in botfather, otherwise the bot will not respond to chat messages with `@bot`. -#### History configuration +### History configuration | KEY | Name | Default | Description | |--------------------|---------------------------------------|---------|---------------------------------------------------------------| @@ -49,7 +49,7 @@ The configuration that is common to each user can only be configured and filled | MAX_HISTORY_LENGTH | Maximum length of message history | `20` | Maximum number of message history entries to keep | | MAX_TOKEN_LENGTH | Maximum token length | `2048` | Maximum token length for message history | -#### Feature configuration +### Feature configuration | KEY | Name | Default | Description | |-----------------------|-------------------------|---------|-------------------------------------------------------------| @@ -61,11 +61,11 @@ The configuration that is common to each user can only be configured and filled | DEBUG_MODE | Debug mode | `false` | When enabled, the latest message will be saved | | DEV_MODE | Development mode | `false` | When enabled, more debugging information will be displayed | -### User configuration +## User configuration Each user's custom configuration can only be modified by sending a message through Telegram. The message format is `/setenv KEY=VALUE`. User configurations have a higher priority than system configurations. If you want to delete a configuration, please use `/delenv KEY`. To set variables in batches, please use `/setenvs {"KEY1": "VALUE1", "KEY2": "VALUE2"}`. -#### General configuration +### General configuration | KEY | Name | Default | Description | |--------------------------|--------------------------------------|-------------------------------|----------------------------------------------------------------------------| @@ -74,7 +74,7 @@ Each user's custom configuration can only be modified by sending a message throu | SYSTEM_INIT_MESSAGE | Default initialization message. | `You are a helpful assistant` | Automatically select default values based on the bound language. | | SYSTEM_INIT_MESSAGE_ROLE | Default initialization message role. | `system` | | -#### OpenAI +### OpenAI | KEY | Name | Default | |-------------------------|-------------------------|-----------------------------| @@ -87,7 +87,11 @@ Each user's custom configuration can only be modified by sending a message throu | DALL_E_IMAGE_QUALITY | DALL-E Image quality | `standard` | | DALL_E_IMAGE_STYLE | DALL-E Image style | `vivid` | -#### Azure OpenAI +### Azure OpenAI + +> AZURE_COMPLETIONS_API `https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/chat/completions?api-version=VERSION_NAME` + +> AZURE_DALLE_API `https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/images/generations?api-version=VERSION_NAME` | KEY | Name | Default | |-----------------------|-----------------------|---------| @@ -95,7 +99,7 @@ Each user's custom configuration can only be modified by sending a message throu | AZURE_COMPLETIONS_API | Azure Completions API | `null` | | AZURE_DALLE_API | Azure DallE API | `null` | -#### Workers +### Workers | KEY | Name | Default | |-----------------------|-----------------------|------------------------------------------------| @@ -104,7 +108,7 @@ Each user's custom configuration can only be modified by sending a message throu | WORKERS_CHAT_MODEL | Text Generation Model | `@cf/mistral/mistral-7b-instruct-v0.1 ` | | WORKERS_IMAGE_MODEL | Text-to-Image Model | `@cf/stabilityai/stable-diffusion-xl-base-1.0` | -#### Gemini +### Gemini | KEY | Name | Default | |--------------------------|-----------------------|------------------------------------------------------------| @@ -114,7 +118,7 @@ Each user's custom configuration can only be modified by sending a message throu > Cloudflare Workers currently do not support accessing Gemini. -#### Mistral +### Mistral | KEY | Name | Default | |--------------------|-------------------|-----------------------------| @@ -122,7 +126,7 @@ Each user's custom configuration can only be modified by sending a message throu | MISTRAL_API_BASE | Mistral API Base | `https://api.mistral.ai/v1` | | MISTRAL_CHAT_MODEL | Mistral API Model | `mistral-tiny` | -#### Cohere +### Cohere | KEY | Name | Default | |-------------------|------------------|-----------------------------| @@ -130,7 +134,7 @@ Each user's custom configuration can only be modified by sending a message throu | COHERE_API_BASE | Cohere API Base | `https://api.cohere.com/v1` | | COHERE_CHAT_MODEL | Cohere API Model | `command-r-plus` | -#### Anthropic +### Anthropic | KEY | Name | Default | |----------------------|---------------------|--------------------------------| @@ -138,7 +142,7 @@ Each user's custom configuration can only be modified by sending a message throu | ANTHROPIC_API_BASE | Anthropic API Base | `https://api.anthropic.com/v1` | | ANTHROPIC_CHAT_MODEL | Anthropic API Model | `claude-3-haiku-20240307` | -### Command +## Command | Command | Description | Example | |:-----------|:------------------------------------------------------------------------|:------------------------------------------------| @@ -154,7 +158,7 @@ Each user's custom configuration can only be modified by sending a message throu | `/redo` | Edit the previous question or provide a different answer. | `/redo Modified content.` or `/redo` | | `/echo` | Echo message, only available in development mode. | `/echo` | -### Custom command. +## Custom command In addition to the commands defined by the system, you can also customize shortcut commands, which can simplify some longer commands into a single word command. @@ -180,8 +184,7 @@ CUSTOM_COMMAND_gpt4 = '/setenvs {"AI_PROVIDER": "openai", "OPENAI_CHAT_MODEL": " CUSTOM_COMMAND_cn2en = '/setenvs {"SYSTEM_INIT_MESSAGE": "You are a translator. Please translate everything I say below into English."}' ``` - -### Add help information for custom commands. +## Custom commands description If you want to add help information for a custom command, you can use environment variables to set `COMMAND_DESCRIPTION_XXX`, where `XXX` is the name of the command, such as `COMMAND_DESCRIPTION_azure`, and the value is the description of the command, such as `Switch AI provider to Azure`. This way, you can use `/help` to view the help information for the custom command. diff --git a/src/config/env.js b/src/config/env.js index 9b8cc669..4cbae25c 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -47,8 +47,10 @@ export class UserConfig { // Azure API Key AZURE_API_KEY = null; // Azure Completions API + // https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/chat/completions?api-version=VERSION_NAME AZURE_COMPLETIONS_API = null; // Azure DallE API + // https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/images/generations?api-version=VERSION_NAME AZURE_DALLE_API = null; // -- Workers 配置 -- diff --git a/wrangler-example.toml b/wrangler-example.toml index 0849ff1a..7c9cb243 100644 --- a/wrangler-example.toml +++ b/wrangler-example.toml @@ -126,8 +126,10 @@ OPENAI_API_KEY = 'SK-1,SK-2' ## Azure API Key #AZURE_API_KEY = '' ## Azure Completions API +## https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/chat/completions?api-version=VERSION_NAME #AZURE_COMPLETIONS_API = '' ## Azure DallE API +## https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/images/generations?api-version=VERSION_NAME #AZURE_DALLE_API = '' ## -- Workers 配置 -- From 5402ef88c5abeec17c587c3a7bd8997a62e1a2fd Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 10:43:46 +0800 Subject: [PATCH 07/17] =?UTF-8?q?chore:=20=E8=AE=BE=E7=BD=AEi18n=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/i18n/index.js b/src/i18n/index.js index d1af83b8..f1f15a88 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -22,5 +22,7 @@ export default function i18n(lang) { case 'en': case 'en-us': return en; + default: + return en; } } From 907a6e9f4000a84d5e458f83b03cd5ff8cf3e862 Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 10:54:58 +0800 Subject: [PATCH 08/17] doc: fix deploy document --- doc/cn/DEPLOY.md | 2 +- doc/en/DEPLOY.md | 2 +- package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/cn/DEPLOY.md b/doc/cn/DEPLOY.md index 8788c1df..60aa1a65 100644 --- a/doc/cn/DEPLOY.md +++ b/doc/cn/DEPLOY.md @@ -72,4 +72,4 @@ 1. 手动部署的一, 二, 三 步骤 2. `mv wrangler-example.toml wrangler.toml`, 然后修改相应配置 3. `npm install` -4. `npm run deploy` +4. `npm run deploy:build` diff --git a/doc/en/DEPLOY.md b/doc/en/DEPLOY.md index cd545727..7ae7b964 100644 --- a/doc/en/DEPLOY.md +++ b/doc/en/DEPLOY.md @@ -68,4 +68,4 @@ Thanks to [**lipeng0820**](https://www.youtube.com/@lipeng0820) for providing th 1. Steps one, two, and three are for manual deployment. 2. Run `mv wrangler-example.toml wrangler.toml` and modify the corresponding configuration. 3. Run `npm install`. -4. Run `npm run deploy`. \ No newline at end of file +4. Run `npm run deploy:build`. diff --git a/package.json b/package.json index d721281a..6ab39b52 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "build": "make build", "debug": "wrangler dev --local", "wrangler": "wrangler", - "deploy:dist": "wrangler deploy", - "deploy:build": "npm run build && wrangler deploy" + "deploy:dist": "wrangler publish", + "deploy:build": "npm run build && wrangler publish" }, "devDependencies": { "@eslint/js": "^9.1.1", From 72c832012effaa9c7eea729710b59a159b83c077 Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 11:05:00 +0800 Subject: [PATCH 09/17] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9wrangler?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6ab39b52..d721281a 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "build": "make build", "debug": "wrangler dev --local", "wrangler": "wrangler", - "deploy:dist": "wrangler publish", - "deploy:build": "npm run build && wrangler publish" + "deploy:dist": "wrangler deploy", + "deploy:build": "npm run build && wrangler deploy" }, "devDependencies": { "@eslint/js": "^9.1.1", From 8beec3c69770db50ed23798554968a93c0f78950 Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 11:11:53 +0800 Subject: [PATCH 10/17] =?UTF-8?q?perf:=20=E5=88=A4=E6=96=ADsetenv=E6=97=B6?= =?UTF-8?q?key=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/telegram/command.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/telegram/command.js b/src/telegram/command.js index f5ce5ac1..80515555 100644 --- a/src/telegram/command.js +++ b/src/telegram/command.js @@ -193,6 +193,9 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } + if (!Object.keys(context.USER_CONFIG).includes(key)) { + return sendMessageToTelegramWithContext(context)(`Key ${key} not found`); + } try { context.USER_CONFIG.DEFINE_KEYS.push(key); context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); @@ -222,11 +225,15 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { async function commandUpdateUserConfigs(message, command, subcommand, context) { try { const values = JSON.parse(subcommand); + const configKeys = Object.keys(context.USER_CONFIG); for (const ent of Object.entries(values)) { const [key, value] = ent; if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } + if (!configKeys.includes(key)) { + return sendMessageToTelegramWithContext(context)(`Key ${key} not found`); + } context.USER_CONFIG.DEFINE_KEYS.push(key); mergeEnvironment(context.USER_CONFIG, { [key]: value, From 327b96f6bdc5e4b1e5e00e8913e597810b6da17b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio?= Date: Tue, 23 Jul 2024 00:24:51 -0300 Subject: [PATCH 11/17] Add Portuguese language support to i18n module --- src/i18n/index.js | 4 ++++ src/i18n/pt.js | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 src/i18n/pt.js diff --git a/src/i18n/index.js b/src/i18n/index.js index f1f15a88..d670f982 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -1,5 +1,6 @@ import zhHans from './zh-hans.js'; import zhHant from './zh-hant.js'; +import pt from './pt.js'; import en from './en.js'; import '../types/i18n.js'; @@ -19,6 +20,9 @@ export default function i18n(lang) { case 'zh-mo': case 'zh-hant': return zhHant; + case 'pt': + case 'pt-br': + return pt; case 'en': case 'en-us': return en; diff --git a/src/i18n/pt.js b/src/i18n/pt.js new file mode 100644 index 00000000..1f7e2404 --- /dev/null +++ b/src/i18n/pt.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +export default {"env":{"system_init_message":"Você é um assistente útil"},"command":{"help":{"summary":"Os seguintes comandos são suportados atualmente:\n","help":"Obter ajuda sobre comandos","new":"Iniciar uma nova conversa","start":"Obter seu ID e iniciar uma nova conversa","img":"Gerar uma imagem, o formato completo do comando é `/img descrição da imagem`, por exemplo `/img praia ao luar`","version":"Obter o número da versão atual para determinar se é necessário atualizar","setenv":"Definir configuração do usuário, o formato completo do comando é /setenv CHAVE=VALOR","setenvs":"Definir configurações do usuário em lote, o formato completo do comando é /setenvs {\"CHAVE1\": \"VALOR1\", \"CHAVE2\": \"VALOR2\"}","delenv":"Excluir configuração do usuário, o formato completo do comando é /delenv CHAVE","clearenv":"Limpar todas as configurações do usuário","system":"Ver algumas informações do sistema","redo":"Refazer a última conversa, /redo com conteúdo modificado ou diretamente /redo","echo":"Repetir a mensagem"},"new":{"new_chat_start":"Uma nova conversa foi iniciada"}}} From ae6d59419ec0de06c2ef73555b83dcf7780a11d5 Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 23 Jul 2024 16:53:09 +0800 Subject: [PATCH 12/17] doc: fix config document --- doc/cn/CONFIG.md | 48 +++++++++++++++++++++++++----------------------- doc/en/CONFIG.md | 32 +++++++++++++++++--------------- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/doc/cn/CONFIG.md b/doc/cn/CONFIG.md index 20260761..0c7845eb 100644 --- a/doc/cn/CONFIG.md +++ b/doc/cn/CONFIG.md @@ -12,6 +12,8 @@ 为每个用户通用的配置,只能在Workers配置界面或者toml中配置填写,不支持通过Telegram发送消息来修改。 +数组为空字符串,表示没有设置值,如果需要设置值,设置为`'value1,value2'`,多个值用逗号分隔。 + ### 基础配置 | KEY | 名称 | 默认值 | 描述 | @@ -25,13 +27,13 @@ | KEY | 名称 | 默认值 | 描述 | |---------------------------|----------------|-----------------------------|-----------------------------------------| | TELEGRAM_API_DOMAIN | Telegram API域名 | `https://api.telegram.org/` | Telegram API的域名 | -| TELEGRAM_AVAILABLE_TOKENS | 可用的Telegram令牌 | `[]` | 允许访问的Telegram Token,设置时以逗号分隔 | +| TELEGRAM_AVAILABLE_TOKENS | 可用的Telegram令牌 | `''//()` | 允许访问的Telegram Token,设置时以逗号分隔 | | DEFAULT_PARSE_MODE | 默认解析模式 | `Markdown` | 默认消息解析模式 | | I_AM_A_GENEROUS_PERSON | 允许所有人使用 | `false` | 是否允许所有人使用 | -| CHAT_WHITE_LIST | 聊天白名单 | `[] ` | 允许使用的聊天ID白名单 | +| CHAT_WHITE_LIST | 聊天白名单 | `''//(array string)` | 允许使用的聊天ID白名单 | | LOCK_USER_CONFIG_KEYS | 锁定的用户配置键 | 默认值为所有API的URL | 防止被替换导致token泄露的配置键 | -| TELEGRAM_BOT_NAME | Telegram机器人名称 | `[]` | 允许访问的Telegram Token对应的Bot Name,设置时以逗号分隔 | -| CHAT_GROUP_WHITE_LIST | 群组白名单 | `[]` | 允许使用的群组ID白名单 | +| TELEGRAM_BOT_NAME | Telegram机器人名称 | `''//(array string)` | 允许访问的Telegram Token对应的Bot Name,设置时以逗号分隔 | +| CHAT_GROUP_WHITE_LIST | 群组白名单 | `''//(array string)` | 允许使用的群组ID白名单 | | GROUP_CHAT_BOT_ENABLE | 群组机器人开关 | `true` | 是否启用群组机器人 | | GROUP_CHAT_BOT_SHARE_MODE | 群组机器人共享模式 | `false` | 开启后同个群组的人使用同一个聊天上下文 | @@ -51,15 +53,15 @@ ### 特性开关 -| KEY | 名称 | 默认值 | 描述 | -|-------------------------|----------|---------|-----------------| -| HIDE_COMMAND_BUTTONS | 隐藏命令按钮 | `[]` | 修改后需要重新init | -| SHOW_REPLY_BUTTON | 显示快捷回复按钮 | `false` | 是否显示快捷回复按钮 | -| EXTRA_MESSAGE_CONTEXT | 额外消息上下文 | `false` | 引用的消息也会假如上下文 | -| STREAM_MODE | 流模式 | `true` | 打字机模式 | -| SAFE_MODE | 安全模式 | `true` | 开启后会保存最新一条消息的ID | -| DEBUG_MODE | 调试模式 | `false` | 开启后会保存最新一条消息 | -| DEV_MODE | 开发模式 | `false` | 开启后会展示更多调试信息 | +| KEY | 名称 | 默认值 | 描述 | +|-----------------------|----------|----------------------|-----------------| +| HIDE_COMMAND_BUTTONS | 隐藏命令按钮 | `''//(array string)` | 修改后需要重新init | +| SHOW_REPLY_BUTTON | 显示快捷回复按钮 | `false` | 是否显示快捷回复按钮 | +| EXTRA_MESSAGE_CONTEXT | 额外消息上下文 | `false` | 引用的消息也会假如上下文 | +| STREAM_MODE | 流模式 | `true` | 打字机模式 | +| SAFE_MODE | 安全模式 | `true` | 开启后会保存最新一条消息的ID | +| DEBUG_MODE | 调试模式 | `false` | 开启后会保存最新一条消息 | +| DEV_MODE | 开发模式 | `false` | 开启后会展示更多调试信息 | ## 用户配置 @@ -76,16 +78,16 @@ ### OpenAI -| KEY | 名称 | 默认值 | -|--------------------------|-------------------------|------------------------------------------------------------| -| OPENAI_API_KEY | OpenAI API Key | `[]` | -| OPENAI_CHAT_MODEL | OpenAI的模型名称 | `gpt-3.5-turbo` | -| OPENAI_API_BASE | OpenAI API BASE | `https://api.openai.com/v1` | -| OPENAI_API_EXTRA_PARAMS | OpenAI API Extra Params | {} | -| DALL_E_MODEL | DALL-E的模型名称 | `dall-e-2` | -| DALL_E_IMAGE_SIZE | DALL-E图片尺寸 | `512x512` | -| DALL_E_IMAGE_QUALITY | DALL-E图片质量 | `standard` | -| DALL_E_IMAGE_STYLE | DALL-E图片风格 | `vivid` | +| KEY | 名称 | 默认值 | +|-------------------------|-------------------------|-----------------------------| +| OPENAI_API_KEY | OpenAI API Key | `''//(array string)` | +| OPENAI_CHAT_MODEL | OpenAI的模型名称 | `gpt-3.5-turbo` | +| OPENAI_API_BASE | OpenAI API BASE | `https://api.openai.com/v1` | +| OPENAI_API_EXTRA_PARAMS | OpenAI API Extra Params | `{}` | +| DALL_E_MODEL | DALL-E的模型名称 | `dall-e-2` | +| DALL_E_IMAGE_SIZE | DALL-E图片尺寸 | `512x512` | +| DALL_E_IMAGE_QUALITY | DALL-E图片质量 | `standard` | +| DALL_E_IMAGE_STYLE | DALL-E图片风格 | `vivid` | ### Azure OpenAI diff --git a/doc/en/CONFIG.md b/doc/en/CONFIG.md index f68cb35a..4c2246c2 100644 --- a/doc/en/CONFIG.md +++ b/doc/en/CONFIG.md @@ -12,6 +12,8 @@ It is recommended to fill in environment variables in the Workers configuration The configuration that is common to each user can only be configured and filled in through the Workers configuration interface or toml, and it is not supported to modify it by sending messages through Telegram. +An empty string in the array indicates that no value has been set. If a value needs to be set, it should be set as `'value1,value2'`, with multiple values separated by commas. + ### Basic configuration | KEY | Name | Default | Description | @@ -25,13 +27,13 @@ The configuration that is common to each user can only be configured and filled | KEY | Name | Default | Description | |---------------------------|--------------------------------|--------------------------------------------|---------------------------------------------------------------------------------------------------------------| | TELEGRAM_API_DOMAIN | Telegram API Domain | `https://api.telegram.org/` | Telegram API domain | -| TELEGRAM_AVAILABLE_TOKENS | Available Telegram tokens. | `[]` | Telegram Tokens allowed to access, separated by commas when setting. | +| TELEGRAM_AVAILABLE_TOKENS | Available Telegram tokens. | `''//(array string)` | Telegram Tokens allowed to access, separated by commas when setting. | | DEFAULT_PARSE_MODE | Default parsing mode. | `Markdown` | Default message parsing mode. | | I_AM_A_GENEROUS_PERSON | Allow everyone to use. | `false` | Is it allowed for everyone to use? | -| CHAT_WHITE_LIST | Chat whitelist | `[] ` | Allowed Chat ID Whitelist | +| CHAT_WHITE_LIST | Chat whitelist | `''//(array string)` | Allowed Chat ID Whitelist | | LOCK_USER_CONFIG_KEYS | Locked user configuration key. | The default value is the URL for all APIs. | Configuration key to prevent token leakage caused by replacement. | -| TELEGRAM_BOT_NAME | Telegram bot name | `[]` | The Bot Name corresponding to the Telegram Token that is allowed to access, separated by commas when setting. | -| CHAT_GROUP_WHITE_LIST | Group whitelist | `[]` | Allowed group ID whitelist. | +| TELEGRAM_BOT_NAME | Telegram bot name | `''//(array string)` | The Bot Name corresponding to the Telegram Token that is allowed to access, separated by commas when setting. | +| CHAT_GROUP_WHITE_LIST | Group whitelist | `''//(array string)` | Allowed group ID whitelist. | | GROUP_CHAT_BOT_ENABLE | Whether to enable group bots. | `true` | Whether to enable group robots. | | GROUP_CHAT_BOT_SHARE_MODE | Group robot sharing mode | `false` | After opening, people in the same group use the same chat context. | @@ -51,15 +53,15 @@ The configuration that is common to each user can only be configured and filled ### Feature configuration -| KEY | Name | Default | Description | -|-----------------------|-------------------------|---------|-------------------------------------------------------------| -| HIDE_COMMAND_BUTTONS | Hide command buttons | `[]` | Need to re-initiate after modification | -| SHOW_REPLY_BUTTON | Show quick reply button | `false` | Whether to display the quick reply button | -| EXTRA_MESSAGE_CONTEXT | Extra message context | `false` | The referenced message will also be included in the context | -| STREAM_MODE | Stream mode | `true` | Typewriter mode | -| SAFE_MODE | Safe mode | `true` | When enabled, the ID of the latest message will be saved | -| DEBUG_MODE | Debug mode | `false` | When enabled, the latest message will be saved | -| DEV_MODE | Development mode | `false` | When enabled, more debugging information will be displayed | +| KEY | Name | Default | Description | +|-----------------------|-------------------------|----------------------------|-------------------------------------------------------------| +| HIDE_COMMAND_BUTTONS | Hide command buttons | `''//(array string)` | Need to re-initiate after modification | +| SHOW_REPLY_BUTTON | Show quick reply button | `false` | Whether to display the quick reply button | +| EXTRA_MESSAGE_CONTEXT | Extra message context | `false` | The referenced message will also be included in the context | +| STREAM_MODE | Stream mode | `true` | Typewriter mode | +| SAFE_MODE | Safe mode | `true` | When enabled, the ID of the latest message will be saved | +| DEBUG_MODE | Debug mode | `false` | When enabled, the latest message will be saved | +| DEV_MODE | Development mode | `false` | When enabled, more debugging information will be displayed | ## User configuration @@ -78,10 +80,10 @@ Each user's custom configuration can only be modified by sending a message throu | KEY | Name | Default | |-------------------------|-------------------------|-----------------------------| -| OPENAI_API_KEY | OpenAI API Key | `[]` | +| OPENAI_API_KEY | OpenAI API Key | `''//(array string)` | | OPENAI_CHAT_MODEL | OpenAI Model | `gpt-3.5-turbo` | | OPENAI_API_BASE | OpenAI API BASE | `https://api.openai.com/v1` | -| OPENAI_API_EXTRA_PARAMS | OpenAI API Extra Params | {} | +| OPENAI_API_EXTRA_PARAMS | OpenAI API Extra Params | `{}` | | DALL_E_MODEL | DALL-E model name. | `dall-e-2` | | DALL_E_IMAGE_SIZE | DALL-E Image size | `512x512` | | DALL_E_IMAGE_QUALITY | DALL-E Image quality | `standard` | From d13af8eb512ed3d6ea25f9c9c95fb8b1bdda8812 Mon Sep 17 00:00:00 2001 From: tbxark Date: Fri, 26 Jul 2024 14:50:17 +0800 Subject: [PATCH 13/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddocker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapter/docker/Dockerfile | 1 - adapter/docker/index.js | 51 +++++++++++++++++++++++++++++++++++---- doc/en/CONFIG.md | 16 ++++++------ 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/adapter/docker/Dockerfile b/adapter/docker/Dockerfile index c587a47c..5c4fce54 100644 --- a/adapter/docker/Dockerfile +++ b/adapter/docker/Dockerfile @@ -4,7 +4,6 @@ WORKDIR /app COPY package*.json index.js ./ RUN npm install RUN apt-get update && apt-get install -y sqlite3 -ENV DOMAIN "http://localhost" VOLUME /app/config EXPOSE 8787 diff --git a/adapter/docker/index.js b/adapter/docker/index.js index 928cbaca..d2d5c4f2 100644 --- a/adapter/docker/index.js +++ b/adapter/docker/index.js @@ -1,14 +1,55 @@ import adapter from 'cloudflare-worker-adapter'; -import {SqliteCache} from 'cloudflare-worker-adapter/cache/sqlite.js'; -import worker from 'cloudflare-worker-adapter'; +import {MemoryCache} from 'cloudflare-worker-adapter/cache/memory.js'; +import {default as worker} from '../../main.js'; + + +const config = JSON.parse(fs.readFileSync('./config/config.json', 'utf-8')); + +// 配置数据库 +let cache = new MemoryCache(); +switch (config?.database?.type) { + case 'local': + // eslint-disable-next-line no-case-declarations + const {LocalCache} = await import('cloudflare-worker-adapter/cache/local.js'); + cache = new LocalCache(config.database.uri); + break; + case 'sqlite': + // eslint-disable-next-line no-case-declarations + const {SqliteCache} = await import('cloudflare-worker-adapter/cache/sqlite.js'); + cache = new SqliteCache(config.database.uri); + break; + case 'redis': + // eslint-disable-next-line no-case-declarations + const {RedisCache} = await import('cloudflare-worker-adapter/cache/redis.js'); + cache = new RedisCache(config.database.uri); + break; + default: + // eslint-disable-next-line no-case-declarations + const {MemoryCache} = await import('cloudflare-worker-adapter/cache/memory.js'); + cache = new MemoryCache(); + break; +} + +console.log(`database: ${config?.database?.type} is ready`); + +const proxy = config.https_proxy || process.env.https_proxy || process.env.HTTPS_PROXY; +if (proxy) { + console.log(`https proxy: ${proxy}`); + const agent = new HttpsProxyAgent(proxy); + const proxyFetch = async (url, init) => { + return fetch(url, {agent, ...init}); + }; + bindGlobal({ + fetch: proxyFetch, + }); +} -const cache = new SqliteCache('./config/cache.sqlite'); adapter.startServer( 8787, - 'localhost', + '127.0.0.1', './config/config.toml', {DATABASE: cache}, - {server: process.env.DOMAIN}, + {server: config.server}, worker.fetch, ); diff --git a/doc/en/CONFIG.md b/doc/en/CONFIG.md index 4c2246c2..95abe920 100644 --- a/doc/en/CONFIG.md +++ b/doc/en/CONFIG.md @@ -53,15 +53,15 @@ An empty string in the array indicates that no value has been set. If a value ne ### Feature configuration -| KEY | Name | Default | Description | -|-----------------------|-------------------------|----------------------------|-------------------------------------------------------------| +| KEY | Name | Default | Description | +|-----------------------|-------------------------|----------------------|-------------------------------------------------------------| | HIDE_COMMAND_BUTTONS | Hide command buttons | `''//(array string)` | Need to re-initiate after modification | -| SHOW_REPLY_BUTTON | Show quick reply button | `false` | Whether to display the quick reply button | -| EXTRA_MESSAGE_CONTEXT | Extra message context | `false` | The referenced message will also be included in the context | -| STREAM_MODE | Stream mode | `true` | Typewriter mode | -| SAFE_MODE | Safe mode | `true` | When enabled, the ID of the latest message will be saved | -| DEBUG_MODE | Debug mode | `false` | When enabled, the latest message will be saved | -| DEV_MODE | Development mode | `false` | When enabled, more debugging information will be displayed | +| SHOW_REPLY_BUTTON | Show quick reply button | `false` | Whether to display the quick reply button | +| EXTRA_MESSAGE_CONTEXT | Extra message context | `false` | The referenced message will also be included in the context | +| STREAM_MODE | Stream mode | `true` | Typewriter mode | +| SAFE_MODE | Safe mode | `true` | When enabled, the ID of the latest message will be saved | +| DEBUG_MODE | Debug mode | `false` | When enabled, the latest message will be saved | +| DEV_MODE | Development mode | `false` | When enabled, more debugging information will be displayed | ## User configuration From 4c39e175aa8b8c34c9a5eff9f94e15c195af9a87 Mon Sep 17 00:00:00 2001 From: tbxark Date: Mon, 29 Jul 2024 15:44:44 +0800 Subject: [PATCH 14/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapter/docker/index.js | 16 +------- dist/buildinfo.json | 2 +- dist/index.js | 89 +++++++++++++++++++++++++++++++++------- dist/timestamp | 2 +- eslint.config.js | 7 +++- src/agent/agents.js | 52 ++++++++++++++++++++--- src/agent/anthropic.js | 14 +++---- src/agent/azure.js | 6 +-- src/agent/cohere.js | 18 ++++---- src/agent/gemini.js | 5 +-- src/agent/llm.js | 4 +- src/agent/mistralai.js | 6 +-- src/agent/openai.js | 8 ++-- src/agent/request.js | 22 +++++----- src/agent/stream.js | 30 +++++++------- src/agent/workersai.js | 14 +++---- src/config/context.js | 4 +- src/config/env.js | 23 +++++++---- src/telegram/command.js | 70 +++++++++++++++++++------------ src/telegram/message.js | 2 +- src/telegram/telegram.js | 2 +- 21 files changed, 257 insertions(+), 139 deletions(-) diff --git a/adapter/docker/index.js b/adapter/docker/index.js index d2d5c4f2..ac66b52e 100644 --- a/adapter/docker/index.js +++ b/adapter/docker/index.js @@ -1,12 +1,13 @@ import adapter from 'cloudflare-worker-adapter'; import {MemoryCache} from 'cloudflare-worker-adapter/cache/memory.js'; import {default as worker} from '../../main.js'; +import fs from 'fs'; const config = JSON.parse(fs.readFileSync('./config/config.json', 'utf-8')); // 配置数据库 -let cache = new MemoryCache(); +let cache; switch (config?.database?.type) { case 'local': // eslint-disable-next-line no-case-declarations @@ -32,19 +33,6 @@ switch (config?.database?.type) { console.log(`database: ${config?.database?.type} is ready`); -const proxy = config.https_proxy || process.env.https_proxy || process.env.HTTPS_PROXY; -if (proxy) { - console.log(`https proxy: ${proxy}`); - const agent = new HttpsProxyAgent(proxy); - const proxyFetch = async (url, init) => { - return fetch(url, {agent, ...init}); - }; - bindGlobal({ - fetch: proxyFetch, - }); -} - - adapter.startServer( 8787, '127.0.0.1', diff --git a/dist/buildinfo.json b/dist/buildinfo.json index dd11e247..5b21f7b4 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "8f11aec", "timestamp": 1721639738} +{"sha": "d13af8e", "timestamp": 1722238667} diff --git a/dist/index.js b/dist/index.js index 04ced871..17a18165 100644 --- a/dist/index.js +++ b/dist/index.js @@ -37,8 +37,10 @@ var UserConfig = class { // Azure API Key AZURE_API_KEY = null; // Azure Completions API + // https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/chat/completions?api-version=VERSION_NAME AZURE_COMPLETIONS_API = null; // Azure DallE API + // https://RESOURCE_NAME.openai.azure.com/openai/deployments/MODEL_NAME/images/generations?api-version=VERSION_NAME AZURE_DALLE_API = null; // -- Workers 配置 -- // @@ -87,9 +89,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1721639738; + BUILD_TIMESTAMP = 1722238667; // 当前版本 commit id - BUILD_VERSION = "8f11aec"; + BUILD_VERSION = "d13af8e"; // -- 基础配置 -- /** * @type {I18n | null} @@ -185,6 +187,11 @@ var ENV_TYPES = { COHERE_API_KEY: "string", ANTHROPIC_API_KEY: "string" }; +var ENV_KEY_MAPPER = { + CHAT_MODEL: "OPENAI_CHAT_MODEL", + API_KEY: "OPENAI_API_KEY", + WORKERS_AI_MODEL: "WORKERS_CHAT_MODEL" +}; function parseArray(raw) { if (raw.startsWith("[") && raw.endsWith("]")) { try { @@ -259,12 +266,12 @@ function initEnv(env, i18n2) { } ENV.TELEGRAM_AVAILABLE_TOKENS.push(env.TELEGRAM_TOKEN); } - if (env.WORKERS_AI_MODEL) { - ENV.USER_CONFIG.WORKERS_CHAT_MODEL = env.WORKERS_AI_MODEL; - } if (env.OPENAI_API_DOMAIN && !ENV.OPENAI_API_BASE) { ENV.USER_CONFIG.OPENAI_API_BASE = `${env.OPENAI_API_DOMAIN}/v1`; } + if (env.WORKERS_AI_MODEL && !ENV.USER_CONFIG.WORKERS_CHAT_MODEL) { + ENV.USER_CONFIG.WORKERS_CHAT_MODEL = env.WORKERS_AI_MODEL; + } if (env.API_KEY && ENV.USER_CONFIG.OPENAI_API_KEY.length === 0) { ENV.USER_CONFIG.OPENAI_API_KEY = env.API_KEY.split(","); } @@ -1386,6 +1393,26 @@ function currentChatModel(agentName, context) { return null; } } +function chatModelKey(agentName) { + switch (agentName) { + case "azure": + return "AZURE_CHAT_MODEL"; + case "openai": + return "OPENAI_CHAT_MODEL"; + case "workers": + return "WORKERS_CHAT_MODEL"; + case "gemini": + return "GOOGLE_COMPLETIONS_MODEL"; + case "mistral": + return "MISTRAL_CHAT_MODEL"; + case "cohere": + return "COHERE_CHAT_MODEL"; + case "anthropic": + return "ANTHROPIC_CHAT_MODEL"; + default: + return null; + } +} function loadChatLLM(context) { for (const llm of chatLlmAgents) { if (llm.name === context.USER_CONFIG.AI_PROVIDER) { @@ -1441,6 +1468,18 @@ function currentImageModel(agentName, context) { return null; } } +function imageModelKey(agentName) { + switch (agentName) { + case "azure": + return null; + case "openai": + return "DALL_E_MODEL"; + case "workers": + return "WORKERS_IMAGE_MODEL"; + default: + return null; + } +} // src/agent/llm.js function tokensCounter() { @@ -1708,11 +1747,15 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { if (kv === -1) { return sendMessageToTelegramWithContext(context)(ENV.I18N.command.help.setenv); } - const key = subcommand.slice(0, kv); + let key = subcommand.slice(0, kv); const value = subcommand.slice(kv + 1); + key = ENV_KEY_MAPPER[key] || key; if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } + if (!Object.keys(context.USER_CONFIG).includes(key)) { + return sendMessageToTelegramWithContext(context)(`Key ${key} not found`); + } try { context.USER_CONFIG.DEFINE_KEYS.push(key); context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); @@ -1732,11 +1775,16 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { async function commandUpdateUserConfigs(message, command, subcommand, context) { try { const values = JSON.parse(subcommand); + const configKeys = Object.keys(context.USER_CONFIG); for (const ent of Object.entries(values)) { - const [key, value] = ent; + let [key, value] = ent; + key = ENV_KEY_MAPPER[key] || key; if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } + if (!configKeys.includes(key)) { + return sendMessageToTelegramWithContext(context)(`Key ${key} not found`); + } context.USER_CONFIG.DEFINE_KEYS.push(key); mergeEnvironment(context.USER_CONFIG, { [key]: value @@ -1805,14 +1853,17 @@ Current version: ${current.sha}(${timeFormat(current.ts)})`); async function commandSystem(message, command, subcommand, context) { let chatAgent = loadChatLLM(context)?.name; let imageAgent = loadImageGen(context)?.name; - let chatModel = currentChatModel(chatAgent, context); - let imageModel = currentImageModel(imageAgent, context); - let msg = `AGENT: ${JSON.stringify({ - CHAT_AGENT: chatAgent, - CHAT_MODEL: chatModel, - IMAGE_AGENT: imageAgent, - IMAGE_MODEL: imageModel - }, null, 2)} + const agent = { + AI_PROVIDER: chatAgent, + AI_IMAGE_PROVIDER: imageAgent + }; + if (chatModelKey(chatAgent)) { + agent[chatModelKey(chatAgent)] = currentChatModel(chatAgent, context); + } + if (imageModelKey(imageAgent)) { + agent[imageModelKey(imageAgent)] = currentImageModel(imageAgent, context); + } + let msg = `AGENT: ${JSON.stringify(agent, null, 2)} `; if (ENV.DEV_MODE) { const shareCtx = { ...context.SHARE_CONTEXT }; @@ -2360,6 +2411,9 @@ var zh_hans_default = { "env": { "system_init_message": "\u4F60\u662F\u4E00\u4E2 // src/i18n/zh-hant.js var zh_hant_default = { "env": { "system_init_message": "\u4F60\u662F\u4E00\u500B\u5F97\u529B\u7684\u52A9\u624B" }, "command": { "help": { "summary": "\u7576\u524D\u652F\u6301\u7684\u547D\u4EE4\u5982\u4E0B\uFF1A\n", "help": "\u7372\u53D6\u547D\u4EE4\u5E6B\u52A9", "new": "\u958B\u59CB\u4E00\u500B\u65B0\u5C0D\u8A71", "start": "\u7372\u53D6\u60A8\u7684ID\u4E26\u958B\u59CB\u4E00\u500B\u65B0\u5C0D\u8A71", "img": "\u751F\u6210\u5716\u7247\uFF0C\u5B8C\u6574\u547D\u4EE4\u683C\u5F0F\u70BA`/img \u5716\u7247\u63CF\u8FF0`\uFF0C\u4F8B\u5982`/img \u6D77\u7058\u6708\u5149`", "version": "\u7372\u53D6\u7576\u524D\u7248\u672C\u865F\u78BA\u8A8D\u662F\u5426\u9700\u8981\u66F4\u65B0", "setenv": "\u8A2D\u7F6E\u7528\u6236\u914D\u7F6E\uFF0C\u5B8C\u6574\u547D\u4EE4\u683C\u5F0F\u70BA/setenv KEY=VALUE", "setenvs": '\u6279\u91CF\u8A2D\u7F6E\u7528\u6237\u914D\u7F6E, \u547D\u4EE4\u5B8C\u6574\u683C\u5F0F\u70BA /setenvs {"KEY1": "VALUE1", "KEY2": "VALUE2"}', "delenv": "\u522A\u9664\u7528\u6236\u914D\u7F6E\uFF0C\u5B8C\u6574\u547D\u4EE4\u683C\u5F0F\u70BA/delenv KEY", "clearenv": "\u6E05\u9664\u6240\u6709\u7528\u6236\u914D\u7F6E", "system": "\u67E5\u770B\u4E00\u4E9B\u7CFB\u7D71\u4FE1\u606F", "redo": "\u91CD\u505A\u4E0A\u4E00\u6B21\u7684\u5C0D\u8A71 /redo \u52A0\u4FEE\u6539\u904E\u7684\u5167\u5BB9 \u6216\u8005 \u76F4\u63A5 /redo", "echo": "\u56DE\u663E\u6D88\u606F" }, "new": { "new_chat_start": "\u958B\u59CB\u4E00\u500B\u65B0\u5C0D\u8A71" } } }; +// src/i18n/pt.js +var pt_default = { "env": { "system_init_message": "Voc\xEA \xE9 um assistente \xFAtil" }, "command": { "help": { "summary": "Os seguintes comandos s\xE3o suportados atualmente:\n", "help": "Obter ajuda sobre comandos", "new": "Iniciar uma nova conversa", "start": "Obter seu ID e iniciar uma nova conversa", "img": "Gerar uma imagem, o formato completo do comando \xE9 `/img descri\xE7\xE3o da imagem`, por exemplo `/img praia ao luar`", "version": "Obter o n\xFAmero da vers\xE3o atual para determinar se \xE9 necess\xE1rio atualizar", "setenv": "Definir configura\xE7\xE3o do usu\xE1rio, o formato completo do comando \xE9 /setenv CHAVE=VALOR", "setenvs": 'Definir configura\xE7\xF5es do usu\xE1rio em lote, o formato completo do comando \xE9 /setenvs {"CHAVE1": "VALOR1", "CHAVE2": "VALOR2"}', "delenv": "Excluir configura\xE7\xE3o do usu\xE1rio, o formato completo do comando \xE9 /delenv CHAVE", "clearenv": "Limpar todas as configura\xE7\xF5es do usu\xE1rio", "system": "Ver algumas informa\xE7\xF5es do sistema", "redo": "Refazer a \xFAltima conversa, /redo com conte\xFAdo modificado ou diretamente /redo", "echo": "Repetir a mensagem" }, "new": { "new_chat_start": "Uma nova conversa foi iniciada" } } }; + // src/i18n/en.js var en_default = { "env": { "system_init_message": "You are a helpful assistant" }, "command": { "help": { "summary": "The following commands are currently supported:\n", "help": "Get command help", "new": "Start a new conversation", "start": "Get your ID and start a new conversation", "img": "Generate an image, the complete command format is `/img image description`, for example `/img beach at moonlight`", "version": "Get the current version number to determine whether to update", "setenv": "Set user configuration, the complete command format is /setenv KEY=VALUE", "setenvs": 'Batch set user configurations, the full format of the command is /setenvs {"KEY1": "VALUE1", "KEY2": "VALUE2"}', "delenv": "Delete user configuration, the complete command format is /delenv KEY", "clearenv": "Clear all user configuration", "system": "View some system information", "redo": "Redo the last conversation, /redo with modified content or directly /redo", "echo": "Echo the message" }, "new": { "new_chat_start": "A new conversation has started" } } }; @@ -2375,9 +2429,14 @@ function i18n(lang) { case "zh-mo": case "zh-hant": return zh_hant_default; + case "pt": + case "pt-br": + return pt_default; case "en": case "en-us": return en_default; + default: + return en_default; } } diff --git a/dist/timestamp b/dist/timestamp index f6045d98..b36b4f8a 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1721639738 +1722238667 diff --git a/eslint.config.js b/eslint.config.js index 1aa84779..64128c98 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -5,4 +5,9 @@ import pluginJs from "@eslint/js"; export default [ {languageOptions: { globals: {...globals.browser, ...globals.node} }}, pluginJs.configs.recommended, -]; \ No newline at end of file + { + rules: { + semi : ["error", "always"], + } + } +]; diff --git a/src/agent/agents.js b/src/agent/agents.js index c1d17a8b..0273bd2a 100644 --- a/src/agent/agents.js +++ b/src/agent/agents.js @@ -10,7 +10,7 @@ import { requestCompletionsFromAzureOpenAI, requestImageFromAzureOpenAI } from "./azure.js"; -import "../types/context.js" +import "../types/context.js"; /** * @@ -67,7 +67,7 @@ export const chatLlmAgents = [ enable: isAnthropicAIEnable, request: requestCompletionsFromAnthropicAI } -] +]; /** * @param {string} agentName @@ -91,7 +91,32 @@ export function currentChatModel(agentName, context) { case "anthropic": return context.USER_CONFIG.ANTHROPIC_CHAT_MODEL; default: - return null + return null; + } +} + +/** + * @param {string} agentName + * @returns {null|string} + */ +export function chatModelKey(agentName) { + switch (agentName) { + case "azure": + return "AZURE_CHAT_MODEL"; + case "openai": + return "OPENAI_CHAT_MODEL"; + case "workers": + return "WORKERS_CHAT_MODEL"; + case "gemini": + return "GOOGLE_COMPLETIONS_MODEL"; + case "mistral": + return "MISTRAL_CHAT_MODEL"; + case "cohere": + return "COHERE_CHAT_MODEL"; + case "anthropic": + return "ANTHROPIC_CHAT_MODEL"; + default: + return null; } } @@ -149,7 +174,7 @@ export const imageGenAgents = [ enable: isWorkersAIEnable, request: requestImageFromWorkersAI } -] +]; /** @@ -187,6 +212,23 @@ export function currentImageModel(agentName, context) { case "workers": return context.USER_CONFIG.WORKERS_IMAGE_MODEL; default: - return null + return null; } } + +/** + * @param {string} agentName + * @returns {null|string} + */ +export function imageModelKey(agentName) { + switch (agentName) { + case "azure": + return null; + case "openai": + return "DALL_E_MODEL"; + case "workers": + return "WORKERS_IMAGE_MODEL"; + default: + return null; + } +} \ No newline at end of file diff --git a/src/agent/anthropic.js b/src/agent/anthropic.js index 3902785a..d549ec1e 100644 --- a/src/agent/anthropic.js +++ b/src/agent/anthropic.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {anthropicSseJsonParser, Stream} from "./stream.js"; import {ENV} from "../config/env.js"; import {requestChatCompletions} from "./request.js"; @@ -38,25 +38,25 @@ export async function requestCompletionsFromAnthropicAI(message, prompt, history max_tokens: ENV.MAX_TOKEN_LENGTH, }; if (!body.system) { - delete body.system + delete body.system; } /** * @type {SseChatCompatibleOptions} */ - const options = {} + const options = {}; options.streamBuilder = function (r, c) { return new Stream(r, c, null, anthropicSseJsonParser); - } + }; options.contentExtractor = function (data) { return data?.delta?.text; - } + }; options.fullContentExtractor = function (data) { return data?.content?.[0].text; - } + }; options.errorExtractor = function (data) { return data?.error?.message; - } + }; return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/src/agent/azure.js b/src/agent/azure.js index 9227d74e..a45e636d 100644 --- a/src/agent/azure.js +++ b/src/agent/azure.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {requestChatCompletions} from "./request.js"; /** @@ -40,9 +40,9 @@ export function isAzureImageEnable(context) { export async function requestCompletionsFromAzureOpenAI(message, prompt, history, context, onStream) { const url = context.USER_CONFIG.AZURE_COMPLETIONS_API; - const messages = [...(history || []), {role: 'user', content: message}] + const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}) + messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { ...context.USER_CONFIG.OPENAI_API_EXTRA_PARAMS, diff --git a/src/agent/cohere.js b/src/agent/cohere.js index 5f12918a..c8a54757 100644 --- a/src/agent/cohere.js +++ b/src/agent/cohere.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {cohereSseJsonParser, Stream} from "./stream.js"; import {requestChatCompletions} from "./request.js"; @@ -33,7 +33,7 @@ export async function requestCompletionsFromCohereAI(message, prompt, history, c const roleMap = { 'assistant': 'CHATBOT', 'user': 'USER', - } + }; const body = { message, @@ -44,28 +44,28 @@ export async function requestCompletionsFromCohereAI(message, prompt, history, c return { role: roleMap[msg.role], message: msg.content, - } + }; }), }; if (!body.preamble) { - delete body.preamble + delete body.preamble; } /** * @type {SseChatCompatibleOptions} */ - const options = {} + const options = {}; options.streamBuilder = function (r, c) { return new Stream(r, c, null, cohereSseJsonParser); - } + }; options.contentExtractor = function (data) { return data?.text; - } + }; options.fullContentExtractor = function (data) { return data?.text; - } + }; options.errorExtractor = function (data) { return data?.message; - } + }; return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/src/agent/gemini.js b/src/agent/gemini.js index 1336a13f..8ba5981e 100644 --- a/src/agent/gemini.js +++ b/src/agent/gemini.js @@ -1,5 +1,4 @@ -import "../types/context.js" -import {CONST} from '../config/env.js'; +import "../types/context.js"; /** * @param {ContextType} context @@ -20,7 +19,7 @@ export function isGeminiAIEnable(context) { * @return {Promise} */ export async function requestCompletionsFromGeminiAI(message, prompt, history, context, onStream) { - onStream = null // 暂时不支持stream模式 + onStream = null; // 暂时不支持stream模式 const url = `${context.USER_CONFIG.GOOGLE_COMPLETIONS_API}${context.USER_CONFIG.GOOGLE_COMPLETIONS_MODEL}:${ onStream ? 'streamGenerateContent' : 'generateContent' }?key=${context.USER_CONFIG.GOOGLE_API_KEY}`; diff --git a/src/agent/llm.js b/src/agent/llm.js index 2220dfc9..3c5cca26 100644 --- a/src/agent/llm.js +++ b/src/agent/llm.js @@ -145,7 +145,7 @@ export async function chatWithLLM(text, context, modifier) { const retryAfter = parseInt(resp.headers.get('Retry-After')); if (retryAfter) { nextEnableTime = Date.now() + retryAfter * 1000; - return + return; } } nextEnableTime = null; @@ -162,7 +162,7 @@ export async function chatWithLLM(text, context, modifier) { if (llm === null) { return sendMessageToTelegramWithContext(context)(`LLM is not enable`); } - const prompt = context.USER_CONFIG.SYSTEM_INIT_MESSAGE + const prompt = context.USER_CONFIG.SYSTEM_INIT_MESSAGE; const answer = await requestCompletionsFromLLM(text, prompt, context, llm, modifier, onStream); context.CURRENT_CHAT_CONTEXT.parse_mode = parseMode; if (ENV.SHOW_REPLY_BUTTON && context.CURRENT_CHAT_CONTEXT.message_id) { diff --git a/src/agent/mistralai.js b/src/agent/mistralai.js index 68661238..60daac85 100644 --- a/src/agent/mistralai.js +++ b/src/agent/mistralai.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {requestChatCompletions} from "./request.js"; /** @@ -21,9 +21,9 @@ export function isMistralAIEnable(context) { */ export async function requestCompletionsFromMistralAI(message, prompt, history, context, onStream) { const url = `${context.USER_CONFIG.MISTRAL_API_BASE}/chat/completions`; - const messages = [...(history || []), {role: 'user', content: message}] + const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}) + messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { model: context.USER_CONFIG.MISTRAL_CHAT_MODEL, diff --git a/src/agent/openai.js b/src/agent/openai.js index bb29c966..fcca7599 100644 --- a/src/agent/openai.js +++ b/src/agent/openai.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {requestChatCompletions} from "./request.js"; @@ -7,7 +7,7 @@ import {requestChatCompletions} from "./request.js"; * @return {string|null} */ function openAIKeyFromContext(context) { - const length = context.USER_CONFIG.OPENAI_API_KEY.length + const length = context.USER_CONFIG.OPENAI_API_KEY.length; return context.USER_CONFIG.OPENAI_API_KEY[Math.floor(Math.random() * length)]; } @@ -33,9 +33,9 @@ export function isOpenAIEnable(context) { */ export async function requestCompletionsFromOpenAI(message, prompt, history, context, onStream) { const url = `${context.USER_CONFIG.OPENAI_API_BASE}/chat/completions`; - const messages = [...(history || []), {role: 'user', content: message}] + const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}) + messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { model: context.USER_CONFIG.OPENAI_CHAT_MODEL, diff --git a/src/agent/request.js b/src/agent/request.js index 2896198a..7a3cf5c0 100644 --- a/src/agent/request.js +++ b/src/agent/request.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {ENV} from "../config/env.js"; import {Stream} from "./stream.js"; @@ -38,17 +38,17 @@ import {Stream} from "./stream.js"; function fixOpenAICompatibleOptions(options) { options = options || {}; options.streamBuilder = options.streamBuilder || function (r, c) { - return new Stream(r, c) + return new Stream(r, c); }; options.contentExtractor = options.contentExtractor || function (d) { - return d?.choices?.[0]?.delta?.content - } + return d?.choices?.[0]?.delta?.content; + }; options.fullContentExtractor = options.fullContentExtractor || function (d) { - return d.choices?.[0]?.message.content - } + return d.choices?.[0]?.message.content; + }; options.errorExtractor = options.errorExtractor || function (d) { - return d.error?.message - } + return d.error?.message; + }; return options; } @@ -65,8 +65,8 @@ export function isJsonResponse(resp) { * @return {boolean} */ export function isEventStreamResponse(resp) { - const types = ['application/stream+json', 'text/event-stream'] - const content = resp.headers.get('content-type') + const types = ['application/stream+json', 'text/event-stream']; + const content = resp.headers.get('content-type'); for (const type of types) { if (content.indexOf(type) !== -1) { return true; @@ -150,7 +150,7 @@ export async function requestChatCompletions(url, header, body, context, onStrea try { onResult?.(result); - return options.fullContentExtractor(result) + return options.fullContentExtractor(result); } catch (e) { console.error(e); throw Error(JSON.stringify(result)); diff --git a/src/agent/stream.js b/src/agent/stream.js index 57923e3a..a3212d46 100644 --- a/src/agent/stream.js +++ b/src/agent/stream.js @@ -122,12 +122,12 @@ export function openaiSseJsonParser(sse) { } if (sse.event === null) { try { - return {data: JSON.parse(sse.data)} + return {data: JSON.parse(sse.data)}; } catch (e) { - console.error(e, sse) + console.error(e, sse); } } - return {} + return {}; } export function cohereSseJsonParser(sse) { @@ -140,17 +140,17 @@ export function cohereSseJsonParser(sse) { switch (sse.event) { case 'text-generation': try { - return {data: JSON.parse(sse.data)} + return {data: JSON.parse(sse.data)}; } catch (e) { - console.error(e, sse.data) - return {} + console.error(e, sse.data); + return {}; } case 'stream-start': - return {} + return {}; case 'stream-end': - return {finish: true} + return {finish: true}; default: - return {} + return {}; } } @@ -163,19 +163,19 @@ export function anthropicSseJsonParser(sse) { switch (sse.event) { case 'content_block_delta': try { - return {data: JSON.parse(sse.data)} + return {data: JSON.parse(sse.data)}; } catch (e) { - console.error(e, sse.data) - return {} + console.error(e, sse.data); + return {}; } case 'message_start': case 'content_block_start': case 'content_block_stop': - return {} + return {}; case 'message_stop': - return {finish: true} + return {finish: true}; default: - return {} + return {}; } } diff --git a/src/agent/workersai.js b/src/agent/workersai.js index 20fe7632..bda39469 100644 --- a/src/agent/workersai.js +++ b/src/agent/workersai.js @@ -1,4 +1,4 @@ -import "../types/context.js" +import "../types/context.js"; import {requestChatCompletions} from "./request.js"; /** @@ -48,9 +48,9 @@ export async function requestCompletionsFromWorkersAI(message, prompt, history, const header = { Authorization: `Bearer ${token}` }; - const messages = [...(history || []), {role: 'user', content: message}] + const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}) + messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { messages: messages, @@ -60,16 +60,16 @@ export async function requestCompletionsFromWorkersAI(message, prompt, history, /** * @type {SseChatCompatibleOptions} */ - const options = {} + const options = {}; options.contentExtractor = function (data) { return data?.response; - } + }; options.fullContentExtractor = function (data) { return data?.result?.response; - } + }; options.errorExtractor = function (data) { return data?.errors?.[0]?.message; - } + }; return requestChatCompletions(url, header, body, context, onStream, null, options); } diff --git a/src/config/context.js b/src/config/context.js index 5205b7d4..2b128464 100644 --- a/src/config/context.js +++ b/src/config/context.js @@ -8,7 +8,7 @@ import '../types/telegram.js'; export function trimUserConfig(userConfig) { const config = { ...userConfig - } + }; const keysSet = new Set(userConfig.DEFINE_KEYS); for (const key of ENV.LOCK_USER_CONFIG_KEYS) { keysSet.delete(key); @@ -92,7 +92,7 @@ export class Context { // 复制默认配置 this.USER_CONFIG = { ...ENV.USER_CONFIG - } + }; /** * @type {UserConfigType} */ diff --git a/src/config/env.js b/src/config/env.js index 4cbae25c..86498d68 100644 --- a/src/config/env.js +++ b/src/config/env.js @@ -29,7 +29,7 @@ export class UserConfig { // OpenAI API BASE `` OPENAI_API_BASE = 'https://api.openai.com/v1'; // OpenAI API Extra Params - OPENAI_API_EXTRA_PARAMS = {} + OPENAI_API_EXTRA_PARAMS = {}; // -- DALLE 配置 -- // @@ -225,6 +225,12 @@ const ENV_TYPES = { ANTHROPIC_API_KEY: 'string', }; +export const ENV_KEY_MAPPER = { + CHAT_MODEL: 'OPENAI_CHAT_MODEL', + API_KEY: 'OPENAI_API_KEY', + WORKERS_AI_MODEL: 'WORKERS_CHAT_MODEL', +}; + function parseArray(raw) { if (raw.startsWith('[') && raw.endsWith(']')) { try { @@ -303,9 +309,9 @@ export function initEnv(env, i18n) { } // 合并环境变量 - mergeEnvironment(ENV, env) - mergeEnvironment(ENV.USER_CONFIG, env) - ENV.USER_CONFIG.DEFINE_KEYS = [] + mergeEnvironment(ENV, env); + mergeEnvironment(ENV.USER_CONFIG, env); + ENV.USER_CONFIG.DEFINE_KEYS = []; // 兼容旧版配置 @@ -319,16 +325,17 @@ export function initEnv(env, i18n) { } ENV.TELEGRAM_AVAILABLE_TOKENS.push(env.TELEGRAM_TOKEN); } - // 兼容旧版 WORKERS_AI_MODEL - if (env.WORKERS_AI_MODEL) { - ENV.USER_CONFIG.WORKERS_CHAT_MODEL = env.WORKERS_AI_MODEL; - } // 兼容旧版 OPENAI_API_DOMAIN if (env.OPENAI_API_DOMAIN && !ENV.OPENAI_API_BASE) { ENV.USER_CONFIG.OPENAI_API_BASE = `${env.OPENAI_API_DOMAIN}/v1`; } + // 兼容旧版 WORKERS_AI_MODEL + if (env.WORKERS_AI_MODEL && !ENV.USER_CONFIG.WORKERS_CHAT_MODEL) { + ENV.USER_CONFIG.WORKERS_CHAT_MODEL = env.WORKERS_AI_MODEL; + } + // 兼容旧版API_KEY if (env.API_KEY && ENV.USER_CONFIG.OPENAI_API_KEY.length === 0) { ENV.USER_CONFIG.OPENAI_API_KEY = env.API_KEY.split(','); diff --git a/src/telegram/command.js b/src/telegram/command.js index 80515555..a0b3c0cd 100644 --- a/src/telegram/command.js +++ b/src/telegram/command.js @@ -1,5 +1,13 @@ -import "../types/context.js" -import {CONST, CUSTOM_COMMAND, CUSTOM_COMMAND_DESCRIPTION, DATABASE, ENV, mergeEnvironment} from '../config/env.js'; +import "../types/context.js"; +import { + CONST, + CUSTOM_COMMAND, + CUSTOM_COMMAND_DESCRIPTION, + DATABASE, + ENV, + ENV_KEY_MAPPER, + mergeEnvironment +} from '../config/env.js'; import { getChatRoleWithContext, sendChatActionToTelegramWithContext, @@ -7,7 +15,14 @@ import { sendPhotoToTelegramWithContext, } from './telegram.js'; import {chatWithLLM} from '../agent/llm.js'; -import {currentChatModel, currentImageModel, loadChatLLM, loadImageGen} from "../agent/agents.js"; +import { + chatModelKey, + currentChatModel, + currentImageModel, + imageModelKey, + loadChatLLM, + loadImageGen +} from "../agent/agents.js"; import {trimUserConfig} from "../config/context.js"; @@ -114,7 +129,7 @@ async function commandGenerateImg(message, command, subcommand, context) { return sendMessageToTelegramWithContext(context)(ENV.I18N.command.help.img); } try { - const gen = loadImageGen(context)?.request + const gen = loadImageGen(context)?.request; if (!gen) { return sendMessageToTelegramWithContext(context)(`ERROR: Image generator not found`); } @@ -138,12 +153,12 @@ async function commandGenerateImg(message, command, subcommand, context) { async function commandGetHelp(message, command, subcommand, context) { let helpMsg = ENV.I18N.command.help.summary + '\n'; helpMsg += Object.keys(commandHandlers) - .map((key) => `${key}:${ENV.I18N.command.help[key.substring(1)]}`) - .join('\n'); + .map((key) => `${key}:${ENV.I18N.command.help[key.substring(1)]}`) + .join('\n'); helpMsg += Object.keys(CUSTOM_COMMAND) - .filter((key) => !!CUSTOM_COMMAND_DESCRIPTION[key]) - .map((key) => `${key}:${CUSTOM_COMMAND_DESCRIPTION[key]}`) - .join('\n'); + .filter((key) => !!CUSTOM_COMMAND_DESCRIPTION[key]) + .map((key) => `${key}:${CUSTOM_COMMAND_DESCRIPTION[key]}`) + .join('\n'); return sendMessageToTelegramWithContext(context)(helpMsg); } @@ -188,8 +203,9 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { if (kv === -1) { return sendMessageToTelegramWithContext(context)(ENV.I18N.command.help.setenv); } - const key = subcommand.slice(0, kv); + let key = subcommand.slice(0, kv); const value = subcommand.slice(kv + 1); + key = ENV_KEY_MAPPER[key] || key; if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } @@ -201,7 +217,7 @@ async function commandUpdateUserConfig(message, command, subcommand, context) { context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); mergeEnvironment(context.USER_CONFIG, { [key]: value, - }) + }); console.log("Update user config: ", key, context.USER_CONFIG[key]); await DATABASE.put( context.SHARE_CONTEXT.configStoreKey, @@ -227,7 +243,8 @@ async function commandUpdateUserConfigs(message, command, subcommand, context) { const values = JSON.parse(subcommand); const configKeys = Object.keys(context.USER_CONFIG); for (const ent of Object.entries(values)) { - const [key, value] = ent; + let [key, value] = ent; + key = ENV_KEY_MAPPER[key] || key; if (ENV.LOCK_USER_CONFIG_KEYS.includes(key)) { return sendMessageToTelegramWithContext(context)(`Key ${key} is locked`); } @@ -237,7 +254,7 @@ async function commandUpdateUserConfigs(message, command, subcommand, context) { context.USER_CONFIG.DEFINE_KEYS.push(key); mergeEnvironment(context.USER_CONFIG, { [key]: value, - }) + }); console.log("Update user config: ", key, context.USER_CONFIG[key]); } context.USER_CONFIG.DEFINE_KEYS = Array.from(new Set(context.USER_CONFIG.DEFINE_KEYS)); @@ -319,10 +336,10 @@ async function commandFetchUpdate(message, command, subcommand, context) { try { const info = `https://raw.githubusercontent.com/TBXark/ChatGPT-Telegram-Workers/${ENV.UPDATE_BRANCH}/dist/buildinfo.json`; - const online = await fetch(info).then((r) => r.json()) + const online = await fetch(info).then((r) => r.json()); const timeFormat = (ts) => { - return new Date(ts * 1000).toLocaleString('en-US', {}) - } + return new Date(ts * 1000).toLocaleString('en-US', {}); + }; if (current.ts < online.ts) { return sendMessageToTelegramWithContext(context)(`New version detected: ${online.sha}(${timeFormat(online.ts)})\nCurrent version: ${current.sha}(${timeFormat(current.ts)})`); } else { @@ -346,16 +363,17 @@ async function commandFetchUpdate(message, command, subcommand, context) { async function commandSystem(message, command, subcommand, context) { let chatAgent = loadChatLLM(context)?.name; let imageAgent = loadImageGen(context)?.name; - let chatModel = currentChatModel(chatAgent, context) - let imageModel = currentImageModel(imageAgent, context) - let msg = `AGENT: ${ - JSON.stringify({ - CHAT_AGENT: chatAgent, - CHAT_MODEL: chatModel, - IMAGE_AGENT: imageAgent, - IMAGE_MODEL: imageModel, - }, null, 2) - }\n`; + const agent = { + AI_PROVIDER: chatAgent, + AI_IMAGE_PROVIDER: imageAgent, + }; + if (chatModelKey(chatAgent)) { + agent[chatModelKey(chatAgent)] = currentChatModel(chatAgent, context); + } + if (imageModelKey(imageAgent)) { + agent[imageModelKey(imageAgent)] = currentImageModel(imageAgent, context); + } + let msg = `AGENT: ${JSON.stringify(agent, null, 2)}\n`; if (ENV.DEV_MODE) { const shareCtx = {...context.SHARE_CONTEXT}; shareCtx.currentBotToken = '******'; diff --git a/src/telegram/message.js b/src/telegram/message.js index cba432e5..ee83ab71 100644 --- a/src/telegram/message.js +++ b/src/telegram/message.js @@ -209,7 +209,7 @@ async function msgHandleGroupMessage(message, context) { } // 未AT机器人的消息不作处理 if (!mentioned) { - throw new Error('No mentioned') + throw new Error('No mentioned'); } else { return null; } diff --git a/src/telegram/telegram.js b/src/telegram/telegram.js index 0415a478..99d952c1 100644 --- a/src/telegram/telegram.js +++ b/src/telegram/telegram.js @@ -1,6 +1,6 @@ import {DATABASE, ENV} from '../config/env.js'; import {escape} from "../utils/md2tgmd.js"; -import "../types/context.js" +import "../types/context.js"; /** * @param {string} message From 9f0740b26c7bd3a59aa75de6433254437018d0fc Mon Sep 17 00:00:00 2001 From: tbxark Date: Tue, 30 Jul 2024 10:09:35 +0800 Subject: [PATCH 15/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapter/docker/index.js | 1 - dist/buildinfo.json | 2 +- dist/index.js | 66 +++++++++++++++++------------------ dist/timestamp | 2 +- src/agent/llm.js | 76 +++++++++++++++++++++-------------------- src/telegram/command.js | 9 +++-- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/adapter/docker/index.js b/adapter/docker/index.js index ac66b52e..96471440 100644 --- a/adapter/docker/index.js +++ b/adapter/docker/index.js @@ -1,5 +1,4 @@ import adapter from 'cloudflare-worker-adapter'; -import {MemoryCache} from 'cloudflare-worker-adapter/cache/memory.js'; import {default as worker} from '../../main.js'; import fs from 'fs'; diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 5b21f7b4..f3cca9af 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "d13af8e", "timestamp": 1722238667} +{"sha": "4c39e17", "timestamp": 1722305338} diff --git a/dist/index.js b/dist/index.js index 17a18165..fd574efd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -89,9 +89,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1722238667; + BUILD_TIMESTAMP = 1722305338; // 当前版本 commit id - BUILD_VERSION = "d13af8e"; + BUILD_VERSION = "4c39e17"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1488,47 +1488,49 @@ function tokensCounter() { }; } async function loadHistory(key) { - const historyDisable = ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH <= 0; - if (historyDisable) { - return { real: [], original: [] }; - } let history = []; try { history = JSON.parse(await DATABASE.get(key)); + history = history.map((item) => { + return { + role: item.role, + content: item.content + }; + }); } catch (e) { console.error(e); } if (!history || !Array.isArray(history)) { history = []; } - let original = JSON.parse(JSON.stringify(history)); const counter = tokensCounter(); const trimHistory = (list, initLength, maxLength, maxToken) => { - if (list.length > maxLength) { + if (maxLength >= 0 && list.length > maxLength) { list = list.splice(list.length - maxLength); } - let tokenLength = initLength; - for (let i = list.length - 1; i >= 0; i--) { - const historyItem = list[i]; - let length = 0; - if (historyItem.content) { - length = counter(historyItem.content); - } else { - historyItem.content = ""; - } - tokenLength += length; - if (tokenLength > maxToken) { - list = list.splice(i + 1); - break; + if (maxToken >= 0) { + let tokenLength = initLength; + for (let i = list.length - 1; i >= 0; i--) { + const historyItem = list[i]; + let length = 0; + if (historyItem.content) { + length = counter(historyItem.content); + } else { + historyItem.content = ""; + } + tokenLength += length; + if (tokenLength > maxToken) { + list = list.splice(i + 1); + break; + } } } return list; }; if (ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH > 0) { history = trimHistory(history, 0, ENV.MAX_HISTORY_LENGTH, ENV.MAX_TOKEN_LENGTH); - original = trimHistory(original, 0, ENV.MAX_HISTORY_LENGTH, ENV.MAX_TOKEN_LENGTH); } - return { real: history, original }; + return history; } async function requestCompletionsFromLLM(text, prompt, context, llm, modifier, onStream) { const historyDisable = ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH <= 0; @@ -1539,12 +1541,11 @@ async function requestCompletionsFromLLM(text, prompt, context, llm, modifier, o history = modifierData.history; text = modifierData.text; } - const { real: realHistory, original: originalHistory } = history; - const answer = await llm(text, prompt, realHistory, context, onStream); + const answer = await llm(text, prompt, history, context, onStream); if (!historyDisable) { - originalHistory.push({ role: "user", content: text || "" }); - originalHistory.push({ role: "assistant", content: answer }); - await DATABASE.put(historyKey, JSON.stringify(originalHistory)).catch(console.error); + history.push({ role: "user", content: text || "" }); + history.push({ role: "assistant", content: answer }); + await DATABASE.put(historyKey, JSON.stringify(history)).catch(console.error); } return answer; } @@ -1893,14 +1894,13 @@ async function commandSystem(message, command, subcommand, context) { } async function commandRegenerate(message, command, subcommand, context) { const mf = (history, text) => { - const { real, original } = history; let nextText = text; - if (!real || !original || real.length === 0 || original.length === 0) { + if (!(history && Array.isArray(history) && history.length > 0)) { throw new Error("History not found"); } + const historyCopy = structuredClone(history); while (true) { - const data = real.pop(); - original.pop(); + const data = historyCopy.pop(); if (data === void 0 || data === null) { break; } else if (data.role === "user") { @@ -1913,7 +1913,7 @@ async function commandRegenerate(message, command, subcommand, context) { if (subcommand) { nextText = subcommand; } - return { history: { real, original }, text: nextText }; + return { history: historyCopy, text: nextText }; }; return chatWithLLM(null, context, mf); } diff --git a/dist/timestamp b/dist/timestamp index b36b4f8a..4aafaa43 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1722238667 +1722305338 diff --git a/src/agent/llm.js b/src/agent/llm.js index 3c5cca26..1f43f662 100644 --- a/src/agent/llm.js +++ b/src/agent/llm.js @@ -15,24 +15,29 @@ function tokensCounter() { }; } +/** + * @typedef {object} HistoryItem + * @property {string} role + * @property {string} content + */ /** * 加载历史TG消息 * * @param {string} key - * @return {Promise} + * @return {Promise} */ async function loadHistory(key) { - const historyDisable = ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH <= 0; - - // 判断是否禁用历史记录 - if (historyDisable) { - return {real: [], original: []}; - } // 加载历史记录 let history = []; try { history = JSON.parse(await DATABASE.get(key)); + history = history.map((item) => { + return { + role: item.role, + content: item.content, + }; + }); } catch (e) { console.error(e); } @@ -40,31 +45,30 @@ async function loadHistory(key) { history = []; } - - let original = JSON.parse(JSON.stringify(history)); - const counter = tokensCounter(); const trimHistory = (list, initLength, maxLength, maxToken) => { - // 历史记录超出长度需要裁剪 - if (list.length > maxLength) { + // 历史记录超出长度需要裁剪, 小于0不裁剪 + if (maxLength >= 0 && list.length > maxLength) { list = list.splice(list.length - maxLength); } - // 处理token长度问题 - let tokenLength = initLength; - for (let i = list.length - 1; i >= 0; i--) { - const historyItem = list[i]; - let length = 0; - if (historyItem.content) { - length = counter(historyItem.content); - } else { - historyItem.content = ''; - } - // 如果最大长度超过maxToken,裁剪history - tokenLength += length; - if (tokenLength > maxToken) { - list = list.splice(i + 1); - break; + // 处理token长度问题, 小于0不裁剪 + if (maxToken >= 0) { + let tokenLength = initLength; + for (let i = list.length - 1; i >= 0; i--) { + const historyItem = list[i]; + let length = 0; + if (historyItem.content) { + length = counter(historyItem.content); + } else { + historyItem.content = ''; + } + // 如果最大长度超过maxToken,裁剪history + tokenLength += length; + if (tokenLength > maxToken) { + list = list.splice(i + 1); + break; + } } } return list; @@ -73,10 +77,9 @@ async function loadHistory(key) { // 裁剪 if (ENV.AUTO_TRIM_HISTORY && ENV.MAX_HISTORY_LENGTH > 0) { history = trimHistory(history, 0, ENV.MAX_HISTORY_LENGTH, ENV.MAX_TOKEN_LENGTH); - original = trimHistory(original, 0, ENV.MAX_HISTORY_LENGTH, ENV.MAX_TOKEN_LENGTH); } - return {real: history, original: original}; + return history; } @@ -85,9 +88,9 @@ async function loadHistory(key) { * @param {string} text * @param {string | null} prompt * @param {ContextType} context - * @param {function} llm - * @param {function} modifier - * @param {function} onStream + * @param {function(string, string, HistoryItem[], ContextType, function)} llm + * @param {function(HistoryItem[], string)} modifier + * @param {function(string)} onStream * @return {Promise} */ async function requestCompletionsFromLLM(text, prompt, context, llm, modifier, onStream) { @@ -99,12 +102,11 @@ async function requestCompletionsFromLLM(text, prompt, context, llm, modifier, o history = modifierData.history; text = modifierData.text; } - const {real: realHistory, original: originalHistory} = history; - const answer = await llm(text, prompt, realHistory, context, onStream); + const answer = await llm(text, prompt, history, context, onStream); if (!historyDisable) { - originalHistory.push({role: 'user', content: text || ''}); - originalHistory.push({role: 'assistant', content: answer}); - await DATABASE.put(historyKey, JSON.stringify(originalHistory)).catch(console.error); + history.push({role: 'user', content: text || ''}); + history.push({role: 'assistant', content: answer}); + await DATABASE.put(historyKey, JSON.stringify(history)).catch(console.error); } return answer; } diff --git a/src/telegram/command.js b/src/telegram/command.js index a0b3c0cd..ccc281ff 100644 --- a/src/telegram/command.js +++ b/src/telegram/command.js @@ -409,14 +409,13 @@ async function commandSystem(message, command, subcommand, context) { */ async function commandRegenerate(message, command, subcommand, context) { const mf = (history, text) => { - const {real, original} = history; let nextText = text; - if (!real || !original || real.length === 0 || original.length === 0) { + if (!(history && Array.isArray(history) && history.length > 0)) { throw new Error('History not found'); } + const historyCopy = structuredClone(history); while (true) { - const data = real.pop(); - original.pop(); + const data = historyCopy.pop(); if (data === undefined || data === null) { break; } else if (data.role === 'user') { @@ -429,7 +428,7 @@ async function commandRegenerate(message, command, subcommand, context) { if (subcommand) { nextText = subcommand; } - return {history: {real, original}, text: nextText}; + return {history: historyCopy, text: nextText}; }; return chatWithLLM(null, context, mf); } From de66f3b638f6de9bb220dd6b7e67f17069c89bb8 Mon Sep 17 00:00:00 2001 From: tbxark Date: Wed, 31 Jul 2024 13:38:41 +0800 Subject: [PATCH 16/17] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96azure=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 22 ++++++++++++++++------ dist/timestamp | 2 +- src/agent/agents.js | 20 +++++++++++++++----- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index f3cca9af..bf7b3bff 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "4c39e17", "timestamp": 1722305338} +{"sha": "9f0740b", "timestamp": 1722404014} diff --git a/dist/index.js b/dist/index.js index fd574efd..ad4e4ad3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -89,9 +89,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1722305338; + BUILD_TIMESTAMP = 1722404014; // 当前版本 commit id - BUILD_VERSION = "4c39e17"; + BUILD_VERSION = "9f0740b"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1376,7 +1376,12 @@ var chatLlmAgents = [ function currentChatModel(agentName, context) { switch (agentName) { case "azure": - return "azure"; + try { + const url = new URL(context.USER_CONFIG.AZURE_COMPLETIONS_API); + return url.pathname.split("/")[3]; + } catch { + return context.USER_CONFIG.AZURE_COMPLETIONS_API; + } case "openai": return context.USER_CONFIG.OPENAI_CHAT_MODEL; case "workers": @@ -1396,7 +1401,7 @@ function currentChatModel(agentName, context) { function chatModelKey(agentName) { switch (agentName) { case "azure": - return "AZURE_CHAT_MODEL"; + return "AZURE_COMPLETIONS_API"; case "openai": return "OPENAI_CHAT_MODEL"; case "workers": @@ -1459,7 +1464,12 @@ function loadImageGen(context) { function currentImageModel(agentName, context) { switch (agentName) { case "azure": - return "azure"; + try { + const url = new URL(context.USER_CONFIG.AZURE_DALLE_API); + return url.pathname.split("/")[3]; + } catch { + return context.USER_CONFIG.AZURE_DALLE_API; + } case "openai": return context.USER_CONFIG.DALL_E_MODEL; case "workers": @@ -1471,7 +1481,7 @@ function currentImageModel(agentName, context) { function imageModelKey(agentName) { switch (agentName) { case "azure": - return null; + return "AZURE_DALLE_API"; case "openai": return "DALL_E_MODEL"; case "workers": diff --git a/dist/timestamp b/dist/timestamp index 4aafaa43..43ca7d13 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1722305338 +1722404014 diff --git a/src/agent/agents.js b/src/agent/agents.js index 0273bd2a..c2876199 100644 --- a/src/agent/agents.js +++ b/src/agent/agents.js @@ -77,7 +77,12 @@ export const chatLlmAgents = [ export function currentChatModel(agentName, context) { switch (agentName) { case "azure": - return "azure"; + try { + const url = new URL(context.USER_CONFIG.AZURE_COMPLETIONS_API); + return url.pathname.split("/")[3]; + } catch { + return context.USER_CONFIG.AZURE_COMPLETIONS_API; + } case "openai": return context.USER_CONFIG.OPENAI_CHAT_MODEL; case "workers": @@ -102,7 +107,7 @@ export function currentChatModel(agentName, context) { export function chatModelKey(agentName) { switch (agentName) { case "azure": - return "AZURE_CHAT_MODEL"; + return "AZURE_COMPLETIONS_API"; case "openai": return "OPENAI_CHAT_MODEL"; case "workers": @@ -206,7 +211,12 @@ export function loadImageGen(context) { export function currentImageModel(agentName, context) { switch (agentName) { case "azure": - return "azure"; + try { + const url = new URL(context.USER_CONFIG.AZURE_DALLE_API); + return url.pathname.split("/")[3]; + } catch { + return context.USER_CONFIG.AZURE_DALLE_API; + } case "openai": return context.USER_CONFIG.DALL_E_MODEL; case "workers": @@ -223,7 +233,7 @@ export function currentImageModel(agentName, context) { export function imageModelKey(agentName) { switch (agentName) { case "azure": - return null; + return "AZURE_DALLE_API"; case "openai": return "DALL_E_MODEL"; case "workers": @@ -231,4 +241,4 @@ export function imageModelKey(agentName) { default: return null; } -} \ No newline at end of file +} From 9d65a4a2660632260604a5c577f4f4f07fdd3a82 Mon Sep 17 00:00:00 2001 From: tbxark Date: Wed, 31 Jul 2024 20:07:10 +0800 Subject: [PATCH 17/17] =?UTF-8?q?fix:=20prompt=E6=8F=92=E5=85=A5=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AFBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 14 +++++++------- dist/timestamp | 2 +- src/agent/azure.js | 2 +- src/agent/gemini.js | 2 +- src/agent/mistralai.js | 2 +- src/agent/openai.js | 2 +- src/agent/workersai.js | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index bf7b3bff..44bd908e 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "9f0740b", "timestamp": 1722404014} +{"sha": "de66f3b", "timestamp": 1722427564} diff --git a/dist/index.js b/dist/index.js index ad4e4ad3..f7196956 100644 --- a/dist/index.js +++ b/dist/index.js @@ -89,9 +89,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1722404014; + BUILD_TIMESTAMP = 1722427564; // 当前版本 commit id - BUILD_VERSION = "9f0740b"; + BUILD_VERSION = "de66f3b"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1034,7 +1034,7 @@ async function requestCompletionsFromOpenAI(message, prompt, history, context, o const url = `${context.USER_CONFIG.OPENAI_API_BASE}/chat/completions`; const messages = [...history || [], { role: "user", content: message }]; if (prompt) { - messages.push({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); + messages.unshift({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); } const body = { model: context.USER_CONFIG.OPENAI_CHAT_MODEL, @@ -1099,7 +1099,7 @@ async function requestCompletionsFromWorkersAI(message, prompt, history, context }; const messages = [...history || [], { role: "user", content: message }]; if (prompt) { - messages.push({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); + messages.unshift({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); } const body = { messages, @@ -1133,7 +1133,7 @@ async function requestCompletionsFromGeminiAI(message, prompt, history, context, const url = `${context.USER_CONFIG.GOOGLE_COMPLETIONS_API}${context.USER_CONFIG.GOOGLE_COMPLETIONS_MODEL}:${onStream ? "streamGenerateContent" : "generateContent"}?key=${context.USER_CONFIG.GOOGLE_API_KEY}`; const contentsTemp = [...history || [], { role: "user", content: message }]; if (prompt) { - contentsTemp.push({ role: "assistant", content: prompt }); + contentsTemp.unshift({ role: "assistant", content: prompt }); } const contents = []; const rolMap = { @@ -1183,7 +1183,7 @@ async function requestCompletionsFromMistralAI(message, prompt, history, context const url = `${context.USER_CONFIG.MISTRAL_API_BASE}/chat/completions`; const messages = [...history || [], { role: "user", content: message }]; if (prompt) { - messages.push({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); + messages.unshift({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); } const body = { model: context.USER_CONFIG.MISTRAL_CHAT_MODEL, @@ -1294,7 +1294,7 @@ async function requestCompletionsFromAzureOpenAI(message, prompt, history, conte const url = context.USER_CONFIG.AZURE_COMPLETIONS_API; const messages = [...history || [], { role: "user", content: message }]; if (prompt) { - messages.push({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); + messages.unshift({ role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt }); } const body = { ...context.USER_CONFIG.OPENAI_API_EXTRA_PARAMS, diff --git a/dist/timestamp b/dist/timestamp index 43ca7d13..56066760 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1722404014 +1722427564 diff --git a/src/agent/azure.js b/src/agent/azure.js index a45e636d..4a829c93 100644 --- a/src/agent/azure.js +++ b/src/agent/azure.js @@ -42,7 +42,7 @@ export async function requestCompletionsFromAzureOpenAI(message, prompt, history const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); + messages.unshift({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { ...context.USER_CONFIG.OPENAI_API_EXTRA_PARAMS, diff --git a/src/agent/gemini.js b/src/agent/gemini.js index 8ba5981e..f6f18fdc 100644 --- a/src/agent/gemini.js +++ b/src/agent/gemini.js @@ -26,7 +26,7 @@ export async function requestCompletionsFromGeminiAI(message, prompt, history, c const contentsTemp = [...history || [], {role: 'user', content: message}]; if (prompt) { - contentsTemp.push({role: 'assistant', content: prompt}); + contentsTemp.unshift({role: 'assistant', content: prompt}); } const contents = []; const rolMap = { diff --git a/src/agent/mistralai.js b/src/agent/mistralai.js index 60daac85..94105f93 100644 --- a/src/agent/mistralai.js +++ b/src/agent/mistralai.js @@ -23,7 +23,7 @@ export async function requestCompletionsFromMistralAI(message, prompt, history, const url = `${context.USER_CONFIG.MISTRAL_API_BASE}/chat/completions`; const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); + messages.unshift({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { model: context.USER_CONFIG.MISTRAL_CHAT_MODEL, diff --git a/src/agent/openai.js b/src/agent/openai.js index fcca7599..c58e58a6 100644 --- a/src/agent/openai.js +++ b/src/agent/openai.js @@ -35,7 +35,7 @@ export async function requestCompletionsFromOpenAI(message, prompt, history, con const url = `${context.USER_CONFIG.OPENAI_API_BASE}/chat/completions`; const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); + messages.unshift({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { model: context.USER_CONFIG.OPENAI_CHAT_MODEL, diff --git a/src/agent/workersai.js b/src/agent/workersai.js index bda39469..9e944501 100644 --- a/src/agent/workersai.js +++ b/src/agent/workersai.js @@ -50,7 +50,7 @@ export async function requestCompletionsFromWorkersAI(message, prompt, history, }; const messages = [...(history || []), {role: 'user', content: message}]; if (prompt) { - messages.push({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); + messages.unshift({role: context.USER_CONFIG.SYSTEM_INIT_MESSAGE_ROLE, content: prompt}); } const body = { messages: messages,