feat(ui): offer only conversation commands in the workflow editor's chat

This commit is contained in:
sam committed 2026-10-19 02:53:06 +11:00
1 parent 35e2e0f943
commit e98f68ecba
3 files changed
+117 -104

No files matched your search

+10
View File
@@ -12,6 +12,16 @@ const ANY_TOKEN = /(?:^|\s)\/[^\s]*$/;
/** How many matches the palette will show at once. */
const MAX_MATCHES = 8;
/** The commands a workflow editor's conversation offers: those about the conversation itself. */
const WORKFLOW_COMMANDS = new Set([
"/model", "/new", "/reset", "/retry", "/undo", "/title", "/branch", "/fork",
"/compress", "/compact", "/sessions", "/resume", "/delete",
]);
export function commandsFor<T extends { command: string }>(specs: T[], workflowEditor: boolean): T[] {
return workflowEditor ? specs.filter((spec) => WORKFLOW_COMMANDS.has(spec.command)) : specs;
}
/**
* matchesFor returns the commands worth offering for the text before the
* caret, matched on the command and its description together so a word from
+8 -5
View File
@@ -2,7 +2,7 @@ import { computed, onMounted, onUnmounted, ref, watch, type Ref } from "vue";
import { api } from "@/lib/api";
import { activeChannel, isWorkflowChannel } from "./channel";
import { matchesFor } from "./commands";
import { commandsFor, matchesFor } from "./commands";
import {
resolveTurn,
retryChatTurn,
@@ -244,10 +244,13 @@ export async function refreshSessions(): Promise<void> {
selectedProvider.value = data.active_provider || providers[0] || "";
selectedModel.value = data.active_model || "";
commandSpecs.value = (data.commands || []).map((item) =>
typeof item === "string"
? { command: item, usage: item, description: "" }
: item,
commandSpecs.value = commandsFor(
(data.commands || []).map((item) =>
typeof item === "string"
? { command: item, usage: item, description: "" }
: item,
),
isWorkflowChannel(channel),
);
if (!currentSession.value && sessionList[0]) {