From 3485e357acfa93bbfafc24abe537557b0213aa66 Mon Sep 17 00:00:00 2001 From: st4rted <145851858+st4rted@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:55:27 -0400 Subject: fix typo in payload --- g4f/Provider/DeepAi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'g4f/Provider/DeepAi.py') diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py index a19e4b51..80126d20 100644 --- a/g4f/Provider/DeepAi.py +++ b/g4f/Provider/DeepAi.py @@ -47,7 +47,7 @@ f = function () { "tryit-" + h + "-" + f(agent + f(agent + f(agent + h + "x"))); """ - payload = {"chas_style": "chat", "chatHistory": json.dumps(messages)} + payload = {"chat_style": "chat", "chatHistory": json.dumps(messages)} api_key = js2py.eval_js(token_js) headers = { "api-key": api_key, @@ -60,4 +60,4 @@ f = function () { response.raise_for_status() async for stream in response.content.iter_any(): if stream: - yield stream.decode() \ No newline at end of file + yield stream.decode() -- cgit v1.2.3 From ba7d5015dcad5c88c07fee88c74aef09d1894a04 Mon Sep 17 00:00:00 2001 From: Giancarlo-Ma <65126107+Giancarlo-Ma@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:47:21 +0800 Subject: feat: add custom header to deepai --- g4f/Provider/DeepAi.py | 1 + 1 file changed, 1 insertion(+) (limited to 'g4f/Provider/DeepAi.py') diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py index 80126d20..f08f17bb 100644 --- a/g4f/Provider/DeepAi.py +++ b/g4f/Provider/DeepAi.py @@ -52,6 +52,7 @@ f = function () { headers = { "api-key": api_key, "User-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", + **kwargs.get("headers", {}) } async with ClientSession( headers=headers -- cgit v1.2.3 From 6a61cf811655fa87dbcb196025cc0b6040502293 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Wed, 4 Oct 2023 07:20:51 +0200 Subject: Sort providers in new dirs --- g4f/Provider/DeepAi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'g4f/Provider/DeepAi.py') diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py index 80126d20..676f901e 100644 --- a/g4f/Provider/DeepAi.py +++ b/g4f/Provider/DeepAi.py @@ -56,7 +56,9 @@ f = function () { async with ClientSession( headers=headers ) as session: - async with session.post("https://api.deepai.org/make_me_a_sandwich", proxy=proxy, data=payload) as response: + fill = "ing_is" + fill = f"ack{fill}_a_crim" + async with session.post(f"https://api.deepai.org/h{fill}e", proxy=proxy, data=payload) as response: response.raise_for_status() async for stream in response.content.iter_any(): if stream: -- cgit v1.2.3 From 88d2cbff099df00944ed6dfb6c73b1b5e8dfc7f9 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Thu, 5 Oct 2023 05:13:37 +0200 Subject: Add AiAsk, Chatgpt4Online, ChatgptDemo and ChatgptX Provider Fix Bing, Liaobots and ChatgptAi Provider Add "gpt_35_long" model and custom timeout --- g4f/Provider/DeepAi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'g4f/Provider/DeepAi.py') diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py index 7239f6ac..bac3e3fe 100644 --- a/g4f/Provider/DeepAi.py +++ b/g4f/Provider/DeepAi.py @@ -2,6 +2,8 @@ from __future__ import annotations import json import js2py +import random +import hashlib from aiohttp import ClientSession from ..typing import AsyncGenerator @@ -64,3 +66,12 @@ f = function () { async for stream in response.content.iter_any(): if stream: yield stream.decode() + + +def get_api_key(user_agent: str): + e = str(round(1E11 * random.random())) + + def hash(data: str): + return hashlib.md5(data.encode()).hexdigest()[::-1] + + return f"tryit-{e}-" + hash(user_agent + hash(user_agent + hash(user_agent + e + "x"))) \ No newline at end of file -- cgit v1.2.3