summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider')
-rw-r--r--g4f/Provider/ChatBase.py7
-rw-r--r--g4f/Provider/MyShell.py1
-rw-r--r--g4f/Provider/deprecated/GetGpt.py5
3 files changed, 12 insertions, 1 deletions
diff --git a/g4f/Provider/ChatBase.py b/g4f/Provider/ChatBase.py
index 0ba511f7..d59717c0 100644
--- a/g4f/Provider/ChatBase.py
+++ b/g4f/Provider/ChatBase.py
@@ -11,6 +11,8 @@ class ChatBase(AsyncGeneratorProvider):
supports_gpt_35_turbo = True
supports_message_history = True
working = True
+ list_incorrect_responses = ["Hmm, I am not sure. Email support@chatbase.co for more info.",
+ "I can only provide support and information about Chatbase"]
@classmethod
async def create_async_generator(
@@ -42,7 +44,12 @@ class ChatBase(AsyncGeneratorProvider):
async with session.post("https://www.chatbase.co/api/fe/chat", json=data, proxy=proxy) as response:
response.raise_for_status()
+ response_data = ""
async for stream in response.content.iter_any():
+ response_data += stream.decode()
+ for incorrect_response in cls.list_incorrect_responses:
+ if incorrect_response in response_data:
+ raise RuntimeError("Incorrect response")
yield stream.decode()
@classmethod
diff --git a/g4f/Provider/MyShell.py b/g4f/Provider/MyShell.py
index fe8604bb..176585ed 100644
--- a/g4f/Provider/MyShell.py
+++ b/g4f/Provider/MyShell.py
@@ -9,6 +9,7 @@ from .helper import format_prompt
class MyShell(AsyncGeneratorProvider):
url = "https://app.myshell.ai/chat"
+ working = True
@classmethod
async def create_async_generator(
diff --git a/g4f/Provider/deprecated/GetGpt.py b/g4f/Provider/deprecated/GetGpt.py
index a5de1d29..0fbb5b87 100644
--- a/g4f/Provider/deprecated/GetGpt.py
+++ b/g4f/Provider/deprecated/GetGpt.py
@@ -5,7 +5,10 @@ import os
import uuid
import requests
-from Crypto.Cipher import AES
+try:
+ from Crypto.Cipher import AES
+except ImportError:
+ from Cryptodome.Cipher import AES
from ...typing import Any, CreateResult
from ..base_provider import BaseProvider