mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
修复Miao-Yunzai无法使用新渲染的问题 (#372)
* 修复后台API反代地址未能正确显示的问题 * 更新渲染页面配置 * 添加个人聊天模式配置 * 将用户数据获取改到common中 * 修复错误的渲染页面参数 * 修复bug * 添加Live2D * 修复渲染页面错误 * 修复渲染传入值 * 更新渲染 * 修复图表渲染bug * 调整live2d模型大小 * 修复live2d无法关闭问题 * 修复错误的传值 * 修复ai命名 * 更新渲染 * 添加用户独立设定 * 更新渲染配置适配个人设置 * 修复合并导致的渲染文件异常删除 * 修复用户数据缺失问题 * 修复旧版本数据缺失问题 * 修复bing参数不存在问题,兼容miao的截图 * 修复受限token重试时不被排除的问题
This commit is contained in:
parent
3e1fcad103
commit
36a51856c5
3 changed files with 25 additions and 6 deletions
|
|
@ -1430,9 +1430,9 @@ export class chatgpt extends plugin {
|
|||
let conversationId = await redis.get(`CHATGPT:SLACK_CONVERSATION:${e.sender.user_id}`)
|
||||
if (!conversationId) {
|
||||
// 如果是新对话
|
||||
if (Config.slackClaudeEnableGlobalPreset && (useCast.slack || Config.slackClaudeGlobalPreset)) {
|
||||
if (Config.slackClaudeEnableGlobalPreset && (useCast?.slack || Config.slackClaudeGlobalPreset)) {
|
||||
// 先发送设定
|
||||
await client.sendMessage(useCast.slack || Config.slackClaudeGlobalPreset, e)
|
||||
await client.sendMessage(useCast?.slack || Config.slackClaudeGlobalPreset, e)
|
||||
}
|
||||
}
|
||||
let text = await client.sendMessage(prompt, e)
|
||||
|
|
@ -1446,7 +1446,7 @@ export class chatgpt extends plugin {
|
|||
completionParams.model = Config.model
|
||||
}
|
||||
const currentDate = new Date().toISOString().split('T')[0]
|
||||
let promptPrefix = `You are ${Config.assistantLabel} ${useCast.api || Config.promptPrefixOverride || defaultPropmtPrefix}
|
||||
let promptPrefix = `You are ${Config.assistantLabel} ${useCast?.api || Config.promptPrefixOverride || defaultPropmtPrefix}
|
||||
Knowledge cutoff: 2021-09. Current date: ${currentDate}`
|
||||
let opts = {
|
||||
apiBaseUrl: Config.openAiBaseUrl,
|
||||
|
|
@ -1690,7 +1690,7 @@ async function getAvailableBingToken (conversation, throttled = []) {
|
|||
return current.Usage < min.Usage ? current : min
|
||||
})
|
||||
bingToken = minElement.Token
|
||||
} else if (restricted.length > 0) {
|
||||
} else if (restricted.length > 0 && restricted.some(x => throttled.includes(x.Token))) {
|
||||
allThrottled = true
|
||||
const minElement = restricted.reduce((min, current) => {
|
||||
return current.Usage < min.Usage ? current : min
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ export default class SydneyAIClient {
|
|||
}
|
||||
}
|
||||
const userData = await getUserData(master)
|
||||
const useCast = userData.cast
|
||||
const useCast = userData.cast || {}
|
||||
const namePlaceholder = '[name]'
|
||||
const defaultBotName = 'Sydney'
|
||||
const groupContextTip = Config.groupContextTip
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import lodash from 'lodash'
|
|||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import buffer from 'buffer'
|
||||
import puppeteer from '../../../lib/puppeteer/puppeteer.js'
|
||||
import yaml from 'yaml'
|
||||
// import puppeteer from '../../../lib/puppeteer/puppeteer.js'
|
||||
import { Config } from './config.js'
|
||||
// export function markdownToText (markdown) {
|
||||
// return remark()
|
||||
|
|
@ -14,6 +15,24 @@ import { Config } from './config.js'
|
|||
// .toString()
|
||||
// }
|
||||
|
||||
let puppeteer
|
||||
try {
|
||||
const Puppeteer = (await import('../../../renderers/puppeteer/lib/puppeteer.js')).default
|
||||
let puppeteerCfg = {}
|
||||
let configFile = `./renderers/puppeteer/config.yaml`
|
||||
if (fs.existsSync(configFile)) {
|
||||
try {
|
||||
puppeteerCfg = yaml.parse(fs.readFileSync(configFile, 'utf8'))
|
||||
} catch (e) {
|
||||
puppeteerCfg = {}
|
||||
}
|
||||
}
|
||||
puppeteer = new Puppeteer(puppeteerCfg)
|
||||
} catch (e) {
|
||||
logger.warn('未能加载puppeteer,尝试降级到Yunzai的puppeteer尝试')
|
||||
puppeteer = (await import('../../../lib/puppeteer/puppeteer.js')).default
|
||||
}
|
||||
|
||||
let localIP = ''
|
||||
export function escapeHtml (str) {
|
||||
const htmlEntities = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue