Fix: agent temperature

This commit is contained in:
Emir Karabeg
2025-02-15 12:13:27 -08:00
parent 17bca0bcff
commit 5e2c3806b8
3 changed files with 9 additions and 6 deletions

View File

@@ -16,13 +16,13 @@ export function SliderInput({
blockId,
subBlockId,
}: SliderInputProps) {
const [value, setValue] = useSubBlockValue(blockId, subBlockId)
const [value, setValue] = useSubBlockValue<number>(blockId, subBlockId)
const sliderValue = value ?? defaultValue
return (
<div className="relative pt-2 pb-6">
<Slider
value={[Number(sliderValue)]}
value={[sliderValue]}
min={min}
max={max}
step={0.1}

View File

@@ -57,7 +57,7 @@ export const AgentBlock: BlockConfig<AgentResponse> = {
type: 'slider',
layout: 'half',
min: 0,
max: 2,
max: 1,
},
{
id: 'apiKey',

View File

@@ -38,11 +38,14 @@ export const useWorkflowStore = create<WorkflowStoreWithHistory>()(
const block = state.blocks[blockId]
if (!block) return state
// Handle different value types appropriately
const processedValue = Array.isArray(value)
? value
: typeof value === 'string'
? value
: JSON.stringify(value, null, 2)
: block.subBlocks[subBlockId]?.type === 'slider'
? Number(value) // Convert slider values to numbers
: typeof value === 'string'
? value
: JSON.stringify(value, null, 2)
// Only attempt JSON parsing for agent responseFormat validation
if (