mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-23 22:08:09 -05:00
Fix actions mapping
This commit is contained in:
@@ -209,9 +209,20 @@ export interface SlashCommand {
|
||||
export const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
|
||||
{ id: 'fast', label: 'Fast' },
|
||||
{ id: 'research', label: 'Research' },
|
||||
{ id: 'superagent', label: 'Actions' },
|
||||
{ id: 'actions', label: 'Actions' },
|
||||
] as const
|
||||
|
||||
/**
|
||||
* Maps UI command IDs to API command IDs.
|
||||
* Some commands have different IDs for display vs API (e.g., "actions" -> "superagent")
|
||||
*/
|
||||
export function getApiCommandId(uiCommandId: string): string {
|
||||
const commandMapping: Record<string, string> = {
|
||||
actions: 'superagent',
|
||||
}
|
||||
return commandMapping[uiCommandId] || uiCommandId
|
||||
}
|
||||
|
||||
export const WEB_COMMANDS: readonly SlashCommand[] = [
|
||||
{ id: 'search', label: 'Search' },
|
||||
{ id: 'read', label: 'Read' },
|
||||
|
||||
@@ -2815,9 +2815,14 @@ export const useCopilotStore = create<CopilotStore>()(
|
||||
mode === 'ask' ? 'ask' : mode === 'plan' ? 'plan' : 'agent'
|
||||
|
||||
// Extract slash commands from contexts (lowercase) and filter them out from contexts
|
||||
// Map UI command IDs to API command IDs (e.g., "actions" -> "superagent")
|
||||
const uiToApiCommandMap: Record<string, string> = { actions: 'superagent' }
|
||||
const commands = contexts
|
||||
?.filter((c) => c.kind === 'slash_command' && 'command' in c)
|
||||
.map((c) => (c as any).command.toLowerCase()) as string[] | undefined
|
||||
.map((c) => {
|
||||
const uiCommand = (c as any).command.toLowerCase()
|
||||
return uiToApiCommandMap[uiCommand] || uiCommand
|
||||
}) as string[] | undefined
|
||||
const filteredContexts = contexts?.filter((c) => c.kind !== 'slash_command')
|
||||
|
||||
const result = await sendStreamingMessage({
|
||||
|
||||
Reference in New Issue
Block a user