返回提交历史
Modified
g4f/Provider/needs_auth/OpenaiChat.py
+10
-0
XFEstudio/gpt4free
Fix NotImplementedError on WIn
65b52275
代码差异
1 个文件
+10
-0
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
3
3
import uuid, json, time, os
4
4
import tempfile, shutil, asyncio
5
import sys, subprocess
5
6
6
7
from ..base_provider import AsyncGeneratorProvider
7
8
from ..helper import get_browser, get_cookies, format_prompt, get_event_loop
@@ -174,6 +175,15 @@ fun.getToken(config).then(token => {
174
175
tmp.write(source.encode())
175
176
tmp.close()
176
177
try:
178
if sys.platform == 'win32':
179
p = subprocess.Popen(
180
[node, tmp.name],
181
stdout=subprocess.PIPE,
182
stderr=subprocess.PIPE
183
)
184
if p.returncode == 0:
185
return p.stdout.read().decode()
186
raise RuntimeError(f"Exec Error: {p.stderr.read().decode()}")
177
187
p = await asyncio.create_subprocess_exec(
178
188
node, tmp.name,
179
189
stderr=asyncio.subprocess.PIPE,