fix: improve /model user feedback + update docs

User messaging improvements:
- Rejection: '(>_<) Error: not a valid model' instead of '(^_^) Warning: Error:'
- Rejection: shows 'Model unchanged' + tip about /model and /provider
- Session-only: explains 'this session only' with reason and 'will revert on restart'
- Saved: clear '(saved to config)' confirmation

Docs updated:
- cli-commands.md, cli.md, messaging/index.md: /model now shows
  provider:model syntax, /provider command added to tables

Test fixes: deduplicated test names, assertions match new messages.
This commit is contained in:
teknium1 2026-03-08 06:13:11 -07:00
parent d07d867718
commit a23bcb81ce
6 changed files with 29 additions and 16 deletions

View file

@ -1414,7 +1414,9 @@ class GatewayRunner:
validation = {"accepted": True, "persist": True, "recognized": False, "message": None}
if not validation.get("accepted"):
return f"⚠️ {validation.get('message')}"
msg = validation.get("message", "Invalid model")
tip = "\n\nUse `/model` to see available models, `/provider` to see providers" if "Did you mean" not in msg else ""
return f"⚠️ {msg}{tip}"
# Persist to config only if validation approves
if validation.get("persist"):
@ -1445,7 +1447,10 @@ class GatewayRunner:
if validation.get("message"):
warning = f"\n⚠️ {validation['message']}"
persist_note = "saved to config" if validation.get("persist") else "session only"
if validation.get("persist"):
persist_note = "saved to config"
else:
persist_note = "this session only — will revert on restart"
return f"🤖 Model changed to `{new_model}` ({persist_note}){provider_note}{warning}\n_(takes effect on next message)_"
async def _handle_provider_command(self, event: MessageEvent) -> str: