From fbbed0475bc680afb754bbe9ba471c584d884a8f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 30 Aug 2025 18:07:41 -0500 Subject: parse stuff --- main.go | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 39cf5cf..61921d8 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,8 @@ package main import ( "embed" "os" + "path/filepath" + "strings" "github.com/google/uuid" "go.wit.com/dev/alexflint/arg" @@ -65,21 +67,42 @@ func main() { _ = aiClient if argv.JsonFile != "" { - jstruct, err := parseJSON(argv.JsonFile) + /* + jstruct, err := parseJSON(argv.JsonFile) + if err != nil { + badExit(err) + } + log.Info("parseJSON() ok. model =", jstruct.Model) + + // Marshal this JSON file into a protobuf + genaiContent, err := convertToGenai(jstruct) + 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 + */ + + // now try to Marshal() into a protobuf + pb, err := parsePB(argv.JsonFile) if err != nil { badExit(err) } - log.Info("parseJSON() ok. model =", jstruct.Model) - - // Marshal this JSON file into a protobuf - genaiContent, err := convertToGenai(jstruct) - if err != nil { - badExit(err) + log.Info("GeminiContent pb.Marshal() worked len =", len(pb.Contents)) + _, filename := filepath.Split(argv.JsonFile) + parts := strings.Split(filename, ".") + + if len(parts) == 5 { + uuid := parts[1] + log.Info(uuid, parts) + // newEntry := new(chatpb.ChatEntry) + // newEntry.GeminiRequest = pb + if chat := me.chats.FindByUuid(uuid); chat != nil { + log.Info("FOUND CHAT", uuid) + } + } else { } - 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 - okExit("") } -- cgit v1.2.3