Skip to content

Commit 479ff95

Browse files
awsl233777番外个体
andauthored
fix: hide api key when provider is excluded from export (#423)
* fix: hide api key for excluded providers * fix: separate export exclusion from error cooldown * fix: collapse edit form grid without api key * fix: show api key placeholder for excluded providers * fix: keep api key editable for excluded providers --------- Co-authored-by: 番外个体 <misaka-worst@openclaw.local>
1 parent c5b1eec commit 479ff95

File tree

4 files changed

+34
-27
lines changed

4 files changed

+34
-27
lines changed

web/src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@
11961196
"apiEndpoint": "API Endpoint",
11971197
"apiKey": "API Key",
11981198
"apiKeyEdit": "API Key (leave empty to keep current)",
1199+
"apiKeyExcludedHint": "This provider is excluded from export and backup. You can still rotate the API key here; it just won't be included in exported files or backup packages.",
11991200
"optionalUrlNote": "Optional if client-specific URLs are set below.",
12001201
"namePlaceholder": "e.g. Production OpenAI",
12011202
"endpointPlaceholder": "https://api.openai.com/v1",

web/src/locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,7 @@
11961196
"apiEndpoint": "API 端点",
11971197
"apiKey": "API 密钥",
11981198
"apiKeyEdit": "API 密钥(留空保持当前值)",
1199+
"apiKeyExcludedHint": "该提供商已设置为“从导出与备份中排除”。您仍可在这里轮换 API 密钥,只是它不会被写入导出文件或系统备份。",
11991200
"optionalUrlNote": "如果下面设置了客户端特定的 URL,则此项为可选。",
12001201
"namePlaceholder": "例如:Production OpenAI",
12011202
"endpointPlaceholder": "https://api.openai.com/v1",

web/src/pages/providers/components/custom-config-step.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -225,36 +225,36 @@ export function CustomConfigStep() {
225225
<h3 className="text-lg font-semibold text-text-primary border-b border-border pb-2">
226226
{t('provider.errorCooldownTitle')}
227227
</h3>
228-
<div className="space-y-4">
229-
<div className="flex items-center justify-between p-4 bg-card border border-border rounded-xl">
230-
<div className="pr-4">
231-
<div className="text-sm font-medium text-foreground">
232-
{t('provider.disableErrorCooldown')}
233-
</div>
234-
<p className="text-xs text-muted-foreground mt-1">
235-
{t('provider.disableErrorCooldownDesc')}
236-
</p>
228+
<div className="flex items-center justify-between p-4 bg-card border border-border rounded-xl">
229+
<div className="pr-4">
230+
<div className="text-sm font-medium text-foreground">
231+
{t('provider.disableErrorCooldown')}
237232
</div>
238-
<Switch
239-
checked={!!formData.disableErrorCooldown}
240-
onCheckedChange={(checked) => updateFormData({ disableErrorCooldown: checked })}
241-
/>
233+
<p className="text-xs text-muted-foreground mt-1">
234+
{t('provider.disableErrorCooldownDesc')}
235+
</p>
242236
</div>
237+
<Switch
238+
checked={!!formData.disableErrorCooldown}
239+
onCheckedChange={(checked) => updateFormData({ disableErrorCooldown: checked })}
240+
/>
241+
</div>
242+
</div>
243243

244-
<div className="flex items-center justify-between p-4 bg-card border border-border rounded-xl">
245-
<div className="pr-4">
246-
<div className="text-sm font-medium text-foreground">
247-
{t('provider.excludeFromExport')}
248-
</div>
249-
<p className="text-xs text-muted-foreground mt-1">
250-
{t('provider.excludeFromExportDesc')}
251-
</p>
252-
</div>
253-
<Switch
254-
checked={!!formData.excludeFromExport}
255-
onCheckedChange={(checked) => updateFormData({ excludeFromExport: checked })}
256-
/>
244+
<div className="space-y-6">
245+
<h3 className="text-lg font-semibold text-text-primary border-b border-border pb-2">
246+
{t('provider.excludeFromExport')}
247+
</h3>
248+
<div className="flex items-center justify-between p-4 bg-card border border-border rounded-xl">
249+
<div className="pr-4">
250+
<p className="text-xs text-muted-foreground mt-1">
251+
{t('provider.excludeFromExportDesc')}
252+
</p>
257253
</div>
254+
<Switch
255+
checked={!!formData.excludeFromExport}
256+
onCheckedChange={(checked) => updateFormData({ excludeFromExport: checked })}
257+
/>
258258
</div>
259259
</div>
260260

web/src/pages/providers/components/provider-edit-flow.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,16 @@ export function ProviderEditFlow({ provider, onClose }: ProviderEditFlowProps) {
677677
type="button"
678678
onClick={() => setShowApiKey(!showApiKey)}
679679
className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors"
680-
tabIndex={-1}
680+
aria-label={showApiKey ? t('common.hide') : t('common.show')}
681681
>
682682
{showApiKey ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
683683
</button>
684684
</div>
685+
{provider.excludeFromExport && (
686+
<div className="mt-2 p-3 bg-muted/50 border border-border rounded-lg text-xs text-muted-foreground">
687+
{t('provider.apiKeyExcludedHint')}
688+
</div>
689+
)}
685690
</div>
686691
</div>
687692
</div>

0 commit comments

Comments
 (0)