This commit is contained in:
SunSeekerX
2026-01-03 23:20:05 +08:00
parent d8a33f9aa7
commit 74e71d0afc
4 changed files with 21 additions and 44 deletions

View File

@@ -1,35 +0,0 @@
{
"keep": {
"days": false,
"amount": 5
},
"auditLog": "D:\\code\\github\\claude-relay-service\\logs\\.claude-relay-audit.log.json",
"files": [
{
"date": 1766937830728,
"name": "D:\\code\\github\\claude-relay-service\\logs\\claude-relay-2025-12-29.log",
"hash": "d82c1d686e66788fe8083e7e0905e214a400c033e83cb6d2d30bfca72b079a5c"
},
{
"date": 1767024423693,
"name": "D:\\code\\github\\claude-relay-service\\logs\\claude-relay-2025-12-30.log",
"hash": "22671b37716c6044051919421a80eedbb42fff28937b467ff9a58eefe70a084c"
},
{
"date": 1767098022995,
"name": "/mnt/d/code/github/claude-relay-service/logs/claude-relay-2025-12-30.log",
"hash": "17b4d378f134d2d9d8a4e929b085d7e2121bcfced44b4ffe2860455b027bd2a7"
},
{
"date": 1767110489197,
"name": "/mnt/d/code/github/claude-relay-service/logs/claude-relay-2025-12-31.log",
"hash": "29305b4cd76e3e64212c41de27ee5c44d1525e090e3a6d157a18d3f4a14cb633"
},
{
"date": 1767197382349,
"name": "/mnt/d/code/github/claude-relay-service/logs/claude-relay-2026-01-01.log",
"hash": "57dea51b19fd2115b1b20ee5ecf1908ded5f709feb102c7210501b20786c1e35"
}
],
"hashType": "sha256"
}

View File

@@ -157,7 +157,9 @@ class CostInitService {
for (let j = 0; j < results.length; j++) { for (let j = 0; j < results.length; j++) {
const [err, values] = results[j] const [err, values] = results[j]
if (err) continue if (err) {
continue
}
// 将数组转换为对象 // 将数组转换为对象
const data = {} const data = {}
@@ -184,7 +186,9 @@ class CostInitService {
const match = key.match( const match = key.match(
/usage:(.+):model:(daily|monthly|hourly):(.+):(\d{4}-\d{2}(?:-\d{2})?(?::\d{2})?)$/ /usage:(.+):model:(daily|monthly|hourly):(.+):(\d{4}-\d{2}(?:-\d{2})?(?::\d{2})?)$/
) )
if (!match) continue if (!match) {
continue
}
const [, , period, model, dateStr] = match const [, , period, model, dateStr] = match
@@ -303,7 +307,9 @@ class CostInitService {
cursor = newCursor cursor = newCursor
for (const usageKey of usageKeys) { 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})$/) const match = usageKey.match(/usage:(.+):model:daily:(.+):(\d{4}-\d{2}-\d{2})$/)
if (match) { if (match) {
@@ -321,7 +327,9 @@ class CostInitService {
} }
} }
if (samplesChecked >= maxSamples) break if (samplesChecked >= maxSamples) {
break
}
} while (cursor !== '0') } while (cursor !== '0')
logger.info('💰 Cost data appears to be up to date') logger.info('💰 Cost data appears to be up to date')

View File

@@ -21,8 +21,12 @@ class DroidScheduler {
_matchesEndpoint(account, endpointType) { _matchesEndpoint(account, endpointType) {
const normalizedEndpoint = normalizeEndpointType(endpointType) const normalizedEndpoint = normalizeEndpointType(endpointType)
const accountEndpoint = normalizeEndpointType(account?.endpointType) const accountEndpoint = normalizeEndpointType(account?.endpointType)
if (normalizedEndpoint === accountEndpoint) return true if (normalizedEndpoint === accountEndpoint) {
if (normalizedEndpoint === 'comm') return true return true
}
if (normalizedEndpoint === 'comm') {
return true
}
const sharedEndpoints = new Set(['anthropic', 'openai']) const sharedEndpoints = new Set(['anthropic', 'openai'])
return sharedEndpoints.has(normalizedEndpoint) && sharedEndpoints.has(accountEndpoint) return sharedEndpoints.has(normalizedEndpoint) && sharedEndpoints.has(accountEndpoint)
} }

View File

@@ -56,9 +56,9 @@ class UnifiedOpenAIScheduler {
let rateLimitChecked = false let rateLimitChecked = false
let stillLimited = false let stillLimited = false
let isSchedulable = isSchedulable(account.schedulable) let _isSchedulable = isSchedulable(account.schedulable)
if (!isSchedulable) { if (!_isSchedulable) {
if (!hasRateLimitFlag) { if (!hasRateLimitFlag) {
return { canUse: false, reason: 'not_schedulable' } return { canUse: false, reason: 'not_schedulable' }
} }
@@ -75,7 +75,7 @@ class UnifiedOpenAIScheduler {
} else { } else {
account.schedulable = 'true' account.schedulable = 'true'
} }
isSchedulable = true _isSchedulable = true
logger.info(`✅ OpenAI账号 ${account.name || accountId} 已解除限流,恢复调度权限`) logger.info(`✅ OpenAI账号 ${account.name || accountId} 已解除限流,恢复调度权限`)
} }