diff options
author | Ryan Jordan <ryjordan@gmail.com> | 2023-09-06 02:39:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-06 02:39:57 +0200 |
commit | f81e618958318a092ca4c70a1b3ea15260bda97c (patch) | |
tree | 3ce022a8d719011268da7f1a0befc97bf32a60d8 /g4f/Provider/DeepAi.py | |
parent | feat(docker): add Docker and Docker Compose support (diff) | |
parent | ~ | Merge pull request #869 from ahobsonsayers/add-console-script (diff) | |
download | gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.gz gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.bz2 gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.lz gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.xz gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.tar.zst gpt4free-f81e618958318a092ca4c70a1b3ea15260bda97c.zip |
Diffstat (limited to 'g4f/Provider/DeepAi.py')
-rw-r--r-- | g4f/Provider/DeepAi.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/g4f/Provider/DeepAi.py b/g4f/Provider/DeepAi.py index 01dc426d..feba6b41 100644 --- a/g4f/Provider/DeepAi.py +++ b/g4f/Provider/DeepAi.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import json import js2py @@ -8,19 +10,17 @@ from .base_provider import BaseProvider class DeepAi(BaseProvider): - url = "https://deepai.org" - working = True - supports_stream = True + url: str = "https://deepai.org" + working = True + supports_stream = True supports_gpt_35_turbo = True @staticmethod def create_completion( model: str, messages: list[dict[str, str]], - stream: bool, - **kwargs: Any, - ) -> CreateResult: - url = "https://api.deepai.org/make_me_a_pizza" + stream: bool, **kwargs: Any) -> CreateResult: + token_js = """ var 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' 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; @@ -54,7 +54,9 @@ f = function () { "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", } - response = requests.post(url, headers=headers, data=payload, stream=True) + response = requests.post("https://api.deepai.org/make_me_a_pizza", + headers=headers, data=payload, stream=True) + for chunk in response.iter_content(chunk_size=None): response.raise_for_status() yield chunk.decode() |