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
572fc909
Unverified
Commit
572fc909
authored
Jul 18, 2023
by
Patrick Devine
Committed by
GitHub
Jul 18, 2023
Browse files
add license layers to the parser (#116)
parent
a6d03dd5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
parser/parser.go
parser/parser.go
+2
-2
server/images.go
server/images.go
+10
-0
No files found.
parser/parser.go
View file @
572fc909
...
@@ -46,8 +46,8 @@ func Parse(reader io.Reader) ([]Command, error) {
...
@@ -46,8 +46,8 @@ func Parse(reader io.Reader) ([]Command, error) {
return
nil
,
fmt
.
Errorf
(
"no model specified in FROM line"
)
return
nil
,
fmt
.
Errorf
(
"no model specified in FROM line"
)
}
}
foundModel
=
true
foundModel
=
true
case
"PROMPT"
:
case
"PROMPT"
,
"LICENSE"
:
command
.
Name
=
"prompt"
command
.
Name
=
strings
.
ToLower
(
fields
[
0
])
if
fields
[
1
]
==
`"""`
{
if
fields
[
1
]
==
`"""`
{
multiline
=
true
multiline
=
true
multilineCommand
=
&
command
multilineCommand
=
&
command
...
...
server/images.go
View file @
572fc909
...
@@ -215,6 +215,16 @@ func CreateModel(name string, mf io.Reader, fn func(status string)) error {
...
@@ -215,6 +215,16 @@ func CreateModel(name string, mf io.Reader, fn func(status string)) error {
}
}
l
.
MediaType
=
"application/vnd.ollama.image.prompt"
l
.
MediaType
=
"application/vnd.ollama.image.prompt"
layers
=
append
(
layers
,
l
)
layers
=
append
(
layers
,
l
)
case
"license"
:
fn
(
"creating license layer"
)
license
:=
strings
.
NewReader
(
c
.
Arg
)
l
,
err
:=
CreateLayer
(
license
)
if
err
!=
nil
{
fn
(
fmt
.
Sprintf
(
"couldn't create license layer: %v"
,
err
))
return
fmt
.
Errorf
(
"failed to create layer: %v"
,
err
)
}
l
.
MediaType
=
"application/vnd.ollama.image.license"
layers
=
append
(
layers
,
l
)
default
:
default
:
params
[
c
.
Name
]
=
c
.
Arg
params
[
c
.
Name
]
=
c
.
Arg
}
}
...
...
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