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

XFEstudio/gpt4free

Update MyShell.py

aa127169
H Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +7 -2
Modified g4f/Provider/MyShell.py +7 -2
@@ -65,6 +65,7 @@ window.reader = response.body.getReader();
65 65 driver.execute_script(script.replace("{body}", json.dumps(data)))
66 66 script = """
67 67 chunk = await window.reader.read();
68 if (chunk['done']) return null;
68 69 text = await (new Response(chunk['value']).text());
69 70 content = '';
70 71 text.split('\\n').forEach((line, index) => {
@@ -79,8 +80,12 @@ text.split('\\n').forEach((line, index) => {
79 80 });
80 81 return content;
81 82 """
82 while chunk := driver.execute_script(script):
83 yield chunk
83 while True:
84 chunk = driver.execute_script(script):
85 if chunk:
86 yield chunk
87 elif chunk != "":
88 break
84 89 finally:
85 90 driver.close()
86 91 if not browser: