diff --git a/apps/sim/app/api/tools/get-user-workflow/route.ts b/apps/sim/app/api/tools/get-user-workflow/route.ts index d6a6c9078b..775bfcdb0a 100644 --- a/apps/sim/app/api/tools/get-user-workflow/route.ts +++ b/apps/sim/app/api/tools/get-user-workflow/route.ts @@ -3,9 +3,9 @@ import { type NextRequest, NextResponse } from 'next/server' import { createLogger } from '@/lib/logs/console-logger' import { loadWorkflowFromNormalizedTables } from '@/lib/workflows/db-helpers' import { generateWorkflowYaml } from '@/lib/workflows/yaml-generator' +import { getBlock } from '@/blocks' import { db } from '@/db' import { workflow as workflowTable } from '@/db/schema' -import { getBlock } from '@/blocks' const logger = createLogger('GetUserWorkflowAPI') @@ -95,7 +95,7 @@ export async function POST(request: NextRequest) { Object.entries(workflowState.blocks).forEach(([blockId, blockState]) => { const block = blockState as any const blockConfig = getBlock(block.type) - + if (blockConfig) { blockSchemas[blockId] = { type: block.type, @@ -142,17 +142,23 @@ export async function POST(request: NextRequest) { }) // Generate workflow summary - const blockTypes = Object.values(workflowState.blocks).reduce((acc: Record, block: any) => { - acc[block.type] = (acc[block.type] || 0) + 1 - return acc - }, {}) + const blockTypes = Object.values(workflowState.blocks).reduce( + (acc: Record, block: any) => { + acc[block.type] = (acc[block.type] || 0) + 1 + return acc + }, + {} + ) - const categories = Object.values(blockSchemas).reduce((acc: Record, schema: any) => { - if (schema.category) { - acc[schema.category] = (acc[schema.category] || 0) + 1 - } - return acc - }, {}) + const categories = Object.values(blockSchemas).reduce( + (acc: Record, schema: any) => { + if (schema.category) { + acc[schema.category] = (acc[schema.category] || 0) + 1 + } + return acc + }, + {} + ) // Prepare response with clear context markers const response: any = { diff --git a/apps/sim/lib/copilot/service.ts b/apps/sim/lib/copilot/service.ts index dec724851b..7c8c6f982d 100644 --- a/apps/sim/lib/copilot/service.ts +++ b/apps/sim/lib/copilot/service.ts @@ -432,7 +432,7 @@ export async function generateChatResponse( }, { id: 'get_user_workflow', - name: 'Get User\'s Specific Workflow', + name: "Get User's Specific Workflow", description: 'Get the user\'s current workflow - this shows ONLY the blocks they have actually built and configured in their specific workflow, not general Sim Studio capabilities. Use this when the user asks about "my workflow", "this workflow", wants to know what blocks they currently have, OR when they ask "How do I..." questions about their workflow so you can give specific, actionable advice based on their actual setup.', params: {}, diff --git a/apps/sim/tools/workflow/get-yaml.ts b/apps/sim/tools/workflow/get-yaml.ts index 2621bf78a6..1143c62c57 100644 --- a/apps/sim/tools/workflow/get-yaml.ts +++ b/apps/sim/tools/workflow/get-yaml.ts @@ -4,7 +4,7 @@ export const getUserWorkflowTool: ToolConfig = { id: 'get_user_workflow', name: 'Get User Workflow', description: - 'Get the current user\'s specific workflow (not general Sim Studio documentation). Returns YAML format showing only the blocks that the user has actually built in their workflow, with their specific configurations, inputs, and connections.', + "Get the current user's specific workflow (not general Sim Studio documentation). Returns YAML format showing only the blocks that the user has actually built in their workflow, with their specific configurations, inputs, and connections.", version: '1.0.0', params: {