t0ng7u
54f118d9ba
✨ feat(models-sync): official upstream sync with conflict resolution UI, opt‑out flag, and backend resiliency
Backend
- Add endpoints:
- GET /api/models/sync_upstream/preview — diff preview (filters out models with sync_official = 0)
- POST /api/models/sync_upstream — apply sync (create missing; optionally overwrite selected fields)
- Respect opt‑out: skip models with sync_official = 0 in both preview and apply
- Return detailed stats: created_models, created_vendors, updated_models, skipped_models, plus created_list / updated_list
- Add model.Model.SyncOfficial (default 1); auto‑migrated by GORM
- Make HTTP fetching robust:
- Shared http.Client (connection reuse) with 3x exponential backoff retry
- 10MB response cap; keep existing IPv4‑first for *.github.io
- Vendor handling:
- New ensureVendorID helper (cache lookup → DB lookup → create), reduces round‑trips
- Transactional overwrite to avoid partial updates
- Small cleanups and clearer helpers (containsField, coalesce, chooseStatus)
Frontend
- ModelsActions: add “Sync official” button with Popover (p‑2) explaining community contribution; loading = syncing || previewing; preview → conflict modal → apply flow
- New UpstreamConflictModal:
- Per‑field columns (description/icon/tags/vendor/name_rule/status) with column‑level checkbox to select all
- Cell with Checkbox + Tag (“Click to view differences”) and Popover (p‑2) showing Local vs Official values
- Auto‑hide columns with no conflicts; responsive width; use native Semi Modal footer
- Full i18n coverage
- useModelsData: add syncing/previewing states; new methods previewUpstreamDiff, applyUpstreamOverwrite, syncUpstream; refresh vendors/models after apply
- EditModelModal: add “Participate in official sync” switch; persisted as sync_official
- ModelsColumnDefs: add “Participate in official sync” column
i18n
- Add missing English keys for the new UI and messages; fix quoting issues
Refs
- Upstream metadata: https://github.com/basellm/llm-metadata
2025-09-02 02:04:22 +08:00
..
2025-08-14 21:10:04 +08:00
2025-08-14 21:10:04 +08:00
2025-09-01 16:23:29 +08:00
2025-08-16 19:11:15 +08:00
2025-08-31 13:00:28 +08:00
2025-06-30 22:31:12 +08:00
2025-08-10 12:11:31 +08:00
2025-08-11 14:40:01 +08:00
2025-09-02 02:04:22 +08:00
2025-08-14 21:10:04 +08:00
2025-08-10 12:11:31 +08:00
2025-08-29 23:42:33 +08:00
2025-08-10 12:11:31 +08:00
2025-08-29 19:48:20 +08:00
2025-08-14 20:05:06 +08:00
2025-04-03 18:57:15 +08:00
2025-08-25 18:01:10 +08:00
2025-07-03 13:10:25 +08:00
2025-08-14 21:10:04 +08:00
2025-08-14 20:05:06 +08:00
2025-08-27 12:33:56 +08:00
2025-08-16 19:11:15 +08:00
2025-08-14 21:10:04 +08:00
2025-08-31 07:07:40 +08:00
2025-08-14 21:10:04 +08:00
2025-08-31 13:00:28 +08:00