feat: Add comprehensive Amazon Bedrock integration support

Add complete Amazon Bedrock integration to Claude Relay Service with:

## Core Features
-  Bedrock account management with encrypted AWS credential storage
-  Full request routing to AWS Bedrock with streaming support
-  Integration with unified Claude scheduler system
-  Support for Inference Profiles and Application Inference Profiles
-  Configurable default and small-fast model settings

## Backend Services
- Add bedrockAccountService.js for account management
- Add bedrockRelayService.js for request forwarding
- Integrate Bedrock accounts into unifiedClaudeScheduler.js
- Update admin and API routes to support Bedrock endpoints
- Add comprehensive configuration options to config.example.js

## Frontend Integration
- Complete Vue.js Web UI for Bedrock account management
- Account creation form with AWS credentials and model configuration
- Real-time account status monitoring and statistics
- Edit/update capabilities for existing accounts

## CLI Support
- Interactive CLI commands for Bedrock account operations
- Account creation, listing, updating, and testing
- Status monitoring and connection validation

## Security & Performance
- AES encrypted storage of AWS credentials in Redis
- Support for temporary credentials (session tokens)
- Region-specific configuration support
- Rate limiting and error handling

This integration enables the relay service to support three AI platforms:
1. Claude (OAuth) - Original Claude.ai integration
2. Gemini - Google AI integration
3. Amazon Bedrock - New AWS Bedrock integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andersonby
2025-08-06 17:41:16 +08:00
parent d6ba97381d
commit 9a9a82c86f
14 changed files with 3493 additions and 23 deletions

View File

@@ -6,6 +6,7 @@ export const useAccountsStore = defineStore('accounts', () => {
// 状态
const claudeAccounts = ref([])
const claudeConsoleAccounts = ref([])
const bedrockAccounts = ref([])
const geminiAccounts = ref([])
const loading = ref(false)
const error = ref(null)
@@ -52,6 +53,25 @@ export const useAccountsStore = defineStore('accounts', () => {
}
}
// 获取Bedrock账户列表
const fetchBedrockAccounts = async () => {
loading.value = true
error.value = null
try {
const response = await apiClient.get('/admin/bedrock-accounts')
if (response.success) {
bedrockAccounts.value = response.data || []
} else {
throw new Error(response.message || '获取Bedrock账户失败')
}
} catch (err) {
error.value = err.message
throw err
} finally {
loading.value = false
}
}
// 获取Gemini账户列表
const fetchGeminiAccounts = async () => {
loading.value = true
@@ -79,6 +99,7 @@ export const useAccountsStore = defineStore('accounts', () => {
await Promise.all([
fetchClaudeAccounts(),
fetchClaudeConsoleAccounts(),
fetchBedrockAccounts(),
fetchGeminiAccounts()
])
} catch (err) {
@@ -129,6 +150,26 @@ export const useAccountsStore = defineStore('accounts', () => {
}
}
// 创建Bedrock账户
const createBedrockAccount = async (data) => {
loading.value = true
error.value = null
try {
const response = await apiClient.post('/admin/bedrock-accounts', data)
if (response.success) {
await fetchBedrockAccounts()
return response.data
} else {
throw new Error(response.message || '创建Bedrock账户失败')
}
} catch (err) {
error.value = err.message
throw err
} finally {
loading.value = false
}
}
// 创建Gemini账户
const createGeminiAccount = async (data) => {
loading.value = true
@@ -189,6 +230,26 @@ export const useAccountsStore = defineStore('accounts', () => {
}
}
// 更新Bedrock账户
const updateBedrockAccount = async (id, data) => {
loading.value = true
error.value = null
try {
const response = await apiClient.put(`/admin/bedrock-accounts/${id}`, data)
if (response.success) {
await fetchBedrockAccounts()
return response
} else {
throw new Error(response.message || '更新Bedrock账户失败')
}
} catch (err) {
error.value = err.message
throw err
} finally {
loading.value = false
}
}
// 更新Gemini账户
const updateGeminiAccount = async (id, data) => {
loading.value = true
@@ -219,6 +280,8 @@ export const useAccountsStore = defineStore('accounts', () => {
endpoint = `/admin/claude-accounts/${id}/toggle`
} else if (platform === 'claude-console') {
endpoint = `/admin/claude-console-accounts/${id}/toggle`
} else if (platform === 'bedrock') {
endpoint = `/admin/bedrock-accounts/${id}/toggle`
} else {
endpoint = `/admin/gemini-accounts/${id}/toggle`
}
@@ -229,6 +292,8 @@ export const useAccountsStore = defineStore('accounts', () => {
await fetchClaudeAccounts()
} else if (platform === 'claude-console') {
await fetchClaudeConsoleAccounts()
} else if (platform === 'bedrock') {
await fetchBedrockAccounts()
} else {
await fetchGeminiAccounts()
}
@@ -254,6 +319,8 @@ export const useAccountsStore = defineStore('accounts', () => {
endpoint = `/admin/claude-accounts/${id}`
} else if (platform === 'claude-console') {
endpoint = `/admin/claude-console-accounts/${id}`
} else if (platform === 'bedrock') {
endpoint = `/admin/bedrock-accounts/${id}`
} else {
endpoint = `/admin/gemini-accounts/${id}`
}
@@ -264,6 +331,8 @@ export const useAccountsStore = defineStore('accounts', () => {
await fetchClaudeAccounts()
} else if (platform === 'claude-console') {
await fetchClaudeConsoleAccounts()
} else if (platform === 'bedrock') {
await fetchBedrockAccounts()
} else {
await fetchGeminiAccounts()
}
@@ -374,6 +443,7 @@ export const useAccountsStore = defineStore('accounts', () => {
const reset = () => {
claudeAccounts.value = []
claudeConsoleAccounts.value = []
bedrockAccounts.value = []
geminiAccounts.value = []
loading.value = false
error.value = null
@@ -385,6 +455,7 @@ export const useAccountsStore = defineStore('accounts', () => {
// State
claudeAccounts,
claudeConsoleAccounts,
bedrockAccounts,
geminiAccounts,
loading,
error,
@@ -394,13 +465,16 @@ export const useAccountsStore = defineStore('accounts', () => {
// Actions
fetchClaudeAccounts,
fetchClaudeConsoleAccounts,
fetchBedrockAccounts,
fetchGeminiAccounts,
fetchAllAccounts,
createClaudeAccount,
createClaudeConsoleAccount,
createBedrockAccount,
createGeminiAccount,
updateClaudeAccount,
updateClaudeConsoleAccount,
updateBedrockAccount,
updateGeminiAccount,
toggleAccount,
deleteAccount,