mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 12:40:44 +00:00
fix(auth): validate Coding Plan API key prefix for China region
- Add validation to check API key starts with "sk-sp-" for China region - Add Chinese translation for the validation error message - Only apply prefix validation when region is aliyun.com (China) This prevents users from submitting invalid API keys for the China region, providing immediate feedback with a localized error message. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
112318d092
commit
fa5bd26b68
2 changed files with 14 additions and 0 deletions
|
|
@ -49,6 +49,18 @@ export function ApiKeyInput({
|
|||
setError(t('API key cannot be empty.'));
|
||||
return;
|
||||
}
|
||||
// Only validate sk-sp- prefix for China region (aliyun.com)
|
||||
if (
|
||||
region === CodingPlanRegion.CHINA &&
|
||||
!trimmedKey.startsWith('sk-sp-')
|
||||
) {
|
||||
setError(
|
||||
t(
|
||||
'Invalid API key. Coding Plan API keys start with "sk-sp-". Please check.',
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
onSubmit(trimmedKey);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue