XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

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
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +2 -0
Modified etc/tool/copilot.py +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: