diff options
| author | Jeff Carr <[email protected]> | 2025-08-30 18:07:41 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-30 18:07:41 -0500 |
| commit | fbbed0475bc680afb754bbe9ba471c584d884a8f (patch) | |
| tree | 8aeac923b5aeaa193744ff4e774065ce9545e707 /json.go | |
| parent | 512ebf5be67f468eaeeb223911c6f6707cea3015 (diff) | |
parse stuff
Diffstat (limited to 'json.go')
| -rw-r--r-- | json.go | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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 |
