mirror of
https://github.com/openai/codex.git
synced 2026-11-02 19:43:24 +00:00
models
This commit is contained in:
@@ -181,6 +181,10 @@ impl App {
|
||||
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
||||
let app_event_tx = AppEventSender::new(app_event_tx);
|
||||
|
||||
let mut config = config;
|
||||
let pending_model_migration_notice =
|
||||
crate::model_migration::take_pending_model_migration_notice(&mut config);
|
||||
|
||||
let conversation_manager = Arc::new(ConversationManager::new(
|
||||
auth_manager.clone(),
|
||||
SessionSource::Cli,
|
||||
@@ -238,10 +242,9 @@ impl App {
|
||||
}
|
||||
};
|
||||
|
||||
// Startup-only: show any previously scheduled model migration notice, then refresh the
|
||||
// schedule to reflect the current config + model presets (at most one scheduled notice).
|
||||
chat_widget.maybe_show_pending_model_migration_notice();
|
||||
chat_widget.refresh_pending_model_migration_notice();
|
||||
if let Some(notice) = pending_model_migration_notice {
|
||||
chat_widget.show_model_migration_notice(notice);
|
||||
}
|
||||
|
||||
chat_widget.maybe_prompt_windows_sandbox_enable();
|
||||
|
||||
|
||||
@@ -469,6 +469,7 @@ impl ChatWidget {
|
||||
// turn now that we know the session is configured.
|
||||
self.maybe_send_next_queued_input();
|
||||
}
|
||||
self.refresh_pending_model_migration_notice();
|
||||
if !self.suppress_session_configured_redraw {
|
||||
self.request_redraw();
|
||||
}
|
||||
@@ -806,12 +807,10 @@ impl ChatWidget {
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
pub(crate) fn maybe_show_pending_model_migration_notice(&mut self) {
|
||||
let Some(notice) = model_migration::take_pending_model_migration_notice(&mut self.config)
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
pub(crate) fn show_model_migration_notice(
|
||||
&mut self,
|
||||
notice: model_migration::PendingModelMigrationNotice,
|
||||
) {
|
||||
self.add_to_history(history_cell::new_info_event(
|
||||
format!(
|
||||
"Model upgrade available: {} -> {}. Use /model to switch.",
|
||||
@@ -826,7 +825,7 @@ impl ChatWidget {
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn refresh_pending_model_migration_notice(&self) {
|
||||
fn refresh_pending_model_migration_notice(&self) {
|
||||
let available_models = match self.models_manager.try_list_models(&self.config) {
|
||||
Ok(models) => models,
|
||||
Err(_) => return,
|
||||
|
||||
@@ -222,6 +222,10 @@ impl App {
|
||||
let (app_event_tx, mut app_event_rx) = unbounded_channel();
|
||||
let app_event_tx = AppEventSender::new(app_event_tx);
|
||||
|
||||
let mut config = config;
|
||||
let pending_model_migration_notice =
|
||||
crate::model_migration::take_pending_model_migration_notice(&mut config);
|
||||
|
||||
let conversation_manager = Arc::new(ConversationManager::new(
|
||||
auth_manager.clone(),
|
||||
SessionSource::Cli,
|
||||
@@ -279,10 +283,9 @@ impl App {
|
||||
}
|
||||
};
|
||||
|
||||
// Startup-only: show any previously scheduled model migration notice, then refresh the
|
||||
// schedule to reflect the current config + model presets (at most one scheduled notice).
|
||||
chat_widget.maybe_show_pending_model_migration_notice();
|
||||
chat_widget.refresh_pending_model_migration_notice();
|
||||
if let Some(notice) = pending_model_migration_notice {
|
||||
chat_widget.show_model_migration_notice(notice);
|
||||
}
|
||||
|
||||
chat_widget.maybe_prompt_windows_sandbox_enable();
|
||||
|
||||
|
||||
@@ -434,6 +434,7 @@ impl ChatWidget {
|
||||
// turn now that we know the session is configured.
|
||||
self.maybe_send_next_queued_input();
|
||||
}
|
||||
self.refresh_pending_model_migration_notice();
|
||||
if !self.suppress_session_configured_redraw {
|
||||
self.request_redraw();
|
||||
}
|
||||
@@ -748,12 +749,10 @@ impl ChatWidget {
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
pub(crate) fn maybe_show_pending_model_migration_notice(&mut self) {
|
||||
let Some(notice) = model_migration::take_pending_model_migration_notice(&mut self.config)
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
pub(crate) fn show_model_migration_notice(
|
||||
&mut self,
|
||||
notice: model_migration::PendingModelMigrationNotice,
|
||||
) {
|
||||
self.add_to_history(history_cell::new_info_event(
|
||||
format!(
|
||||
"Model upgrade available: {} -> {}. Use /model to switch.",
|
||||
@@ -768,7 +767,7 @@ impl ChatWidget {
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn refresh_pending_model_migration_notice(&self) {
|
||||
fn refresh_pending_model_migration_notice(&self) {
|
||||
let available_models = match self.models_manager.try_list_models(&self.config) {
|
||||
Ok(models) => models,
|
||||
Err(_) => return,
|
||||
|
||||
Reference in New Issue
Block a user