mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-03 14:27:32 +08:00
fix(setting-model): support field-level autoComplete to suppress browser autofill (#17559)
This commit is contained in:
@@ -32,6 +32,7 @@ export const GenericApiKeyConfig: ProviderConfig = {
|
||||
required: true,
|
||||
placeholder: 'instanceNameMessage',
|
||||
tooltip: 'instanceNameTip',
|
||||
autoComplete: 'new-password',
|
||||
validation: { message: 'instanceNameMessage' },
|
||||
},
|
||||
{
|
||||
@@ -40,6 +41,7 @@ export const GenericApiKeyConfig: ProviderConfig = {
|
||||
type: FormFieldType.Password,
|
||||
required: true,
|
||||
placeholder: 'apiKeyMessage',
|
||||
autoComplete: 'new-password',
|
||||
validation: { message: 'apiKeyMessage' },
|
||||
},
|
||||
{
|
||||
@@ -64,6 +66,7 @@ export const GenericApiKeyConfig: ProviderConfig = {
|
||||
return 'openaiBaseUrlPlaceholder';
|
||||
},
|
||||
shouldRender: 'showBaseUrl',
|
||||
autoComplete: 'new-password',
|
||||
},
|
||||
{
|
||||
name: 'group_id',
|
||||
@@ -71,6 +74,7 @@ export const GenericApiKeyConfig: ProviderConfig = {
|
||||
type: FormFieldType.Text,
|
||||
required: false,
|
||||
shouldRender: 'showGroupId',
|
||||
autoComplete: 'new-password',
|
||||
},
|
||||
],
|
||||
verifyTransform: (values) => ({
|
||||
|
||||
@@ -209,6 +209,7 @@ export const useProviderFields = ({
|
||||
value: o.value,
|
||||
})) as any,
|
||||
defaultValue: field.defaultValue,
|
||||
autoComplete: field.autoComplete,
|
||||
validation,
|
||||
shouldRender: resolveShouldRender(field.shouldRender),
|
||||
// In viewMode, only the model-related fields are editable.
|
||||
@@ -245,7 +246,11 @@ export const useProviderFields = ({
|
||||
placeholder={placeholderText}
|
||||
/>
|
||||
) : (
|
||||
<Input {...fieldProps} placeholder={placeholderText} />
|
||||
<Input
|
||||
{...fieldProps}
|
||||
placeholder={placeholderText}
|
||||
autoComplete={field.autoComplete}
|
||||
/>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -85,6 +85,12 @@ export interface FieldConfig {
|
||||
options?: SelectOption[];
|
||||
/** Default value */
|
||||
defaultValue?: any;
|
||||
/**
|
||||
* HTML `autocomplete` attribute forwarded to the underlying `<input>`.
|
||||
* Use `'new-password'` to suppress browser autofill (Chrome ignores
|
||||
* `'off'` on forms containing a password field).
|
||||
*/
|
||||
autoComplete?: string;
|
||||
/**
|
||||
* Validation rules.
|
||||
* `message` is treated as an i18n key by the ProviderModal and translated
|
||||
|
||||
Reference in New Issue
Block a user