mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
feat: ProviderOpsConfig 支持独立存储 base_url
将 base_url 作为 ProviderOpsConfig 的独立字段存储, 获取时优先读取配置中的值,否则回退到 endpoint/provider。
This commit is contained in:
@@ -177,8 +177,8 @@ class ProviderOpsService:
|
||||
registry = get_registry()
|
||||
architecture = registry.get_or_default(config.architecture_id)
|
||||
|
||||
# 获取 base_url
|
||||
base_url = self._get_provider_base_url(provider)
|
||||
# 获取 base_url:优先从 config 读取
|
||||
base_url = config.base_url or self._get_provider_base_url(provider)
|
||||
if not base_url:
|
||||
return False, "Provider 未配置 base_url"
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ class ProviderOpsConfig:
|
||||
"""Provider 操作配置(存储在 Provider.config['provider_ops'] 中)"""
|
||||
|
||||
architecture_id: str = "generic_api"
|
||||
base_url: Optional[str] = None # API 基础地址
|
||||
|
||||
# 连接器配置
|
||||
connector_auth_type: ConnectorAuthType = ConnectorAuthType.API_KEY
|
||||
@@ -134,6 +135,7 @@ class ProviderOpsConfig:
|
||||
|
||||
return cls(
|
||||
architecture_id=data.get("architecture_id", "generic_api"),
|
||||
base_url=data.get("base_url"),
|
||||
connector_auth_type=ConnectorAuthType(
|
||||
data.get("connector", {}).get("auth_type", "api_key")
|
||||
),
|
||||
@@ -147,6 +149,7 @@ class ProviderOpsConfig:
|
||||
"""转换为字典(用于存储)"""
|
||||
return {
|
||||
"architecture_id": self.architecture_id,
|
||||
"base_url": self.base_url,
|
||||
"connector": {
|
||||
"auth_type": self.connector_auth_type.value,
|
||||
"config": self.connector_config,
|
||||
|
||||
Reference in New Issue
Block a user