返回提交历史
Deleted
g4f/Provider/Feedough.py
+0
-52
XFEstudio/gpt4free
Delete g4f/Provider/Feedough.py
abf92bf4
代码差异
1 个文件
+0
-52
@@ -1,52 +0,0 @@
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 Feedough(AsyncGeneratorProvider):
12
url = "https://www.feedough.com"
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
26
"Accept": "*/*",
27
"Accept-Language": "en-US,en;q=0.5",
28
"Accept-Encoding": "gzip, deflate, br",
29
"Referer": "https://www.feedough.com/ai-prompt-generator/",
30
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
31
"Origin": "https://www.feedough.com",
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": "same-origin",
38
"TE": "trailers",
39
}
40
async with ClientSession(headers=headers) as session:
41
prompt = format_prompt(messages)
42
data = {
43
"action": "aixg_generate",
44
"prompt": prompt,
45
}
46
async with session.post(f"{cls.url}/wp-admin/admin-ajax.php", data=data, proxy=proxy) as response:
47
response.raise_for_status()
48
response_text = await response.text()
49
response_json = json.loads(response_text)
50
if response_json["success"]:
51
message = response_json["data"]["message"]
52
yield message