fix: Preserve system prompt when sent as a string instead of content block array

This commit is contained in:
Dominic Robinson
2026-03-09 07:38:11 +00:00
parent f5941a411c
commit 5c9997cdac

View File

@@ -1266,6 +1266,10 @@ func checkSystemInstructionsWithMode(payload []byte, strictMode bool) []byte {
}
return true
})
} else if system.Type == gjson.String && system.String() != "" {
partJSON := `{"type":"text","cache_control":{"type":"ephemeral"}}`
partJSON, _ = sjson.Set(partJSON, "text", system.String())
result += "," + partJSON
}
result += "]"