From f00ffceb40a8274c5e566e8a63796e69b87ac1c3 Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Fri, 2 Oct 2026 10:20:50 +0200 Subject: [PATCH] Allow choosing the model for draft sessions Co-Authored-By: Claude Opus 5.5 --- src/app.rs | 11 +++++++++++ src/app/view/chat.rs | 16 +++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 7927edc..ba86ac3 100644 --- a/src/app.rs +++ b/src/app.rs @@ -538,6 +538,7 @@ pub(crate) enum Message { DeleteProject(i32), CreateSession(i32), DraftProjectChanged(i32), + DraftModelChanged(ModelChoice), SwitchGitBranch(String), ReasoningModeChanged(ReasoningMode), PermissionModeChanged(PermissionMode), @@ -1843,6 +1844,16 @@ impl App { } } Message::DraftProjectChanged(project_id) => self.move_draft_to_project(project_id), + Message::DraftModelChanged(model) => { + if self.selected_session.is_some() { + self.error = Some("The model is fixed once a chat has started.".into()); + } else if self.active_chat_count() > 0 { + self.error = + Some("Stop all active generations before changing the model.".into()); + } else if let Err(error) = self.activate_model(model) { + self.error = Some(error); + } + } Message::SwitchGitBranch(branch) => self.switch_git_branch(&branch), Message::ReasoningModeChanged(mode) => { if self.active_chat_count() > 0 { diff --git a/src/app/view/chat.rs b/src/app/view/chat.rs index b0db497..f6e17d8 100644 --- a/src/app/view/chat.rs +++ b/src/app/view/chat.rs @@ -337,6 +337,20 @@ impl App { .padding([2, 6]) .into() }; + // A draft has no user message yet, so its model is still open. + let model_control: Element<'_, Message> = + if self.selected_session.is_none() && self.active_chat_count() == 0 { + pick_list( + model::installed_models(&models_path()), + Some(self.config.model), + Message::DraftModelChanged, + ) + .text_size(12) + .padding([2, 6]) + .into() + } else { + text(self.config.model.to_string()).size(12).into() + }; let vision_ready = self.config.model.supports_vision() && model::engine_artifacts(self.config.model, false, &models_path()) .vision @@ -399,7 +413,7 @@ impl App { .padding([2, 6]), reasoning_control, icon(ICON_MODEL, 16), - text(self.config.model.to_string()).size(12), + model_control, action, ] .spacing(6)