feat(cli): add Coding Plan Global/Intl region support

Add support for Coding Plan international region with separate base URL:
- Add CodingPlanRegion enum (CHINA, GLOBAL) for region management
- Add CODING_PLAN_INTL_MODELS template with intl base URL
- Add version storage for both regions (codingPlan.version/versionIntl)
- Update AuthDialog to show both region options
- Update useCodingPlanUpdates to handle region-specific updates
- Add i18n translations for all supported languages
- Fix and update unit tests

Users can now choose between:
- Coding Plan (Bailian, China) - https://coding.dashscope.aliyuncs.com/v1
- Coding Plan (Bailian, Global/Intl) - https://coding-intl.dashscope.aliyuncs.com/v1

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mingholy.lmh 2026-02-17 20:19:21 +08:00 committed by qwen-code-ci-bot
parent a0a0a70b12
commit 39360dc058
13 changed files with 684 additions and 219 deletions

View file

@ -17,6 +17,7 @@ import { useUIState } from '../contexts/UIStateContext.js';
import { useUIActions } from '../contexts/UIActionsContext.js';
import { useConfig } from '../contexts/ConfigContext.js';
import { t } from '../../i18n/index.js';
import { CodingPlanRegion } from '../../constants/codingPlan.js';
const MODEL_PROVIDERS_DOCUMENTATION_URL =
'https://qwenlm.github.io/qwen-code-docs/en/users/configuration/settings/#modelproviders';
@ -34,7 +35,7 @@ function parseDefaultAuthType(
}
// Sub-mode types for API-KEY authentication
type ApiKeySubMode = 'coding-plan' | 'custom';
type ApiKeySubMode = 'coding-plan' | 'coding-plan-intl' | 'custom';
// View level for navigation
type ViewLevel = 'main' | 'api-key-sub' | 'api-key-input' | 'custom-info';
@ -52,6 +53,9 @@ export function AuthDialog(): React.JSX.Element {
const [selectedIndex, setSelectedIndex] = useState<number | null>(null);
const [viewLevel, setViewLevel] = useState<ViewLevel>('main');
const [apiKeySubModeIndex, setApiKeySubModeIndex] = useState<number>(0);
const [region, setRegion] = useState<CodingPlanRegion>(
CodingPlanRegion.CHINA,
);
// Main authentication entries
const mainItems = [
@ -71,9 +75,14 @@ export function AuthDialog(): React.JSX.Element {
const apiKeySubItems = [
{
key: 'coding-plan',
label: t('Coding Plan (Bailian)'),
label: t('Coding Plan (Bailian, China)'),
value: 'coding-plan' as ApiKeySubMode,
},
{
key: 'coding-plan-intl',
label: t('Coding Plan (Bailian, Global/Intl)'),
value: 'coding-plan-intl' as ApiKeySubMode,
},
{
key: 'custom',
label: t('Custom'),
@ -135,6 +144,10 @@ export function AuthDialog(): React.JSX.Element {
onAuthError(null);
if (subMode === 'coding-plan') {
setRegion(CodingPlanRegion.CHINA);
setViewLevel('api-key-input');
} else if (subMode === 'coding-plan-intl') {
setRegion(CodingPlanRegion.GLOBAL);
setViewLevel('api-key-input');
} else {
setViewLevel('custom-info');
@ -149,8 +162,8 @@ export function AuthDialog(): React.JSX.Element {
return;
}
// Submit to parent for processing
await handleCodingPlanSubmit(apiKey);
// Submit to parent for processing with region info
await handleCodingPlanSubmit(apiKey, region);
};
const handleGoBack = () => {
@ -264,7 +277,11 @@ export function AuthDialog(): React.JSX.Element {
// Render API key input for coding-plan mode
const renderApiKeyInputView = () => (
<Box marginTop={1}>
<ApiKeyInput onSubmit={handleApiKeyInputSubmit} onCancel={handleGoBack} />
<ApiKeyInput
onSubmit={handleApiKeyInputSubmit}
onCancel={handleGoBack}
region={region}
/>
</Box>
);