Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

ignore nil map values

Michael Yangf723bf087901
diff --git a/api/types.go b/api/types.go
index 393555ad9..7ed102bfa 100644
--- a/api/types.go
+++ b/api/types.go
@@ -216,6 +216,10 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
if opt, ok := jsonOpts[key]; ok {
field := valueOpts.FieldByName(opt.Name)
if field.IsValid() && field.CanSet() {
+ if val == nil {
+ continue
+ }
+
switch field.Kind() {
case reflect.Int:
switch t := val.(type) {