Skip to content

Commit c48039f

Browse files
improvement(subblock-defaults): custom defaults for subblocks if needed (#1298)
1 parent 8f7b11f commit c48039f

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

apps/sim/blocks/blocks/agent.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Create a system prompt appropriately detailed for the request, using clear langu
175175
layout: 'half',
176176
min: 0,
177177
max: 1,
178+
defaultValue: 0.5,
178179
condition: () => ({
179180
field: 'model',
180181
value: (() => {
@@ -192,6 +193,7 @@ Create a system prompt appropriately detailed for the request, using clear langu
192193
layout: 'half',
193194
min: 0,
194195
max: 2,
196+
defaultValue: 1,
195197
condition: () => ({
196198
field: 'model',
197199
value: (() => {
@@ -289,6 +291,7 @@ Create a system prompt appropriately detailed for the request, using clear langu
289291
title: 'Tools',
290292
type: 'tool-input',
291293
layout: 'full',
294+
defaultValue: [],
292295
},
293296
{
294297
id: 'responseFormat',

apps/sim/blocks/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export interface SubBlockConfig {
103103
mode?: 'basic' | 'advanced' | 'both' // Default is 'both' if not specified
104104
canonicalParamId?: string
105105
required?: boolean
106+
defaultValue?: string | number | boolean | Record<string, unknown> | Array<unknown>
106107
options?:
107108
| { label: string; id: string; icon?: React.ComponentType<{ className?: string }> }[]
108109
| (() => { label: string; id: string; icon?: React.ComponentType<{ className?: string }> }[])

apps/sim/hooks/use-collaborative-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ export function useCollaborativeWorkflow() {
634634
subBlocks[subBlock.id] = {
635635
id: subBlock.id,
636636
type: subBlock.type,
637-
value: null,
637+
value: subBlock.defaultValue ?? null,
638638
}
639639
})
640640
}

0 commit comments

Comments
 (0)