fix qwen url (#217)

This commit is contained in:
paisley
2026-02-28 11:38:04 +08:00
committed by GitHub
Unverified
parent d63810f54b
commit 270bc1e402

View File

@@ -223,9 +223,19 @@ class DeviceOAuthManager extends EventEmitter {
let baseUrl = token.resourceUrl || defaultBaseUrl;
// Ensure baseUrl has a protocol prefix
if (baseUrl && !baseUrl.startsWith('http://') && !baseUrl.startsWith('https://')) {
baseUrl = 'https://' + baseUrl;
}
// Ensure the base URL ends with /anthropic
if (providerType.startsWith('minimax-portal') && baseUrl) {
baseUrl = baseUrl.replace(/\/v1$/, '').replace(/\/anthropic$/, '').replace(/\/$/, '') + '/anthropic';
} else if (providerType === 'qwen-portal' && baseUrl) {
// Ensure Qwen API gets /v1 at the end
if (!baseUrl.endsWith('/v1')) {
baseUrl = baseUrl.replace(/\/$/, '') + '/v1';
}
}
try {