summaryrefslogtreecommitdiffstats
path: root/g4f/Provider
diff options
context:
space:
mode:
authorzukixa <56563509+zukixa@users.noreply.github.com>2024-08-13 15:26:17 +0200
committerzukixa <56563509+zukixa@users.noreply.github.com>2024-08-13 15:26:17 +0200
commit08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4 (patch)
tree6849b1aff21d95487d01f439460aa5e891728dab /g4f/Provider
parentMerge pull request #2135 from repsac-by/update-perplexity-labs (diff)
downloadgpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar.gz
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar.bz2
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar.lz
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar.xz
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.tar.zst
gpt4free-08d1c0531007e1d21e92c8fb6dfec5a2cde9b1b4.zip
Diffstat (limited to 'g4f/Provider')
-rw-r--r--g4f/Provider/Chatgpt4Online.py10
-rw-r--r--g4f/Provider/FlowGpt.py4
-rw-r--r--g4f/Provider/MagickPenAsk.py3
3 files changed, 12 insertions, 5 deletions
diff --git a/g4f/Provider/Chatgpt4Online.py b/g4f/Provider/Chatgpt4Online.py
index d55be65b..f62ef8af 100644
--- a/g4f/Provider/Chatgpt4Online.py
+++ b/g4f/Provider/Chatgpt4Online.py
@@ -13,7 +13,12 @@ class Chatgpt4Online(AsyncGeneratorProvider):
api_endpoint = "/wp-json/mwai-ui/v1/chats/submit"
working = True
supports_gpt_4 = True
-
+
+ async def get_nonce():
+ async with ClientSession() as session:
+ async with session.post(f"https://chatgpt4online.org/wp-json/mwai/v1/start_session") as response:
+ return (await response.json())["restNonce"]
+
@classmethod
async def create_async_generator(
cls,
@@ -37,7 +42,7 @@ class Chatgpt4Online(AsyncGeneratorProvider):
"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",
- "x-wp-nonce": "d9505e9877",
+ "x-wp-nonce": await cls.get_nonce(),
}
async with ClientSession(headers=headers) as session:
@@ -69,3 +74,4 @@ class Chatgpt4Online(AsyncGeneratorProvider):
continue
yield full_response
+
diff --git a/g4f/Provider/FlowGpt.py b/g4f/Provider/FlowGpt.py
index 6c2aa046..d823a7ab 100644
--- a/g4f/Provider/FlowGpt.py
+++ b/g4f/Provider/FlowGpt.py
@@ -30,7 +30,7 @@ class FlowGpt(AsyncGeneratorProvider, ProviderModelMixin):
"pygmalion-13b",
"chronos-hermes-13b",
"Mixtral-8x7B",
- "Dolphin-2.6-8x7B"
+ "Dolphin-2.6-8x7B",
]
model_aliases = {
"gemini": "google-gemini",
@@ -91,7 +91,7 @@ class FlowGpt(AsyncGeneratorProvider, ProviderModelMixin):
"generateImage": False,
"generateAudio": False
}
- async with session.post("https://backend-k8s.flowgpt.com/v2/chat-anonymous-encrypted", json=data, proxy=proxy) as response:
+ async with session.post("https://prod-backend-k8s.flowgpt.com/v3/chat-anonymous", json=data, proxy=proxy) as response:
await raise_for_status(response)
async for chunk in response.content:
if chunk.strip():
diff --git a/g4f/Provider/MagickPenAsk.py b/g4f/Provider/MagickPenAsk.py
index 54058228..8b7473d8 100644
--- a/g4f/Provider/MagickPenAsk.py
+++ b/g4f/Provider/MagickPenAsk.py
@@ -36,7 +36,8 @@ class MagickPenAsk(AsyncGeneratorProvider, ProviderModelMixin):
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
- "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
+ "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
+ 'X-API-Secret': 'WCASR6ZQJYM85DVDX7'
}
async with ClientSession(headers=headers) as session:
data = {