diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2024-07-11 20:03:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 20:03:13 +0200 |
commit | 31edda55f75b85651998bc0a77f22e538accaa1f (patch) | |
tree | cfb769c3569449780c9edc5073eb47180e60655d /g4f/Provider/not_working | |
parent | Merge pull request #2097 from gamelist1990/main (diff) | |
parent | Update g4f/models.py (diff) | |
download | gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar.gz gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar.bz2 gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar.lz gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar.xz gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.tar.zst gpt4free-31edda55f75b85651998bc0a77f22e538accaa1f.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/not_working/Aichatos.py (renamed from g4f/Provider/Aichatos.py) | 8 | ||||
-rw-r--r-- | g4f/Provider/not_working/ChatForAi.py (renamed from g4f/Provider/ChatForAi.py) | 10 | ||||
-rw-r--r-- | g4f/Provider/not_working/ChatgptAi.py (renamed from g4f/Provider/ChatgptAi.py) | 12 | ||||
-rw-r--r-- | g4f/Provider/not_working/ChatgptNext.py (renamed from g4f/Provider/ChatgptNext.py) | 8 | ||||
-rw-r--r-- | g4f/Provider/not_working/ChatgptX.py (renamed from g4f/Provider/ChatgptX.py) | 10 | ||||
-rw-r--r-- | g4f/Provider/not_working/Cnote.py (renamed from g4f/Provider/Cnote.py) | 8 | ||||
-rw-r--r-- | g4f/Provider/not_working/Feedough.py | 78 | ||||
-rw-r--r-- | g4f/Provider/not_working/__init__.py | 9 |
8 files changed, 114 insertions, 29 deletions
diff --git a/g4f/Provider/Aichatos.py b/g4f/Provider/not_working/Aichatos.py index 1d4747d7..d651abf3 100644 --- a/g4f/Provider/Aichatos.py +++ b/g4f/Provider/not_working/Aichatos.py @@ -2,16 +2,16 @@ from __future__ import annotations from aiohttp import ClientSession -from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider -from .helper import format_prompt +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider +from ..helper import format_prompt import random class Aichatos(AsyncGeneratorProvider): url = "https://chat10.aichatos.xyz" api = "https://api.binjie.fun" - working = True + working = False supports_gpt_35_turbo = True @classmethod diff --git a/g4f/Provider/ChatForAi.py b/g4f/Provider/not_working/ChatForAi.py index 1c693955..b7f13c3d 100644 --- a/g4f/Provider/ChatForAi.py +++ b/g4f/Provider/not_working/ChatForAi.py @@ -4,14 +4,14 @@ import time import hashlib import uuid -from ..typing import AsyncResult, Messages -from ..requests import StreamSession, raise_for_status -from ..errors import RateLimitError -from .base_provider import AsyncGeneratorProvider, ProviderModelMixin +from ...typing import AsyncResult, Messages +from ...requests import StreamSession, raise_for_status +from ...errors import RateLimitError +from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin class ChatForAi(AsyncGeneratorProvider, ProviderModelMixin): url = "https://chatforai.store" - working = True + working = False default_model = "gpt-3.5-turbo" supports_message_history = True supports_gpt_35_turbo = True diff --git a/g4f/Provider/ChatgptAi.py b/g4f/Provider/not_working/ChatgptAi.py index d15140d7..5c694549 100644 --- a/g4f/Provider/ChatgptAi.py +++ b/g4f/Provider/not_working/ChatgptAi.py @@ -3,14 +3,14 @@ from __future__ import annotations import re, html, json, string, random from aiohttp import ClientSession -from ..typing import Messages, AsyncResult -from ..errors import RateLimitError -from .base_provider import AsyncGeneratorProvider -from .helper import get_random_string +from ...typing import Messages, AsyncResult +from ...errors import RateLimitError +from ..base_provider import AsyncGeneratorProvider +from ..helper import get_random_string class ChatgptAi(AsyncGeneratorProvider): url = "https://chatgpt.ai" - working = True + working = False supports_message_history = True supports_system_message = True, supports_gpt_4 = True, @@ -85,4 +85,4 @@ class ChatgptAi(AsyncGeneratorProvider): if line["type"] == "live": yield line["data"] elif line["type"] == "end": - break
\ No newline at end of file + break diff --git a/g4f/Provider/ChatgptNext.py b/g4f/Provider/not_working/ChatgptNext.py index 2d6f7487..1c15dd67 100644 --- a/g4f/Provider/ChatgptNext.py +++ b/g4f/Provider/not_working/ChatgptNext.py @@ -3,12 +3,12 @@ from __future__ import annotations import json from aiohttp import ClientSession -from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider class ChatgptNext(AsyncGeneratorProvider): url = "https://www.chatgpt-free.cc" - working = True + working = False supports_gpt_35_turbo = True supports_message_history = True supports_system_message = True @@ -63,4 +63,4 @@ class ChatgptNext(AsyncGeneratorProvider): if chunk.startswith(b"data: "): content = json.loads(chunk[6:])["choices"][0]["delta"].get("content") if content: - yield content
\ No newline at end of file + yield content diff --git a/g4f/Provider/ChatgptX.py b/g4f/Provider/not_working/ChatgptX.py index 9be0d89b..760333d9 100644 --- a/g4f/Provider/ChatgptX.py +++ b/g4f/Provider/not_working/ChatgptX.py @@ -4,15 +4,15 @@ import re import json from aiohttp import ClientSession -from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider -from .helper import format_prompt -from ..errors import RateLimitError +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider +from ..helper import format_prompt +from ...errors import RateLimitError class ChatgptX(AsyncGeneratorProvider): url = "https://chatgptx.de" supports_gpt_35_turbo = True - working = True + working = False @classmethod async def create_async_generator( diff --git a/g4f/Provider/Cnote.py b/g4f/Provider/not_working/Cnote.py index 7d4018bb..48626982 100644 --- a/g4f/Provider/Cnote.py +++ b/g4f/Provider/not_working/Cnote.py @@ -3,15 +3,15 @@ from __future__ import annotations import json from aiohttp import ClientSession -from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider -from .helper import format_prompt +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider +from ..helper import format_prompt class Cnote(AsyncGeneratorProvider): url = "https://f1.cnote.top" api_url = "https://p1api.xjai.pro/freeapi/chat-process" - working = True + working = False supports_gpt_35_turbo = True @classmethod diff --git a/g4f/Provider/not_working/Feedough.py b/g4f/Provider/not_working/Feedough.py new file mode 100644 index 00000000..24c33d14 --- /dev/null +++ b/g4f/Provider/not_working/Feedough.py @@ -0,0 +1,78 @@ +from __future__ import annotations + +import json +import asyncio +from aiohttp import ClientSession, TCPConnector +from urllib.parse import urlencode + +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin +from ..helper import format_prompt + + +class Feedough(AsyncGeneratorProvider, ProviderModelMixin): + url = "https://www.feedough.com" + api_endpoint = "/wp-admin/admin-ajax.php" + working = False + default_model = '' + + @classmethod + async def create_async_generator( + cls, + model: str, + messages: Messages, + proxy: str = None, + **kwargs + ) -> AsyncResult: + headers = { + "accept": "*/*", + "accept-language": "en-US,en;q=0.9", + "content-type": "application/x-www-form-urlencoded;charset=UTF-8", + "dnt": "1", + "origin": cls.url, + "referer": f"{cls.url}/ai-prompt-generator/", + "sec-ch-ua": '"Not/A)Brand";v="8", "Chromium";v="126"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Linux"', + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-origin", + "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" + } + + connector = TCPConnector(ssl=False) + + async with ClientSession(headers=headers, connector=connector) as session: + data = { + "action": "aixg_generate", + "prompt": format_prompt(messages), + "aixg_generate_nonce": "110c021031" + } + + try: + async with session.post( + f"{cls.url}{cls.api_endpoint}", + data=urlencode(data), + proxy=proxy + ) as response: + response.raise_for_status() + response_text = await response.text() + try: + response_json = json.loads(response_text) + if response_json.get("success") and "data" in response_json: + message = response_json["data"].get("message", "") + yield message + except json.JSONDecodeError: + yield response_text + except Exception as e: + print(f"An error occurred: {e}") + + @classmethod + async def run(cls, *args, **kwargs): + async for item in cls.create_async_generator(*args, **kwargs): + yield item + + tasks = asyncio.all_tasks() + for task in tasks: + if not task.done(): + await task diff --git a/g4f/Provider/not_working/__init__.py b/g4f/Provider/not_working/__init__.py index 4778c968..c4c9a5a1 100644 --- a/g4f/Provider/not_working/__init__.py +++ b/g4f/Provider/not_working/__init__.py @@ -1,14 +1,21 @@ from .AItianhu import AItianhu +from .Aichatos import Aichatos from .Bestim import Bestim from .ChatBase import ChatBase +from .ChatForAi import ChatForAi +from .ChatgptAi import ChatgptAi from .ChatgptDemo import ChatgptDemo from .ChatgptDemoAi import ChatgptDemoAi from .ChatgptLogin import ChatgptLogin +from .ChatgptNext import ChatgptNext +from .ChatgptX import ChatgptX from .Chatxyz import Chatxyz +from .Cnote import Cnote +from .Feedough import Feedough from .Gpt6 import Gpt6 from .GptChatly import GptChatly from .GptForLove import GptForLove from .GptGo import GptGo from .GptGod import GptGod -from .OnlineGpt import OnlineGpt
\ No newline at end of file +from .OnlineGpt import OnlineGpt |