AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
Fix `validate_json` file error when cwd != project root (#2665)
Mick91537b049625
diff --git a/autogpt/json_utils/utilities.py b/autogpt/json_utils/utilities.pyindex eb9bb68775..388cad3c44 100644--- a/autogpt/json_utils/utilities.py+++ b/autogpt/json_utils/utilities.py@@ -1,5 +1,6 @@"""Utilities for the json_fixes package."""import json+import os.pathimport refrom jsonschema import Draft7Validator@@ -34,7 +35,9 @@ def validate_json(json_object: object, schema_name: object) -> object::param schema_name::type json_object: object"""- with open(f"autogpt/json_utils/{schema_name}.json", "r") as f:+ script_dir = os.path.dirname(__file__)++ with open(os.path.join(script_dir, f"{schema_name}.json"), "r") as f:schema = json.load(f)validator = Draft7Validator(schema)