diff --git a/humanTable.go b/humanTable.go index 78a9b2e..29e6411 100644 --- a/humanTable.go +++ b/humanTable.go @@ -3,7 +3,11 @@ package chatpb import ( + "strings" + "time" + "go.wit.com/lib/cobol" + "go.wit.com/lib/gui/shell" "go.wit.com/log" ) @@ -73,23 +77,29 @@ 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} + args := []string{"uuid", "age", "ID", "Who", "model", "", "", "", "", ""} + sizes := []int{40, 5, 5, 8, 12, 2, 2, 2, 2, 2} log.Info(cobol.StandardTableSize10(sizes, args)) for _, e := range c.GetEntries() { var args []string - age := e.Ctime.AsTime().String() + dur := time.Since(e.Ctime.AsTime()) + age := shell.FormatDuration(dur) var model string + var id string if e.GeminiRequest == nil { model = "nil" } else { model = e.GeminiRequest.Model } - args = []string{e.Uuid, age, e.GetContentFile(), e.From.String(), model, "", "", "", "", ""} + if e.GetContentFile() != "" { + parts := strings.Split(e.GetContentFile(), ".") + id = parts[3] + } + args = []string{e.Uuid, age, id, e.From.String(), model, "", "", "", "", ""} start := cobol.StandardTableSize10(sizes, args) - log.Info(start) + log.Info(start, e.GetContentFile()) } log.Infof("Total Chats: %d\n", len(c.GetEntries())) }