From 1dba6b5bf95735ccd51533937be7582e0d591592 Mon Sep 17 00:00:00 2001 From: chanx <1243304602@qq.com> Date: Tue, 18 Nov 2025 09:39:02 +0800 Subject: [PATCH 1/3] Fix: Fixed an issue where adding session variables multiple times would overwrite them. (#11308) ### What problem does this PR solve? Fix: Fixed an issue where adding session variables multiple times would overwrite them. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- .../gobal-variable-sheet/hooks/use-form.tsx | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx b/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx index cb38012f3..54d37957a 100644 --- a/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx +++ b/web/src/pages/agent/gobal-variable-sheet/hooks/use-form.tsx @@ -15,27 +15,30 @@ export const useHandleForm = () => { return value; } }; - const handleSubmit = useCallback(async (fieldValue: FieldValues) => { - const param = { - ...(data.dsl?.variables || {}), - [fieldValue.name]: { - ...fieldValue, - value: - fieldValue.type === TypesWithArray.Object || - fieldValue.type === TypesWithArray.ArrayObject - ? handleObjectData(fieldValue.value) - : fieldValue.value, - }, - } as Record; + const handleSubmit = useCallback( + async (fieldValue: FieldValues) => { + const param = { + ...(data.dsl?.variables || {}), + [fieldValue.name]: { + ...fieldValue, + value: + fieldValue.type === TypesWithArray.Object || + fieldValue.type === TypesWithArray.ArrayObject + ? handleObjectData(fieldValue.value) + : fieldValue.value, + }, + } as Record; - const res = await saveGraph(undefined, { - globalVariables: param, - }); + const res = await saveGraph(undefined, { + globalVariables: param, + }); - if (res.code === 0) { - refetch(); - } - }, []); + if (res.code === 0) { + refetch(); + } + }, + [data.dsl?.variables, refetch, saveGraph], + ); return { handleSubmit, loading }; }; From 89e8818dda92b8aef24e9ad1b50cbe07f429852e Mon Sep 17 00:00:00 2001 From: Jonah Hartmann Date: Tue, 18 Nov 2025 02:39:25 +0100 Subject: [PATCH 2/3] Feat: add s3-compatible storage boxes (#11313) ### What problem does this PR solve? PR for implementing s3 compatible storage units #11240 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- common/data_source/blob_connector.py | 7 ++++++ common/data_source/config.py | 2 ++ common/data_source/utils.py | 7 ++++++ web/src/components/dynamic-form.tsx | 22 ++++++++++++++----- web/src/locales/en.ts | 2 ++ .../user-setting/data-source/contant.tsx | 13 +++++++++++ 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/common/data_source/blob_connector.py b/common/data_source/blob_connector.py index 0bec7cbe6..9e74a5394 100644 --- a/common/data_source/blob_connector.py +++ b/common/data_source/blob_connector.py @@ -87,6 +87,13 @@ class BlobStorageConnector(LoadConnector, PollConnector): ): raise ConnectorMissingCredentialError("Oracle Cloud Infrastructure") + elif self.bucket_type == BlobType.S3_COMPATIBLE: + if not all( + credentials.get(key) + for key in ["endpoint_url", "aws_access_key_id", "aws_secret_access_key"] + ): + raise ConnectorMissingCredentialError("S3 Compatible Storage") + else: raise ValueError(f"Unsupported bucket type: {self.bucket_type}") diff --git a/common/data_source/config.py b/common/data_source/config.py index e4040f85e..6cd497527 100644 --- a/common/data_source/config.py +++ b/common/data_source/config.py @@ -32,6 +32,7 @@ class BlobType(str, Enum): R2 = "r2" GOOGLE_CLOUD_STORAGE = "google_cloud_storage" OCI_STORAGE = "oci_storage" + S3_COMPATIBLE = "s3_compatible" class DocumentSource(str, Enum): @@ -47,6 +48,7 @@ class DocumentSource(str, Enum): GOOGLE_DRIVE = "google_drive" GMAIL = "gmail" DISCORD = "discord" + S3_COMPATIBLE = "s3_compatible" class FileOrigin(str, Enum): diff --git a/common/data_source/utils.py b/common/data_source/utils.py index b42c3833b..c079b2b9a 100644 --- a/common/data_source/utils.py +++ b/common/data_source/utils.py @@ -311,6 +311,13 @@ def create_s3_client(bucket_type: BlobType, credentials: dict[str, Any], europea aws_secret_access_key=credentials["secret_access_key"], region_name=credentials["region"], ) + elif bucket_type == BlobType.S3_COMPATIBLE: + return boto3.client( + "s3", + endpoint_url=credentials["endpoint_url"], + aws_access_key_id=credentials["aws_access_key_id"], + aws_secret_access_key=credentials["aws_secret_access_key"], + ) else: raise ValueError(f"Unsupported bucket type: {bucket_type}") diff --git a/web/src/components/dynamic-form.tsx b/web/src/components/dynamic-form.tsx index a90afe287..5c78a1dcb 100644 --- a/web/src/components/dynamic-form.tsx +++ b/web/src/components/dynamic-form.tsx @@ -67,6 +67,7 @@ export interface FormFieldConfig { ) => string | boolean | Promise; dependencies?: string[]; schema?: ZodSchema; + shouldRender?: (formValues: any) => boolean; } // Component props interface @@ -654,6 +655,9 @@ const DynamicForm = { } }; + // Watch all form values to re-render when they change (for shouldRender checks) + const formValues = form.watch(); + return (
<> - {fields.map((field) => ( -
- {renderField(field)} -
- ))} + {fields.map((field) => { + const shouldShow = field.shouldRender + ? field.shouldRender(formValues) + : true; + return ( +
+ {renderField(field)} +
+ ); + })} {children}
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 350a64db8..47a8b8351 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -705,6 +705,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s 'The base URL of your Confluence instance (e.g., https://your-domain.atlassian.net/wiki)', s3PrefixTip: `Specify the folder path within your S3 bucket to fetch files from. Example: general/v2/`, + S3CompatibleEndpointUrlTip: `Required for S3 compatible Storage Box. Specify the S3-compatible endpoint URL. +Example: https://fsn1.your-objectstorage.com`, addDataSourceModalTital: 'Create your {{name}} connector', deleteSourceModalTitle: 'Delete data source', deleteSourceModalContent: ` diff --git a/web/src/pages/user-setting/data-source/contant.tsx b/web/src/pages/user-setting/data-source/contant.tsx index 3c8c55826..65788464c 100644 --- a/web/src/pages/user-setting/data-source/contant.tsx +++ b/web/src/pages/user-setting/data-source/contant.tsx @@ -105,9 +105,21 @@ export const DataSourceFormFields = { { label: 'R2', value: 'r2' }, { label: 'Google Cloud Storage', value: 'google_cloud_storage' }, { label: 'OCI Storage', value: 'oci_storage' }, + { label: 'S3 Compatible', value: 's3_compatible' }, ], required: true, }, + { + label: 'Endpoint URL', + name: 'config.credentials.endpoint_url', + type: FormFieldType.Text, + required: false, + placeholder: 'https://fsn1.your-objectstorage.com', + tooltip: t('setting.S3CompatibleEndpointUrlTip'), + shouldRender: (formValues) => { + return formValues?.config?.bucket_type === 's3_compatible'; + }, + }, { label: 'Prefix', name: 'config.prefix', @@ -483,6 +495,7 @@ export const DataSourceFormDefaultValues = { credentials: { aws_access_key_id: '', aws_secret_access_key: '', + endpoint_url: '', }, }, }, From 912b6b023e999ca725fb55bd4e181bd65742aa7e Mon Sep 17 00:00:00 2001 From: buua436 <66937541+buua436@users.noreply.github.com> Date: Tue, 18 Nov 2025 09:39:45 +0800 Subject: [PATCH 3/3] fix: update check_embedding failed info (#11321) ### What problem does this PR solve? change: update check_embedding failed info ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/kb_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index f173b56a0..53e42303f 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -918,6 +918,6 @@ def check_embedding(): } if summary["avg_cos_sim"] > 0.9: return get_json_result(data={"summary": summary, "results": results}) - return get_json_result(code=RetCode.NOT_EFFECTIVE, message="failed", data={"summary": summary, "results": results}) + return get_json_result(code=RetCode.NOT_EFFECTIVE, message="Embedding model switch failed: the average similarity between old and new vectors is below 0.9, indicating incompatible vector spaces.", data={"summary": summary, "results": results})