mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 02:17:28 +00:00
- Added support to fetch and render “model prefill groups” in `EditChannelModal.jsx` - Users can now click a group button to instantly merge that group’s models into the models Select - Mirrors the prefill-group UX used for tags/endpoints in `EditModelModal.jsx` Details - UI/UX: - Renders one button per model group inside the models field’s extra actions - Clicking a button merges its items into the selected models (trimmed, deduplicated), updating immediately - Non-destructive and works alongside existing actions (fill related/all models, fetch upstream, clear, copy) - API: - GET `/api/prefill_group?type=model` - Handles `items` as either an array or a JSON string array for robustness - If request fails or returns no groups, buttons are simply not shown - i18n: - Reuses existing i18n; group names come from backend and are displayed as-is - Performance: - Simple set merge; negligible overhead - Backward compatibility: - No changes required on the backend or elsewhere; feature is additive - Testing (manual): 1) Open channel modal (new or edit) and navigate to the Models section 2) Confirm model group buttons render when groups are configured 3) Click a group button → models Select updates with merged models (no duplicates) 4) Verify other actions (fill related/all, fetch upstream, clear, copy) still work 5) Close/reopen modal → state resets as expected Implementation - `web/src/components/table/channels/modals/EditChannelModal.jsx` - Added `modelGroups` state and `fetchModelGroups()` (GET `/api/prefill_group?type=model`) - Invoked `fetchModelGroups()` when the modal opens - Rendered group buttons in the models Select `extraText`, merging group items into current selection Chore - Verified no new linter errors were introduced.