Skip to content

Commit 88668fe

Browse files
authored
improvement(starter): added tag dropdown for input fields, fixed response block, remove logs and workflowConnections from api response(#716)
* added start block input fields to tag dropdown * remove logs and workflowConnections from metadata for API triggered executions * added field name validation for start block input to prevent JSON/API errors and user error * fix response stringifcation, reuse input format from starter block for response format, add tag dropdown & connection block handling for response format * hepler func for filteredResult * fix response format w builder * fix stringification of response handler * expand fields by default * cleanup
1 parent fe5402a commit 88668fe

File tree

13 files changed

+493
-990
lines changed

13 files changed

+493
-990
lines changed

apps/docs/content/docs/tools/linkup.mdx

Lines changed: 10 additions & 17 deletions
Large diffs are not rendered by default.

apps/docs/content/docs/tools/telegram.mdx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,17 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
1111
icon={true}
1212
iconSvg={`<svg className="block-icon"
1313
14+
xmlns='http://www.w3.org/2000/svg'
15+
viewBox='0 0 24 24'
1416
1517
16-
viewBox='-5 0 41 33'
1718
fill='none'
18-
xmlns='http://www.w3.org/2000/svg'
1919
>
20-
<circle cx='16' cy='16' r='14' fill='url(#paint0_linear_87_7225)' />
20+
<circle cx='12' cy='12' r='10' fill='#0088CC' />
2121
<path
22-
d='M22.9866 10.2088C23.1112 9.40332 22.3454 8.76755 21.6292 9.082L7.36482 15.3448C6.85123 15.5703 6.8888 16.3483 7.42147 16.5179L10.3631 17.4547C10.9246 17.6335 11.5325 17.541 12.0228 17.2023L18.655 12.6203C18.855 12.4821 19.073 12.7665 18.9021 12.9426L14.1281 17.8646C13.665 18.3421 13.7569 19.1512 14.314 19.5005L19.659 22.8523C20.2585 23.2282 21.0297 22.8506 21.1418 22.1261L22.9866 10.2088Z'
22+
d='M16.7 8.4c.1-.6-.4-1.1-1-.8l-9.8 4.3c-.4.2-.4.8.1.9l2.1.7c.4.1.8.1 1.1-.2l4.5-3.1c.1-.1.3.1.2.2l-3.2 3.5c-.3.3-.2.8.2 1l3.6 2.3c.4.2.9-.1 1-.5l1.2-7.8Z'
2323
fill='white'
2424
/>
25-
<defs>
26-
<linearGradient
27-
id='paint0_linear_87_7225'
28-
x1='16'
29-
y1='2'
30-
x2='16'
31-
y2='30'
32-
gradientUnits='userSpaceOnUse'
33-
>
34-
<stop stopColor='#37BBFE' />
35-
<stop offset='1' stopColor='#007DBB' />
36-
</linearGradient>
37-
</defs>
3825
</svg>`}
3926
/>
4027

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ const EnvVarsSchema = z.record(z.string())
3333
// Use a combination of workflow ID and request ID to allow concurrent executions with different inputs
3434
const runningExecutions = new Set<string>()
3535

36+
// Utility function to filter out logs and workflowConnections from API response
37+
function createFilteredResult(result: any) {
38+
return {
39+
...result,
40+
logs: undefined,
41+
metadata: result.metadata
42+
? {
43+
...result.metadata,
44+
workflowConnections: undefined,
45+
}
46+
: undefined,
47+
}
48+
}
49+
3650
// Custom error class for usage limit exceeded
3751
class UsageLimitError extends Error {
3852
statusCode: number
@@ -358,7 +372,10 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
358372
return createHttpResponseFromBlock(result)
359373
}
360374

361-
return createSuccessResponse(result)
375+
// Filter out logs and workflowConnections from the API response
376+
const filteredResult = createFilteredResult(result)
377+
378+
return createSuccessResponse(filteredResult)
362379
} catch (error: any) {
363380
logger.error(`[${requestId}] Error executing workflow: ${id}`, error)
364381

@@ -418,7 +435,10 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
418435
return createHttpResponseFromBlock(result)
419436
}
420437

421-
return createSuccessResponse(result)
438+
// Filter out logs and workflowConnections from the API response
439+
const filteredResult = createFilteredResult(result)
440+
441+
return createSuccessResponse(filteredResult)
422442
} catch (error: any) {
423443
logger.error(`[${requestId}] Error executing workflow: ${id}`, error)
424444

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/dropdown.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SelectTrigger,
77
SelectValue,
88
} from '@/components/ui/select'
9+
import { ResponseBlockHandler } from '@/executor/handlers/response/response-handler'
910
import { useSubBlockValue } from '../hooks/use-sub-block-value'
1011

1112
interface DropdownProps {
@@ -34,6 +35,10 @@ export function Dropdown({
3435
const [storeValue, setStoreValue] = useSubBlockValue<string>(blockId, subBlockId)
3536
const [storeInitialized, setStoreInitialized] = useState(false)
3637

38+
// For response dataMode conversion - get builderData and data sub-blocks
39+
const [builderData] = useSubBlockValue<any[]>(blockId, 'builderData')
40+
const [, setData] = useSubBlockValue<string>(blockId, 'data')
41+
3742
// Use preview value when in preview mode, otherwise use store value or prop value
3843
const value = isPreview ? previewValue : propValue !== undefined ? propValue : storeValue
3944

@@ -108,6 +113,20 @@ export function Dropdown({
108113
onValueChange={(newValue) => {
109114
// Only update store when not in preview mode and not disabled
110115
if (!isPreview && !disabled) {
116+
// Handle conversion when switching from Builder to Editor mode in response blocks
117+
if (
118+
subBlockId === 'dataMode' &&
119+
storeValue === 'structured' &&
120+
newValue === 'json' &&
121+
builderData &&
122+
Array.isArray(builderData) &&
123+
builderData.length > 0
124+
) {
125+
// Convert builderData to JSON string for editor mode
126+
const jsonString = ResponseBlockHandler.convertBuilderDataToJsonString(builderData)
127+
setData(jsonString)
128+
}
129+
111130
setStoreValue(newValue)
112131
}
113132
}}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/response/components/property-renderer.tsx

Lines changed: 0 additions & 236 deletions
This file was deleted.

0 commit comments

Comments
 (0)