mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-12 08:29:30 -04:00
commit
f04e415bec
@ -8,7 +8,7 @@ class AiAsk(AsyncGeneratorProvider):
|
|||||||
url = "https://e.aiask.me"
|
url = "https://e.aiask.me"
|
||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
working = True
|
working = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create_async_generator(
|
async def create_async_generator(
|
||||||
|
@ -8,8 +8,8 @@ from .helper import get_cookies
|
|||||||
from ..requests import StreamSession
|
from ..requests import StreamSession
|
||||||
|
|
||||||
class Aichat(AsyncProvider):
|
class Aichat(AsyncProvider):
|
||||||
url = "https://chat-gpt.org/chat"
|
url = "https://chat-gpt.org/chat"
|
||||||
working = True
|
working = False
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1,42 +1,44 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import re
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
from ..typing import AsyncResult, Messages
|
from ..typing import Messages
|
||||||
from .base_provider import AsyncGeneratorProvider
|
from .base_provider import AsyncProvider
|
||||||
|
from .helper import format_prompt
|
||||||
|
|
||||||
|
class Chatgpt4Online(AsyncProvider):
|
||||||
class Chatgpt4Online(AsyncGeneratorProvider):
|
|
||||||
url = "https://chatgpt4online.org"
|
url = "https://chatgpt4online.org"
|
||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
working = False
|
working = True
|
||||||
|
_wpnonce = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create_async_generator(
|
async def create_async(
|
||||||
cls,
|
cls,
|
||||||
model: str,
|
model: str,
|
||||||
messages: Messages,
|
messages: Messages,
|
||||||
proxy: str = None,
|
proxy: str = None,
|
||||||
**kwargs
|
**kwargs
|
||||||
) -> AsyncResult:
|
) -> str:
|
||||||
async with ClientSession() as session:
|
async with ClientSession() as session:
|
||||||
|
if not cls._wpnonce:
|
||||||
|
async with session.get(f"{cls.url}/", proxy=proxy) as response:
|
||||||
|
response.raise_for_status()
|
||||||
|
response = await response.text()
|
||||||
|
if result := re.search(r'data-nonce="(.*?)"', response):
|
||||||
|
cls._wpnonce = result.group(1)
|
||||||
|
else:
|
||||||
|
raise RuntimeError("No nonce found")
|
||||||
data = {
|
data = {
|
||||||
"botId": "default",
|
"_wpnonce": cls._wpnonce,
|
||||||
"customId": None,
|
"post_id": 58,
|
||||||
"session": "N/A",
|
"url": "https://chatgpt4online.org",
|
||||||
"chatId": "",
|
"action": "wpaicg_chat_shortcode_message",
|
||||||
"contextId": 58,
|
"message": format_prompt(messages),
|
||||||
"messages": messages,
|
"bot_id": 3405
|
||||||
"newMessage": messages[-1]["content"],
|
|
||||||
"stream": True
|
|
||||||
}
|
}
|
||||||
|
async with session.post(f"{cls.url}/rizq", data=data, proxy=proxy) as response:
|
||||||
async with session.post(f"{cls.url}/wp-json/mwai-ui/v1/chats/submit", json=data, proxy=proxy) as response:
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
async for line in response.content:
|
return (await response.json())["data"]
|
||||||
if line.startswith(b"data: "):
|
|
||||||
line = json.loads(line[6:])
|
|
||||||
if line["type"] == "live":
|
|
||||||
yield line["data"]
|
|
@ -12,7 +12,7 @@ domains = [
|
|||||||
|
|
||||||
class FreeGpt(AsyncGeneratorProvider):
|
class FreeGpt(AsyncGeneratorProvider):
|
||||||
url = "https://freegpts1.aifree.site/"
|
url = "https://freegpts1.aifree.site/"
|
||||||
working = True
|
working = False
|
||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
supports_gpt_35_turbo = True
|
supports_gpt_35_turbo = True
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from .Acytoo import Acytoo
|
|
||||||
from .AiAsk import AiAsk
|
from .AiAsk import AiAsk
|
||||||
from .Aibn import Aibn
|
|
||||||
from .Aichat import Aichat
|
from .Aichat import Aichat
|
||||||
from .Ails import Ails
|
|
||||||
from .AItianhu import AItianhu
|
from .AItianhu import AItianhu
|
||||||
from .AItianhuSpace import AItianhuSpace
|
from .AItianhuSpace import AItianhuSpace
|
||||||
from .Berlin import Berlin
|
from .Berlin import Berlin
|
||||||
@ -13,11 +10,9 @@ from .ChatForAi import ChatForAi
|
|||||||
from .Chatgpt4Online import Chatgpt4Online
|
from .Chatgpt4Online import Chatgpt4Online
|
||||||
from .ChatgptAi import ChatgptAi
|
from .ChatgptAi import ChatgptAi
|
||||||
from .ChatgptDemo import ChatgptDemo
|
from .ChatgptDemo import ChatgptDemo
|
||||||
from .ChatgptDuo import ChatgptDuo
|
|
||||||
from .ChatgptFree import ChatgptFree
|
from .ChatgptFree import ChatgptFree
|
||||||
from .ChatgptLogin import ChatgptLogin
|
from .ChatgptLogin import ChatgptLogin
|
||||||
from .ChatgptX import ChatgptX
|
from .ChatgptX import ChatgptX
|
||||||
from .Cromicle import Cromicle
|
|
||||||
from .DeepInfra import DeepInfra
|
from .DeepInfra import DeepInfra
|
||||||
from .FakeGpt import FakeGpt
|
from .FakeGpt import FakeGpt
|
||||||
from .FreeGpt import FreeGpt
|
from .FreeGpt import FreeGpt
|
||||||
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
from ..typing import AsyncResult, Messages
|
from ...typing import AsyncResult, Messages
|
||||||
from .base_provider import AsyncGeneratorProvider
|
from ..base_provider import AsyncGeneratorProvider
|
||||||
|
|
||||||
|
|
||||||
class Acytoo(AsyncGeneratorProvider):
|
class Acytoo(AsyncGeneratorProvider):
|
@ -3,9 +3,9 @@ from __future__ import annotations
|
|||||||
import time
|
import time
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from ..typing import AsyncResult, Messages
|
from ...typing import AsyncResult, Messages
|
||||||
from ..requests import StreamSession
|
from ...requests import StreamSession
|
||||||
from .base_provider import AsyncGeneratorProvider
|
from ..base_provider import AsyncGeneratorProvider
|
||||||
|
|
||||||
|
|
||||||
class Aibn(AsyncGeneratorProvider):
|
class Aibn(AsyncGeneratorProvider):
|
@ -7,8 +7,8 @@ import json
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
from ..typing import SHA256, AsyncResult, Messages
|
from ...typing import SHA256, AsyncResult, Messages
|
||||||
from .base_provider import AsyncGeneratorProvider
|
from ..base_provider import AsyncGeneratorProvider
|
||||||
|
|
||||||
|
|
||||||
class Ails(AsyncGeneratorProvider):
|
class Ails(AsyncGeneratorProvider):
|
@ -1,8 +1,8 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from ..typing import Messages
|
from ...typing import Messages
|
||||||
from curl_cffi.requests import AsyncSession
|
from curl_cffi.requests import AsyncSession
|
||||||
from .base_provider import AsyncProvider, format_prompt
|
from ..base_provider import AsyncProvider, format_prompt
|
||||||
|
|
||||||
|
|
||||||
class ChatgptDuo(AsyncProvider):
|
class ChatgptDuo(AsyncProvider):
|
@ -2,10 +2,10 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from ..typing import AsyncResult, Messages, Dict
|
from ...typing import AsyncResult, Messages, Dict
|
||||||
|
|
||||||
from .base_provider import AsyncGeneratorProvider
|
from ..base_provider import AsyncGeneratorProvider
|
||||||
from .helper import format_prompt
|
from ..helper import format_prompt
|
||||||
|
|
||||||
|
|
||||||
class Cromicle(AsyncGeneratorProvider):
|
class Cromicle(AsyncGeneratorProvider):
|
@ -13,4 +13,9 @@ from .FastGpt import FastGpt
|
|||||||
from .Aivvm import Aivvm
|
from .Aivvm import Aivvm
|
||||||
from .Vitalentum import Vitalentum
|
from .Vitalentum import Vitalentum
|
||||||
from .H2o import H2o
|
from .H2o import H2o
|
||||||
from .Myshell import Myshell
|
from .Myshell import Myshell
|
||||||
|
from .Acytoo import Acytoo
|
||||||
|
from .Aibn import Aibn
|
||||||
|
from .Ails import Ails
|
||||||
|
from .ChatgptDuo import ChatgptDuo
|
||||||
|
from .Cromicle import Cromicle
|
@ -15,10 +15,8 @@ from .Provider import (
|
|||||||
Berlin,
|
Berlin,
|
||||||
Llama2,
|
Llama2,
|
||||||
Vercel,
|
Vercel,
|
||||||
Aichat,
|
|
||||||
GPTalk,
|
GPTalk,
|
||||||
Koala,
|
Koala,
|
||||||
AiAsk,
|
|
||||||
GptGo,
|
GptGo,
|
||||||
Phind,
|
Phind,
|
||||||
Bard,
|
Bard,
|
||||||
@ -42,7 +40,7 @@ default = Model(
|
|||||||
base_provider = "",
|
base_provider = "",
|
||||||
best_provider = RetryProvider([
|
best_provider = RetryProvider([
|
||||||
Bing, # Not fully GPT 3 or 4
|
Bing, # Not fully GPT 3 or 4
|
||||||
AiAsk, Aichat, ChatgptAi, FreeGpt, GptGo, GeekGpt,
|
ChatgptAi, GptGo, GeekGpt,
|
||||||
Phind, You
|
Phind, You
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user