Skip to content

Commit ddd3219

Browse files
Sg312icecrasher321waleedlatif1emir-karabegaadamgough
authored
improvement(copilot): v0.2 (#2086)
* Edit workflow returns workflow * Condense workflkow conosle * Limit console results to 2 * mark checkoff v1 * Mark and checkoff todo * Fixes * Plan mode * fix agent output * broken * Fixes * Fix diff mode persist * Fix diff coloring * Undo/redo * Checkpoint udno redo * fix(templates): fix templates details page (#1942) * Fix template details * Fix deps * fix(templates-details): restore approval feature, and keep details UI consistent, smoothen out creation of profile (#1943) * fix(templates): view current ui * update UI to be less cluttered * make state management for creating user profile smoother * fix autoselect logic * fix lint * fix(landing): need to propagate landing page copilot prompt (#1944) * fix(wand): subblocks should not be overwritten after wand gen (#1946) * fix(settings): fix broken api keys, help modal, logs, workflow renaming (#1945) * fix(settings): fix broken api keys, help modal, logs, workflow renaming * fix build * cleanup * use emcn * fix(files): changed file input value sample from string -> object (#1947) * improvement: usage-indicator UI (#1948) * fix(deploy): fix button (#1949) * fix(executor): consolidate execution hooks (#1950) * fix(autoconnect): should check if triggermode is set from the toolbar drag event directly (#1951) * improvement: templates styling (#1952) * improvement: template use button (#1954) * feat(newgifs): added new gifs (#1953) * new gifs * changed wording * changed wording * lowercase * changed wording * remove blog stuff --------- Co-authored-by: aadamgough <[email protected]> Co-authored-by: waleed <[email protected]> * feat(drizzle): added ods for analytics from drizzle (#1956) * feat(drizzle): added ods for analytics from drizzle * clean * fix(sheets): file selector had incorrect provider (#1958) * feat(docs): added docs analytics drizzle ods (#1957) * feat(docs): added docs analytics drizzle ods * fix build * fix provider for docs selector (#1959) * fix(custom-tools): updates to legacy + copilot generated custom tools (#1960) * fix(custom-tools): updates to existing tools * don't reorder custom tools in modal based on edit time * restructure custom tools to persist copilot generated tools * fix tests * fix(slack): remove update message incorrect canonical param (#1964) * fix(slack): send message tool * add logging * add more logs * add more logs * fix canonical param * improvement(templates): add share button, serve public templates routes for unauthenticated users and workspace one for authenticated users, improve settings style and organization (#1962) * improvement(templates): add share button, serve public templates routes for unauthenticated users and workspace one for authenticated users, improve settings style and organization * fix lint --------- Co-authored-by: Vikhyath Mondreti <[email protected]> * fix(onedrive): incorrect canonical param (#1966) * fix(onedrive): incorrect canonical param * fix download file * fix * fix * Revert "fix" This reverts commit f68ccd7. * Revert "fix" This reverts commit f3d8ace. * fix(executor): streaming after tool calls (#1963) * Provider changes * Fix lint * fix(code): readd wand to code subblock (#1969) * fix(cmd-k): z-index + reoder tools, triggers (#1970) * fix(cmd-k): z-index + reoder tools, triggers * fix more z-index styling * fix(executor): streaming response format (#1972) * fix(workflow-block): fix redeploy header to not repeatedly show redeploy when redeploy is not necessary (#1973) * fix(workflow-block): fix redeploy header to not repeatedly show redeploy when redeploy is not necessary * cleanup * improvement(platform): chat, emcn, terminal, usage-limit (#1974) * improvement(usage-indicator): layout * improvement: expand default terminal height * fix: swap workflow block ports * improvement: chat initial positioning * improvement(chat): display; improvement(emcn): popover attributes * fix lint * feat(settings): added reactquery for settings, removed zustand stores, added apollo, added workflow block selector dropdown search, added add environment variable option to empty env var dropdown (#1971) * feat(settings): added reactquery for settings, removed zustand stores, added apollo, added workflow block selector dropdown search, added add environment variable option to empty env var dropdown * fix delete dialog for copilot keys * simplify combobox * fix more z indices * consolidated duplicate hooks --------- Co-authored-by: Vikhyath Mondreti <[email protected]> * fix(copilot-subflows): copilot-added subflows id mismatch (#1977) * feat(i18n): update translations (#1978) * feat(i18n): update translations * fix build --------- Co-authored-by: waleedlatif1 <[email protected]> * fix(logs): show block inputs (#1979) * Fix executor lgos block inputs * Fix Comment * fix(onedrive): parse array values correctly (#1981) * fix(onedrive): parse array values correctly * fix onedrive * fix * fix onedrive input parsing by reusing code subblock * fix type * feat(files): add presigned URL generation support for execution files (#1980) * fix(popovers): billed account + async example command (#1982) * fix(settings): update usage data in settings > subs to use reactquery hooks (#1983) * fix(settings): update usage data in settings > subs to use reactquery hooks * standardize usage pills calculation * fix(output-selector): z-index in chat deploy modal (#1984) * improvement(logs): improved logs search (#1985) * improvement(logs): improved logs search * more * ack PR comments * feat(slack): added slack full message object in response (#1987) * feat(slack): add better error messages, reminder to add bot to app (#1990) * feat(i18n): update translations (#1989) Co-authored-by: waleedlatif1 <[email protected]> * fix(landing): hero stripe icon (#1988) * Temp * Update * Update * Update * Progress * Diff store fixes * simplify sockets ops for diff store * Search patterns tool * Better tool calls * Fix sanitizationg * Context window display * fix(variables): fix double stringification (#1991) * improvement(variables): support dot notation for nested objects (#1992) * improvement(tanstack): migrate multiple stores (#1994) * improvement(tanstack): migrate folders, knowledge to tanstack * fix types * fix(folders): duplicate (#1996) * fix(variables): fix variables block json resolution (#1997) * Improvement(ui/ux): signup, command-list, cursors, search modal, workflow runs, usage indicator (#1998) * improvement: signup loading, command-list, cursors, search modal ordering * improvement: workflow runs, search modal * improvement(usage-indicator): ui/ux * test(pr): hackathon (#1999) * test(pr): github trigger (#2000) * fix(usage-indicator): conditional rendering, upgrade, and ui/ux (#2001) * fix: usage-limit indicator and render conditonally on is billing enabled * fix: upgrade render * fix(notes): fix notes, tighten spacing, update deprecated zustand function, update use mention data to ignore block positon (#2002) * fix(pdfs): use unpdf instead of pdf-parse (#2004) * fix(modals): fix z-index for various modals and output selector and variables (#2005) * fix(condition): treat condition input the same as the code subblock (#2006) * feat(models): added gpt-5.1 (#2007) * improvement: runpath edges, blocks, active (#2008) * feat(i18n): update translations (#2009) * fix(triggers): check triggermode and consolidate block type (#2011) * fix(triggers): disabled trigger shouldn't be added to dag (#2012) * Fix disabled blocks * Comments * Fix api/chat trigger not found message * fix(tags): only show start block upstream if is ancestor (#2013) * fix(variables): Fix resolution on double < (#2016) * Fix variable <> * Ling * Clean * feat(billing): add notif for first failed payment, added upgrade email from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect (#2015) * feat(billing): add notif for first failed payment, added upgrade email from free, updated providers that supported granular tool control to support them, fixed envvar popover, fixed redirect to wrong workspace after oauth connect * fix build * ack PR comments * feat(performance): added reactquery hooks for workflow operations, for logs, fixed logs reloading, fix subscription UI (#2017) * feat(performance): added reactquery hooks for workflow operations, for logs, fixed logs reloading, fix subscription UI * use useInfiniteQuery for logs fetching * fix(copilot): run workflow supports input format and fix run id (#2018) * fix(router): fix error edge in router block + fix source handle problem (#2019) * Fix router block error port handling * Remove comment * Fix edge execution * improvement: code subblock, action bar, connections (#2024) * improvement: action bar, connections * fix: code block draggable resize * fix(response): fix response block http format (#2027) * Fix response block * Lint * fix(notes): fix notes block spacing, additional logs for billing transfer route (#2029) * fix(usage-data): refetch on usage limit update in settings (#2032) * fix(overage): fix pill calculation in the usage indicator to be consistent across views (#2034) * fix(workflows): fixed workflow loading in without start block, added templates RQ hook, cleaned up unused templates code (#2035) * fix(triggers): dedup + not surfacing deployment status log (#2033) * fix(triggers): dedup + not surfacing deployment status log * fix ms teams * change to microsoftteams * Revert "change to microsoftteams" This reverts commit 217f808. * fix * fix * fix provider name * fix oauth for msteams * improvement(undo-redo): expand undo-redo store to store 100 ops instead of 15 (#2036) * improvement(undo-redo): expand undo-redo store to store 100 ops instead of 15 * prevent undo-redo from interfering with subblock browser text undo * improvement(docs): remove copy page from mobile view on docs (#2037) * improvement(docs): remove copy page from mobile view on docs * bring title and pagenav lower on mobile * added cursor pointer to clickable components in docs * fix(workflow-block): clearing child workflow input format field must lazy cascade parent workflow state deletion (#2038) * Error tools * Ui tools * Navigate ui tool * Combine env vars and oauth tools * Plan mode section * Plan mode v1 * Plan mode v1 * Plan mode improvements * Build plan button * Make workflow plan editable * Tool improvements * Fix build plan button * Lint * Fix * Fix lint * Fix plan * Remove migrations * fix undo/redo settling of ops * Add migratinos back * Smoothen out diff store * Hide plan mode * Fix lint * Edit run workflow params * Fix lint * Fix tests * Fix typing * Fix build errors and lint * Fix build * Fix tests --------- Co-authored-by: Vikhyath Mondreti <[email protected]> Co-authored-by: Waleed <[email protected]> Co-authored-by: Emir Karabeg <[email protected]> Co-authored-by: Adam Gough <[email protected]> Co-authored-by: aadamgough <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]> Co-authored-by: Emir Karabeg <[email protected]> Co-authored-by: waleedlatif1 <[email protected]>
1 parent 67bd5bd commit ddd3219

File tree

88 files changed

+13607
-2071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+13607
-2071
lines changed

apps/sim/app/api/chat/manage/[id]/route.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('Chat Edit API Route', () => {
1919
const mockCreateErrorResponse = vi.fn()
2020
const mockEncryptSecret = vi.fn()
2121
const mockCheckChatAccess = vi.fn()
22+
const mockGetSession = vi.fn()
2223

2324
beforeEach(() => {
2425
vi.resetModules()
@@ -42,6 +43,10 @@ describe('Chat Edit API Route', () => {
4243
chat: { id: 'id', identifier: 'identifier', userId: 'userId' },
4344
}))
4445

46+
vi.doMock('@/lib/auth', () => ({
47+
getSession: mockGetSession,
48+
}))
49+
4550
vi.doMock('@/lib/logs/console/logger', () => ({
4651
createLogger: vi.fn().mockReturnValue({
4752
info: vi.fn(),
@@ -89,9 +94,7 @@ describe('Chat Edit API Route', () => {
8994

9095
describe('GET', () => {
9196
it('should return 401 when user is not authenticated', async () => {
92-
vi.doMock('@/lib/auth', () => ({
93-
getSession: vi.fn().mockResolvedValue(null),
94-
}))
97+
mockGetSession.mockResolvedValueOnce(null)
9598

9699
const req = new NextRequest('http://localhost:3000/api/chat/manage/chat-123')
97100
const { GET } = await import('@/app/api/chat/manage/[id]/route')
@@ -102,11 +105,9 @@ describe('Chat Edit API Route', () => {
102105
})
103106

104107
it('should return 404 when chat not found or access denied', async () => {
105-
vi.doMock('@/lib/auth', () => ({
106-
getSession: vi.fn().mockResolvedValue({
107-
user: { id: 'user-id' },
108-
}),
109-
}))
108+
mockGetSession.mockResolvedValueOnce({
109+
user: { id: 'user-id' },
110+
})
110111

111112
mockCheckChatAccess.mockResolvedValue({ hasAccess: false })
112113

apps/sim/app/api/copilot/chat/route.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,8 @@ describe('Copilot Chat API Route', () => {
563563
],
564564
messageCount: 4,
565565
previewYaml: null,
566+
config: null,
567+
planArtifact: null,
566568
createdAt: '2024-01-01T00:00:00.000Z',
567569
updatedAt: '2024-01-02T00:00:00.000Z',
568570
},
@@ -576,6 +578,8 @@ describe('Copilot Chat API Route', () => {
576578
],
577579
messageCount: 2,
578580
previewYaml: null,
581+
config: null,
582+
planArtifact: null,
579583
createdAt: '2024-01-03T00:00:00.000Z',
580584
updatedAt: '2024-01-04T00:00:00.000Z',
581585
},

apps/sim/app/api/copilot/chat/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ChatMessageSchema = z.object({
5353
])
5454
.optional()
5555
.default('claude-4.5-sonnet'),
56-
mode: z.enum(['ask', 'agent']).optional().default('agent'),
56+
mode: z.enum(['ask', 'agent', 'plan']).optional().default('agent'),
5757
prefetch: z.boolean().optional(),
5858
createNewChat: z.boolean().optional().default(false),
5959
stream: z.boolean().optional().default(true),
@@ -880,6 +880,8 @@ export async function GET(req: NextRequest) {
880880
title: copilotChats.title,
881881
model: copilotChats.model,
882882
messages: copilotChats.messages,
883+
planArtifact: copilotChats.planArtifact,
884+
config: copilotChats.config,
883885
createdAt: copilotChats.createdAt,
884886
updatedAt: copilotChats.updatedAt,
885887
})
@@ -897,6 +899,8 @@ export async function GET(req: NextRequest) {
897899
messages: Array.isArray(chat.messages) ? chat.messages : [],
898900
messageCount: Array.isArray(chat.messages) ? chat.messages.length : 0,
899901
previewYaml: null, // Not needed for chat list
902+
planArtifact: chat.planArtifact || null,
903+
config: chat.config || null,
900904
createdAt: chat.createdAt,
901905
updatedAt: chat.updatedAt,
902906
}))

apps/sim/app/api/copilot/chat/update-messages/route.ts

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ const UpdateMessagesSchema = z.object({
3737
.optional(),
3838
})
3939
),
40+
planArtifact: z.string().nullable().optional(),
41+
config: z
42+
.object({
43+
mode: z.enum(['ask', 'build', 'plan']).optional(),
44+
model: z.string().optional(),
45+
})
46+
.nullable()
47+
.optional(),
4048
})
4149

4250
export async function POST(req: NextRequest) {
@@ -49,7 +57,7 @@ export async function POST(req: NextRequest) {
4957
}
5058

5159
const body = await req.json()
52-
const { chatId, messages } = UpdateMessagesSchema.parse(body)
60+
const { chatId, messages, planArtifact, config } = UpdateMessagesSchema.parse(body)
5361

5462
// Verify that the chat belongs to the user
5563
const [chat] = await db
@@ -62,18 +70,27 @@ export async function POST(req: NextRequest) {
6270
return createNotFoundResponse('Chat not found or unauthorized')
6371
}
6472

65-
// Update chat with new messages
66-
await db
67-
.update(copilotChats)
68-
.set({
69-
messages: messages,
70-
updatedAt: new Date(),
71-
})
72-
.where(eq(copilotChats.id, chatId))
73+
// Update chat with new messages, plan artifact, and config
74+
const updateData: Record<string, any> = {
75+
messages: messages,
76+
updatedAt: new Date(),
77+
}
78+
79+
if (planArtifact !== undefined) {
80+
updateData.planArtifact = planArtifact
81+
}
82+
83+
if (config !== undefined) {
84+
updateData.config = config
85+
}
86+
87+
await db.update(copilotChats).set(updateData).where(eq(copilotChats.id, chatId))
7388

74-
logger.info(`[${tracker.requestId}] Successfully updated chat messages`, {
89+
logger.info(`[${tracker.requestId}] Successfully updated chat`, {
7590
chatId,
7691
newMessageCount: messages.length,
92+
hasPlanArtifact: !!planArtifact,
93+
hasConfig: !!config,
7794
})
7895

7996
return NextResponse.json({
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import { db } from '@sim/db'
2+
import { templates } from '@sim/db/schema'
3+
import { eq } from 'drizzle-orm'
4+
import { type NextRequest, NextResponse } from 'next/server'
5+
import { checkInternalApiKey } from '@/lib/copilot/utils'
6+
import { createLogger } from '@/lib/logs/console/logger'
7+
import { generateRequestId } from '@/lib/utils'
8+
import { sanitizeForCopilot } from '@/lib/workflows/json-sanitizer'
9+
10+
const logger = createLogger('TemplatesSanitizedAPI')
11+
12+
export const revalidate = 0
13+
14+
/**
15+
* GET /api/templates/approved/sanitized
16+
* Returns all approved templates with their sanitized JSONs, names, and descriptions
17+
* Requires internal API secret authentication via X-API-Key header
18+
*/
19+
export async function GET(request: NextRequest) {
20+
const requestId = generateRequestId()
21+
22+
try {
23+
const url = new URL(request.url)
24+
const hasApiKey = !!request.headers.get('x-api-key')
25+
26+
// Check internal API key authentication
27+
const authResult = checkInternalApiKey(request)
28+
if (!authResult.success) {
29+
logger.warn(`[${requestId}] Authentication failed for approved sanitized templates`, {
30+
error: authResult.error,
31+
hasApiKey,
32+
howToUse: 'Add header: X-API-Key: <INTERNAL_API_SECRET>',
33+
})
34+
return NextResponse.json(
35+
{
36+
error: authResult.error,
37+
hint: 'Include X-API-Key header with INTERNAL_API_SECRET value',
38+
},
39+
{ status: 401 }
40+
)
41+
}
42+
43+
// Fetch all approved templates
44+
const approvedTemplates = await db
45+
.select({
46+
id: templates.id,
47+
name: templates.name,
48+
details: templates.details,
49+
state: templates.state,
50+
tags: templates.tags,
51+
requiredCredentials: templates.requiredCredentials,
52+
})
53+
.from(templates)
54+
.where(eq(templates.status, 'approved'))
55+
56+
// Process each template to sanitize for copilot
57+
const sanitizedTemplates = approvedTemplates
58+
.map((template) => {
59+
try {
60+
const copilotSanitized = sanitizeForCopilot(template.state as any)
61+
62+
if (copilotSanitized?.blocks) {
63+
Object.values(copilotSanitized.blocks).forEach((block: any) => {
64+
if (block && typeof block === 'object') {
65+
block.outputs = undefined
66+
block.position = undefined
67+
block.height = undefined
68+
block.layout = undefined
69+
block.horizontalHandles = undefined
70+
71+
// Also clean nested nodes recursively
72+
if (block.nestedNodes) {
73+
Object.values(block.nestedNodes).forEach((nestedBlock: any) => {
74+
if (nestedBlock && typeof nestedBlock === 'object') {
75+
nestedBlock.outputs = undefined
76+
nestedBlock.position = undefined
77+
nestedBlock.height = undefined
78+
nestedBlock.layout = undefined
79+
nestedBlock.horizontalHandles = undefined
80+
}
81+
})
82+
}
83+
}
84+
})
85+
}
86+
87+
const details = template.details as { tagline?: string; about?: string } | null
88+
const description = details?.tagline || details?.about || ''
89+
90+
return {
91+
id: template.id,
92+
name: template.name,
93+
description,
94+
tags: template.tags,
95+
requiredCredentials: template.requiredCredentials,
96+
sanitizedJson: copilotSanitized,
97+
}
98+
} catch (error) {
99+
logger.error(`[${requestId}] Error sanitizing template ${template.id}`, {
100+
error: error instanceof Error ? error.message : String(error),
101+
})
102+
return null
103+
}
104+
})
105+
.filter((t): t is NonNullable<typeof t> => t !== null)
106+
107+
const response = {
108+
templates: sanitizedTemplates,
109+
count: sanitizedTemplates.length,
110+
}
111+
112+
return NextResponse.json(response)
113+
} catch (error) {
114+
logger.error(`[${requestId}] Error fetching approved sanitized templates`, {
115+
error: error instanceof Error ? error.message : String(error),
116+
stack: error instanceof Error ? error.stack : undefined,
117+
})
118+
return NextResponse.json(
119+
{
120+
error: 'Internal server error',
121+
requestId,
122+
},
123+
{ status: 500 }
124+
)
125+
}
126+
}
127+
128+
// Add a helpful OPTIONS handler for CORS preflight
129+
export async function OPTIONS(request: NextRequest) {
130+
const requestId = generateRequestId()
131+
logger.info(`[${requestId}] OPTIONS request received for /api/templates/approved/sanitized`)
132+
133+
return new NextResponse(null, {
134+
status: 200,
135+
headers: {
136+
'Access-Control-Allow-Methods': 'GET, OPTIONS',
137+
'Access-Control-Allow-Headers': 'X-API-Key, Content-Type',
138+
},
139+
})
140+
}

apps/sim/app/api/workflows/[id]/state/route.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { eq } from 'drizzle-orm'
44
import { type NextRequest, NextResponse } from 'next/server'
55
import { z } from 'zod'
66
import { getSession } from '@/lib/auth'
7+
import { env } from '@/lib/env'
78
import { createLogger } from '@/lib/logs/console/logger'
89
import { generateRequestId } from '@/lib/utils'
910
import { extractAndPersistCustomTools } from '@/lib/workflows/custom-tools-persistence'
@@ -248,6 +249,26 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
248249
const elapsed = Date.now() - startTime
249250
logger.info(`[${requestId}] Successfully saved workflow ${workflowId} state in ${elapsed}ms`)
250251

252+
try {
253+
const socketUrl = env.SOCKET_SERVER_URL || 'http://localhost:3002'
254+
const notifyResponse = await fetch(`${socketUrl}/api/workflow-updated`, {
255+
method: 'POST',
256+
headers: { 'Content-Type': 'application/json' },
257+
body: JSON.stringify({ workflowId }),
258+
})
259+
260+
if (!notifyResponse.ok) {
261+
logger.warn(
262+
`[${requestId}] Failed to notify Socket.IO server about workflow ${workflowId} update`
263+
)
264+
}
265+
} catch (notificationError) {
266+
logger.warn(
267+
`[${requestId}] Error notifying Socket.IO server about workflow ${workflowId} update`,
268+
notificationError
269+
)
270+
}
271+
251272
return NextResponse.json({ success: true, warnings }, { status: 200 })
252273
} catch (error: any) {
253274
const elapsed = Date.now() - startTime

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ export function OutputSelect({
7070
const popoverRef = useRef<HTMLDivElement>(null)
7171
const contentRef = useRef<HTMLDivElement>(null)
7272
const blocks = useWorkflowStore((state) => state.blocks)
73-
const { isShowingDiff, isDiffReady, diffWorkflow } = useWorkflowDiffStore()
73+
const { isShowingDiff, isDiffReady, hasActiveDiff, baselineWorkflow } = useWorkflowDiffStore()
7474
const subBlockValues = useSubBlockStore((state) =>
7575
workflowId ? state.workflowValues[workflowId] : null
7676
)
7777

7878
/**
7979
* Uses diff blocks when in diff mode, otherwise main blocks
8080
*/
81-
const workflowBlocks = isShowingDiff && isDiffReady && diffWorkflow ? diffWorkflow.blocks : blocks
81+
const shouldUseBaseline = hasActiveDiff && isDiffReady && !isShowingDiff && baselineWorkflow
82+
const workflowBlocks =
83+
shouldUseBaseline && baselineWorkflow ? baselineWorkflow.blocks : (blocks as any)
8284

8385
/**
8486
* Extracts all available workflow outputs for the dropdown
@@ -100,7 +102,7 @@ export function OutputSelect({
100102
const blockArray = Object.values(workflowBlocks)
101103
if (blockArray.length === 0) return outputs
102104

103-
blockArray.forEach((block) => {
105+
blockArray.forEach((block: any) => {
104106
if (block.type === 'starter' || !block?.id || !block?.type) return
105107

106108
const blockName =
@@ -110,8 +112,8 @@ export function OutputSelect({
110112

111113
const blockConfig = getBlock(block.type)
112114
const responseFormatValue =
113-
isShowingDiff && isDiffReady && diffWorkflow
114-
? diffWorkflow.blocks[block.id]?.subBlocks?.responseFormat?.value
115+
shouldUseBaseline && baselineWorkflow
116+
? baselineWorkflow.blocks?.[block.id]?.subBlocks?.responseFormat?.value
115117
: subBlockValues?.[block.id]?.responseFormat
116118
const responseFormat = parseResponseFormatSafely(responseFormatValue, block.id)
117119

@@ -164,7 +166,16 @@ export function OutputSelect({
164166
})
165167

166168
return outputs
167-
}, [workflowBlocks, workflowId, isShowingDiff, isDiffReady, diffWorkflow, blocks, subBlockValues])
169+
}, [
170+
workflowBlocks,
171+
workflowId,
172+
isShowingDiff,
173+
isDiffReady,
174+
baselineWorkflow,
175+
blocks,
176+
subBlockValues,
177+
shouldUseBaseline,
178+
])
168179

169180
/**
170181
* Checks if an output is currently selected by comparing both ID and label

0 commit comments

Comments
 (0)