summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/V50.py
diff options
context:
space:
mode:
authorRyan Jordan <ryjordan@gmail.com>2023-09-06 02:39:57 +0200
committerGitHub <noreply@github.com>2023-09-06 02:39:57 +0200
commitf81e618958318a092ca4c70a1b3ea15260bda97c (patch)
tree3ce022a8d719011268da7f1a0befc97bf32a60d8 /g4f/Provider/V50.py
parentfeat(docker): add Docker and Docker Compose support (diff)
parent~ | Merge pull request #869 from ahobsonsayers/add-console-script (diff)
downloadgpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.gz
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.bz2
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.lz
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.xz
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.zst
gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.zip
Diffstat (limited to 'g4f/Provider/V50.py')
-rw-r--r--g4f/Provider/V50.py67
1 files changed, 36 insertions, 31 deletions
diff --git a/g4f/Provider/V50.py b/g4f/Provider/V50.py
index 125dd7c5..81a95ba8 100644
--- a/g4f/Provider/V50.py
+++ b/g4f/Provider/V50.py
@@ -1,52 +1,57 @@
-import uuid, requests
+from __future__ import annotations
+
+import uuid
+
+import requests
+
from ..typing import Any, CreateResult
from .base_provider import BaseProvider
class V50(BaseProvider):
- url = 'https://p5.v50.ltd'
- supports_gpt_35_turbo = True
- supports_stream = False
- needs_auth = False
- working = True
+ url = 'https://p5.v50.ltd'
+ supports_gpt_35_turbo = True
+ supports_stream = False
+ needs_auth = False
+ working = False
@staticmethod
def create_completion(
model: str,
messages: list[dict[str, str]],
- stream: bool,
- **kwargs: Any,
- ) -> CreateResult:
- conversation = ''
- for message in messages:
- conversation += '%s: %s\n' % (message['role'], message['content'])
+ stream: bool, **kwargs: Any) -> CreateResult:
- conversation += 'assistant: '
+ conversation = "\n".join(f"{message['role']}: {message['content']}" for message in messages)
+ conversation += "\nassistant: "
+
payload = {
- "prompt": conversation,
- "options": {},
- "systemMessage": ".",
- "temperature": kwargs.get("temperature", 0.4),
- "top_p": kwargs.get("top_p", 0.4),
- "model": model,
- "user": str(uuid.uuid4())
+ "prompt" : conversation,
+ "options" : {},
+ "systemMessage" : ".",
+ "temperature" : kwargs.get("temperature", 0.4),
+ "top_p" : kwargs.get("top_p", 0.4),
+ "model" : model,
+ "user" : str(uuid.uuid4())
}
+
headers = {
- 'authority': 'p5.v50.ltd',
- 'accept': 'application/json, text/plain, */*',
- 'accept-language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
- 'content-type': 'application/json',
- 'origin': 'https://p5.v50.ltd',
- 'referer': 'https://p5.v50.ltd/',
+ 'authority' : 'p5.v50.ltd',
+ 'accept' : 'application/json, text/plain, */*',
+ 'accept-language' : 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
+ 'content-type' : 'application/json',
+ 'origin' : 'https://p5.v50.ltd',
+ 'referer' : 'https://p5.v50.ltd/',
'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'
+ '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'
}
response = requests.post("https://p5.v50.ltd/api/chat-process",
json=payload, headers=headers, proxies=kwargs['proxy'] if 'proxy' in kwargs else {})
- yield response.text
+
+ if "https://fk1.v50.ltd" not in response.text:
+ yield response.text
@classmethod
@property