summaryrefslogtreecommitdiff
path: root/addChat.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-01 22:19:44 -0500
committerJeff Carr <[email protected]>2025-09-01 22:19:44 -0500
commit49ad81bc279a8b1669f68e5d02c95d2a66a5cb4b (patch)
tree18a6475a98a70ab88d73cd44be73c91b7ea74136 /addChat.go
parent559e276c44962be9b14506e42326ff07fdafb579 (diff)
more stuff for importing JSON output from gemini-cli
Diffstat (limited to 'addChat.go')
-rw-r--r--addChat.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/addChat.go b/addChat.go
new file mode 100644
index 0000000..972bb42
--- /dev/null
+++ b/addChat.go
@@ -0,0 +1,28 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
+package chatpb
+
+import (
+ "time"
+
+ "go.wit.com/log"
+ timestamppb "google.golang.org/protobuf/types/known/timestamppb"
+)
+
+// returns true if the pb was added
+// to indicate that ConfigSave() should be run to write it out to disk
+func (c *Chat) AddGeminiRequest(fname string, age time.Time, pb *GeminiRequest) bool {
+ for _, e := range c.GetEntries() {
+ if e.GetContentFile() == fname {
+ log.Info("fname already here", fname)
+ return false
+ }
+ }
+ e := new(ChatEntry)
+ e.Ctime = timestamppb.New(age)
+ e.From = Who_USER
+ e.ContentFile = fname
+ e.GeminiRequest = pb
+ c.AppendEntry(e)
+ return true
+}