From 872011630aeadc97e0e9d0b4e7d1d7f5de05e926 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 31 Jul 2023 21:34:52 -0700 Subject: [PATCH] fix license --- server/images.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/images.go b/server/images.go index 53ffb9a8..852c5cdc 100644 --- a/server/images.go +++ b/server/images.go @@ -271,7 +271,19 @@ func CreateModel(name string, path string, fn func(resp api.ProgressResponse)) e layers = append(layers, newLayer) } } - case "license", "template", "system", "prompt": + case "license": + fn(api.ProgressResponse{Status: fmt.Sprintf("creating model %s layer", c.Name)}) + // remove the prompt layer if one exists + mediaType := fmt.Sprintf("application/vnd.ollama.image.%s", c.Name) + + layer, err := CreateLayer(strings.NewReader(c.Args)) + if err != nil { + return err + } + + layer.MediaType = mediaType + layers = append(layers, layer) + case "template", "system", "prompt": fn(api.ProgressResponse{Status: fmt.Sprintf("creating model %s layer", c.Name)}) // remove the prompt layer if one exists mediaType := fmt.Sprintf("application/vnd.ollama.image.%s", c.Name)