mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
cca1e0ba1d
## Summary - Bump the workspace Rust toolchain from `1.93.0` to `1.95.0` across Cargo, Bazel, CI, release workflows, devcontainers, and the Codex environment config. - Refresh `MODULE.bazel.lock` so the Bazel Rust toolchain artifacts match the new version. - Leave purpose-specific toolchains unchanged, including the `argument-comment-lint` nightly and the upstream `rusty_v8` `1.91.0` build pin. - Includes fixes for new lints from `just fix` and a few codex-authored fixes for lints without a suggestion.
39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
//! Test-only helpers exposed for dependent crate tests.
|
|
//!
|
|
//! Production code should not depend on this module.
|
|
|
|
use crate::ModelsManagerConfig;
|
|
use crate::bundled_models_response;
|
|
use crate::manager::construct_model_info_from_candidates;
|
|
use codex_protocol::openai_models::ModelInfo;
|
|
use codex_protocol::openai_models::ModelPreset;
|
|
|
|
/// Get model identifier without consulting remote state or cache.
|
|
pub fn get_model_offline_for_tests(model: Option<&str>) -> String {
|
|
if let Some(model) = model {
|
|
return model.to_string();
|
|
}
|
|
let mut response = bundled_models_response().unwrap_or_default();
|
|
response.models.sort_by_key(|model| model.priority);
|
|
let presets: Vec<ModelPreset> = response.models.into_iter().map(Into::into).collect();
|
|
presets
|
|
.iter()
|
|
.find(|preset| preset.show_in_picker)
|
|
.or_else(|| presets.first())
|
|
.map(|preset| preset.model.clone())
|
|
.unwrap_or_default()
|
|
}
|
|
|
|
/// Build `ModelInfo` without consulting remote state or cache.
|
|
pub fn construct_model_info_offline_for_tests(
|
|
model: &str,
|
|
config: &ModelsManagerConfig,
|
|
) -> ModelInfo {
|
|
let candidates: &[ModelInfo] = if let Some(model_catalog) = config.model_catalog.as_ref() {
|
|
&model_catalog.models
|
|
} else {
|
|
&[]
|
|
};
|
|
construct_model_info_from_candidates(model, candidates, config)
|
|
}
|