feat(ui): add Done button to ModelSelectModal in combo creation (#1031)
This commit is contained in:
committed by
GitHub
parent
8f4d29caa4
commit
17cab0ed52
@@ -86,6 +86,9 @@ export default function ComboFormModal({ isOpen, combo, onClose, onSave, activeP
|
|||||||
const handleAddModel = (model) => {
|
const handleAddModel = (model) => {
|
||||||
if (!models.includes(model.value)) setModels([...models, model.value]);
|
if (!models.includes(model.value)) setModels([...models, model.value]);
|
||||||
};
|
};
|
||||||
|
const handleDeselectModel = (model) => {
|
||||||
|
setModels(models.filter((m) => m !== model.value));
|
||||||
|
};
|
||||||
const handleRemoveModel = (i) => setModels(models.filter((_, idx) => idx !== i));
|
const handleRemoveModel = (i) => setModels(models.filter((_, idx) => idx !== i));
|
||||||
const handleMoveUp = (i) => {
|
const handleMoveUp = (i) => {
|
||||||
if (i === 0) return;
|
if (i === 0) return;
|
||||||
@@ -164,8 +167,10 @@ export default function ComboFormModal({ isOpen, combo, onClose, onSave, activeP
|
|||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<ModelSelectModal isOpen={showModelSelect} onClose={() => setShowModelSelect(false)}
|
<ModelSelectModal isOpen={showModelSelect} onClose={() => setShowModelSelect(false)}
|
||||||
onSelect={handleAddModel} activeProviders={activeProviders} modelAliases={modelAliases}
|
onSelect={handleAddModel} onDeselect={handleDeselectModel}
|
||||||
title="Add Model to Combo" kindFilter={kindFilter} />
|
activeProviders={activeProviders} modelAliases={modelAliases}
|
||||||
|
title="Add Model to Combo" kindFilter={kindFilter}
|
||||||
|
addedModelValues={models} closeOnSelect={false} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useState, useMemo, useEffect } from "react";
|
import { useState, useMemo, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import Modal from "./Modal";
|
import Modal from "./Modal";
|
||||||
|
import Button from "./Button";
|
||||||
import { getModelsByProviderId } from "@/shared/constants/models";
|
import { getModelsByProviderId } from "@/shared/constants/models";
|
||||||
import { OAUTH_PROVIDERS, APIKEY_PROVIDERS, FREE_PROVIDERS, FREE_TIER_PROVIDERS, AI_PROVIDERS, isOpenAICompatibleProvider, isAnthropicCompatibleProvider, getProviderAlias } from "@/shared/constants/providers";
|
import { OAUTH_PROVIDERS, APIKEY_PROVIDERS, FREE_PROVIDERS, FREE_TIER_PROVIDERS, AI_PROVIDERS, isOpenAICompatibleProvider, isAnthropicCompatibleProvider, getProviderAlias } from "@/shared/constants/providers";
|
||||||
|
|
||||||
@@ -370,6 +371,19 @@ export default function ModelSelectModal({
|
|||||||
title={title}
|
title={title}
|
||||||
size="md"
|
size="md"
|
||||||
className="p-4!"
|
className="p-4!"
|
||||||
|
footer={
|
||||||
|
!closeOnSelect ? (
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
onClose();
|
||||||
|
setSearchQuery("");
|
||||||
|
}}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
Done
|
||||||
|
</Button>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{/* Search - compact */}
|
{/* Search - compact */}
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user