diff options
| author | Jeff Carr <[email protected]> | 2025-08-30 15:15:43 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-30 15:15:43 -0500 |
| commit | c7896e47f9c91e330b023bdb34a7540f193a5422 (patch) | |
| tree | 76a0801d34c7b53442e2e5d2ecaeba5ef5e961c0 /doImport.go | |
| parent | 7f8f5e3b9b37fccbb357b70e6490823a8b22ae7e (diff) | |
code cleanup of early drafts of code from Gemini AI
Diffstat (limited to 'doImport.go')
| -rw-r--r-- | doImport.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/doImport.go b/doImport.go deleted file mode 100644 index def0071..0000000 --- a/doImport.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "io/ioutil" - "time" - - "go.wit.com/lib/protobuf/chatpb" - "go.wit.com/log" - "google.golang.org/protobuf/types/known/timestamppb" -) - -func doImport(filename string) { - content, err := ioutil.ReadFile(filename) - if err != nil { - log.Warn("Error reading import file:", err) - return - } - - s := string(content) - - // 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_REGEX, - Ctime: timestamppb.New(time.Now()), - ToolCalls: []*chatpb.ToolCall{ - { - Name: "Shell", - Input: 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.") - } - } -} |
