From c7896e47f9c91e330b023bdb34a7540f193a5422 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 30 Aug 2025 15:15:43 -0500 Subject: code cleanup of early drafts of code from Gemini AI --- doInput.go | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 doInput.go (limited to 'doInput.go') diff --git a/doInput.go b/doInput.go deleted file mode 100644 index fe7cf21..0000000 --- a/doInput.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "os" - "time" - - "go.wit.com/lib/protobuf/chatpb" - "go.wit.com/log" - "google.golang.org/protobuf/types/known/timestamppb" -) - -func doInput(s string) { - filename := "/tmp/regex-input.log" - f, err := os.OpenFile(filename, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - log.Println(err) - return - } - defer f.Close() - if _, err := f.WriteString(s + "\n"); err != nil { - log.Println(err) - } - - log.Info("INPUT 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_USER, - Content: s, - Ctime: timestamppb.New(time.Now()), - } - 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.") - } - } -} -- cgit v1.2.3