Skip to content

Commit cd66814

Browse files
authored
fix: s3init (#5784)
* doc * fix: s3init * perf: dynamic import * remove moongose dep * worker build * worker code * perf: worker build * fix: error throw * doc * doc * fix: build * fix: dockerfile * nextjs config * fix: worker
1 parent 02917f1 commit cd66814

File tree

39 files changed

+3934
-5287
lines changed

39 files changed

+3934
-5287
lines changed

.claude/design/projects_app_performance_stability_analysis.md

Lines changed: 1723 additions & 0 deletions
Large diffs are not rendered by default.

.claude/design/projects_app_performance_stability_deep_analysis.md

Lines changed: 1278 additions & 0 deletions
Large diffs are not rendered by default.

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ README.md
99
.yalc/
1010
yalc.lock
1111
testApi/
12-
*.local.*
12+
*.local.*
13+
*.local

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ files/helm/fastgpt/charts/*.tgz
3737

3838
tmp/
3939
coverage
40-
document/.source
40+
document/.source
41+
42+
projects/app/worker/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ ifeq ($(proxy), taobao)
2121
else ifeq ($(proxy), clash)
2222
docker build -f $(filePath) -t $(image) . --network host --build-arg HTTP_PROXY=http://127.0.0.1:7890 --build-arg HTTPS_PROXY=http://127.0.0.1:7890
2323
else
24-
docker build -f $(filePath) -t $(image) .
24+
docker build --progress=plain -f $(filePath) -t $(image) .
2525
endif

document/content/docs/upgrading/4-13/4132.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ S3_PUBLIC_BUCKET=S3公开桶名称(公开读私有写)
2222

2323
1. 非管理员无法看到团队审计日志。
2424
2. 引入 S3 用于存储应用头像。
25+
3. 工作流画布性能。
2526

2627
## 🐛 修复
2728

document/data/doc-last-modified.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T22:29:56+08:00",
114114
"document/content/docs/upgrading/4-13/4130.mdx": "2025-09-30T16:00:10+08:00",
115115
"document/content/docs/upgrading/4-13/4131.mdx": "2025-09-30T15:47:06+08:00",
116-
"document/content/docs/upgrading/4-13/4132.mdx": "2025-10-17T21:17:58+08:00",
116+
"document/content/docs/upgrading/4-13/4132.mdx": "2025-10-17T21:40:12+08:00",
117117
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
118118
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
119119
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
export const getTextValidLength = (chunk: string) => {
22
return chunk.replaceAll(/[\s\n]/g, '').length;
33
};
4+
5+
export const isObjectId = (str: string) => {
6+
return /^[0-9a-fA-F]{24}$/.test(str);
7+
};

packages/service/common/mongo/index.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,19 @@ export const getMongoLogModel = <T>(name: string, schema: mongoose.Schema) => {
123123
};
124124

125125
const syncMongoIndex = async (model: Model<any>) => {
126-
if (process.env.SYNC_INDEX !== '0' && process.env.NODE_ENV !== 'test') {
127-
try {
128-
model.syncIndexes({ background: true });
129-
} catch (error) {
130-
addLog.error('Create index error', error);
131-
}
126+
if (
127+
process.env.NODE_ENV === 'test' ||
128+
process.env.SYNC_INDEX === '0' ||
129+
process.env.NEXT_PHASE === 'phase-production-build' ||
130+
!MONGO_URL
131+
) {
132+
return;
133+
}
134+
135+
try {
136+
await model.syncIndexes({ background: true });
137+
} catch (error) {
138+
addLog.error('Create index error', error);
132139
}
133140
};
134141

packages/service/common/response/index.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,12 @@ export const jsonRes = <T = any>(
9999
clearCookie(res);
100100
}
101101

102-
res.status(processedError.code);
103-
104-
// 如果有自定义消息,直接发送
105-
if (message) {
106-
res.send(message);
107-
} else {
108-
res.json({
109-
code: processedError.code,
110-
statusText: processedError.statusText,
111-
message: processedError.message,
112-
data: processedError.data !== undefined ? processedError.data : null
113-
});
114-
}
102+
res.status(500).json({
103+
code: processedError.code,
104+
statusText: processedError.statusText,
105+
message: message || processedError.message,
106+
data: processedError.data !== undefined ? processedError.data : null
107+
});
115108

116109
return;
117110
}

0 commit comments

Comments
 (0)