返回提交历史
Modified
g4f/Provider/Copilot.py
+2
-2
XFEstudio/gpt4free
Improve user identity header handling in Copilot provider by conditionally including it based on access token presence.
aff4e127
代码差异
1 个文件
+2
-2
@@ -156,7 +156,7 @@ class Copilot(AsyncAuthedProvider, ProviderModelMixin):
156
156
else:
157
157
debug.log(f"Copilot: User: {user}")
158
158
if conversation is None:
159
response = await session.post(cls.conversation_url, headers={"x-useridentitytype": useridentitytype})
159
response = await session.post(cls.conversation_url, headers={"x-useridentitytype": useridentitytype} if cls._access_token else {})
160
160
response.raise_for_status()
161
161
conversation_id = response.json().get("id")
162
162
conversation = Conversation(conversation_id)
@@ -178,7 +178,7 @@ class Copilot(AsyncAuthedProvider, ProviderModelMixin):
178
178
headers={
179
179
"content-type": is_accepted_format(data),
180
180
"content-length": str(len(data)),
181
"x-useridentitytype": useridentitytype
181
**({"x-useridentitytype": useridentitytype} if cls._access_token else {})
182
182
},
183
183
data=data
184
184
)