Ver Fonte

✨ 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.
t0ng7u há 10 meses atrás
pai
commit
3ced5ff144
2 ficheiros alterados com 19 adições e 8 exclusões
  1. 2 1
      web/src/i18n/locales/en.json
  2. 17 7
      web/src/pages/Channel/EditChannel.js

+ 2 - 1
web/src/i18n/locales/en.json

@@ -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"
 }

+ 17 - 7
web/src/pages/Channel/EditChannel.js

@@ -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={