fix(ai): prevent Edge/password-manager autofill and save prompts in AI settings (#2719)

* fix(ai): prevent password autofill in AI settings

* fix(ai): avoid password manager prompts for API key fields

* fix(ai): disable autocomplete for AI settings inputs

* update code style

---------

Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
This commit is contained in:
Yeung
2026-02-24 17:43:49 +08:00
committed by GitHub
parent 299d6d4878
commit e9fa161148
+27 -8
View File
@@ -113,11 +113,11 @@ function AIForm() {
return (
<div className="grid gap-6 sm:grid-cols-2">
<div className="flex flex-col gap-y-2">
<Label htmlFor="provider">
<Label htmlFor="ai-provider">
<Trans>Provider</Trans>
</Label>
<Combobox
id="provider"
id="ai-provider"
value={provider}
disabled={enabled}
options={providerOptions}
@@ -126,43 +126,62 @@ function AIForm() {
</div>
<div className="flex flex-col gap-y-2">
<Label htmlFor="model">
<Label htmlFor="ai-model">
<Trans>Model</Trans>
</Label>
<Input
id="model"
id="ai-model"
name="ai-model"
type="text"
value={model}
disabled={enabled}
onChange={(e) => handleModelChange(e.target.value)}
placeholder="e.g., gpt-4, claude-3-opus, gemini-pro"
autoCorrect="off"
autoComplete="off"
spellCheck="false"
autoCapitalize="off"
/>
</div>
<div className="flex flex-col gap-y-2 sm:col-span-2">
<Label htmlFor="api-key">
<Label htmlFor="ai-api-key">
<Trans>API Key</Trans>
</Label>
<Input
id="api-key"
id="ai-api-key"
name="ai-api-key"
type="password"
value={apiKey}
disabled={enabled}
onChange={(e) => handleApiKeyChange(e.target.value)}
autoCorrect="off"
autoComplete="off"
spellCheck="false"
autoCapitalize="off"
// ignore password managers
data-lpignore="true"
data-bwignore="true"
data-1p-ignore="true"
/>
</div>
<div className="flex flex-col gap-y-2 sm:col-span-2">
<Label htmlFor="base-url">
<Label htmlFor="ai-base-url">
<Trans>Base URL (Optional)</Trans>
</Label>
<Input
id="base-url"
id="ai-base-url"
name="ai-base-url"
type="url"
value={baseURL}
disabled={enabled}
placeholder={selectedOption?.defaultBaseURL}
onChange={(e) => handleBaseURLChange(e.target.value)}
autoCorrect="off"
autoComplete="off"
spellCheck="false"
autoCapitalize="off"
/>
</div>