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

XFEstudio/gpt4free

~ | remove DeepAi

c9c573a6
abc <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

5 个文件 +2 -90
Modified README.md +0 -3
@@ -215,7 +215,6 @@ from g4f.Provider import (
215 215 Bing,
216 216 ChatBase,
217 217 ChatgptAi,
218 DeepAi,
219 218 H2o,
220 219 HuggingChat,
221 220 OpenAssistant,
@@ -282,7 +281,6 @@ _providers = [
282 281 g4f.Provider.Aichat,
283 282 g4f.Provider.ChatBase,
284 283 g4f.Provider.Bing,
285 g4f.Provider.DeepAi,
286 284 g4f.Provider.GptGo,
287 285 g4f.Provider.You,
288 286 g4f.Provider.Yqcloud,
@@ -394,7 +392,6 @@ if __name__ == "__main__":
394 392 | [chatgpt.ai](https://chatgpt.ai/) | `g4f.Provider.ChatgptAi` | ✔️ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
395 393 | [opchatgpts.net](https://opchatgpts.net) | `g4f.Provider.ChatgptLogin` | ✔️ | ❌ | ❌ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
396 394 | [ava-ai-ef611.web.app](https://ava-ai-ef611.web.app) | `g4f.Provider.CodeLinkAva` | ✔️ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
397 | [deepai.org](https://deepai.org) | `g4f.Provider.DeepAi` | ✔️ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
398 395 | [gptgo.ai](https://gptgo.ai) | `g4f.Provider.GptGo` | ✔️ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
399 396 | [gpt-gm.h2o.ai](https://gpt-gm.h2o.ai) | `g4f.Provider.H2o` | ❌ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ |
400 397 | [huggingface.co](https://huggingface.co/chat/) | `g4f.Provider.HuggingChat` | ❌ | ❌ | ✔️ | ✔️ | ![Active](https://img.shields.io/badge/Active-brightgreen) | ✔️ |
Deleted g4f/Provider/DeepAi.py +0 -80
@@ -1,80 +0,0 @@
1 from __future__ import annotations
2
3 import json
4 import js2py
5 import random
6 import hashlib
7 from aiohttp import ClientSession
8
9 from ..typing import AsyncResult, Messages
10 from .base_provider import AsyncGeneratorProvider
11
12
13 class DeepAi(AsyncGeneratorProvider):
14 url = "https://deepai.org"
15 working = True
16 supports_gpt_35_turbo = True
17
18 @staticmethod
19 async def create_async_generator(
20 model: str,
21 messages: Messages,
22 proxy: str = None,
23 **kwargs
24 ) -> AsyncResult:
25 agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
26
27 token_js = """
28 var agent = '""" + agent + """'
29 var a, b, c, d, e, h, f, l, g, k, m, n, r, x, C, E, N, F, T, O, P, w, D, G, Q, R, W, I, aa, fa, na, oa, ha, ba, X, ia, ja, ka, J, la, K, L, ca, S, U, M, ma, B, da, V, Y;
30 h = Math.round(1E11 * Math.random()) + "";
31 f = function() {
32 for (var p = [], r = 0; 64 > r;) p[r] = 0 | 4294967296 * Math.sin(++r % Math.PI);
33 return function(z) {
34 var B, G, H, ca = [B = 1732584193, G = 4023233417, ~B, ~G],
35 X = [],
36 x = unescape(encodeURI(z)) + "\u0080",
37 v = x.length;
38 z = --v / 4 + 2 | 15;
39 for (X[--z] = 8 * v; ~v;) X[v >> 2] |= x.charCodeAt(v) << 8 * v--;
40 for (r = x = 0; r < z; r += 16) {
41 for (v = ca; 64 > x; v = [H = v[3], B + ((H = v[0] + [B & G | ~B & H, H & B | ~H & G, B ^ G ^ H, G ^ (B | ~H)][v = x >> 4] + p[x] + ~~X[r | [x, 5 * x + 1, 3 * x + 5, 7 * x][v] & 15]) << (v = [7, 12, 17, 22, 5, 9, 14, 20, 4, 11, 16, 23, 6, 10, 15, 21][4 * v + x++ % 4]) | H >>> -v), B, G]) B = v[1] | 0, G = v[2];
42 for (x = 4; x;) ca[--x] += v[x]
43 }
44 for (z = ""; 32 > x;) z += (ca[x >> 3] >> 4 * (1 ^ x++) & 15).toString(16);
45 return z.split("").reverse().join("")
46 }
47 }();
48
49 "tryit-" + h + "-" + f(agent + f(agent + f(agent + h + "x")));
50 """
51
52 payload = {"chat_style": "chat", "chatHistory": json.dumps(messages)}
53 api_key = js2py.eval_js(token_js)
54 headers = {
55 "api-key": api_key,
56 "User-Agent": agent,
57 **kwargs.get("headers", {})
58 }
59 async with ClientSession(
60 headers=headers
61 ) as session:
62 fill = "ing_is"
63 fill = f"ack{fill}_a_crim"
64 async with session.post(f"https://api.deepai.org/h{fill}e", proxy=proxy, data=payload) as response:
65 response.raise_for_status()
66 async for stream in response.content.iter_any():
67 if stream:
68 try:
69 yield stream.decode("utf-8")
70 except UnicodeDecodeError:
71 yield stream.decode("unicode-escape")
72
73
74 def get_api_key(user_agent: str):
75 e = str(round(1E11 * random.random()))
76
77 def hash(data: str):
78 return hashlib.md5(data.encode()).hexdigest()[::-1]
79
80 return f"tryit-{e}-" + hash(user_agent + hash(user_agent + hash(user_agent + e + "x")))
Modified g4f/Provider/__init__.py +0 -3
@@ -16,7 +16,6 @@ from .ChatgptDemo import ChatgptDemo
16 16 from .ChatgptDuo import ChatgptDuo
17 17 from .ChatgptX import ChatgptX
18 18 from .Cromicle import Cromicle
19 from .DeepAi import DeepAi
20 19 from .FreeGpt import FreeGpt
21 20 from .GPTalk import GPTalk
22 21 from .GptForLove import GptForLove
@@ -64,7 +63,6 @@ class ProviderUtils:
64 63 'ChatgptX': ChatgptX,
65 64 'CodeLinkAva': CodeLinkAva,
66 65 'Cromicle': Cromicle,
67 'DeepAi': DeepAi,
68 66 'DfeHub': DfeHub,
69 67 'EasyChat': EasyChat,
70 68 'Equing': Equing,
@@ -127,7 +125,6 @@ __all__ = [
127 125 'ChatgptX',
128 126 'Cromicle',
129 127 'CodeLinkAva',
130 'DeepAi',
131 128 'DfeHub',
132 129 'EasyChat',
133 130 'Forefront',
Modified g4f/gui/client/html/index.html +0 -1
@@ -153,7 +153,6 @@
153 153 <option value="g4f.Provider.Myshell">Myshell</option>
154 154 <option value="g4f.Provider.FreeGpt">FreeGpt</option>
155 155 <option value="g4f.Provider.Vercel">Vercel</option>
156 <option value="g4f.Provider.DeepAi">DeepAi</option>
157 156 <option value="g4f.Provider.Aichat">Aichat</option>
158 157 <option value="g4f.Provider.GPTalk">GPTalk</option>
159 158 <option value="g4f.Provider.GptGod">GptGod</option>
Modified g4f/models.py +2 -3
@@ -16,7 +16,6 @@ from .Provider import (
16 16 Myshell,
17 17 FreeGpt,
18 18 Vercel,
19 DeepAi,
20 19 Aichat,
21 20 GPTalk,
22 21 GptGod,
@@ -45,7 +44,7 @@ default = Model(
45 44 Yqcloud, # Answers short questions in chinese
46 45 ChatBase, # Don't want to answer creatively
47 46 ChatgptDuo, # Include search results
48 Aibn, Aichat, ChatgptAi, ChatgptLogin, DeepAi, FreeGpt, GptGo, Myshell, Ylokh,
47 Aibn, Aichat, ChatgptAi, ChatgptLogin, FreeGpt, GptGo, Myshell, Ylokh,
49 48 ])
50 49 )
51 50
@@ -65,7 +64,7 @@ gpt_35_turbo = Model(
65 64 name = 'gpt-3.5-turbo',
66 65 base_provider = 'openai',
67 66 best_provider = RetryProvider([
68 DeepAi, Aivvm, ChatgptLogin, ChatgptAi, GptGo, AItianhu, Aichat, AItianhuSpace, Myshell, Aibn, FreeGpt, Ylokh
67 Aivvm, ChatgptLogin, ChatgptAi, GptGo, AItianhu, Aichat, AItianhuSpace, Myshell, Aibn, FreeGpt, Ylokh
69 68 ])
70 69 )
71 70