From 66ae4434c5ef8465e198c91757effb562fdba52e Mon Sep 17 00:00:00 2001 From: Zane Staggs Date: Sat, 19 Jul 2025 13:47:14 -0700 Subject: [PATCH 01/19] added back recipe parameter support --- ui/desktop/openapi.json | 5 ++ ui/desktop/src/api/types.gen.ts | 4 ++ .../src/components/ParameterInputModal.tsx | 58 +++++++++++++++---- ui/desktop/src/components/RecipeEditor.tsx | 52 ++++++++++++++--- .../components/parameter/ParameterInput.tsx | 42 +++++++++++++- ui/desktop/src/hooks/useRecipeManager.ts | 2 +- ui/desktop/src/recipe/index.ts | 3 +- ui/desktop/src/utils/providerUtils.ts | 12 ++-- 8 files changed, 152 insertions(+), 26 deletions(-) diff --git a/ui/desktop/openapi.json b/ui/desktop/openapi.json index d891d6536bf0..30ac193e3d0e 100644 --- a/ui/desktop/openapi.json +++ b/ui/desktop/openapi.json @@ -1827,6 +1827,11 @@ "format": "double", "description": "Cost per token for output (optional)", "nullable": true + }, + "supports_cache_control": { + "type": "boolean", + "description": "Whether this model supports cache control", + "nullable": true } } }, diff --git a/ui/desktop/src/api/types.gen.ts b/ui/desktop/src/api/types.gen.ts index 071c7bfd557e..45a43b44ba18 100644 --- a/ui/desktop/src/api/types.gen.ts +++ b/ui/desktop/src/api/types.gen.ts @@ -273,6 +273,10 @@ export type ModelInfo = { * Cost per token for output (optional) */ output_token_cost?: number | null; + /** + * Whether this model supports cache control + */ + supports_cache_control?: boolean | null; }; export type PermissionConfirmationRequest = { diff --git a/ui/desktop/src/components/ParameterInputModal.tsx b/ui/desktop/src/components/ParameterInputModal.tsx index 07f578cc2d04..65564068239d 100644 --- a/ui/desktop/src/components/ParameterInputModal.tsx +++ b/ui/desktop/src/components/ParameterInputModal.tsx @@ -122,17 +122,53 @@ const ParameterInputModal: React.FC = ({ {param.description || param.key} {param.requirement === 'required' && *} - handleChange(param.key, e.target.value)} - className={`w-full p-3 border rounded-lg bg-bgSubtle text-textStandard focus:outline-none focus:ring-2 ${ - validationErrors[param.key] - ? 'border-red-500 focus:ring-red-500' - : 'border-borderSubtle focus:ring-borderProminent' - }`} - placeholder={param.default || `Enter value for ${param.key}...`} - /> + + {/* Render different input types */} + {param.input_type === 'select' && param.options ? ( + + ) : param.input_type === 'boolean' ? ( + + ) : ( + handleChange(param.key, e.target.value)} + className={`w-full p-3 border rounded-lg bg-bgSubtle text-textStandard focus:outline-none focus:ring-2 ${ + validationErrors[param.key] + ? 'border-red-500 focus:ring-red-500' + : 'border-borderSubtle focus:ring-borderProminent' + }`} + placeholder={param.default || `Enter value for ${param.key}...`} + /> + )} + {validationErrors[param.key] && (

{validationErrors[param.key]}

)} diff --git a/ui/desktop/src/components/RecipeEditor.tsx b/ui/desktop/src/components/RecipeEditor.tsx index c3f1ce6d3dba..79d780260190 100644 --- a/ui/desktop/src/components/RecipeEditor.tsx +++ b/ui/desktop/src/components/RecipeEditor.tsx @@ -401,13 +401,51 @@ export default function RecipeEditor({ config }: RecipeEditorProps) {
{errors.instructions}
)} - {parameters.map((parameter: Parameter) => ( - handleParameterChange(name, value)} - /> - ))} + {/* Parameters section */} +
+
+

Parameters

+
+ + {parameters.length > 0 && ( + + )} +
+
+ + {parameters.map((parameter: Parameter) => ( + handleParameterChange(name, value)} + /> + ))} +
= ({ parameter, onChange })

This is the message the end-user will see.

- {/* Controls for requirement and default value */} -
+ {/* Controls for requirement, input type, and default value */} +
+
+ + +
+