mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 19:57:20 +00:00
chore
This commit is contained in:
@@ -157,7 +157,9 @@ class CostInitService {
|
||||
|
||||
for (let j = 0; j < results.length; j++) {
|
||||
const [err, values] = results[j]
|
||||
if (err) continue
|
||||
if (err) {
|
||||
continue
|
||||
}
|
||||
|
||||
// 将数组转换为对象
|
||||
const data = {}
|
||||
@@ -184,7 +186,9 @@ class CostInitService {
|
||||
const match = key.match(
|
||||
/usage:(.+):model:(daily|monthly|hourly):(.+):(\d{4}-\d{2}(?:-\d{2})?(?::\d{2})?)$/
|
||||
)
|
||||
if (!match) continue
|
||||
if (!match) {
|
||||
continue
|
||||
}
|
||||
|
||||
const [, , period, model, dateStr] = match
|
||||
|
||||
@@ -303,7 +307,9 @@ class CostInitService {
|
||||
cursor = newCursor
|
||||
|
||||
for (const usageKey of usageKeys) {
|
||||
if (samplesChecked >= maxSamples) break
|
||||
if (samplesChecked >= maxSamples) {
|
||||
break
|
||||
}
|
||||
|
||||
const match = usageKey.match(/usage:(.+):model:daily:(.+):(\d{4}-\d{2}-\d{2})$/)
|
||||
if (match) {
|
||||
@@ -321,7 +327,9 @@ class CostInitService {
|
||||
}
|
||||
}
|
||||
|
||||
if (samplesChecked >= maxSamples) break
|
||||
if (samplesChecked >= maxSamples) {
|
||||
break
|
||||
}
|
||||
} while (cursor !== '0')
|
||||
|
||||
logger.info('💰 Cost data appears to be up to date')
|
||||
|
||||
@@ -21,8 +21,12 @@ class DroidScheduler {
|
||||
_matchesEndpoint(account, endpointType) {
|
||||
const normalizedEndpoint = normalizeEndpointType(endpointType)
|
||||
const accountEndpoint = normalizeEndpointType(account?.endpointType)
|
||||
if (normalizedEndpoint === accountEndpoint) return true
|
||||
if (normalizedEndpoint === 'comm') return true
|
||||
if (normalizedEndpoint === accountEndpoint) {
|
||||
return true
|
||||
}
|
||||
if (normalizedEndpoint === 'comm') {
|
||||
return true
|
||||
}
|
||||
const sharedEndpoints = new Set(['anthropic', 'openai'])
|
||||
return sharedEndpoints.has(normalizedEndpoint) && sharedEndpoints.has(accountEndpoint)
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ class UnifiedOpenAIScheduler {
|
||||
let rateLimitChecked = false
|
||||
let stillLimited = false
|
||||
|
||||
let isSchedulable = isSchedulable(account.schedulable)
|
||||
let _isSchedulable = isSchedulable(account.schedulable)
|
||||
|
||||
if (!isSchedulable) {
|
||||
if (!_isSchedulable) {
|
||||
if (!hasRateLimitFlag) {
|
||||
return { canUse: false, reason: 'not_schedulable' }
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class UnifiedOpenAIScheduler {
|
||||
} else {
|
||||
account.schedulable = 'true'
|
||||
}
|
||||
isSchedulable = true
|
||||
_isSchedulable = true
|
||||
logger.info(`✅ OpenAI账号 ${account.name || accountId} 已解除限流,恢复调度权限`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user