summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-03 21:36:50 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2023-11-03 21:36:50 +0100
commit65b5227500f4204c69ca39670a6e4cab89314617 (patch)
tree3694235129208902c07a02826d56d8a1be00dce8
parentMerge pull request #1202 from Commenter123321/main (diff)
downloadgpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar.gz
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar.bz2
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar.lz
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar.xz
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.tar.zst
gpt4free-65b5227500f4204c69ca39670a6e4cab89314617.zip
-rw-r--r--g4f/Provider/needs_auth/OpenaiChat.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py
index fb81face..119626e5 100644
--- a/g4f/Provider/needs_auth/OpenaiChat.py
+++ b/g4f/Provider/needs_auth/OpenaiChat.py
@@ -2,6 +2,7 @@ from __future__ import annotations
import uuid, json, time, os
import tempfile, shutil, asyncio
+import sys, subprocess
from ..base_provider import AsyncGeneratorProvider
from ..helper import get_browser, get_cookies, format_prompt, get_event_loop
@@ -174,6 +175,15 @@ fun.getToken(config).then(token => {
tmp.write(source.encode())
tmp.close()
try:
+ if sys.platform == 'win32':
+ p = subprocess.Popen(
+ [node, tmp.name],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE
+ )
+ if p.returncode == 0:
+ return p.stdout.read().decode()
+ raise RuntimeError(f"Exec Error: {p.stderr.read().decode()}")
p = await asyncio.create_subprocess_exec(
node, tmp.name,
stderr=asyncio.subprocess.PIPE,