Spaces:
Paused
Paused
| package handler | |
| import ( | |
| "encoding/json" | |
| "net/http" | |
| "zai-proxy/internal/model" | |
| ) | |
| func HandleModels(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Set("Content-Type", "application/json") | |
| var models []map[string]string | |
| for _, id := range model.ModelList { | |
| models = append(models, map[string]string{ | |
| "id": id, | |
| "object": "model", | |
| "owned_by": "z.ai", | |
| }) | |
| } | |
| json.NewEncoder(w).Encode(map[string]interface{}{ | |
| "object": "list", | |
| "data": models, | |
| }) | |
| } |