mirror of
https://github.com/tcsenpai/ollama.git
synced 2025-06-07 11:45:21 +00:00
Fix infinite keep_alive (#2480)
This commit is contained in:
parent
1d263449ff
commit
caf2b13c10
@ -415,8 +415,7 @@ func (d *Duration) UnmarshalJSON(b []byte) (err error) {
|
|||||||
switch t := v.(type) {
|
switch t := v.(type) {
|
||||||
case float64:
|
case float64:
|
||||||
if t < 0 {
|
if t < 0 {
|
||||||
t = math.MaxFloat64
|
d.Duration = time.Duration(math.MaxInt64)
|
||||||
d.Duration = time.Duration(t)
|
|
||||||
} else {
|
} else {
|
||||||
d.Duration = time.Duration(t * float64(time.Second))
|
d.Duration = time.Duration(t * float64(time.Second))
|
||||||
}
|
}
|
||||||
@ -426,8 +425,7 @@ func (d *Duration) UnmarshalJSON(b []byte) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if d.Duration < 0 {
|
if d.Duration < 0 {
|
||||||
mf := math.MaxFloat64
|
d.Duration = time.Duration(math.MaxInt64)
|
||||||
d.Duration = time.Duration(mf)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user