diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-12 02:06:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 02:06:06 +0100 |
commit | 6ef282de3a3245acbfecd08ae48dba85ff91d031 (patch) | |
tree | 0236c9678eea8f9c78ed7c09f3d86eaf3d7c691c /g4f/Provider/not_working/GptChatly.py | |
parent | Update .gitignore (diff) | |
download | gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.gz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.bz2 gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.lz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.xz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.zst gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.zip |
Diffstat (limited to 'g4f/Provider/not_working/GptChatly.py')
-rw-r--r-- | g4f/Provider/not_working/GptChatly.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/g4f/Provider/not_working/GptChatly.py b/g4f/Provider/not_working/GptChatly.py new file mode 100644 index 00000000..a1e3dd74 --- /dev/null +++ b/g4f/Provider/not_working/GptChatly.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from ...requests import Session, get_session_from_browser +from ...typing import Messages +from ..base_provider import AsyncProvider + + +class GptChatly(AsyncProvider): + url = "https://gptchatly.com" + working = False + supports_message_history = True + supports_gpt_35_turbo = True + + @classmethod + async def create_async( + cls, + model: str, + messages: Messages, + proxy: str = None, + timeout: int = 120, + session: Session = None, + **kwargs + ) -> str: + if not session: + session = get_session_from_browser(cls.url, proxy=proxy, timeout=timeout) + if model.startswith("gpt-4"): + chat_url = f"{cls.url}/fetch-gpt4-response" + else: + chat_url = f"{cls.url}/felch-response" + data = { + "past_conversations": messages + } + response = session.post(chat_url, json=data) + response.raise_for_status() + return response.json()["chatGPTResponse"]
\ No newline at end of file |