mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(model-fetch): 提取获取计划请求,并使网关运行时与共享构建器保持一致
- 将 build_execution_plan 的散参数收敛为 ModelFetchExecutionPlanRequest,消除 clippy too_many_arguments - 在 aether-gateway 的 model_fetch runtime 中显式依赖 build_models_fetch_execution_plan - 补充共享 models fetch plan builder 的运行时测试覆盖
This commit is contained in:
@@ -365,7 +365,9 @@ mod tests {
|
||||
use aether_data_contracts::repository::provider_catalog::{
|
||||
StoredProviderCatalogEndpoint, StoredProviderCatalogKey, StoredProviderCatalogProvider,
|
||||
};
|
||||
use aether_model_fetch::{ModelFetchAssociationStore, ModelFetchTransportRuntime};
|
||||
use aether_model_fetch::{
|
||||
build_models_fetch_execution_plan, ModelFetchAssociationStore, ModelFetchTransportRuntime,
|
||||
};
|
||||
use async_trait::async_trait;
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
@@ -746,6 +748,30 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn gateway_runtime_state_supports_shared_models_fetch_plan_builder() {
|
||||
let state = TestState::default();
|
||||
let transport = sample_transport(
|
||||
"openai",
|
||||
"provider-openai",
|
||||
"endpoint-openai-chat",
|
||||
"key-openai-chat",
|
||||
"openai:chat",
|
||||
"api_key",
|
||||
None,
|
||||
);
|
||||
|
||||
let plan = build_models_fetch_execution_plan(&state, &transport)
|
||||
.await
|
||||
.expect("shared models fetch plan should build");
|
||||
|
||||
assert_eq!(plan.method, "GET");
|
||||
assert_eq!(plan.provider_id, "provider-openai");
|
||||
assert_eq!(plan.endpoint_id, "endpoint-openai-chat");
|
||||
assert_eq!(plan.key_id, "key-openai-chat");
|
||||
assert_eq!(plan.model_name.as_deref(), Some("models"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn model_fetch_uses_preset_models_without_endpoint() {
|
||||
let provider = sample_provider("provider-codex", "codex");
|
||||
|
||||
Reference in New Issue
Block a user