mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(agent-block): hide temperature for models without temperature input
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user