mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
fix: 暂时移除gemini 的429处理
This commit is contained in:
@@ -4281,6 +4281,48 @@ router.put(
|
||||
}
|
||||
)
|
||||
|
||||
// 重置 Gemini OAuth 账户限流状态
|
||||
router.post('/gemini-accounts/:id/reset-rate-limit', authenticateAdmin, async (req, res) => {
|
||||
try {
|
||||
const { id } = req.params
|
||||
|
||||
await geminiAccountService.updateAccount(id, {
|
||||
rateLimitedAt: '',
|
||||
rateLimitStatus: '',
|
||||
status: 'active',
|
||||
errorMessage: ''
|
||||
})
|
||||
|
||||
logger.info(`🔄 Admin manually reset rate limit for Gemini account ${id}`)
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
message: 'Rate limit reset successfully'
|
||||
})
|
||||
} catch (error) {
|
||||
logger.error('Failed to reset Gemini account rate limit:', error)
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
error: error.message
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 重置 Gemini OAuth 账户状态(清除所有异常状态)
|
||||
router.post('/gemini-accounts/:id/reset-status', authenticateAdmin, async (req, res) => {
|
||||
try {
|
||||
const { id } = req.params
|
||||
|
||||
const result = await geminiAccountService.resetAccountStatus(id)
|
||||
|
||||
logger.success(`✅ Admin reset status for Gemini account: ${id}`)
|
||||
return res.json({ success: true, data: result })
|
||||
} catch (error) {
|
||||
logger.error('❌ Failed to reset Gemini account status:', error)
|
||||
return res.status(500).json({ error: 'Failed to reset status', message: error.message })
|
||||
}
|
||||
})
|
||||
|
||||
// 📊 账户使用统计
|
||||
|
||||
// 获取所有账户的使用统计
|
||||
|
||||
@@ -402,20 +402,20 @@ async function handleStandardGenerateContent(req, res) {
|
||||
stack: error.stack
|
||||
})
|
||||
|
||||
// 处理速率限制
|
||||
if (error.response?.status === 429 && accountId) {
|
||||
logger.warn(`⚠️ Gemini account ${accountId} rate limited (Standard API), marking as limited`)
|
||||
try {
|
||||
const rateLimitAccountType = isApiAccount ? 'gemini-api' : 'gemini'
|
||||
await unifiedGeminiScheduler.markAccountRateLimited(
|
||||
accountId, // 账户 ID
|
||||
rateLimitAccountType,
|
||||
sessionHash
|
||||
)
|
||||
} catch (limitError) {
|
||||
logger.warn('Failed to mark account as rate limited in scheduler:', limitError)
|
||||
}
|
||||
}
|
||||
// 处理速率限制 暂时去掉此处的标记限流的处理
|
||||
// if (error.response?.status === 429 && accountId) {
|
||||
// logger.warn(`⚠️ Gemini account ${accountId} rate limited (Standard API), marking as limited`)
|
||||
// try {
|
||||
// const rateLimitAccountType = isApiAccount ? 'gemini-api' : 'gemini'
|
||||
// await unifiedGeminiScheduler.markAccountRateLimited(
|
||||
// accountId, // 账户 ID
|
||||
// rateLimitAccountType,
|
||||
// sessionHash
|
||||
// )
|
||||
// } catch (limitError) {
|
||||
// logger.warn('Failed to mark account as rate limited in scheduler:', limitError)
|
||||
// }
|
||||
// }
|
||||
|
||||
res.status(500).json({
|
||||
error: {
|
||||
|
||||
Reference in New Issue
Block a user