Skip to content

Commit 0c61cc8

Browse files
committed
clean code
1 parent f440fd0 commit 0c61cc8

File tree

5 files changed

+6
-112
lines changed

5 files changed

+6
-112
lines changed

.env.marketplace.template

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,61 +5,14 @@ S3_SECRET_KEY=minioadmin
55
MARKETPLACE_BASE_URL=http://localhost:3100
66
MARKETPLACE_AUTH_TOKEN=token
77

8-
# ✅ 对象存储供应商
9-
# - minio: MinIO / 或者其他兼容 S3 协议的自部署对象存储服务
10-
# - aws-s3: AWS S3
11-
# - oss: 阿里云 OSS
12-
# - cos: 腾讯云 COS
13-
STORAGE_VENDOR=minio
14-
# 地区
15-
# - minio: 通常本地部署的对象存储服务的地区设置没什么影响 比如设置为 "us-east-1" 就可以了
16-
# - aws-s3: 根据云服务商提供的设置 比如 "ap-northeast-1"
17-
# - oss: 根据云服务商提供的设置 比如 "oss-cn-hangzhou"
18-
# - cos: 根据云服务商提供的设置 比如 "ap-shanghai"
8+
# 对象存储
9+
STORAGE_VENDOR=minio # 如果是 Sealos 的对象存储填 aws-s3
1910
STORAGE_REGION=us-east-1
20-
# 身份验证凭证
2111
STORAGE_ACCESS_KEY_ID=minioadmin
2212
STORAGE_SECRET_ACCESS_KEY=minioadmin
23-
# 存储桶名称
24-
# - 公开桶
25-
# - 私有桶
2613
STORAGE_PUBLIC_BUCKET=fastgpt-public
2714
STORAGE_PRIVATE_BUCKET=fastgpt-private
28-
# 一个公开的、前端和用户可以直接访问的对象存储连接
29-
# - 比如 MinIO 的反向代理链接或者一个 CDN: https://s3.example.com
3015
STORAGE_EXTERNAL_ENDPOINT=
31-
# ️⭕ 兼容 S3 协议的对象存储需要额外填的
32-
# S3 端点连接 URL 为了避免歧义 填写完整的、包含协议与端口的 URL
33-
# - 本地 MinIO: http://127.0.0.1:9000
34-
# - docker-compose 中的 MinIO: http://fastgpt-minio:9000
3516
STORAGE_S3_ENDPOINT=http://127.0.0.1:9000
36-
# 路径风格配置 (virtual-host style | path style)
37-
# - true => http(s)://endpoint/{bucket}/{key}
38-
# - false => http(s)://{bucket}.endpoint/{key}
3917
STORAGE_S3_FORCE_PATH_STYLE=true
40-
# 【可选】最多请求重试次数
4118
STORAGE_S3_MAX_RETRIES=3
42-
# ️⭕ 阿里云 OSS 需要额外填的 参考: https://github.com/ali-sdk/ali-oss?tab=readme-ov-file#ossoptions
43-
# 阿里云连接端点 URL
44-
# - 比如 oss-cn-hangzhou.aliyuncs.com
45-
# - 如果配置了 CName 记得更换为映射的域名 比如 http(s)://example.com
46-
STORAGE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
47-
# 【可选】自定义域名 CNAME 参考: https://help.aliyun.com/zh/oss/developer-reference/initialization-10?spm=a2c4g.11186623.help-menu-31815.d_1_1_10_1.34ec79cfj3YO6w&scm=20140722.H_111256._.OR_help-T_cn~zh-V_1#9635d0c28f3p6
48-
STORAGE_OSS_CNAME=false
49-
# 【可选】是否开启 TLS
50-
# - true
51-
# - false
52-
STORAGE_OSS_SECURE=false
53-
# 【可选】Whether to use internal endpoint (intra-cloud)
54-
STORAGE_OSS_INTERNAL=false
55-
# ️⭕ 腾讯云 COS 需要额外填的 参考: https://cloud.tencent.com/document/product/436/8629#.E9.85.8D.E7.BD.AE.E9.A1.B9
56-
# 【可选】发请求时用的协议,可选项 https:、http: 默认判断当前页面是 http: 时使用 http: 否则使用 https:
57-
# - http:
58-
# - https:
59-
STORAGE_COS_PROTOCOL=http:
60-
# 【可选】是否启用全球加速域名 默认为 false 若改为 true 需要存储桶开启全球加速功能
61-
STORAGE_COS_USE_ACCELERATE=false
62-
# 【可选】CNAME 的自定义域名
63-
STORAGE_COS_CNAME_DOMAIN=
64-
# 【可选】请求时使用 HTTP 代理,例如:http://127.0.0.1:8080
65-
STORAGE_COS_PROXY=

