From a703378cb1297c06eeec9c26daeba67d1d55d05d Mon Sep 17 00:00:00 2001 From: Sean Murphy Date: Fri, 28 Jul 2023 20:13:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=99=90=E5=88=B6=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E7=AE=A1=E7=90=86=E6=8C=87=E4=BB=A4=E7=9A=84=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=9D=A1=E4=BB=B6=E9=98=B2=E6=AD=A2=E8=AF=AF=E8=A7=A6?= =?UTF-8?q?=20(#525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add support for ‘greeting’ and ‘global reply mode’ commands, improve variable naming and remove unnecessary backend output. * feat: Add support for black and white lists, global reply mode and voice role settings, private chat switch, and active greeting configuration. Refactor some variable names and comment out redundant code for better readability and reduced backend output. * feat: 为新功能完善了帮助面板 * docs: 完善了‘打招呼’的帮助说明 * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * Commit Type: feat, bugfix Add functionality to view plugin command table, fix bug in blacklist/whitelist, and fix bug where chat mode can still be used in private messaging when disabled. * refactor: Remove redundant log output. * Refactor: optimize code logic * Fix: 修复绘图指令表被抢指令的bug。 * Refactor:1. Add support for automatically translating replies to Japanese and generating voice messages in VITS voice mode (please monitor remaining quota after enabling). 2. Add translation function. 3. Add emotion configuration for Azure voice mode, allowing the robot to select appropriate emotional styles for replies. * Refactor:Handle the issue of exceeding character setting limit caused by adding emotion configuration. * Fix: fix bugs * Refactor: Added error feedback to translation service * Refactor: Added support for viewing the list of supported roles for each language mode, and fixed some bugs in the emotion switching feature of the auzre mode. * Refactor: Optimized some command feedback and added owner restriction to chat record export function. * Refactor: Optimized feedback when viewing role list to avoid excessive messages. * Refactor: Optimized feedback when configuring multi-emotion mode. * Feature: Added help instructions for translation feature. * chore: Adjust help instructions for mood settings * Fix: Fixed issue where only first line of multi-line replies were being read and Azure voice was pronouncing punctuation marks. * Fix: Fixed bug where switching to Azure voice mode prompted for missing key and restricted ability to view voice role list to only when in voice mode. * Refactor: Add image OCR function and support translation for both quoted text and image. * fix: Fix issue with error caused by non-image input. * Refactor: Optimize code to filter emojis that cannot be displayed properly in claude mode. * Refactor: Optimize some code structures. * fix: Fix the bug of returning only one result when entering multiple lines of text on Windows system. * Refactor: Optimize code logic for better user experience * Refactor: Fix the conflict issue with other plugin translation commands * Refactor: Replace Baidu Translation with Youdao Translation to eliminate configuration steps; optimize translation experience; add missing dependency prompts instead of causing program errors.Optimize the experience of switching between voice mode and setting global reply mode. * Refactor: Remove unused files and dependencies in the project. * Feature: Add Youdao translation service to provide more comprehensive translation support. * Refactor: Optimize translation experience * Refactor: Optimize translation experience * Feature: Add functionality of keyword search command * Feature: Add functionality of keyword search command. * Refactor: Remove redundant code * Add: Add feature to support randomly selecting roles for Azure voice. Refactor the code to support existing voice services for the ‘greeting’ feature. Fix the display issue of Azure voice role selection on the Guoba panel. * Refactor: Remove redundant code * Refactor: Improve the function of setting global voice roles and viewing role lists. Now you can set default roles for each voice service separately or view the supported role list. * Refactor: Remove redundant code * Feature: Add new function to support random character dialogues in all voice modes, add the ability to view the current user’s reply settings, and improve related functions in the global settings. * Refactor: Add compatibility directive for viewing reply settings feature * Feature: support adding QQ number to blacklist/whitelist * fix: 处理全局设置指令被上下班指令占用的问题 * fix: 处理全局设置指令被上下班指令占用的问题 * Refactor: Preprocess dialogue blacklist/whitelist when filling in the form in Guoba panel * Fix: Fixed the issue where black and white lists were not effective when filled in the Guoba panel, and the issue where no results were returned when viewing the voice role list without parameters in azure tts mode. * fix: 2.7 dev start * feat: 初步支持function call(WIP) * fix: syntax error * fix: syntax error * feat: 群聊上下文 * fix: 暂时阉割掉全员禁言功能 * fix: 修改禁言时间范围 * fix: 修复一些功能易用性 * fix: 只有管理员和群主才能用jinyan和kickout * fix: 加回来禁言和踢出 * fix: 修复管理员权限判断问题(可能吧) * fix: 试图优化逻辑 * fix: fuck openai documents * fix: 删掉认主不然一直禁言我烦死了 * fix: 哔哩哔哩封面损坏问题 * fix: 加个天气小工具 * fix: 天气不存在城市 * fix: website工具用浏览器 * feat: serp tool * feat: 增加一个google搜索源 * fix: 加一句描述 * feat: 增加搜索来源选项 * feat: 搜图和发图 * fix: groupId format error * Refactor: Optimized the HTML parsing rules * fix: Fixed the bug where conversations could not be properly ended in at mode, now it works normally * refactor: Added EliMovieTool and EliMusicTool. Modified some tool’s prompt to make AI make better choices. Optimized the display of chat history.Remove SendMusicTool and replace it with EliMusicTool. * chore: trivial changes. * refactor:Keep SearchMusicTool and SendMusicTool when avocado plugin is not installed, waiting for more testing~~~ * Refactor: Move the parameter processing logic of some tools into each tool internally.🥑Rename ttstool to SendAudioMessageTool, defaulting to the voice role configured by the current user, and support personalized configuration of the existing tts mode in the plugin.🥑Add SendMessageToSpecificGroupOrUserTool, which allows the robot to send messages to specific groups or friends.🥑Encapsulate the function of generating audio messages into an independent function for easy tool invocation.🥑Separate SendPictureTool and SendAvatarTool to avoid unnecessary bugs.🥑 * chore: Remove unnecessary log file🥑 * refactor: Trivial changes and fixed a bug in QueryUserinfoTool.🥑 * Refactor: Rewrite blacklist and whitelist functionality, optimize code calls Description: Rewrote the blacklist and whitelist functionality to support group, QQ number, and a combination of group and QQ number configurations. Removed the command to set the blacklist and whitelist functionality and unified it through the Guoba panel. Also optimized some code calls to EliMusicTool and EliMovieTool.🥑 * chore: Adjust some tool prompts * chore: adjust prompt * Refactor: Improve the user experience of EliMovieTool and EliMusicTool🥑 * Fix: Fix the bug that AI sends content to itself using the tool🥑 * refactor: Instructions adapted to the new version of avocado-plugin * refactor: optimize avocadoRender🥑 * Chore: Optimize regex commands related to management functions * Chore: trivial changes --------- Co-authored-by: Sean <1519059137@qq.com> Co-authored-by: ikechan8370 Co-authored-by: ikechan8370 --- apps/management.js | 16 ++++++++-------- utils/common.js | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apps/management.js b/apps/management.js index 6671eb7..93aca06 100644 --- a/apps/management.js +++ b/apps/management.js @@ -29,42 +29,42 @@ export class ChatgptManagement extends plugin { priority: 500, rule: [ { - reg: '#chatgpt开启(问题)?(回复)?确认', + reg: '^#chatgpt开启(问题)?(回复)?确认', fnc: 'turnOnConfirm', permission: 'master' }, { - reg: '#chatgpt关闭(问题)?(回复)?确认', + reg: '^#chatgpt关闭(问题)?(回复)?确认', fnc: 'turnOffConfirm', permission: 'master' }, { - reg: '#chatgpt(设置|绑定)(token|Token)', + reg: '^#chatgpt(设置|绑定)(token|Token)', fnc: 'setAccessToken', permission: 'master' }, { - reg: '#chatgpt(设置|绑定)(Poe|POE)(token|Token)', + reg: '^#chatgpt(设置|绑定)(Poe|POE)(token|Token)', fnc: 'setPoeCookie', permission: 'master' }, { - reg: '#chatgpt(设置|绑定|添加)(必应|Bing |bing )(token|Token)', + reg: '^#chatgpt(设置|绑定|添加)(必应|Bing |bing )(token|Token)', fnc: 'setBingAccessToken', permission: 'master' }, { - reg: '#chatgpt(删除|移除)(必应|Bing |bing )(token|Token)', + reg: '^#chatgpt(删除|移除)(必应|Bing |bing )(token|Token)', fnc: 'delBingAccessToken', permission: 'master' }, { - reg: '#chatgpt(查看|浏览)(必应|Bing |bing )(token|Token)', + reg: '^#chatgpt(查看|浏览)(必应|Bing |bing )(token|Token)', fnc: 'getBingAccessToken', permission: 'master' }, { - reg: '#chatgpt(迁移|恢复)(必应|Bing |bing )(token|Token)', + reg: '^#chatgpt(迁移|恢复)(必应|Bing |bing )(token|Token)', fnc: 'migrateBingAccessToken', permission: 'master' }, diff --git a/utils/common.js b/utils/common.js index 002f69c..df7256d 100644 --- a/utils/common.js +++ b/utils/common.js @@ -1,17 +1,17 @@ // import { remark } from 'remark' // import stripMarkdown from 'strip-markdown' -import { exec } from 'child_process' +import {exec} from 'child_process' import lodash from 'lodash' import fs from 'node:fs' import path from 'node:path' import buffer from 'buffer' import yaml from 'yaml' import puppeteer from '../../../lib/puppeteer/puppeteer.js' -import { Config } from './config.js' -import { convertSpeaker, generateVitsAudio, speakers as vitsRoleList } from './tts.js' -import VoiceVoxTTS, { supportConfigurations as voxRoleList } from './tts/voicevox.js' -import AzureTTS, { supportConfigurations as azureRoleList } from './tts/microsoft-azure.js' -import { translate } from './translate.js' +import {Config} from './config.js' +import {convertSpeaker, generateVitsAudio, speakers as vitsRoleList} from './tts.js' +import VoiceVoxTTS, {supportConfigurations as voxRoleList} from './tts/voicevox.js' +import AzureTTS, {supportConfigurations as azureRoleList} from './tts/microsoft-azure.js' +import {translate} from './translate.js' import uploadRecord from './uploadRecord.js' // export function markdownToText (markdown) { // return remark() @@ -897,6 +897,7 @@ export async function generateAzureAudio (pendingText, role = '随机', speaking let languagePrefix = azureRoleList.find(config => config.code === speaker).languageDetail.charAt(0) languagePrefix = languagePrefix.startsWith('E') ? '英' : languagePrefix pendingText = (await translate(pendingText, languagePrefix)).replace('\n', '') + } else { let role, languagePrefix role = azureRoleList[Math.floor(Math.random() * azureRoleList.length)] @@ -938,3 +939,4 @@ export function getUserSpeaker (userSetting) { return userSetting.ttsRoleVoiceVox || Config.voicevoxTTSSpeaker } } + From 709a1cebf038a6ee72713969e550cc05979d02b9 Mon Sep 17 00:00:00 2001 From: HalcyonAlcedo <41666148+HalcyonAlcedo@users.noreply.github.com> Date: Fri, 28 Jul 2023 20:14:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=92=8C=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E4=BF=AE=E5=A4=8D=20(#527)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复后台API反代地址未能正确显示的问题 * 更新渲染页面配置 * 添加个人聊天模式配置 * 将用户数据获取改到common中 * 修复错误的渲染页面参数 * 修复bug * 添加Live2D * 修复渲染页面错误 * 修复渲染传入值 * 更新渲染 * 修复图表渲染bug * 调整live2d模型大小 * 修复live2d无法关闭问题 * 修复错误的传值 * 修复ai命名 * 更新渲染 * 添加用户独立设定 * 更新渲染配置适配个人设置 * 修复合并导致的渲染文件异常删除 * 修复用户数据缺失问题 * 修复旧版本数据缺失问题 * 修复bing参数不存在问题,兼容miao的截图 * 修复受限token重试时不被排除的问题 * 修复个人模式下结束对话的模式错误 * 更新渲染页面,将预览版转为正式版 * 修复传统渲染无法调用截图功能的问题 * 文字模式也进行一次缓存 * 更新README * Update README.md * 更新渲染 * 更新渲染页面 * 添加版本信息 * 遗漏参数 * 丢失引用 * 补充路由 * 添加云转码功能 * 判断node-silk是否正常合成 * 云转码提示 * 修复图片渲染出错 * 云转码支持发送Buffer * 添加云转码模式支持 * 更新描述 * 更新后台渲染页面 * 更新配置 * 更新渲染页面 * 添加云渲染 * 修复错误的接口调用 * 修复遗漏的数据转换 * 修复获取的图片数据异常问题 * 更新后台配置 * 更新渲染页面 * 修复云渲染访问地址错误 * 更新渲染页面 * 修复遗漏的模型文件 * 修复live2d问题 * 更新live2d以及相关配置 * 修复遗漏的数据参数 * 修复新live2d情况下云渲染错误的问题 * 适配云渲染1.1.2等待参数 * 添加云服务api检查 * 更新渲染页面 * 添加live2d加载检测 * 修复错误的属性判断 * 添加云渲染DPR * 更新sydney支持内容生成 * 修改文件模式语音转码接收模式 * 添加云转码时recordUrl检查 * 更新后台配置项 * 修复错误的文本描述 * 更新后台页面 * 添加全局对话模式设置,更新后台面板 * 添加第三方渲染服务适配 * 修复第三方服务器live2d加载导致的渲染失败问题 * 修复后台地址无法实时保存的问题 * 添加live2d模型透明度设置 * 合并更新 * 更新渲染页面 * 更新渲染页面 * 使dpr对本地渲染也生效 * 更新渲染页面 * 添加网页截图功能 * 添加后台配置项 * 添加配置导出和导入功能 * 运行通过参数传递用户token * 登录时将token作为参数返回 * 修复错误 * 添加密码修改和用户删除接口 * 修正密码比对 * 修复user错误 * 优化数据保存时的返回值 * 添加系统额外服务检查api * 添加AccessToken配置 * 修复错误的导入提示 * 添加ws连接 * 添加ws用户信息获取 * 修复错误的循环 * 修正ws参数 * 添加群消息获取权限 * 添加用户多端登录支持 * 修复错误的路径引用 * 修复错误的路径引用 * 修复错误 * 修复页面数据获取失败问题 * 修复异常的中断 * 添加配置视图 * 更新配置面板 * 添加用户版本信息 * 更新配置视图 * 修复错误的视图绑定 * 修改视图文件位置,添加mediaLink相关代码 * 修复错误的视图配置绑定 * 更新依赖,添加qq消息组件初始化信息获取 * 修复异常的群名称无法获取问题 * 修改注释 * 撤销对management的错误合并 * 添加Sydney图片识别功能 * 更新配置文件和后台页面 * 修改view配置 * 修复node版本过低导致的FormData无法调用,尝试添加反代 * 国外图片识别不使用反代 * fix: 修复云转码导致的语音重复发送问题 * fix: 修复qq消息可越权获取的问题 * feat: 添加代理post操作 * fix: 修复一些字符串格式的数字导致的配置加载错误 * fix: 修复错误的云服务api网址格式 * fix: 修复错误的云转码接口调用格式 * fix: 修复错误的精度 --------- Co-authored-by: ikechan8370 --- apps/chat.js | 74 +++++----- apps/entertainment.js | 2 +- package.json | 2 +- server/index.js | 22 ++- utils/SydneyAIClient.js | 32 ++-- utils/common.js | 7 +- utils/tts.js | 2 +- utils/uploadRecord.js | 6 +- yarn.lock | 313 +++++++++++++++++++++++----------------- 9 files changed, 258 insertions(+), 202 deletions(-) diff --git a/apps/chat.js b/apps/chat.js index e20c942..8985f37 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -99,8 +99,8 @@ const defaultPropmtPrefix = ', a large language model trained by OpenAI. You ans const newFetch = (url, options = {}) => { const defaultOptions = Config.proxy ? { - agent: proxy(Config.proxy) - } + agent: proxy(Config.proxy) + } : {} const mergedOptions = { ...defaultOptions, @@ -110,7 +110,7 @@ const newFetch = (url, options = {}) => { return fetch(url, mergedOptions) } export class chatgpt extends plugin { - constructor () { + constructor() { let toggleMode = Config.toggleMode super({ /** 功能名称 */ @@ -276,7 +276,7 @@ export class chatgpt extends plugin { * @param e * @returns {Promise} */ - async getConversations (e) { + async getConversations(e) { // todo 根据use返回不同的对话列表 let keys = await redis.keys('CHATGPT:CONVERSATIONS:*') if (!keys || keys.length === 0) { @@ -299,7 +299,7 @@ export class chatgpt extends plugin { * @param e * @returns {Promise} */ - async destroyConversations (e) { + async destroyConversations(e) { const userData = await getUserData(e.user_id) const use = (userData.mode === 'default' ? null : userData.mode) || await redis.get('CHATGPT:USE') await redis.del(`CHATGPT:WRONG_EMOTION:${e.sender.user_id}`) @@ -451,7 +451,7 @@ export class chatgpt extends plugin { } } - async endAllConversations (e) { + async endAllConversations(e) { let use = await redis.get('CHATGPT:USE') || 'api' let deleted = 0 switch (use) { @@ -535,7 +535,7 @@ export class chatgpt extends plugin { await this.reply(`结束了${deleted}个用户的对话。`, true) } - async deleteConversation (e) { + async deleteConversation(e) { let ats = e.message.filter(m => m.type === 'at') let use = await redis.get('CHATGPT:USE') || 'api' if (use !== 'api3') { @@ -593,7 +593,7 @@ export class chatgpt extends plugin { } } - async switch2Picture (e) { + async switch2Picture(e) { let userReplySetting = await redis.get(`CHATGPT:USER:${e.sender.user_id}`) if (!userReplySetting) { userReplySetting = getDefaultReplySetting() @@ -606,7 +606,7 @@ export class chatgpt extends plugin { await this.reply('ChatGPT回复已转换为图片模式') } - async switch2Text (e) { + async switch2Text(e) { let userSetting = await getUserReplySetting(this.e) userSetting.usePicture = false userSetting.useTTS = false @@ -614,7 +614,7 @@ export class chatgpt extends plugin { await this.reply('ChatGPT回复已转换为文字模式') } - async switch2Audio (e) { + async switch2Audio(e) { switch (Config.ttsMode) { case 'vits-uma-genshin-honkai': if (!Config.ttsSpace) { @@ -642,7 +642,7 @@ export class chatgpt extends plugin { await this.reply('ChatGPT回复已转换为语音模式') } - async switchTTSSource (e) { + async switchTTSSource(e) { let target = e.msg.replace(/^#chatgpt语音换源/, '') switch (target.trim()) { case '1': { @@ -665,7 +665,7 @@ export class chatgpt extends plugin { await e.reply('语音转换源已切换为' + Config.ttsMode) } - async setDefaultRole (e) { + async setDefaultRole(e) { if (Config.ttsMode === 'vits-uma-genshin-honkai' && !Config.ttsSpace) { await this.reply('您没有配置vits-uma-genshin-honkai API,请前往后台管理或锅巴面板进行配置') return @@ -749,7 +749,7 @@ export class chatgpt extends plugin { /** * #chatgpt */ - async chatgpt (e) { + async chatgpt(e) { let prompt if (this.toggleMode === 'at') { if (!e.raw_message || e.msg?.startsWith('#')) { @@ -815,7 +815,7 @@ export class chatgpt extends plugin { await this.abstractChat(e, prompt, use) } - async abstractChat (e, prompt, use) { + async abstractChat(e, prompt, use) { // 关闭私聊通道后不回复 if (!e.isMaster && e.isPrivate && !Config.enablePrivateChat) { return false @@ -1207,8 +1207,8 @@ export class chatgpt extends plugin { // 处理多行回复有时候只会读第一行和azure语音会读出一些标点符号的问题 ttsResponse = ttsResponse.replace(/[-:_;*;\n]/g, ',') // 先把文字回复发出去,避免过久等待合成语音 - if (Config.alsoSendText || ttsResponse.length > Config.ttsAutoFallbackThreshold) { - if (Config.ttsMode === 'vits-uma-genshin-honkai' && ttsResponse.length > Config.ttsAutoFallbackThreshold) { + if (Config.alsoSendText || ttsResponse.length > parseInt(Config.ttsAutoFallbackThreshold)) { + if (Config.ttsMode === 'vits-uma-genshin-honkai' && ttsResponse.length > parseInt(Config.ttsAutoFallbackThreshold)) { await this.reply('回复的内容过长,已转为文本模式') } await this.reply(await convertFaces(response, Config.enableRobotAt, e), e.isGroup) @@ -1283,7 +1283,7 @@ export class chatgpt extends plugin { } } - async chatgpt1 (e) { + async chatgpt1(e) { if (!Config.allowOtherMode) { return false } @@ -1302,7 +1302,7 @@ export class chatgpt extends plugin { return true } - async chatgpt3 (e) { + async chatgpt3(e) { if (!Config.allowOtherMode) { return false } @@ -1321,7 +1321,7 @@ export class chatgpt extends plugin { return true } - async chatglm (e) { + async chatglm(e) { if (!Config.allowOtherMode) { return false } @@ -1340,7 +1340,7 @@ export class chatgpt extends plugin { return true } - async bing (e) { + async bing(e) { if (!Config.allowOtherMode) { return false } @@ -1359,7 +1359,7 @@ export class chatgpt extends plugin { return true } - async claude (e) { + async claude(e) { if (!Config.allowOtherMode) { return false } @@ -1378,7 +1378,7 @@ export class chatgpt extends plugin { return true } - async xh (e) { + async xh(e) { if (!Config.allowOtherMode) { return false } @@ -1397,7 +1397,7 @@ export class chatgpt extends plugin { return true } - async cacheContent (e, use, content, prompt, quote = [], mood = '', suggest = '', imgUrls = []) { + async cacheContent(e, use, content, prompt, quote = [], mood = '', suggest = '', imgUrls = []) { let cacheData = { file: '', cacheUrl: Config.cacheUrl, status: '' } cacheData.file = randomString() const cacheresOption = { @@ -1437,11 +1437,11 @@ export class chatgpt extends plugin { return cacheData } - async renderImage (e, use, content, prompt, quote = [], mood = '', suggest = '', imgUrls = []) { + async renderImage(e, use, content, prompt, quote = [], mood = '', suggest = '', imgUrls = []) { let cacheData = await this.cacheContent(e, use, content, prompt, quote, mood, suggest, imgUrls) const template = use !== 'bing' ? 'content/ChatGPT/index' : 'content/Bing/index' if (!Config.oldview) { - if (cacheData.error || cacheData.status != 200) { await this.reply(`出现错误:${cacheData.error || 'server error ' + cacheData.status}`, true) } else { await e.reply(await renderUrl(e, (Config.viewHost ? `${Config.viewHost}/` : `http://127.0.0.1:${Config.serverPort || 3321}/`) + `page/${cacheData.file}?qr=${Config.showQRCode ? 'true' : 'false'}`, { retType: Config.quoteReply ? 'base64' : '', Viewport: { width: Config.chatViewWidth, height: parseInt(Config.chatViewWidth * 0.56) }, func: (Config.live2d && !Config.viewHost) ? 'window.Live2d == true' : '', deviceScaleFactor: Config.cloudDPR }), e.isGroup && Config.quoteReply) } + if (cacheData.error || cacheData.status != 200) { await this.reply(`出现错误:${cacheData.error || 'server error ' + cacheData.status}`, true) } else { await e.reply(await renderUrl(e, (Config.viewHost ? `${Config.viewHost}/` : `http://127.0.0.1:${Config.serverPort || 3321}/`) + `page/${cacheData.file}?qr=${Config.showQRCode ? 'true' : 'false'}`, { retType: Config.quoteReply ? 'base64' : '', Viewport: { width: parseInt(Config.chatViewWidth), height: parseInt(parseInt(Config.chatViewWidth) * 0.56) }, func: (parseFloat(Config.live2d) && !Config.viewHost) ? 'window.Live2d == true' : '', deviceScaleFactor: parseFloat(Config.cloudDPR) }), e.isGroup && Config.quoteReply) } } else { if (Config.cacheEntry) cacheData.file = randomString() const cacheresOption = { @@ -1485,7 +1485,7 @@ export class chatgpt extends plugin { } } - async sendMessage (prompt, conversation = {}, use, e) { + async sendMessage(prompt, conversation = {}, use, e) { if (!conversation) { conversation = { timeoutMs: Config.defaultTimeoutMs @@ -2083,7 +2083,7 @@ export class chatgpt extends plugin { } else { tools.push(new SerpImageTool()) tools.push(...[new SearchVideoTool(), - new SendVideoTool()]) + new SendVideoTool()]) } let funcMap = {} let fullFuncMap = {} @@ -2166,7 +2166,7 @@ export class chatgpt extends plugin { } } - async newClaudeConversation (e) { + async newClaudeConversation(e) { let presetName = e.msg.replace(/^#claude开启新对话/, '').trim() let client = new SlackClaudeClient({ slackUserToken: Config.slackUserToken, @@ -2204,12 +2204,12 @@ export class chatgpt extends plugin { return true } - async emptyQueue (e) { + async emptyQueue(e) { await redis.lTrim('CHATGPT:CHAT_QUEUE', 1, 0) await this.reply('已清空当前等待队列') } - async removeQueueFirst (e) { + async removeQueueFirst(e) { let uid = await redis.lPop('CHATGPT:CHAT_QUEUE', 0) if (!uid) { await this.reply('当前等待队列为空') @@ -2218,7 +2218,7 @@ export class chatgpt extends plugin { } } - async getAllConversations (e) { + async getAllConversations(e) { const use = await redis.get('CHATGPT:USE') if (use === 'api3') { let conversations = await getConversations(e.sender.user_id, newFetch) @@ -2239,7 +2239,7 @@ export class chatgpt extends plugin { } } - async joinConversation (e) { + async joinConversation(e) { let ats = e.message.filter(m => m.type === 'at') let use = await redis.get('CHATGPT:USE') || 'api' // if (use !== 'api3') { @@ -2270,7 +2270,7 @@ export class chatgpt extends plugin { } } - async attachConversation (e) { + async attachConversation(e) { const use = await redis.get('CHATGPT:USE') if (use !== 'api3') { await this.reply('该功能目前仅支持API3模式') @@ -2287,7 +2287,7 @@ export class chatgpt extends plugin { } } - async totalAvailable (e) { + async totalAvailable(e) { // 查询OpenAI API剩余试用额度 let subscriptionRes = await newFetch(`${Config.openAiBaseUrl}/dashboard/billing/subscription`, { method: 'GET', @@ -2296,7 +2296,7 @@ export class chatgpt extends plugin { } }) - function getDates () { + function getDates() { const today = new Date() const tomorrow = new Date(today) tomorrow.setDate(tomorrow.getDate() + 1) @@ -2333,7 +2333,7 @@ export class chatgpt extends plugin { * @param prompt 问题 * @param conversation 对话 */ - async chatgptBrowserBased (prompt, conversation) { + async chatgptBrowserBased(prompt, conversation) { let option = { markdown: true } if (Config['2captchaToken']) { option.captchaToken = Config['2captchaToken'] @@ -2392,7 +2392,7 @@ export class chatgpt extends plugin { } } -async function getAvailableBingToken (conversation, throttled = []) { +async function getAvailableBingToken(conversation, throttled = []) { let allThrottled = false if (!await redis.get('CHATGPT:BING_TOKENS')) { return { diff --git a/apps/entertainment.js b/apps/entertainment.js index 27ca530..fdfb7f6 100644 --- a/apps/entertainment.js +++ b/apps/entertainment.js @@ -490,7 +490,7 @@ ${translateLangLabels} width: Config.chatViewWidth, height: parseInt(Config.chatViewWidth * 0.56) }, - deviceScaleFactor: Config.cloudDPR + deviceScaleFactor: parseFloat(Config.cloudDPR) } ), e.isGroup && Config.quoteReply) diff --git a/package.json b/package.json index db3dee7..c5aa66d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "eventsource-parser": "^1.0.0", "fastify": "^4.18.0", "form-data": "^4.0.0", - "https-proxy-agent": "5.0.1", + "https-proxy-agent": "7.0.1", "js-tiktoken": "^1.0.5", "keyv": "^4.5.3", "keyv-file": "^0.2.0", diff --git a/server/index.js b/server/index.js index def4522..743b6c2 100644 --- a/server/index.js +++ b/server/index.js @@ -98,7 +98,7 @@ async function mediaLink() { }) if (testServer.ok) { const checkCloudData = await testServer.json() - if (checkCloudData.state != 'error') { + if (checkCloudData.state == 'error') { console.log('本地服务无法访问,开启media服务代理') const serverurl = new URL(Config.cloudTranscode) const ws = new websocketclient(`ws://${serverurl.hostname}${serverurl.port ? ':' + serverurl.port : ''}/ws`) @@ -152,6 +152,18 @@ async function mediaLink() { ws.send(JSON.stringify({ command: data.command, state: false, error: '未输入用户名或密码', region: Bot.uin, type: 'server' })) } break + case 'post_command': + console.log(data) + const fetchOptions = { + method: 'POST', + body: data.postData + } + const response = await fetch(`http://localhost:${Config.serverPort || 3321}${data.postPath}`, fetchOptions) + if (response.ok) { + const json = await response.json() + ws.send(JSON.stringify({ command: data.command, state: true, region: Bot.uin, type: 'server', path: data.postPath, data: json })) + } + break } } catch (error) { console.log(error) @@ -313,7 +325,7 @@ export async function createServer() { connection.socket.on('message', async (message) => { try { const data = JSON.parse(message) - + const user = UserInfo(data.token) switch (data.command) { case 'sendMsg': // 代理消息发送 if (!connection.login) { @@ -339,7 +351,7 @@ export async function createServer() { } break case 'login': // 登录 - const user = UserInfo(data.token) + if (user) { clients[user.user] = connection.socket connection.login = true @@ -353,6 +365,10 @@ export async function createServer() { await connection.socket.send(JSON.stringify({ command: data.command, state: false, error: '请先登录账号' })) return } + if (user.autho != 'admin') { + await connection.socket.send(JSON.stringify({ command: data.command, state: true, error: '普通用户无需进行初始化' })) + return + } const groupList = Bot.getGroupList() groupList.forEach(async (item) => { const group = Bot.pickGroup(item.group_id) diff --git a/utils/SydneyAIClient.js b/utils/SydneyAIClient.js index 51db267..79ac108 100644 --- a/utils/SydneyAIClient.js +++ b/utils/SydneyAIClient.js @@ -28,7 +28,7 @@ if (!globalThis.fetch) { // } // return WebSocket // } -async function getKeyv () { +async function getKeyv() { let Keyv try { Keyv = (await import('keyv')).default @@ -45,7 +45,7 @@ async function getKeyv () { const genRanHex = (size) => [...Array(size)].map(() => Math.floor(Math.random() * 16).toString(16)).join('') export default class SydneyAIClient { - constructor (opts) { + constructor(opts) { this.opts = { ...opts, host: opts.host || Config.sydneyReverseProxy || 'https://edgeservices.bing.com/edgesvc' @@ -56,7 +56,7 @@ export default class SydneyAIClient { this.debug = opts.debug } - async initCache () { + async initCache() { if (!this.conversationsCache) { const cacheOptions = this.opts.cache || {} cacheOptions.namespace = cacheOptions.namespace || 'bing' @@ -65,7 +65,7 @@ export default class SydneyAIClient { } } - async createNewConversation () { + async createNewConversation() { await this.initCache() const fetchOptions = { headers: { @@ -130,7 +130,7 @@ export default class SydneyAIClient { } } - async createWebSocketConnection () { + async createWebSocketConnection() { await this.initCache() // let WebSocket = await getWebSocket() return new Promise((resolve, reject) => { @@ -194,13 +194,13 @@ export default class SydneyAIClient { }) } - async cleanupWebSocketConnection (ws) { + async cleanupWebSocketConnection(ws) { clearInterval(ws.bingPingInterval) ws.close() ws.removeAllListeners() } - async sendMessage ( + async sendMessage( message, opts = {} ) { @@ -367,7 +367,6 @@ export default class SydneyAIClient { } const currentDate = moment().format('YYYY-MM-DDTHH:mm:ssZ') const imageDate = await this.kblobImage(opts.imageUrl) - // console.log(imageDate) const obj = { arguments: [ { @@ -575,9 +574,9 @@ export default class SydneyAIClient { const message = messages.length ? messages[messages.length - 1] : { - adaptiveCards: adaptiveCardsSoFar, - text: replySoFar.join('') - } + adaptiveCards: adaptiveCardsSoFar, + text: replySoFar.join('') + } if (messages[0].contentOrigin === 'Apology') { console.log('Apology found') if (!replySoFar[0]) { @@ -642,9 +641,9 @@ export default class SydneyAIClient { const message = messages.length ? messages[messages.length - 1] : { - adaptiveCards: adaptiveCardsSoFar, - text: replySoFar.join('') - } + adaptiveCards: adaptiveCardsSoFar, + text: replySoFar.join('') + } // 获取到图片内容 if (message.contentType === 'IMAGE') { message.imageTag = messages.filter(m => m.contentType === 'IMAGE').map(m => m.text).join('') @@ -808,7 +807,6 @@ export default class SydneyAIClient { return false } } - /** * Iterate through messages, building an array based on the parentMessageId. * Each message has an id and a parentMessageId. The parentMessageId is the id of the message that this message is a reply to. @@ -816,7 +814,7 @@ export default class SydneyAIClient { * @param parentMessageId * @returns {*[]} An array containing the messages in the order they should be displayed, starting with the root message. */ - static getMessagesForConversation (messages, parentMessageId) { + static getMessagesForConversation(messages, parentMessageId) { const orderedMessages = [] let currentMessageId = parentMessageId while (currentMessageId) { @@ -832,7 +830,7 @@ export default class SydneyAIClient { } } -async function generateRandomIP () { +async function generateRandomIP() { let ip = await redis.get('CHATGPT:BING_IP') if (ip) { return ip diff --git a/utils/common.js b/utils/common.js index df7256d..c76a552 100644 --- a/utils/common.js +++ b/utils/common.js @@ -346,7 +346,8 @@ export async function renderUrl (e, url, renderCfg = {}) { // 云渲染 if (Config.cloudRender) { url = url.replace(`127.0.0.1:${Config.serverPort || 3321}`, Config.serverHost || `${await getPublicIP()}:${Config.serverPort || 3321}`) - const resultres = await fetch(`${Config.cloudTranscode}/screenshot`, { + const cloudUrl = new URL(Config.cloudTranscode) + const resultres = await fetch(`${cloudUrl.href}screenshot`, { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -844,9 +845,7 @@ export async function generateAudio (e, pendingText, speakingEmotion, emotionDeg try { try { sendable = await uploadRecord(wav, Config.ttsMode) - if (sendable) { - await e.reply(sendable) - } else { + if (!sendable) { // 如果合成失败,尝试使用ffmpeg合成 sendable = segment.record(wav) } diff --git a/utils/tts.js b/utils/tts.js index b8eb569..0888db2 100644 --- a/utils/tts.js +++ b/utils/tts.js @@ -47,7 +47,7 @@ function randomNum (minNum, maxNum) { * @param lengthScale * @returns {Promise} */ -export async function generateVitsAudio (text, speaker = '随机', language = '中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)', noiseScale = Config.noiseScale, noiseScaleW = Config.noiseScaleW, lengthScale = Config.lengthScale) { +export async function generateVitsAudio (text, speaker = '随机', language = '中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)', noiseScale = parseFloat(Config.noiseScale), noiseScaleW = parseFloat(Config.noiseScaleW), lengthScale = parseFloat(Config.lengthScale)) { if (!speaker || speaker === '随机') { logger.info('随机角色!这次哪个角色这么幸运会被选到呢……') speaker = speakers[randomNum(0, speakers.length)] diff --git a/utils/uploadRecord.js b/utils/uploadRecord.js index d5d2b80..f26f419 100644 --- a/utils/uploadRecord.js +++ b/utils/uploadRecord.js @@ -83,7 +83,8 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') { buffer = Buffer.from(arrayBuffer) formData.append('file', new File([buffer], 'audio.wav')) } - const resultres = await fetch(`${Config.cloudTranscode}/audio`, { + const cloudUrl = new URL(Config.cloudTranscode) + const resultres = await fetch(`${cloudUrl}audio`, { method: 'POST', body: formData }) @@ -99,7 +100,8 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') { throw e } } else { - const resultres = await fetch(`${Config.cloudTranscode}/audio`, { + const cloudUrl = new URL(Config.cloudTranscode) + const resultres = await fetch(`${cloudUrl}audio`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/yarn.lock b/yarn.lock index 81066cb..56def67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -137,7 +137,7 @@ pixelmatch "^4.0.2" tinycolor2 "^1.6.0" -"@jimp/custom@^0.22.8", "@jimp/custom@>=0.3.5": +"@jimp/custom@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/custom/-/custom-0.22.8.tgz" integrity sha512-u6lP9x/HNeGHB0Oojv4c2mhuDvn7G0ikzYbK4IKLsH4HzHxt62faMjBzQMcFhKJhR6UiiKE/jiHrhGvBT/fMkw== @@ -161,14 +161,14 @@ "@jimp/utils" "^0.22.8" jpeg-js "^0.4.4" -"@jimp/plugin-blit@^0.22.8", "@jimp/plugin-blit@>=0.3.5": +"@jimp/plugin-blit@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-blit/-/plugin-blit-0.22.8.tgz" integrity sha512-rQ19txVCKIwo74HtgFodFt4//0ATPCJK+f24riqzb+nx+1JaOo1xRvpJqg4moirHwKR2fhwdDxmY7KX20kCeYA== dependencies: "@jimp/utils" "^0.22.8" -"@jimp/plugin-blur@^0.22.8", "@jimp/plugin-blur@>=0.3.5": +"@jimp/plugin-blur@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-blur/-/plugin-blur-0.22.8.tgz" integrity sha512-GWbNK3YW6k2EKiGJdpAFEr0jezPBtiVxj2wG/lCPuWJz7KmzSSN99hQjIy73xQxoBCRdALfJlkhe3leFNRueSQ== @@ -182,7 +182,7 @@ dependencies: "@jimp/utils" "^0.22.8" -"@jimp/plugin-color@^0.22.8", "@jimp/plugin-color@>=0.8.0": +"@jimp/plugin-color@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-color/-/plugin-color-0.22.8.tgz" integrity sha512-ogkbg6rpDVH/mMLgAQKg17z3oZE0VN7ZWxNoH12fUHchqKz1I57zpa65fxZe2I8T5Xz97HR3x+7V7oI8qQGdSA== @@ -204,7 +204,7 @@ dependencies: "@jimp/utils" "^0.22.8" -"@jimp/plugin-crop@^0.22.8", "@jimp/plugin-crop@>=0.3.5": +"@jimp/plugin-crop@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-crop/-/plugin-crop-0.22.8.tgz" integrity sha512-ns4oH0h0gezYsbuH8RThcMLY5uTLk/vnqOVjWCehMHEzxi0DHMWCmpcb6bC//vJ+XFNhtVGn1ALN7+ROmPrj+A== @@ -275,21 +275,21 @@ "@jimp/utils" "^0.22.8" load-bmfont "^1.4.1" -"@jimp/plugin-resize@^0.22.8", "@jimp/plugin-resize@>=0.3.5", "@jimp/plugin-resize@>=0.8.0": +"@jimp/plugin-resize@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-resize/-/plugin-resize-0.22.8.tgz" integrity sha512-kg8ArQRPqv/iU3DWNXCa8kcVIhoq64Ze0aGCAeFLKlAq/59f5pzAci6m6vV4L/uOVdYmUa9/kYwIFY6RWKpfzQ== dependencies: "@jimp/utils" "^0.22.8" -"@jimp/plugin-rotate@^0.22.8", "@jimp/plugin-rotate@>=0.3.5": +"@jimp/plugin-rotate@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-rotate/-/plugin-rotate-0.22.8.tgz" integrity sha512-9a+VPZWMN/Cks76wf8LjM5RVA3ntP9+NAdsS1SZhhXel7U3Re/dWMouIEbo3QTt6K+igRo4txUCdZiw4ZucvkQ== dependencies: "@jimp/utils" "^0.22.8" -"@jimp/plugin-scale@^0.22.8", "@jimp/plugin-scale@>=0.3.5": +"@jimp/plugin-scale@^0.22.8": version "0.22.8" resolved "https://registry.npmmirror.com/@jimp/plugin-scale/-/plugin-scale-0.22.8.tgz" integrity sha512-dQS4pG6DX6endu8zUpvBBOEtGC+ljDDDNw0scSXY71TxyQdNo5Ro0apfsppjmuAr8rNotRkfyxbITKkXQDRUDQ== @@ -410,6 +410,66 @@ semver "^7.3.5" tar "^6.1.11" +"@node-rs/jieba-android-arm-eabi@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm-eabi/-/jieba-android-arm-eabi-1.7.0.tgz#50b9921c6feb44755584963e8e00e425e557965a" + integrity sha512-XF4OYcZCyDiBK+jm1Zmt2o+xEO7K2K5OvUC3MTc9jd3Lwvy3EdHp8tpGvEp8PxfVFe2/JxNzX4OQQQP3Dhmk9A== + +"@node-rs/jieba-android-arm64@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-android-arm64/-/jieba-android-arm64-1.7.0.tgz#3778790451e5664b7d658bdb66cc1013448b4ee2" + integrity sha512-9oWwFVr/37T89WC+jjiI9A6u0zUJNTJl5ZC4CMxX45MVMokWI7bBXU7t7qBmMdFBzj+OFwDd3sm1fh4vl7NSWA== + +"@node-rs/jieba-darwin-arm64@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-darwin-arm64/-/jieba-darwin-arm64-1.7.0.tgz#a2b4941ba3f738538cd2c432411408d52d8dba85" + integrity sha512-9gBuxJCNITNI/gU5l8eeVGQ9MAf0BV86lfeo9TeU61vJCy6sqyx26wFMLODQgLNdiMP+q/fZme/G0hfZUjfPVA== + +"@node-rs/jieba-darwin-x64@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-darwin-x64/-/jieba-darwin-x64-1.7.0.tgz#360bf8d1bbf580b538b93f66f5364b743ca4370f" + integrity sha512-FFUSMY4tl0Prpxa1SHy7Yzze2KfV/bZzccpO5nd+a8zCKbiX6gVkJ89FfxSAD2QrXUGkZvJYiPmu5nkZItqRZQ== + +"@node-rs/jieba-freebsd-x64@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-freebsd-x64/-/jieba-freebsd-x64-1.7.0.tgz#f397ea7552121deb8f583ab51e96c198a0f88e38" + integrity sha512-QFz2pz0Br+621QbKkgQPqTn90j1kcCD9jaI++qTLNHJGlWLRn6sFoAjb+jQEQEy9aE7VqfIV56eaVcCoU5VO2w== + +"@node-rs/jieba-linux-arm-gnueabihf@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm-gnueabihf/-/jieba-linux-arm-gnueabihf-1.7.0.tgz#e8914e8ad38b412edd78674d10381153bf6ac8b7" + integrity sha512-kHJxO2sd7gMKqI1YS5DjABEcRwRemaCtgbKSuUqEaHGmUz9nAaUF6FSY8U4rXwr7HXt+kQa4NgyYDjgz+Pscrw== + +"@node-rs/jieba-linux-arm64-gnu@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-gnu/-/jieba-linux-arm64-gnu-1.7.0.tgz#987d7db0e1ffe30aff23abd5c3bb664aff88152f" + integrity sha512-3qoCV9pF6llPBGDMu7K8JdHjI10WPkrq6P2gpZESqekcE4DatV6DcU9FWR+QL7MK/7meoE3/Zhjm7OK+qBd8gg== + +"@node-rs/jieba-linux-arm64-musl@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-arm64-musl/-/jieba-linux-arm64-musl-1.7.0.tgz#e32d20f1ba346e5e0e8c7cc4c5d9c5970dc7e6e7" + integrity sha512-xv6hvzOV7iTCq7mM8SWhC3zEk6CqmBwhOSlfbb3gvPkc4U1UA1hmvcrD7oO5Qn+U+nuswysGCdVU6Z5AypLDfg== + +"@node-rs/jieba-linux-x64-gnu@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-gnu/-/jieba-linux-x64-gnu-1.7.0.tgz#e39cf21d5220565542f1478571aa899ac4574411" + integrity sha512-NpelWidMSNLoFTw+ov3y5jhJZjapHwEnh0Fyfm/7mvqkdwzVyedqNj22etRGum+nsAosMotCUWUznIMAD075gQ== + +"@node-rs/jieba-linux-x64-musl@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-linux-x64-musl/-/jieba-linux-x64-musl-1.7.0.tgz#01f756bccc4f7b683317665d606e4384b47361ee" + integrity sha512-yG4F8sy+fW4RbhyKXmEMT/JGuQuKH0TGymCEGYgT0km2I60iys63jWf2VTzCtrx583wxN5XoHv5HN60nhtIBtw== + +"@node-rs/jieba-win32-arm64-msvc@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-arm64-msvc/-/jieba-win32-arm64-msvc-1.7.0.tgz#71806504eea7390c3edd3579956d1f7e55f69c2e" + integrity sha512-R6l/BSMs6R6BwpZS6DIDZuAEjUIPdAHgyi+xptP3mICjm6U+GMsvsRTeZkIJ7a/yzYUfqvz54VpQsfE5f0psBQ== + +"@node-rs/jieba-win32-ia32-msvc@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@node-rs/jieba-win32-ia32-msvc/-/jieba-win32-ia32-msvc-1.7.0.tgz#9c1c3f5aca2144cc2c8a14c0707a494e7ce79209" + integrity sha512-FwibbuizEjzom02K2JM2T8tL0VlxW5xGDDy3L3dgx46xIGE85PwGYjgju+eDt4UODgxDsxGC4DUMMZf3XvCc7A== + "@node-rs/jieba-win32-x64-msvc@1.7.0": version "1.7.0" resolved "https://registry.npmmirror.com/@node-rs/jieba-win32-x64-msvc/-/jieba-win32-x64-msvc-1.7.0.tgz" @@ -752,7 +812,12 @@ acorn@^8.4.1: resolved "https://registry.npmmirror.com/acorn/-/acorn-8.9.0.tgz" integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== -agent-base@^6.0.1, agent-base@6: +agent-base@5: + version "5.1.1" + resolved "https://registry.npmmirror.com/agent-base/-/agent-base-5.1.1.tgz" + integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== + +agent-base@6, agent-base@^6.0.1: version "6.0.2" resolved "https://registry.npmmirror.com/agent-base/-/agent-base-6.0.2.tgz" integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== @@ -766,11 +831,6 @@ agent-base@^7.0.2: dependencies: debug "^4.3.4" -agent-base@5: - version "5.1.1" - resolved "https://registry.npmmirror.com/agent-base/-/agent-base-5.1.1.tgz" - integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== - ajv-formats@^2.1.1: version "2.1.1" resolved "https://registry.npmmirror.com/ajv-formats/-/ajv-formats-2.1.1.tgz" @@ -981,16 +1041,7 @@ bent@^7.3.12: caseless "~0.12.0" is-stream "^2.0.0" -bl@^4.0.3: - version "4.1.0" - resolved "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -bl@^4.1.0: +bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.npmmirror.com/bl/-/bl-4.1.0.tgz" integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== @@ -1075,15 +1126,7 @@ buffer-equal@0.0.1: resolved "https://registry.npmmirror.com/buffer-equal/-/buffer-equal-0.0.1.tgz" integrity sha512-RgSV6InVQ9ODPdLWJ5UAqBqJBOg370Nz6ZQtRzpt6nUjc8v0St97uJ4PYC6NztqIScrAXafKM3mZPMygSe1ggA== -buffer@^5.2.0: - version "5.7.1" - resolved "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -buffer@^5.5.0: +buffer@^5.2.0, buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmmirror.com/buffer/-/buffer-5.7.1.tgz" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -1259,16 +1302,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@^1.0.0, color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.3.tgz" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-name@^1.0.0, color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + color-string@^1.9.0: version "1.9.1" resolved "https://registry.npmmirror.com/color-string/-/color-string-1.9.1.tgz" @@ -1321,7 +1364,7 @@ console-control-strings@^1.0.0, console-control-strings@^1.1.0: resolved "https://registry.npmmirror.com/console-control-strings/-/console-control-strings-1.1.0.tgz" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== -content-disposition@^0.5.3, content-disposition@0.5.4: +content-disposition@0.5.4, content-disposition@^0.5.3: version "0.5.4" resolved "https://registry.npmmirror.com/content-disposition/-/content-disposition-0.5.4.tgz" integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== @@ -1338,7 +1381,7 @@ cookie-signature@1.0.6: resolved "https://registry.npmmirror.com/cookie-signature/-/cookie-signature-1.0.6.tgz" integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== -cookie@^0.5.0, cookie@0.5.0: +cookie@0.5.0, cookie@^0.5.0: version "0.5.0" resolved "https://registry.npmmirror.com/cookie/-/cookie-0.5.0.tgz" integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== @@ -1369,27 +1412,6 @@ debounce-fn@^5.1.2: dependencies: mimic-fn "^4.0.0" -debug@^4.0.0: - version "4.3.4" - resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -debug@^4.1.1: - version "4.3.4" - resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -debug@^4.3.4, debug@4: - version "4.3.4" - resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - debug@2.6.9: version "2.6.9" resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz" @@ -1397,6 +1419,13 @@ debug@2.6.9: dependencies: ms "2.0.0" +debug@4, debug@^4.0.0, debug@^4.1.1, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + decompress-response@^6.0.0: version "6.0.0" resolved "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz" @@ -1768,6 +1797,11 @@ fast-fifo@^1.0.0, fast-fifo@^1.1.0, fast-fifo@^1.2.0: resolved "https://registry.npmmirror.com/fast-fifo/-/fast-fifo-1.2.0.tgz" integrity sha512-NcvQXt7Cky1cNau15FWy64IjuO8X0JijhTBBrJj1YlxlDfRkJXNaK9RFUjwpfDPzMdv7wB38jr53l9tkNLxnWg== +fast-fifo@^1.1.0, fast-fifo@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.0.tgz#03e381bcbfb29932d7c3afde6e15e83e05ab4d8b" + integrity sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw== + fast-json-stringify@^5.7.0: version "5.7.0" resolved "https://registry.npmmirror.com/fast-json-stringify/-/fast-json-stringify-5.7.0.tgz" @@ -1824,6 +1858,28 @@ fastify@^4.11.0, fastify@^4.18.0, fastify@>=4: semver "^7.5.0" tiny-lru "^11.0.1" +fastify@^4.18.0: + version "4.20.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-4.20.0.tgz#d796c7433ac64b83a666350dc8b57e1b2517c116" + integrity sha512-zWWi5KGAb1YZ6fyrnFnA1CA1EZHkGM6YuELgB3QpS3l4lLRy14W1cc16b4KGPH/zQ98WCSdS+T41JkHY3eq1oA== + dependencies: + "@fastify/ajv-compiler" "^3.5.0" + "@fastify/error" "^3.2.0" + "@fastify/fast-json-stringify-compiler" "^4.3.0" + abstract-logging "^2.0.1" + avvio "^8.2.1" + fast-content-type-parse "^1.0.0" + fast-json-stringify "^5.7.0" + find-my-way "^7.6.0" + light-my-request "^5.9.1" + pino "^8.12.0" + process-warning "^2.2.0" + proxy-addr "^2.0.7" + rfdc "^1.3.0" + secure-json-parse "^2.5.0" + semver "^7.5.0" + tiny-lru "^11.0.1" + fastq@^1.6.1: version "1.15.0" resolved "https://registry.npmmirror.com/fastq/-/fastq-1.15.0.tgz" @@ -2192,6 +2248,14 @@ http-errors@2.0.0: statuses "2.0.1" toidentifier "1.0.1" +https-proxy-agent@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.1.tgz#0277e28f13a07d45c663633841e20a40aaafe0ab" + integrity sha512-Eun8zV0kcYS1g19r78osiQLEFIRspRUDd9tIfBCTBPBeMieF/EsJNL8VI3xOIdYRDEkjQnqOYPsZ2DsWsVsFwQ== + dependencies: + agent-base "^7.0.2" + debug "4" + https-proxy-agent@^4.0.0: version "4.0.0" resolved "https://registry.npmmirror.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz" @@ -2200,7 +2264,7 @@ https-proxy-agent@^4.0.0: agent-base "5" debug "4" -https-proxy-agent@^5.0.0, https-proxy-agent@5.0.1: +https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -2221,7 +2285,7 @@ human-signals@^2.1.0: resolved "https://registry.npmmirror.com/human-signals/-/human-signals-2.1.0.tgz" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -iconv-lite@^0.4.24, iconv-lite@0.4.24: +iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -2248,7 +2312,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@2, inherits@2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.npmmirror.com/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2269,7 +2333,7 @@ inquirer-autocomplete-prompt@^3.0.0: run-async "^2.4.1" rxjs "^7.5.6" -inquirer@^9.1.0, inquirer@^9.1.4: +inquirer@^9.1.4: version "9.2.7" resolved "https://registry.npmmirror.com/inquirer/-/inquirer-9.2.7.tgz" integrity sha512-Bf52lnfvNxGPJPltiNO2tLBp3zC339KNlGMqOkW+dsvNikBhcVDK5kqU2lVX2FTPzuXUFX5WJDlsw//w3ZwoTw== @@ -2669,6 +2733,13 @@ keyv@^4.5.2, keyv@^4.5.3: dependencies: json-buffer "3.0.1" +keyv@^4.5.3: + version "4.5.3" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" + integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== + dependencies: + json-buffer "3.0.1" + kind-of@^2.0.1: version "2.0.1" resolved "https://registry.npmmirror.com/kind-of/-/kind-of-2.0.1.tgz" @@ -2825,7 +2896,7 @@ mime-types@^2.1.12, mime-types@~2.1.24, mime-types@~2.1.34: dependencies: mime-db "1.52.0" -mime@^1.3.4: +mime@1.6.0, mime@^1.3.4: version "1.6.0" resolved "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== @@ -2835,11 +2906,6 @@ mime@^3.0.0: resolved "https://registry.npmmirror.com/mime/-/mime-3.0.0.tgz" integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== -mime@1.6.0: - version "1.6.0" - resolved "https://registry.npmmirror.com/mime/-/mime-1.6.0.tgz" - integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.npmmirror.com/mimic-fn/-/mimic-fn-2.1.0.tgz" @@ -2936,11 +3002,6 @@ mnemonist@0.39.5: dependencies: obliterator "^2.0.1" -ms@^2.1.1: - version "2.1.3" - resolved "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - ms@2.0.0: version "2.0.0" resolved "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz" @@ -2951,7 +3012,7 @@ ms@2.1.2: resolved "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3: +ms@2.1.3, ms@^2.1.1: version "2.1.3" resolved "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -2993,14 +3054,7 @@ node-domexception@^1.0.0: resolved "https://registry.npmmirror.com/node-domexception/-/node-domexception-1.0.0.tgz" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== -node-fetch@^2.6.1: - version "2.6.11" - resolved "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.11.tgz" - integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== - dependencies: - whatwg-url "^5.0.0" - -node-fetch@^2.6.7: +node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.11" resolved "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.11.tgz" integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== @@ -3297,16 +3351,16 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.npmmirror.com/path-key/-/path-key-3.1.1.tgz" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-to-regexp@^6.2.1: - version "6.2.1" - resolved "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-6.2.1.tgz" - integrity sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw== - path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz" integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== +path-to-regexp@^6.2.1: + version "6.2.1" + resolved "https://registry.npmmirror.com/path-to-regexp/-/path-to-regexp-6.2.1.tgz" + integrity sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw== + peek-readable@^4.1.0: version "4.1.0" resolved "https://registry.npmmirror.com/peek-readable/-/peek-readable-4.1.0.tgz" @@ -3484,7 +3538,7 @@ puppeteer-extra-plugin@^3.2.3: debug "^4.1.1" merge-deep "^3.0.1" -puppeteer-extra@*, puppeteer-extra@^3.3.6: +puppeteer-extra@^3.3.6: version "3.3.6" resolved "https://registry.npmmirror.com/puppeteer-extra/-/puppeteer-extra-3.3.6.tgz" integrity sha512-rsLBE/6mMxAjlLd06LuGacrukP2bqbzKCLzV1vrhHFavqQE/taQ2UXv3H5P0Ls7nsrASa+6x3bDbXHpqMwq+7A== @@ -3510,7 +3564,7 @@ quick-format-unescaped@^4.0.3: resolved "https://registry.npmmirror.com/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz" integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== -quick-lru@^6.1.1, quick-lru@6.1.1: +quick-lru@6.1.1, quick-lru@^6.1.1: version "6.1.1" resolved "https://registry.npmmirror.com/quick-lru/-/quick-lru-6.1.1.tgz" integrity sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q== @@ -3527,20 +3581,20 @@ range-parser@~1.2.1: resolved "https://registry.npmmirror.com/range-parser/-/range-parser-1.2.1.tgz" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@^2.3.3: - version "2.5.2" - resolved "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.2.tgz" - integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== +raw-body@2.5.1: + version "2.5.1" + resolved "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.1.tgz" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== dependencies: bytes "3.1.2" http-errors "2.0.0" iconv-lite "0.4.24" unpipe "1.0.0" -raw-body@2.5.1: - version "2.5.1" - resolved "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.1.tgz" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== +raw-body@^2.3.3: + version "2.5.2" + resolved "https://registry.npmmirror.com/raw-body/-/raw-body-2.5.2.tgz" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== dependencies: bytes "3.1.2" http-errors "2.0.0" @@ -3576,16 +3630,7 @@ read-pkg@^7.1.0: parse-json "^5.2.0" type-fest "^2.0.0" -readable-stream@^3.1.1, readable-stream@^3.4.0: - version "3.6.2" - resolved "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@^3.6.0: +readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.2" resolved "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== @@ -3695,7 +3740,7 @@ rxjs@^7.5.6, rxjs@^7.8.1: dependencies: tslib "^2.1.0" -safe-buffer@^5.0.1, safe-buffer@~5.2.0, safe-buffer@5.2.1: +safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -3721,7 +3766,7 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz" integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== -safer-buffer@^2.1.0, "safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: version "2.1.2" resolved "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -3758,6 +3803,13 @@ semver@^7.3.4, semver@^7.3.5, semver@^7.3.8, semver@^7.5.0, semver@^7.5.4: dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.npmmirror.com/send/-/send-0.18.0.tgz" @@ -3948,18 +4000,10 @@ string_decoder@^1.1.1: resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz" integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== dependencies: - safe-buffer "~5.2.0" + fast-fifo "^1.1.0" + queue-tick "^1.0.1" -"string-width@^1.0.2 || 2 || 3 || 4": - version "4.2.3" - resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.3: +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4004,6 +4048,13 @@ string.prototype.trimstart@^1.0.6: define-properties "^1.1.4" es-abstract "^1.20.4" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz" @@ -4165,7 +4216,7 @@ ts-node-register@^1.0.0: dependencies: ts-node ">=0.9.0" -ts-node@^10.9.1, ts-node@>=0.9.0: +ts-node@>=0.9.0, ts-node@^10.9.1: version "10.9.1" resolved "https://registry.npmmirror.com/ts-node/-/ts-node-10.9.1.tgz" integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== @@ -4238,11 +4289,6 @@ typed-array-length@^1.0.4: for-each "^0.3.3" is-typed-array "^1.1.9" -typescript@>=2.7: - version "5.1.3" - resolved "https://registry.npmmirror.com/typescript/-/typescript-5.1.3.tgz" - integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw== - unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.npmmirror.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz" @@ -4270,7 +4316,7 @@ universalify@^2.0.0: resolved "https://registry.npmmirror.com/universalify/-/universalify-2.0.0.tgz" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== -unpipe@~1.0.0, unpipe@1.0.0: +unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmmirror.com/unpipe/-/unpipe-1.0.0.tgz" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== @@ -4424,12 +4470,7 @@ wrappy@1: resolved "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@^7.5.3: - version "7.5.9" - resolved "https://registry.npmmirror.com/ws/-/ws-7.5.9.tgz" - integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== - -ws@^7.5.6: +ws@^7.5.3, ws@^7.5.6: version "7.5.9" resolved "https://registry.npmmirror.com/ws/-/ws-7.5.9.tgz" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== From e445cb3c7f7258d346457b078d6299741d9fd931 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Fri, 28 Jul 2023 23:58:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=BF=85=E5=BA=94=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88=20(#528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 必应验证码另一个解决方案 * fix: add log * fix: try try * fix: 优化报错信息 --- apps/chat.js | 81 +++++++++++++++++++++----------------------- guoba.support.js | 6 ++++ utils/bingCaptcha.js | 32 +++++++++++++++-- utils/config.js | 1 + 4 files changed, 75 insertions(+), 45 deletions(-) diff --git a/apps/chat.js b/apps/chat.js index 8985f37..06123d7 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -66,7 +66,7 @@ import { SendDiceTool } from '../utils/tools/SendDiceTool.js' import { SendAvatarTool } from '../utils/tools/SendAvatarTool.js' import { SendMessageToSpecificGroupOrUserTool } from '../utils/tools/SendMessageToSpecificGroupOrUserTool.js' import { SetTitleTool } from '../utils/tools/SetTitleTool.js' -import { createCaptcha, solveCaptcha } from '../utils/bingCaptcha.js' +import { createCaptcha, solveCaptcha, solveCaptchaOneShot } from '../utils/bingCaptcha.js' try { await import('emoji-strip') @@ -233,7 +233,7 @@ export class chatgpt extends plugin { reg: '^#chatgpt删除对话', fnc: 'deleteConversation', permission: 'master' - }, + } // { // reg: '^#chatgpt必应验证码', // fnc: 'bingCaptcha' @@ -1678,42 +1678,37 @@ export class chatgpt extends plugin { } catch (error) { logger.error(error) const message = error?.message || error?.data?.message || error || '出错了' - // if (message && typeof message === 'string' && message.indexOf('CaptchaChallenge') > -1) { - // if (bingToken) { - // // let { id, regionId, image } = await createCaptcha(e, bingToken) - // // e.bingCaptchaId = id - // // e.token = bingToken - // // e.regionId = regionId - // // const { - // // conversationSignature, - // // conversationId, - // // clientId - // // } = error?.conversation - // // e.bingConversation = { - // // conversationSignature, - // // conversationId, - // // clientId - // // } - // return { - // text: '请在60秒内输入下面图片以通过必应人机验证', - // image, - // error: true, - // token: bingToken - // } - // } - // } else - if (message && typeof message === 'string' && message.indexOf('限流') > -1) { - throttledTokens.push(bingToken) - let bingTokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS')) - const badBingToken = bingTokens.findIndex(element => element.Token === bingToken) - const now = new Date() - const hours = now.getHours() - now.setHours(hours + 6) - bingTokens[badBingToken].State = '受限' - bingTokens[badBingToken].DisactivationTime = now - await redis.set('CHATGPT:BING_TOKENS', JSON.stringify(bingTokens)) + if (message && typeof message === 'string' && message.indexOf('CaptchaChallenge') > -1) { + if (bingToken) { + await e.reply('出现必应验证码,尝试解决中') + try { + let captchaResolveResult = await solveCaptchaOneShot(bingToken) + if (captchaResolveResult?.success) { + await e.reply('验证码已解决') + } else { + logger.error(captchaResolveResult) + await e.reply('验证码解决失败: ' + captchaResolveResult.error) + retry = 0 + } + } catch (err) { + logger.error(err) + await e.reply('验证码解决失败: ' + err) + retry = 0 + } + } + } else + if (message && typeof message === 'string' && message.indexOf('限流') > -1) { + throttledTokens.push(bingToken) + let bingTokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS')) + const badBingToken = bingTokens.findIndex(element => element.Token === bingToken) + const now = new Date() + const hours = now.getHours() + now.setHours(hours + 6) + bingTokens[badBingToken].State = '受限' + bingTokens[badBingToken].DisactivationTime = now + await redis.set('CHATGPT:BING_TOKENS', JSON.stringify(bingTokens)) // 不减次数 - } else if (message && typeof message === 'string' && message.indexOf('UnauthorizedRequest') > -1) { + } else if (message && typeof message === 'string' && message.indexOf('UnauthorizedRequest') > -1) { // token过期了 // let bingTokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS')) // const badBingToken = bingTokens.findIndex(element => element.Token === bingToken) @@ -1729,12 +1724,12 @@ export class chatgpt extends plugin { // bingTokens[badBingToken].exception = 1 // } // await redis.set('CHATGPT:BING_TOKENS', JSON.stringify(bingTokens)) - logger.warn(`token${bingToken}疑似不存在或已过期,再试试`) - retry = retry - 0.1 - } else { - retry-- - errorMessage = message === 'Timed out waiting for response. Try enabling debug mode to see more information.' ? (reply ? `${reply}\n不行了,我的大脑过载了,处理不过来了!` : '必应的小脑瓜不好使了,不知道怎么回答!') : message - } + logger.warn(`token${bingToken}疑似不存在或已过期,再试试`) + retry = retry - 0.1 + } else { + retry-- + errorMessage = message === 'Timed out waiting for response. Try enabling debug mode to see more information.' ? (reply ? `${reply}\n不行了,我的大脑过载了,处理不过来了!` : '必应的小脑瓜不好使了,不知道怎么回答!') : message + } } } while (retry > 0) if (errorMessage) { diff --git a/guoba.support.js b/guoba.support.js index 0d10068..9153cf5 100644 --- a/guoba.support.js +++ b/guoba.support.js @@ -465,6 +465,12 @@ export function supportGuoba () { bottomHelpMessage: '【一般情况无需也不建议开启】默认情况下仅创建对话走反代,对话时仍然直连微软。开启本选项将使对话过程也走反,需反代支持', component: 'Switch' }, + { + field: 'bingCaptchaOneShotUrl', + label: '必应验证码pass服务', + bottomHelpMessage: '必应出验证码会自动用该服务绕过', + component: 'Input' + }, { field: 'sydneyMood', label: '情感显示', diff --git a/utils/bingCaptcha.js b/utils/bingCaptcha.js index 3a6fe23..d0ebf11 100644 --- a/utils/bingCaptcha.js +++ b/utils/bingCaptcha.js @@ -1,9 +1,9 @@ import fetch from 'node-fetch' // this file is deprecated - -import { Config } from './config.js' +import {Config} from './config.js' import HttpsProxyAgent from 'https-proxy-agent' + const newFetch = (url, options = {}) => { const defaultOptions = Config.proxy ? { @@ -60,3 +60,31 @@ export async function solveCaptcha (id, regionId, text, token) { } } } + +export async function solveCaptchaOneShot (token) { + if (!token) { + throw new Error('no token') + } + let solveUrl = Config.bingCaptchaOneShotUrl + if (!solveUrl) { + throw new Error('no captcha source') + } + logger.info(`尝试解决token${token}的验证码`) + let result = await fetch(solveUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + _U: token + }) + }) + if (result.status === 200) { + return await result.json() + } else { + return { + success: false, + error: result.statusText + } + } +} diff --git a/utils/config.js b/utils/config.js index 808d366..36510bc 100644 --- a/utils/config.js +++ b/utils/config.js @@ -131,6 +131,7 @@ const defaultConfig = { serpSource: 'ikechan8370', extraUrl: 'https://cpe.ikechan8370.com', smartMode: false, + bingCaptchaOneShotUrl: 'http://bingcaptcha.ikechan8370.com/bing', version: 'v2.7.3' } const _path = process.cwd()