default to post
This commit is contained in:
parent
b29382b86f
commit
65658e4077
@ -5,7 +5,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -307,15 +306,9 @@ func CreateBlob(ctx context.Context, src, digest string, r *os.File) (error) {
|
|||||||
Host: net.JoinHostPort(ollamaHost.Host, ollamaHost.Port),
|
Host: net.JoinHostPort(ollamaHost.Host, ollamaHost.Port),
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(digest)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
reqBody := bytes.NewReader(data)
|
|
||||||
path := fmt.Sprintf("/api/blobs/%s", digest)
|
path := fmt.Sprintf("/api/blobs/%s", digest)
|
||||||
requestURL := base.JoinPath(path)
|
requestURL := base.JoinPath(path)
|
||||||
request, err := http.NewRequestWithContext(ctx, http.MethodPost, requestURL.String(), reqBody)
|
request, err := http.NewRequestWithContext(ctx, http.MethodPost, requestURL.String(), r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -943,13 +943,13 @@ func (s *Server) CreateBlobHandler(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if c.GetHeader("X-Ollama-File") != "" && s.isLocal(c) {
|
if c.GetHeader("X-Ollama-File") != "" && s.isLocal(c) {
|
||||||
err = localBlobCopy(c.GetHeader("X-Ollama-File"), path)
|
err = localBlobCopy(c.GetHeader("X-Ollama-File"), path)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
c.Status(http.StatusCreated)
|
c.Status(http.StatusCreated)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} */
|
}
|
||||||
|
|
||||||
layer, err := NewLayer(c.Request.Body, "")
|
layer, err := NewLayer(c.Request.Body, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -971,15 +971,15 @@ func localBlobCopy (src, dest string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
/* err = localCopy(src, dest)
|
err = localCopy(src, dest)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
} */
|
}
|
||||||
|
|
||||||
/* err = defaultCopy(src, dest)
|
err = defaultCopy(src, dest)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
} */
|
}
|
||||||
|
|
||||||
return fmt.Errorf("failed to copy blob")
|
return fmt.Errorf("failed to copy blob")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user