Skip to content

Commit

Permalink
🔑 [refactor] Improve API key and AWS credentials management
Browse files Browse the repository at this point in the history
- Translate comments to English for consistency
- Add explanatory comment for AWS credentials function
- Refactor default region assignment with inline comment
  • Loading branch information
Sunwood-ai-labs committed Oct 17, 2024
1 parent d86eaa4 commit 2470806
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/lib/.server/llm/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ export function getAPIKey(cloudflareEnv: Env, provider: string) {
return env.GROQ_API_KEY || cloudflareEnv.GROQ_API_KEY;
case 'OpenRouter':
return env.OPEN_ROUTER_API_KEY || cloudflareEnv.OPEN_ROUTER_API_KEY;
// Bedrock用のAWSクレデンシャルは別途取得
// AWS credentials for Bedrock are obtained separately
default:
return "";
}
}

// This function retrieves AWS credentials from environment variables
export function getAWSCredentials(cloudflareEnv: Env) {
return {
accessKeyId: env.AWS_ACCESS_KEY_ID || cloudflareEnv.AWS_ACCESS_KEY_ID,
secretAccessKey: env.AWS_SECRET_ACCESS_KEY || cloudflareEnv.AWS_SECRET_ACCESS_KEY,
region: env.AWS_REGION || cloudflareEnv.AWS_REGION || 'us-east-1', // デフォルトリージョン
region: env.AWS_REGION || cloudflareEnv.AWS_REGION || 'us-east-1', // Default region
};
}

0 comments on commit 2470806

Please sign in to comment.