feat: provider api_formats 可空继承、OpenAI 图片 edit/variation 与用量配额多项补强

- 鉴权: provider_api_keys.api_formats 改为可空,OAuth 托管 key 自动继承 provider endpoints 激活格式,相关 handler/测试同步更新
- 图片 planner: OpenAI 图片路由新增 edit/variation 操作并完善参数校验、响应合并与流式处理
- 用量: user me usage 返回区分 client_requested_stream/upstream_is_stream,前端 usage 列表筛选与展示增强
- 统计: stats_daily_model 新增 cache_creation_ephemeral_5m/1h tokens 字段与回填链路
- 配额/observability: quota repository 新增内存与 SQL 扩展,admin observability usage 字段扩充
- 其它: OAuth 导入/轮询收敛、provider 汇总与 pool admin 读写链路小修、新增 system_config 缓存与 provider template handler

Closes #318

Co-authored-by: Entropy.Xu <[email protected]>
This commit is contained in:
fawney19
2026-04-23 14:42:51 +08:00
co-authored by Entropy.Xu
parent f55f22d2e8
commit fa328e18a1
128 changed files with 5583 additions and 690 deletions
@@ -201,8 +201,10 @@ pub(super) async fn execute_admin_provider_oauth_batch_import(
match update_existing_provider_oauth_catalog_key(
state,
&existing_key,
provider_type,
&access_token,
&auth_config,
&api_formats,
None,
expires_at,
)
@@ -242,6 +244,7 @@ pub(super) async fn execute_admin_provider_oauth_batch_import(
match create_provider_oauth_catalog_key(
state,
provider_id,
provider_type,
key_name.as_str(),
&access_token,
&auth_config,
@@ -57,6 +57,7 @@ pub(super) async fn execute_admin_provider_oauth_kiro_batch_import(
let endpoints = state
.list_provider_catalog_endpoints_by_provider_ids(&[provider_id.to_string()])
.await?;
let api_formats = provider_oauth_active_api_formats(&endpoints);
let runtime_endpoint = provider_oauth_runtime_endpoint_for_provider("kiro", &endpoints);
let request_proxy = state
.resolve_admin_provider_oauth_operation_proxy_snapshot(
@@ -191,8 +192,10 @@ pub(super) async fn execute_admin_provider_oauth_kiro_batch_import(
match update_existing_provider_oauth_catalog_key(
state,
&existing_key,
provider.provider_type.as_str(),
&access_token,
&auth_config,
&api_formats,
None,
refreshed_auth_config.expires_at,
)
@@ -223,10 +226,11 @@ pub(super) async fn execute_admin_provider_oauth_kiro_batch_import(
match create_provider_oauth_catalog_key(
state,
provider_id,
provider.provider_type.as_str(),
&key_name,
&access_token,
&auth_config,
&provider_oauth_active_api_formats(&endpoints),
&api_formats,
None,
refreshed_auth_config.expires_at,
)