Skip to content

Commit f2b9849

Browse files
myxamediyarclaude
authored andcommitted
fix(higgsfield): parse numeric inputs only for the selected operation
A hidden numeric field from another operation no longer blocks the selected one when its value is invalid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 60089cf commit f2b9849

1 file changed

Lines changed: 36 additions & 29 deletions

File tree

‎apps/sim/blocks/blocks/higgsfield.ts‎

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -314,35 +314,42 @@ export const HiggsfieldBlock: BlockConfig = {
314314
],
315315
config: {
316316
tool: (params) => params.operation,
317-
params: (params) => ({
318-
...params,
319-
batchSize: parseOptionalNumberInput(params.batchSize, 'Number of Images', {
320-
integer: true,
321-
}),
322-
characterStrength: parseOptionalNumberInput(
323-
params.characterStrength,
324-
'Character Strength',
325-
{
326-
min: 0,
327-
max: 1,
328-
}
329-
),
330-
styleStrength: parseOptionalNumberInput(params.styleStrength, 'Style Strength', {
331-
min: 0,
332-
max: 1,
333-
}),
334-
seed: parseOptionalNumberInput(params.seed, 'Seed', {
335-
integer: true,
336-
min: 1,
337-
max: 1000000,
338-
}),
339-
expiresAfter: parseOptionalNumberInput(params.expiresAfter, 'Keep Data For', {
340-
integer: true,
341-
min: 3600,
342-
}),
343-
page: parseOptionalNumberInput(params.page, 'Page', { integer: true, min: 1 }),
344-
pageSize: parseOptionalNumberInput(params.pageSize, 'Page Size', { integer: true, min: 1 }),
345-
}),
317+
params: (params, context) => {
318+
const operation = context?.operation ?? params.operation
319+
const isSoul = operation === SOUL
320+
const isGenerate = GENERATE_OPERATIONS.includes(operation)
321+
const isList = operation === 'higgsfield_list_characters'
322+
return {
323+
...params,
324+
batchSize: isSoul
325+
? parseOptionalNumberInput(params.batchSize, 'Number of Images', { integer: true })
326+
: undefined,
327+
characterStrength: isSoul
328+
? parseOptionalNumberInput(params.characterStrength, 'Character Strength', {
329+
min: 0,
330+
max: 1,
331+
})
332+
: undefined,
333+
styleStrength: isSoul
334+
? parseOptionalNumberInput(params.styleStrength, 'Style Strength', { min: 0, max: 1 })
335+
: undefined,
336+
seed: isSoul
337+
? parseOptionalNumberInput(params.seed, 'Seed', { integer: true, min: 1, max: 1000000 })
338+
: undefined,
339+
expiresAfter: isGenerate
340+
? parseOptionalNumberInput(params.expiresAfter, 'Keep Data For', {
341+
integer: true,
342+
min: 3600,
343+
})
344+
: undefined,
345+
page: isList
346+
? parseOptionalNumberInput(params.page, 'Page', { integer: true, min: 1 })
347+
: undefined,
348+
pageSize: isList
349+
? parseOptionalNumberInput(params.pageSize, 'Page Size', { integer: true, min: 1 })
350+
: undefined,
351+
}
352+
},
346353
},
347354
},
348355
inputs: {

0 commit comments

Comments
 (0)