fix: support /models alias for /model
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Commands: accept /models as an alias for /model.
|
||||||
- Debugging: add raw model stream logging flags and document gateway watch mode.
|
- Debugging: add raw model stream logging flags and document gateway watch mode.
|
||||||
- Agent: add claude-cli/opus-4.5 runner via Claude CLI with resume support (tools disabled).
|
- Agent: add claude-cli/opus-4.5 runner via Claude CLI with resume support (tools disabled).
|
||||||
- CLI: improve `logs` output (pretty/plain/JSONL), add gateway unreachable hint, and document logging.
|
- CLI: improve `logs` output (pretty/plain/JSONL), add gateway unreachable hint, and document logging.
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ describe("commands registry", () => {
|
|||||||
expect(detection.regex.test("/status:")).toBe(true);
|
expect(detection.regex.test("/status:")).toBe(true);
|
||||||
expect(detection.regex.test("/stop")).toBe(true);
|
expect(detection.regex.test("/stop")).toBe(true);
|
||||||
expect(detection.regex.test("/send:")).toBe(true);
|
expect(detection.regex.test("/send:")).toBe(true);
|
||||||
|
expect(detection.regex.test("/models")).toBe(true);
|
||||||
|
expect(detection.regex.test("/models list")).toBe(true);
|
||||||
expect(detection.regex.test("try /status")).toBe(false);
|
expect(detection.regex.test("try /status")).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const CHAT_COMMANDS: ChatCommandDefinition[] = [
|
|||||||
key: "model",
|
key: "model",
|
||||||
nativeName: "model",
|
nativeName: "model",
|
||||||
description: "Show or set the model.",
|
description: "Show or set the model.",
|
||||||
textAliases: ["/model"],
|
textAliases: ["/model", "/models"],
|
||||||
acceptsArgs: true,
|
acceptsArgs: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ describe("extractModelDirective", () => {
|
|||||||
expect(result.cleaned).toBe("");
|
expect(result.cleaned).toBe("");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("extracts /models with argument", () => {
|
||||||
|
const result = extractModelDirective("/models gpt-5");
|
||||||
|
expect(result.hasDirective).toBe(true);
|
||||||
|
expect(result.rawModel).toBe("gpt-5");
|
||||||
|
expect(result.cleaned).toBe("");
|
||||||
|
});
|
||||||
|
|
||||||
it("extracts /model with provider/model format", () => {
|
it("extracts /model with provider/model format", () => {
|
||||||
const result = extractModelDirective("/model anthropic/claude-opus-4-5");
|
const result = extractModelDirective("/model anthropic/claude-opus-4-5");
|
||||||
expect(result.hasDirective).toBe(true);
|
expect(result.hasDirective).toBe(true);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function extractModelDirective(
|
|||||||
if (!body) return { cleaned: "", hasDirective: false };
|
if (!body) return { cleaned: "", hasDirective: false };
|
||||||
|
|
||||||
const modelMatch = body.match(
|
const modelMatch = body.match(
|
||||||
/(?:^|\s)\/model(?=$|\s|:)\s*:?\s*([A-Za-z0-9_.:@-]+(?:\/[A-Za-z0-9_.:@-]+)?)?/i,
|
/(?:^|\s)\/models?(?=$|\s|:)\s*:?\s*([A-Za-z0-9_.:@-]+(?:\/[A-Za-z0-9_.:@-]+)?)?/i,
|
||||||
);
|
);
|
||||||
|
|
||||||
const aliases = (options?.aliases ?? [])
|
const aliases = (options?.aliases ?? [])
|
||||||
|
|||||||
Reference in New Issue
Block a user