feat: migrate to fastgpt storage sdk#324
Conversation
5a9130f to
2adb9ae
Compare
|
✅ Build Successful - Preview Images for this PR: Changed packages: |
8c43628 to
3520ec3
Compare
There was a problem hiding this comment.
Pull request overview
This PR migrates the codebase from a custom MinIO-based S3 implementation to the @fastgpt-sdk/storage SDK, which provides unified support for multiple cloud storage vendors including MinIO, AWS S3, Alibaba Cloud OSS, and Tencent Cloud COS.
Key Changes:
- Replaced custom S3 client implementation with @fastgpt-sdk/storage SDK
- Refactored environment variable configuration to support multiple storage vendors
- Updated storage-related APIs to use the new SDK's interface
- Added new version entries for multiple tool packages
Reviewed changes
Copilot reviewed 38 out of 40 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/package.json | Bumped package version from 0.2.16 to 0.2.17 |
| scripts/deploy-marketplace.ts | Migrated S3Client usage to createStorage API with multi-vendor support |
| runtime/index.ts | Removed initializeS3() call as initialization is now handled in lib/s3/index.ts |
| runtime/.env.template | Replaced old S3 environment variables with new STORAGE_* variables for multi-vendor support |
| package.json | Added @fastgpt-sdk/storage ^0.5.1 and proxy-agent dependencies |
| modules/tool/utils/uploadFile.ts | Added global prefix handling for worker-based file uploads |
| modules/tool/type/req.ts | Added optional prefix field to tool system variables |
| modules/tool/parseMod.ts | Updated to use new SDK's generateExternalUrl method |
| modules/tool/loadToolDev.ts | Removed await from generateExternalUrl calls (now synchronous) |
| modules/tool/constants.ts | Removed leading slash from PluginBaseS3Prefix constant |
| modules/tool/build/build-json.ts | Updated icon path generation to use new SDK |
| modules/tool/api/upload/confirmUpload.ts | Added debug logging for downloaded tools |
| modules/model/avatars.ts | Removed await from generateExternalUrl (now synchronous) |
| lib/worker/worker.ts | Added global.currentToolPrefix for cross-import state management |
| lib/worker/loadTool.ts | Moved LoadToolsByFilename implementation from loadToolProd and removed icon path generation |
| lib/worker/index.ts | Added getInheritEnv helper to pass all environment variables to workers |
| lib/utils/setupProxy.ts | Simplified proxy setup to use undici's EnvHttpProxyAgent |
| lib/type/env.d.ts | Removed old S3_* environment variable declarations |
| lib/s3/index.ts | Completely refactored to use @fastgpt-sdk/storage with lazy initialization |
| lib/s3/controller.ts | Migrated from minio.Client to IStorage interface |
| lib/s3/const.ts | Removed PublicBucketBaseURL constant (now handled by SDK) |
| lib/s3/config.ts | Replaced S3ConfigType with createDefaultStorageOptions function supporting multiple vendors |
| lib/package.json | Added @fastgpt-sdk/storage 0.5.7 dependency |
| .github/workflows/deploy-marketplace.yml | Updated environment variables from S3_* to STORAGE_* |
| .env.marketplace.template | Added comprehensive STORAGE_* configuration options |
| Multiple tool config files | Added new version entries (0.1.1, 0.1.2, etc.) with updated configurations |
| modules/tool/packages/dbops/children/oracle/src/index.ts | Improved Oracle DB error handling and result sanitization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0c61cc8 to
d924356
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 39 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| storage.uploadObject({ | ||
| key: `${UploadToolsS3Path}/${toolId}/${childId}/logo`, | ||
| body: Buffer.from(await Bun.file(childLogo).arrayBuffer()), | ||
| contentType: mimeMap[ext] | ||
| }); |
There was a problem hiding this comment.
Missing await keyword on storage.uploadObject() call. This async operation is not being awaited, which could result in incomplete uploads when the child has its own logo.
* chore: more logs * feat: migrate to fastgpt storage sdk * chore: add systemVar types * chore: rename env variable * fix: oracle db operation * fix: global proxy agent * fix: incorrect config load timing * fix: incorrect fastgpt storage sdk version * fix: update COS proxy * chore: upgrade tools' version which using 'uploadFile' function * clean code
* feat: migrate to fastgpt storage sdk (#324) * chore: more logs * feat: migrate to fastgpt storage sdk * chore: add systemVar types * chore: rename env variable * fix: oracle db operation * fix: global proxy agent * fix: incorrect config load timing * fix: incorrect fastgpt storage sdk version * fix: update COS proxy * chore: upgrade tools' version which using 'uploadFile' function * clean code * fix: use "minio" for minio adapter (#337) * chore: more logs * clean code * fix: use "minio" for minio adapter * fix: remove log client when ensure public policy failed (#338) * chore: more logs * clean code * fix: remove log client when ensure public policy failed * fix: use minio client to delete files when using minio vendor * chore: bump @fastgpt-sdk/storage (#339) * chore: more logs * clean code * chore: bump @fastgpt-sdk/storage * fix: bump storage sdk (#340) * chore: more logs * clean code * fix: bump storage sdk * perf: worker in tool (#342) * remove run in worker * update plugin version * perf: worker in tool * adapt v1 * adapt v1 * adapt v1 * adapt v1 * update lock * worker * log * log * log * mongo (#343) * mongo * fix: ts * fix: add async context for non-worker environment (#344) * chore: more logs * clean code * fix: add async context for non-worker environment * fix: bundle pkgs without mongo and storage dependencies * fix: force throw error when there is no prefix passing in --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com> * fix: mssql authentication (#345) * chore: more logs * clean code * fix: mssql authentication --------- Co-authored-by: roy <whoeverimf5@gmail.com> Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
No description provided.