refactor: 大规模模块拆分与代码精简,新增 ai-pipeline/data-contracts 独立 crate

- 新增 aether-ai-pipeline 和 aether-data-contracts crate,将 pipeline 逻辑与数据契约从 gateway 中解耦
- 重构 admin handlers:拆分单体模块为 auth/billing/endpoint/features/model/observability/provider/system 等独立子模块
- 合并 chat/cli 重复代码路径:精简 conversion、finalize、planner 中的 sync/chat/cli 分支
- 重构 scheduler/executor/data 层,引入 facade 模式降低模块间耦合
- 移除冗余的 intent 模块,将 plan_fallback/policy/stream_path/sync_path 迁移至 executor
- 前端适配:调整 admin API 调用和 provider 模型测试对话框
This commit is contained in:
fawney19
2026-04-07 02:50:19 +08:00
parent 763ff03a7b
commit 5d96d6673b
732 changed files with 28589 additions and 20662 deletions
@@ -1,3 +1,4 @@
use aether_data_contracts::DataLayerError;
use chrono::{DateTime, Utc};
use serde_json::Value;
@@ -9,7 +10,7 @@ pub(super) async fn system_config_bool(
data: &GatewayDataState,
key: &str,
default: bool,
) -> Result<bool, aether_data::DataLayerError> {
) -> Result<bool, DataLayerError> {
Ok(match data.find_system_config_value(key).await? {
Some(Value::Bool(value)) => value,
Some(Value::Number(value)) => value.as_i64().map(|raw| raw != 0).unwrap_or(default),
@@ -26,7 +27,7 @@ pub(super) async fn system_config_u64(
data: &GatewayDataState,
key: &str,
default: u64,
) -> Result<u64, aether_data::DataLayerError> {
) -> Result<u64, DataLayerError> {
Ok(match data.find_system_config_value(key).await? {
Some(Value::Number(value)) => value
.as_u64()
@@ -41,7 +42,7 @@ pub(super) async fn system_config_usize(
data: &GatewayDataState,
key: &str,
default: usize,
) -> Result<usize, aether_data::DataLayerError> {
) -> Result<usize, DataLayerError> {
Ok(match data.find_system_config_value(key).await? {
Some(Value::Number(value)) => value
.as_u64()
@@ -62,7 +63,7 @@ pub(super) async fn system_config_string(
data: &GatewayDataState,
key: &str,
default: &str,
) -> Result<String, aether_data::DataLayerError> {
) -> Result<String, DataLayerError> {
Ok(match data.find_system_config_value(key).await? {
Some(Value::String(value)) => {
let trimmed = value.trim();
@@ -78,13 +79,13 @@ pub(super) async fn system_config_string(
pub(super) async fn pending_cleanup_timeout_minutes(
data: &GatewayDataState,
) -> Result<u64, aether_data::DataLayerError> {
) -> Result<u64, DataLayerError> {
system_config_u64(data, "pending_request_timeout_minutes", 10).await
}
pub(super) async fn pending_cleanup_batch_size(
data: &GatewayDataState,
) -> Result<usize, aether_data::DataLayerError> {
) -> Result<usize, DataLayerError> {
Ok(system_config_usize(data, "cleanup_batch_size", 1_000)
.await?
.max(1)
@@ -93,7 +94,7 @@ pub(super) async fn pending_cleanup_batch_size(
pub(super) async fn usage_cleanup_settings(
data: &GatewayDataState,
) -> Result<UsageCleanupSettings, aether_data::DataLayerError> {
) -> Result<UsageCleanupSettings, DataLayerError> {
Ok(UsageCleanupSettings {
detail_retention_days: system_config_u64(data, "detail_log_retention_days", 7).await?,
compressed_retention_days: system_config_u64(data, "compressed_log_retention_days", 30)