diff options
| author | Jeff Carr <[email protected]> | 2025-09-01 00:29:48 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-01 00:29:48 -0500 |
| commit | 4a800a7cfd6e8d59b021ff1b5a0ea9d42b89b7b3 (patch) | |
| tree | f6343d4cf86e121e5874f85502a4822613e54093 /dumpchat.go | |
| parent | eba85c6b97dbbab8b9b437e557a3dd5e6de41984 (diff) | |
attempts to submit data to the Gemini API
Diffstat (limited to 'dumpchat.go')
| -rw-r--r-- | dumpchat.go | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/dumpchat.go b/dumpchat.go index dbaa3ee..2f479ae 100644 --- a/dumpchat.go +++ b/dumpchat.go @@ -9,10 +9,31 @@ func dumpEntry(entry *chatpb.ChatEntry) { log.Printf(entry.FormatTEXT()) } -func dumpchat(chat *chatpb.Chat) { +func dumpchat(chat *chatpb.Chat) error { entries := chat.GetEntries() + var lastEntry *chatpb.ChatEntry if len(entries) > 0 { - lastEntry := entries[len(entries)-1] + lastEntry = entries[len(entries)-1] + } else { + return log.Errorf("no entries") + } + if argv.Playback.Last != nil { dumpEntry(lastEntry) } + if argv.Playback.Submit != nil { + if lastEntry.GeminiRequest == nil { + return log.Errorf("lastEntry.GeminiRequest == nil") + } + aichat, err := convertToGenai(lastEntry.GeminiRequest) + if err != nil { + log.Info("convertToGenai() returned with error", err) + return err + } + err = submitChat(aichat) + if err != nil { + log.Info("submitChat() returned with error", err) + return err + } + } + return nil } |
