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/deprecated/V50.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/deprecated/V50.py')
-rw-r--r-- | g4f/Provider/deprecated/V50.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/g4f/Provider/deprecated/V50.py b/g4f/Provider/deprecated/V50.py index 9a8b032c..f4f4d823 100644 --- a/g4f/Provider/deprecated/V50.py +++ b/g4f/Provider/deprecated/V50.py @@ -21,9 +21,12 @@ class V50(BaseProvider): messages: list[dict[str, str]], stream: bool, **kwargs: Any) -> CreateResult: - conversation = "\n".join(f"{message['role']}: {message['content']}" for message in messages) - conversation += "\nassistant: " - + conversation = ( + "\n".join( + f"{message['role']}: {message['content']}" for message in messages + ) + + "\nassistant: " + ) payload = { "prompt" : conversation, "options" : {}, @@ -33,7 +36,7 @@ class V50(BaseProvider): "model" : model, "user" : str(uuid.uuid4()) } - + headers = { 'authority' : 'p5.v50.ltd', 'accept' : 'application/json, text/plain, */*', @@ -47,9 +50,13 @@ class V50(BaseProvider): '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' } - response = requests.post("https://p5.v50.ltd/api/chat-process", - json=payload, headers=headers, proxies=kwargs['proxy'] if 'proxy' in kwargs else {}) - + response = requests.post( + "https://p5.v50.ltd/api/chat-process", + json=payload, + headers=headers, + proxies=kwargs.get('proxy', {}), + ) + if "https://fk1.v50.ltd" not in response.text: yield response.text |