From 99faf7d058de0c7e0d01b784c77c80d8c1afeac8 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Sat, 27 Dec 2025 10:47:50 +0400 Subject: [PATCH] fix: account for basePath in getOAuthBaseUrl --- lib/services/qwen-oauth.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/services/qwen-oauth.ts b/lib/services/qwen-oauth.ts index 0bc5800..15bfbc3 100644 --- a/lib/services/qwen-oauth.ts +++ b/lib/services/qwen-oauth.ts @@ -4,13 +4,19 @@ const DEFAULT_QWEN_ENDPOINT = "https://dashscope-intl.aliyuncs.com/compatible-mo const TOKEN_STORAGE_KEY = "promptarch-qwen-tokens"; function getOAuthBaseUrl(): string { + const basePath = '/tools/promptarch'; if (typeof window !== "undefined") { - return `${window.location.origin}/api/qwen`; + const origin = window.location.origin; + return `${origin}${basePath}/api/qwen`; } if (process.env.NEXT_PUBLIC_SITE_URL) { - return `${process.env.NEXT_PUBLIC_SITE_URL}/api/qwen`; + const siteUrl = process.env.NEXT_PUBLIC_SITE_URL.replace(/\/$/, ""); + if (siteUrl.endsWith(basePath)) { + return `${siteUrl}/api/qwen`; + } + return `${siteUrl}${basePath}/api/qwen`; } - return "/api/qwen"; + return `${basePath}/api/qwen`; } export interface QwenOAuthConfig {