diff --git a/packages/hub/src/app/ai/Sidebar.tsx b/packages/hub/src/app/ai/Sidebar.tsx index c509b962ac..77e84f7bd9 100644 --- a/packages/hub/src/app/ai/Sidebar.tsx +++ b/packages/hub/src/app/ai/Sidebar.tsx @@ -1,5 +1,6 @@ "use client"; +import _ from "lodash"; import { forwardRef, useEffect, @@ -96,21 +97,23 @@ Outputs: const handleSubmit = form.handleSubmit( async ({ prompt, squiggleCode, model, numericSteps, styleGuideSteps }) => { + const numericStepsNumber = _.toNumber(numericSteps) || 0; + const styleGuideStepsNumber = _.toNumber(styleGuideSteps) || 0; const requestBody: AiRequestBody = mode === "create" ? { kind: "create", prompt, model: model as LlmId, - numericSteps, - styleGuideSteps, + numericSteps: numericStepsNumber, + styleGuideSteps: styleGuideStepsNumber, } : { kind: "edit", squiggleCode, model: model as LlmId, - numericSteps, - styleGuideSteps, + numericSteps: numericStepsNumber, + styleGuideSteps: styleGuideStepsNumber, }; submitWorkflow(requestBody); @@ -163,8 +166,9 @@ Outputs: name="squiggleCode" label="Squiggle Code" placeholder="Enter your Squiggle code here" - rows={12} - minRows={12} + rows={8} + minRows={6} + maxRows={20} /> diff --git a/packages/ui/src/forms/fields/TextAreaFormField.tsx b/packages/ui/src/forms/fields/TextAreaFormField.tsx index 3fe380ff29..270f9877fb 100644 --- a/packages/ui/src/forms/fields/TextAreaFormField.tsx +++ b/packages/ui/src/forms/fields/TextAreaFormField.tsx @@ -17,9 +17,10 @@ export function TextAreaFormField< placeholder, rows, minRows, + maxRows, ...fieldProps }: CommonStringFieldProps & - Pick) { + Pick) { return ( {(inputProps) => ( @@ -28,6 +29,7 @@ export function TextAreaFormField< placeholder={placeholder} rows={rows} minRows={minRows} + maxRows={maxRows} /> )}