refactor: 拆分 system.rs 大文件,将 email_templates/proxy_errors/system_config 下沉到 shared 层

- 删除 1666 行的 admin/system/shared/system.rs,按职责拆分到独立模块
- 新增 handlers/shared/email_templates.rs 和 system_config_values.rs 存放跨层共用的模板/配置工具函数
- 新增 admin/system/shared/email_templates.rs 存放 admin 专用的模板操作逻辑
- 新增 admin/shared/proxy_errors.rs 存放 build_proxy_error_response
- 清理 public/system_modules_helpers 中不属于 public 层的导出
- 新增架构测试守护模块归属边界
This commit is contained in:
fawney19
2026-04-07 08:19:26 +08:00
parent 5d96d6673b
commit 29055c575f
27 changed files with 814 additions and 1994 deletions
@@ -1,9 +1,11 @@
mod admin_proxy;
mod catalog;
mod email_templates;
mod external_models;
mod normalize;
mod payloads;
mod request_utils;
mod system_config_values;
mod usage_stats;
pub(crate) use self::admin_proxy::{
@@ -17,6 +19,11 @@ pub(crate) use self::catalog::{
provider_catalog_key_supports_format, provider_key_health_summary,
provider_key_status_snapshot_payload,
};
pub(crate) use self::email_templates::{
admin_email_template_definition, admin_email_template_html_key,
admin_email_template_subject_key, escape_admin_email_template_html,
read_admin_email_template_payload, render_admin_email_template_html,
};
pub(crate) use self::external_models::OFFICIAL_EXTERNAL_MODEL_PROVIDERS;
pub(crate) use self::normalize::{
normalize_json_array, normalize_json_object, normalize_string_list,
@@ -34,6 +41,9 @@ pub(crate) use self::request_utils::{
sanitize_upstream_path_and_query, should_strip_forwarded_provider_credential_header,
should_strip_forwarded_trusted_admin_header, strip_query_param, unix_secs_to_rfc3339,
};
pub(crate) use self::system_config_values::{
module_available_from_env, system_config_bool, system_config_string,
};
pub(crate) use self::usage_stats::{
admin_stats_bad_request_response, list_usage_for_optional_range, parse_bounded_u32, round_to,
AdminStatsTimeRange, AdminStatsUsageFilter,