diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2024-09-07 21:37:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-07 21:37:24 +0200 |
commit | 07fa87b4d180259d1da86afb565e14ac3d60d50b (patch) | |
tree | d474a2bf8bd79cf94bfa48cbaca3917659dd19be /g4f/Provider/Free2GPT.py | |
parent | Merge pull request #2206 from Parthsadaria/patch-1 (diff) | |
parent | g4f/models.py g4f/Provider/MagickPen.py (diff) | |
download | gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar.gz gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar.bz2 gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar.lz gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar.xz gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.tar.zst gpt4free-07fa87b4d180259d1da86afb565e14ac3d60d50b.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/Free2GPT.py (renamed from g4f/Provider/GeminiProChat.py) | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/g4f/Provider/GeminiProChat.py b/g4f/Provider/Free2GPT.py index 208ca773..a79bd1da 100644 --- a/g4f/Provider/GeminiProChat.py +++ b/g4f/Provider/Free2GPT.py @@ -12,11 +12,11 @@ from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider, ProviderModelMixin -class GeminiProChat(AsyncGeneratorProvider, ProviderModelMixin): - url = "https://gemini-pro.chat/" +class Free2GPT(AsyncGeneratorProvider, ProviderModelMixin): + url = "https://chat10.free2gpt.xyz" working = True supports_message_history = True - default_model = 'gemini-pro' + default_model = 'llama-3.1-70b' @classmethod async def create_async_generator( @@ -28,9 +28,9 @@ class GeminiProChat(AsyncGeneratorProvider, ProviderModelMixin): **kwargs, ) -> AsyncResult: headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36", "Accept": "*/*", - "Accept-Language": "en-US,en;q=0.5", + "Accept-Language": "en-US,en;q=0.9", "Accept-Encoding": "gzip, deflate, br", "Content-Type": "text/plain;charset=UTF-8", "Referer": f"{cls.url}/", @@ -38,21 +38,23 @@ class GeminiProChat(AsyncGeneratorProvider, ProviderModelMixin): "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", - "Connection": "keep-alive", - "TE": "trailers", + "Sec-Ch-Ua": '"Chromium";v="127", "Not)A;Brand";v="99"', + "Sec-Ch-Ua-Mobile": "?0", + "Sec-Ch-Ua-Platform": '"Linux"', + "Cache-Control": "no-cache", + "Pragma": "no-cache", + "Priority": "u=1, i", } async with ClientSession( connector=get_connector(connector, proxy), headers=headers ) as session: timestamp = int(time.time() * 1e3) + system_message = { + "role": "system", + "content": "" + } data = { - "messages": [ - { - "role": "model" if message["role"] == "assistant" else "user", - "parts": [{"text": message["content"]}], - } - for message in messages - ], + "messages": [system_message] + messages, "time": timestamp, "pass": None, "sign": generate_signature(timestamp, messages[-1]["content"]), |