From 85743ad9146c397f13f96c40b99acd57703044d7 Mon Sep 17 00:00:00 2001 From: Benson Wong Date: Fri, 4 Oct 2024 12:33:41 -0700 Subject: [PATCH] remove the v1/models endpoint, needs improvement --- proxy/manager.go | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/proxy/manager.go b/proxy/manager.go index 4611069..38d6a08 100644 --- a/proxy/manager.go +++ b/proxy/manager.go @@ -34,34 +34,7 @@ func (pm *ProxyManager) HandleFunc(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/v1/chat/completions" { // extracts the `model` from json body pm.proxyChatRequest(w, r) - } else if r.URL.Path == "/v1/models" { - - // Transform Models to the desired JSON structure - jsonOutput := map[string]interface{}{ - "object": "list", - "data": []map[string]string{}, - } - - for id := range pm.config.Models { - modelData := map[string]string{ - "id": id, - "object": "model", - } - jsonOutput["data"] = append(jsonOutput["data"].([]map[string]string), modelData) - } - - // Marshal the JSON output for display - result, err := json.MarshalIndent(jsonOutput, "", " ") - if err != nil { - http.Error(w, "JSON marshal error", http.StatusInternalServerError) - return - } - - w.Header().Set("Content-Type", "application/json") - w.Write(result) - } else { - pm.proxyRequest(w, r) } }