Select thinking mode from the chat

This commit is contained in:
Georg Bauer
2026-08-01 09:49:37 +02:00
parent d0431edaff
commit c0e4ec13cc
5 changed files with 104 additions and 9 deletions

View File

@@ -449,6 +449,7 @@ pub(crate) enum Message {
CreateSession(i32),
DraftProjectChanged(i32),
SwitchGitBranch(String),
ReasoningModeChanged(ReasoningMode),
PermissionModeChanged(PermissionMode),
ToggleGitFile(PathBuf),
OpenGitDiff(PathBuf),
@@ -1522,6 +1523,34 @@ impl App {
}
Message::DraftProjectChanged(project_id) => self.move_draft_to_project(project_id),
Message::SwitchGitBranch(branch) => self.switch_git_branch(&branch),
Message::ReasoningModeChanged(mode) => {
if self.active_chat_count() > 0 {
self.error =
Some("Stop all active generations before changing thinking mode.".into());
} else if !self
.config
.generation
.supported_reasoning_modes()
.contains(&mode)
{
self.error = Some(
"Think Max requires a context window of at least 393216 tokens.".into(),
);
} else {
let mut config = self.config.clone();
config.generation.reasoning_mode = mode;
match config.save(&config_path()) {
Ok(()) => {
self.config = config;
self.preference_draft.reasoning_mode = mode;
self.error = None;
#[cfg(target_os = "macos")]
preferences::update_runtime_config(&self.runtime_config, &self.config);
}
Err(error) => self.error = Some(error),
}
}
}
Message::PermissionModeChanged(mode) => {
#[cfg(target_os = "macos")]
if self.active_tools.is_some() {