From 4a800a7cfd6e8d59b021ff1b5a0ea9d42b89b7b3 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 1 Sep 2025 00:29:48 -0500 Subject: attempts to submit data to the Gemini API --- doJSON.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 doJSON.go (limited to 'doJSON.go') diff --git a/doJSON.go b/doJSON.go new file mode 100644 index 0000000..3853783 --- /dev/null +++ b/doJSON.go @@ -0,0 +1,43 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +// An app to submit patches for the 30 GO GUI repos + +import ( + "path/filepath" + "strconv" + "strings" + + "go.wit.com/lib/protobuf/chatpb" + "go.wit.com/log" +) + +func doJSON() { + // now try to Marshal() into a protobuf + pb, err := parsePB(argv.JsonFile) + if err != nil { + badExit(err) + } + log.Info("GeminiContent pb.Marshal() worked pb.Contents len =", len(pb.Contents)) + _, filename := filepath.Split(argv.JsonFile) + parts := strings.Split(filename, ".") + + if len(parts) == 5 { + uuid := parts[1] + num, _ := strconv.Atoi(parts[3]) + log.Info(uuid, parts) + if chat := me.chats.FindByUuid(uuid); chat != nil { + log.Info("FOUND CHAT", uuid, num) + newEntry := new(chatpb.ChatEntry) + newEntry.GeminiRequest = pb + newEntry.ContentFile = filename + newEntry.RequestCounter = int32(num) + chat.AppendEntry(newEntry) + me.chats.ConfigSave() + } + } else { + } + okExit("") +} -- cgit v1.2.3