diff options
author | ⲘrṨhส∂ow <71973368+MrShadowDev@users.noreply.github.com> | 2023-10-23 09:46:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-23 09:46:25 +0200 |
commit | 3982f39424ea037aca1086d45c6f657b4bfc457c (patch) | |
tree | 987290c5dc5822cb0197e789df68488536b1637c /g4f/Provider/needs_auth/Theb.py | |
parent | ~ | g4f `v-0.1.7.5` (diff) | |
download | gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar.gz gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar.bz2 gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar.lz gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar.xz gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.tar.zst gpt4free-3982f39424ea037aca1086d45c6f657b4bfc457c.zip |
Diffstat (limited to 'g4f/Provider/needs_auth/Theb.py')
-rw-r--r-- | g4f/Provider/needs_auth/Theb.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/g4f/Provider/needs_auth/Theb.py b/g4f/Provider/needs_auth/Theb.py index 9803db97..b3c9019d 100644 --- a/g4f/Provider/needs_auth/Theb.py +++ b/g4f/Provider/needs_auth/Theb.py @@ -28,28 +28,28 @@ class Theb(BaseProvider): "bearer_token":"free", "org_id":"theb", }) - + bearer_token = auth["bearer_token"] org_id = auth["org_id"] - + headers = { - 'authority' : 'beta.theb.ai', - 'accept' : 'text/event-stream', - 'accept-language' : 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7', - 'authorization' : 'Bearer '+bearer_token, - 'content-type' : 'application/json', - 'origin' : 'https://beta.theb.ai', - 'referer' : 'https://beta.theb.ai/home', - 'sec-ch-ua' : '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"', - 'sec-ch-ua-mobile' : '?0', + 'authority': 'beta.theb.ai', + 'accept': 'text/event-stream', + 'accept-language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7', + 'authorization': f'Bearer {bearer_token}', + 'content-type': 'application/json', + 'origin': 'https://beta.theb.ai', + 'referer': 'https://beta.theb.ai/home', + 'sec-ch-ua': '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"', + 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', - 'sec-fetch-dest' : 'empty', - 'sec-fetch-mode' : 'cors', - 'sec-fetch-site' : 'same-origin', - 'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36', - 'x-ai-model' : 'ee8d4f29cb7047f78cbe84313ed6ace8', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'same-origin', + 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36', + 'x-ai-model': 'ee8d4f29cb7047f78cbe84313ed6ace8', } - + req_rand = random.randint(100000000, 9999999999) json_data: dict[str, Any] = { @@ -65,7 +65,7 @@ class Theb(BaseProvider): "long_term_memory" : "auto" } } - + response = requests.post( f"https://beta.theb.ai/api/conversation?org_id={org_id}&req_rand={req_rand}", headers=headers, @@ -73,7 +73,7 @@ class Theb(BaseProvider): stream=True, proxies={"https": proxy} ) - + response.raise_for_status() content = "" next_content = "" @@ -82,7 +82,7 @@ class Theb(BaseProvider): next_content = content data = json.loads(chunk.decode().split("data: ")[1]) content = data["content"] - yield data["content"].replace(next_content, "") + yield content.replace(next_content, "") @classmethod @property |