fix: buildTextBlock cache_control sjson path issue
sjson treats 'cache_control.type' as nested path, creating
{ephemeral: {scope: org}} instead of {type: ephemeral, scope: org}.
Pass the whole map to sjson.SetBytes as a single value.
This commit is contained in:
@@ -1346,10 +1346,8 @@ func checkSystemInstructionsWithSigningMode(payload []byte, strictMode bool, exp
|
|||||||
func buildTextBlock(text string, cacheControl map[string]string) string {
|
func buildTextBlock(text string, cacheControl map[string]string) string {
|
||||||
block := []byte(`{"type":"text"}`)
|
block := []byte(`{"type":"text"}`)
|
||||||
block, _ = sjson.SetBytes(block, "text", text)
|
block, _ = sjson.SetBytes(block, "text", text)
|
||||||
if cacheControl != nil {
|
if cacheControl != nil && len(cacheControl) > 0 {
|
||||||
for k, v := range cacheControl {
|
block, _ = sjson.SetBytes(block, "cache_control", cacheControl)
|
||||||
block, _ = sjson.SetBytes(block, "cache_control."+k, v)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return string(block)
|
return string(block)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user