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

XFEstudio/gpt4free

Add Gpt6 Provider

a73820ab
Heiner Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

4 个文件 +61 -1
Modified g4f/Provider/ChatgptDemo.py +1 -1
@@ -10,7 +10,7 @@ from .helper import format_prompt
10 10 class ChatgptDemo(AsyncGeneratorProvider):
11 11 url = "https://chat.chatgptdemo.net"
12 12 supports_gpt_35_turbo = True
13 working = False
13 working = True
14 14
15 15 @classmethod
16 16 async def create_async_generator(
Added g4f/Provider/Gpt6.py +55 -0
@@ -0,0 +1,55 @@
1 from __future__ import annotations
2
3 import json
4 from aiohttp import ClientSession
5
6 from ..typing import AsyncResult, Messages
7 from .base_provider import AsyncGeneratorProvider
8 from .helper import format_prompt
9
10
11 class Gpt6(AsyncGeneratorProvider):
12 url = "https://gpt6.ai"
13 working = True
14 supports_gpt_35_turbo = True
15
16 @classmethod
17 async def create_async_generator(
18 cls,
19 model: str,
20 messages: Messages,
21 proxy: str = None,
22 **kwargs
23 ) -> AsyncResult:
24 headers = {
25 "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0",
26 "Accept": "*/*",
27 "Accept-Language": "de,en-US;q=0.7,en;q=0.3",
28 "Accept-Encoding": "gzip, deflate, br",
29 "Content-Type": "application/json",
30 "Origin": "https://gpt6.ai",
31 "Connection": "keep-alive",
32 "Referer": "https://gpt6.ai/",
33 "Sec-Fetch-Dest": "empty",
34 "Sec-Fetch-Mode": "cors",
35 "Sec-Fetch-Site": "cross-site",
36 "TE": "trailers",
37 }
38 async with ClientSession(headers=headers) as session:
39 data = {
40 "prompts":messages,
41 "geoInfo":{"ip":"100.90.100.222","hostname":"ip-100-090-100-222.um36.pools.vodafone-ip.de","city":"Muenchen","region":"North Rhine-Westphalia","country":"DE","loc":"44.0910,5.5827","org":"AS3209 Vodafone GmbH","postal":"41507","timezone":"Europe/Berlin"},
42 "paid":False,
43 "character":{"textContent":"","id":"52690ad6-22e4-4674-93d4-1784721e9944","name":"GPT6","htmlContent":""}
44 }
45 async with session.post(f"https://seahorse-app-d29hu.ondigitalocean.app/api/v1/query", json=data, proxy=proxy) as response:
46 response.raise_for_status()
47 async for line in response.content:
48 if line.startswith(b"data: [DONE]"):
49 break
50 elif line.startswith(b"data: "):
51 line = json.loads(line[6:-1])
52
53 chunk = line["choices"][0]["delta"].get("content")
54 if chunk:
55 yield chunk
Modified g4f/Provider/__init__.py +1 -0
@@ -28,6 +28,7 @@ from .ChatgptX import ChatgptX
28 28 from .DeepInfra import DeepInfra
29 29 from .FakeGpt import FakeGpt
30 30 from .FreeGpt import FreeGpt
31 from .Gpt6 import Gpt6
31 32 from .GPTalk import GPTalk
32 33 from .GptChatly import GptChatly
33 34 from .GptForLove import GptForLove
Modified g4f/models.py +4 -0
@@ -8,6 +8,7 @@ from .Provider import (
8 8 ChatAnywhere,
9 9 ChatgptNext,
10 10 HuggingChat,
11 ChatgptDemo,
11 12 GptForLove,
12 13 ChatgptAi,
13 14 DeepInfra,
@@ -23,6 +24,7 @@ from .Provider import (
23 24 Phind,
24 25 Koala,
25 26 GptGo,
27 Gpt6,
26 28 Bard,
27 29 Bing,
28 30 You,
@@ -65,6 +67,8 @@ gpt_35_long = Model(
65 67 ChatgptDemoAi,
66 68 OnlineGpt,
67 69 ChatgptNext,
70 ChatgptDemo,
71 Gpt6,
68 72 ])
69 73 )
70 74