refactor: 将格式转换全局开关迁移到环境变量配置

- 新增 FORMAT_CONVERSION_ENABLED 环境变量(默认开启)
- 移除数据库中的 format_conversion_enabled 系统配置
- 移除前端系统设置页面的格式转换开关 UI
- 统一同族格式转换(OPENAI/OPENAI_CLI)逻辑,也需检查全局开关和端点配置
- 流生成器使用 ctx.needs_conversion 替代 _needs_format_conversion 方法调用
- 更新测试用例适配新逻辑
- 清理 .env.example 中过时的超时和连接池配置注释
This commit is contained in:
fawney19
2026-01-28 01:22:39 +08:00
parent 1e0255d0ed
commit af0daa91ad
9 changed files with 112 additions and 135 deletions

View File

@@ -659,9 +659,8 @@ class CacheAwareScheduler:
return [], global_model_id
# 2. 构建候选列表(传入 is_stream 和 capability_requirements 用于过滤)
global_conversion_enabled = bool(
SystemConfigService.get_config(db, "format_conversion_enabled", False)
)
from src.config.settings import config
global_conversion_enabled = config.format_conversion_enabled
candidates = await self._build_candidates(
db=db,
providers=providers,

View File

@@ -118,10 +118,6 @@ class SystemConfigService:
"value": "cache_affinity",
"description": "调度模式fixed_order(固定顺序模式,严格按优先级顺序) 或 cache_affinity(缓存亲和模式优先使用已缓存的Provider)",
},
"format_conversion_enabled": {
"value": False,
"description": "是否启用全局格式自动转换(需要端点配置 format_acceptance_config 才能生效)",
},
"auto_delete_expired_keys": {
"value": False,
"description": "是否自动删除过期的API KeyTrue=物理删除False=仅禁用),仅管理员可配置",