From 369acf8fe62efa508029c3a20ea2c0c765b20c00 Mon Sep 17 00:00:00 2001 From: Lily Delalande <119957291+lily-de@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:01:41 -0400 Subject: [PATCH] ui: change add model modal to 'switch model' and add form validation (#1878) --- .../models/subcomponents/AddModelModal.tsx | 124 +++++++++++++----- 1 file changed, 94 insertions(+), 30 deletions(-) diff --git a/ui/desktop/src/components/settings_v2/models/subcomponents/AddModelModal.tsx b/ui/desktop/src/components/settings_v2/models/subcomponents/AddModelModal.tsx index 42854c80..3dac3141 100644 --- a/ui/desktop/src/components/settings_v2/models/subcomponents/AddModelModal.tsx +++ b/ui/desktop/src/components/settings_v2/models/subcomponents/AddModelModal.tsx @@ -10,7 +10,7 @@ import { useConfig } from '../../../ConfigContext'; import { changeModel as switchModel } from '../index'; import type { View } from '../../../../App'; -const ModalButtons = ({ onSubmit, onCancel }) => ( +const ModalButtons = ({ onSubmit, onCancel, isValid, validationErrors }) => (
@@ -181,6 +242,9 @@ export const AddModelModal = ({ onClose, setView }: AddModelModalProps) => { onChange={(event) => setModel(event.target.value)} value={model} /> + {attemptedSubmit && validationErrors.model && ( +
{validationErrors.model}
+ )}
)}