mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-12 09:14:15 +00:00
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 {
|
||||
block := []byte(`{"type":"text"}`)
|
||||
block, _ = sjson.SetBytes(block, "text", text)
|
||||
if cacheControl != nil {
|
||||
for k, v := range cacheControl {
|
||||
block, _ = sjson.SetBytes(block, "cache_control."+k, v)
|
||||
}
|
||||
if cacheControl != nil && len(cacheControl) > 0 {
|
||||
block, _ = sjson.SetBytes(block, "cache_control", cacheControl)
|
||||
}
|
||||
return string(block)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user