Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
orangecat
ollama
Commits
536028c3
"vscode:/vscode.git/clone" did not exist on "848f99449f62fc9cc4a0e220ee28640df9e0ecda"
Commit
536028c3
authored
Jul 24, 2023
by
Bruce MacDonald
Browse files
better error message when model not found on pull
parent
aedf3d1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
api/client.go
api/client.go
+1
-1
server/images.go
server/images.go
+6
-1
No files found.
api/client.go
View file @
536028c3
...
@@ -131,7 +131,7 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f
...
@@ -131,7 +131,7 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f
}
}
if
errorResponse
.
Error
!=
""
{
if
errorResponse
.
Error
!=
""
{
return
fmt
.
Errorf
(
"stream: %s"
,
errorResponse
.
Error
)
return
fmt
.
Errorf
(
errorResponse
.
Error
)
}
}
if
response
.
StatusCode
>=
400
{
if
response
.
StatusCode
>=
400
{
...
...
server/images.go
View file @
536028c3
...
@@ -684,7 +684,7 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
...
@@ -684,7 +684,7 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
manifest
,
err
:=
pullModelManifest
(
mp
,
regOpts
)
manifest
,
err
:=
pullModelManifest
(
mp
,
regOpts
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"pull model manifest: %
q
"
,
err
)
return
fmt
.
Errorf
(
"pull model manifest: %
s
"
,
err
)
}
}
var
layers
[]
*
Layer
var
layers
[]
*
Layer
...
@@ -738,6 +738,8 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
...
@@ -738,6 +738,8 @@ func PullModel(name string, regOpts *RegistryOptions, fn func(api.ProgressRespon
return
nil
return
nil
}
}
var
errModelNotFound
=
fmt
.
Errorf
(
"model not found"
)
func
pullModelManifest
(
mp
ModelPath
,
regOpts
*
RegistryOptions
)
(
*
ManifestV2
,
error
)
{
func
pullModelManifest
(
mp
ModelPath
,
regOpts
*
RegistryOptions
)
(
*
ManifestV2
,
error
)
{
url
:=
fmt
.
Sprintf
(
"%s/v2/%s/manifests/%s"
,
mp
.
Registry
,
mp
.
GetNamespaceRepository
(),
mp
.
Tag
)
url
:=
fmt
.
Sprintf
(
"%s/v2/%s/manifests/%s"
,
mp
.
Registry
,
mp
.
GetNamespaceRepository
(),
mp
.
Tag
)
headers
:=
map
[
string
]
string
{
headers
:=
map
[
string
]
string
{
...
@@ -753,6 +755,9 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
...
@@ -753,6 +755,9 @@ func pullModelManifest(mp ModelPath, regOpts *RegistryOptions) (*ManifestV2, err
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
// Check for success: For a successful upload, the Docker registry will respond with a 201 Created
if
resp
.
StatusCode
!=
http
.
StatusOK
{
if
resp
.
StatusCode
!=
http
.
StatusOK
{
if
resp
.
StatusCode
==
http
.
StatusNotFound
{
return
nil
,
errModelNotFound
}
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
return
nil
,
fmt
.
Errorf
(
"on pull registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
return
nil
,
fmt
.
Errorf
(
"on pull registry responded with code %d: %s"
,
resp
.
StatusCode
,
body
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment