apiRefreshAllAccountsModels POST /admin/api/accounts/models/refresh 直接复用 refreshModelsCache,为所有已启用账号刷新模型路由缓存。
(w http.ResponseWriter, r *http.Request)
| 676 | h.modelsCacheMu.Lock() |
| 677 | h.cachedModels = mergeUniqueModels(h.cachedModels, models) |
| 678 | h.modelsCacheTime = time.Now().Unix() |
| 679 | h.modelsCacheMu.Unlock() |
| 680 | |
| 681 | logger.Infof("[ModelsCache] Refreshed %d models for account %s", len(models), account.Email) |
| 682 | return nil |
| 683 | } |
| 684 | |
| 685 | // apiRefreshAccountModels POST /admin/api/accounts/{id}/models/refresh |
| 686 | // 立即为指定账号拉取并更新模型路由缓存。 |
| 687 | func (h *Handler) apiRefreshAccountModels(w http.ResponseWriter, r *http.Request, id string) { |
| 688 | accounts := config.GetAccounts() |
| 689 | var account *config.Account |
| 690 | for i := range accounts { |
| 691 | if accounts[i].ID == id { |
no test coverage detected