mirror of
https://github.com/openai/codex.git
synced 2026-11-18 22:20:48 +00:00
Enable conversation-scoped speed selection for Cloud turns (#61178)
## What changed - Stage Cloud speed choices for the next new turn in the conversation, alongside pending model and effort selections. Update the displayed conversation speed after admission without changing the local default. - Offer speed commands supported by the pending model. Clear an incompatible pending speed change with a warning when switching models. - Carry `service_tier` through Cloud message requests, preserving omission to inherit the thread tier and explicit null to clear it. Translate `default` to null and reject tier overrides on queued requests. ## Testing Add tests for Cloud speed toggling, model-dependent speed choices, admission-time updates, and preserving the conversation tier when selecting a model. Extend request and wire tests to cover service-tier values, explicit clearing, and queue rejection. GitOrigin-RevId: b4daa701f1fe29593d90a938e60cc20cb980298a
This commit is contained in:
committed by
copyberry
parent
72532ecae5
commit
b279cfb170
@@ -103,36 +103,44 @@ impl App {
|
||||
);
|
||||
return;
|
||||
};
|
||||
if service_tier.is_some()
|
||||
|| model == crate::model_catalog::LUNA_RESERVE_MODEL
|
||||
|| !self.model_catalog.models.iter().any(|preset| {
|
||||
preset.model == model
|
||||
&& effort.as_ref().is_none_or(|effort| {
|
||||
*effort == preset.default_reasoning_effort
|
||||
|| preset
|
||||
.supported_reasoning_efforts
|
||||
.iter()
|
||||
.any(|preset| &preset.effort == effort)
|
||||
})
|
||||
&& preset.model_specialty.as_deref() != Some(MODEL_SPECIALTY_CYBER)
|
||||
})
|
||||
{
|
||||
let preset = self.model_catalog.models.iter().find(|preset| {
|
||||
preset.model == model
|
||||
&& effort.as_ref().is_none_or(|effort| {
|
||||
*effort == preset.default_reasoning_effort
|
||||
|| preset
|
||||
.supported_reasoning_efforts
|
||||
.iter()
|
||||
.any(|preset| &preset.effort == effort)
|
||||
})
|
||||
&& preset.model_specialty.as_deref() != Some(MODEL_SPECIALTY_CYBER)
|
||||
});
|
||||
let Some(preset) = preset.filter(|_| {
|
||||
service_tier.is_none() && model != crate::model_catalog::LUNA_RESERVE_MODEL
|
||||
}) else {
|
||||
self.chat_widget.add_error_message(
|
||||
"Choose a supported Cloud model and effort at the current speed.".into(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
let label = Self::reasoning_label_for(&model, effort.as_ref())
|
||||
.map_or_else(String::new, |label| format!(" {label}"));
|
||||
let message =
|
||||
format!("Selected {model}{label} for the next new turn in this conversation");
|
||||
if app_server.stage_cloud_model_selection(thread_id, model, effort) {
|
||||
self.chat_widget.add_info_message(message, /*hint*/ None);
|
||||
} else {
|
||||
self.chat_widget.add_error_message(
|
||||
match app_server.stage_cloud_model_selection(thread_id, preset, effort) {
|
||||
Ok(dropped_tier) => {
|
||||
self.chat_widget.sync_service_tier_commands();
|
||||
self.chat_widget.add_info_message(message, /*hint*/ None);
|
||||
if let Some(tier) = dropped_tier {
|
||||
let tier = if tier == "priority" { "fast" } else { &tier };
|
||||
self.chat_widget.add_warning_message(format!(
|
||||
"{model} does not support {tier} speed. Cleared the pending speed change."
|
||||
));
|
||||
}
|
||||
}
|
||||
Err(()) => self.chat_widget.add_error_message(
|
||||
"The Cloud account changed. Reopen the conversation before choosing a model."
|
||||
.into(),
|
||||
);
|
||||
),
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user