FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
30.21k stars 15.61k forks source link

[FEATURE] support endpoint config for s3 #2718

Closed NiuBlibing closed 2 months ago

NiuBlibing commented 3 months ago

Describe the feature you'd like Support endpoint config for s3, so we can use s3 compatiable service like minio, aliyun oss,etc.

HenryHengZJ commented 3 months ago

which endpoint config? currently we support S3 for storage - https://docs.flowiseai.com/configuration/environment-variables#for-storage

NiuBlibing commented 3 months ago

which endpoint config? currently we support S3 for storage - https://docs.flowiseai.com/configuration/environment-variables#for-storage

https://github.com/aws/aws-sdk-js-v3/blob/44475422c0c87ac92cba77d6a27d07e5e15c6281/supplemental-docs/CLIENTS.md?plain=1#L154-L174 The above endpoint config. @HenryHengZJ

NiuBlibing commented 3 months ago

If we can set this endpoint, it will be directly able to support s3 compatiable services like mino, aliyun oss,etc.

NiuBlibing commented 3 months ago
diff --git a/packages/components/src/storageUtils.ts b/packages/components/src/storageUtils.ts
index 483eb9ae..44f2244b 100644
--- a/packages/components/src/storageUtils.ts
+++ b/packages/components/src/storageUtils.ts
@@ -318,6 +318,7 @@ export const getS3Config = () => {
     const secretAccessKey = process.env.S3_STORAGE_SECRET_ACCESS_KEY
     const region = process.env.S3_STORAGE_REGION
     const Bucket = process.env.S3_STORAGE_BUCKET_NAME
+    const endpoint = process.env.S3_ENDPOINT
     if (!region || !Bucket) {
         throw new Error('S3 storage configuration is missing')
     }
@@ -332,7 +333,8 @@ export const getS3Config = () => {

     const s3Client = new S3Client({
         credentials,
-        region
+        region,
+        endpoint: endpoint
     })
     return { s3Client, Bucket }
 }

I write a demo patch(I'm not familar with ts), could you help to commit it?

HenryHengZJ commented 2 months ago

added PR - https://github.com/FlowiseAI/Flowise/pull/2891

HenryHengZJ commented 2 months ago

PR merged, will be pushed to next release!