fix(agent-block): hide temperature for models without temperature input

This commit is contained in:
Emir Karabeg
2025-03-11 16:09:51 -07:00
parent f4fdda36df
commit 5e101e4dac
3 changed files with 20 additions and 6 deletions
@@ -128,11 +128,21 @@ export function WorkflowBlock({ id, data }: NodeProps<WorkflowBlockProps>) {
? mergedState?.subBlocks[block.condition.and.field]?.value
: undefined
// Check if the condition value is an array
const isValueMatch = Array.isArray(block.condition.value)
? fieldValue != null &&
block.condition.value.includes(fieldValue as string | number | boolean)
: fieldValue === block.condition.value
// Check both conditions if 'and' is present
return (
fieldValue === block.condition.value &&
(!block.condition.and || andFieldValue === block.condition.and.value)
)
const isAndValueMatch =
!block.condition.and ||
(Array.isArray(block.condition.and.value)
? andFieldValue != null &&
block.condition.and.value.includes(andFieldValue as string | number | boolean)
: andFieldValue === block.condition.and.value)
return isValueMatch && isAndValueMatch
})
visibleSubBlocks.forEach((block) => {
+4
View File
@@ -60,6 +60,10 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
layout: 'half',
min: 0,
max: 1,
condition: {
field: 'model',
value: ['gpt-4o', 'gemini-2.0-flash'],
},
},
{
id: 'apiKey',
+2 -2
View File
@@ -93,10 +93,10 @@ export interface SubBlockConfig {
value?: (params: Record<string, any>) => string
condition?: {
field: string
value: string | number | boolean
value: string | number | boolean | Array<string | number | boolean>
and?: {
field: string
value: string | number | boolean
value: string | number | boolean | Array<string | number | boolean>
}
}
// OAuth specific properties