From 3c2ee171cb1e379b21f8ce2f47b3aad111406d7f Mon Sep 17 00:00:00 2001 From: langcaiye Date: Wed, 3 Jun 2026 19:11:23 +0800 Subject: [PATCH] fix: skip credential validation when editing data source --- .../settings/DataSourceEditorDialog.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/knowledge/settings/DataSourceEditorDialog.vue b/frontend/src/views/knowledge/settings/DataSourceEditorDialog.vue index 1ce90038..6f4b6ef1 100644 --- a/frontend/src/views/knowledge/settings/DataSourceEditorDialog.vue +++ b/frontend/src/views/knowledge/settings/DataSourceEditorDialog.vue @@ -311,12 +311,14 @@ function selectType(def: ConnectorDef) { // --- Test connection (stateless, no DB write) --- async function testConnection() { - const fields = currentDef.value?.fields || [] - for (const f of fields) { - if (f.optional) continue - if (!form.value.config.credentials[f.key]) { - MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`) - return + if (!isEdit.value || !credentialsConfigured.value || replaceCredentialsMode.value) { + const fields = currentDef.value?.fields || [] + for (const f of fields) { + if (f.optional) continue + if (!form.value.config.credentials[f.key]) { + MessagePlugin.warning(`${t(f.labelKey)} ${t('datasource.isRequired')}`) + return + } } } @@ -441,6 +443,10 @@ function toggleResource(id: string) { } function validateStep1Fields(): boolean { + if (isEdit.value && credentialsConfigured.value && !replaceCredentialsMode.value) { + return true + } + const fields = currentDef.value?.fields || [] for (const f of fields) { if (f.optional) continue