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 /main.go | |
| parent | 7f8f5e3b9b37fccbb357b70e6490823a8b22ae7e (diff) | |
code cleanup of early drafts of code from Gemini AI
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 79 |
1 files changed, 26 insertions, 53 deletions
@@ -47,70 +47,54 @@ func main() { os.Exit(0) } + // load the default chat protobuf me.chats = chatpb.NewChats() if err := me.chats.ConfigLoad(); err != nil { badExit(err) } + + // verify all the chats have Uuid's if verifyUuids(me.chats) { me.chats.ConfigSave() } - if argv.GetNextAutoTopic { - doGetNextAutoTopic() - okExit("") + aiClient, err := doConnect() + if err != nil { + badExit(err) } + _ = aiClient - if argv.Connect != nil { - err := doConnect() + if argv.JsonFile != "" { + req, err := parseJSON(argv.JsonFile) if err != nil { badExit(err) } - okExit("") - } - - if argv.Editor != nil { - doEditor() - okExit("") - } - - if argv.NewChat != nil { - doNewChat() - okExit("") - } - - if argv.Stats != nil { - doStats() - okExit("") - } + log.Info("parseJSON() ok. model =", req.Model) - if argv.Output != "" { - doOutput(argv.Output) - okExit("") - } - - if argv.Input != "" { - doInput(argv.Input) - okExit("") - } + genaiContent, err := convertToGenai(req) + if err != nil { + badExit(err) + } + log.Info("Successfully converted JSON to genai.Content") + // Here you would now use the 'genaiContent' to send to the API + _ = genaiContent // Prevent unused variable error for now - if argv.ImportFile != "" { - doImport(argv.ImportFile) okExit("") } - if argv.Add != "" { - newChats, err := addFile(argv.Add) + if argv.Interact != nil { + log.Info("testing AI client with simpleHello()") + err = simpleHello(aiClient) if err != nil { badExit(err) } - verifyUuids(newChats) - for _, newChat := range newChats.GetChats() { - me.chats.AppendByUuid(newChat) - log.Info("Attempting to add chat", newChat.ChatName) - } + doInteract() + okExit("") + } - me.chats.ConfigSave() + if argv.Stats != "" { + doStats() okExit("") } @@ -123,21 +107,10 @@ func main() { okExit("") } - /* - // if opening the GUI, always check git for dirty repos - log.Info("look for 'auto' here") - // Find the "auto" chat. - for _, chat := range me.chats.GetChats() { - if chat.GetChatName() == "auto" { - prettyFormatChat(chat) - okExit("") - } - } - */ // doGui() // by default, start interacting with gemini-cli - doEditor() + me.pp.WriteHelp(os.Stdout) okExit("") } |
