XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Update (g4f/Provider/GizAI.py)

2a29f1b2
kqlio67 <kqlio67@users.noreply.github.com>
提交于

代码差异

1 个文件 +11 -6
Modified g4f/Provider/GizAI.py +11 -6
@@ -8,7 +8,7 @@ from .helper import format_prompt
8 8
9 9
10 10 class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
11 url = "https://app.giz.ai"
11 url = "https://app.giz.ai/assistant"
12 12 api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer"
13 13 working = True
14 14 supports_stream = False
@@ -46,7 +46,7 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
46 46 'Connection': 'keep-alive',
47 47 'Content-Type': 'application/json',
48 48 'DNT': '1',
49 'Origin': cls.url,
49 'Origin': 'https://app.giz.ai',
50 50 'Pragma': 'no-cache',
51 51 'Sec-Fetch-Dest': 'empty',
52 52 'Sec-Fetch-Mode': 'cors',
@@ -56,16 +56,21 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin):
56 56 'sec-ch-ua-mobile': '?0',
57 57 'sec-ch-ua-platform': '"Linux"'
58 58 }
59
60 prompt = format_prompt(messages)
61
59 62 async with ClientSession(headers=headers) as session:
60 63 data = {
61 64 "model": model,
62 65 "input": {
63 "messages": messages,
66 "messages": [{"type": "human", "content": prompt}],
64 67 "mode": "plan"
65 68 },
66 69 "noStream": True
67 70 }
68 71 async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
69 response.raise_for_status()
70 result = await response.json()
71 yield result['output'].strip()
72 if response.status == 201:
73 result = await response.json()
74 yield result['output'].strip()
75 else:
76 raise Exception(f"Unexpected response status: {response.status}")