fix: 修复gemini转发未响应问题

This commit is contained in:
shaw
2025-11-20 21:02:43 +08:00
parent 61929874eb
commit 823be8acfc
2 changed files with 9 additions and 10 deletions

View File

@@ -279,7 +279,7 @@ async function sendGeminiRequest({
// 添加代理配置
const proxyAgent = createProxyAgent(proxy)
if (proxyAgent) {
axiosConfig.httpAgent = proxyAgent
// 只设置 httpsAgent,因为目标 URL 是 HTTPS (cloudcode.googleapis.com)
axiosConfig.httpsAgent = proxyAgent
axiosConfig.proxy = false
logger.info(`🌐 Using proxy for Gemini API request: ${ProxyHelper.getProxyDescription(proxy)}`)
@@ -389,7 +389,7 @@ async function getAvailableModels(accessToken, proxy, projectId, location = 'us-
const proxyAgent = createProxyAgent(proxy)
if (proxyAgent) {
axiosConfig.httpAgent = proxyAgent
// 只设置 httpsAgent,因为目标 URL 是 HTTPS (cloudcode.googleapis.com)
axiosConfig.httpsAgent = proxyAgent
axiosConfig.proxy = false
logger.info(
@@ -492,7 +492,7 @@ async function countTokens({
// 添加代理配置
const proxyAgent = createProxyAgent(proxy)
if (proxyAgent) {
axiosConfig.httpAgent = proxyAgent
// 只设置 httpsAgent,因为目标 URL 是 HTTPS (cloudcode.googleapis.com)
axiosConfig.httpsAgent = proxyAgent
axiosConfig.proxy = false
logger.info(