Summary • Backend – Moved duplicate-name validation and total vendor-count aggregation from controllers (`controller/model_meta.go`, `controller/vendor_meta.go`, `controller/prefill_group.go`) to model layer (`model/model_meta.go`, `model/vendor_meta.go`, `model/prefill_group.go`). – Added `GetVendorModelCounts()` and `Is*NameDuplicated()` helpers; controllers now call these instead of duplicating queries. – API response for `/api/models` now returns `vendor_counts` with per-vendor totals across all pages, plus `all` summary. – Removed redundant checks and unused imports, eliminating `go vet` warnings. • Frontend – `useModelsData.js` updated to consume backend-supplied `vendor_counts`, calculate the `all` total once, and drop legacy client-side counting logic. – Simplified initial data flow: first render now triggers only one models request. – Deleted obsolete `updateVendorCounts` helper and related comments. – Ensured search flow also sets `vendorCounts`, keeping tab badges accurate. Why This refactor enforces single-responsibility (aggregation in model layer), delivers consistent totals irrespective of pagination, and removes redundant client queries, leading to cleaner code and better performance.
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| ability.go | Loading commit data... | |
| channel.go | Loading commit data... | |
| channel_cache.go | Loading commit data... | |
| log.go | Loading commit data... | |
| main.go | Loading commit data... | |
| midjourney.go | Loading commit data... | |
| missing_models.go | Loading commit data... | |
| model_extra.go | Loading commit data... | |
| model_meta.go | Loading commit data... | |
| option.go | Loading commit data... | |
| prefill_group.go | Loading commit data... | |
| pricing.go | Loading commit data... | |
| pricing_refresh.go | Loading commit data... | |
| redemption.go | Loading commit data... | |
| setup.go | Loading commit data... | |
| task.go | Loading commit data... | |
| token.go | Loading commit data... | |
| token_cache.go | Loading commit data... | |
| topup.go | Loading commit data... | |
| twofa.go | Loading commit data... | |
| usedata.go | Loading commit data... | |
| user.go | Loading commit data... | |
| user_cache.go | Loading commit data... | |
| utils.go | Loading commit data... | |
| vendor_meta.go | Loading commit data... |