✨ feat: Enhance Channel Model Management UI
Summary • Introduced standalone `ModelSelectModal.jsx` for selecting channel models • Fetch-list now opens modal instead of in-place select, keeping EditChannelModal lean Modal Features 1. Search bar with `IconSearch`, keyboard clear & mobile full-screen support 2. Tab layout (“New Models” / “Existing Models”) displayed next to title, responsive wrapping 3. Models grouped by vendor via `getModelCategories` and rendered inside always-expanded `Collapse` panels 4. Per-category checkbox in panel extra area for bulk select / deselect 5. Footer checkbox for bulk select of all models in current tab, with real-time counter 6. Empty state uses `IllustrationNoResult` / `IllustrationNoResultDark` for visual consistency 7. Accessible header/footer paddings aligned with Semi UI defaults Fixes & Improvements • All indeterminate and full-select states handled correctly • Consistent “selected X / Y” stats synced with active tab, not global list • All panels now controlled via `activeKey`, ensuring they remain expanded • Search, vendor grouping, and responsive layout tested across mobile & desktop These changes modernise the channel model management workflow and prepare the codebase for upcoming upstream-ratio integration.
This commit is contained in:
@@ -47,6 +47,7 @@ import {
|
||||
Highlight,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import { getChannelModels, copy, getChannelIcon, getModelCategories, selectFilter } from '../../../../helpers';
|
||||
import ModelSelectModal from './ModelSelectModal';
|
||||
import {
|
||||
IconSave,
|
||||
IconClose,
|
||||
@@ -141,6 +142,8 @@ const EditChannelModal = (props) => {
|
||||
const [customModel, setCustomModel] = useState('');
|
||||
const [modalImageUrl, setModalImageUrl] = useState('');
|
||||
const [isModalOpenurl, setIsModalOpenurl] = useState(false);
|
||||
const [modelModalVisible, setModelModalVisible] = useState(false);
|
||||
const [fetchedModels, setFetchedModels] = useState([]);
|
||||
const formApiRef = useRef(null);
|
||||
const [vertexKeys, setVertexKeys] = useState([]);
|
||||
const [vertexFileList, setVertexFileList] = useState([]);
|
||||
@@ -378,7 +381,7 @@ const EditChannelModal = (props) => {
|
||||
// return;
|
||||
// }
|
||||
setLoading(true);
|
||||
const models = inputs['models'] || [];
|
||||
const models = [];
|
||||
let err = false;
|
||||
|
||||
if (isEdit) {
|
||||
@@ -419,8 +422,9 @@ const EditChannelModal = (props) => {
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
handleInputChange(name, Array.from(new Set(models)));
|
||||
showSuccess(t('获取模型列表成功'));
|
||||
const uniqueModels = Array.from(new Set(models));
|
||||
setFetchedModels(uniqueModels);
|
||||
setModelModalVisible(true);
|
||||
} else {
|
||||
showError(t('获取模型列表失败'));
|
||||
}
|
||||
@@ -1650,6 +1654,17 @@ const EditChannelModal = (props) => {
|
||||
onVisibleChange={(visible) => setIsModalOpenurl(visible)}
|
||||
/>
|
||||
</SideSheet>
|
||||
<ModelSelectModal
|
||||
visible={modelModalVisible}
|
||||
models={fetchedModels}
|
||||
selected={inputs.models}
|
||||
onConfirm={(selectedModels) => {
|
||||
handleInputChange('models', selectedModels);
|
||||
showSuccess(t('模型列表已更新'));
|
||||
setModelModalVisible(false);
|
||||
}}
|
||||
onCancel={() => setModelModalVisible(false)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user