diff options
| author | Jeff Carr <[email protected]> | 2025-09-01 18:58:06 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-01 18:58:06 -0500 |
| commit | f0cea5973d51ab9bd5bd4e80456b9f2357a37706 (patch) | |
| tree | b93470e81f14e496e1ec1b9e4fa6e75188ef1f3c | |
| parent | fe0c0d8f4f1626f18a7f2ec9c6340b9b6376b122 (diff) | |
dump tables to STDOUT
| -rw-r--r-- | humanTable.go | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/humanTable.go b/humanTable.go new file mode 100644 index 0000000..78a9b2e --- /dev/null +++ b/humanTable.go @@ -0,0 +1,95 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package chatpb + +import ( + "go.wit.com/lib/cobol" + "go.wit.com/log" +) + +func (all *Chats) PrintHumanTable() { + log.DaemonMode(true) + + // print the header + args := []string{"uuid", "name", "age", "master", "devel", "user", "curver", "lasttag", "next", "repo type"} + sizes := []int{40, 40, 6, 4, 4, 4, 4, 4, 4, 4} + log.Info(cobol.StandardTableSize10(sizes, args)) + + for chat := range all.IterAll() { + chat.printChatToTable(sizes) + } + log.Infof("Total Chats: %d\n", all.Len()) +} + +func (c *Chat) printChatToTable(sizes []int) { + var args []string + age := c.Ctime.AsTime().String() + args = []string{c.Uuid, age, c.GetChatName(), "", "", "", "", "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + + log.Info(start) +} + +func (c *Chat) PrintChatStatsTable() { + log.DaemonMode(true) + + // print the header + args := []string{"uuid", "name", "age", "master", "devel", "user", "curver", "lasttag", "next", "repo type"} + sizes := []int{40, 40, 6, 4, 4, 4, 4, 4, 4, 4} + log.Info(cobol.StandardTableSize10(sizes, args)) + + for _, e := range c.GetSession() { + var args []string + args = []string{e.Uuid, "", "", "", "", "", "", "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + + log.Info(start) + } + log.Infof("Total Chats: %d\n", len(c.GetEntries())) +} + +func (c *Chat) PrintChatEntriesTable() { + log.DaemonMode(true) + + // print the header + args := []string{"uuid", "age", "con file", "Who", "model", "", "", "", "", ""} + sizes := []int{40, 16, 8, 4, 8, 2, 2, 2, 2, 2} + log.Info(cobol.StandardTableSize10(sizes, args)) + + for _, e := range c.GetEntries() { + var args []string + age := e.Ctime.AsTime().String() + args = []string{e.Uuid, age, e.GetContentFile(), e.From.String(), "", "", "", "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + log.Info(start) + } + log.Infof("Total Chats: %d\n", len(c.GetEntries())) +} + +func (c *Chat) PrintChatGeminiTable() { + log.DaemonMode(true) + + // print the header + args := []string{"uuid", "age", "con file", "Who", "model", "", "", "", "", ""} + sizes := []int{40, 16, 8, 4, 8, 2, 2, 2, 2, 2} + log.Info(cobol.StandardTableSize10(sizes, args)) + + for _, e := range c.GetEntries() { + var args []string + age := e.Ctime.AsTime().String() + var model string + if e.GeminiRequest == nil { + model = "nil" + } else { + model = e.GeminiRequest.Model + } + args = []string{e.Uuid, age, e.GetContentFile(), e.From.String(), model, "", "", "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + log.Info(start) + } + log.Infof("Total Chats: %d\n", len(c.GetEntries())) +} |
