summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/ChatBase.py
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-09-12 00:47:03 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-09-12 00:47:03 +0200
commitd6382a2145e7e1c90b3795e3116e3c574e787868 (patch)
tree52e10e6314c9b9643ac91171dce58d5273cca575 /g4f/Provider/ChatBase.py
parent~ | 0.0.2.8 (diff)
downloadgpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar.gz
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar.bz2
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar.lz
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar.xz
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.tar.zst
gpt4free-d6382a2145e7e1c90b3795e3116e3c574e787868.zip
Diffstat (limited to 'g4f/Provider/ChatBase.py')
-rw-r--r--g4f/Provider/ChatBase.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/g4f/Provider/ChatBase.py b/g4f/Provider/ChatBase.py
index 7d73fd2f..b98fe565 100644
--- a/g4f/Provider/ChatBase.py
+++ b/g4f/Provider/ChatBase.py
@@ -21,8 +21,10 @@ class ChatBase(AsyncGeneratorProvider):
) -> AsyncGenerator:
if model == "gpt-4":
chat_id = "quran---tafseer-saadi-pdf-wbgknt7zn"
- elif model == "gpt-3.5-turbo" or True:
+ elif model == "gpt-3.5-turbo" or not model:
chat_id = "chatbase--1--pdf-p680fxvnm"
+ else:
+ raise ValueError(f"Model are not supported: {model}")
headers = {
"User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
"Accept" : "*/*",
@@ -45,9 +47,7 @@ class ChatBase(AsyncGeneratorProvider):
async with session.post("https://www.chatbase.co/api/fe/chat", json=data) as response:
response.raise_for_status()
async for stream in response.content.iter_any():
- stream = stream.decode()
- if stream:
- yield stream
+ yield stream.decode()
@classmethod