Row-proxy / internal /handler /models.go
Moge-Row's picture
restore models.go
39041c5
raw
history blame
483 Bytes
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,
})
}