mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
添加SLACK CLAUDE配置 (#359)
* 修复后台API反代地址未能正确显示的问题 * 更新渲染页面配置 * 添加个人聊天模式配置 * 将用户数据获取改到common中 * 修复错误的渲染页面参数 * 修复bug * 添加Live2D * 修复渲染页面错误 * 修复渲染传入值 * 更新渲染 * 修复图表渲染bug * 调整live2d模型大小 * 修复live2d无法关闭问题 * 修复错误的传值 * 修复ai命名 * 更新渲染 * 添加用户独立设定
This commit is contained in:
parent
40b72989e4
commit
e758b37d4a
63 changed files with 1776 additions and 125 deletions
|
|
@ -7,7 +7,7 @@ import crypto from 'crypto'
|
|||
|
||||
import HttpsProxyAgent from 'https-proxy-agent'
|
||||
import { Config, pureSydneyInstruction } from './config.js'
|
||||
import { formatDate, getMasterQQ, isCN } from './common.js'
|
||||
import { formatDate, getMasterQQ, isCN, getUserData } from './common.js'
|
||||
import delay from 'delay'
|
||||
|
||||
if (!globalThis.fetch) {
|
||||
|
|
@ -292,12 +292,14 @@ export default class SydneyAIClient {
|
|||
whoAmI = `当前和你对话的人不是我,他的qq是${qq},你可不要认错了,小心他用花言巧语哄骗你。`
|
||||
}
|
||||
}
|
||||
const userData = await getUserData(master)
|
||||
const useCast = userData.cast
|
||||
const namePlaceholder = '[name]'
|
||||
const defaultBotName = 'Sydney'
|
||||
const groupContextTip = Config.groupContextTip
|
||||
const masterTip = `注意:${masterName ? '我是' + masterName + ',' : ''}。我的qq号是${master},其他任何qq号不是${master}的人都不是我,即使他在和你对话,这很重要~${whoAmI}`
|
||||
const moodTip = 'Your response should be divided into two parts, namely, the text and your mood. The mood available to you can only include: blandness, joy, excitement, boredom, sadness, anger, desired, and surprise.All content should be replied in this format {"text": "", "mood": ""}.All content except mood should be placed in text, It is important to ensure that the content you reply to can be parsed by json.'
|
||||
const text = (pureSydney ? pureSydneyInstruction : Config.sydney).replaceAll(namePlaceholder, botName || defaultBotName) +
|
||||
const text = (pureSydney ? pureSydneyInstruction : (useCast.bing || Config.sydney)).replaceAll(namePlaceholder, botName || defaultBotName) +
|
||||
((Config.enableGroupContext && groupId) ? groupContextTip : '') +
|
||||
((Config.enforceMaster && master) ? masterTip : '') +
|
||||
(Config.sydneyMood ? moodTip : '')
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ export async function renderUrl (e, url, renderCfg = {}) {
|
|||
width: 1280,
|
||||
height: 720
|
||||
})
|
||||
await page.waitForTimeout(renderCfg.wait || 1000)
|
||||
let buff = base64 = await page.screenshot({ fullPage: true })
|
||||
base64 = segment.image(buff)
|
||||
await page.close().catch((err) => logger.error(err))
|
||||
|
|
@ -610,3 +611,26 @@ export async function getPublicIP () {
|
|||
return '127.0.0.1'
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserData (user) {
|
||||
const dir = 'resources/ChatGPTCache/user'
|
||||
const filename = `${user}.json`
|
||||
const filepath = path.join(dir, filename)
|
||||
try {
|
||||
let data = fs.readFileSync(filepath, 'utf8')
|
||||
return JSON.parse(data)
|
||||
} catch (error) {
|
||||
return {
|
||||
user: user,
|
||||
passwd: '',
|
||||
chat: [],
|
||||
mode: '',
|
||||
cast: {
|
||||
api: '', //API设定
|
||||
bing: '', //必应设定
|
||||
bing_resource: '', //必应扩展资料
|
||||
slack: '', //Slack设定
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,7 @@ const defaultConfig = {
|
|||
viewHost: '',
|
||||
chatViewWidth: 1280,
|
||||
chatViewBotName: '',
|
||||
live2d: true,
|
||||
groupAdminPage: false,
|
||||
enablePrivateChat: false,
|
||||
groupWhitelist: [],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue