diff options
Diffstat (limited to '')
-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 |