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
f27bc261
Commit
f27bc261
authored
Aug 10, 2023
by
Michael Yang
Browse files
s/parmeter/parameter/
parent
21e6197c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
api/types.go
api/types.go
+6
-6
No files found.
api/types.go
View file @
f27bc261
...
...
@@ -225,12 +225,12 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
// when JSON unmarshals numbers, it uses float64, not int
field
.
SetInt
(
int64
(
t
))
default
:
log
.
Printf
(
"could not convert model parmeter %v to int, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to int, skipped"
,
key
)
}
case
reflect
.
Bool
:
val
,
ok
:=
val
.
(
bool
)
if
!
ok
{
log
.
Printf
(
"could not convert model parmeter %v to bool, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to bool, skipped"
,
key
)
continue
}
field
.
SetBool
(
val
)
...
...
@@ -238,14 +238,14 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
// JSON unmarshals to float64
val
,
ok
:=
val
.
(
float64
)
if
!
ok
{
log
.
Printf
(
"could not convert model parmeter %v to float32, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to float32, skipped"
,
key
)
continue
}
field
.
SetFloat
(
val
)
case
reflect
.
String
:
val
,
ok
:=
val
.
(
string
)
if
!
ok
{
log
.
Printf
(
"could not convert model parmeter %v to string, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to string, skipped"
,
key
)
continue
}
field
.
SetString
(
val
)
...
...
@@ -253,7 +253,7 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
// JSON unmarshals to []interface{}, not []string
val
,
ok
:=
val
.
([]
interface
{})
if
!
ok
{
log
.
Printf
(
"could not convert model parmeter %v to slice, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to slice, skipped"
,
key
)
continue
}
// convert []interface{} to []string
...
...
@@ -261,7 +261,7 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
for
i
,
item
:=
range
val
{
str
,
ok
:=
item
.
(
string
)
if
!
ok
{
log
.
Printf
(
"could not convert model parmeter %v to slice of strings, skipped"
,
key
)
log
.
Printf
(
"could not convert model par
a
meter %v to slice of strings, skipped"
,
key
)
continue
}
slice
[
i
]
=
str
...
...
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