fix(cli): switched model command to session selector

- Routed the TUI /model command through the temporary session model selector used by /switch and Alt+P.
- Added slash-command coverage for /model opening the session selector.

Fixes #2846
This commit is contained in:
roboomp
2026-06-17 07:41:46 +00:00
parent 8eeb707387
commit de05b2d0af
3 changed files with 15 additions and 2 deletions
+1
View File
@@ -22,6 +22,7 @@
### Fixed
- Fixed `/model` in the TUI to open the active-session model switcher instead of the role-assignment picker ([#2846](https://github.com/can1357/oh-my-pi/issues/2846)).
- Fixed Whisper STT cache detection to require both encoder and decoder `.onnx` files, so partial model downloads now trigger a proper foreground download instead of being treated as fully cached
- Fixed same-process `JsRuntime` cleanup so disposing an older inline/direct runtime no longer deletes a newer runtime's JS helper globals; inactive cmux/direct runtimes now re-activate their globals before sequential use while overlapping cross-runtime runs fail explicitly.
- Fixed magic-keyword steering notices (`ultrathink-notice`, `orchestrate-notice`, `workflow-notice`) to be prepended before the related user message so they influence that same turn
@@ -308,7 +308,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
{
name: "model",
aliases: ["models"],
description: "Select model (opens selector UI)",
description: "Switch model for this session",
acpDescription: "Show current model selection",
handle: async (command, runtime) => {
if (command.args) {
@@ -341,7 +341,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
return commandConsumed();
},
handleTui: (_command, runtime) => {
runtime.ctx.showModelSelector();
runtime.ctx.showModelSelector({ temporaryOnly: true });
runtime.ctx.editor.setText("");
},
},
@@ -17,6 +17,18 @@ function createRuntime() {
};
}
describe("/model slash command", () => {
it("opens the temporary model selector for the active session", async () => {
const harness = createRuntime();
const handled = await executeBuiltinSlashCommand("/model", harness.runtime);
expect(handled).toBe(true);
expect(harness.showModelSelector).toHaveBeenCalledWith({ temporaryOnly: true });
expect(harness.setText).toHaveBeenCalledWith("");
});
});
describe("/switch slash command", () => {
it("opens the temporary model selector (mirrors alt+p)", async () => {
const harness = createRuntime();