Skip to content

Commit 02b214b

Browse files
authored
feat: remove buffer;fix: custom pdf parse (#4914)
* fix: doc * fix: remove buffer * fix: pdf parse
1 parent a171c7b commit 02b214b

File tree

11 files changed

+79
-35
lines changed

11 files changed

+79
-35
lines changed

deploy/docker/docker-compose-milvus.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ services:
132132
# fastgpt
133133
sandbox:
134134
container_name: sandbox
135-
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10 # git
136-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10 # 阿里云
135+
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
136+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
137137
networks:
138138
- fastgpt
139139
restart: always
140140
fastgpt-mcp-server:
141141
container_name: fastgpt-mcp-server
142-
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10 # git
143-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10 # 阿里云
142+
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
143+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
144144
ports:
145145
- 3005:3000
146146
networks:
@@ -150,8 +150,8 @@ services:
150150
- FASTGPT_ENDPOINT=http://fastgpt:3000
151151
fastgpt:
152152
container_name: fastgpt
153-
image: ghcr.io/labring/fastgpt:v4.9.10 # git
154-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10 # 阿里云
153+
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
154+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
155155
ports:
156156
- 3000:3000
157157
networks:

deploy/docker/docker-compose-oceanbase/docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ services:
109109
# fastgpt
110110
sandbox:
111111
container_name: sandbox
112-
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10 # git
113-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10 # 阿里云
112+
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
113+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
114114
networks:
115115
- fastgpt
116116
restart: always
117117
fastgpt-mcp-server:
118118
container_name: fastgpt-mcp-server
119-
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10 # git
120-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10 # 阿里云
119+
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
120+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
121121
ports:
122122
- 3005:3000
123123
networks:
@@ -127,8 +127,8 @@ services:
127127
- FASTGPT_ENDPOINT=http://fastgpt:3000
128128
fastgpt:
129129
container_name: fastgpt
130-
image: ghcr.io/labring/fastgpt:v4.9.10 # git
131-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10 # 阿里云
130+
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
131+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
132132
ports:
133133
- 3000:3000
134134
networks:

deploy/docker/docker-compose-pgvector.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ services:
9696
# fastgpt
9797
sandbox:
9898
container_name: sandbox
99-
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10 # git
100-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10 # 阿里云
99+
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
100+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
101101
networks:
102102
- fastgpt
103103
restart: always
104104
fastgpt-mcp-server:
105105
container_name: fastgpt-mcp-server
106-
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10 # git
107-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10 # 阿里云
106+
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
107+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
108108
ports:
109109
- 3005:3000
110110
networks:
@@ -114,8 +114,8 @@ services:
114114
- FASTGPT_ENDPOINT=http://fastgpt:3000
115115
fastgpt:
116116
container_name: fastgpt
117-
image: ghcr.io/labring/fastgpt:v4.9.10 # git
118-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10 # 阿里云
117+
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
118+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
119119
ports:
120120
- 3000:3000
121121
networks:

deploy/docker/docker-compose-zilliz.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ services:
7272

7373
sandbox:
7474
container_name: sandbox
75-
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10 # git
76-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10 # 阿里云
75+
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
76+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
7777
networks:
7878
- fastgpt
7979
restart: always
8080
fastgpt-mcp-server:
8181
container_name: fastgpt-mcp-server
82-
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10 # git
83-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10 # 阿里云
82+
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
83+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
8484
ports:
8585
- 3005:3000
8686
networks:
@@ -90,8 +90,8 @@ services:
9090
- FASTGPT_ENDPOINT=http://fastgpt:3000
9191
fastgpt:
9292
container_name: fastgpt
93-
image: ghcr.io/labring/fastgpt:v4.9.10 # git
94-
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10 # 阿里云
93+
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
94+
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
9595
ports:
9696
- 3000:3000
9797
networks:

docSite/content/zh-cn/docs/development/upgrading/4910.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ weight: 790
1515

1616
### 2. 更新镜像 tag
1717

18-
- 更新 FastGPT 镜像 tag: v4.9.10
19-
- 更新 FastGPT 商业版镜像 tag: v4.9.10
18+
- 更新 FastGPT 镜像 tag: v4.9.10-fix2
19+
- 更新 FastGPT 商业版镜像 tag: v4.9.10-fix2
2020
- mcp_server 无需更新
2121
- Sandbox 无需更新
2222
- AIProxy 无需更新

docSite/content/zh-cn/docs/development/upgrading/4911.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ weight: 789
2020

2121
1. 工作流中,管理员声明的全局系统工具,无法进行版本管理。
2222
2. 工具调用节点前,有交互节点时,上下文异常。
23-
3. 修复备份导入,小于 1000 字时,无法分块问题。
23+
3. 修复备份导入,小于 1000 字时,无法分块问题。
24+
4. 自定义 PDF 解析,无法保存 base64 图片。

packages/service/common/buffer/rawText/controller.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { retryFn } from '@fastgpt/global/common/system/utils';
22
import { connectionMongo } from '../../mongo';
33
import { MongoRawTextBufferSchema, bucketName } from './schema';
44
import { addLog } from '../../system/log';
5+
import { setCron } from '../../system/cron';
6+
import { checkTimerLock } from '../../system/timerLock/utils';
7+
import { TimerIdEnum } from '../../system/timerLock/constants';
58

69
const getGridBucket = () => {
710
return new connectionMongo.mongo.GridFSBucket(connectionMongo.connection.db!, {
@@ -137,3 +140,40 @@ export const updateRawTextBufferExpiredTime = async ({
137140
);
138141
});
139142
};
143+
144+
export const clearExpiredRawTextBufferCron = async () => {
145+
const clearExpiredRawTextBuffer = async () => {
146+
addLog.debug('Clear expired raw text buffer start');
147+
const gridBucket = getGridBucket();
148+
149+
return retryFn(async () => {
150+
const data = await MongoRawTextBufferSchema.find(
151+
{
152+
'metadata.expiredTime': { $lt: new Date() }
153+
},
154+
'_id'
155+
).lean();
156+
157+
for (const item of data) {
158+
await gridBucket.delete(item._id);
159+
}
160+
addLog.debug('Clear expired raw text buffer end');
161+
});
162+
};
163+
164+
setCron('*/10 * * * *', async () => {
165+
if (
166+
await checkTimerLock({
167+
timerId: TimerIdEnum.clearExpiredRawTextBuffer,
168+
lockMinuted: 9
169+
})
170+
) {
171+
try {
172+
await clearExpiredRawTextBuffer();
173+
} catch (error) {
174+
addLog.error('clearExpiredRawTextBufferCron error', error);
175+
}
176+
}
177+
});
178+
clearExpiredRawTextBuffer();
179+
};

packages/service/common/file/read/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const readRawContentByFileBuffer = async ({
110110

111111
return {
112112
rawText: text,
113-
formatText: rawText,
113+
formatText: text,
114114
imageList
115115
};
116116
};

packages/service/common/system/timerLock/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export enum TimerIdEnum {
55
clearExpiredSubPlan = 'clearExpiredSubPlan',
66
updateStandardPlan = 'updateStandardPlan',
77
scheduleTriggerApp = 'scheduleTriggerApp',
8-
notification = 'notification'
8+
notification = 'notification',
9+
clearExpiredRawTextBuffer = 'clearExpiredRawTextBuffer'
910
}
1011

1112
export enum LockNotificationEnum {

projects/app/src/instrumentation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export async function register() {
3939
systemStartCb();
4040
initGlobalVariables();
4141

42+
try {
43+
await preLoadWorker();
44+
} catch (error) {
45+
console.error('Preload worker error', error);
46+
}
47+
4248
// Connect to MongoDB
4349
await connectMongo(connectionMongo, MONGO_URL);
4450
connectMongo(connectionLogMongo, MONGO_LOG_URL);
@@ -54,12 +60,6 @@ export async function register() {
5460
startCron();
5561
startTrainingQueue(true);
5662

57-
try {
58-
await preLoadWorker();
59-
} catch (error) {
60-
console.error('Preload worker error', error);
61-
}
62-
6363
console.log('Init system success');
6464
}
6565
} catch (error) {

0 commit comments

Comments
 (0)