PatchThoughtSignatures adds fallback thought signatures to Gemini tool-call history in body. It returns changed=false when no patch is needed.
(body []byte)
| 75 | // PatchThoughtSignatures adds fallback thought signatures to Gemini tool-call |
| 76 | // history in body. It returns changed=false when no patch is needed. |
| 77 | func PatchThoughtSignatures(body []byte) ([]byte, bool, error) { |
| 78 | var payload map[string]any |
| 79 | if err := json.Unmarshal(body, &payload); err != nil { |
| 80 | return nil, false, err |
| 81 | } |
| 82 | if !AddThoughtSignaturesToLatestTurn(payload) { |
| 83 | return body, false, nil |
| 84 | } |
| 85 | patched, err := json.Marshal(payload) |
| 86 | if err != nil { |
| 87 | return nil, false, err |
| 88 | } |
| 89 | return patched, true, nil |
| 90 | } |
| 91 | |
| 92 | // AddThoughtSignaturesToLatestTurn patches only the current turn because |
| 93 | // completed tool-call/result pairs from earlier turns are not validated by |
no test coverage detected