diff --git a/web/src/pages/Setting/Ratio/ModelRationNotSetEditor.jsx b/web/src/pages/Setting/Ratio/ModelRationNotSetEditor.jsx index dd5d4d8..98135a5 100644 --- a/web/src/pages/Setting/Ratio/ModelRationNotSetEditor.jsx +++ b/web/src/pages/Setting/Ratio/ModelRationNotSetEditor.jsx @@ -57,6 +57,9 @@ export default function ModelRatioNotSetEditor(props) { const [batchCompletionRatioValue, setBatchCompletionRatioValue] = useState(''); const addFormRef = useRef(null); + const editFormRef = useRef(null); + const [editVisible, setEditVisible] = useState(false); + const [editRecord, setEditRecord] = useState(null); const { Text } = Typography; // 定义可选的每页显示条数 const pageSizeOptions = [10, 20, 50, 100]; @@ -281,72 +284,19 @@ export default function ModelRatioNotSetEditor(props) { ), }, { - title: t('缓存读取倍率'), - dataIndex: 'cacheRatio', - key: 'cacheRatio', - render: (text, record) => ( - updateModel(record.name, 'cacheRatio', value)} - /> - ), - }, - { - title: t('缓存创建倍率(5分钟)'), - dataIndex: 'cacheCreationRatio', - key: 'cacheCreationRatio', - render: (text, record) => ( - - updateModel(record.name, 'cacheCreationRatio', value) - } - /> - ), - }, - { - title: t('图片倍率'), - dataIndex: 'imageRatio', - key: 'imageRatio', - render: (text, record) => ( - updateModel(record.name, 'imageRatio', value)} - /> - ), - }, - { - title: t('音频输入倍率'), - dataIndex: 'audioRatio', - key: 'audioRatio', - render: (text, record) => ( - updateModel(record.name, 'audioRatio', value)} - /> - ), - }, - { - title: t('音频输出倍率'), - dataIndex: 'audioCompletionRatio', - key: 'audioCompletionRatio', - render: (text, record) => ( - - updateModel(record.name, 'audioCompletionRatio', value) - } - /> + title: t('操作'), + key: 'action', + render: (_, record) => ( + ), }, ]; @@ -764,6 +714,87 @@ export default function ModelRatioNotSetEditor(props) { + + {/* 高级比例编辑弹窗 */} + { + setEditVisible(false); + setEditRecord(null); + }} + onOk={() => { + if (editRecord && editFormRef.current) { + const formValues = editFormRef.current.getValues(); + setModels((prev) => + prev.map((model) => { + if (model.name !== editRecord.name) return model; + return { + ...model, + cacheRatio: formValues.cacheRatio != null ? formValues.cacheRatio : model.cacheRatio, + cacheCreationRatio: formValues.cacheCreationRatio != null ? formValues.cacheCreationRatio : model.cacheCreationRatio, + imageRatio: formValues.imageRatio != null ? formValues.imageRatio : model.imageRatio, + audioRatio: formValues.audioRatio != null ? formValues.audioRatio : model.audioRatio, + audioCompletionRatio: formValues.audioCompletionRatio != null ? formValues.audioCompletionRatio : model.audioCompletionRatio, + }; + }), + ); + setEditVisible(false); + setEditRecord(null); + showSuccess(t('更新成功')); + } + }} + > +
(editFormRef.current = api)} + initValues={{ + cacheRatio: editRecord?.cacheRatio ?? '', + cacheCreationRatio: editRecord?.cacheCreationRatio ?? '', + imageRatio: editRecord?.imageRatio ?? '', + audioRatio: editRecord?.audioRatio ?? '', + audioCompletionRatio: editRecord?.audioCompletionRatio ?? '', + }} + > + + + + + + +
); }