mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
Prettier format
This commit is contained in:
@@ -1548,7 +1548,8 @@ router.post('/claude-console-accounts', authenticateAdmin, async (req, res) => {
|
|||||||
priority: priority || 50,
|
priority: priority || 50,
|
||||||
supportedModels: supportedModels || [],
|
supportedModels: supportedModels || [],
|
||||||
userAgent,
|
userAgent,
|
||||||
rateLimitDuration: (rateLimitDuration !== undefined && rateLimitDuration !== null) ? rateLimitDuration : 60,
|
rateLimitDuration:
|
||||||
|
rateLimitDuration !== undefined && rateLimitDuration !== null ? rateLimitDuration : 60,
|
||||||
proxy,
|
proxy,
|
||||||
accountType: accountType || 'shared'
|
accountType: accountType || 'shared'
|
||||||
})
|
})
|
||||||
@@ -4628,7 +4629,8 @@ router.post('/openai-accounts', authenticateAdmin, async (req, res) => {
|
|||||||
description: description || '',
|
description: description || '',
|
||||||
accountType: accountType || 'shared',
|
accountType: accountType || 'shared',
|
||||||
priority: priority || 50,
|
priority: priority || 50,
|
||||||
rateLimitDuration: (rateLimitDuration !== undefined && rateLimitDuration !== null) ? rateLimitDuration : 60,
|
rateLimitDuration:
|
||||||
|
rateLimitDuration !== undefined && rateLimitDuration !== null ? rateLimitDuration : 60,
|
||||||
openaiOauth: openaiOauth || {},
|
openaiOauth: openaiOauth || {},
|
||||||
accountInfo: accountInfo || {},
|
accountInfo: accountInfo || {},
|
||||||
proxy: proxy?.enabled
|
proxy: proxy?.enabled
|
||||||
|
|||||||
@@ -123,7 +123,9 @@ class ClaudeConsoleAccountService {
|
|||||||
priority: parseInt(accountData.priority) || 50,
|
priority: parseInt(accountData.priority) || 50,
|
||||||
supportedModels: JSON.parse(accountData.supportedModels || '[]'),
|
supportedModels: JSON.parse(accountData.supportedModels || '[]'),
|
||||||
userAgent: accountData.userAgent,
|
userAgent: accountData.userAgent,
|
||||||
rateLimitDuration: (Number.isNaN(parseInt(accountData.rateLimitDuration)) ? 60 : parseInt(accountData.rateLimitDuration)),
|
rateLimitDuration: Number.isNaN(parseInt(accountData.rateLimitDuration))
|
||||||
|
? 60
|
||||||
|
: parseInt(accountData.rateLimitDuration),
|
||||||
isActive: accountData.isActive === 'true',
|
isActive: accountData.isActive === 'true',
|
||||||
proxy: accountData.proxy ? JSON.parse(accountData.proxy) : null,
|
proxy: accountData.proxy ? JSON.parse(accountData.proxy) : null,
|
||||||
accountType: accountData.accountType || 'shared',
|
accountType: accountData.accountType || 'shared',
|
||||||
@@ -373,7 +375,10 @@ class ClaudeConsoleAccountService {
|
|||||||
const minutesSinceRateLimit = (now - rateLimitedAt) / (1000 * 60)
|
const minutesSinceRateLimit = (now - rateLimitedAt) / (1000 * 60)
|
||||||
|
|
||||||
// 使用账户配置的限流时间
|
// 使用账户配置的限流时间
|
||||||
const rateLimitDuration = (typeof account.rateLimitDuration === 'number' && !Number.isNaN(account.rateLimitDuration)) ? account.rateLimitDuration : 60
|
const rateLimitDuration =
|
||||||
|
typeof account.rateLimitDuration === 'number' && !Number.isNaN(account.rateLimitDuration)
|
||||||
|
? account.rateLimitDuration
|
||||||
|
: 60
|
||||||
|
|
||||||
if (minutesSinceRateLimit >= rateLimitDuration) {
|
if (minutesSinceRateLimit >= rateLimitDuration) {
|
||||||
await this.removeAccountRateLimit(accountId)
|
await this.removeAccountRateLimit(accountId)
|
||||||
|
|||||||
@@ -146,7 +146,10 @@ async function createAccount(accountData) {
|
|||||||
accountType: accountData.accountType || 'shared',
|
accountType: accountData.accountType || 'shared',
|
||||||
groupId: accountData.groupId || null,
|
groupId: accountData.groupId || null,
|
||||||
priority: accountData.priority || 50,
|
priority: accountData.priority || 50,
|
||||||
rateLimitDuration: (accountData.rateLimitDuration !== undefined && accountData.rateLimitDuration !== null) ? accountData.rateLimitDuration : 60,
|
rateLimitDuration:
|
||||||
|
accountData.rateLimitDuration !== undefined && accountData.rateLimitDuration !== null
|
||||||
|
? accountData.rateLimitDuration
|
||||||
|
: 60,
|
||||||
// OAuth相关字段(加密存储)
|
// OAuth相关字段(加密存储)
|
||||||
idToken: encrypt(oauthData.idToken || ''),
|
idToken: encrypt(oauthData.idToken || ''),
|
||||||
accessToken: encrypt(oauthData.accessToken || ''),
|
accessToken: encrypt(oauthData.accessToken || ''),
|
||||||
|
|||||||
Reference in New Issue
Block a user