From 1aaa1d0e0743acc62b41e65b7547a53de5a399bf Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 2 Sep 2025 18:37:23 -0500 Subject: [PATCH] human print the gemini struct --- humanTable.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/humanTable.go b/humanTable.go index b134efb..d77bc01 100644 --- a/humanTable.go +++ b/humanTable.go @@ -107,3 +107,50 @@ func (c *Chat) PrintChatGeminiTable() { } log.Infof("Total Chats: %d\n", len(c.GetEntries())) } + +func (gr *GeminiRequest) PrintGeminiTable() { + if gr == nil { + return + } + log.DaemonMode(true) + + // print the header + args := []string{"model", "what", "age", "cId", "partId", "", "", "", "", ""} + sizes := []int{16, 8, 4, 4, 4, 16, 120, 2, 2, 2} + log.Info(cobol.StandardTableSize10(sizes, args)) + + var countCONTENTS int + var countPARTS int + for x, c := range gr.GetContents() { + model := gr.Model + cId := log.Sprintf("%d", x) + countCONTENTS += 1 + for i, p := range c.GetParts() { + var args []string + partId := log.Sprintf("%d", i) + + // removes newline chars from the text + parts := strings.Split(p.GetText(), "\n") + txt := strings.Join(parts, "__") + + what := "TXT" + + if fc := p.GetFunctionCall(); fc != nil { + what = "FuncCall" + txt = log.Sprintf("%s, %v", fc.Name, fc.Args) + + } + if fr := p.GetFunctionResponse(); fr != nil { + what = "FuncResp" + txt = fr.Name + } + + args = []string{model, what, "", cId, partId, p.ThoughtSignature, txt, "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + log.Info(start) + countPARTS += 1 + } + } + log.Infof("Total Contents (%d) Parts (%d)\n", countCONTENTS, countPARTS) +}