feat: api response block and implementation#510
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@adiologydev is attempting to deploy a commit to the Sim Studio Team on Vercel. A member of the Team first needs to authorize it. |
|
@adiologydev please address the test errors and also add information in the PR description for testing, and check all relevant boxes. Then, add something at the end for additional information or delete it if unnecessary whenever you're done with your changes |
There was a problem hiding this comment.
PR Summary
Implements a new Response block feature enabling structured API responses in workflows, with comprehensive HTTP response control and documentation.
- Added
apps/sim/blocks/blocks/response.tsimplementing Response block with configurable data, status codes, and headers - Enhanced
apps/sim/executor/handlers/response/response-handler.tsto process response blocks with proper status codes (default 200) and Content-Type headers - Modified
apps/sim/app/w/[id]/components/workflow-block/workflow-block.tsxto make Response blocks terminal nodes (no output connections) - Added support for 'json-object' generation type in
apps/sim/app/api/codegen/route.tsfor structured JSON responses - Improved input format handling in
apps/sim/blocks/blocks/starter.tsfor better API request validation
21 files reviewed, 6 comments
Edit PR Review Bot Settings | Greptile
| @@ -0,0 +1,300 @@ | |||
| import { useRef, useState } from 'react' | |||
There was a problem hiding this comment.
need to wrap handleDragOver, handleInputChange, handleTagSelect, and handleEnvVarSelect in useCallbacks. Not blocking, can be done in a follow up PR.
| // layout: 'full', | ||
| // condition: { field: 'startWorkflow', value: 'manual' }, | ||
| // }, | ||
| { |
There was a problem hiding this comment.
Minor issue with this -- the variables are not correctly matching up. And the autocomplete / dropdown doesn't show them.
Screen.Recording.2025-06-21.at.11.05.38.AM.mov
There was a problem hiding this comment.
Second question -- it doesn't let me delete all the fields after adding them. E.g. I can't delete Name and Joke after adding them. The trash can becomes disabled.
There was a problem hiding this comment.
Minor issue with this -- the variables are not correctly matching up. And the autocomplete / dropdown doesn't show them.
Screen.Recording.2025-06-21.at.11.05.38.AM.mov
This is happening with all blocks which have tag input and variable input; it worked 50/50 of the time for me.
It's those specific components which need to be addressed in another PR.
There was a problem hiding this comment.
Second question -- it doesn't let me delete all the fields after adding them. E.g. I can't delete Name and Joke after adding them. The trash can becomes disabled.
Pushing a fix for this.
|
A few issues.
Screen.Recording.2025-06-21.at.11.16.29.AM.mov
Screen.Recording.2025-06-21.at.11.19.32.AM.mov |
|


Description
Added a new Response block, which lets users add an ending to their workflows and send a structured API response back.
Reinstated the old input fields block. I tried using JSON schema, but this UX is much better (IMHO).
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Locally by running API calls on deployed workflows
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Checklist:
bun run test)Security Considerations:
Additional Information:
Any additional information, configuration or data that might be necessary to reproduce the issue or use the feature.