diff --git a/packages/cli/src/i18n/locales/de.js b/packages/cli/src/i18n/locales/de.js index 063af8715..a0510a200 100644 --- a/packages/cli/src/i18n/locales/de.js +++ b/packages/cli/src/i18n/locales/de.js @@ -1398,6 +1398,10 @@ export default { // ============================================================================ // Coding Plan Authentication // ============================================================================ + 'Please enter your API key:': 'Bitte geben Sie Ihren API-Schlüssel ein:', + 'API key cannot be empty.': 'API-Schlüssel darf nicht leer sein.', + 'You can get your exclusive Coding Plan API-KEY here:': + 'Hier können Sie Ihren exklusiven Coding Plan API-KEY erhalten:', 'New model configurations are available for Bailian Coding Plan. Update now?': 'Neue Modellkonfigurationen sind für Bailian Coding Plan verfügbar. Jetzt aktualisieren?', 'Coding Plan configuration updated successfully. New models are now available.': diff --git a/packages/cli/src/i18n/locales/en.js b/packages/cli/src/i18n/locales/en.js index ab03a9512..dfd37df5f 100644 --- a/packages/cli/src/i18n/locales/en.js +++ b/packages/cli/src/i18n/locales/en.js @@ -1373,6 +1373,8 @@ export default { // ============================================================================ 'Please enter your API key:': 'Please enter your API key:', 'API key cannot be empty.': 'API key cannot be empty.', + 'You can get your exclusive Coding Plan API-KEY here:': + 'You can get your exclusive Coding Plan API-KEY here:', 'API key is stored in settings.env. You can migrate it to a .env file for better security.': 'API key is stored in settings.env. You can migrate it to a .env file for better security.', 'New model configurations are available for Bailian Coding Plan. Update now?': diff --git a/packages/cli/src/i18n/locales/ja.js b/packages/cli/src/i18n/locales/ja.js index 348aabc88..99db86f73 100644 --- a/packages/cli/src/i18n/locales/ja.js +++ b/packages/cli/src/i18n/locales/ja.js @@ -909,6 +909,10 @@ export default { // ============================================================================ // Coding Plan Authentication // ============================================================================ + 'Please enter your API key:': 'APIキーを入力してください:', + 'API key cannot be empty.': 'APIキーは空にできません。', + 'You can get your exclusive Coding Plan API-KEY here:': + 'Coding Plan の API-KEY はこちらで取得できます:', 'New model configurations are available for Bailian Coding Plan. Update now?': 'Bailian Coding Plan の新しいモデル設定が利用可能です。今すぐ更新しますか?', 'Coding Plan configuration updated successfully. New models are now available.': diff --git a/packages/cli/src/i18n/locales/pt.js b/packages/cli/src/i18n/locales/pt.js index fb8aff23d..9f047aff2 100644 --- a/packages/cli/src/i18n/locales/pt.js +++ b/packages/cli/src/i18n/locales/pt.js @@ -1412,6 +1412,10 @@ export default { // ============================================================================ // Coding Plan Authentication // ============================================================================ + 'Please enter your API key:': 'Por favor, digite sua chave de API:', + 'API key cannot be empty.': 'A chave de API não pode estar vazia.', + 'You can get your exclusive Coding Plan API-KEY here:': + 'Você pode obter sua chave de API exclusiva do Coding Plan aqui:', 'New model configurations are available for Bailian Coding Plan. Update now?': 'Novas configurações de modelo estão disponíveis para o Bailian Coding Plan. Atualizar agora?', 'Coding Plan configuration updated successfully. New models are now available.': diff --git a/packages/cli/src/i18n/locales/ru.js b/packages/cli/src/i18n/locales/ru.js index 70c428197..3552eca4d 100644 --- a/packages/cli/src/i18n/locales/ru.js +++ b/packages/cli/src/i18n/locales/ru.js @@ -1402,6 +1402,10 @@ export default { // ============================================================================ // Coding Plan Authentication // ============================================================================ + 'Please enter your API key:': 'Пожалуйста, введите ваш API-ключ:', + 'API key cannot be empty.': 'API-ключ не может быть пустым.', + 'You can get your exclusive Coding Plan API-KEY here:': + 'Получите свой эксклюзивный API-KEY Coding Plan здесь:', 'New model configurations are available for Bailian Coding Plan. Update now?': 'Доступны новые конфигурации моделей для Bailian Coding Plan. Обновить сейчас?', 'Coding Plan configuration updated successfully. New models are now available.': diff --git a/packages/cli/src/i18n/locales/zh.js b/packages/cli/src/i18n/locales/zh.js index cb7b7a7f6..291235482 100644 --- a/packages/cli/src/i18n/locales/zh.js +++ b/packages/cli/src/i18n/locales/zh.js @@ -1208,6 +1208,8 @@ export default { // ============================================================================ 'Please enter your API key:': '请输入您的 API Key:', 'API key cannot be empty.': 'API Key 不能为空。', + 'You can get your exclusive Coding Plan API-KEY here:': + '您可以在这里获取专属的 Coding Plan API-KEY:', 'API key is stored in settings.env. You can migrate it to a .env file for better security.': 'API Key 已存储在 settings.env 中。您可以将其迁移到 .env 文件以获得更好的安全性。', 'New model configurations are available for Bailian Coding Plan. Update now?': diff --git a/packages/cli/src/ui/auth/AuthDialog.tsx b/packages/cli/src/ui/auth/AuthDialog.tsx index ff73cf204..2d4794d72 100644 --- a/packages/cli/src/ui/auth/AuthDialog.tsx +++ b/packages/cli/src/ui/auth/AuthDialog.tsx @@ -42,8 +42,11 @@ type ViewLevel = 'main' | 'api-key-sub' | 'api-key-input' | 'custom-info'; export function AuthDialog(): React.JSX.Element { const { pendingAuthType, authError } = useUIState(); - const { handleAuthSelect: onAuthSelect, handleCodingPlanSubmit } = - useUIActions(); + const { + handleAuthSelect: onAuthSelect, + handleCodingPlanSubmit, + onAuthError, + } = useUIActions(); const config = useConfig(); const [errorMessage, setErrorMessage] = useState(null); @@ -69,7 +72,7 @@ export function AuthDialog(): React.JSX.Element { const apiKeySubItems = [ { key: 'coding-plan', - label: t('Coding Plan'), + label: t('Coding Plan (Bailian)'), value: 'coding-plan' as ApiKeySubMode, }, { @@ -116,6 +119,7 @@ export function AuthDialog(): React.JSX.Element { value: (typeof mainItems)[number]['value'], ) => { setErrorMessage(null); + onAuthError(null); if (value === 'API-KEY') { // Navigate to API-KEY sub-mode selection @@ -129,6 +133,7 @@ export function AuthDialog(): React.JSX.Element { const handleApiKeySubSelect = async (subMode: ApiKeySubMode) => { setErrorMessage(null); + onAuthError(null); if (subMode === 'coding-plan') { setViewLevel('api-key-input'); @@ -151,6 +156,7 @@ export function AuthDialog(): React.JSX.Element { const handleGoBack = () => { setErrorMessage(null); + onAuthError(null); if (viewLevel === 'api-key-sub') { setViewLevel('main'); @@ -390,7 +396,9 @@ export function AuthDialog(): React.JSX.Element { - {'https://github.com/QwenLM/Qwen3-Coder/blob/main/README.md'} + { + 'https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/' + } diff --git a/packages/cli/src/ui/components/ApiKeyInput.tsx b/packages/cli/src/ui/components/ApiKeyInput.tsx index 0177f8791..f741e3fab 100644 --- a/packages/cli/src/ui/components/ApiKeyInput.tsx +++ b/packages/cli/src/ui/components/ApiKeyInput.tsx @@ -11,12 +11,16 @@ import { TextInput } from './shared/TextInput.js'; import { Colors } from '../colors.js'; import { useKeypress } from '../hooks/useKeypress.js'; import { t } from '../../i18n/index.js'; +import Link from 'ink-link'; interface ApiKeyInputProps { onSubmit: (apiKey: string) => void; onCancel: () => void; } +const CODING_PLAN_API_KEY_URL = + 'https://bailian.console.aliyun.com/?tab=model#/efm/coding_plan'; + export function ApiKeyInput({ onSubmit, onCancel, @@ -51,6 +55,16 @@ export function ApiKeyInput({ {error} )} + + {t('You can get your exclusive Coding Plan API-KEY here:')} + + + + + {CODING_PLAN_API_KEY_URL} + + + {t('(Press Enter to submit, Escape to cancel)')} diff --git a/packages/cli/src/ui/contexts/UIActionsContext.tsx b/packages/cli/src/ui/contexts/UIActionsContext.tsx index ed339e6fa..e4cb85003 100644 --- a/packages/cli/src/ui/contexts/UIActionsContext.tsx +++ b/packages/cli/src/ui/contexts/UIActionsContext.tsx @@ -42,7 +42,7 @@ export interface UIActions { ) => Promise; handleCodingPlanSubmit: (apiKey: string) => Promise; setAuthState: (state: AuthState) => void; - onAuthError: (error: string) => void; + onAuthError: (error: string | null) => void; cancelAuthentication: () => void; handleEditorSelect: ( editorType: EditorType | undefined,