feat: add bymFuckList Configuration (#737)

* feat: add bymFuckList

* feat: geminikey load balancing

* add: console.log()

* fix:  whole key

* fix:  whole key

* feat: geminikey load balancing
This commit is contained in:
syfantasy 2025-01-02 16:06:30 +08:00 committed by GitHub
parent 5692af692b
commit 1c34ecbb83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View file

@ -266,6 +266,17 @@ config.version = defaultConfig.version
// config.version = latestTag
export const Config = new Proxy(config, {
get(target, property) {
if (property === 'geminiKey') {
if (typeof target[property] === 'string' && target[property].includes(',')) {
const keys = target[property].split(',').map(key => key.trim()).filter(Boolean)
const selectedKey = keys[Math.floor(Math.random() * keys.length)]
console.log(`[ChatGPT-Plugin] 当前使用的Gemini Key: ${selectedKey.slice(0, 8)}...`)
return selectedKey
}
}
return target[property]
},
set (target, property, value) {
target[property] = value
const change = lodash.transform(target, function (result, value, key) {