fetchModelsFromURL fetches and parses an OpenAI-compatible models list from the given URL using the supplied client. It is a thin wrapper around dispatchModelsRequest for tests that inject an httptest server's client.
(ctx context.Context, url string, client *http.Client)
| 315 | // the given URL using the supplied client. It is a thin wrapper around |
| 316 | // dispatchModelsRequest for tests that inject an httptest server's client. |
| 317 | func fetchModelsFromURL(ctx context.Context, url string, client *http.Client) []string { |
| 318 | req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, http.NoBody) |
| 319 | if err != nil { |
| 320 | slog.WarnContext(ctx, "failed to create request for provider models", "url", url, "error", err) |
| 321 | return nil |
| 322 | } |
| 323 | return dispatchModelsRequest(ctx, req, client) |
| 324 | } |
| 325 | |
| 326 | // dispatchModelsRequest sends req via client and parses the OpenAI-style model |
| 327 | // list returned. Empty IDs are skipped; duplicates are preserved (the caller |