@@ -2,6 +2,7 @@ package models
22
33import (
44 "cmp"
5+ "context"
56 "encoding/json"
67 "net/http"
78 "net/url"
@@ -53,7 +54,6 @@ func init() {
5354 loadLocalModels(models)
5455
5556 viper.SetDefault("providers.local.apiKey", "dummy")
56− ProviderPopularity[ProviderLocal] = 0
5757 }
5858}
5959
@@ -75,7 +75,7 @@ type localModel struct {
7575}
7676
7777func listLocalModels(modelsEndpoint string) []localModel {
78− res, err := http.Get(modelsEndpoint)
78+ res, err := http.NewRequestWithContext(context.Background(), http.MethodGet, modelsEndpoint, nil)
7979 if err != nil {
8080 logging.Debug("Failed to list local models",
8181 "error", err,
@@ -84,9 +84,9 @@ func listLocalModels(modelsEndpoint string) []localModel {
8484 }
8585 defer res.Body.Close()
8686
87− if res.StatusCode != http.StatusOK {
87+ if res.Response.StatusCode != http.StatusOK {
8888 logging.Debug("Failed to list local models",
89− "status", res.StatusCode,
89+ "status", res.Response.Status,
9090 "endpoint", modelsEndpoint,
9191 )
9292 }