feat(bedrock): 支持 bedrock_proxy_url 代理配置

从 Dify provider_credentials 的 encrypted_config 中读取 bedrock_proxy_url 字段,
若非空则将 HTTP 请求经该代理(host:port 或 http://host:port)转发到 AWS Bedrock,
不再强制直连 bedrock-runtime.{region}.amazonaws.com。
变更:
- ProviderCredentials 新增 BedrockProxyURL 字段
- ConfigKeyBedrockProxyURL 常量
- GetDifyProviderCredentials 提取 bedrock_proxy_url(明文,不解密)
- proxyBedrockRequest 根据 BedrockProxyURL 配置 http.Transport.Proxy
This commit is contained in:
npc0-hue
2026-04-24 09:59:56 +08:00
parent ea77171028
commit 3bad30bff1
3 changed files with 19 additions and 2 deletions
@@ -28,6 +28,7 @@ const (
ConfigKeyAWSSecretAccessKey = "aws_secret_access_key"
ConfigKeyAWSSessionToken = "aws_session_token"
ConfigKeyAWSRegion = "aws_region"
ConfigKeyBedrockProxyURL = "bedrock_proxy_url" // 可选:HTTP 代理地址,格式 host:port 或 http://host:port
)
// SupportedProviders 列表展示的提供商顺序
@@ -11,6 +11,8 @@ type ProviderCredentials struct {
AWSSecretAccessKey string `json:"aws_secret_access_key,omitempty"`
AWSSessionToken string `json:"aws_session_token,omitempty"`
AWSRegion string `json:"aws_region,omitempty"`
// Bedrock 可选代理地址(host:port 或 http://host:port),非空时请求经该代理转发到 AWS
BedrockProxyURL string `json:"bedrock_proxy_url,omitempty"`
}
// ModelInfo 模型信息