Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
allow overriding default generate options
Bruce MacDonaldf5e2e150b812
diff --git a/api/types.go b/api/types.goindex 79bc2c242..2aadcfff7 100644--- a/api/types.go+++ b/api/types.go@@ -33,8 +33,8 @@ type GenerateRequest struct {Model string `json:"model"`Prompt string `json:"prompt"`- ModelOptions `json:"model_opts,omitempty"`- PredictOptions `json:"predict_opts,omitempty"`+ ModelOptions *ModelOptions `json:"model_opts,omitempty"`+ PredictOptions *PredictOptions `json:"predict_opts,omitempty"`}type ModelOptions struct {diff --git a/server/routes.go b/server/routes.goindex 47db78a23..d9e2184f2 100644--- a/server/routes.go+++ b/server/routes.go@@ -38,8 +38,13 @@ func cacheDir() string {func generate(c *gin.Context) {var req api.GenerateRequest- req.ModelOptions = api.DefaultModelOptions- req.PredictOptions = api.DefaultPredictOptions+ if req.ModelOptions == nil {+ req.ModelOptions = &api.DefaultModelOptions+ }++ if req.PredictOptions == nil {+ req.PredictOptions = &api.DefaultPredictOptions+ }if err := c.ShouldBindJSON(&req); err != nil {c.JSON(http.StatusBadRequest, gin.H{"message": err.Error()})return