@@ -2,6 +2,7 @@ package models
5 "encoding/json"
6 "encoding/json"
@@ -53,7 +54,6 @@ func init() {
53 loadLocalModels(models)
54 loadLocalModels(models)
55 viper.SetDefault("providers.local.apiKey", "dummy")
56 viper.SetDefault("providers.local.apiKey", "dummy")
56− ProviderPopularity[ProviderLocal] = 0
@@ -75,7 +75,7 @@ type localModel struct {
77func listLocalModels(modelsEndpoint string) []localModel {
77func listLocalModels(modelsEndpoint string) []localModel {
78− res, err := http.Get(modelsEndpoint)
78+ res, err := http.NewRequestWithContext(context.Background(), http.MethodGet, modelsEndpoint, nil)
79 if err != nil {
79 if err != nil {
80 logging.Debug("Failed to list local models",
80 logging.Debug("Failed to list local models",
81 "error", err,
81 "error", err,
@@ -84,9 +84,9 @@ func listLocalModels(modelsEndpoint string) []localModel {
85 defer res.Body.Close()
85 defer res.Body.Close()
87− if res.StatusCode != http.StatusOK {
87+ if res.Response.StatusCode != http.StatusOK {
88 logging.Debug("Failed to list local models",
88 logging.Debug("Failed to list local models",
89− "status", res.StatusCode,
89+ "status", res.Response.Status,
90 "endpoint", modelsEndpoint,
90 "endpoint", modelsEndpoint,