From 270bc1e402b6cec6aca332db7846e298a62a990b Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Sat, 28 Feb 2026 11:38:04 +0800 Subject: [PATCH] fix qwen url (#217) --- electron/utils/device-oauth.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/electron/utils/device-oauth.ts b/electron/utils/device-oauth.ts index e4a4c407a..213be03ae 100644 --- a/electron/utils/device-oauth.ts +++ b/electron/utils/device-oauth.ts @@ -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 {