From 5b94db6905a06315e55c4087dd440b7409a5b6ad Mon Sep 17 00:00:00 2001 From: Siddharth Ganesan Date: Thu, 9 Apr 2026 19:38:42 -0700 Subject: [PATCH] Options ordering --- .../app/api/webhooks/trigger/[path]/route.ts | 21 ++---- .../components/chat-content/chat-content.tsx | 73 ++++++++++++------- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/apps/sim/app/api/webhooks/trigger/[path]/route.ts b/apps/sim/app/api/webhooks/trigger/[path]/route.ts index 0db8bd9ad7..abb37e8960 100644 --- a/apps/sim/app/api/webhooks/trigger/[path]/route.ts +++ b/apps/sim/app/api/webhooks/trigger/[path]/route.ts @@ -155,19 +155,14 @@ async function handleWebhookPost( if (shouldSkipWebhookEvent(foundWebhook, body, requestId)) { continue } - - try { - const response = await queueWebhookExecution(foundWebhook, foundWorkflow, body, request, { - requestId, - path, - actorUserId: preprocessResult.actorUserId, - executionId: preprocessResult.executionId, - correlation: preprocessResult.correlation, - }) - responses.push(response) - } catch (error) { - throw error - } + const response = await queueWebhookExecution(foundWebhook, foundWorkflow, body, request, { + requestId, + path, + actorUserId: preprocessResult.actorUserId, + executionId: preprocessResult.executionId, + correlation: preprocessResult.correlation, + }) + responses.push(response) } if (responses.length === 0) { diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx index d73196f34a..56a7c7b5f6 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx @@ -241,40 +241,57 @@ export function ChatContent({ const hasSpecialContent = parsed.hasPendingTag || parsed.segments.some((s) => s.type !== 'text') if (hasSpecialContent) { + type RenderGroup = + | { kind: 'inline'; markdown: string } + | { kind: 'block'; segment: ContentSegment; index: number } + + const groups: RenderGroup[] = [] + let pendingMarkdown = '' + + const flushMarkdown = () => { + if (pendingMarkdown.trim()) { + groups.push({ kind: 'inline', markdown: pendingMarkdown }) + } + pendingMarkdown = '' + } + + for (let i = 0; i < parsed.segments.length; i++) { + const s = parsed.segments[i] + if (s.type === 'workspace_resource') { + const label = s.data.title || s.data.id + pendingMarkdown += `[${label}](#wsres-${s.data.type}-${s.data.id})` + } else if (s.type === 'text' || s.type === 'thinking') { + pendingMarkdown += s.content + } else { + flushMarkdown() + groups.push({ kind: 'block', segment: s, index: i }) + } + } + flushMarkdown() + return (
- {parsed.segments.map((segment, i) => { - if ( - segment.type === 'text' || - segment.type === 'thinking' || - segment.type === 'workspace_resource' - ) { - return null + {groups.map((group, i) => { + if (group.kind === 'inline') { + return ( +
:first-child]:mt-0 [&>:last-child]:mb-0')} + > + + {group.markdown} + +
+ ) } return ( - + ) })} - {(() => { - const reassembled = parsed.segments - .map((s) => { - if (s.type === 'workspace_resource') { - const label = s.data.title || s.data.id - return `[${label}](#wsres-${s.data.type}-${s.data.id})` - } - if (s.type === 'text' || s.type === 'thinking') return s.content - return '' - }) - .join('') - if (!reassembled.trim()) return null - return ( -
:first-child]:mt-0 [&>:last-child]:mb-0')}> - - {reassembled} - -
- ) - })()} {parsed.hasPendingTag && isStreaming && }
)