mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 02:17:46 +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:
@@ -0,0 +1,5 @@
|
||||
mod paths;
|
||||
mod payloads;
|
||||
|
||||
pub(crate) use self::paths::*;
|
||||
pub(crate) use self::payloads::*;
|
||||
@@ -0,0 +1,46 @@
|
||||
pub(crate) fn is_admin_global_models_root(request_path: &str) -> bool {
|
||||
matches!(
|
||||
request_path,
|
||||
"/api/admin/models/global" | "/api/admin/models/global/"
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn admin_global_model_id_from_path(request_path: &str) -> Option<String> {
|
||||
let raw = request_path.strip_prefix("/api/admin/models/global/")?;
|
||||
let normalized = raw.trim().trim_matches('/');
|
||||
if normalized.is_empty()
|
||||
|| normalized.contains('/')
|
||||
|| normalized == "batch-delete"
|
||||
|| normalized.ends_with("/providers")
|
||||
|| normalized.ends_with("/assign-to-providers")
|
||||
|| normalized.ends_with("/routing")
|
||||
{
|
||||
None
|
||||
} else {
|
||||
Some(normalized.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn admin_global_model_assign_to_providers_id(request_path: &str) -> Option<String> {
|
||||
request_path
|
||||
.strip_prefix("/api/admin/models/global/")?
|
||||
.strip_suffix("/assign-to-providers")
|
||||
.map(|value| value.trim().trim_matches('/').to_string())
|
||||
.filter(|value| !value.is_empty() && !value.contains('/'))
|
||||
}
|
||||
|
||||
pub(crate) fn admin_global_model_routing_id(request_path: &str) -> Option<String> {
|
||||
request_path
|
||||
.strip_prefix("/api/admin/models/global/")?
|
||||
.strip_suffix("/routing")
|
||||
.map(|value| value.trim().trim_matches('/').to_string())
|
||||
.filter(|value| !value.is_empty() && !value.contains('/'))
|
||||
}
|
||||
|
||||
pub(crate) fn admin_global_model_providers_id(request_path: &str) -> Option<String> {
|
||||
request_path
|
||||
.strip_prefix("/api/admin/models/global/")?
|
||||
.strip_suffix("/providers")
|
||||
.map(|value| value.trim().trim_matches('/').to_string())
|
||||
.filter(|value| !value.is_empty() && !value.contains('/'))
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct AdminGlobalModelCreateRequest {
|
||||
pub(crate) name: String,
|
||||
pub(crate) display_name: String,
|
||||
#[serde(default)]
|
||||
pub(crate) default_price_per_request: Option<f64>,
|
||||
#[serde(default)]
|
||||
pub(crate) default_tiered_pricing: Option<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
pub(crate) supported_capabilities: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub(crate) config: Option<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
pub(crate) is_active: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct AdminGlobalModelUpdateRequest {
|
||||
#[serde(default)]
|
||||
pub(crate) display_name: Option<String>,
|
||||
#[serde(default)]
|
||||
pub(crate) is_active: Option<bool>,
|
||||
#[serde(default)]
|
||||
pub(crate) default_price_per_request: Option<f64>,
|
||||
#[serde(default)]
|
||||
pub(crate) default_tiered_pricing: Option<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
pub(crate) supported_capabilities: Option<Vec<String>>,
|
||||
#[serde(default)]
|
||||
pub(crate) config: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct AdminBatchDeleteIdsRequest {
|
||||
pub(crate) ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct AdminBatchAssignToProvidersRequest {
|
||||
pub(crate) provider_ids: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub(crate) create_models: Option<bool>,
|
||||
}
|
||||
Reference in New Issue
Block a user