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
OpenDAS
ollama
Commits
aac9ab4d
Commit
aac9ab4d
authored
Jan 18, 2024
by
Michael Yang
Browse files
fix show handler
parent
1f5b7ff9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
server/routes.go
server/routes.go
+3
-4
No files found.
server/routes.go
View file @
aac9ab4d
...
@@ -630,11 +630,10 @@ func ShowModelHandler(c *gin.Context) {
...
@@ -630,11 +630,10 @@ func ShowModelHandler(c *gin.Context) {
return
return
}
}
var
model
string
if
req
.
Model
!=
""
{
if
req
.
Model
!=
""
{
model
=
req
.
Model
// noop
}
else
if
req
.
Name
!=
""
{
}
else
if
req
.
Name
!=
""
{
m
odel
=
req
.
Name
req
.
M
odel
=
req
.
Name
}
else
{
}
else
{
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model is required"
})
c
.
AbortWithStatusJSON
(
http
.
StatusBadRequest
,
gin
.
H
{
"error"
:
"model is required"
})
return
return
...
@@ -643,7 +642,7 @@ func ShowModelHandler(c *gin.Context) {
...
@@ -643,7 +642,7 @@ func ShowModelHandler(c *gin.Context) {
resp
,
err
:=
GetModelInfo
(
req
)
resp
,
err
:=
GetModelInfo
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
c
.
JSON
(
http
.
StatusNotFound
,
gin
.
H
{
"error"
:
fmt
.
Sprintf
(
"model '%s' not found"
,
m
odel
)})
c
.
JSON
(
http
.
StatusNotFound
,
gin
.
H
{
"error"
:
fmt
.
Sprintf
(
"model '%s' not found"
,
req
.
M
odel
)})
}
else
{
}
else
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
}
}
...
...
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