Files
codex/codex-rs/tui/src/model_catalog.rs
T
andrewgu-oai 49e95cc73f Add GPT-6 Sol and Luna to the model catalog (#47332)
## What changed

- Add `gpt-6-sol` and `gpt-6-luna` catalog entries and refresh model descriptions.
- Offer migrations from `gpt-5.5`, `gpt-5.6-sol`, and `gpt-5.6-terra` to `gpt-6-sol`, and from `gpt-5.6-luna` to `gpt-6-luna`.
- Retarget retired `gpt-5.4` and `gpt-5.4-mini` selections to GPT-6 Sol and Luna, respectively.
- Recommend `gpt-6-luna` in the rate-limit switch prompt.

## Testing

Extend migration tests to cover the new targets, their default reasoning effort, and prompting again after a previously acknowledged migration to an older target. Update model-picker and rate-limit prompt snapshots.

GitOrigin-RevId: d3a093d18ce44a903383504ab8f5cbbc911d602d
2026-09-22 18:17:39 +00:00

49 lines
1.4 KiB
Rust

//! TUI model and collaboration inventories; refreshing models preserves the server mode catalog.
use codex_protocol::config_types::CollaborationModeMask;
use codex_protocol::openai_models::ModelPreset;
use std::convert::Infallible;
pub(crate) const LUNA_RESERVE_MODEL: &str = "gpt-reserve";
pub(crate) const LUNA_MODEL: &str = "gpt-6-luna";
pub(crate) fn model_display_name(model: &str) -> &str {
if model.eq_ignore_ascii_case(LUNA_RESERVE_MODEL) {
"Luna Reserve"
} else {
model
}
}
#[derive(Debug, Clone)]
pub(crate) struct ModelCatalog {
pub(crate) models: Vec<ModelPreset>,
pub(crate) collaboration_modes: Vec<CollaborationModeMask>,
}
impl ModelCatalog {
pub(crate) fn new(models: Vec<ModelPreset>) -> Self {
Self {
models,
collaboration_modes: Vec::new(),
}
}
pub(crate) fn with_collaboration_modes(mut self, modes: Vec<CollaborationModeMask>) -> Self {
self.collaboration_modes = modes;
self
}
pub(crate) fn try_list_models(&self) -> Result<Vec<ModelPreset>, Infallible> {
Ok(self.models.clone())
}
pub(crate) fn display_name<'a>(&'a self, model: &'a str) -> &'a str {
self.models
.iter()
.find(|preset| preset.model == model)
.map(|preset| preset.display_name.as_str())
.unwrap_or_else(|| model_display_name(model))
}
}