summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go79
1 files changed, 26 insertions, 53 deletions
diff --git a/main.go b/main.go
index 6f91f27..16c2ea7 100644
--- a/main.go
+++ b/main.go
@@ -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("")
}