From e0b859dbbee9b71406ab4cdd2284f6eeade83264 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Tue, 22 Jul 2025 21:31:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(EditChannelModal):=20hide=20?= =?UTF-8?q?empty=20=E2=80=9CAPI=20Config=E2=80=9D=20card=20for=20VolcEngin?= =?UTF-8?q?e=20Ark/Doubao=20(type=2045)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VolcEngine Ark/Doubao channel now has a hard-coded base URL inside the backend, so it no longer requires any API-address settings on the front-end side. Previously, the input field was hidden but the surrounding “API Config” card still rendered, leaving a blank, confusing section. Changes made • Added `showApiConfigCard` flag (true when `inputs.type !== 45`) right after the state declarations. • Wrapped the entire “API Config” card in a conditional render driven by this flag. • Removed the duplicate declaration of `showApiConfigCard` further down in the component to avoid shadowing and improve readability. Scope verification • Checked all other channel types: every remaining type either displays a dedicated API-related input/banner (3, 8, 22, 36, 37, 40, …) or falls back to the generic “custom API address” field. • Therefore, only type 45 requires the card to be fully hidden. Result The “Edit Channel” modal now shows no empty card for the VolcEngine Ark/Doubao channel, leading to a cleaner and more intuitive UI while preserving behaviour for all other channels. --- .../channels/modals/EditChannelModal.jsx | 203 +++++++++--------- 1 file changed, 103 insertions(+), 100 deletions(-) diff --git a/web/src/components/table/channels/modals/EditChannelModal.jsx b/web/src/components/table/channels/modals/EditChannelModal.jsx index 92c26540..6613dddc 100644 --- a/web/src/components/table/channels/modals/EditChannelModal.jsx +++ b/web/src/components/table/channels/modals/EditChannelModal.jsx @@ -142,6 +142,7 @@ const EditChannelModal = (props) => { const [isMultiKeyChannel, setIsMultiKeyChannel] = useState(false); const [channelSearchValue, setChannelSearchValue] = useState(''); const [useManualInput, setUseManualInput] = useState(false); // 是否使用手动输入模式 + const showApiConfigCard = inputs.type !== 45; // 控制是否显示 API 配置卡片(仅当渠道类型不是 豆包 时显示) const getInitValues = () => ({ ...originInputs }); const handleInputChange = (name, value) => { if (formApiRef.current) { @@ -1108,130 +1109,132 @@ const EditChannelModal = (props) => { {/* API Configuration Card */} - - {/* Header: API Config */} -
- - - -
- {t('API 配置')} -
{t('API 地址和相关配置')}
+ {showApiConfigCard && ( + + {/* Header: API Config */} +
+ + + +
+ {t('API 配置')} +
{t('API 地址和相关配置')}
+
-
- {inputs.type === 40 && ( - + {t('邀请链接')}: + window.open('https://cloud.siliconflow.cn/i/hij0YNTZ')} + > + https://cloud.siliconflow.cn/i/hij0YNTZ + +
+ } + className='!rounded-lg' + /> + )} + + {inputs.type === 3 && ( + <> +
- {t('邀请链接')}: - window.open('https://cloud.siliconflow.cn/i/hij0YNTZ')} - > - https://cloud.siliconflow.cn/i/hij0YNTZ - + handleInputChange('base_url', value)} + showClear + />
- } - className='!rounded-lg' - /> - )} +
+ handleInputChange('other', value)} + showClear + /> +
+ + )} - {inputs.type === 3 && ( - <> + {inputs.type === 8 && ( + <> + +
+ handleInputChange('base_url', value)} + showClear + /> +
+ + )} + + {inputs.type === 37 && ( + )} + + {inputs.type !== 3 && inputs.type !== 8 && inputs.type !== 22 && inputs.type !== 36 && inputs.type !== 45 && (
handleInputChange('base_url', value)} + showClear + extraText={t('对于官方渠道,new-api已经内置地址,除非是第三方代理站点或者Azure的特殊接入地址,否则不需要填写')} + /> +
+ )} + + {inputs.type === 22 && ( +
+ handleInputChange('base_url', value)} showClear />
-
- handleInputChange('other', value)} - showClear - /> -
- - )} + )} - {inputs.type === 8 && ( - <> - + {inputs.type === 36 && (
handleInputChange('base_url', value)} showClear />
- - )} - - {inputs.type === 37 && ( - - )} - - {inputs.type !== 3 && inputs.type !== 8 && inputs.type !== 22 && inputs.type !== 36 && inputs.type !== 45 && ( -
- handleInputChange('base_url', value)} - showClear - extraText={t('对于官方渠道,new-api已经内置地址,除非是第三方代理站点或者Azure的特殊接入地址,否则不需要填写')} - /> -
- )} - - {inputs.type === 22 && ( -
- handleInputChange('base_url', value)} - showClear - /> -
- )} - - {inputs.type === 36 && ( -
- handleInputChange('base_url', value)} - showClear - /> -
- )} -
+ )} + + )} {/* Model Configuration Card */}