mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 13:52:09 +03:00
Merge pull request #923 from GGGO076/fix/github-copilot-v2
fix: GitHub Copilot token refresh failure and reasoning field stripping
This commit is contained in:
@@ -55,6 +55,19 @@ export class GithubExecutor extends BaseExecutor {
|
||||
);
|
||||
delete modifiedBody.response_format;
|
||||
}
|
||||
|
||||
// Strip reasoning_text / reasoning_content from assistant messages.
|
||||
// GitHub Copilot converts these into Anthropic thinking blocks but cannot
|
||||
// supply a valid `signature`, causing upstream 400 errors.
|
||||
if (Array.isArray(modifiedBody.messages)) {
|
||||
for (const msg of modifiedBody.messages) {
|
||||
if (msg.role === "assistant") {
|
||||
delete msg.reasoning_text;
|
||||
delete msg.reasoning_content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return modifiedBody;
|
||||
}
|
||||
|
||||
@@ -167,6 +180,10 @@ export class GithubExecutor extends BaseExecutor {
|
||||
...githubTokens,
|
||||
copilotToken: copilotResult.token,
|
||||
copilotTokenExpiresAt: copilotResult.expiresAt,
|
||||
providerSpecificData: {
|
||||
copilotToken: copilotResult.token,
|
||||
copilotTokenExpiresAt: copilotResult.expiresAt,
|
||||
},
|
||||
};
|
||||
}
|
||||
return githubTokens;
|
||||
@@ -179,6 +196,10 @@ export class GithubExecutor extends BaseExecutor {
|
||||
refreshToken: credentials.refreshToken,
|
||||
copilotToken: copilotResult.token,
|
||||
copilotTokenExpiresAt: copilotResult.expiresAt,
|
||||
providerSpecificData: {
|
||||
copilotToken: copilotResult.token,
|
||||
copilotTokenExpiresAt: copilotResult.expiresAt,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ export async function checkAndRefreshToken(provider: string, credentials: any) {
|
||||
copilotToken: copilotToken.token,
|
||||
copilotTokenExpiresAt: copilotToken.expiresAt,
|
||||
};
|
||||
// Sync to top-level so buildHeaders() picks up the fresh token
|
||||
updatedCredentials.copilotToken = copilotToken.token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user