mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
feat: 格式转换支持三层开关控制(全局/Provider/端点)
- _get_convertible_formats 始终返回所有可转换格式,由下游精确过滤 - get_compatible_provider_formats 增加 Provider 级别 enable_format_conversion 判断 - Provider 设置更新后自动失效相关缓存(模型列表、解析缓存、Provider 缓存) - 前端 toggleFormatConversion 使用接口返回的完整对象更新本地状态
This commit is contained in:
@@ -289,6 +289,7 @@ def get_compatible_provider_formats(
|
||||
ProviderEndpoint.api_family,
|
||||
ProviderEndpoint.endpoint_kind,
|
||||
ProviderEndpoint.format_acceptance_config,
|
||||
Provider.enable_format_conversion,
|
||||
)
|
||||
.join(Provider, ProviderEndpoint.provider_id == Provider.id)
|
||||
.filter(
|
||||
@@ -302,16 +303,24 @@ def get_compatible_provider_formats(
|
||||
)
|
||||
|
||||
provider_to_formats: dict[str, set[str]] = {}
|
||||
for provider_id, api_family, endpoint_kind, format_acceptance_config in endpoint_rows:
|
||||
for (
|
||||
provider_id,
|
||||
api_family,
|
||||
endpoint_kind,
|
||||
format_acceptance_config,
|
||||
provider_conversion_enabled,
|
||||
) in endpoint_rows:
|
||||
if not provider_id or not api_family or not endpoint_kind:
|
||||
continue
|
||||
endpoint_format = normalize_endpoint_signature(f"{api_family}:{endpoint_kind}")
|
||||
skip_endpoint_check = global_conversion_enabled or bool(provider_conversion_enabled)
|
||||
is_compatible, _needs_conversion, _reason = is_format_compatible(
|
||||
client_format_norm,
|
||||
endpoint_format,
|
||||
format_acceptance_config,
|
||||
is_stream=False,
|
||||
effective_conversion_enabled=global_conversion_enabled,
|
||||
skip_endpoint_check=skip_endpoint_check,
|
||||
)
|
||||
if not is_compatible:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user