返回提交历史
Modified
etc/tool/copilot.py
+2
-0
XFEstudio/gpt4free
feat: Handle alternate JSON format delimiter in read_json function
- Modified `read_json` function in `copilot.py` - Added handling for alternate text delimiter `"\n\n---\n\n"` when extracting JSON content
919308a7
代码差异
1 个文件
+2
-0
@@ -67,6 +67,8 @@ def read_json(text: str) -> dict:
67
67
match = re.search(r"```(json|)\n(?P<code>[\S\s]+?)\n```", text)
68
68
if match:
69
69
text = match.group("code")
70
else:
71
text = text.split("\n\n---\n\n")[0]
70
72
try:
71
73
return json.loads(text.strip())
72
74
except json.JSONDecodeError: