XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

add v50

cbaad15b
Bagus Indrayana <bagusindrayanaindo@gmail.com>
提交于

代码差异

3 个文件 +50 -0
Added .vscode/settings.json +6 -0
@@ -0,0 +1,6 @@
1 {
2 "[python]": {
3 "editor.defaultFormatter": "ms-python.black-formatter"
4 },
5 "python.formatting.provider": "none"
6 }
Added g4f/Provider/Providers/V50.py +43 -0
@@ -0,0 +1,43 @@
1 import os, uuid, requests
2 from ...typing import get_type_hints
3 url = 'https://p5.v50.ltd'
4 model = ['gpt-3.5-turbo','gpt-3.5-turbo-16k']
5 supports_stream = False
6 needs_auth = False
7 working = True
8
9 def _create_completion(model: str, messages: list, stream: bool, temperature: float = 0.7, **kwargs):
10
11 conversation = ''
12 for message in messages:
13 conversation += '%s: %s\n' % (message['role'], message['content'])
14
15 conversation += 'assistant: '
16 payload = {
17 "prompt": conversation,
18 "options": {},
19 "systemMessage": ".",
20 "temperature": temperature,
21 "top_p": 1,
22 "model": model,
23 "user": str(uuid.uuid4())
24 }
25 headers = {
26 'authority': 'p5.v50.ltd',
27 'accept': 'application/json, text/plain, */*',
28 'accept-language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7',
29 'content-type': 'application/json',
30 'origin': 'https://p5.v50.ltd',
31 'referer': 'https://p5.v50.ltd/',
32 'sec-ch-ua-platform': '"Windows"',
33 'sec-fetch-dest': 'empty',
34 'sec-fetch-mode': 'cors',
35 'sec-fetch-site': 'same-origin',
36 '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'
37 }
38 response = requests.post("https://p5.v50.ltd/api/chat-process",
39 json=payload, headers=headers, stream=True)
40 yield response.text
41
42 params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
43 '(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
Modified g4f/Provider/__init__.py +1 -0
@@ -25,6 +25,7 @@ from .Providers import (
25 25 ChatgptAi,
26 26 opchatgpts,
27 27 Raycast,
28 V50,
28 29 )
29 30
30 31 Palm = Bard