mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
适配Trss (#575)
* fix: 修复星火api上下文 * 将无星火ck的情况降低为warn * feat: 添加星火设定自定义代码功能 * 修复星火api模式的一些问题 * 修复导出配置问题 * feat:添加工具箱快捷登录接口 * 添加工具箱快捷登录指令 * 阻止群聊使用快捷登录 * 添加Azure配置支持,修复重复的配置项冲突 * 移除旧版本渲染和新版本帮助 * 添加工具箱 * 更新工具箱替换原有后台 * 更新工具箱适配代码 * 后台适配Trss * 修复trss不支持sendPrivateMsg的问题 * 优化路由 * 修复路由 * 适配其他uin
This commit is contained in:
parent
64f2699b22
commit
0f9c8a7abe
10 changed files with 73 additions and 37 deletions
|
|
@ -84,14 +84,14 @@ export async function makeForwardMsg (e, msg = [], dec = '') {
|
|||
let nickname = Bot.nickname
|
||||
if (e.isGroup) {
|
||||
try {
|
||||
let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin)
|
||||
let info = await Bot.getGroupMemberInfo(e.group_id, getUin(e))
|
||||
nickname = info.card || info.nickname
|
||||
} catch (err) {
|
||||
console.error(`Failed to get group member info: ${err}`)
|
||||
}
|
||||
}
|
||||
let userInfo = {
|
||||
user_id: Bot.uin,
|
||||
user_id: getUin(e),
|
||||
nickname
|
||||
}
|
||||
|
||||
|
|
@ -821,6 +821,14 @@ export function getMaxModelTokens (model = 'gpt-3.5-turbo') {
|
|||
}
|
||||
}
|
||||
|
||||
export function getUin (e) {
|
||||
if (e?.bot?.uin) return e.bot.uin
|
||||
if (Array.isArray(Bot.uin)) {
|
||||
if (Config.trssBotUin && Bot.uin.indexOf(Config.trssBotUin) > -1) return Config.trssBotUin
|
||||
else return Bot.uin[0]
|
||||
} else return Bot.uin
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成当前语音模式下可发送的音频信息
|
||||
* @param e - 上下文对象
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ const defaultConfig = {
|
|||
claudeAITimeout: 120,
|
||||
claudeAIJA3: '772,4865-4866-4867-49195-49199-49196-49200-52393-52392-49171-49172-156-157-47-53,27-5-65281-13-35-0-51-18-16-43-10-45-11-17513-23,29-23-24,0',
|
||||
claudeAIUA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
|
||||
// trss配置
|
||||
trssBotUin: '',
|
||||
version: 'v2.7.5'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import crypto from 'crypto'
|
|||
import child_process from 'child_process'
|
||||
import { Config } from './config.js'
|
||||
import path from 'path'
|
||||
import { mkdirs } from './common.js'
|
||||
import { mkdirs, getUin } from './common.js'
|
||||
let module
|
||||
try {
|
||||
module = await import('oicq')
|
||||
|
|
@ -139,7 +139,7 @@ async function uploadRecord (recordUrl, ttsMode = 'vits-uma-genshin-honkai') {
|
|||
2: 3,
|
||||
5: {
|
||||
1: Contactable.target,
|
||||
2: Bot.uin,
|
||||
2: getUin(e),
|
||||
3: 0,
|
||||
4: hash,
|
||||
5: buf.length,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue