Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion gui/src/components/mainInput/ContinueInputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [
"repo-map",
];

// Slash command sources that should be allowed in edit mode
const EDIT_ALLOWED_SLASH_COMMAND_SOURCES: Set<string> = new Set([
"yaml-prompt-block",
"mcp-prompt",
"prompt-file-v1",
"prompt-file-v2",
"invokable-rule",
]);

function ContinueInputBox(props: ContinueInputBoxProps) {
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const availableSlashCommands = useAppSelector(
Expand All @@ -50,7 +59,15 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
const editModeState = useAppSelector((state) => state.editModeState);

const filteredSlashCommands = useMemo(() => {
return isInEdit ? [] : availableSlashCommands;
if (!isInEdit) {
return availableSlashCommands;
}

// In edit mode, only allow prompt-based slash commands
return availableSlashCommands.filter((command) => {
// Check if this command has a source property and if it's allowed in edit mode
return command.source && EDIT_ALLOWED_SLASH_COMMAND_SOURCES.has(command.source);
});
}, [isInEdit, availableSlashCommands]);

const filteredContextProviders = useMemo(() => {
Expand Down
1 change: 1 addition & 0 deletions gui/src/components/mainInput/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export interface ComboBoxItem {
icon?: string;
action?: () => void;
subActions?: ComboBoxSubAction[];
source?: string;
}
1 change: 1 addition & 0 deletions gui/src/redux/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const selectSlashCommandComboBoxInputs = createSelector(
description: cmd.description,
type: "slashCommand" as ComboBoxItemType,
content: content,
source: cmd.source,
} as ComboBoxItem;
}) || []
);
Expand Down
Loading