Skip to content

Commit 0fd7aad

Browse files
committed
chore: confirmUpload can confirm a bunch of tools
1 parent d9ee244 commit 0fd7aad

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

README_zh_CN.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ FastGPT 已有系统工具已经迁移到这个仓库,新工具也将在这个
2525
## 系统工具基础设施
2626

2727
- [x] 工具独立运行
28-
- [ ] 热插拔
28+
- [x] 热插拔
29+
- [x] 工具版本管理
30+
- [x] SSE 流响应
2931
- [ ] 更优雅的 Secret 配置
3032
- [ ] 可视化调试
3133
- [ ] 反向调用 FastGPT
32-
- [ ] 工具版本管理
33-
- [ ] SSE 流响应
3434
- [ ] 更多安全策略
3535

3636
## 文档
3737

38-
- [系统工具开发指南](https://doc.tryfastgpt.ai/docs/introduction/guide/plugins/dev_system_tool)
39-
- [设计文档](https://doc.tryfastgpt.ai/docs/introduction/development/design/design_plugin)
38+
- [系统工具开发指南](https://doc.fastgpt.io/docs/introduction/guide/plugins/dev_system_tool)
39+
- [设计文档](https://doc.fastgpt.io/docs/introduction/development/design/design_plugin)
4040
- [开发规范](./dev_zh_CN.md)

dev_zh_CN.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# FastGPT-plugin 开发文档
22

3-
43
## 常用命令
54

65
### 安装依赖
@@ -145,4 +144,4 @@ modules/tool/type/tool.ts 下修改 `ToolTypeMap` 字段来增加类型枚举。
145144
### 新增模型
146145

147146
1. modules/model/provider 找到对应模型提供商配置文件
148-
2. 按 ConfigModelItemSchema 数据类型填写配置即可
147+
2. 按 ConfigModelItemSchema 数据类型填写配置即可

modules/tool/api/upload/confirmUpload.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ import { s } from '@/router/init';
22
import { contract } from '@/contract';
33
import { MongoS3TTL } from '@/s3/ttl/schema';
44
import { UploadToolsS3Path } from '@tool/constants';
5+
import { MongoPlugin } from '@/mongo/models/plugins';
56

67
export default s.route(contract.tool.upload.confirmUpload, async ({ body }) => {
7-
const { toolId } = body;
8+
const { toolIds } = body;
9+
10+
await MongoPlugin.create(
11+
toolIds.map((toolId) => ({
12+
toolId
13+
}))
14+
);
815

916
await MongoS3TTL.deleteMany({
1017
minioKey: {
11-
$regex: new RegExp(`${UploadToolsS3Path}/${toolId}`)
18+
$regex: toolIds.map((toolId) => `^${UploadToolsS3Path}/${toolId}`).join('|')
1219
}
1320
});
1421

modules/tool/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const toolUploadContract = c.router(
4343
method: 'POST',
4444
description: 'Upload and install a tool plugin',
4545
body: z.object({
46-
toolId: z.string()
46+
toolIds: z.array(z.string())
4747
}),
4848
responses: {
4949
200: z.object({

0 commit comments

Comments
 (0)