Files
FastGPT/document/content/docs/introduction/guide/plugins/upload_system_tool.mdx
Ctrlz 31c12fdeb9 Enhance file upload functionality and system tool integration (#5257)
* Enhance file upload functionality and system tool integration

* Add supplementary documents and optimize the upload interface

* Refactor file plugin types and update upload configurations

* Refactor MinIO configuration variables and clean up API plugin handlers for improved readability and consistency

* File name change

* Refactor SystemTools component layout

* fix i18n

* fix

* fix

* fix
2025-07-31 11:46:10 +08:00

123 lines
3.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 如何在线上传系统工具
description: FastGPT 系统工具在线上传指南
---
> 从 FastGPT 4.10.0 版本开始,系统管理员可以通过 Web 界面直接上传和更新系统工具,无需重新部署服务
## 权限要求
⚠️ **重要提示**:只有 **root 用户** 才能使用在线上传系统工具功能。
- 确保您已使用 `root` 账户登录 FastGPT
- 普通用户无法看到"导入/更新"按钮和删除功能
## 支持的文件格式
- **文件类型**`.js` 文件
- **文件大小**:最大 10MB
- **文件数量**:每次只能上传一个文件
## 上传步骤
### 1. 进入系统工具页面
1. 登录 FastGPT 管理后台
2. 导航到:**工作台** → **系统工具**
3. 确认页面右上角显示"导入/更新"按钮(只有 root 用户可见)
![](/imgs/plugins/entry.png)
### 2. 准备工具文件
在上传之前,请确保您的 `.js` 文件是从 fastgpt-plugin 项目中通过 `bun run build` 命令打包后的 dist/tools/built-in 文件夹下得到的
![](/imgs/plugins/file.png)
### 3. 执行上传
1. 点击 **"导入/更新"** 按钮
2. 在弹出的对话框中,点击文件选择区域
3. 选择您准备好的 `.js` 工具文件
4. 确认文件信息无误后,点击 **"确认导入"**
### 4. 上传过程
- 上传成功后会显示成功提示
- 页面自动刷新,新工具会出现在工具列表中
## 功能特点
### 工具管理
- **查看工具**:所有用户都可以查看已安装的系统工具
- **上传工具**:仅 root 用户可以上传新工具或更新现有工具
- **删除工具**:仅 root 用户可以删除已上传的工具
### 工具类型识别
系统会根据工具的配置自动识别工具类型:
- 🔧 **工具 (tools)**
- 🔍 **搜索 (search)**
- 🎨 **多模态 (multimodal)**
- 💬 **通讯 (communication)**
- 📦 **其他 (other)**
## 常见问题
### Q: 上传失败,提示"文件内容存在错误"
**可能原因:**
- fastgpt-plugin 项目不是最新的,导致打包的 `.js` 文件缺少正确的内容
- 工具配置格式不正确
**解决方案:**
1. 拉取最新的 fastgpt-plugin 项目重新进行 `bun run build` 获得打包后的 `.js` 文件
2. 检查本地插件运行是否成功
### Q: 无法看到"导入/更新"按钮
**原因:** 当前用户不是 root 用户
**解决方案:** 使用 root 账户重新登录
### Q: 文件上传超时
**可能原因:**
- 文件过大(超过 10MB
- 网络连接不稳定
**解决方案:**
1. 确认文件大小在限制范围内
2. 检查网络连接
3. 尝试重新上传
## 最佳实践
### 上传前检查
1. **代码测试**:在本地环境测试工具功能
2. **格式验证**:确保符合 FastGPT 工具规范
3. **文件大小**:保持文件在合理大小范围内
### 版本管理
- 建议为工具添加版本号注释
- 更新工具时,先备份原有版本
- 记录更新日志和功能变更
### 安全考虑
- 仅上传来源可信的工具文件
- 避免包含敏感信息或凭据
- 定期审查已安装的工具
### 存储方式
- 工具文件存储在 MinIO 中
- 工具元数据保存在 MongoDB 中
---
通过在线上传功能,您可以快速部署和管理系统工具,提高 FastGPT 的扩展性和灵活性。如遇到问题,请参考上述常见问题或联系技术支持。