summaryrefslogtreecommitdiff
path: root/doOutput.go
diff options
context:
space:
mode:
authorCastor Gemini <[email protected]>2025-08-22 10:12:05 -0500
committerJeff Carr <[email protected]>2025-08-22 10:12:05 -0500
commit48ba121435b816c61b2740535fb75193934e2a6b (patch)
tree039af88f404a298b4d530c80d4184e4bfa51bd2c /doOutput.go
parente6737ba6357622807cac01c30710f19a668f452f (diff)
feat(gemini): update "auto" chat on --output
Diffstat (limited to 'doOutput.go')
-rw-r--r--doOutput.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/doOutput.go b/doOutput.go
index b979b5c..9bd5169 100644
--- a/doOutput.go
+++ b/doOutput.go
@@ -3,6 +3,7 @@ package main
import (
"os"
+ "go.wit.com/lib/protobuf/chatpb"
"go.wit.com/log"
)
@@ -19,4 +20,34 @@ func doOutput(s string) {
}
log.Info("OUTPUT LOGGED TO", filename)
+
+ // Load the existing chats.
+ all := chatpb.NewChats()
+ if err := all.ConfigLoad(); err != nil {
+ log.Warn("Error loading config, can't add to auto chat:", err)
+ return
+ }
+
+ // Find the "auto" chat.
+ var autoChat *chatpb.Chat
+ for _, chat := range all.GetChats() {
+ if chat.GetChatName() == "auto" {
+ autoChat = chat
+ break
+ }
+ }
+
+ // If the "auto" chat is found, add the new entry.
+ if autoChat != nil {
+ newEntry := &chatpb.ChatEntry{
+ From: chatpb.Who_GEMINI, // Or USER, depending on context
+ Content: s,
+ }
+ autoChat.Entries = append(autoChat.Entries, newEntry)
+ if err := all.ConfigSave(); err != nil {
+ log.Warn("Error saving config after adding to auto chat:", err)
+ } else {
+ log.Info("Added new entry to 'auto' chat.")
+ }
+ }
}