mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Improve user identity header handling in Copilot provider by conditionally including it based on access token presence.
This commit is contained in:
parent
76a1bb754c
commit
aff4e12784
1 changed files with 2 additions and 2 deletions
|
|
@ -156,7 +156,7 @@ class Copilot(AsyncAuthedProvider, ProviderModelMixin):
|
|||
else:
|
||||
debug.log(f"Copilot: User: {user}")
|
||||
if conversation is None:
|
||||
response = await session.post(cls.conversation_url, headers={"x-useridentitytype": useridentitytype})
|
||||
response = await session.post(cls.conversation_url, headers={"x-useridentitytype": useridentitytype} if cls._access_token else {})
|
||||
response.raise_for_status()
|
||||
conversation_id = response.json().get("id")
|
||||
conversation = Conversation(conversation_id)
|
||||
|
|
@ -178,7 +178,7 @@ class Copilot(AsyncAuthedProvider, ProviderModelMixin):
|
|||
headers={
|
||||
"content-type": is_accepted_format(data),
|
||||
"content-length": str(len(data)),
|
||||
"x-useridentitytype": useridentitytype
|
||||
**({"x-useridentitytype": useridentitytype} if cls._access_token else {})
|
||||
},
|
||||
data=data
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue