feat: 新增Claude账号订阅类型设置

1. OAuth可自动判断订阅类型,Setup Token请自行选择。无论那种类型都可以自己改
2. 优化调度,Pro账号不再接受opus模型请求的调度
This commit is contained in:
KevinLiao
2025-08-14 16:43:58 +08:00
parent 1224ade5a7
commit 0e5f4e03c1
7 changed files with 697 additions and 22 deletions

View File

@@ -1376,6 +1376,46 @@ router.delete('/claude-accounts/:accountId', authenticateAdmin, async (req, res)
}
})
// 更新单个Claude账户的Profile信息
router.post('/claude-accounts/:accountId/update-profile', authenticateAdmin, async (req, res) => {
try {
const { accountId } = req.params
const profileInfo = await claudeAccountService.fetchAndUpdateAccountProfile(accountId)
logger.success(`✅ Updated profile for Claude account: ${accountId}`)
return res.json({
success: true,
message: 'Account profile updated successfully',
data: profileInfo
})
} catch (error) {
logger.error('❌ Failed to update account profile:', error)
return res
.status(500)
.json({ error: 'Failed to update account profile', message: error.message })
}
})
// 批量更新所有Claude账户的Profile信息
router.post('/claude-accounts/update-all-profiles', authenticateAdmin, async (req, res) => {
try {
const result = await claudeAccountService.updateAllAccountProfiles()
logger.success('✅ Batch profile update completed')
return res.json({
success: true,
message: 'Batch profile update completed',
data: result
})
} catch (error) {
logger.error('❌ Failed to update all account profiles:', error)
return res
.status(500)
.json({ error: 'Failed to update all account profiles', message: error.message })
}
})
// 刷新Claude账户token
router.post('/claude-accounts/:accountId/refresh', authenticateAdmin, async (req, res) => {
try {