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

XFEstudio/gpt4free

Delete g4f/Provider/Aichatos.py

ebc40b7b
kqlio67 <166700875+kqlio67@users.noreply.github.com>
提交于

代码差异

1 个文件 +0 -56
Deleted g4f/Provider/Aichatos.py +0 -56
@@ -1,56 +0,0 @@
1 from __future__ import annotations
2
3 from aiohttp import ClientSession
4
5 from ..typing import AsyncResult, Messages
6 from .base_provider import AsyncGeneratorProvider
7 from .helper import format_prompt
8
9 import random
10
11 class Aichatos(AsyncGeneratorProvider):
12 url = "https://chat10.aichatos.xyz"
13 api = "https://api.binjie.fun"
14 working = True
15 supports_gpt_35_turbo = True
16
17 @classmethod
18 async def create_async_generator(
19 cls,
20 model: str,
21 messages: Messages,
22 proxy: str = None,
23 **kwargs
24 ) -> AsyncResult:
25 headers = {
26 "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
27 "Accept": "application/json, text/plain, */*",
28 "Accept-Language": "en-US,en;q=0.5",
29 "Accept-Encoding": "gzip, deflate, br",
30 "Content-Type": "application/json",
31 "Origin": "https://chat10.aichatos.xyz",
32 "DNT": "1",
33 "Sec-GPC": "1",
34 "Connection": "keep-alive",
35 "Sec-Fetch-Dest": "empty",
36 "Sec-Fetch-Mode": "cors",
37 "Sec-Fetch-Site": "cross-site",
38 "TE": "trailers",
39 }
40 async with ClientSession(headers=headers) as session:
41 prompt = format_prompt(messages)
42 userId = random.randint(1000000000000, 9999999999999)
43 system_message: str = "",
44 data = {
45 "prompt": prompt,
46 "userId": "#/chat/{userId}",
47 "network": True,
48 "system": system_message,
49 "withoutContext": False,
50 "stream": True,
51 }
52 async with session.post(f"{cls.api}/api/generateStream", json=data, proxy=proxy) as response:
53 response.raise_for_status()
54 async for chunk in response.content:
55 if chunk:
56 yield chunk.decode()