From e11a299dfe929c3f7be5b3677217fff5569ea4dc Mon Sep 17 00:00:00 2001 From: syfantasy <115546901+syfantasy@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:10:47 +0800 Subject: [PATCH] add: console.log() --- utils/config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/config.js b/utils/config.js index 955beb0..81724a4 100644 --- a/utils/config.js +++ b/utils/config.js @@ -268,9 +268,13 @@ config.version = defaultConfig.version export const Config = new Proxy(config, { get(target, property) { if (property === 'geminiKey') { + // 如果配置中的geminiKey包含逗号,说明是多个key if (typeof target[property] === 'string' && target[property].includes(',')) { const keys = target[property].split(',').map(key => key.trim()).filter(Boolean) - return keys[Math.floor(Math.random() * keys.length)] + // 随机返回其中一个key + const selectedKey = keys[Math.floor(Math.random() * keys.length)] + console.log(`[ChatGPT-Plugin] 当前使用的Gemini Key: ${selectedKey.slice(0, 8)}...`) // 只显示key的前8位,后面用...代替 + return selectedKey } } return target[property]