params
This commit is contained in:
13
main.go
13
main.go
@@ -44,10 +44,21 @@ func main() {
|
||||
r.HandleFunc("/api/tasks/{id}", tasks_item_patch).Methods("PATCH")
|
||||
r.HandleFunc("/api/tasks/{id}", tasks_item_delete).Methods("DELETE")
|
||||
|
||||
r.HandleFunc("/api/params/model", models_params_get).Methods("GET")
|
||||
|
||||
log.Println("Web Server is running on http://localhost:8080")
|
||||
http.ListenAndServe(":8080", r)
|
||||
}
|
||||
|
||||
func models_params_get(w http.ResponseWriter, r *http.Request) {
|
||||
params := make(map[string]interface{})
|
||||
params["type"] = []string{"lora", "ckp", "hyper", "ti"}
|
||||
params["status"] = []string{"pending", "running", "finished", "failed"}
|
||||
params["base_model"] = []string{"SD1.5", "SD2"}
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write(ToJSON(params))
|
||||
}
|
||||
|
||||
func models_get(w http.ResponseWriter, r *http.Request) {
|
||||
var listview models.ListView
|
||||
listview.Page = ParamInt(r.URL.Query().Get("page"), 1)
|
||||
@@ -154,7 +165,7 @@ func images_get(w http.ResponseWriter, r *http.Request) {
|
||||
listview.Total = models.CountImages()
|
||||
listview.Next = listview.Page*listview.PageSize < listview.Total
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write(ToJSON(listview))
|
||||
w.Write(listview.ToJSON())
|
||||
}
|
||||
|
||||
func images_post(w http.ResponseWriter, r *http.Request) {
|
||||
|
Reference in New Issue
Block a user