chore: Improve channel creation UX: defer "Fetch Model List" action until after creation

Previously, the "Fetch Model List" button was visible in the channel-creation view even though
it only functions once a channel record exists, leading to user confusion.

Changes introduced:
• Render the "Fetch Model List" button only when editing an existing channel (`isEdit === true`).
• Display an informational Banner in creation mode to remind users that the upstream model list
  can be fetched after the channel has been created.
• Refactored JSX to apply the above conditional rendering without altering existing logic.

This update streamlines the creation workflow and sets clearer expectations for users.
This commit is contained in:
t0ng7u
2025-06-27 10:08:44 +08:00
parent 38d3ab5acf
commit 3ced5ff144
2 changed files with 19 additions and 8 deletions

View File

@@ -1748,5 +1748,6 @@
"快捷设置": "Quick settings",
"批量创建时会在名称后自动添加随机后缀": "When creating in batches, a random suffix will be automatically added to the name",
"额度必须大于0": "Quota must be greater than 0",
"生成数量必须大于0": "Generation quantity must be greater than 0"
"生成数量必须大于0": "Generation quantity must be greater than 0",
"创建后可在编辑渠道时获取上游模型列表": "After creation, you can get the upstream model list when editing the channel"
}

View File

@@ -792,13 +792,15 @@ const EditChannel = (props) => {
>
{t('填入所有模型')}
</Button>
<Button
type='tertiary'
onClick={() => fetchUpstreamModelList('models')}
className="!rounded-lg"
>
{t('获取模型列表')}
</Button>
{isEdit ? (
<Button
type='tertiary'
onClick={() => fetchUpstreamModelList('models')}
className="!rounded-lg"
>
{t('获取模型列表')}
</Button>
) : null}
<Button
type='warning'
onClick={() => handleInputChange('models', [])}
@@ -826,6 +828,14 @@ const EditChannel = (props) => {
</Button>
</div>
{!isEdit && (
<Banner
type='info'
description={t('创建后可在编辑渠道时获取上游模型列表')}
className='!rounded-lg'
/>
)}
<div>
<Input
addonAfter={