mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-11 15:14:53 -05:00
improvement(copilot): structured metadata context + start block deprecation (#1362)
* progress * progress * deploy command update * add trigger mode modal * fix trigger icons' * fix corners for add trigger card * update serialization error visual in console * works * improvement(copilot-context): structured context for copilot * forgot long description * Update metadata params * progress * add better workflow ux * progress * highlighting works * trigger card * default agent workflow change * fix build error * remove any casts * address greptile comments * Diff input format * address greptile comments * improvement: ui/ux * improvement: changed to vertical scrolling * fix(workflow): ensure new blocks from sidebar click/drag use getUniqueBlockName (with semantic trigger base when applicable) * Validation + build/edit mark complete * fix trigger dropdown * Copilot stuff (lots of it) * Temp update prod dns * fix trigger check * fix * fix trigger mode check * Fix yaml imports * Fix autolayout error * fix deployed chat * Fix copilot input text overflow * fix trigger mode persistence in addBlock with enableTriggerMode flag passed in * Lint * Fix failing tests * Reset ishosted * Lint * input format for legacy starter * Fix executor --------- Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com> Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
This commit is contained in:
committed by
GitHub
parent
68df95906f
commit
b7876ca466
@@ -13,6 +13,7 @@ import { hasAdminPermission } from '@/lib/permissions/utils'
|
||||
import { processStreamingBlockLogs } from '@/lib/tokenization'
|
||||
import { getEmailDomain } from '@/lib/urls/utils'
|
||||
import { decryptSecret, generateRequestId } from '@/lib/utils'
|
||||
import { TriggerUtils } from '@/lib/workflows/triggers'
|
||||
import { getBlock } from '@/blocks'
|
||||
import { Executor } from '@/executor'
|
||||
import type { BlockLog, ExecutionResult } from '@/executor/types'
|
||||
@@ -430,9 +431,10 @@ export async function executeWorkflowForChat(
|
||||
(acc, [id, block]) => {
|
||||
const blockConfig = getBlock(block.type)
|
||||
const isTriggerBlock = blockConfig?.category === 'triggers'
|
||||
const isChatTrigger = block.type === 'chat_trigger'
|
||||
|
||||
// Skip trigger blocks during chat execution
|
||||
if (!isTriggerBlock) {
|
||||
// Keep all non-trigger blocks and also keep the chat_trigger block
|
||||
if (!isTriggerBlock || isChatTrigger) {
|
||||
acc[id] = block
|
||||
}
|
||||
return acc
|
||||
@@ -487,8 +489,10 @@ export async function executeWorkflowForChat(
|
||||
|
||||
// Filter edges to exclude connections to/from trigger blocks (same as manual execution)
|
||||
const triggerBlockIds = Object.keys(mergedStates).filter((id) => {
|
||||
const blockConfig = getBlock(mergedStates[id].type)
|
||||
return blockConfig?.category === 'triggers'
|
||||
const type = mergedStates[id].type
|
||||
const blockConfig = getBlock(type)
|
||||
// Exclude chat_trigger from the list so its edges are preserved
|
||||
return blockConfig?.category === 'triggers' && type !== 'chat_trigger'
|
||||
})
|
||||
|
||||
const filteredEdges = edges.filter(
|
||||
@@ -613,9 +617,29 @@ export async function executeWorkflowForChat(
|
||||
// Set up logging on the executor
|
||||
loggingSession.setupExecutor(executor)
|
||||
|
||||
// Determine the start block for chat execution
|
||||
const startBlock = TriggerUtils.findStartBlock(mergedStates, 'chat')
|
||||
|
||||
if (!startBlock) {
|
||||
const errorMessage =
|
||||
'No Chat trigger configured for this workflow. Add a Chat Trigger block to enable chat execution.'
|
||||
logger.error(`[${requestId}] ${errorMessage}`)
|
||||
await loggingSession.safeCompleteWithError({
|
||||
endedAt: new Date().toISOString(),
|
||||
totalDurationMs: 0,
|
||||
error: {
|
||||
message: errorMessage,
|
||||
stackTrace: undefined,
|
||||
},
|
||||
})
|
||||
throw new Error(errorMessage)
|
||||
}
|
||||
|
||||
const startBlockId = startBlock.blockId
|
||||
|
||||
let result
|
||||
try {
|
||||
result = await executor.execute(workflowId)
|
||||
result = await executor.execute(workflowId, startBlockId)
|
||||
} catch (error: any) {
|
||||
logger.error(`[${requestId}] Chat workflow execution failed:`, error)
|
||||
await loggingSession.safeCompleteWithError({
|
||||
|
||||
Reference in New Issue
Block a user