from agent import _robust_json_parse, _repair_json import json def test_repair(): truncated = '{"niche": "AI Tools", "scenes": [{"scene_number": 1, "text": "Hello world' print(f"Original: {truncated}") repaired = _repair_json(truncated) print(f"Repaired: {repaired}") data = _robust_json_parse(truncated) print(f"Parsed JSON niche: {data['niche']}") # Test complex truncation complex_trunc = '{"seo": {"title": "AI' print(f"\nOriginal: {complex_trunc}") repaired_complex = _repair_json(complex_trunc) print(f"Repaired: {repaired_complex}") data_complex = _robust_json_parse(complex_trunc) print(f"Parsed JSON SEO title: {data_complex['seo']['title']}") if __name__ == "__main__": test_repair()