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
2b9892a8
"src/vscode:/vscode.git/clone" did not exist on "30cef6bff344708734bb8173e19646c6a2d979b4"
Commit
2b9892a8
authored
Dec 15, 2023
by
Michael Yang
Browse files
fix(windows): modelpath and list
parent
2bb2bdd5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
server/modelpath.go
server/modelpath.go
+1
-1
server/routes.go
server/routes.go
+8
-7
No files found.
server/modelpath.go
View file @
2b9892a8
...
@@ -46,7 +46,7 @@ func ParseModelPath(name string) ModelPath {
...
@@ -46,7 +46,7 @@ func ParseModelPath(name string) ModelPath {
name
=
after
name
=
after
}
}
parts
:=
strings
.
Split
(
name
,
string
(
os
.
PathSeparator
)
)
parts
:=
strings
.
Split
(
name
,
"/"
)
switch
len
(
parts
)
{
switch
len
(
parts
)
{
case
3
:
case
3
:
mp
.
Registry
=
parts
[
0
]
mp
.
Registry
=
parts
[
0
]
...
...
server/routes.go
View file @
2b9892a8
...
@@ -711,7 +711,7 @@ func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error) {
...
@@ -711,7 +711,7 @@ func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error) {
func
ListModelsHandler
(
c
*
gin
.
Context
)
{
func
ListModelsHandler
(
c
*
gin
.
Context
)
{
models
:=
make
([]
api
.
ModelResponse
,
0
)
models
:=
make
([]
api
.
ModelResponse
,
0
)
fp
,
err
:=
GetManifestPath
()
manifestsPath
,
err
:=
GetManifestPath
()
if
err
!=
nil
{
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
return
...
@@ -741,13 +741,14 @@ func ListModelsHandler(c *gin.Context) {
...
@@ -741,13 +741,14 @@ func ListModelsHandler(c *gin.Context) {
walkFunc
:=
func
(
path
string
,
info
os
.
FileInfo
,
_
error
)
error
{
walkFunc
:=
func
(
path
string
,
info
os
.
FileInfo
,
_
error
)
error
{
if
!
info
.
IsDir
()
{
if
!
info
.
IsDir
()
{
dir
,
file
:=
filepath
.
Split
(
path
)
path
,
tag
:=
filepath
.
Split
(
path
)
dir
=
strings
.
Trim
(
strings
.
TrimPrefix
(
dir
,
fp
),
string
(
os
.
PathSeparator
))
model
:=
strings
.
Trim
(
strings
.
TrimPrefix
(
path
,
manifestsPath
),
string
(
os
.
PathSeparator
))
tag
:=
strings
.
Join
([]
string
{
dir
,
file
},
":"
)
modelPath
:=
strings
.
Join
([]
string
{
model
,
tag
},
":"
)
canonicalModelPath
:=
strings
.
ReplaceAll
(
modelPath
,
string
(
os
.
PathSeparator
),
"/"
)
resp
,
err
:=
modelResponse
(
tag
)
resp
,
err
:=
modelResponse
(
canonicalModelPath
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"skipping file: %s"
,
fp
)
log
.
Printf
(
"skipping file: %s"
,
canonicalModelPath
)
// nolint: nilerr
// nolint: nilerr
return
nil
return
nil
}
}
...
@@ -759,7 +760,7 @@ func ListModelsHandler(c *gin.Context) {
...
@@ -759,7 +760,7 @@ func ListModelsHandler(c *gin.Context) {
return
nil
return
nil
}
}
if
err
:=
filepath
.
Walk
(
fp
,
walkFunc
);
err
!=
nil
{
if
err
:=
filepath
.
Walk
(
manifestsPath
,
walkFunc
);
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"error"
:
err
.
Error
()})
return
return
}
}
...
...
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