diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index dc94ba7..61224f8 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -501,9 +501,9 @@ "gemini_cli_oauth_title": "Gemini CLI OAuth", "gemini_cli_oauth_button": "Start Gemini CLI Login", "gemini_cli_oauth_hint": "Login to Google Gemini CLI service through OAuth flow, automatically obtain and save authentication files.", - "gemini_cli_project_id_label": "Google Cloud Project ID:", - "gemini_cli_project_id_placeholder": "Enter Google Cloud Project ID", - "gemini_cli_project_id_hint": "Project ID is required for Gemini CLI OAuth.", + "gemini_cli_project_id_label": "Google Cloud Project ID (Optional):", + "gemini_cli_project_id_placeholder": "Leave blank to auto-select first available project", + "gemini_cli_project_id_hint": "Optional. If not provided, the system will automatically select the first available project from your account.", "gemini_cli_project_id_required": "Please enter a Google Cloud project ID.", "gemini_cli_oauth_url_label": "Authorization URL:", "gemini_cli_open_link": "Open Link", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 84ad6d8..b84e8d0 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -501,9 +501,9 @@ "gemini_cli_oauth_title": "Gemini CLI OAuth", "gemini_cli_oauth_button": "开始 Gemini CLI 登录", "gemini_cli_oauth_hint": "通过 OAuth 流程登录 Google Gemini CLI 服务,自动获取并保存认证文件。", - "gemini_cli_project_id_label": "Google Cloud 项目 ID:", - "gemini_cli_project_id_placeholder": "输入 Google Cloud 项目 ID", - "gemini_cli_project_id_hint": "请填写项目 ID,用于 Gemini CLI OAuth 登录。", + "gemini_cli_project_id_label": "Google Cloud 项目 ID (可选):", + "gemini_cli_project_id_placeholder": "留空将自动选择第一个可用项目", + "gemini_cli_project_id_hint": "可选填写项目 ID。如不填写,系统将自动选择您账号下的第一个可用项目。", "gemini_cli_project_id_required": "请填写 Google Cloud 项目 ID。", "gemini_cli_oauth_url_label": "授权链接:", "gemini_cli_open_link": "打开链接", diff --git a/src/pages/OAuthPage.tsx b/src/pages/OAuthPage.tsx index 9e35a58..124d336 100644 --- a/src/pages/OAuthPage.tsx +++ b/src/pages/OAuthPage.tsx @@ -131,12 +131,7 @@ export function OAuthPage() { const startAuth = async (provider: OAuthProvider) => { const projectId = provider === 'gemini-cli' ? (states[provider]?.projectId || '').trim() : undefined; - if (provider === 'gemini-cli' && !projectId) { - const message = t('auth_login.gemini_cli_project_id_required'); - updateProviderState(provider, { projectIdError: message }); - showNotification(message, 'warning'); - return; - } + // 项目 ID 现在是可选的,如果不输入将自动选择第一个可用项目 if (provider === 'gemini-cli') { updateProviderState(provider, { projectIdError: undefined }); } @@ -151,7 +146,7 @@ export function OAuthPage() { try { const res = await oauthApi.startAuth( provider, - provider === 'gemini-cli' ? { projectId: projectId! } : undefined + provider === 'gemini-cli' ? { projectId: projectId || undefined } : undefined ); updateProviderState(provider, { url: res.url, state: res.state, status: 'waiting', polling: true }); if (res.state) {