feat: require API key for non-official Claude providers
- Add required asterisk to API key input label for non-official providers - Pre-fill API key placeholder when switching to custom mode - Ensure consistent validation across Claude and Codex providers
This commit is contained in:
@@ -303,7 +303,7 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
|
|||||||
const customTemplate = {
|
const customTemplate = {
|
||||||
env: {
|
env: {
|
||||||
ANTHROPIC_BASE_URL: "https://your-api-endpoint.com",
|
ANTHROPIC_BASE_URL: "https://your-api-endpoint.com",
|
||||||
ANTHROPIC_AUTH_TOKEN: "your-api-key-here",
|
ANTHROPIC_AUTH_TOKEN: "sk-your-api-key-here",
|
||||||
// 可选配置
|
// 可选配置
|
||||||
// ANTHROPIC_MODEL: "your-model-name",
|
// ANTHROPIC_MODEL: "your-model-name",
|
||||||
// ANTHROPIC_SMALL_FAST_MODEL: "your-fast-model-name"
|
// ANTHROPIC_SMALL_FAST_MODEL: "your-fast-model-name"
|
||||||
@@ -315,7 +315,7 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
|
|||||||
websiteUrl: "",
|
websiteUrl: "",
|
||||||
settingsConfig: JSON.stringify(customTemplate, null, 2),
|
settingsConfig: JSON.stringify(customTemplate, null, 2),
|
||||||
});
|
});
|
||||||
setApiKey("");
|
setApiKey("sk-your-api-key-here");
|
||||||
setDisableCoAuthored(false);
|
setDisableCoAuthored(false);
|
||||||
setClaudeModel("");
|
setClaudeModel("");
|
||||||
setClaudeSmallFastModel("");
|
setClaudeSmallFastModel("");
|
||||||
@@ -630,6 +630,7 @@ const ProviderForm: React.FC<ProviderFormProps> = ({
|
|||||||
<ApiKeyInput
|
<ApiKeyInput
|
||||||
value={apiKey}
|
value={apiKey}
|
||||||
onChange={handleApiKeyChange}
|
onChange={handleApiKeyChange}
|
||||||
|
required={!isOfficialPreset}
|
||||||
placeholder={
|
placeholder={
|
||||||
isOfficialPreset
|
isOfficialPreset
|
||||||
? "官方登录无需填写 API Key,直接保存即可"
|
? "官方登录无需填写 API Key,直接保存即可"
|
||||||
|
|||||||
Reference in New Issue
Block a user