Skip to content

Commit fefcb61

Browse files
committed
Fix actions mapping
1 parent 24173bb commit fefcb61

File tree

2 files changed

+18
-2
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input
    • stores/panel/copilot

2 files changed

+18
-2
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/constants.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,20 @@ export interface SlashCommand {
209209
export const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
210210
{ id: 'fast', label: 'Fast' },
211211
{ id: 'research', label: 'Research' },
212-
{ id: 'superagent', label: 'Actions' },
212+
{ id: 'actions', label: 'Actions' },
213213
] as const
214214

215+
/**
216+
* Maps UI command IDs to API command IDs.
217+
* Some commands have different IDs for display vs API (e.g., "actions" -> "superagent")
218+
*/
219+
export function getApiCommandId(uiCommandId: string): string {
220+
const commandMapping: Record<string, string> = {
221+
actions: 'superagent',
222+
}
223+
return commandMapping[uiCommandId] || uiCommandId
224+
}
225+
215226
export const WEB_COMMANDS: readonly SlashCommand[] = [
216227
{ id: 'search', label: 'Search' },
217228
{ id: 'read', label: 'Read' },

apps/sim/stores/panel/copilot/store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,9 +2815,14 @@ export const useCopilotStore = create<CopilotStore>()(
28152815
mode === 'ask' ? 'ask' : mode === 'plan' ? 'plan' : 'agent'
28162816

28172817
// Extract slash commands from contexts (lowercase) and filter them out from contexts
2818+
// Map UI command IDs to API command IDs (e.g., "actions" -> "superagent")
2819+
const uiToApiCommandMap: Record<string, string> = { actions: 'superagent' }
28182820
const commands = contexts
28192821
?.filter((c) => c.kind === 'slash_command' && 'command' in c)
2820-
.map((c) => (c as any).command.toLowerCase()) as string[] | undefined
2822+
.map((c) => {
2823+
const uiCommand = (c as any).command.toLowerCase()
2824+
return uiToApiCommandMap[uiCommand] || uiCommand
2825+
}) as string[] | undefined
28212826
const filteredContexts = contexts?.filter((c) => c.kind !== 'slash_command')
28222827

28232828
const result = await sendStreamingMessage({

0 commit comments

Comments
 (0)