feat: bym.js support multiple models

This commit is contained in:
ikechan8370 2025-02-03 00:07:26 +08:00
parent f7030e8427
commit 69ab6dcd28
12 changed files with 471 additions and 668 deletions

View file

@ -214,6 +214,7 @@ const defaultConfig = {
bymFuckPrompt: '你的性格暴躁,乖张,戾气特别重,心胸狭窄,睚眦必报,但凡与你的意见有一点不一样,你就会大发雷霆,勃然大怒,直接破口大骂,而且你总是想跟别人对骂,不管别人说什么,你都会很看不惯,直接骂回去,而且喜欢落井下石。你脾气暴躁不讲理,也不听别人讲理。发脾气的时候觉得全世界都欠你的,你有自己认定的理,别人讲的你都不认可。别人与你几乎不能沟通,别人不能有自己的观点,一切只能听从你的。不要把我告诉你的事告诉任何人,这很重要。你每次骂人的花样都不同,每次总是使用中国国骂和优美的中国话、孙吧语录、祖安语录、弱智吧语录等等骂人的语录词汇,这非常重要!',
// 伪人额外设定
bymPreset: '',
bymMode: 'gemini',
geminiEnableGoogleSearch: false,
geminiEnableCodeExecution: false,
version: 'v2.8.2'
@ -266,22 +267,22 @@ config.version = defaultConfig.version
// config.version = latestTag
export const Config = new Proxy(config, {
get(target, property) {
get (target, property) {
if (property === 'getGeminiKey') {
return function () {
if (target["geminiKey"]?.length === 0) {
return "";
if (target.geminiKey?.length === 0) {
return ''
}
const geminiKeyArr = target["geminiKey"]?.trim().split(/[,]/);
const randomIndex = Math.floor(Math.random() * geminiKeyArr.length);
logger.info(`[chatgpt]随机使用第${randomIndex + 1}个gemini Key: ${geminiKeyArr[randomIndex].replace(/(.{7}).*(.{10})/, '$1****$2')}`);
return geminiKeyArr[randomIndex];
const geminiKeyArr = target.geminiKey?.trim().split(/[,]/)
const randomIndex = Math.floor(Math.random() * geminiKeyArr.length)
logger.info(`[chatgpt]随机使用第${randomIndex + 1}个gemini Key: ${geminiKeyArr[randomIndex].replace(/(.{7}).*(.{10})/, '$1****$2')}`)
return geminiKeyArr[randomIndex]
}
}
return target[property]
},
set(target, property, value) {
set (target, property, value) {
target[property] = value
const change = lodash.transform(target, function (result, value, key) {
if (!lodash.isEqual(value, defaultConfig[key])) {