This commit is contained in:
jif-oai
2025-11-19 18:58:48 +00:00
parent d9812a1081
commit ac189b5ae7
3 changed files with 4 additions and 24 deletions

View File

@@ -4,13 +4,13 @@ use codex_app_server_protocol::ReasoningEffortOption;
use codex_common::model_presets::ModelPreset;
use codex_common::model_presets::ReasoningEffortPreset;
use codex_common::model_presets::builtin_model_presets;
use codex_common::model_presets::default_model_id_for_auth;
use codex_core::config::default_model_for_auth;
pub fn supported_models(auth_mode: Option<AuthMode>) -> Vec<Model> {
let default_model_id = default_model_id_for_auth(auth_mode);
let default_model_id = default_model_for_auth(auth_mode);
builtin_model_presets(auth_mode)
.into_iter()
.map(|preset| model_from_preset(preset, default_model_id))
.map(|preset| model_from_preset(preset, &default_model_id))
.collect()
}

View File

@@ -256,13 +256,6 @@ pub fn builtin_model_presets(auth_mode: Option<AuthMode>) -> Vec<ModelPreset> {
.collect()
}
pub fn default_model_id_for_auth(auth_mode: Option<AuthMode>) -> &'static str {
match auth_mode {
Some(AuthMode::ApiKey) => "gpt-5.1-codex",
_ => "gpt-5.1-codex-max",
}
}
pub fn all_model_presets() -> &'static Vec<ModelPreset> {
&PRESETS
}
@@ -287,17 +280,4 @@ mod tests {
.all(|preset| preset.id != "gpt-5.1-codex-max")
);
}
#[test]
fn default_model_depends_on_auth_mode() {
assert_eq!(
default_model_id_for_auth(Some(AuthMode::ChatGPT)),
"gpt-5.1-codex-max"
);
assert_eq!(
default_model_id_for_auth(Some(AuthMode::ApiKey)),
"gpt-5.1-codex"
);
assert_eq!(default_model_id_for_auth(None), "gpt-5.1-codex-max");
}
}

View File

@@ -1349,7 +1349,7 @@ fn default_model() -> String {
OPENAI_DEFAULT_MODEL.to_string()
}
fn default_model_for_auth(auth_mode: Option<AuthMode>) -> String {
pub fn default_model_for_auth(auth_mode: Option<AuthMode>) -> String {
match auth_mode {
Some(AuthMode::ApiKey) => OPENAI_DEFAULT_MODEL_API_KEY.to_string(),
_ => default_model(),