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
9bd00041
"vscode:/vscode.git/clone" did not exist on "b18547fdeb6b9e13bc304fd8ba2167663cafdbe9"
Commit
9bd00041
authored
Jun 27, 2024
by
Josh Yan
Browse files
trim all params
parent
4e986a82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
11 deletions
+4
-11
parser/parser.go
parser/parser.go
+2
-9
parser/parser_test.go
parser/parser_test.go
+2
-2
No files found.
parser/parser.go
View file @
9bd00041
...
@@ -124,8 +124,7 @@ func ParseFile(r io.Reader) (*File, error) {
...
@@ -124,8 +124,7 @@ func ParseFile(r io.Reader) (*File, error) {
case
stateComment
,
stateNil
:
case
stateComment
,
stateNil
:
// pass
// pass
case
stateValue
:
case
stateValue
:
s
,
ok
:=
unquote
(
b
.
String
())
s
,
ok
:=
unquote
(
strings
.
TrimSpace
(
b
.
String
()))
if
!
ok
||
isSpace
(
r
)
{
if
!
ok
||
isSpace
(
r
)
{
if
_
,
err
:=
b
.
WriteRune
(
r
);
err
!=
nil
{
if
_
,
err
:=
b
.
WriteRune
(
r
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -159,13 +158,7 @@ func ParseFile(r io.Reader) (*File, error) {
...
@@ -159,13 +158,7 @@ func ParseFile(r io.Reader) (*File, error) {
case
stateComment
,
stateNil
:
case
stateComment
,
stateNil
:
// pass; nothing to flush
// pass; nothing to flush
case
stateValue
:
case
stateValue
:
var
s
string
s
,
ok
:=
unquote
(
strings
.
TrimSpace
(
b
.
String
()))
var
ok
bool
if
cmd
.
Name
==
"model"
{
s
,
ok
=
unquote
(
strings
.
TrimSpace
(
b
.
String
()))
}
else
{
s
,
ok
=
unquote
(
b
.
String
())
}
if
!
ok
{
if
!
ok
{
return
nil
,
io
.
ErrUnexpectedEOF
return
nil
,
io
.
ErrUnexpectedEOF
}
}
...
...
parser/parser_test.go
View file @
9bd00041
...
@@ -108,7 +108,7 @@ func TestParseFileFrom(t *testing.T) {
...
@@ -108,7 +108,7 @@ func TestParseFileFrom(t *testing.T) {
},
},
{
{
"PARAMETER what the
\n
FROM lemons make lemonade "
,
"PARAMETER what the
\n
FROM lemons make lemonade "
,
[]
Command
{{
Name
:
"what"
,
Args
:
"the
"
},
{
Name
:
"model"
,
Args
:
"lemons make lemonade"
}},
[]
Command
{{
Name
:
"what"
,
Args
:
"the"
},
{
Name
:
"model"
,
Args
:
"lemons make lemonade"
}},
nil
,
nil
,
},
},
}
}
...
@@ -424,7 +424,7 @@ func TestParseFileParameters(t *testing.T) {
...
@@ -424,7 +424,7 @@ func TestParseFileParameters(t *testing.T) {
"mirostat_eta 1.0"
:
{
"mirostat_eta"
,
"1.0"
},
"mirostat_eta 1.0"
:
{
"mirostat_eta"
,
"1.0"
},
"penalize_newline true"
:
{
"penalize_newline"
,
"true"
},
"penalize_newline true"
:
{
"penalize_newline"
,
"true"
},
"stop ### User:"
:
{
"stop"
,
"### User:"
},
"stop ### User:"
:
{
"stop"
,
"### User:"
},
"stop ### User: "
:
{
"stop"
,
"### User:
"
},
"stop ### User: "
:
{
"stop"
,
"### User:"
},
"stop
\"
### User:
\"
"
:
{
"stop"
,
"### User:"
},
"stop
\"
### User:
\"
"
:
{
"stop"
,
"### User:"
},
"stop
\"
### User:
\"
"
:
{
"stop"
,
"### User: "
},
"stop
\"
### User:
\"
"
:
{
"stop"
,
"### User: "
},
"stop
\"\"\"
### User:
\"\"\"
"
:
{
"stop"
,
"### User:"
},
"stop
\"\"\"
### User:
\"\"\"
"
:
{
"stop"
,
"### User:"
},
...
...
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