From 5e2c3806b8a9600071167843c77f8bf74fa508af Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Sat, 15 Feb 2025 12:13:27 -0800 Subject: [PATCH] Fix: agent temperature --- .../components/sub-block/components/slider-input.tsx | 4 ++-- blocks/blocks/agent.ts | 2 +- stores/workflow/store.ts | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/w/[id]/components/workflow-block/components/sub-block/components/slider-input.tsx b/app/w/[id]/components/workflow-block/components/sub-block/components/slider-input.tsx index 29c5368d8..4ae163a77 100644 --- a/app/w/[id]/components/workflow-block/components/sub-block/components/slider-input.tsx +++ b/app/w/[id]/components/workflow-block/components/sub-block/components/slider-input.tsx @@ -16,13 +16,13 @@ export function SliderInput({ blockId, subBlockId, }: SliderInputProps) { - const [value, setValue] = useSubBlockValue(blockId, subBlockId) + const [value, setValue] = useSubBlockValue(blockId, subBlockId) const sliderValue = value ?? defaultValue return (
= { type: 'slider', layout: 'half', min: 0, - max: 2, + max: 1, }, { id: 'apiKey', diff --git a/stores/workflow/store.ts b/stores/workflow/store.ts index 52b4d701d..b8381a6af 100644 --- a/stores/workflow/store.ts +++ b/stores/workflow/store.ts @@ -38,11 +38,14 @@ export const useWorkflowStore = create()( 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 (