diff options
author | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-11 20:18:50 +0100 |
---|---|---|
committer | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-11 20:18:50 +0100 |
commit | 2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0 (patch) | |
tree | de5694cbfa1f7f50da1b6a493ae53ee8f97f1a6e /g4f/Provider/GizAI.py | |
parent | fix(g4f/Provider/HuggingChat.py): update conversation data request parameter (diff) | |
download | gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar.gz gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar.bz2 gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar.lz gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar.xz gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.tar.zst gpt4free-2a29f1b2ac7a3bd3ac40682a4e11908e576e1af0.zip |
Diffstat (limited to 'g4f/Provider/GizAI.py')
-rw-r--r-- | g4f/Provider/GizAI.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/g4f/Provider/GizAI.py b/g4f/Provider/GizAI.py index a5ce0ec2..f00b344e 100644 --- a/g4f/Provider/GizAI.py +++ b/g4f/Provider/GizAI.py @@ -8,7 +8,7 @@ from .helper import format_prompt class GizAI(AsyncGeneratorProvider, ProviderModelMixin): - url = "https://app.giz.ai" + url = "https://app.giz.ai/assistant" api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer" working = True supports_stream = False @@ -46,7 +46,7 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin): 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'DNT': '1', - 'Origin': cls.url, + 'Origin': 'https://app.giz.ai', 'Pragma': 'no-cache', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', @@ -56,16 +56,21 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin): 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Linux"' } + + prompt = format_prompt(messages) + async with ClientSession(headers=headers) as session: data = { "model": model, "input": { - "messages": messages, + "messages": [{"type": "human", "content": prompt}], "mode": "plan" }, "noStream": True } async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response: - response.raise_for_status() - result = await response.json() - yield result['output'].strip() + if response.status == 201: + result = await response.json() + yield result['output'].strip() + else: + raise Exception(f"Unexpected response status: {response.status}") |