fix: bing自动刷新;<EMPTY>匹配错误

This commit is contained in:
ikechan8370 2025-02-06 21:46:02 +08:00
parent f9a6fafb9e
commit e67a145635
4 changed files with 26 additions and 23 deletions

View file

@ -1,23 +1,6 @@
import { CustomGoogleGeminiClient } from '../client/CustomGoogleGeminiClient.js'
import { Config } from '../utils/config.js'
import { getImg } from '../utils/common.js'
import { getChatHistoryGroup } from '../utils/chat.js'
import { SearchVideoTool } from '../utils/tools/SearchBilibiliTool.js'
import { SerpImageTool } from '../utils/tools/SearchImageTool.js'
import { SearchMusicTool } from '../utils/tools/SearchMusicTool.js'
import { SendAvatarTool } from '../utils/tools/SendAvatarTool.js'
import { SendVideoTool } from '../utils/tools/SendBilibiliTool.js'
import { SendMusicTool } from '../utils/tools/SendMusicTool.js'
import { SendPictureTool } from '../utils/tools/SendPictureTool.js'
import { WebsiteTool } from '../utils/tools/WebsiteTool.js'
import { convertFaces } from '../utils/face.js'
import { WeatherTool } from '../utils/tools/WeatherTool.js'
import { EditCardTool } from '../utils/tools/EditCardTool.js'
import { JinyanTool } from '../utils/tools/JinyanTool.js'
import { KickOutTool } from '../utils/tools/KickOutTool.js'
import { SetTitleTool } from '../utils/tools/SetTitleTool.js'
import { SerpTool } from '../utils/tools/SerpTool.js'
import { SendMessageToSpecificGroupOrUserTool } from '../utils/tools/SendMessageToSpecificGroupOrUserTool.js'
import { customSplitRegex, filterResponseChunk } from '../utils/text.js'
import core from '../model/core.js'

View file

@ -24,6 +24,7 @@ import { supportConfigurations as azureRoleList } from '../utils/tts/microsoft-a
import fetch from 'node-fetch'
import { newFetch } from '../utils/proxy.js'
import { createServer, runServer, stopServer } from '../server/index.js'
import { BingAIClient } from '../client/CopilotAIClient.js'
export class ChatgptManagement extends plugin {
constructor (e) {
@ -362,6 +363,15 @@ export class ChatgptManagement extends plugin {
reg: '^#(chatgpt)?(Copilot|Bing|必应)配置方法',
fnc: 'copilotSetting'
}
],
task: [
{
cron: '0 */2 * * * ?',
// cron: '*/1 * * * *',
name: 'refreshBingAi',
fnc: 'refreshBingAi',
log: false
}
]
})
this.reply = async (msg, quote, data) => {
@ -1848,7 +1858,6 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
}
}
async switchBYM (e) {
if (e.msg.includes('开启')) {
if (Config.enableBYM) {
@ -1916,4 +1925,15 @@ azure语音Azure 语音是微软 Azure 平台提供的一项语音服务,
await e.reply('操作成功')
}
async refreshBingAi () {
if (Config.bingAiRefreshToken) {
let client = new BingAIClient(Config.bingAiToken, Config.sydneyReverseProxy, Config.debug, Config._2captchaKey, Config.bingAiClientId, Config.bingAiScope, Config.bingAiRefreshToken, Config.bingAiOid, Config.bingReasoning)
let json = await client.doRefreshToken()
if (json.refresh_token) {
logger.mark('Bing AI Token Refreshed')
} else {
logger.mark('Failed to refresh Bing AI Token')
}
}
}
}