diff options
-rw-r--r-- | g4f/Provider/MyShell.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/g4f/Provider/MyShell.py b/g4f/Provider/MyShell.py index ac3290b5..70fd3509 100644 --- a/g4f/Provider/MyShell.py +++ b/g4f/Provider/MyShell.py @@ -24,13 +24,13 @@ class MyShell(BaseProvider): hidden_display: bool = True, **kwargs ) -> CreateResult: - if not browser: + if browser: + driver = browser + else: if hidden_display: driver, display = get_browser("", True, proxy) else: - display = get_browser("", False, proxy) - else: - driver = browser + driver = get_browser("", False, proxy) from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait @@ -66,7 +66,7 @@ window.reader = response.body.getReader(); script = """ chunk = await window.reader.read(); if (chunk['done']) return null; -text = await (new Response(chunk['value']).text()); +text = (new TextDecoder ()).decode(chunk['value']); content = ''; text.split('\\n').forEach((line, index) => { if (line.startsWith('data: ')) { |