diff options
| author | Jeff Carr <[email protected]> | 2025-09-01 12:23:18 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-01 12:23:18 -0500 |
| commit | 3a1e76e65ea82f7fecb9ab923d812007436ffc57 (patch) | |
| tree | 9a6cbc102e429635734853a5b075688e4e5a6164 /convertToPB.go | |
| parent | c84460eb65b1776c62119ad76c567dc128c2e5fd (diff) | |
gemini-cli is stupid
Diffstat (limited to 'convertToPB.go')
| -rw-r--r-- | convertToPB.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/convertToPB.go b/convertToPB.go index e9399b6..13faad5 100644 --- a/convertToPB.go +++ b/convertToPB.go @@ -21,15 +21,24 @@ func convertToPB(resp *genai.GenerateContentResponse) *chatpb.ChatEntry { PartType: &chatpb.Part_Text{Text: part.Text}, }) } - if part.FunctionCall != nil { - fmt.Printf("Gemini API requested to execute command: %s\n", part.FunctionCall.Name) - // This is a simplified conversion of args. - // A more robust implementation would handle different value types. + if fc := part.FunctionCall; fc != nil { + fmt.Printf("Gemini API requested to execute command: %s\n", fc.Name) entry.Parts = append(entry.Parts, &chatpb.Part{ PartType: &chatpb.Part_FunctionCall{ FunctionCall: &chatpb.FunctionCall{ - Name: part.FunctionCall.Name, - Args: &chatpb.ArgsInfo{}, // TODO: Properly map args if needed + Name: fc.Name, + Args: &chatpb.ArgsInfo{}, // TODO: Properly map args from fc.Args map[string]any + }, + }, + }) + } + if fr := part.FunctionResponse; fr != nil { + // Convert the FunctionResponse to the protobuf equivalent + entry.Parts = append(entry.Parts, &chatpb.Part{ + PartType: &chatpb.Part_FunctionResponse{ + FunctionResponse: &chatpb.FunctionResponse{ + Name: fr.Name, + // TODO: Properly map the response content }, }, }) |
