human print the gemini struct

This commit is contained in:
Jeff Carr 2025-09-02 18:37:23 -05:00
parent 0bf0fe3b01
commit 1aaa1d0e07
1 changed files with 47 additions and 0 deletions

View File

@ -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)
}