From 56db2051118073d19b0146b23f6e76214f2853a8 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Thu, 16 Nov 2023 19:41:31 +0100 Subject: Update MyShell.py --- g4f/Provider/MyShell.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'g4f') 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: ')) { -- cgit v1.2.3