package main import ( "go.wit.com/lib/protobuf/chatpb" "go.wit.com/log" ) func dumpEntry(entry *chatpb.ChatEntry) { log.Printf(entry.FormatTEXT()) } func dumpchat(chat *chatpb.Chat) error { entries := chat.GetEntries() var lastEntry *chatpb.ChatEntry if len(entries) > 0 { 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.GetGeminiRequest()) 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 }