From f4ab854b0635cd9ab36c0fc0660d3037369eb1cb Mon Sep 17 00:00:00 2001 From: "blinkagent[bot]" <237617714+blinkagent[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 10:54:00 -0500 Subject: [PATCH] fix: mark context limit as required in model form (#22845) ## Summary The backend requires `context_limit` to be a positive integer when creating a model config, but the frontend form did not visually indicate this to the user. This caused a confusing error after submission ("Context limit is required. context_limit must be greater than zero."). ## Changes - Added required asterisk (`*`) to the **Context Limit** label, matching the existing **Model Identifier** field pattern - Added Yup `.required()` validation to the `contextLimit` field so the form catches the missing value client-side before submission ## Before The "Context Limit" label had no required indicator. Users could submit the form without filling it in, only to receive a backend error. ## After The "Context Limit" label now shows a red `*` (consistent with "Model Identifier"), and the form validates the field as required before allowing submission. Created on behalf of @uzair-coder07 --------- Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> --- .../ChatModelAdminPanel/ModelForm.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/site/src/pages/AgentsPage/ChatModelAdminPanel/ModelForm.tsx b/site/src/pages/AgentsPage/ChatModelAdminPanel/ModelForm.tsx index 0b86febfe2..d0f3d28e81 100644 --- a/site/src/pages/AgentsPage/ChatModelAdminPanel/ModelForm.tsx +++ b/site/src/pages/AgentsPage/ChatModelAdminPanel/ModelForm.tsx @@ -40,11 +40,13 @@ import { ProviderIcon } from "./ProviderIcon"; const validationSchema = Yup.object({ model: Yup.string().trim().required("Model ID is required."), displayName: Yup.string(), - contextLimit: Yup.string().test( - "positive-integer", - "Context limit must be a positive integer.", - (value) => !value?.trim() || parsePositiveInteger(value) !== null, - ), + contextLimit: Yup.string() + .required("Context limit is required.") + .test( + "positive-integer", + "Context limit must be a positive integer.", + (value) => !value?.trim() || parsePositiveInteger(value) !== null, + ), compressionThreshold: Yup.string().test( "threshold-range", "Compression threshold must be a number between 0 and 100.", @@ -367,7 +369,10 @@ export const ModelForm: FC = ({ htmlFor={contextLimitField.id} className="text-sm font-medium text-content-primary" > - Context Limit + Context Limit{" "} + + * +

Max tokens in the context window.