feat: add model deselection functionality in ComboFormModal and ComboDetailPage (#889)
- Implemented handleDeselectModel function to allow users to deselect models in both ComboFormModal and ComboDetailPage. - Updated ModelSelectModal to handle deselection and visually indicate selected models. - Enhanced user experience by allowing models to be removed from the selection without closing the modal.
This commit is contained in:
1 parent
7f93df3a92
commit
0667a26b5a
3 files changed
+65
-17
No files matched your search
@@ -390,6 +390,10 @@ function ComboFormModal({ isOpen, combo, onClose, onSave, activeProviders, kindF
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeselectModel = (model) => {
|
||||
setModels(models.filter((m) => m !== model.value));
|
||||
};
|
||||
|
||||
const handleRemoveModel = (index) => {
|
||||
setModels(models.filter((_, i) => i !== index));
|
||||
};
|
||||
@@ -502,10 +506,13 @@ function ComboFormModal({ isOpen, combo, onClose, onSave, activeProviders, kindF
|
||||
isOpen={showModelSelect}
|
||||
onClose={() => setShowModelSelect(false)}
|
||||
onSelect={handleAddModel}
|
||||
onDeselect={handleDeselectModel}
|
||||
activeProviders={activeProviders}
|
||||
modelAliases={modelAliases}
|
||||
title="Add Model to Combo"
|
||||
kindFilter={kindFilter}
|
||||
addedModelValues={models}
|
||||
closeOnSelect={false}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user