lib/worker/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ import { publicS3Server } from '@/s3';
77
import { basePath, devToolIds } from '@tool/constants';
88
import type { StreamDataType, ToolCallbackReturnSchemaType } from '@tool/type/req';
99

10-
const getInheritEnv = (): Record<string, string> => {
11-
const env: Record<string, string> = {};
12-
for (const [key, val] of Object.entries(process.env)) {
13-
if (typeof val === 'string') env[key] = val;
14-
}
15-
return env;
16-
};
17-
1810
type WorkerQueueItem = {
1911
id: string;
2012
worker: Worker;
@@ -103,7 +95,6 @@ export class WorkerPool<Props = Record<string, unknown>, Response = unknown> {
10395
const workerId = `${Date.now()}${Math.random()}`;
10496
const worker = new Worker('./worker.js', {
10597
env: {
106-
...getInheritEnv(),
10798
...(process.env.HTTP_PROXY ? { HTTP_PROXY: process.env.HTTP_PROXY } : {}),
10899
...(process.env.HTTPS_PROXY ? { HTTPS_PROXY: process.env.HTTPS_PROXY } : {})
109100
},
@@ -184,9 +175,7 @@ export async function dispatchWithNewWorker(data: {
184175
const isBun = typeof Bun !== 'undefined';
185176
const workerPath = `${basePath}/dist/worker.js`;
186177
const worker = new Worker(workerPath, {
187-
env: {
188-
...getInheritEnv()
189-
},
178+
env: {},
190179
...(isBun
191180
? {}
192181
: {

modules/tool/api/upload/confirmUpload.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default s.route(contract.tool.upload.confirmUpload, async ({ body }) => {
1313
const toolIds = [...new Set(_toolIds)];
1414
addLog.debug(`Confirming uploaded tools: ${toolIds}`);
1515
const pendingTools = await privateS3Server.getFiles(`${UploadToolsS3Path}/temp`);
16-
addLog.debug(`Downloaded tools: ${pendingTools}`);
1716
const pendingToolIds = pendingTools
1817
.map((item) => item.split('/').at(-1)?.split('.').at(0))
1918
.filter((item): item is string => !!item);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
]
5656
},
5757
"dependencies": {
58-
"@fastgpt-sdk/storage": "^0.5.1",
58+
"@fastgpt-sdk/storage": "^0.5.7",
5959
"@ts-rest/core": "3.52.1",
6060
"@ts-rest/express": "3.52.1",
6161
"@ts-rest/open-api": "3.52.1",

runtime/.env.template

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,61 +23,14 @@ SERVICE_REQUEST_MAX_CONTENT_LENGTH=10
2323
MAX_API_SIZE=10
2424
DISABLE_DEV_TOOLS=false # 禁用 Dev 插件载入
2525

26-
# ✅ 对象存储供应商
27-
# - minio: MinIO / 或者其他兼容 S3 协议的自部署对象存储服务
28-
# - aws-s3: AWS S3
29-
# - oss: 阿里云 OSS
30-
# - cos: 腾讯云 COS
31-
STORAGE_VENDOR=minio
32-
# 地区
33-
# - minio: 通常本地部署的对象存储服务的地区设置没什么影响 比如设置为 "us-east-1" 就可以了
34-
# - aws-s3: 根据云服务商提供的设置 比如 "ap-northeast-1"
35-
# - oss: 根据云服务商提供的设置 比如 "oss-cn-hangzhou"
36-
# - cos: 根据云服务商提供的设置 比如 "ap-shanghai"
26+
# 对象存储
27+
STORAGE_VENDOR=minio # 如果是 Sealos 的对象存储填 aws-s3
3728
STORAGE_REGION=us-east-1
38-
# 身份验证凭证
3929
STORAGE_ACCESS_KEY_ID=minioadmin
4030
STORAGE_SECRET_ACCESS_KEY=minioadmin
41-
# 存储桶名称
42-
# - 公开桶
43-
# - 私有桶
4431
STORAGE_PUBLIC_BUCKET=fastgpt-public
4532
STORAGE_PRIVATE_BUCKET=fastgpt-private
46-
# 一个公开的、前端和用户可以直接访问的对象存储连接
47-
# - 比如 MinIO 的反向代理链接或者一个 CDN: https://s3.example.com
4833
STORAGE_EXTERNAL_ENDPOINT=
49-
# ️⭕ 兼容 S3 协议的对象存储需要额外填的
50-
# S3 端点连接 URL 为了避免歧义 填写完整的、包含协议与端口的 URL
51-
# - 本地 MinIO: http://127.0.0.1:9000
52-
# - docker-compose 中的 MinIO: http://fastgpt-minio:9000
5334
STORAGE_S3_ENDPOINT=http://127.0.0.1:9000
54-
# 路径风格配置 (virtual-host style | path style)
55-
# - true => http(s)://endpoint/{bucket}/{key}
56-
# - false => http(s)://{bucket}.endpoint/{key}
5735
STORAGE_S3_FORCE_PATH_STYLE=true
58-
# 【可选】最多请求重试次数
5936
STORAGE_S3_MAX_RETRIES=3
60-
# ️⭕ 阿里云 OSS 需要额外填的 参考: https://github.com/ali-sdk/ali-oss?tab=readme-ov-file#ossoptions
61-
# 阿里云连接端点 URL
62-
# - 比如 oss-cn-hangzhou.aliyuncs.com
63-
# - 如果配置了 CName 记得更换为映射的域名 比如 http(s)://example.com
64-
STORAGE_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
65-
# 【可选】自定义域名 CNAME 参考: https://help.aliyun.com/zh/oss/developer-reference/initialization-10?spm=a2c4g.11186623.help-menu-31815.d_1_1_10_1.34ec79cfj3YO6w&scm=20140722.H_111256._.OR_help-T_cn~zh-V_1#9635d0c28f3p6
66-
STORAGE_OSS_CNAME=false
67-
# 【可选】是否开启 TLS
68-
# - true
69-
# - false
70-
STORAGE_OSS_SECURE=false
71-
# 【可选】Whether to use internal endpoint (intra-cloud)
72-
STORAGE_OSS_INTERNAL=false
73-
# ️⭕ 腾讯云 COS 需要额外填的 参考: https://cloud.tencent.com/document/product/436/8629#.E9.85.8D.E7.BD.AE.E9.A1.B9
74-
# 【可选】发请求时用的协议,可选项 https:、http: 默认判断当前页面是 http: 时使用 http: 否则使用 https:
75-
# - http:
76-
# - https:
77-
STORAGE_COS_PROTOCOL=http:
78-
# 【可选】是否启用全球加速域名 默认为 false 若改为 true 需要存储桶开启全球加速功能
79-
STORAGE_COS_USE_ACCELERATE=false
80-
# 【可选】CNAME 的自定义域名
81-
STORAGE_COS_CNAME_DOMAIN=
82-
# 【可选】请求时使用 HTTP 代理,例如:http://127.0.0.1:8080
83-
STORAGE_COS_PROXY=

0 commit comments

Comments
 (0)