Spaces:
Paused
Paused
File size: 483 Bytes
48d903a 39041c5 48d903a 39041c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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,
})
} |