summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/ChatgptFree.py
diff options
context:
space:
mode:
authorrazrab <razrab@PimoLin>2023-10-23 07:25:46 +0200
committerrazrab <razrab@PimoLin>2023-10-23 07:25:46 +0200
commit2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c (patch)
tree7de51129865bd786bdf7b21fa658725a474a8cd8 /g4f/Provider/ChatgptFree.py
parentAdded code to ignore certain providers in the API (diff)
parent~ | g4f `v-0.1.7.5` (diff)
downloadgpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.gz
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.bz2
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.lz
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.xz
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.tar.zst
gpt4free-2b3bc749b39b0c6f3e8921b9e3b2fc52263c568c.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/ChatgptFree.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/g4f/Provider/ChatgptFree.py b/g4f/Provider/ChatgptFree.py
index 8b7d04c4..806ff7cc 100644
--- a/g4f/Provider/ChatgptFree.py
+++ b/g4f/Provider/ChatgptFree.py
@@ -14,7 +14,7 @@ from .helper import format_prompt, get_cookies
class ChatgptFree(AsyncProvider):
url = "https://chatgptfree.ai"
supports_gpt_35_turbo = True
- working = True
+ working = False
_post_id = None
_nonce = None
@@ -24,6 +24,7 @@ class ChatgptFree(AsyncProvider):
model: str,
messages: Messages,
proxy: str = None,
+ timeout: int = 120,
cookies: dict = None,
**kwargs
) -> str:
@@ -45,14 +46,19 @@ class ChatgptFree(AsyncProvider):
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
+ 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36',
}
- async with StreamSession(headers=headers,
- impersonate="chrome107", proxies={"https": proxy}, timeout=10) as session:
+ async with StreamSession(
+ headers=headers,
+ cookies=cookies,
+ impersonate="chrome107",
+ proxies={"https": proxy},
+ timeout=timeout
+ ) as session:
if not cls._nonce:
- async with session.get(f"{cls.url}/", cookies=cookies) as response:
+ async with session.get(f"{cls.url}/") as response:
response.raise_for_status()
response = await response.text()