Merge branch 'v2' into v2

This commit is contained in:
ycxom 2025-02-07 14:15:02 +08:00 committed by GitHub
commit 799b3a0769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 26 deletions

View file

@ -1,25 +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 { initializeImageTool } from '../utils/tools/ImageTool.js'
import { DailyNewsTool } from '../utils/tools/DailyNewsTool.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) {
@ -364,6 +365,15 @@ export class ChatgptManagement extends plugin {
}
]
})
this.task = [
{
cron: '0 0 */2 * * ?',
// cron: '*/1 * * * *',
name: 'refreshBingAi',
fnc: this.refreshBingAi,
log: false
}
]
this.reply = async (msg, quote, data) => {
if (!Config.enableMd) {
return e.reply(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')
}
}
}
}