🐛 fix(EditChannelModal): hide empty “API Config” card for VolcEngine Ark/Doubao (type 45)

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.
This commit is contained in:
t0ng7u
2025-07-22 21:31:37 +08:00
parent 07b64ff1a4
commit e0b859dbbe

View File

@@ -142,6 +142,7 @@ const EditChannelModal = (props) => {
const [isMultiKeyChannel, setIsMultiKeyChannel] = useState(false); const [isMultiKeyChannel, setIsMultiKeyChannel] = useState(false);
const [channelSearchValue, setChannelSearchValue] = useState(''); const [channelSearchValue, setChannelSearchValue] = useState('');
const [useManualInput, setUseManualInput] = useState(false); // 是否使用手动输入模式 const [useManualInput, setUseManualInput] = useState(false); // 是否使用手动输入模式
const showApiConfigCard = inputs.type !== 45; // 控制是否显示 API 配置卡片(仅当渠道类型不是 豆包 时显示)
const getInitValues = () => ({ ...originInputs }); const getInitValues = () => ({ ...originInputs });
const handleInputChange = (name, value) => { const handleInputChange = (name, value) => {
if (formApiRef.current) { if (formApiRef.current) {
@@ -1108,6 +1109,7 @@ const EditChannelModal = (props) => {
</Card> </Card>
{/* API Configuration Card */} {/* API Configuration Card */}
{showApiConfigCard && (
<Card className="!rounded-2xl shadow-sm border-0 mb-6"> <Card className="!rounded-2xl shadow-sm border-0 mb-6">
{/* Header: API Config */} {/* Header: API Config */}
<div className="flex items-center mb-2"> <div className="flex items-center mb-2">
@@ -1232,6 +1234,7 @@ const EditChannelModal = (props) => {
</div> </div>
)} )}
</Card> </Card>
)}
{/* Model Configuration Card */} {/* Model Configuration Card */}
<Card className="!rounded-2xl shadow-sm border-0 mb-6"> <Card className="!rounded-2xl shadow-sm border-0 mb-6">