fix: uid -> uuid

This commit is contained in:
mudler 2023-05-20 14:25:53 +02:00
parent fa6e5c6cb2
commit 7c04158509
3 changed files with 10 additions and 9 deletions

View file

@ -869,17 +869,18 @@ curl http://localhost:8080/models/apply -H "Content-Type: application/json" -d '
"uri": "<additional_file>", "uri": "<additional_file>",
"sha256": "<additional_file_hash>", "sha256": "<additional_file_hash>",
"name": "<additional_file_name>" "name": "<additional_file_name>"
} },
"overrides": { "backend": "...", "f16": true }
] ]
} }
``` ```
An optional, list of additional files can be specified to be downloaded. The `name` allows to override the model name. An optional, list of additional files can be specified to be downloaded within `files`. The `name` allows to override the model name. Finally it is possible to override the model config file with `override`.
Returns an `uuid` and an `url` to follow up the state of the process: Returns an `uuid` and an `url` to follow up the state of the process:
```json ```json
{ "uid":"251475c9-f666-11ed-95e0-9a8a4480ac58", "status":"http://localhost:8080/models/jobs/251475c9-f666-11ed-95e0-9a8a4480ac58"} { "uuid":"251475c9-f666-11ed-95e0-9a8a4480ac58", "status":"http://localhost:8080/models/jobs/251475c9-f666-11ed-95e0-9a8a4480ac58"}
``` ```
To see a collection example of curated models definition files, see the [model-gallery](https://github.com/go-skynet/model-gallery). To see a collection example of curated models definition files, see the [model-gallery](https://github.com/go-skynet/model-gallery).

View file

@ -147,9 +147,9 @@ var _ = Describe("API test", func() {
}, },
}) })
Expect(response["uid"]).ToNot(BeEmpty(), fmt.Sprint(response)) Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))
uuid := response["uid"].(string) uuid := response["uuid"].(string)
Eventually(func() bool { Eventually(func() bool {
response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid) response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid)
@ -172,9 +172,9 @@ var _ = Describe("API test", func() {
Overrides: map[string]string{}, Overrides: map[string]string{},
}) })
Expect(response["uid"]).ToNot(BeEmpty(), fmt.Sprint(response)) Expect(response["uuid"]).ToNot(BeEmpty(), fmt.Sprint(response))
uuid := response["uid"].(string) uuid := response["uuid"].(string)
Eventually(func() bool { Eventually(func() bool {
response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid) response := getModelStatus("http://127.0.0.1:9090/models/jobs/" + uuid)

View file

@ -163,7 +163,7 @@ func (request ApplyGalleryModelRequest) DecodeURL() (string, error) {
func getOpStatus(g *galleryApplier) func(c *fiber.Ctx) error { func getOpStatus(g *galleryApplier) func(c *fiber.Ctx) error {
return func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error {
status := g.getstatus(c.Params("uid")) status := g.getstatus(c.Params("uuid"))
if status == nil { if status == nil {
return fmt.Errorf("could not find any status for ID") return fmt.Errorf("could not find any status for ID")
} }
@ -189,7 +189,7 @@ func applyModelGallery(modelPath string, cm *ConfigMerger, g chan galleryOp) fun
id: uuid.String(), id: uuid.String(),
} }
return c.JSON(struct { return c.JSON(struct {
ID string `json:"uid"` ID string `json:"uuid"`
StatusURL string `json:"status"` StatusURL string `json:"status"`
}{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()}) }{ID: uuid.String(), StatusURL: c.BaseURL() + "/models/jobs/" + uuid.String()})
} }