mirror of
https://github.com/ollama/ollama.git
synced 2025-11-11 16:27:02 +01:00
read runner parameter options from map
- read runner options from map to see what was specified explicitly and overwrite zero values
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"dario.cat/mergo"
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -59,8 +58,14 @@ func GenerateHandler(c *gin.Context) {
|
||||
loaded.llm = nil
|
||||
}
|
||||
|
||||
opts := model.Options
|
||||
if err := mergo.Merge(&opts, req.Options, mergo.WithOverride); err != nil {
|
||||
opts := api.DefaultOptions()
|
||||
if err := opts.FromMap(model.Options); err != nil {
|
||||
log.Printf("could not load model options: %v", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
if err := opts.FromMap(req.Options); err != nil {
|
||||
log.Printf("could not merge model options: %v", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user