feat(model-aliases): restore Fast service-tier option
- enable Fast for Codex API, OpenAI-compatible, and Codex OAuth sources - apply service_tier=priority as an independent payload override - support Fast-only and reasoning-effort combinations - disable Fast until a supported model source is selected
This commit is contained in:
1 parent
708a834e24
commit
cff6a21974
9 files changed
+443
-112
No files matched your search
@@ -437,6 +437,7 @@ pub(crate) async fn create_thinking_alias(
|
||||
source_id: String,
|
||||
alias: String,
|
||||
effort: String,
|
||||
fast: Option<bool>,
|
||||
) -> Result<Vec<ThinkingAliasEntry>, String> {
|
||||
let config = gui_config_state.snapshot()?;
|
||||
let source_id = source_id.trim().to_string();
|
||||
@@ -449,12 +450,15 @@ pub(crate) async fn create_thinking_alias(
|
||||
} else {
|
||||
validate_thinking_alias_effort(&effort)?
|
||||
};
|
||||
let fast = fast.unwrap_or(false);
|
||||
let content = fetch_management_config_yaml(&config).await?;
|
||||
let available_models =
|
||||
fetch_agent_models(config.port, effective_agent_api_key(&config)).await?;
|
||||
let definitions = fetch_oauth_model_definitions(&config).await;
|
||||
let capability = if !effort.is_empty() {
|
||||
AliasSourceCapability::Reasoning
|
||||
} else if fast {
|
||||
AliasSourceCapability::Fast
|
||||
} else {
|
||||
AliasSourceCapability::Base
|
||||
};
|
||||
@@ -467,6 +471,9 @@ pub(crate) async fn create_thinking_alias(
|
||||
.ok_or_else(|| {
|
||||
"原模型已不在内核当前可用模型中,或其配置来源已经变化,请刷新后重新选择".to_string()
|
||||
})?;
|
||||
if fast && !alias_source_supports_fast(&source) {
|
||||
return Err("Fast 仅支持 OpenAI 兼容 API、Codex API 或 Codex OAuth 模型源".to_string());
|
||||
}
|
||||
if !effort.is_empty()
|
||||
&& !source
|
||||
.source
|
||||
@@ -498,7 +505,7 @@ pub(crate) async fn create_thinking_alias(
|
||||
return Err(format!("别名模型 {alias} 已存在"));
|
||||
}
|
||||
|
||||
let updated = add_model_alias_to_yaml(&content, &source, &alias, &effort)?;
|
||||
let updated = add_model_alias_to_yaml(&content, &source, &alias, &effort, fast)?;
|
||||
put_management_alias_config_changes(&config, &content, &updated).await?;
|
||||
thinking_aliases_from_yaml(&updated)
|
||||
}
|
||||
|
||||
@@ -922,9 +922,7 @@ pub(crate) fn resolved_oauth_alias_sources(
|
||||
AliasSourceCapability::Reasoning => {
|
||||
sources.retain(|source| !source.source.reasoning_levels.is_empty())
|
||||
}
|
||||
AliasSourceCapability::Fast => {
|
||||
sources.retain(|source| model_supports_fast(&source.source.model))
|
||||
}
|
||||
AliasSourceCapability::Fast => sources.retain(alias_source_supports_fast),
|
||||
AliasSourceCapability::Base => {}
|
||||
}
|
||||
let configured_codex_api_models = sources
|
||||
@@ -949,8 +947,6 @@ pub(crate) fn resolved_oauth_alias_sources(
|
||||
.filter(|definition| {
|
||||
(capability != AliasSourceCapability::Reasoning
|
||||
|| !definition.reasoning_levels.is_empty())
|
||||
&& (capability != AliasSourceCapability::Fast
|
||||
|| model_supports_fast(&definition.id))
|
||||
&& thinking_alias_model_is_available(available_models, &definition.id)
|
||||
&& (channel.key != "codex"
|
||||
|| !configured_codex_api_models
|
||||
@@ -985,19 +981,13 @@ pub(crate) fn thinking_alias_model_is_available(
|
||||
.any(|available| available.name.eq_ignore_ascii_case(model))
|
||||
}
|
||||
|
||||
pub(crate) fn model_supports_fast(model: &str) -> bool {
|
||||
let model = model.trim().to_ascii_lowercase();
|
||||
model == "gpt" || model.starts_with("gpt-")
|
||||
}
|
||||
|
||||
pub(crate) fn alias_source_supports_fast(source: &ResolvedThinkingAliasSource) -> bool {
|
||||
model_supports_fast(&source.source.model)
|
||||
&& match &source.location {
|
||||
ThinkingAliasSourceLocation::Oauth { channel, .. } => *channel == "codex",
|
||||
ThinkingAliasSourceLocation::ConfigModel { section, .. } => {
|
||||
matches!(*section, "codex-api-key" | "openai-compatibility")
|
||||
}
|
||||
match &source.location {
|
||||
ThinkingAliasSourceLocation::Oauth { channel, .. } => *channel == "codex",
|
||||
ThinkingAliasSourceLocation::ConfigModel { section, .. } => {
|
||||
matches!(*section, "codex-api-key" | "openai-compatibility")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn collect_config_thinking_alias_sources(
|
||||
@@ -1634,7 +1624,11 @@ pub(crate) fn add_model_alias_to_yaml(
|
||||
source: &ResolvedThinkingAliasSource,
|
||||
alias: &str,
|
||||
effort: &str,
|
||||
fast: bool,
|
||||
) -> Result<String, String> {
|
||||
if fast && !alias_source_supports_fast(source) {
|
||||
return Err("Fast 仅支持 OpenAI 兼容 API、Codex API 或 Codex OAuth 模型源".to_string());
|
||||
}
|
||||
let mut document = yaml_serde_edit::YamlValue::parse(content)
|
||||
.map_err(|error| format!("解析内核 YAML 配置失败: {error}"))?;
|
||||
let mut updated = document.get().clone();
|
||||
@@ -1667,8 +1661,32 @@ pub(crate) fn add_model_alias_to_yaml(
|
||||
}
|
||||
|
||||
remove_thinking_payload_model(root, alias)?;
|
||||
if effort.is_empty() {
|
||||
return render_updated_core_yaml(&mut document, updated);
|
||||
remove_speed_payload_model(root, alias)?;
|
||||
if !effort.is_empty() {
|
||||
let mut params_mapping = serde_norway::Mapping::new();
|
||||
insert_thinking_effort_params(&mut params_mapping, &source.source, effort)?;
|
||||
append_alias_payload_override(root, alias, &source.source.protocol, params_mapping)?;
|
||||
}
|
||||
if fast {
|
||||
let mut params_mapping = serde_norway::Mapping::new();
|
||||
params_mapping.insert(
|
||||
yaml_key("service_tier"),
|
||||
serde_norway::Value::String("priority".to_string()),
|
||||
);
|
||||
append_alias_payload_override(root, alias, &source.source.protocol, params_mapping)?;
|
||||
}
|
||||
|
||||
render_updated_core_yaml(&mut document, updated)
|
||||
}
|
||||
|
||||
pub(crate) fn append_alias_payload_override(
|
||||
root: &mut serde_norway::Mapping,
|
||||
alias: &str,
|
||||
protocol: &str,
|
||||
params_mapping: serde_norway::Mapping,
|
||||
) -> Result<(), String> {
|
||||
if params_mapping.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
let payload = root
|
||||
.entry(yaml_key("payload"))
|
||||
@@ -1688,12 +1706,8 @@ pub(crate) fn add_model_alias_to_yaml(
|
||||
);
|
||||
model_mapping.insert(
|
||||
yaml_key("protocol"),
|
||||
serde_norway::Value::String(source.source.protocol.clone()),
|
||||
serde_norway::Value::String(protocol.to_string()),
|
||||
);
|
||||
let mut params_mapping = serde_norway::Mapping::new();
|
||||
if !effort.is_empty() {
|
||||
insert_thinking_effort_params(&mut params_mapping, &source.source, effort)?;
|
||||
}
|
||||
let mut rule_mapping = serde_norway::Mapping::new();
|
||||
rule_mapping.insert(
|
||||
yaml_key("models"),
|
||||
@@ -1704,8 +1718,7 @@ pub(crate) fn add_model_alias_to_yaml(
|
||||
serde_norway::Value::Mapping(params_mapping),
|
||||
);
|
||||
override_rules.push(serde_norway::Value::Mapping(rule_mapping));
|
||||
|
||||
render_updated_core_yaml(&mut document, updated)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn add_speed_alias_to_yaml(
|
||||
@@ -1714,9 +1727,7 @@ pub(crate) fn add_speed_alias_to_yaml(
|
||||
alias: &str,
|
||||
) -> Result<String, String> {
|
||||
if !alias_source_supports_fast(source) {
|
||||
return Err(
|
||||
"Fast 仅支持 OpenAI 兼容 API、Codex API 或 Codex OAuth 的 GPT 系列模型".to_string(),
|
||||
);
|
||||
return Err("Fast 仅支持 OpenAI 兼容 API、Codex API 或 Codex OAuth 模型源".to_string());
|
||||
}
|
||||
let mut document = yaml_serde_edit::YamlValue::parse(content)
|
||||
.map_err(|error| format!("解析内核 YAML 配置失败: {error}"))?;
|
||||
@@ -1749,41 +1760,12 @@ pub(crate) fn add_speed_alias_to_yaml(
|
||||
}
|
||||
|
||||
remove_speed_payload_model(root, alias)?;
|
||||
let payload = root
|
||||
.entry(yaml_key("payload"))
|
||||
.or_insert_with(|| serde_norway::Value::Mapping(serde_norway::Mapping::new()))
|
||||
.as_mapping_mut()
|
||||
.ok_or_else(|| "payload 必须是 YAML 映射".to_string())?;
|
||||
let override_rules = payload
|
||||
.entry(yaml_key("override"))
|
||||
.or_insert_with(|| serde_norway::Value::Sequence(Vec::new()))
|
||||
.as_sequence_mut()
|
||||
.ok_or_else(|| "payload.override 必须是数组".to_string())?;
|
||||
|
||||
let mut model_mapping = serde_norway::Mapping::new();
|
||||
model_mapping.insert(
|
||||
yaml_key("name"),
|
||||
serde_norway::Value::String(alias.to_string()),
|
||||
);
|
||||
model_mapping.insert(
|
||||
yaml_key("protocol"),
|
||||
serde_norway::Value::String(source.source.protocol.clone()),
|
||||
);
|
||||
let mut params_mapping = serde_norway::Mapping::new();
|
||||
params_mapping.insert(
|
||||
yaml_key("service_tier"),
|
||||
serde_norway::Value::String("priority".to_string()),
|
||||
);
|
||||
let mut rule_mapping = serde_norway::Mapping::new();
|
||||
rule_mapping.insert(
|
||||
yaml_key("models"),
|
||||
serde_norway::Value::Sequence(vec![serde_norway::Value::Mapping(model_mapping)]),
|
||||
);
|
||||
rule_mapping.insert(
|
||||
yaml_key("params"),
|
||||
serde_norway::Value::Mapping(params_mapping),
|
||||
);
|
||||
override_rules.push(serde_norway::Value::Mapping(rule_mapping));
|
||||
append_alias_payload_override(root, alias, &source.source.protocol, params_mapping)?;
|
||||
|
||||
render_updated_core_yaml(&mut document, updated)
|
||||
}
|
||||
|
||||
@@ -2214,7 +2214,7 @@ fn thinking_alias_prefers_codex_api_key_model_over_same_named_oauth_definition()
|
||||
));
|
||||
|
||||
let rendered =
|
||||
add_model_alias_to_yaml(input, &sources[0], "gpt-5.6-luna-xhigh", "xhigh").unwrap();
|
||||
add_model_alias_to_yaml(input, &sources[0], "gpt-5.6-luna-xhigh", "xhigh", false).unwrap();
|
||||
assert!(rendered.contains("alias: gpt-5.6-luna-xhigh"), "{rendered}");
|
||||
assert!(!rendered.contains("oauth-model-alias"), "{rendered}");
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ fn thinking_alias_uses_source_native_override_parameters() {
|
||||
for (channel, model, effort, expected) in cases {
|
||||
let source = test_oauth_thinking_source(channel, model);
|
||||
let alias = format!("{model}-{effort}");
|
||||
let rendered = add_model_alias_to_yaml("{}\n", &source, &alias, effort).unwrap();
|
||||
let rendered = add_model_alias_to_yaml("{}\n", &source, &alias, effort, false).unwrap();
|
||||
for parameter in expected {
|
||||
assert!(
|
||||
rendered.contains(parameter),
|
||||
@@ -187,7 +187,8 @@ fn configured_claude_and_gemini_models_use_native_overrides() {
|
||||
.iter()
|
||||
.find(|source| source.source.kind == "claude-api")
|
||||
.unwrap();
|
||||
let with_claude = add_model_alias_to_yaml(input, claude, "claude-fixed", "high").unwrap();
|
||||
let with_claude =
|
||||
add_model_alias_to_yaml(input, claude, "claude-fixed", "high", false).unwrap();
|
||||
assert!(
|
||||
with_claude.contains("output_config.effort: high"),
|
||||
"{with_claude}"
|
||||
@@ -204,7 +205,8 @@ fn configured_claude_and_gemini_models_use_native_overrides() {
|
||||
.iter()
|
||||
.find(|source| source.source.kind == "gemini-api")
|
||||
.unwrap();
|
||||
let rendered = add_model_alias_to_yaml(&with_claude, gemini, "gemini-fixed", "low").unwrap();
|
||||
let rendered =
|
||||
add_model_alias_to_yaml(&with_claude, gemini, "gemini-fixed", "low", false).unwrap();
|
||||
assert!(
|
||||
rendered.contains("generationConfig.thinkingConfig.thinkingLevel: low"),
|
||||
"{rendered}"
|
||||
@@ -260,7 +262,7 @@ fn antigravity_alias_uses_its_own_oauth_channel_and_force_mapping() {
|
||||
assert_eq!(sources.len(), 1);
|
||||
assert_eq!(sources[0].source.kind, "antigravity-oauth");
|
||||
let rendered =
|
||||
add_model_alias_to_yaml("{}\n", &sources[0], "gemini-3.1-pro-preview", "").unwrap();
|
||||
add_model_alias_to_yaml("{}\n", &sources[0], "gemini-3.1-pro-preview", "", false).unwrap();
|
||||
|
||||
assert!(rendered.contains("antigravity:"), "{rendered}");
|
||||
assert!(rendered.contains("name: gemini-pro-agent"), "{rendered}");
|
||||
@@ -291,15 +293,20 @@ fn oauth_alias_reader_and_delete_preserve_the_exact_channel() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fast_is_only_available_for_gpt_models_from_supported_sources() {
|
||||
fn fast_is_only_available_for_supported_model_sources() {
|
||||
let input = "openai-compatibility:\n - name: Relay\n base-url: https://example.com/v1\n models:\n - name: gpt-test\n - name: deepseek-chat\n";
|
||||
let available_models = test_agent_models(&["gpt-test", "deepseek-chat"]);
|
||||
let sources =
|
||||
resolved_oauth_alias_sources(input, &[], &available_models, AliasSourceCapability::Fast)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(sources.len(), 1);
|
||||
assert_eq!(sources[0].source.model, "gpt-test");
|
||||
assert_eq!(sources.len(), 2);
|
||||
assert!(sources
|
||||
.iter()
|
||||
.any(|source| source.source.model == "gpt-test"));
|
||||
assert!(sources
|
||||
.iter()
|
||||
.any(|source| source.source.model == "deepseek-chat"));
|
||||
|
||||
let deepseek_source = ResolvedThinkingAliasSource {
|
||||
source: ThinkingAliasSource {
|
||||
@@ -317,7 +324,11 @@ fn fast_is_only_available_for_gpt_models_from_supported_sources() {
|
||||
model_index: 1,
|
||||
},
|
||||
};
|
||||
assert!(add_speed_alias_to_yaml(input, &deepseek_source, "deepseek-fast").is_err());
|
||||
let deepseek_fast = add_speed_alias_to_yaml(input, &deepseek_source, "deepseek-fast").unwrap();
|
||||
assert!(
|
||||
deepseek_fast.contains("service_tier: priority"),
|
||||
"{deepseek_fast}"
|
||||
);
|
||||
|
||||
let antigravity_source = ResolvedThinkingAliasSource {
|
||||
source: ThinkingAliasSource {
|
||||
@@ -349,7 +360,8 @@ fn fast_is_only_available_for_gpt_models_from_supported_sources() {
|
||||
fn thinking_alias_adds_fork_and_matching_payload_rule() {
|
||||
let input = "# Keep this comment\ndebug: true\npayload:\n override:\n - models:\n - name: existing-fast\n protocol: codex\n params:\n service_tier: priority\n";
|
||||
let source = test_codex_oauth_thinking_source("gpt-5.5");
|
||||
let rendered = add_model_alias_to_yaml(input, &source, "gpt-5.5-xhigh", "xhigh").unwrap();
|
||||
let rendered =
|
||||
add_model_alias_to_yaml(input, &source, "gpt-5.5-xhigh", "xhigh", false).unwrap();
|
||||
let aliases = thinking_aliases_from_yaml(&rendered).unwrap();
|
||||
|
||||
assert!(rendered.contains("# Keep this comment"), "{rendered}");
|
||||
@@ -370,7 +382,7 @@ fn thinking_alias_adds_fork_and_matching_payload_rule() {
|
||||
#[test]
|
||||
fn model_alias_can_be_created_without_overrides() {
|
||||
let source = test_codex_oauth_thinking_source("gpt-5.5");
|
||||
let rendered = add_model_alias_to_yaml("{}\n", &source, "gpt-5.5-alias", "").unwrap();
|
||||
let rendered = add_model_alias_to_yaml("{}\n", &source, "gpt-5.5-alias", "", false).unwrap();
|
||||
|
||||
assert!(rendered.contains("alias: gpt-5.5-alias"), "{rendered}");
|
||||
assert!(!rendered.contains("payload:"), "{rendered}");
|
||||
@@ -396,7 +408,7 @@ fn configured_model_alias_can_be_created_without_overrides() {
|
||||
.iter()
|
||||
.find(|source| source.source.model == "gpt-custom")
|
||||
.unwrap();
|
||||
let rendered = add_model_alias_to_yaml(input, source, "gpt-custom-alias", "").unwrap();
|
||||
let rendered = add_model_alias_to_yaml(input, source, "gpt-custom-alias", "", false).unwrap();
|
||||
|
||||
assert!(rendered.contains("alias: gpt-custom-alias"), "{rendered}");
|
||||
assert!(!rendered.contains("thinking:"), "{rendered}");
|
||||
@@ -414,6 +426,57 @@ fn thinking_alias_removal_cleans_legacy_combined_rules() {
|
||||
assert!(!restored.contains("service_tier: priority"), "{restored}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_alias_combines_reasoning_and_fast_as_independent_overrides() {
|
||||
let source = test_codex_oauth_thinking_source("gpt-5.6-sol");
|
||||
let alias = "gpt-5.6-sol-high-fast";
|
||||
let rendered = add_model_alias_to_yaml("{}\n", &source, alias, "high", true).unwrap();
|
||||
|
||||
assert!(rendered.contains("reasoning.effort: high"), "{rendered}");
|
||||
assert!(rendered.contains("service_tier: priority"), "{rendered}");
|
||||
let document: serde_norway::Value = serde_norway::from_str(&rendered).unwrap();
|
||||
let root = document.as_mapping().unwrap();
|
||||
let rules = nested_yaml_value(root, &["payload", "override"])
|
||||
.and_then(serde_norway::Value::as_sequence)
|
||||
.unwrap();
|
||||
let alias_rules = rules
|
||||
.iter()
|
||||
.filter_map(serde_norway::Value::as_mapping)
|
||||
.filter(|rule| {
|
||||
yaml_mapping_value(rule, "models")
|
||||
.and_then(serde_norway::Value::as_sequence)
|
||||
.is_some_and(|models| {
|
||||
models
|
||||
.iter()
|
||||
.any(|model| thinking_payload_model_matches(model, alias, "codex"))
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
assert_eq!(alias_rules.len(), 2, "{rendered}");
|
||||
assert!(alias_rules.iter().any(|rule| {
|
||||
yaml_mapping_value(rule, "params")
|
||||
.and_then(serde_norway::Value::as_mapping)
|
||||
.is_some_and(|params| {
|
||||
yaml_mapping_value(params, "reasoning.effort").is_some()
|
||||
&& yaml_mapping_value(params, "service_tier").is_none()
|
||||
})
|
||||
}));
|
||||
assert!(alias_rules.iter().any(|rule| {
|
||||
yaml_mapping_value(rule, "params")
|
||||
.and_then(serde_norway::Value::as_mapping)
|
||||
.is_some_and(|params| {
|
||||
yaml_mapping_value(params, "service_tier").is_some()
|
||||
&& yaml_mapping_value(params, "reasoning.effort").is_none()
|
||||
})
|
||||
}));
|
||||
assert_eq!(thinking_aliases_from_yaml(&rendered).unwrap().len(), 1);
|
||||
assert_eq!(speed_aliases_from_yaml(&rendered).unwrap().len(), 1);
|
||||
|
||||
let restored = remove_thinking_alias_from_yaml(&rendered, alias).unwrap();
|
||||
assert!(!restored.contains(alias), "{restored}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn speed_alias_adds_fast_service_tier_and_removes_only_its_rule() {
|
||||
let input = "payload:\n override:\n - models:\n - name: existing-thinker\n protocol: codex\n params:\n reasoning.effort: xhigh\n";
|
||||
@@ -517,7 +580,7 @@ fn thinking_alias_rejects_duplicate_client_visible_name() {
|
||||
let input = "oauth-model-alias:\n codex:\n - name: gpt-5.5\n alias: gpt-5.5-high\n fork: true\n";
|
||||
let source = test_codex_oauth_thinking_source("gpt-5.4");
|
||||
assert!(
|
||||
add_model_alias_to_yaml(input, &source, "GPT-5.5-HIGH", "high")
|
||||
add_model_alias_to_yaml(input, &source, "GPT-5.5-HIGH", "high", false)
|
||||
.unwrap_err()
|
||||
.contains("已存在")
|
||||
);
|
||||
@@ -532,7 +595,8 @@ fn thinking_alias_supports_openai_compatible_model_entries() {
|
||||
.iter()
|
||||
.find(|source| source.source.model == "deepseek-chat")
|
||||
.unwrap();
|
||||
let rendered = add_model_alias_to_yaml(input, source, "deepseek-chat-high", "high").unwrap();
|
||||
let rendered =
|
||||
add_model_alias_to_yaml(input, source, "deepseek-chat-high", "high", false).unwrap();
|
||||
let value: serde_norway::Value = serde_norway::from_str(&rendered).unwrap();
|
||||
let root = value.as_mapping().unwrap();
|
||||
let providers = yaml_mapping_value(root, "openai-compatibility")
|
||||
@@ -576,7 +640,8 @@ fn thinking_alias_supports_codex_api_model_entries() {
|
||||
.iter()
|
||||
.find(|source| source.source.kind == "codex-api")
|
||||
.unwrap();
|
||||
let rendered = add_model_alias_to_yaml(input, source, "gpt-custom-xhigh", "xhigh").unwrap();
|
||||
let rendered =
|
||||
add_model_alias_to_yaml(input, source, "gpt-custom-xhigh", "xhigh", false).unwrap();
|
||||
|
||||
assert!(rendered.contains("alias: gpt-custom-xhigh"), "{rendered}");
|
||||
assert!(rendered.contains("protocol: codex"), "{rendered}");
|
||||
@@ -586,3 +651,23 @@ fn thinking_alias_supports_codex_api_model_entries() {
|
||||
assert_eq!(entries.len(), 1);
|
||||
assert_eq!(entries[0].kind, "codex-api");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn speed_alias_supports_codex_api_model_entries() {
|
||||
let input = "codex-api-key:\n - api-key: test\n base-url: https://example.com/v1\n models:\n - name: codex-custom\n";
|
||||
let available_models = test_agent_models(&["codex-custom"]);
|
||||
let sources = resolved_speed_alias_sources(input, &[], &available_models).unwrap();
|
||||
let source = sources
|
||||
.iter()
|
||||
.find(|source| source.source.kind == "codex-api")
|
||||
.unwrap();
|
||||
let rendered = add_speed_alias_to_yaml(input, source, "codex-custom-fast").unwrap();
|
||||
|
||||
assert!(rendered.contains("alias: codex-custom-fast"), "{rendered}");
|
||||
assert!(rendered.contains("protocol: codex"), "{rendered}");
|
||||
assert!(rendered.contains("service_tier: priority"), "{rendered}");
|
||||
assert!(!rendered.contains("oauth-model-alias"), "{rendered}");
|
||||
let entries = speed_aliases_from_yaml(&rendered).unwrap();
|
||||
assert_eq!(entries.len(), 1);
|
||||
assert_eq!(entries[0].kind, "codex-api");
|
||||
}
|
||||
Reference in new issue
Block a user