From e29c6b44c7bca59c2d992d6db32a8de1fd2a193a Mon Sep 17 00:00:00 2001 From: RedwindA Date: Tue, 5 Aug 2025 23:18:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=80=8D=E7=8E=87=E8=AE=BE=E7=BD=AE=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E6=A8=A1=E5=9E=8B=E6=97=B6=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E9=94=81=E5=AE=9A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/Ratio/ModelSettingsVisualEditor.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js b/web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js index 2aa45ace..1205f6d8 100644 --- a/web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js +++ b/web/src/pages/Setting/Ratio/ModelSettingsVisualEditor.js @@ -44,6 +44,7 @@ export default function ModelSettingsVisualEditor(props) { const { t } = useTranslation(); const [models, setModels] = useState([]); const [visible, setVisible] = useState(false); + const [isEditMode, setIsEditMode] = useState(false); const [currentModel, setCurrentModel] = useState(null); const [searchText, setSearchText] = useState(''); const [currentPage, setCurrentPage] = useState(1); @@ -386,9 +387,11 @@ export default function ModelSettingsVisualEditor(props) { setCurrentModel(null); setPricingMode('per-token'); setPricingSubMode('ratio'); + setIsEditMode(false); }; const editModel = (record) => { + setIsEditMode(true); // Determine which pricing mode to use based on the model's current configuration let initialPricingMode = 'per-token'; let initialPricingSubMode = 'ratio'; @@ -500,13 +503,7 @@ export default function ModelSettingsVisualEditor(props) { model.name === currentModel.name) - ? t('编辑模型') - : t('添加模型') - } + title={isEditMode ? t('编辑模型') : t('添加模型')} visible={visible} onCancel={() => { resetModalState(); @@ -562,11 +559,7 @@ export default function ModelSettingsVisualEditor(props) { label={t('模型名称')} placeholder='strawberry' required - disabled={ - currentModel && - currentModel.name && - models.some((model) => model.name === currentModel.name) - } + disabled={isEditMode} onChange={(value) => setCurrentModel((prev) => ({ ...prev, name: value })) }