MCPcopy
hub / github.com/mudler/LocalAI / getModelStatus

Function getModelStatus

core/http/app_test.go:52–82  ·  view source on GitHub ↗
(url string)

Source from the content-addressed store, hash-verified

50}
51
52func getModelStatus(url string) (response map[string]any) {
53 // Create the HTTP request
54 req, err := http.NewRequest("GET", url, nil)
55 req.Header.Set("Content-Type", "application/json")
56 req.Header.Set("Authorization", bearerKey)
57 if err != nil {
58 fmt.Println("Error creating request:", err)
59 return
60 }
61 client := &http.Client{}
62 resp, err := client.Do(req)
63 if err != nil {
64 fmt.Println("Error sending request:", err)
65 return
66 }
67 defer resp.Body.Close()
68
69 body, err := io.ReadAll(resp.Body)
70 if err != nil {
71 fmt.Println("Error reading response body:", err)
72 return
73 }
74
75 // Unmarshal the response into a map[string]interface{}
76 err = json.Unmarshal(body, &response)
77 if err != nil {
78 fmt.Println("Error unmarshaling JSON response:", err)
79 return
80 }
81 return
82}
83
84func getModels(url string) ([]gallery.GalleryModel, error) {
85 response := []gallery.GalleryModel{}

Callers 1

app_test.goFile · 0.85

Calls 2

SetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected