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
b12f1b98
Unverified
Commit
b12f1b98
authored
Dec 05, 2023
by
Michael Yang
Committed by
GitHub
Dec 05, 2023
Browse files
Merge pull request #1393 from jmorganca/mxyng/fix-whitespace
fix: trim space in modelfile fields
parents
195e3d9d
38fe1a36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
parser/parser.go
parser/parser.go
+6
-3
No files found.
parser/parser.go
View file @
b12f1b98
...
...
@@ -37,10 +37,13 @@ func Parse(reader io.Reader) ([]Command, error) {
switch
string
(
bytes
.
ToUpper
(
fields
[
0
]))
{
case
"FROM"
:
command
.
Name
=
"model"
command
.
Args
=
string
(
fields
[
1
])
command
.
Args
=
string
(
bytes
.
TrimSpace
(
fields
[
1
])
)
// copy command for validation
modelCommand
=
command
case
"LICENSE"
,
"TEMPLATE"
,
"SYSTEM"
,
"PROMPT"
,
"ADAPTER"
:
case
"ADAPTER"
:
command
.
Name
=
string
(
bytes
.
ToLower
(
fields
[
0
]))
command
.
Args
=
string
(
bytes
.
TrimSpace
(
fields
[
1
]))
case
"LICENSE"
,
"TEMPLATE"
,
"SYSTEM"
,
"PROMPT"
:
command
.
Name
=
string
(
bytes
.
ToLower
(
fields
[
0
]))
command
.
Args
=
string
(
fields
[
1
])
case
"PARAMETER"
:
...
...
@@ -50,7 +53,7 @@ func Parse(reader io.Reader) ([]Command, error) {
}
command
.
Name
=
string
(
fields
[
0
])
command
.
Args
=
string
(
fields
[
1
])
command
.
Args
=
string
(
bytes
.
TrimSpace
(
fields
[
1
])
)
case
"EMBED"
:
return
nil
,
fmt
.
Errorf
(
"deprecated command: EMBED is no longer supported, use the /embed API endpoint instead"
)
default
:
...
...
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