mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 02:47:45 +08:00
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:
@@ -1,3 +1,4 @@
|
||||
use aether_data_contracts::DataLayerError;
|
||||
use tracing::info;
|
||||
|
||||
use crate::data::GatewayDataState;
|
||||
@@ -11,9 +12,7 @@ use super::{
|
||||
perform_wallet_daily_usage_aggregation_once, summarize_postgres_pool,
|
||||
};
|
||||
|
||||
pub(super) async fn run_audit_cleanup_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
pub(super) async fn run_audit_cleanup_once(data: &GatewayDataState) -> Result<(), DataLayerError> {
|
||||
let deleted = cleanup_audit_logs_once(data).await?;
|
||||
if deleted > 0 {
|
||||
info!(
|
||||
@@ -29,7 +28,7 @@ pub(super) async fn run_audit_cleanup_once(
|
||||
|
||||
pub(super) async fn run_gemini_file_mapping_cleanup_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
) -> Result<(), DataLayerError> {
|
||||
let deleted = cleanup_expired_gemini_file_mappings_once(data).await?;
|
||||
if deleted > 0 {
|
||||
info!(
|
||||
@@ -43,9 +42,7 @@ pub(super) async fn run_gemini_file_mapping_cleanup_once(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) async fn run_db_maintenance_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
pub(super) async fn run_db_maintenance_once(data: &GatewayDataState) -> Result<(), DataLayerError> {
|
||||
let summary = perform_db_maintenance_once(data).await?;
|
||||
if summary.attempted > 0 {
|
||||
info!(
|
||||
@@ -63,7 +60,7 @@ pub(super) async fn run_db_maintenance_once(
|
||||
|
||||
pub(super) async fn run_wallet_daily_usage_aggregation_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
) -> Result<(), DataLayerError> {
|
||||
let summary = perform_wallet_daily_usage_aggregation_once(data).await?;
|
||||
info!(
|
||||
event_name = "wallet_daily_usage_aggregation_completed",
|
||||
@@ -80,7 +77,7 @@ pub(super) async fn run_wallet_daily_usage_aggregation_once(
|
||||
|
||||
pub(super) async fn run_stats_aggregation_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
) -> Result<(), DataLayerError> {
|
||||
let Some(summary) = perform_stats_aggregation_once(data).await? else {
|
||||
return Ok(());
|
||||
};
|
||||
@@ -101,9 +98,7 @@ pub(super) async fn run_stats_aggregation_once(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) async fn run_usage_cleanup_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
pub(super) async fn run_usage_cleanup_once(data: &GatewayDataState) -> Result<(), DataLayerError> {
|
||||
let summary = perform_usage_cleanup_once(data).await?;
|
||||
if summary.body_compressed > 0
|
||||
|| summary.body_cleaned > 0
|
||||
@@ -146,7 +141,7 @@ pub(super) fn run_pool_monitor_once(data: &GatewayDataState) {
|
||||
|
||||
pub(super) async fn run_pending_cleanup_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
) -> Result<(), DataLayerError> {
|
||||
let summary = cleanup_stale_pending_requests_once(data).await?;
|
||||
if summary.failed > 0 || summary.recovered > 0 {
|
||||
info!(
|
||||
@@ -163,7 +158,7 @@ pub(super) async fn run_pending_cleanup_once(
|
||||
|
||||
pub(super) async fn run_stats_hourly_aggregation_once(
|
||||
data: &GatewayDataState,
|
||||
) -> Result<(), aether_data::DataLayerError> {
|
||||
) -> Result<(), DataLayerError> {
|
||||
let Some(summary) = perform_stats_hourly_aggregation_once(data).await? else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user