fix(coding-agent): clamp thinking level to model capabilities

- setThinkingLevel() now clamps xhigh to high when model doesn't support it
- Model changes automatically re-clamp the current thinking level
- Fixed /model command to use session.setModel() instead of agent.setModel()
- Footer and editor border color update after model/thinking changes

Closes #253
This commit is contained in:
Mario Zechner 2025-12-20 09:50:56 +01:00
parent c712901eb2
commit b7c3cf9436
3 changed files with 42 additions and 20 deletions

View file

@ -1172,6 +1172,7 @@ export class InteractiveMode {
if (newLevel === null) {
this.showStatus("Current model does not support thinking");
} else {
this.footer.updateState(this.session.state);
this.updateEditorBorderColor();
this.showStatus(`Thinking level: ${newLevel}`);
}
@ -1184,6 +1185,7 @@ export class InteractiveMode {
const msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
this.showStatus(msg);
} else {
this.footer.updateState(this.session.state);
this.updateEditorBorderColor();
const thinkingStr =
result.model.reasoning && result.thinkingLevel !== "off" ? ` (thinking: ${result.thinkingLevel})` : "";
@ -1310,6 +1312,7 @@ export class InteractiveMode {
this.session.getAvailableThinkingLevels(),
(level) => {
this.session.setThinkingLevel(level);
this.footer.updateState(this.session.state);
this.updateEditorBorderColor();
done();
this.showStatus(`Thinking level: ${level}`);
@ -1379,11 +1382,17 @@ export class InteractiveMode {
this.ui,
this.session.model,
this.settingsManager,
(model) => {
this.agent.setModel(model);
this.sessionManager.saveModelChange(model.provider, model.id);
done();
this.showStatus(`Model: ${model.id}`);
async (model) => {
try {
await this.session.setModel(model);
this.footer.updateState(this.session.state);
this.updateEditorBorderColor();
done();
this.showStatus(`Model: ${model.id}`);
} catch (error) {
done();
this.showError(error instanceof Error ? error.message : String(error));
}
},
() => {
done();