mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
fixes 2
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user