summaryrefslogtreecommitdiff
path: root/json.go
diff options
context:
space:
mode:
Diffstat (limited to 'json.go')
-rw-r--r--json.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/json.go b/json.go
index e663fc5..e55521d 100644
--- a/json.go
+++ b/json.go
@@ -45,10 +45,7 @@ type FunctionResponse struct {
Response map[string]interface{} `json:"response"`
}
-// parseJSON opens the given file, reads it, and unmarshals it into our structs.
-func parseJSON(filename string) (*GeminiRequest, error) {
- log.Infof("Attempting to parse file: %s\n", filename)
-
+func parsePB(filename string) (*chatpb.GeminiRequest, error) {
// Read the entire file
data, err := os.ReadFile(filename)
if err != nil {
@@ -58,6 +55,18 @@ func parseJSON(filename string) (*GeminiRequest, error) {
if err := pb.UnmarshalJSON(data); err != nil {
return nil, err
}
+ return pb, nil
+}
+
+// parseJSON opens the given file, reads it, and unmarshals it into our structs.
+func parseJSON(filename string) (*GeminiRequest, error) {
+ log.Infof("Attempting to parse file: %s\n", filename)
+
+ // Read the entire file
+ data, err := os.ReadFile(filename)
+ if err != nil {
+ return nil, log.Errorf("failed to read file %s: %w", filename, err)
+ }
// Unmarshal the JSON data
var req *GeminiRequest