-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(streaming-api): fix streaming api #1846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* improvement(performance): remove unused source/target indices, add index on snapshot id (#1603) * fix(blog): rename building to blogs with redirect (#1604) * improvement(privacy-policy): updated privacy policy for google (#1602) * updated privacy policy for google * update terms, privacy, and emails to incl address and update verbiage * feat(guardrails): added guardrails block/tools and docs (#1605) * Adding guardrails block * ack PR comments * cleanup checkbox in dark mode * cleanup * fix supabase tools * fix(inference-billing): fix inference billing when stream is true via API, add drag-and-drop functionality to deployed chat (#1606) * fix(inference): fix inference billing when stream is true via API * add drag-and-drop to deployed chat * feat(mistal): added mistral as a provider, updated model prices (#1607) * feat(mistal): added mistral as a provider, updated model prices * remove the ability for a block to reference its own outluts * fixed order of responses for guardrails block * feat(versions): added the ability to rename deployment versions (#1610) * fix(vulns): fix various vulnerabilities and enhanced code security (#1611) * fix(vulns): fix SSRF vulnerabilities * cleanup * cleanup * regen docs * remove unused deps * fix failing tests * cleanup * update deps * regen bun lock
…ad support for more blocks
…hboard improvements
* fix(debug-mode): remove duplicate debug mode flag (#1714) * feat(i18n): update translations (#1709) * improvement(condition): added variable and envvar highlighting for condition input (#1718) * fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data (#1719) * fix(dashboard): add additional context for paginated logs in dashboard, add empty state when selected cell has no data * apps/sim * renaming * remove relative import * feat(tools): added webflow OAuth + tools (#1720) * feat(tools): added webflow OAuth + tools * remove itemId from delete item * remove siteId * added webhook triggers + oauth scopes + site/collection selector * update sample payload for webflow triggers * cleanup * fix discord color * feat(i18n): update translations (#1721) * improvement(schedule): fix UI bug with schedule modal (#1722)
* fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix
…cp improvements, local kb file storage
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR fixes streaming API functionality by adding support for deployed workflow execution with proper output selection and formatting.
Key Changes:
- Added
resolveOutputIdsfunction in workflow execution route to convert block names to UUIDs for deployed workflows - Integrated
createStreamingResponsefor non-draft executions, enabling proper streaming for deployed chat workflows - Enhanced chat streaming hook to handle
outputConfigs, extracting and formatting specific block outputs in final responses - Fixed MDX documentation formatting issues with escaped brackets in JSON examples
Implementation:
The PR splits execution paths: draft workflows use console log streaming (existing behavior), while deployed workflows now use the new streaming API that properly handles selected outputs through the createStreamingResponse function. The resolveOutputIds function handles multiple output ID formats (UUID-based, dot notation, block names) and normalizes them for the executor.
Confidence Score: 4/5
- Safe to merge with minor considerations around edge case handling
- The implementation is solid with proper fallback handling and logging. Score reflects the complexity of the resolveOutputIds function which handles multiple formats and edge cases. While the logic appears sound, the multiple conditional branches increase cognitive complexity and could benefit from additional test coverage for edge cases like blocks with special characters in names or ambiguous output ID formats.
- Pay closer attention to
apps/sim/app/api/workflows/[id]/execute/route.ts- specifically theresolveOutputIdsfunction's block name matching logic
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/api/workflows/[id]/execute/route.ts | 4/5 | Added streaming API response for deployed workflows with new resolveOutputIds function to handle block name to UUID resolution |
| apps/sim/app/chat/hooks/use-chat-streaming.ts | 4/5 | Enhanced final event handling with outputConfigs support, formatting outputs from specific blocks and paths in chat responses |
Sequence Diagram
sequenceDiagram
participant Client as Chat Client
participant API as /api/workflows/[id]/execute
participant Streaming as createStreamingResponse
participant Executor as executeWorkflow
participant Hook as useChatStreaming
Client->>API: POST with trigger=chat & streaming
API->>API: Load deployed workflow state
API->>API: resolveOutputIds(selectedOutputs, blocks)
Note over API: Converts block names to UUIDs
API->>Streaming: createStreamingResponse(config)
Streaming->>Executor: executeWorkflow(workflow, streamConfig)
loop For each streaming block
Executor->>Streaming: onStream(blockId, stream)
Streaming->>Client: SSE chunk events
Client->>Hook: handleStreamedResponse
Hook->>Hook: Accumulate text chunks
end
Executor->>Streaming: onBlockComplete(blockId, output)
Note over Streaming: Extract selected outputs by path
Streaming->>Client: SSE chunk with formatted output
Streaming->>Streaming: Build minimal result with selected outputs
Streaming->>Client: SSE final event with output data
Client->>Hook: Process final event
Hook->>Hook: Extract values using outputConfigs
Hook->>Hook: Format outputs (JSON/string)
Hook->>Hook: Combine accumulated text + formatted outputs
Hook->>Client: Update message with final content
8 files reviewed, no comments
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
* fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint --------- Co-authored-by: Waleed <[email protected]> Co-authored-by: Vikhyath Mondreti <[email protected]>
* feat(i18n): update translations * fix(streaming-api): fix streaming api (#1846) * fix(billing): should allow restoring subscription (#1728) * fix(already-cancelled-sub): UI should allow restoring subscription * restore functionality fixed * fix * Fix streaming api * Fix uuid stuff * Lint * Stripe docs fix * Fix docs build error * Fix uuid check * Fix deployed chat streaming for non agent blocks * Fix lint
Summary
Fix streaming api for new executor and fix non agent block outputs in deployed chats
Type of Change
Testing
Manual
Checklist