From 8d6f4417258a1780998f149b169bec5334a11f78 Mon Sep 17 00:00:00 2001 From: tbxark Date: Fri, 10 May 2024 15:41:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=9A=82?= =?UTF-8?q?=E6=97=A0=E5=8E=86=E5=8F=B2=E6=B6=88=E6=81=AF=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=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 | 15 +++++++++------ dist/timestamp | 2 +- src/command.js | 2 +- src/i18n/en.js | 1 + src/i18n/type.js | 1 + src/i18n/zh-hans.js | 1 + src/i18n/zh-hant.js | 1 + 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 42ce6a9a..7b78a57e 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "cb00fc1", "timestamp": 1715320133} +{"sha": "d027b36", "timestamp": 1715326817} diff --git a/dist/index.js b/dist/index.js index 787ae852..6791098f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,9 +3,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1715320133; + BUILD_TIMESTAMP = 1715326817; // 当前版本 commit id - BUILD_VERSION = "cb00fc1"; + BUILD_VERSION = "d027b36"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1969,7 +1969,7 @@ async function commandRegenerate(message, command, subcommand, context) { const { real, original } = history; let nextText = text; if (!real || !original || real.length === 0 || original.length === 0) { - throw new Error(ENV.I18N.command.help.redo); + throw new Error(ENV.I18N.message.history_empty); } while (true) { const data = real.pop(); @@ -2537,7 +2537,8 @@ var zh_hans_default = { "not_supported_chat_type_message": "\u6682\u4E0D\u652F\u6301\u975E\u6587\u672C\u683C\u5F0F\u6D88\u606F", "handle_chat_type_message_error": (type) => `\u5904\u7406${type}\u7C7B\u578B\u7684\u804A\u5929\u6D88\u606F\u51FA\u9519`, "user_has_no_permission_to_use_the_bot": (id) => `\u4F60\u6CA1\u6709\u6743\u9650\u4F7F\u7528\u8FD9\u4E2Abot, \u8BF7\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u4F60\u7684ID(${id})\u5230\u767D\u540D\u5355`, - "group_has_no_permission_to_use_the_bot": (id) => `\u8BE5\u7FA4\u672A\u5F00\u542F\u804A\u5929\u6743\u9650, \u8BF7\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u7FA4ID(${id})\u5230\u767D\u540D\u5355` + "group_has_no_permission_to_use_the_bot": (id) => `\u8BE5\u7FA4\u672A\u5F00\u542F\u804A\u5929\u6743\u9650, \u8BF7\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u7FA4ID(${id})\u5230\u767D\u540D\u5355`, + "history_empty": "\u6682\u65E0\u5386\u53F2\u6D88\u606F" }, command: { help: { @@ -2621,7 +2622,8 @@ var zh_hant_default = { "not_supported_chat_type_message": "\u7576\u524D\u4E0D\u652F\u6301\u975E\u6587\u672C\u683C\u5F0F\u6D88\u606F", "handle_chat_type_message_error": (type) => `\u8655\u7406${type}\u985E\u578B\u7684\u804A\u5929\u6D88\u606F\u51FA\u932F`, "user_has_no_permission_to_use_the_bot": (id) => `\u60A8\u6C92\u6709\u6B0A\u9650\u4F7F\u7528\u672C\u6A5F\u5668\u4EBA\uFF0C\u8ACB\u806F\u7E6B\u7BA1\u7406\u54E1\u5C07\u60A8\u7684ID(${id})\u6DFB\u52A0\u5230\u767D\u540D\u55AE\u4E2D`, - "group_has_no_permission_to_use_the_bot": (id) => `\u8A72\u7FA4\u7D44\u672A\u958B\u555F\u804A\u5929\u6B0A\u9650\uFF0C\u8ACB\u806F\u7E6B\u7BA1\u7406\u54E1\u5C07\u8A72\u7FA4\u7D44ID(${id})\u6DFB\u52A0\u5230\u767D\u540D\u55AE\u4E2D` + "group_has_no_permission_to_use_the_bot": (id) => `\u8A72\u7FA4\u7D44\u672A\u958B\u555F\u804A\u5929\u6B0A\u9650\uFF0C\u8ACB\u806F\u7E6B\u7BA1\u7406\u54E1\u5C07\u8A72\u7FA4\u7D44ID(${id})\u6DFB\u52A0\u5230\u767D\u540D\u55AE\u4E2D`, + "history_empty": "\u66AB\u7121\u6B77\u53F2\u6D88\u606F" }, command: { help: { @@ -2705,7 +2707,8 @@ var en_default = { "not_supported_chat_type_message": "Currently not supported non-text format messages", "handle_chat_type_message_error": (type) => `Error handling ${type} type of chat messages`, "user_has_no_permission_to_use_the_bot": (id) => `You do not have permission to use this bot, please contact the administrator to add your ID (${id}) to the whitelist`, - "group_has_no_permission_to_use_the_bot": (id) => `The group has not enabled chat permissions, please contact the administrator to add the group ID (${id}) to the whitelist` + "group_has_no_permission_to_use_the_bot": (id) => `The group has not enabled chat permissions, please contact the administrator to add the group ID (${id}) to the whitelist`, + "history_empty": "No history messages" }, command: { help: { diff --git a/dist/timestamp b/dist/timestamp index 6d575b6e..151cdb82 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1715320133 +1715326817 diff --git a/src/command.js b/src/command.js index b80b7b2e..c840fd56 100644 --- a/src/command.js +++ b/src/command.js @@ -503,7 +503,7 @@ async function commandRegenerate(message, command, subcommand, context) { const {real, original} = history; let nextText = text; if (!real || !original || real.length === 0 || original.length === 0) { - throw new Error(ENV.I18N.command.help.redo); + throw new Error(ENV.I18N.message.history_empty); } while (true) { const data = real.pop(); diff --git a/src/i18n/en.js b/src/i18n/en.js index abc7bf3e..1a0661f5 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -15,6 +15,7 @@ export default { 'handle_chat_type_message_error': (type) => `Error handling ${type} type of chat messages`, 'user_has_no_permission_to_use_the_bot': (id) => `You do not have permission to use this bot, please contact the administrator to add your ID (${id}) to the whitelist`, 'group_has_no_permission_to_use_the_bot': (id) => `The group has not enabled chat permissions, please contact the administrator to add the group ID (${id}) to the whitelist`, + 'history_empty': 'No history messages', }, command: { help: { diff --git a/src/i18n/type.js b/src/i18n/type.js index e7fa99a4..dcf8456e 100644 --- a/src/i18n/type.js +++ b/src/i18n/type.js @@ -11,6 +11,7 @@ * @property {function} message.handle_chat_type_message_error * @property {function} message.user_has_no_permission_to_use_the_bot * @property {function} message.group_has_no_permission_to_use_the_bot + * @property {string} message.history_empty * * @property {string} command.help.summary * @property {string} command.help.help diff --git a/src/i18n/zh-hans.js b/src/i18n/zh-hans.js index 008ba2b0..5d81f640 100644 --- a/src/i18n/zh-hans.js +++ b/src/i18n/zh-hans.js @@ -15,6 +15,7 @@ export default { 'handle_chat_type_message_error': (type) => `处理${type}类型的聊天消息出错`, 'user_has_no_permission_to_use_the_bot': (id) => `你没有权限使用这个bot, 请请联系管理员添加你的ID(${id})到白名单`, 'group_has_no_permission_to_use_the_bot': (id) => `该群未开启聊天权限, 请请联系管理员添加群ID(${id})到白名单`, + 'history_empty': '暂无历史消息', }, command: { help: { diff --git a/src/i18n/zh-hant.js b/src/i18n/zh-hant.js index ac09566b..0005ef33 100644 --- a/src/i18n/zh-hant.js +++ b/src/i18n/zh-hant.js @@ -15,6 +15,7 @@ export default { 'handle_chat_type_message_error': (type) => `處理${type}類型的聊天消息出錯`, 'user_has_no_permission_to_use_the_bot': (id) => `您沒有權限使用本機器人,請聯繫管理員將您的ID(${id})添加到白名單中`, 'group_has_no_permission_to_use_the_bot': (id) => `該群組未開啟聊天權限,請聯繫管理員將該群組ID(${id})添加到白名單中`, + 'history_empty': '暫無歷史消息', }, command: { help: { From 90cf7c6f1f97670a8636a83bb75cdfb1e7302497 Mon Sep 17 00:00:00 2001 From: tbxark Date: Fri, 10 May 2024 15:48:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20/redo=E5=91=BD=E4=BB=A4=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E5=A4=84=E7=90=86subcommand=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/buildinfo.json | 2 +- dist/index.js | 7 +++++-- dist/timestamp | 2 +- src/command.js | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/buildinfo.json b/dist/buildinfo.json index 7b78a57e..db7b6ee2 100644 --- a/dist/buildinfo.json +++ b/dist/buildinfo.json @@ -1 +1 @@ -{"sha": "d027b36", "timestamp": 1715326817} +{"sha": "8d6f441", "timestamp": 1715327121} diff --git a/dist/index.js b/dist/index.js index 6791098f..1131471f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,9 +3,9 @@ var Environment = class { // -- 版本数据 -- // // 当前版本 - BUILD_TIMESTAMP = 1715326817; + BUILD_TIMESTAMP = 1715327121; // 当前版本 commit id - BUILD_VERSION = "d027b36"; + BUILD_VERSION = "8d6f441"; // -- 基础配置 -- /** * @type {I18n | null} @@ -1983,6 +1983,9 @@ async function commandRegenerate(message, command, subcommand, context) { break; } } + if (subcommand) { + nextText = subcommand; + } return { history: { real, original }, text: nextText }; }; return chatWithLLM(null, context, mf); diff --git a/dist/timestamp b/dist/timestamp index 151cdb82..b9e6fd25 100644 --- a/dist/timestamp +++ b/dist/timestamp @@ -1 +1 @@ -1715326817 +1715327121 diff --git a/src/command.js b/src/command.js index c840fd56..7f0653bc 100644 --- a/src/command.js +++ b/src/command.js @@ -517,6 +517,9 @@ async function commandRegenerate(message, command, subcommand, context) { break; } } + if (subcommand) { + nextText = subcommand; + } return {history: {real, original}, text: nextText}; }; return chatWithLLM(null, context, mf);