This commit is contained in:
Siddharth Ganesan
2025-07-08 22:15:13 -07:00
parent 37c4f835dd
commit 6ca8311a76
3 changed files with 20 additions and 14 deletions

View File

@@ -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<string, number>, block: any) => {
acc[block.type] = (acc[block.type] || 0) + 1
return acc
}, {})
const blockTypes = Object.values(workflowState.blocks).reduce(
(acc: Record<string, number>, block: any) => {
acc[block.type] = (acc[block.type] || 0) + 1
return acc
},
{}
)
const categories = Object.values(blockSchemas).reduce((acc: Record<string, number>, schema: any) => {
if (schema.category) {
acc[schema.category] = (acc[schema.category] || 0) + 1
}
return acc
}, {})
const categories = Object.values(blockSchemas).reduce(
(acc: Record<string, number>, schema: any) => {
if (schema.category) {
acc[schema.category] = (acc[schema.category] || 0) + 1
}
return acc
},
{}
)
// Prepare response with clear context markers
const response: any = {

View File

@@ -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: {},

View File

@@ -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: {