Commit 7506a147 by Archer Committed by GitHub

V4.14.x (#6751)

* batch node (#6732)

* batch node

* docs: add local code quality standards and style guides for automated review

* refactor: remove enforced minimum for parallel concurrency, simplify edge handling in task runtime context, and fix loop output mapping

* feat: auto-infer and sync valueType for parallel loop input and output based on referenced array source

* fix: refactor parallelRun output type synchronization and improve sub-workflow error handling in dispatch service

* feat: enforce parallel concurrency limits and validate against workflow loop constraints

* feat: implement retry mechanism for parallel workflow tasks with usage tracking per attempt

* fix review

* perf: use function

* refactor: abstract nested node logic into useNestedNode hook and update parallelRun icon/service logic

* fix: type import

* refactor: update ParallelRunStatusEnum and i18n labels for improved status clarity

* feat: parallel run details and input/output display to chat response modal and service dispatch

* fix: config limit error

* refactor: optimize parallel run task execution, fix point accumulation, and improve error handling for sub-workflows

* fix: include totalPoints in parallel task results

* refactor: centralize nested input injection and point safety utilities for workflow dispatchers

* test: add unit tests for safePoints utility function

* refactor: update parallel workflow runtime types and clean up docstring placement in dispatch utils

* fix: include all runtime nodes in parallel execution to ensure variable reference accessibility

* refactor: update pushSubWorkflowUsage signature to use object parameter for improved consistency

---------

Co-authored-by: DigHuang <114602213+DigHuang@users.noreply.github.com>

* feat(s3): add proxy transfer mode with tokenized upload/download (#6729)

* feat(s3): add proxy transfer mode with tokenized upload/download

* wip: switch to proxy mode for upload progress

* fix: office mime types

* fix(s3): upload MIME validation, multer whitelist, API error status

- Treat AVI/MPEG mime aliases (incl. video/mp1s vs video/mpeg) as matching
- Optional allowedExtensions on multer for dataset images and localFile
- Map S3/business errors to 4xx in jsonRes where appropriate
- Align presign max size with team plan; fix dataset import size UX
- Add upload validation tests

Made-with: Cursor

* fix: show clear message when upload frequency limit is exceeded

- Reject ERROR_ENUM.uploadFileIntervalLimit from authFrequencyLimit instead of Mongo doc
- Add i18n for upload_file_interval_limit (zh-CN/en/zh-Hant)

Made-with: Cursor

* fix file token validation and upload mime checks

* fix: test

* fix(s3): treat m4a audio/mp4 and audio/x-m4a as equivalent

- Add MIME equivalence group for AAC/M4A container mismatch (mime-types vs file-type)
- Add upload validation test for minimal ftyp/M4A buffer
- Test env: keep FILE_TOKEN_KEY in vitest test.env and test/setup.ts (drop loadTestEnv file)

Made-with: Cursor

* fix(chat): 调试区文件类型与编辑态一致,并修复 accept 在 WebKit 下不更新

- ChatTest: 用 getAppChatConfig + getGuideModule 合并画布引导节点与 chatConfig
- useChatTest: 依赖 fileSelectConfig 序列化与 chatConfig,避免深层变更未触发预览更新
- useSelectFile: 用 useCallback + input key 替代 useMemoizedFn,确保 accept 变更后重建 input

Made-with: Cursor

* fix: invalid request

* feat: prompt inject (#6757)

* feat: resume chat stream (#6722)

* fix: openapi schema issue while creating openapi json

* feat: resume chat stream

* wip: chat status and read status

* feat: sync chat side bar status

* fix: allow reassignment of variables in chatTest handler

Made-with: Cursor

* feat(chat): stream resume hardening, resume modules in @fastgpt/service, stale generating cron

- Move stream resume mirror + resumeStatus into packages/service; update API imports
- chatTest: ensurePendingChatRoundItems, default responseChatItemId; zod default import for client
- useChatTest + HomeChatWindow: enableAutoResume and sync init chatGenerateStatus
- ChatContext: safe no-op defaults without provider
- Cron: clean MongoChat stuck in generating >30min; timer lock cleanStaleGeneratingChat

Made-with: Cursor

* fix(chat): address stream-resume PR review (zod/mongoose enum, legacy status, upsert, UI race)

- Zod: use z.nativeEnum(ChatGenerateStatusEnum); mongoose chatGenerateStatus enum as [0,1,2] only
- Init APIs: default missing chatGenerateStatus to done before read/unread logic
- ensurePendingChatRoundItems: unique index + upsert; rename ChatGenerateStatusEnum
- ChatBox auto-resume: guard by chatId; sidebar sync via targetChatId
- Tests: chat history/feedback APIs pass with schema fixes

Made-with: Cursor

* fix(chat): expose resume at /api/v2/chat/resume; openapi + review tidy

- Move handler from v1/stream to v2/chat/resume (pairs with v2 completions + Redis mirror)
- Update fetch, OpenAPI AIPath, comments; remove slim projects/app global chat api
- getHistoryStatus default chatGenerateStatus; team init + chatTest notes; ChatItem tweak

Made-with: Cursor

* fix(chat): fix resume JSON parse catch shadowing; drop unused resumeChatStream

Made-with: Cursor

* docs(chat): comment closed+stream mirror write path in workflow dispatch

Made-with: Cursor

* refactor: unify resumable stream mirroring

* fix: keep v1 chat completions out of resume flow

* refactor: make prepared chat rounds transactional

* fix: handle resume stream terminal errors

* fix: rerank max token

* feat(workflow): extend variable update node with Number/Boolean/Array operations (#6752)

* feat(workflow): extend variable update node with   Number/Boolean/Array ops

* feat: math operator icons and refactor variable update renderers for improved layout and consistency

* chore(workflow): clean up variable update types and restore icon   cleanup

* feat: add test

* fix:md_ascii_bug (#6755)

* md_ascii_bug

* md_ascii_bug

* md_ascii_bug

* md_ascii_bug

* md_ascii_bug

* perf: test

---------

Co-authored-by: archer <545436317@qq.com>

* doc

* del dataset

* perf: date auto coerce

* doc

* add test

* perf: channel setting

* doc

* fix: chat resume stream (#6759)

* refactor(api): move stream resume to /api/core/chat/resume

Relocate resume handler from pages/api/v2 to pages/api/core, update
OpenAPI paths, frontend streamResumeFetch URL, tests, and comments.

Made-with: Cursor

* fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus

Made-with: Cursor

* fix: use enum instead of nativeEnum

* fix(chat): address resume review suggestions

* fix(chat): require sse when resuming generating chats

* revert(chat): keep chatitem dataId index non-unique

* fix: ts

* fix doc

* fix(chat): gate stream resume mirror by header (#6760)

* fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus

Made-with: Cursor

* fix: use enum instead of nativeEnum

* fix(chat): address resume review suggestions

* fix(chat): require sse when resuming generating chats

* feat(chat): gate stream resume mirror by header

* refactor(chat): decouple resume mirror header parsing

* perf: dataset queue

* fix: multipleselect

* perf: workflow bug

* doc

* doc

* perf: deploy yml;fix: child nodes watch

* adapt embedding model defaultconfig

* install shell

* add mcp zod check

* feat: http tool zod schema

* Feat/batch UI (#6763)

* feat: aggregate parallel run results into task-specific virtual nodes and update UI to support i18n arguments for module names

* style: update workflow node card padding and table styling for improved layout consistency

* feat: implement parallel run workflow node with documentation and i18n support

* style(modal): WholeResponseModal UI and layout styling

* chore: improve chat resume UX (#6764)

* fix: remove stray conflict markers; use z.nativeEnum for chatGenerateStatus

Made-with: Cursor

* fix: use enum instead of nativeEnum

* fix(chat): address resume review suggestions

* fix(chat): require sse when resuming generating chats

* feat(chat): gate stream resume mirror by header

* refactor(chat): decouple resume mirror header parsing

* feat: improve stream resume fallback

* feat: block duplicate chat generation

* feat: polish resume unavailable recovery

* test: stabilize resume stream timeout

* fix: harden resume wait flow

* fix: get mcp tool raw schema

* style: update UI styling and layout for LLM request detail and response modals

* perf: http tool

* fix: test

* fix: http raw schema

* fix: test

* deploy yml

* deploy yml

---------

Co-authored-by: DigHuang <114602213+DigHuang@users.noreply.github.com>
Co-authored-by: Ryo <whoeverimf5@gmail.com>
Co-authored-by: YeYuheng <57035043+YYH211@users.noreply.github.com>
parent ac36cad6
# 功能开发文档
# 功能开发文档
## 文档标识
- 任务前缀:`md-encoding-repair`
- 文档文件名:`md-encoding-repair-功能开发文档.md`
- 文档状态:已补全(实施完成版)
- 最后更新:2026-04-15
## 0. 开发目标与约束
- 功能目标:修复“Markdown 文件前部英文导致编码误判为 `ascii`,从而中文乱码”的问题。
- 核心策略:`UTF-8 严格校验优先(BOM + 字节级合法性校验)`,失败后再进入探测回退。
- 代码范围:
- `FastGPT/packages/global/common/file/tools.ts`
- `FastGPT/packages/service/worker/readFile/extension/rawText.ts`
- `FastGPT/test/cases/global/common/file/tool.test.ts`
- `FastGPT/test/cases/service/common/file/read/encoding.regression.test.ts`
- 非目标(明确不做):API 协议、DB schema、前端交互改造。
- 必须遵循规范:`/Users/xxyyh/.codex/skills/fastgpt-requirement-design/references/style-standards-entry.md`
- 适用维度(从需求分析继承):API[ ] DB[ ] Front[ ] Logger[ ] Package[x]
## 1. 实施任务拆解(执行结果)
| 任务ID | 任务名称 | 责任层 | 执行结果 | 完成定义(DoD) | 状态 |
|---|---|---|---|---|---|
| T1 | 重构编码检测策略 | Service(global utils) | `detectFileEncoding` 改为 BOM + UTF-8 严格校验优先;失败再 fallback 探测 | 不再依赖“仅前 200 字节” | ✅ 已完成 |
| T2 | 增加 `ascii` 误判兜底 | Service(global + worker) | 检测层与解码层都对 `ascii` + 非 ASCII 字节做兜底 | 不再按错误 `ascii` 解码中文 | ✅ 已完成 |
| T3 | 补充/修正单测 | Test | 增加 BOM、长英文前缀+中文正文等用例 | 新场景稳定通过 | ✅ 已完成 |
| T4 | 解码层轻量保护落地 | Service(worker) | `readFileRawText` 增加 `ascii` 误判兜底,并复用全局 `hasNonAsciiByte` | 上游误判时仍输出可读文本 | ✅ 已完成 |
| T5 | 编码回归矩阵补齐 | Test | 新增 `encoding.regression.test.ts` 覆盖 4 类编码回归场景 | 回归矩阵全通过 | ✅ 已完成 |
## 2. 文件级改动清单
| 文件路径 | 改动类型 | 变更摘要 | 关联任务ID |
|---|---|---|---|
| `FastGPT/packages/global/common/file/tools.ts` | 修改 | 新增 `hasUtf8Bom``isValidUtf8``getDetectSample`、导出 `hasNonAsciiByte``detectFileEncoding` 改为验证优先策略 | T1,T2 |
| `FastGPT/packages/service/worker/readFile/extension/rawText.ts` | 修改 | 删除本地重复 `hasNonAsciiByte`,改为复用全局工具;`ascii` + 非 ASCII 字节时改走 UTF-8 解码 | T2,T4 |
| `FastGPT/test/cases/global/common/file/tool.test.ts` | 修改 | 新增 UTF-8 BOM 测试;新增“长英文前缀 + 中文正文”测试;替换旧弱断言用例语义 | T3 |
| `FastGPT/test/cases/service/common/file/read/encoding.regression.test.ts` | 新增 | 新增编码回归矩阵(UTF-8 混排、ASCII、ascii 误传、非法 UTF-8) | T5 |
## 3. 后端实施说明
### 3.1 API 改动
| 路由 | 方法 | 请求参数 | 响应结构 | 鉴权 | 错误处理 |
|---|---|---|---|---|---|
| N/A | N/A | N/A | N/A | N/A | N/A |
说明:本需求仅涉及文件编码判定与解码策略,不改 API 合约。
### 3.2 Service/Core 改动
| 模块 | 函数/类型 | 具体改动 | 依赖关系 |
|---|---|---|---|
| `packages/global/common/file/tools.ts` | `detectFileEncoding` | 判定顺序改为:`BOM -> strict UTF-8 validate -> jschardet fallback`;对 `ascii` + 非 ASCII 字节做兜底 | 仅使用现有 `jschardet`,未新增依赖 |
| `packages/global/common/file/tools.ts` | `hasNonAsciiByte` | 由私有函数改为导出,供多处复用 | 复用方为 service worker 解码逻辑 |
| `packages/service/worker/readFile/extension/rawText.ts` | `readFileRawText` | 新增 `normalizedEncoding`,在 `encoding='ascii'` 且检测到非 ASCII 字节时强制按 UTF-8 解码 | 复用 `@fastgpt/global/common/file/tools` |
### 3.3 数据层改动
| 集合/表 | 字段 | 类型 | 必填 | 默认值 | 索引 | 迁移策略 |
|---|---|---|---|---|---|---|
| N/A | N/A | N/A | N/A | N/A | N/A | 无需迁移 |
## 4. 前端实施说明
| 页面/组件 | 文件路径 | 交互变化 | i18n 改动 | 状态覆盖 |
|---|---|---|---|---|
| N/A | N/A | 无 | 无 | N/A |
## 5. 日志与可观测性
| 触发点 | 日志级别 | category | 字段 | 备注 |
|---|---|---|---|---|
| 本期无新增日志点 | N/A | N/A | N/A | 为最小改动未加新日志,后续可按需要加 debug 观测 |
## 6. 测试与验证
### 6.1 自动化测试清单(已执行)
| 测试文件 | 覆盖重点 | 结果 |
|---|---|---|
| `test/cases/global/common/file/tool.test.ts` | 编码检测基础能力(UTF-8、ASCII、BOM、混排场景) | ✅ 通过 |
| `test/cases/service/common/file/read/utils.test.ts` | 文件读取主链路(readFileContentByBuffer) | ✅ 通过 |
| `test/cases/service/common/file/gridfs/utils.test.ts` | 预览流编码链路(stream2Encoding) | ✅ 通过 |
| `test/cases/service/common/file/read/encoding.regression.test.ts` | 编码回归矩阵(4 场景) | ✅ 通过 |
### 6.2 回归矩阵(新增)
| 场景 | 输入 | 预期 | 结果 |
|---|---|---|---|
| UTF-8 混排正文 | 长英文前缀 + 中文正文(UTF-8) | 检测 `utf-8`,中文可读 | ✅ |
| 纯 ASCII 文本 | `Hello ASCII 123` | 行为不变 | ✅ |
| `ascii` 误传 | UTF-8 中文 buffer + `encoding='ascii'` | 触发兜底,中文可读 | ✅ |
| 非法 UTF-8 序列 | 非 UTF-8 合法字节序列 | 不应判为 `utf-8` | ✅ |
### 6.3 执行命令与结果
执行命令:
```bash
pnpm -C FastGPT exec vitest run \
test/cases/global/common/file/tool.test.ts \
test/cases/service/common/file/read/utils.test.ts \
test/cases/service/common/file/gridfs/utils.test.ts \
test/cases/service/common/file/read/encoding.regression.test.ts
```
结果摘要:
- Test Files: `4 passed (4)`
- Tests: `45 passed (45)`
### 6.4 UTF-8 严格校验性能检测报告(新增)
#### 6.4.1 检测背景
- 目标:评估 `isValidUtf8(buffer)` 全量线性扫描在大文件场景下的 CPU 开销,确认是否需要阈值门控。
- 方法:在本地通过 Node.js 基准脚本,复用当前实现逻辑,分别对 ASCII 缓冲区与中英混排 UTF-8 缓冲区做多轮扫描取平均值。
#### 6.4.2 检测结果(平均单次扫描耗时)
| 文件大小 | ASCII only | UTF-8 中英混排 |
|---|---:|---:|
| 10MB | 16.20ms | 32.21ms |
| 50MB | 84.04ms | 87.52ms |
| 100MB | 160.06ms | 169.08ms |
| 200MB | 327.01ms | 345.51ms |
| 500MB | 894.27ms | 880.22ms |
补充:实测吞吐约 `560~620 MB/s`,整体符合线性增长特征(O(n))。
#### 6.4.3 结论与策略
- 20MB 以下:开销较小,通常无体感影响。
- 50~100MB:开始出现可感知延迟。
- 200MB 以上:单次扫描约 300ms+,并发场景下会放大 CPU 压力。
- 500MB:接近 1 秒/次,不建议默认全量严格校验。
建议落地策略:
1. 交互链路默认仅对 `<=32MB`(或 `<=64MB`)执行全量 UTF-8 严格校验。
2. 超过阈值时跳过全量校验,改走采样探测 fallback。
3. 后续可按线上机器规格和峰值并发再微调阈值。
## 7. 质量自检清单
- [x] 输入与权限流程未被破坏(未改 API/权限逻辑)
- [x] 无新增 `any` 滥用、无未处理 Promise
- [x] 包依赖方向符合 monorepo 约束(`service` 复用 `global`
- [x] 覆盖关键回归场景(UTF-8 混排、ascii 误判兜底)
- [x] 无新增敏感日志输出
## 8. 发布与回滚
### 8.1 发布步骤
1. 合并代码后在测试环境执行上述 4 组回归测试。
2. 手工上传 UTF-8 中英混排 Markdown,确认预览与入库内容正常。
3. 观察线上相关解析失败反馈。
### 8.2 回滚触发条件
- 发布后出现明显新增的非 UTF-8 文本解析失败反馈。
### 8.3 回滚步骤
1. 回滚 `FastGPT/packages/global/common/file/tools.ts``FastGPT/packages/service/worker/readFile/extension/rawText.ts`
2. 重新发布并复测上传链路。
## 9. AI 实施提示(给执行模型)
- 编码检测必须坚持“验证优先”,禁止回退到“仅前缀猜测优先”。
- 若后续扩展多候选编码评分,单独开需求,不在本任务内扩大范围。
- 每次改动编码策略后,必须至少跑本文件第 6.3 节的回归命令。
# 需求设计文档
# 需求设计文档
## 0. 文档标识
- 任务前缀:`md-encoding-repair`
- 文档文件名:`md-encoding-repair-需求设计文档.md`
- 文档状态:已补全(实施回填版)
- 最后更新:2026-04-15
## 1. 需求背景与目标
### 1.1 背景
- 问题现状:知识库上传 `.md` 文件时,若文件开头英文占比高,系统可能将编码误判为 `ascii`,随后按 `ascii` 解码整篇文本,导致中文出现乱码。
- 触发场景:`md/txt/csv/html` 等文本文件,文件前部主要为英文,中文内容出现在较后位置。
### 1.2 目标
- 业务目标:保证知识库文档上传后中文内容可被正确解析并进入分段/训练链路。
- 技术目标:避免“前部英文导致整篇 `ascii` 误判”的编码检测缺陷。
- 成功指标(可量化):
- 构造“前 500+ 字节英文、后续中文”的 UTF-8 Markdown 文件,解析结果中文不乱码。
- 纯英文 ASCII 文件解析结果保持不变。
- 编码相关回归测试全量通过。
## 2. 当前项目事实基线(基于代码)
| 能力项 | 现有实现位置(文件路径) | 现状说明 | 结论(复用/修改/新增) |
|---|---|---|---|
| API | `FastGPT/projects/app/src/pages/api/core/dataset/collection/create/fileId.ts` | 上传后创建文件型 collection 的入口;本身不处理编码,只触发后续解析流程 | 复用 |
| Core Service | `FastGPT/packages/service/core/dataset/read.ts` -> `FastGPT/packages/service/common/s3/sources/dataset/index.ts` | 读取 S3 文件后调用 `detectFileEncoding(buffer)`,再把 encoding 传给解析器 | 复用调用链,修改编码策略实现 |
| Worker Decode | `FastGPT/packages/service/worker/readFile/extension/rawText.ts` | 根据上游 encoding 对文本 buffer 解码 | 新增解码兜底保护 |
| DB Schema | `FastGPT/packages/service/core/dataset/collection/schema.ts` | 当前问题与 DB 结构无关 | 不改 |
| Frontend | `FastGPT/projects/app/src/pageComponents/dataset/detail/Import/diffSource/FileLocal.tsx` | 前端只负责上传到 S3,不决定后端解析编码 | 不改 |
| Logger | `FastGPT/packages/service/common/s3/sources/dataset/index.ts` | 当前已有下载日志;编码误判场景无专门日志 | 本期不改 |
关键代码锚点(实施后):
- 编码判定入口:`FastGPT/packages/global/common/file/tools.ts``detectFileEncoding`(已改为验证优先)
- 解码兜底:`FastGPT/packages/service/worker/readFile/extension/rawText.ts``readFileRawText`
## 3. 需求澄清记录
| 维度 | 已确认内容 | 待确认内容 | 备注 |
|---|---|---|---|
| 业务目标 | 修复 Markdown 上传中文乱码 | 是否覆盖更多小众本地编码(如 Shift_JIS) | 后续二期可评估 |
| 范围边界 | 聚焦知识库/读文件链路的编码判定与解码保护 | 是否新增线上编码判定日志点 | 本期不做 |
| 权限模型 | 无权限模型变化 | 无 | N/A |
| 数据模型 | 不新增字段 | 无 | N/A |
| API 行为 | 不改 API 入参/出参 | 无 | N/A |
| 前端交互 | 不改页面交互 | 无 | N/A |
## 3.1 影响域判定(先判定,再核对规范)
| 维度 | 是否命中 | 证据(需求/代码锚点) | 核对规范 | 结论 |
|---|---|---|---|---|
| API | No | 编码问题发生在服务端文件解析,现有路由仅透传 fileId | `style/api.md` | Not Applicable(不改接口) |
| DB | No | 不涉及 schema/索引/数据迁移 | `style/db.md` | Not Applicable |
| Front | No | 上传流程不参与后端解码决策 | `style/front.md` | Not Applicable |
| Logger | No(本期) | 本期目标为最小可控修复,未新增观测点 | `style/logger.md` | Not Applicable |
| Package | Yes | 修改位置在 `packages/global``packages/service`,涉及跨包复用 | `style/package.md` | 已遵守依赖方向(service 依赖 global) |
## 4. 范围定义
### 4.1 In Scope(本期必须)
-`detectFileEncoding` 从“猜测优先”调整为“验证优先”。
- 增加 `ascii` 误判保护(检测层+解码层双保险)。
- 补充编码回归测试矩阵,覆盖核心场景。
### 4.2 Out of Scope(本期不做)
- 不改知识库 API 协议。
- 不改数据库结构。
- 不做前端上传流程改造。
- 不引入多候选编码评分引擎(后续可独立需求)。
## 5. 方案对比
| 方案 | 核心思路 | 优点 | 风险 | 实施成本 | 结论 |
|---|---|---|---|---|---|
| 方案A(最小改动) | `UTF-8 验证优先(BOM + 严格字节校验)` + fallback 探测 + `ascii` 兜底 | 改动集中、确定性高、能直接修复现网主问题 | 对极端小众编码仍依赖 fallback | 低 | 推荐并已落地 |
| 方案B(可扩展) | 多候选编码试解 + 文本质量打分 | 覆盖更多边缘编码场景 | 复杂度与误判调参成本高 | 中-高 | 本期不选 |
推荐方案:方案A(已实施)。
## 6. 推荐方案详细设计(实施回填)
### 6.1 API 设计
| 路由 | 方法 | 鉴权 | 请求 | 响应 | 错误分支 | 相关文件 |
|---|---|---|---|---|---|---|
| N/A | N/A | N/A | N/A | N/A | N/A | 不涉及 |
### 6.2 数据设计
| 实体/集合 | 字段 | 类型 | 必填 | 默认值 | 索引/约束 | 兼容策略 |
|---|---|---|---|---|---|---|
| N/A | N/A | N/A | N/A | N/A | N/A | N/A |
### 6.3 核心代码设计
| 模块 | 关键函数/类型 | 实际变更 | 上下游影响 |
|---|---|---|---|
| `FastGPT/packages/global/common/file/tools.ts` | `detectFileEncoding(buffer)` | 判定顺序调整为:`hasUtf8Bom -> isValidUtf8 -> detect(getDetectSample)`;并增加 `ascii + 非 ASCII 字节` 兜底 | 所有调用方收益(知识库、工作流读文件、预览编码头) |
| `FastGPT/packages/global/common/file/tools.ts` | `hasNonAsciiByte(buffer)` | 从私有函数提升为导出工具函数,供多处复用 | 减少重复实现,维护单一事实源 |
| `FastGPT/packages/service/worker/readFile/extension/rawText.ts` | `readFileRawText` | 新增 `encoding='ascii'` 且存在非 ASCII 字节时强制 UTF-8 解码保护 | 防止上游误判导致中文乱码 |
| `FastGPT/test/cases/global/common/file/tool.test.ts` | `detectFileEncoding` tests | 新增 BOM 场景、长英文前缀+中文正文场景 | 防回归 |
| `FastGPT/test/cases/service/common/file/read/encoding.regression.test.ts` | 编码回归矩阵 | 新增 4 场景覆盖:UTF-8 混排、ASCII、ascii 误传、非法 UTF-8 | 回归覆盖补齐 |
### 6.4 前端设计
| 页面/组件 | 入口文件 | 交互状态(加载/空/错/成功) | i18n key | 变更说明 |
|---|---|---|---|---|
| N/A | N/A | N/A | N/A | 本期不涉及 |
### 6.5 日志与观测设计
| 场景 | 日志级别 | category | 结构化字段 | 脱敏策略 |
|---|---|---|---|---|
| 本期无新增日志 | N/A | N/A | N/A | N/A |
## 7. 风险、迁移与回滚
### 7.1 风险清单
- 风险1:严格 UTF-8 校验为 O(n) 线性扫描,超大文本文件会增加少量 CPU。
- 风险2:小众非 UTF-8 编码仍可能依赖 fallback 的稳定性。
### 7.2 迁移策略
- 无 DB 迁移。
- 通过新增回归矩阵 + 现有测试集进行功能验证。
### 7.3 回滚策略
- 回滚目标文件:
- `FastGPT/packages/global/common/file/tools.ts`
- `FastGPT/packages/service/worker/readFile/extension/rawText.ts`
- 回滚触发条件:发布后出现显著新增的“非 UTF-8 文本解析异常”反馈。
## 8. 验收标准(执行结果)
| 验收项 | 验收方式 | 通过标准 | 结果 |
|---|---|---|---|
| UTF-8 混合文档不乱码 | 自动化测试 + 手测路径定义 | 中文片段解析正常 | ✅ 通过 |
| 纯 ASCII 文档兼容 | 自动化测试 | 行为不回归 | ✅ 通过 |
| `ascii` 误传防护 | 自动化测试 | 解码结果中文可读 | ✅ 通过 |
| 回归安全 | 编码相关测试集合 | 全部通过 | ✅ 45/45 |
已执行测试命令:
```bash
pnpm -C FastGPT exec vitest run \
test/cases/global/common/file/tool.test.ts \
test/cases/service/common/file/read/utils.test.ts \
test/cases/service/common/file/gridfs/utils.test.ts \
test/cases/service/common/file/read/encoding.regression.test.ts
```
测试结果摘要:
- Test Files: `4 passed (4)`
- Tests: `45 passed (45)`
## 9. MECE 核查结论(实施后)
### 9.1 相互独立检查结果
- 发现问题:编码检测与解码保护存在重复判断风险。
- 影响范围:后续维护可能出现策略漂移。
- 修订动作:统一由 `tools.ts` 提供通用工具(`hasNonAsciiByte`),`rawText.ts` 仅做末端防护。
- 修订后结果:职责清晰,复用一致。
### 9.2 完全穷尽检查结果
- 发现问题:仅修检测层不足以防止历史调用链误传 `ascii`
- 影响范围:部分链路仍可能乱码。
- 修订动作:增加解码层二次兜底 + 回归矩阵覆盖误传场景。
- 修订后结果:正常/异常链路覆盖完整。
### 9.3 修订动作与最终边界
- 本期聚焦编码检测与解码兜底,不扩展 API/DB/前端。
- 后续若要支持更广泛本地编码智能识别,建议单开“多候选评分”二期需求。
# TODO — 变量更新节点类型操作扩展
> 设计见同目录 `design.md`
## Phase 1:类型 & 运行时(后端,先行)
- [x] 扩展 `TUpdateListItem` 类型,新增 `numberOperator / booleanMode / arrayMode`
- [x] `runUpdateVar.ts`:添加 oldValue 读取工具函数
- [x] `runUpdateVar.ts`:Number 公式分派(含除零保持旧值)
- [x] `runUpdateVar.ts`:Boolean `true/false/negate` 分派
- [x] `runUpdateVar.ts`:Array `append/clear/equal` 分派(append 使用元素类型做 `valueTypeFormat`
- [x] `runUpdateVar.ts`:所有新字段仅在 `renderType === input` 时生效的 guard
- [x] 写 vitest 测试 `runUpdateVar.test.ts`,运行通过(20 tests)
## Phase 2:前端组件拆分(重构,不改行为)
- [x] 建立目录 `NodeVariableUpdate/`
- [x] 把现有 `NodeVariableUpdate.tsx` 迁到 `NodeVariableUpdate/index.tsx`,拆出 `VariableSelector.tsx`
- [x] 新增 `ValueRenderer.tsx`(按 renderType / valueType 派发)
## Phase 3:前端渲染器(新功能)
- [x] `renderers/NumberFormula.tsx`:运算符下拉 + numberInput(图标化)
- [x] `renderers/BooleanSelect.tsx`:True/False/Negate 下拉
- [x] `renderers/ArrayValue.tsx`:模式下拉 + 按元素类型映射 `InputRender`(不递归)
- [x] `ValueRenderer.tsx`:按 valueType 派发到新 renderer
- [x] 切换模式时清空 `value: undefined`
## Phase 4:i18n
- [x] 补充 `workflow:var_update_boolean_*``workflow:var_update_array_*` 中 / 英 / 繁中
## Phase 5:联调
- [x] dev server 起:string / number / boolean / array 四类变量逐一验证手动输入 + 引用两种模式
- [x] 老数据打开(无新字段),表现与升级前一致
- [x] 运行 `pnpm lint` 全量通过(0 errors)
## Phase 6:Review 清理(2026-04-15)
- [x] 还原 `constants.ts`:剥离 107 条与 math icons 无关的图标注册,只保留 5 个 `math/*`
- [x] `any[]` 收紧为 `EditorVariablePickerType[]` / `EditorVariableLabelPickerType[]`(3 个 renderer + ValueRenderer)
- [x] 抽出 `getDefaultsForValueType()` 统一目标变量切换时的默认字段下发
- [x] `VariableSelector.tsx``.includes('array')``.startsWith('array')` 与仓内风格对齐
- [x] `workflow.json` 三语把 `var_update_*` 按字母序移到 `variable_*` 之前
---
name: local-review
description: 当用户请求对本地未提交的代码(或本地分支特定 commit 等)进行代码审查时触发该 skill,对本地变更进行审查。
---
# When to Use This Skill
当用户请求本地审查时触发。本技能支持对以下三种变更范围进行环境友好的深度审查:
1. **未提交的变更 (Uncommitted)**: 审查工作区中所有尚未提交的修改(包括已暂存和未暂存)。
2. **特定的历史 Commit (Recent Commits)**: 选定检查最近几次 commit(如 `HEAD~N`)的改动情况。
3. **主干差异对比 (Main Branch Diff)**: 与 `main` 等主干分支对比,整体审查当前特性的增量细节。
# Local Review 本地代码审查技能
> 在本地开发环境中,利用全量代码库的上下文优势,全面审查代码变更的质量、安全性、性能和架构设计,并自动评估跨文件影响,提供专业的改进建议。
## 审查范围与启动方式 (Scope Definitions)
你需要根据用户的指令意图,判断并选择对应的比对策略来拉取代码。**务必使用 `-U15` 等参数增加局部上下文视野**
### 模式 1:未提交审查 (Uncommitted Changes)
```bash
# 获取工作区未暂存及已暂存的混合全量 diff
git diff HEAD -U15
```
### 模式 2:特定历史 Commit 审查 (Recent Commits)
```bash
# 审查最后一次 commit
git diff HEAD~1 HEAD -U15
# 审查最近 3 次的整体 commit 变更 (数字可根据用户指令替换)
git diff HEAD~3 HEAD -U15
```
### 模式 3:主干差异审查 (Main Branch Diff)
```bash
# 审查当前特性分支相较于 main 主干的所有的增量代码
git diff main...HEAD -U15
```
## 工具集成
### 使用 git CLI 与本地工具加速审查
在本地环境审查时,相较于 PR 审查的局限点,我们要极大发挥能“到处跑、到处看”的优势。
```bash
# 获取已修改的文件列表及状态
git status -s
# 将宽泛上下文的 diff 存入临时文件便于分析
git diff -U15 > /tmp/local_changes.diff
# 跨文件依赖与上下文搜索(寻找受修改影响的引用方)
git grep "修改的函数名或类型"
```
### 本地测试与验证代码
本地审查时可以直接执行验证流程,以结果作为审查依据:
```bash
# 运行单元测试
pnpm test
# 运行代码规范检查
pnpm lint
# 运行类型检查以捕获变更导致的隐藏/全局类型错误
pnpm tsc --noEmit
# 启动开发服务器通过 UI 进行直观验证
pnpm dev
```
### 常见命令参考
```bash
# 获取具体的 diff 内容
git diff --name-only
git diff <file_path>
# 追溯某段代码的演进历史
git blame <file_path>
# 获取最近的 commit 记录
git log -n 5 --oneline
```
## 审查流程
### 1. 信息与上下文收集阶段 (⭐本地环境核心增强)
**切勿仅凭零碎的补丁代码(Diff chunks)盲目审查,务必建立完整的上下文认知:**
自动执行/指导执行以下步骤:
```bash
# 1. 确认当前的修改状态及涉及的文件
git status
# 2. 获取具有充足上下文的变更细节(-U15 或更大)
git diff -U15
# 3. 阅读全量文件(上下文增强):
# 对于重点修改的文件,不要只看 diff,而是查看整个源文件,理解数据流向和全貌。
cat <file_path>
# 4. 分析跨文件影响(上下文追踪):
# 如果改动涉及到变量名变更、导出方法的增删改、Props 类型更改,
# 必须使用本地搜索查出其在项目中的所有调用点:
git grep "<Edited_Target>"
```
### 2. 多维度代码审查
基于完整的调用链和文件上下文,按照以下维度进行系统性审查:
#### 维度 1: 基本代码质量标准 📐
通用的代码质量标准,适用于所有项目:
- **安全性**: 输入验证、权限检查、注入防护、敏感信息保护
- **正确性**: 错误处理、边界条件、类型安全(**结合上下文,看传参方是否提供了正确数据**
- **性能**: 算法复杂度、数据库优化、内存管理(**结合上下文,审查循环逻辑或多次重渲染问题**
- **可测试性**: 测试覆盖、测试质量、Mock 使用
📖 **详细指南**: [code-quality-standards.md](./code-quality-standards.md)
#### 维度 2: FastGPT 风格规范 🎨
FastGPT 项目特定的代码规范和约定:
- **API 路由开发**: 路由定义、权限验证、错误处理: [API 路由开发规范](./style/api.md)
- **前端组件开发**: TypeScript + React、Chakra UI、状态管理: [前端组件开发规范](./style/front.md)
- **数据库操作**: Model 定义、查询优化、索引设计: [数据库操作规范](./style/db.md)
- **包结构与依赖**: 依赖方向、导入规范、类型导出: [包结构与依赖规范](./style/package.md)
- **日志与可观测性**: 统一日志分类、结构化字段、敏感信息、OTEL 导出等审查标准: [日志review 标准](./style/logger.md)
#### 维度 3: 常见问题检查清单 🔍
快速识别和修复常见问题模式:
- **TypeScript 问题**: any 类型滥用、类型定义不完整、不安全断言
- **异步错误处理**: 未处理 Promise、错误信息丢失、静默失败
- **React 性能**: 不必要的重渲染、渲染中创建对象、缺少 memoization
- **工作流节点**: isEntry 未重置、交互历史未清理、白名单遗漏
- **安全漏洞**: 注入攻击、XSS、文件上传漏洞
📖 **详细清单**: [common-issues-checklist.md](./common-issues-checklist.md)
### 3. 生成并输出综合审查报告
本地审查输出主要通过对话框返回整体审查报告和行级建议。
#### 步骤 1: 结合上下文深度分析代码并准备评论
在详细审查阶段,记录之前通过额外探索收集的上下文论据:
- **全局视野**:这个改动是否打破了使用该模块的其他文件的运行?
- **文件路径**: 如 `packages/service/core/workflow/dispatch.ts`
- **行号 / 变更块**: 如 `L142-L150`
- **问题类型**: 🔴严重 / 🟡改进 / 🟢优化
- **评论内容**: 具体的问题描述和基于整体上下文推导出的深层建议
#### 步骤 2: 汇总代码审查评论
将所有的行级代码和上下文关联分析结果整合成一份连贯的内容:
```markdown
### 📍 代码级深层意见
#### `packages/service/core/workflow/dispatch.ts`
- **L142**: 🔴 **严重跨文件隐患**: 这里更改了返回值格式,但通过 `git grep` 追踪发现调用方的接收逻辑(如 `file_B.ts L30`)未进行相应的适配,将导致生产环境崩溃。
**建议**: 修改本处的兼容逻辑,或一并更新相关的调用方代码:
```typescript
// 提供结合了调用关系的修复代码
```
- **L150**: 🟡 **逻辑重构优化**: 结合该文件的大环境,该段正则其实在多个地方共享,建议提取到外部公共目录中复用。
```
#### 步骤 3: 生成整体审查报告
在对话框中提供类似以下的整体审查报告格式:
```markdown
# Local Review 代码审查报告
## 📊 审查面与追踪范围
- **本地变更类型**: 未暂存 / 已暂存 / 与某分支差异
- **变更统计**: +{additions} -{deletions} 行
- **涉及直接修改文件**: {files.length} 个
- **延伸上下文排查文件**: {context_files.length} 个(评估了相关的外链影响)
## ✅ 亮点与优点
{列出做得好的地方}
## ⚠️ 问题汇总
### 🔴 严峻环境问题 ({count} 个,必须修复)
{简要列出每个严重问题,并指向下文的详细行级评论}
### 🟡 建议与重构项 ({count} 个)
{简要列出每个建议}
### 🟢 局部优化选项 ({count} 个)
{简要列出优化建议}
---
{在此处插入包含上下文增强分析内容的 "📍 代码级深层意见"}
---
## 🧪 本地测试验证策略
{基于本次上下文排查所发现的影响范围,给出建议:例如某个隐性关联页面的渲染测试等}
## 💬 总体评价
- **代码质量**: ⭐⭐⭐⭐☆ (4/5)
- **安全性**: ⭐⭐⭐⭐⭐ (5/5)
- **性能**: ⭐⭐⭐⭐☆ (4/5)
- **全栈协调性**: ⭐⭐⭐⭐☆ (4/5) (反映修改对全局代码影响程度的好坏)
## 🚀 审查结论
{建议: 可以提交 / 修改后提交 / 建议将调用方文件的修复一起囊括}
```
#### 步骤 4: 响应用户并提供报告
输出或保存完整的 Markdown 报告,必要时提出主动帮用户把发现的联调问题(调用方 bug 等)以命令形式进行顺手修复的建议。
#### 本地审查命令快速补救参考:
| 场景 | 命令 |
|------|------|
| 修改后需重新审查暂存区 | `git diff --cached` |
| 检测改动后是否出现死类型 | `pnpm tsc --noEmit` |
| 放弃某个被污染的本地改动 | `git checkout -- <file>` |
# API 路由开发规范
FastGPT 使用 Next.js API Routes,需要遵循特定的开发模式。
### 2.1 路由定义
**文件位置**: `projects/app/src/pages/api/`
**审查要点**:
- ✅ 路由文件使用命名导出,不支持默认导出
- ✅ 使用 `NextAPIRequest``NextAPIResponse` 类型
- ✅ 支持的 HTTP 方法明确 (`GET`, `POST`, `PUT`, `DELETE`)
- ✅ 返回统一的响应格式
**示例**:
```typescript
import type { NextAPIRequest, NextAPIResponse } from '@fastgpt/service/type/next';
import { APIError } from '@fastgpt/service/core/error/controller';
export default async function handler(req: NextAPIRequest, res: NextAPIResponse) {
try {
if (req.method !== 'POST') {
throw new Error('Method not allowed');
}
// 处理逻辑...
const result = await processData(req.body);
res.json(result);
} catch (error) {
APIError(error)(req, res);
}
}
```
### 2.2 类型合约
**文件位置**: `packages/global/openapi/`
**审查要点**:
- ✅ API 合约定义在 OpenAPI 规范文件中
- ✅ 请求参数有完整的类型定义
- ✅ 响应格式有完整的类型定义
- ✅ 错误响应有说明
### 2.3 业务逻辑
**文件位置**:
- 通用逻辑: `packages/service/`
- 项目特定逻辑: `projects/app/src/service/`
**审查要点**:
- ✅ 业务逻辑与 API 路由分离
- ✅ 服务函数有明确的类型定义
- ✅ 错误处理统一
### 2.4 权限验证
**审查要点**:
- ✅ 所有 API 路由都有权限验证 (除了公开端点)
- ✅ 使用 `parseHeaderCert` 解析认证头
- ✅ 验证用户对资源的所有权
- ✅ 敏感操作需要额外验证
**示例**:
```typescript
import { parseHeaderCert } from '@fastgpt/global/support/permission/controller';
export default async function handler(req: NextAPIRequest, res: NextAPIResponse) {
try {
// 解析认证头
const { userId, teamId } = await parseHeaderCert(req);
// 验证权限
const resource = await Resource.findById(resourceId);
if (!resource || resource.userId !== userId) {
throw new Error('Permission denied');
}
// 继续处理...
} catch (error) {
APIError(error)(req, res);
}
}
```
### 2.5 错误处理
**审查要点**:
- ✅ 使用 try-catch 包裹所有异步操作
- ✅ 使用 `APIError` 统一错误响应
- ✅ 错误信息不暴露敏感数据
- ✅ HTTP 状态码正确
---
# 数据库操作规范
FastGPT 使用 MongoDB (Mongoose) 和 PostgreSQL。
## 4.1 Model 定义
**文件位置**: `packages/service/common/mongo/schema/`
**审查要点**:
- ✅ Schema 定义使用 TypeScript 泛型
- ✅ 必要的字段添加索引
- ✅ 敏感字段加密存储
- ✅ 定义虚拟字段和实例方法
**示例**:
```typescript
import { mongoose, Schema } from '@fastgpt/service/common/mongo';
const UserSchema = new Schema({
username: { type: String, required: true, unique: true },
password: { type: String, required: true, select: false }, // 默认不查询
email: { type: String, required: true },
createdAt: { type: Date, default: Date.now }
});
// 索引
UserSchema.index({ username: 1 });
UserSchema.index({ email: 1 });
// 虚拟字段
UserSchema.virtual('fullName').get(function() {
return `${this.firstName} ${this.lastName}`;
});
export const User = mongoose.model('User', UserSchema);
```
## 4.2 查询操作
**审查要点**:
- ✅ 使用参数化查询防止注入
- ✅ 避免 N+1 查询
- ✅ 使用 projection 只查询需要的字段
- ✅ 大结果集使用分页
- ✅ 异步操作有错误处理
**示例**:
```typescript
// ❌ 不好的实践
const users = await User.find({}).toArray(); // 可能返回大量数据
// ✅ 好的实践
const users = await User.find({})
.project({ username: 1, email: 1 }) // 只查询需要的字段
.limit(20) // 限制结果数量
.skip(page * 20)
.toArray();
```
## 4.3 错误处理
**审查要点**:
- ✅ 数据库操作使用 try-catch
- ✅ 处理重复键错误 (code 11000)
- ✅ 处理连接错误
- ✅ 错误日志包含上下文信息
---
# 前端组件开发规范
FastGPT 使用 React + TypeScript + Chakra UI。
## 3.1 组件结构
**审查要点**:
- ✅ 使用函数式组件和 Hooks
- ✅ 组件使用 `React.memo` 优化性能
- ✅ Props 有明确的类型定义
- ✅ 使用 TypeScript type 而不是 interface (项目约定)
**示例**:
```typescript
import React from 'react';
import { Box, Button } from '@chakra-ui/react';
type YourComponentProps = {
title: string;
onClick: () => void;
disabled?: boolean;
};
export const YourComponent = React.memo(function YourComponent({
title,
onClick,
disabled = false
}: YourComponentProps) {
return (
<Box>
<Button onClick={onClick} isDisabled={disabled}>
{title}
</Button>
</Box>
);
});
```
## 3.2 状态管理
**审查要点**:
- ✅ 本地状态使用 `useState`
- ✅ 全局状态使用 Zustand store
- ✅ 表单状态使用 `useForm` (react-hook-form)
- ✅ 复杂状态逻辑使用 `useReducer`
## 3.3 样式规范
**审查要点**:
- ✅ 优先使用 Chakra UI props
- ✅ 响应式设计使用 Chakra UI 的断点系统
- ✅ 自定义样式放在 `styles/theme.ts`
- ✅ 避免内联样式
**示例**:
```typescript
// ❌ 不好的实践
<Box style={{ backgroundColor: 'blue', padding: '16px' }}>
// ✅ 好的实践
<Box bg="blue.500" p={4}>
```
## 3.4 国际化
**审查要点**:
- ✅ 所有用户可见文本使用 `i18nT`
- ✅ 翻译 key 使用命名空间
- ✅ 动态文本使用插值
**示例**:
```typescript
import { i18nT } from '@fastgpt/web/i18n/utils';
const message = i18nT('user:welcome', { name: userName });
```
## 3.5 性能优化
**审查要点**:
- ✅ 列表渲染使用 key
- ✅ 大列表使用虚拟化
- ✅ 避免在渲染中创建新对象/函数
- ✅ 使用 `useMemo` 缓存计算结果
- ✅ 使用 `useCallback` 缓存函数
---
# 日志与可观测性审查标准
FastGPT 后端统一使用 `@fastgpt/service/common/logger`。日志需要可检索、可聚合、可回放,且避免敏感信息泄露。
## 1. 统一 Logger 接入
**审查要点**:
- ✅ 服务端统一使用 `@fastgpt/service/common/logger`,避免 `console.log`
- ✅ 启动入口只初始化一次 `configureLogger()`
- ✅ 使用 `getLogger(LogCategories.XXX)` 指定分类
- ✅ 未经讨论不要自定义 category 字符串数组
**示例**:
```ts
import { configureLogger, getLogger, LogCategories } from '@fastgpt/service/common/logger';
await configureLogger();
const logger = getLogger(LogCategories.SYSTEM);
logger.info('System initialized successfully');
```
## 2. 分类(Category)选择
**审查要点**:
-`SYSTEM` 用于系统级初始化与全局状态
-`INFRA.*` 用于数据库/缓存/队列/存储等
-`HTTP.*` 用于请求、响应、请求错误
-`MODULE.*` 用于业务模块(参考 `pages/api` 路径)
- ✅ 缺少分类时补充到 `packages/service/common/logger/categories.ts`
**问题示例**:
```ts
// ❌ 不规范:自定义字符串分类
const logger = getLogger(['custom', 'random']);
```
## 3. 结构化日志与消息规范
**审查要点**:
- ✅ 消息短、稳定、可检索
- ✅ 关键字段放在结构化对象中(id、状态、耗时、数量)
- ✅ 避免 `JSON.stringify` 拼接到消息里
- ✅ 避免在消息中包含用户输入或大段文本
**示例**:
```ts
// ✅ 推荐
logger.info('Vector queue task finished', { taskId, durationMs, count });
// ❌ 不推荐
logger.info(`Task finished: ${JSON.stringify({ taskId, durationMs, count })}`);
```
## 4. 错误日志标准
**审查要点**:
- ✅ 使用 `error` 字段记录 `Error` 对象,保留堆栈
- ✅ 错误日志包含关键上下文(teamId、datasetId、jobId 等)
- ✅ 捕获后必须记录或向上抛出,避免静默失败
**示例**:
```ts
try {
await doSomething();
} catch (error) {
logger.error('Do something failed', { error, teamId, datasetId });
throw error;
}
```
## 5. 日志等级规范
**审查要点**:
-`info` 用于阶段开始/完成
-`warn` 用于可恢复异常
-`error` 用于失败或影响流程的异常
- ✅ 高频循环日志必须使用 `debug/trace`
**示例**:
```ts
logger.info('Training started', { datasetId });
logger.debug('Training progress', { datasetId, step, total });
logger.warn('Retrying batch', { batchId, retryLeft });
logger.error('Training failed', { datasetId, error });
```
## 6. 请求/任务链路上下文
**审查要点**:
- ✅ HTTP 请求日志应带 `requestId`,优先使用 `withContext`
- ✅ 队列/定时任务日志应带 `jobId`/`queueName`
- ✅ 跨模块调用尽量保持同一上下文字段名
**示例**:
```ts
return withContext({ requestId }, async () => {
logger.info('Request received', { requestId, method, url });
});
```
## 7. 敏感信息与 OTEL
**审查要点**:
- ✅ 禁止输出 token、密钥、密码、完整对话内容
- ✅ 必须记录敏感信息时做脱敏或截断
- ✅ 需要阻止 OTEL 导出时,可添加 `fastgpt` 属性
**示例**:
```ts
logger.warn('Payload truncated for debug', {
fastgpt: true,
payloadPreview: payload.slice(0, 200)
});
```
# 5. 包结构与依赖规范
FastGPT 是一个 monorepo,使用 pnpm workspaces。
## 5.1 包结构
```
packages/
├── global/ # 类型、常量、工具函数 (无运行时依赖)
├── service/ # 后端服务、数据库模型 (依赖 global)
└── web/ # 前端组件、样式、i18n (依赖 global)
projects/
├── app/ # NextJS 应用 (依赖所有 packages)
├── sandbox/ # NestJS 沙箱服务 (独立应用)
└── mcp_server/ # MCP 服务器 (独立应用)
```
## 5.2 依赖规则
**审查要点**:
-`packages/global/` 无任何运行时依赖
-`packages/service/` 只依赖 `packages/global/`
-`packages/web/` 只依赖 `packages/global/`
-`projects/app/` 可以依赖所有 packages
- ✅ 独立项目 (sandbox, mcp_server) 最小化依赖
## 5.3 导入规范
**审查要点**:
- ✅ 使用项目别名导入: `@fastgpt/global`, `@fastgpt/service`, `@fastgpt/web`
- ✅ 避免相对路径导入跨包的文件
- ✅ 导入路径使用 index 简化
**示例**:
```typescript
// ❌ 不好的导入
import { UserType } from ../../../../../packages/global/core/user/type.d.ts;
// ✅ 好的导入
import { UserType } from '@fastgpt/global/core/user/type';
```
## 5.4 类型导出
**审查要点**:
- ✅ 公共类型必须导出
- ✅ 类型文件使用 `.d.ts` 扩展名
- ✅ 复杂类型放在独立的类型文件
- ✅ 使用 `export type` 导出类型
---
...@@ -28,6 +28,7 @@ packages/ ...@@ -28,6 +28,7 @@ packages/
│ ├── schema.ts # App 主表 Mongoose Schema │ ├── schema.ts # App 主表 Mongoose Schema
│ ├── entity.ts # findById / create / updateById 等基础操作封装 │ ├── entity.ts # findById / create / updateById 等基础操作封装
│ ├── service.ts # 聚合业务逻辑(跨子功能协调),不允许互相引用,只允许单向依赖,跨 service 的协调需由上层通过 props 传入另一个 service 或者衍生方法 │ ├── service.ts # 聚合业务逻辑(跨子功能协调),不允许互相引用,只允许单向依赖,跨 service 的协调需由上层通过 props 传入另一个 service 或者衍生方法
│ ├── auth.ts # 鉴权相关(如有)
│ ├── utils.ts # 纯函数工具,无副作用,可独立单测 │ ├── utils.ts # 纯函数工具,无副作用,可独立单测
│ ├── version/ │ ├── version/
│ │ ├── schema.ts │ │ ├── schema.ts
...@@ -87,7 +88,8 @@ const service2 = (props: {id:string; service1: typeof service1 }) => { ...@@ -87,7 +88,8 @@ const service2 = (props: {id:string; service1: typeof service1 }) => {
- 一个目录内无需拆子功能时,直接放 `schema.ts` + `entity.ts` + `service.ts` + `utils.ts` - 一个目录内无需拆子功能时,直接放 `schema.ts` + `entity.ts` + `service.ts` + `utils.ts`
- 多个 schema 文件(如 `evalSchema.ts` + `evalItemSchema.ts`**合并**到单个 `schema.ts` - 多个 schema 文件(如 `evalSchema.ts` + `evalItemSchema.ts`**合并**到单个 `schema.ts`
## 使用 `type` 进行类型声明,不使用 `interface` ## 代码风格
### 使用 `type` 进行类型声明,不使用 `interface`
```typescript ```typescript
// ❌ 不好的实践 // ❌ 不好的实践
...@@ -105,7 +107,7 @@ type User = { ...@@ -105,7 +107,7 @@ type User = {
--- ---
## 使用 IIFE 写法来取代 if/else 进行变量条件赋值。 ### 使用 IIFE 写法来取代 if/else 进行变量条件赋值。
```typescript ```typescript
// ❌ 不好的实践 // ❌ 不好的实践
...@@ -126,7 +128,7 @@ const value = (() => { ...@@ -126,7 +128,7 @@ const value = (() => {
--- ---
## 类型推导:Zod schema 同时承担校验和类型 ### 类型推导:Zod schema 同时承担校验和类型
`z.infer` 从 schema 推导类型,不重复手写相同结构的 type。 `z.infer` 从 schema 推导类型,不重复手写相同结构的 type。
...@@ -158,7 +160,7 @@ onProgress?.({ phase: 'creatingContainer' }); ...@@ -158,7 +160,7 @@ onProgress?.({ phase: 'creatingContainer' });
--- ---
## 空值合并取默认值 ### 空值合并取默认值
`??` 取代 `||` 处理默认值,避免 `0``false``''` 被错误覆盖。 `??` 取代 `||` 处理默认值,避免 `0``false``''` 被错误覆盖。
...@@ -174,7 +176,7 @@ const text = item?.value ?? ''; ...@@ -174,7 +176,7 @@ const text = item?.value ?? '';
--- ---
## 解构重命名 ### 解构重命名
同名变量来自多个来源时,解构时重命名,避免命名冲突。 同名变量来自多个来源时,解构时重命名,避免命名冲突。
...@@ -192,7 +194,7 @@ const inputTokens = guidanceUsage.inputTokens + generateUsage.inputTokens; ...@@ -192,7 +194,7 @@ const inputTokens = guidanceUsage.inputTokens + generateUsage.inputTokens;
--- ---
## 类型守卫 ### 类型守卫
`is` 关键字收窄 `unknown` / `any` 类型,替代强制断言。 `is` 关键字收窄 `unknown` / `any` 类型,替代强制断言。
...@@ -213,7 +215,7 @@ if (isValidNumber(value)) { ...@@ -213,7 +215,7 @@ if (isValidNumber(value)) {
--- ---
## 非关键清理用 `.catch()` 链 ### 非关键清理用 `.catch()` 链
次要的清理操作(不影响主流程)用 `.catch()` 吞掉错误,不污染主 try/catch。 次要的清理操作(不影响主流程)用 `.catch()` 吞掉错误,不污染主 try/catch。
...@@ -231,7 +233,7 @@ await client.delete().catch(() => {}); ...@@ -231,7 +233,7 @@ await client.delete().catch(() => {});
--- ---
## 函数参数不超过 2 个,多参数用对象传递 ### 函数参数不超过 2 个,多参数用对象传递
独立参数不超过 2 个,超过时改为对象参数,便于扩展且无需关心顺序。 独立参数不超过 2 个,超过时改为对象参数,便于扩展且无需关心顺序。
...@@ -245,7 +247,7 @@ function createVersion(data: { skillId: string; teamId: string; tmbId: string; v ...@@ -245,7 +247,7 @@ function createVersion(data: { skillId: string; teamId: string; tmbId: string; v
--- ---
## 数据写操作函数支持可选 session 参数 ### 数据写操作函数支持可选 session 参数
涉及数据库写操作的函数统一支持可选的 `session` 参数,便于上层组合事务。事务统一通过 `mongoSessionRun` 发起,内部自动处理 startTransaction / commit / abort / retry。 涉及数据库写操作的函数统一支持可选的 `session` 参数,便于上层组合事务。事务统一通过 `mongoSessionRun` 发起,内部自动处理 startTransaction / commit / abort / retry。
......
...@@ -26,7 +26,6 @@ jobs: ...@@ -26,7 +26,6 @@ jobs:
- uses: pnpm/action-setup@v4 - uses: pnpm/action-setup@v4
with: with:
version: 9 version: 9
- name: 'Install Deps' - name: 'Install Deps'
run: pnpm install run: pnpm install
- name: 'Test' - name: 'Test'
......
...@@ -51,7 +51,7 @@ vector.vector.db = String(vectordb); ...@@ -51,7 +51,7 @@ vector.vector.db = String(vectordb);
replace(template, 'cn', VectorEnum.vector) replace(template, 'cn', VectorEnum.vector)
), ),
fs.promises.writeFile( fs.promises.writeFile(
path.join(process.cwd(), 'docker', 'global', 'docker-compose.ziliiz.yml'), path.join(process.cwd(), 'docker', 'global', 'docker-compose.zilliz.yml'),
replace(template, 'global', VectorEnum.vector) replace(template, 'global', VectorEnum.vector)
), ),
``` ```
......
...@@ -265,6 +265,8 @@ services: ...@@ -265,6 +265,8 @@ services:
- 8090:8090 - 8090:8090
networks: networks:
- fastgpt - fastgpt
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载
configs: configs:
......
...@@ -265,6 +265,8 @@ services: ...@@ -265,6 +265,8 @@ services:
- 8090:8090 - 8090:8090
networks: networks:
- fastgpt - fastgpt
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载
configs: configs:
......
...@@ -41,7 +41,7 @@ x-log-config: &x-log-config ...@@ -41,7 +41,7 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
MILVUS_ADDRESS: http://fastgpt-milvus-standalone:19530 MILVUS_ADDRESS: http://fastgpt-vector:19530
MILVUS_TOKEN: none MILVUS_TOKEN: none
...@@ -82,7 +82,7 @@ services: ...@@ -82,7 +82,7 @@ services:
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
fastgpt-milvus-standalone: fastgpt-vector:
container_name: fastgpt-milvus-standalone container_name: fastgpt-milvus-standalone
image: milvusdb/milvus:v2.4.3 image: milvusdb/milvus:v2.4.3
command: ['milvus', 'run', 'standalone'] command: ['milvus', 'run', 'standalone']
...@@ -92,8 +92,7 @@ services: ...@@ -92,8 +92,7 @@ services:
ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379 ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379
MINIO_ADDRESS: fastgpt-milvus-minio:9000 MINIO_ADDRESS: fastgpt-milvus-minio:9000
networks: networks:
- fastgpt - data
- vector
volumes: volumes:
- fastgpt-milvus-data:/var/lib/milvus - fastgpt-milvus-data:/var/lib/milvus
healthcheck: healthcheck:
...@@ -111,7 +110,7 @@ services: ...@@ -111,7 +110,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -158,7 +157,7 @@ services: ...@@ -158,7 +157,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -178,7 +177,7 @@ services: ...@@ -178,7 +177,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -197,15 +196,28 @@ services: ...@@ -197,15 +196,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-milvus-standalone fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -245,6 +257,7 @@ services: ...@@ -245,6 +257,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -283,7 +296,7 @@ services: ...@@ -283,7 +296,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -318,9 +331,13 @@ services: ...@@ -318,9 +331,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -328,7 +345,7 @@ services: ...@@ -328,7 +345,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -340,7 +357,8 @@ services: ...@@ -340,7 +357,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -351,6 +369,8 @@ services: ...@@ -351,6 +369,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -367,16 +387,24 @@ services: ...@@ -367,16 +387,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -399,9 +427,9 @@ services: ...@@ -399,9 +427,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -430,7 +458,6 @@ services: ...@@ -430,7 +458,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -469,9 +496,11 @@ services: ...@@ -469,9 +496,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -503,7 +532,7 @@ configs: ...@@ -503,7 +532,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,19 +41,19 @@ x-log-config: &x-log-config ...@@ -41,19 +41,19 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-ob:2881/mysql OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-vector:2881/mysql
services: services:
# Vector DB # Vector DB
fastgpt-ob: fastgpt-vector:
image: oceanbase/oceanbase-ce:4.3.5-lts image: oceanbase/oceanbase-ce:4.3.5-lts
container_name: fastgpt-ob container_name: fastgpt-ob
restart: always restart: always
# ports: # 生产环境建议不要暴露 # ports: # 生产环境建议不要暴露
# - 2881:2881 # - 2881:2881
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- OB_SYS_PASSWORD=obsyspassword - OB_SYS_PASSWORD=obsyspassword
...@@ -88,7 +88,7 @@ services: ...@@ -88,7 +88,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -135,7 +135,7 @@ services: ...@@ -135,7 +135,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -155,7 +155,7 @@ services: ...@@ -155,7 +155,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -174,15 +174,28 @@ services: ...@@ -174,15 +174,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-ob fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -222,6 +235,7 @@ services: ...@@ -222,6 +235,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -260,7 +274,7 @@ services: ...@@ -260,7 +274,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -295,9 +309,13 @@ services: ...@@ -295,9 +309,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -305,7 +323,7 @@ services: ...@@ -305,7 +323,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -317,7 +335,8 @@ services: ...@@ -317,7 +335,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -328,6 +347,8 @@ services: ...@@ -328,6 +347,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -344,16 +365,24 @@ services: ...@@ -344,16 +365,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -376,9 +405,9 @@ services: ...@@ -376,9 +405,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -407,7 +436,6 @@ services: ...@@ -407,7 +436,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -446,9 +474,11 @@ services: ...@@ -446,9 +474,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -480,7 +510,7 @@ configs: ...@@ -480,7 +510,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,16 +41,16 @@ x-log-config: &x-log-config ...@@ -41,16 +41,16 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
PG_URL: postgresql://username:password@fastgpt-pg:5432/postgres PG_URL: postgresql://username:password@fastgpt-vector:5432/postgres
services: services:
# Vector DB # Vector DB
fastgpt-pg: fastgpt-vector:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15
container_name: fastgpt-pg container_name: fastgpt-pg
restart: always restart: always
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- POSTGRES_USER=username - POSTGRES_USER=username
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -116,7 +116,7 @@ services: ...@@ -116,7 +116,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -136,7 +136,7 @@ services: ...@@ -136,7 +136,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -155,15 +155,28 @@ services: ...@@ -155,15 +155,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-pg fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -203,6 +216,7 @@ services: ...@@ -203,6 +216,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -241,7 +255,7 @@ services: ...@@ -241,7 +255,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -276,9 +290,13 @@ services: ...@@ -276,9 +290,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -286,7 +304,7 @@ services: ...@@ -286,7 +304,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -298,7 +316,8 @@ services: ...@@ -298,7 +316,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -309,6 +328,8 @@ services: ...@@ -309,6 +328,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -325,16 +346,24 @@ services: ...@@ -325,16 +346,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -357,9 +386,9 @@ services: ...@@ -357,9 +386,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -388,7 +417,6 @@ services: ...@@ -388,7 +417,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -427,9 +455,11 @@ services: ...@@ -427,9 +455,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -461,7 +491,7 @@ configs: ...@@ -461,7 +491,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,12 +41,12 @@ x-log-config: &x-log-config ...@@ -41,12 +41,12 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-seekdb:2881/mysql SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-vector:2881/mysql
services: services:
# Vector DB # Vector DB
fastgpt-seekdb: fastgpt-vector:
image: oceanbase/seekdb:1.0.1.0-100000392025122619 image: oceanbase/seekdb:1.0.1.0-100000392025122619
container_name: fastgpt-seekdb container_name: fastgpt-seekdb
restart: always restart: always
...@@ -54,7 +54,7 @@ services: ...@@ -54,7 +54,7 @@ services:
# - 2881:2881 # - 2881:2881
# - 2886:2886 # - 2886:2886
networks: networks:
- fastgpt - data
environment: environment:
# SeekDB 连接配置(兼容 MySQL 协议) # SeekDB 连接配置(兼容 MySQL 协议)
- ROOT_PASSWORD=seekdbpassword - ROOT_PASSWORD=seekdbpassword
...@@ -75,7 +75,7 @@ services: ...@@ -75,7 +75,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -122,7 +122,7 @@ services: ...@@ -122,7 +122,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -142,7 +142,7 @@ services: ...@@ -142,7 +142,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -161,15 +161,28 @@ services: ...@@ -161,15 +161,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-seekdb fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -209,6 +222,7 @@ services: ...@@ -209,6 +222,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -247,7 +261,7 @@ services: ...@@ -247,7 +261,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -282,9 +296,13 @@ services: ...@@ -282,9 +296,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -292,7 +310,7 @@ services: ...@@ -292,7 +310,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -304,7 +322,8 @@ services: ...@@ -304,7 +322,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -315,6 +334,8 @@ services: ...@@ -315,6 +334,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -331,16 +352,24 @@ services: ...@@ -331,16 +352,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -363,9 +392,9 @@ services: ...@@ -363,9 +392,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -394,7 +423,6 @@ services: ...@@ -394,7 +423,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -433,9 +461,11 @@ services: ...@@ -433,9 +461,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -467,7 +497,7 @@ configs: ...@@ -467,7 +497,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -52,7 +52,7 @@ services: ...@@ -52,7 +52,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -99,7 +99,7 @@ services: ...@@ -99,7 +99,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -119,7 +119,7 @@ services: ...@@ -119,7 +119,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -138,14 +138,28 @@ services: ...@@ -138,14 +138,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -185,6 +199,7 @@ services: ...@@ -185,6 +199,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -223,7 +238,7 @@ services: ...@@ -223,7 +238,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -258,9 +273,13 @@ services: ...@@ -258,9 +273,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -268,7 +287,7 @@ services: ...@@ -268,7 +287,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -280,7 +299,8 @@ services: ...@@ -280,7 +299,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -291,6 +311,8 @@ services: ...@@ -291,6 +311,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -307,16 +329,24 @@ services: ...@@ -307,16 +329,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -339,9 +369,9 @@ services: ...@@ -339,9 +369,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -370,7 +400,6 @@ services: ...@@ -370,7 +400,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -409,9 +438,11 @@ services: ...@@ -409,9 +438,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -443,7 +474,7 @@ configs: ...@@ -443,7 +474,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,7 +41,7 @@ x-log-config: &x-log-config ...@@ -41,7 +41,7 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
MILVUS_ADDRESS: http://fastgpt-milvus-standalone:19530 MILVUS_ADDRESS: http://fastgpt-vector:19530
MILVUS_TOKEN: none MILVUS_TOKEN: none
...@@ -82,7 +82,7 @@ services: ...@@ -82,7 +82,7 @@ services:
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
fastgpt-milvus-standalone: fastgpt-vector:
container_name: fastgpt-milvus-standalone container_name: fastgpt-milvus-standalone
image: milvusdb/milvus:v2.4.3 image: milvusdb/milvus:v2.4.3
command: ['milvus', 'run', 'standalone'] command: ['milvus', 'run', 'standalone']
...@@ -92,8 +92,7 @@ services: ...@@ -92,8 +92,7 @@ services:
ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379 ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379
MINIO_ADDRESS: fastgpt-milvus-minio:9000 MINIO_ADDRESS: fastgpt-milvus-minio:9000
networks: networks:
- fastgpt - data
- vector
volumes: volumes:
- fastgpt-milvus-data:/var/lib/milvus - fastgpt-milvus-data:/var/lib/milvus
healthcheck: healthcheck:
...@@ -111,7 +110,7 @@ services: ...@@ -111,7 +110,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -158,7 +157,7 @@ services: ...@@ -158,7 +157,7 @@ services:
image: redis:7.2-alpine image: redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -178,7 +177,7 @@ services: ...@@ -178,7 +177,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -197,15 +196,28 @@ services: ...@@ -197,15 +196,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-milvus-standalone fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -245,6 +257,7 @@ services: ...@@ -245,6 +257,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -283,7 +296,7 @@ services: ...@@ -283,7 +296,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10 image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -318,9 +331,13 @@ services: ...@@ -318,9 +331,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -328,7 +345,7 @@ services: ...@@ -328,7 +345,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10 image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -340,7 +357,8 @@ services: ...@@ -340,7 +357,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -351,6 +369,8 @@ services: ...@@ -351,6 +369,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -367,16 +387,24 @@ services: ...@@ -367,16 +387,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -399,9 +427,9 @@ services: ...@@ -399,9 +427,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -430,7 +458,6 @@ services: ...@@ -430,7 +458,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -469,9 +496,11 @@ services: ...@@ -469,9 +496,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -503,7 +532,7 @@ configs: ...@@ -503,7 +532,7 @@ configs:
image = "opensandbox/egress:v1.0.3" image = "opensandbox/egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,19 +41,19 @@ x-log-config: &x-log-config ...@@ -41,19 +41,19 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-ob:2881/mysql OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-vector:2881/mysql
services: services:
# Vector DB # Vector DB
fastgpt-ob: fastgpt-vector:
image: oceanbase/oceanbase-ce:4.3.5-lts image: oceanbase/oceanbase-ce:4.3.5-lts
container_name: fastgpt-ob container_name: fastgpt-ob
restart: always restart: always
# ports: # 生产环境建议不要暴露 # ports: # 生产环境建议不要暴露
# - 2881:2881 # - 2881:2881
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- OB_SYS_PASSWORD=obsyspassword - OB_SYS_PASSWORD=obsyspassword
...@@ -88,7 +88,7 @@ services: ...@@ -88,7 +88,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -135,7 +135,7 @@ services: ...@@ -135,7 +135,7 @@ services:
image: redis:7.2-alpine image: redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -155,7 +155,7 @@ services: ...@@ -155,7 +155,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -174,15 +174,28 @@ services: ...@@ -174,15 +174,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-ob fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -222,6 +235,7 @@ services: ...@@ -222,6 +235,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -260,7 +274,7 @@ services: ...@@ -260,7 +274,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10 image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -295,9 +309,13 @@ services: ...@@ -295,9 +309,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -305,7 +323,7 @@ services: ...@@ -305,7 +323,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10 image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -317,7 +335,8 @@ services: ...@@ -317,7 +335,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -328,6 +347,8 @@ services: ...@@ -328,6 +347,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -344,16 +365,24 @@ services: ...@@ -344,16 +365,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -376,9 +405,9 @@ services: ...@@ -376,9 +405,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -407,7 +436,6 @@ services: ...@@ -407,7 +436,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -446,9 +474,11 @@ services: ...@@ -446,9 +474,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -480,7 +510,7 @@ configs: ...@@ -480,7 +510,7 @@ configs:
image = "opensandbox/egress:v1.0.3" image = "opensandbox/egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,16 +41,16 @@ x-log-config: &x-log-config ...@@ -41,16 +41,16 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
PG_URL: postgresql://username:password@fastgpt-pg:5432/postgres PG_URL: postgresql://username:password@fastgpt-vector:5432/postgres
services: services:
# Vector DB # Vector DB
fastgpt-pg: fastgpt-vector:
image: pgvector/pgvector:0.8.0-pg15 image: pgvector/pgvector:0.8.0-pg15
container_name: fastgpt-pg container_name: fastgpt-pg
restart: always restart: always
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- POSTGRES_USER=username - POSTGRES_USER=username
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -116,7 +116,7 @@ services: ...@@ -116,7 +116,7 @@ services:
image: redis:7.2-alpine image: redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -136,7 +136,7 @@ services: ...@@ -136,7 +136,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -155,15 +155,28 @@ services: ...@@ -155,15 +155,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-pg fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -203,6 +216,7 @@ services: ...@@ -203,6 +216,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -241,7 +255,7 @@ services: ...@@ -241,7 +255,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10 image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -276,9 +290,13 @@ services: ...@@ -276,9 +290,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -286,7 +304,7 @@ services: ...@@ -286,7 +304,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10 image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -298,7 +316,8 @@ services: ...@@ -298,7 +316,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -309,6 +328,8 @@ services: ...@@ -309,6 +328,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -325,16 +346,24 @@ services: ...@@ -325,16 +346,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -357,9 +386,9 @@ services: ...@@ -357,9 +386,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -388,7 +417,6 @@ services: ...@@ -388,7 +417,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -427,9 +455,11 @@ services: ...@@ -427,9 +455,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -461,7 +491,7 @@ configs: ...@@ -461,7 +491,7 @@ configs:
image = "opensandbox/egress:v1.0.3" image = "opensandbox/egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,12 +41,12 @@ x-log-config: &x-log-config ...@@ -41,12 +41,12 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-seekdb:2881/mysql SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-vector:2881/mysql
services: services:
# Vector DB # Vector DB
fastgpt-seekdb: fastgpt-vector:
image: oceanbase/seekdb:1.0.1.0-100000392025122619 image: oceanbase/seekdb:1.0.1.0-100000392025122619
container_name: fastgpt-seekdb container_name: fastgpt-seekdb
restart: always restart: always
...@@ -54,7 +54,7 @@ services: ...@@ -54,7 +54,7 @@ services:
# - 2881:2881 # - 2881:2881
# - 2886:2886 # - 2886:2886
networks: networks:
- fastgpt - data
environment: environment:
# SeekDB 连接配置(兼容 MySQL 协议) # SeekDB 连接配置(兼容 MySQL 协议)
- ROOT_PASSWORD=seekdbpassword - ROOT_PASSWORD=seekdbpassword
...@@ -75,7 +75,7 @@ services: ...@@ -75,7 +75,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -122,7 +122,7 @@ services: ...@@ -122,7 +122,7 @@ services:
image: redis:7.2-alpine image: redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -142,7 +142,7 @@ services: ...@@ -142,7 +142,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -161,15 +161,28 @@ services: ...@@ -161,15 +161,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-seekdb fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -209,6 +222,7 @@ services: ...@@ -209,6 +222,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -247,7 +261,7 @@ services: ...@@ -247,7 +261,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10 image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -282,9 +296,13 @@ services: ...@@ -282,9 +296,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -292,7 +310,7 @@ services: ...@@ -292,7 +310,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10 image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -304,7 +322,8 @@ services: ...@@ -304,7 +322,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -315,6 +334,8 @@ services: ...@@ -315,6 +334,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -331,16 +352,24 @@ services: ...@@ -331,16 +352,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -363,9 +392,9 @@ services: ...@@ -363,9 +392,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -394,7 +423,6 @@ services: ...@@ -394,7 +423,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -433,9 +461,11 @@ services: ...@@ -433,9 +461,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -467,7 +497,7 @@ configs: ...@@ -467,7 +497,7 @@ configs:
image = "opensandbox/egress:v1.0.3" image = "opensandbox/egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -52,7 +52,7 @@ services: ...@@ -52,7 +52,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -99,7 +99,7 @@ services: ...@@ -99,7 +99,7 @@ services:
image: redis:7.2-alpine image: redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -119,7 +119,7 @@ services: ...@@ -119,7 +119,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -138,14 +138,28 @@ services: ...@@ -138,14 +138,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -185,6 +199,7 @@ services: ...@@ -185,6 +199,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ghcr.io/labring/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -223,7 +238,7 @@ services: ...@@ -223,7 +238,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10 image: ghcr.io/labring/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -258,9 +273,13 @@ services: ...@@ -258,9 +273,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -268,7 +287,7 @@ services: ...@@ -268,7 +287,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10 image: ghcr.io/labring/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -280,7 +299,8 @@ services: ...@@ -280,7 +299,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -291,6 +311,8 @@ services: ...@@ -291,6 +311,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -307,16 +329,24 @@ services: ...@@ -307,16 +329,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -339,9 +369,9 @@ services: ...@@ -339,9 +369,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -370,7 +400,6 @@ services: ...@@ -370,7 +400,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -409,9 +438,11 @@ services: ...@@ -409,9 +438,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -443,7 +474,7 @@ configs: ...@@ -443,7 +474,7 @@ configs:
image = "opensandbox/egress:v1.0.3" image = "opensandbox/egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -54,30 +54,20 @@ const args = (() => { ...@@ -54,30 +54,20 @@ const args = (() => {
const vector = { const vector = {
pg: { pg: {
serviceName: 'fastgpt-pg',
dependsOn: `\
- fastgpt-pg
`,
db: '', db: '',
config: `\ config: `\
PG_URL: postgresql://username:password@fastgpt-pg:5432/postgres`, PG_URL: postgresql://username:password@fastgpt-vector:5432/postgres`,
extra: '' extra: ''
}, },
milvus: { milvus: {
serviceName: 'fastgpt-milvus-standalone',
dependsOn: `\
- fastgpt-milvus-standalone
`,
db: '', db: '',
config: `\ config: `\
MILVUS_ADDRESS: http://fastgpt-milvus-standalone:19530 MILVUS_ADDRESS: http://fastgpt-vector:19530
MILVUS_TOKEN: none MILVUS_TOKEN: none
`, `,
extra: '' extra: ''
}, },
zilliz: { zilliz: {
serviceName: '',
dependsOn: '',
db: '', db: '',
config: `\ config: `\
MILVUS_ADDRESS: zilliz_cloud_address MILVUS_ADDRESS: zilliz_cloud_address
...@@ -85,13 +75,9 @@ const vector = { ...@@ -85,13 +75,9 @@ const vector = {
extra: '' extra: ''
}, },
ob: { ob: {
serviceName: 'fastgpt-ob',
dependsOn: `\
- fastgpt-ob
`,
db: '', db: '',
config: `\ config: `\
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-ob:2881/mysql OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-vector:2881/mysql
`, `,
extra: `\ extra: `\
init_sql: init_sql:
...@@ -101,20 +87,16 @@ init_sql: ...@@ -101,20 +87,16 @@ init_sql:
` `
}, },
seekdb: { seekdb: {
serviceName: 'fastgpt-seekdb',
dependsOn: `\
- fastgpt-seekdb
`,
db: '', db: '',
config: `\ config: `\
SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-seekdb:2881/mysql SEEKDB_URL: mysql://root:seekdbpassword@fastgpt-vector:2881/mysql
`, `,
extra: `` extra: ``
}, },
opengauss: { opengauss: {
db: '', db: '',
config: `\ config: `\
OPENGAUSS_URL: postgresql://gaussdb:FastGPT@123@opengauss:5432/fastgpt`, OPENGAUSS_URL: postgresql://gaussdb:FastGPT@123@fastgpt-vector:5432/fastgpt`,
extra: '' extra: ''
}, },
}; };
...@@ -218,7 +200,7 @@ const generateProdFile = async () => { ...@@ -218,7 +200,7 @@ const generateProdFile = async () => {
replace(template, 'cn', VectorEnum.zilliz) replace(template, 'cn', VectorEnum.zilliz)
), ),
fs.promises.writeFile( fs.promises.writeFile(
path.join(process.cwd(), 'docker', 'global', 'docker-compose.ziliiz.yml'), path.join(process.cwd(), 'docker', 'global', 'docker-compose.zilliz.yml'),
replace(template, 'global', VectorEnum.zilliz) replace(template, 'global', VectorEnum.zilliz)
), ),
fs.promises.writeFile( fs.promises.writeFile(
......
...@@ -265,6 +265,8 @@ services: ...@@ -265,6 +265,8 @@ services:
- 8090:8090 - 8090:8090
networks: networks:
- fastgpt - fastgpt
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载
configs: configs:
......
...@@ -51,7 +51,7 @@ ${{vec.db}} ...@@ -51,7 +51,7 @@ ${{vec.db}}
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -98,7 +98,7 @@ ${{vec.db}} ...@@ -98,7 +98,7 @@ ${{vec.db}}
image: ${{redis.image}}:${{redis.tag}} image: ${{redis.image}}:${{redis.tag}}
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -118,7 +118,7 @@ ${{vec.db}} ...@@ -118,7 +118,7 @@ ${{vec.db}}
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -137,14 +137,28 @@ ${{vec.db}} ...@@ -137,14 +137,28 @@ ${{vec.db}}
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
${{vec.dependsOn}} fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -184,6 +198,7 @@ ${{vec.dependsOn}} ...@@ -184,6 +198,7 @@ ${{vec.dependsOn}}
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ${{agent-sandbox-image.image}} AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: ${{agent-sandbox-image.image}}
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: ${{agent-sandbox-image.tag}} AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: ${{agent-sandbox-image.tag}}
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -222,7 +237,7 @@ ${{vec.dependsOn}} ...@@ -222,7 +237,7 @@ ${{vec.dependsOn}}
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: ${{fastgpt-code-sandbox.image}}:${{fastgpt-code-sandbox.tag}} image: ${{fastgpt-code-sandbox.image}}:${{fastgpt-code-sandbox.tag}}
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -257,9 +272,13 @@ ${{vec.dependsOn}} ...@@ -257,9 +272,13 @@ ${{vec.dependsOn}}
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -267,7 +286,7 @@ ${{vec.dependsOn}} ...@@ -267,7 +286,7 @@ ${{vec.dependsOn}}
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: ${{fastgpt-mcp_server.image}}:${{fastgpt-mcp_server.tag}} image: ${{fastgpt-mcp_server.image}}:${{fastgpt-mcp_server.tag}}
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -279,7 +298,8 @@ ${{vec.dependsOn}} ...@@ -279,7 +298,8 @@ ${{vec.dependsOn}}
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -290,6 +310,8 @@ ${{vec.dependsOn}} ...@@ -290,6 +310,8 @@ ${{vec.dependsOn}}
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -306,16 +328,24 @@ ${{vec.dependsOn}} ...@@ -306,16 +328,24 @@ ${{vec.dependsOn}}
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -338,9 +368,9 @@ ${{vec.dependsOn}} ...@@ -338,9 +368,9 @@ ${{vec.dependsOn}}
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -369,7 +399,6 @@ ${{vec.dependsOn}} ...@@ -369,7 +399,6 @@ ${{vec.dependsOn}}
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -408,9 +437,11 @@ ${{vec.dependsOn}} ...@@ -408,9 +437,11 @@ ${{vec.dependsOn}}
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -442,7 +473,7 @@ configs: ...@@ -442,7 +473,7 @@ configs:
image = "${{opensandbox-egress.image}}:${{opensandbox-egress.tag}}" image = "${{opensandbox-egress.image}}:${{opensandbox-egress.tag}}"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
fastgpt-milvus-standalone: fastgpt-vector:
container_name: fastgpt-milvus-standalone container_name: fastgpt-milvus-standalone
image: ${{milvus-standalone.image}}:${{milvus-standalone.tag}} image: ${{milvus-standalone.image}}:${{milvus-standalone.tag}}
command: ['milvus', 'run', 'standalone'] command: ['milvus', 'run', 'standalone']
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379 ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379
MINIO_ADDRESS: fastgpt-milvus-minio:9000 MINIO_ADDRESS: fastgpt-milvus-minio:9000
networks: networks:
- fastgpt - data
- vector
volumes: volumes:
- fastgpt-milvus-data:/var/lib/milvus - fastgpt-milvus-data:/var/lib/milvus
healthcheck: healthcheck:
......
fastgpt-ob: fastgpt-vector:
image: ${{oceanbase.image}}:${{oceanbase.tag}} image: ${{oceanbase.image}}:${{oceanbase.tag}}
container_name: fastgpt-ob container_name: fastgpt-ob
restart: always restart: always
# ports: # 生产环境建议不要暴露 # ports: # 生产环境建议不要暴露
# - 2881:2881 # - 2881:2881
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- OB_SYS_PASSWORD=obsyspassword - OB_SYS_PASSWORD=obsyspassword
......
vectorDB: fastgpt-vector:
image: opengauss/opengauss:7.0.0-RC1 image: opengauss/opengauss:7.0.0-RC1
container_name: opengauss container_name: fastgpt-opengauss
restart: always restart: always
privileged: true privileged: true
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- GS_USERNAME=gaussdb # 默认会创建 gaussdb 用户 - GS_USERNAME=gaussdb # 默认会创建 gaussdb 用户
......
fastgpt-pg: fastgpt-vector:
image: ${{pg.image}}:${{pg.tag}} image: ${{pg.image}}:${{pg.tag}}
container_name: fastgpt-pg container_name: fastgpt-pg
restart: always restart: always
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- POSTGRES_USER=username - POSTGRES_USER=username
......
fastgpt-seekdb: fastgpt-vector:
image: ${{seekdb.image}}:${{seekdb.tag}} image: ${{seekdb.image}}:${{seekdb.tag}}
container_name: fastgpt-seekdb container_name: fastgpt-seekdb
restart: always restart: always
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# - 2881:2881 # - 2881:2881
# - 2886:2886 # - 2886:2886
networks: networks:
- fastgpt - data
environment: environment:
# SeekDB 连接配置(兼容 MySQL 协议) # SeekDB 连接配置(兼容 MySQL 协议)
- ROOT_PASSWORD=seekdbpassword - ROOT_PASSWORD=seekdbpassword
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"sandbox-v2", "sandbox-v2",
"sandbox", "sandbox",
"loop", "loop",
"parallel_run",
"knowledge_base_search_merge", "knowledge_base_search_merge",
"coreferenceResolution", "coreferenceResolution",
"laf", "laf",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"sandbox-v2", "sandbox-v2",
"sandbox", "sandbox",
"loop", "loop",
"parallel_run",
"knowledge_base_search_merge", "knowledge_base_search_merge",
"coreferenceResolution", "coreferenceResolution",
"laf", "laf",
......
---
title: Parallel Run
description: FastGPT Parallel Run node overview and usage (available in 4.14.11+)
---
## Node Overview
The **Parallel Run** node takes an array as input and runs the same sub-workflow for **every element at the same time**, then aggregates the results.
![Parallel Run node](/imgs/fastgpt-parallel-run-node.png)
It fits batch tasks where each item is **independent and does not depend on the others** — for example:
- Translating a batch of text snippets
- Scraping multiple web pages and extracting information
- Calling an external API for many records
## Core Features
1. **Runs in parallel, finishes faster**
- Items are processed at the same time instead of queuing one by one
- You can set "how many to run at once" to balance speed against resource usage
2. **A single failure does not break the batch**
- A failed task does not interrupt the others
- Failures are retried automatically; the retry count is configurable
- Successful and failed results are grouped separately for easier downstream handling
3. **Per-task view in the debug panel**
- After the run finishes, each task's execution can be inspected independently
- No need to dig through a flat list of child-node responses
## Parameters
### Inputs
| Parameter | Required | Default | Description |
| -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| Array | Yes | - | The items to process, usually from an upstream node's array output. Elements can be strings, numbers, objects, etc. |
| Max concurrency | Yes | 5 | How many tasks are allowed to run at the same time. Range: 1 to the upper limit (set by the deployment, default 10) |
| Max retries per task | Yes | 3 | How many times to retry a failed task. Range: 0–5. `0` disables retries |
| Execution Logic | Yes | - | The sub-flow to run, wrapped between the fixed Start and End anchors. You can place any nodes in between |
### Outputs
| Output | Type | Description |
| --------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success Results | `Array<any>` | Outputs of successful tasks only, ordered by input index. Failed items are filtered out. **This is what you usually reference downstream.** |
| Full Results | `Array<object>` | Has the **same length as the input**. Each item is `{ success, message, data }`: on success `success=true` and `data` is the value; on failure `success=false`, `message` holds the error and `data` is `null` |
| Status | `string` | Overall status: `success` (all succeeded), `partial_success` (some failed), `failed` (all failed). Useful for branching |
## Notes
- **No nesting**: a Parallel Run node cannot contain another Parallel Run or a Batch Processing node
- **No interactive nodes**: form input, user selection, and other interactive nodes cannot run inside the Execution Logic — the editor blocks dropping them in
- **Variable isolation**: changes made to global variables inside the Execution Logic are not carried back to the main flow. Use the End node's output to persist anything you need
- **Array length cap**: the input array is capped at 100 items by default (adjustable by the deployment — see below)
- **Turn off streaming for AI nodes inside the Execution Logic**: it is strongly recommended to disable **"Return AI content"** on AI Chat nodes placed inside the parallel body. Otherwise multiple tasks will stream to the same chat window at once and the text will interleave into a garbled mess. Usually you only want a final **Specified Reply** node *after* the parallel node to emit the aggregated result.
### Deployment Settings
The following environment variables can be tuned on self-hosted deployments:
| Environment variable | Default | Description |
| ----------------------------------- | ------- | ------------------------------------------------------------------------------------------- |
| `WORKFLOW_MAX_LOOP_TIMES` | 100 | Maximum length of the input array (shared by Batch Processing and Parallel Run) |
| `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | 10 | Upper bound of the Max concurrency setting. Must not exceed `WORKFLOW_MAX_LOOP_TIMES` |
## Example: Translate a Text Array in Parallel
The minimal flow below translates a few text snippets into English in parallel.
![Parallel translate example](/imgs/fastgpt-parallel-run-example.png)
#### Steps
1. Prepare the input array
Use a Code Execution node to build a test array:
```javascript
function main(){
const texts = [
"这是第一段文本",
"这是第二段文本",
"这是第三段文本"
];
return { textArray: texts };
}
```
2. Configure the Parallel Run node
- **Array input**: select `textArray` from the previous Code Execution node
- **Max concurrency**: keep the default `5` (only 3 items, so 3 tasks actually run at once)
- **Max retries per task**: keep the default `3`
- Inside the Execution Logic, add an AI Chat node that references the Start node's input as the text to translate, with a prompt like `Translate the following text into English: {current item}`. Be sure to **turn off "Return AI content"** so outputs from different tasks do not interleave.
- On the End node, select the AI reply as the output variable
3. Use the results
- Reference **Success Results** downstream to get the array of translated strings
- Reference **Full Results** when you need to check each item's success/failure
- Use **Status** to decide whether to run a fallback (for example, alert when everything failed)
#### Execution Flow
![Parallel run detail](/imgs/fastgpt-parallel-run-detail.png)
1. The Code Execution node produces 3 text snippets
2. The Parallel Run node sends all 3 snippets to the AI chat node at the same time
3. Any failing translation is retried automatically; still-failing items are marked as failed in **Full Results**
4. Once all tasks finish, the node emits **Success Results**, **Full Results**, and **Status** together
---
title: 并行执行
description: FastGPT 并行执行节点介绍和使用(适用于 4.14.11 及以上版本)
---
## 节点概述
【**并行执行**】节点接收一个数组,对每个元素**同时**执行同一段子工作流,最后把所有结果汇总输出。
![并行执行节点](/imgs/fastgpt-parallel-run-node.png)
适合那些**每一项都可以独立完成、互不依赖**的批量任务,比如:
- 同时翻译一批文本片段
- 同时抓取多个网页并提取信息
- 批量调用外部接口
## 核心特性
1. **同时处理,更快完成**
- 多个任务一起跑,不用一个一个排队
- 可以设置「最多几个同时跑」,平衡速度与资源消耗
2. **单个失败不影响整体**
- 某个任务失败不会中断其他任务
- 失败会自动重试,重试次数可自定义
- 最后把成功和失败的结果分别归总,方便下游处理
3. **结果按任务折叠展示**
- 运行完成后,可以在调试面板按任务单独查看每一项的执行过程
- 不用在一堆节点里翻找某一项的执行细节
## 参数说明
### 输入
| 参数 | 必填 | 默认 | 说明 |
| ---------------- | ---- | ---- | --------------------------------------------------------------------------------------- |
| 数组 | 是 | - | 要批量处理的数据,通常来自上游节点的数组输出,元素可以是字符串、数字、对象等 |
| 最大并发数 | 是 | 5 | 最多允许几个任务同时进行,范围 1~上限值(上限由部署方设置,默认 10) |
| 单轮报错重试次数 | 是 | 3 | 单个任务失败后自动重试的次数,范围 0~5;设为 0 表示失败不再重试 |
| 执行逻辑 | 是 | - | 节点内部要执行的子流程,由「开始」和「结束」两个固定锚点包围,中间可以自由编排其他节点 |
### 输出
| 参数 | 类型 | 说明 |
| -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 成功结果 | `Array<any>` | 只包含执行成功的任务输出,按输入顺序排列;失败的那些会被过滤掉。**下游通常用这个字段** |
| 完整结果 | `Array<object>` | 与输入数组**一一对应**,每项形如 `{ success, message, data }`。成功时 `success=true`、`data` 是输出值;失败时 `success=false`、`message` 是错误提示、`data` 为 `null` |
| 完成状态 | `string` | 整体状态:`success`(全部成功)、`partial_success`(部分失败)、`failed`(全部失败),可用于分支判断 |
## 注意事项
- **不能嵌套**:并行执行节点里不能再放另一个【并行执行】或【批量运行】节点
- **不支持交互节点**:表单输入、用户选择等需要和用户互动的节点不能放在执行逻辑内,编辑器会阻止拖入
- **变量独立**:执行逻辑内对全局变量的修改不会带回主流程,想要保留的结果请通过「结束」节点输出
- **数组长度**:输入数组最多 100 项(由部署方统一设置,可通过下文环境变量调整)
- **尽量关闭 AI 节点的流式输出**:执行逻辑内的【AI 对话】等节点建议关闭「返回 AI 内容」(流式输出),否则多个任务的输出会同时往对话窗口里推送,容易出现内容交错、显示混乱。通常只在并行节点**之后**的【指定回复】节点里统一输出汇总结果即可。
### 部署参数
以下两个环境变量在私有化部署时可以按需调整:
| 环境变量 | 默认值 | 说明 |
| ----------------------------------- | ------ | -------------------------------------------------------- |
| `WORKFLOW_MAX_LOOP_TIMES` | 100 | 输入数组的最大长度(【批量运行】和【并行执行】共用) |
| `WORKFLOW_PARALLEL_MAX_CONCURRENCY` | 10 | 最大并发数的上限值,不能超过 `WORKFLOW_MAX_LOOP_TIMES` |
## 场景示例:并行翻译文本数组
假设我们要把一组文本片段并行翻译成英文,下面是最简流程。
![并行翻译文本数组](/imgs/fastgpt-parallel-run-example.png)
#### 实现步骤
1. 准备输入数组
使用【代码运行】节点构造测试数组:
```javascript
function main(){
const texts = [
"这是第一段文本",
"这是第二段文本",
"这是第三段文本"
];
return { textArray: texts };
}
```
2. 配置并行执行节点
- **数组输入**:选择上一步【代码运行】节点的输出变量 `textArray`
- **最大并发数**:保持默认 `5`(数组只有 3 项,实际会同时跑 3 个任务)
- **单轮报错重试次数**:保持默认 `3`
- 在执行逻辑内添加一个【AI 对话】节点,引用「开始」节点的输入作为待翻译文本,prompt 设为:`请将下面这段文本翻译成英文:{当前数组项}`,并**关闭「返回 AI 内容」**,避免多个任务的输出交错
- 「结束」节点选择输出变量为 AI 对话的回复内容
3. 使用结果
- 下游引用「**成功结果**」即可拿到翻译好的字符串数组
- 如果需要核对每一项是否成功,引用「**完整结果**」查看每项的状态
- 通过「**完成状态**」可以快速判断是否需要走兜底逻辑(例如全部失败时发送告警)
#### 执行流程
![并行执行详情](/imgs/fastgpt-parallel-run-detail.png)
1. 【代码运行】节点生成 3 段文本
2. 【并行执行】节点接收数组,3 段文本同时送入 AI 翻译
3. 任一翻译失败会自动重试,仍失败的项会在「完整结果」中标记为失败
4. 所有任务完成后,节点一次性输出「成功结果」「完整结果」「完成状态」
...@@ -22,13 +22,21 @@ This guide covers environment variable configuration for object storage provider ...@@ -22,13 +22,21 @@ This guide covers environment variable configuration for object storage provider
- `STORAGE_PUBLIC_BUCKET` FastGPT public resource bucket name - `STORAGE_PUBLIC_BUCKET` FastGPT public resource bucket name
- `STORAGE_PRIVATE_BUCKET` FastGPT private resource bucket name - `STORAGE_PRIVATE_BUCKET` FastGPT private resource bucket name
### Transfer Behavior
- Uploads always go through the FastGPT backend proxy.
- Downloads support both `proxy` and `presigned` modes.
- The default download mode is inferred from `STORAGE_EXTERNAL_ENDPOINT`:
- not configured: default to `proxy`
- configured: default to `presigned`
### Self-Hosted MinIO and AWS S3 ### Self-Hosted MinIO and AWS S3
> MinIO has strong AWS S3 protocol support, so MinIO and AWS S3 configurations are nearly identical — differences come from provider-specific or self-hosted requirements. > MinIO has strong AWS S3 protocol support, so MinIO and AWS S3 configurations are nearly identical — differences come from provider-specific or self-hosted requirements.
> In theory, any object storage with S3 protocol support comparable to MinIO will work, such as SeaweedFS, RustFS, etc. > In theory, any object storage with S3 protocol support comparable to MinIO will work, such as SeaweedFS, RustFS, etc.
- `STORAGE_S3_ENDPOINT` Internal connection address. Can be a container ID, e.g., `http://fastgpt-minio:9000` - `STORAGE_S3_ENDPOINT` Internal connection address. Can be a container ID, e.g., `http://fastgpt-minio:9000`
- `STORAGE_EXTERNAL_ENDPOINT` An address accessible by both **server** and **client** to reach the bucket. Use a fixed host IP or domain name — don't use `127.0.0.1` or `localhost` (containers can't access loopback addresses). This address is used when generating signed file upload URLs. - `STORAGE_EXTERNAL_ENDPOINT` An address accessible by both **server** and **client** to reach the bucket. Use a fixed host IP or domain name — don't use `127.0.0.1` or `localhost` (containers can't access loopback addresses). Once configured, the default download mode automatically becomes `presigned`.
- `STORAGE_S3_FORCE_PATH_STYLE` [Optional] Virtual-hosted-style or path-style routing. If vendor is `minio`, this is fixed to `true`. - `STORAGE_S3_FORCE_PATH_STYLE` [Optional] Virtual-hosted-style or path-style routing. If vendor is `minio`, this is fixed to `true`.
- `STORAGE_S3_MAX_RETRIES` [Optional] Maximum request retry attempts. Default: 3 - `STORAGE_S3_MAX_RETRIES` [Optional] Maximum request retry attempts. Default: 3
......
...@@ -22,13 +22,21 @@ import FastGPTLink from '@/components/docs/linkFastGPT'; ...@@ -22,13 +22,21 @@ import FastGPTLink from '@/components/docs/linkFastGPT';
- `STORAGE_PUBLIC_BUCKET` FastGPT 公开资源存储桶桶名 - `STORAGE_PUBLIC_BUCKET` FastGPT 公开资源存储桶桶名
- `STORAGE_PRIVATE_BUCKET` FastGPT 私有资源存储桶桶名 - `STORAGE_PRIVATE_BUCKET` FastGPT 私有资源存储桶桶名
### 传输模式说明
- 上传固定走 FastGPT 后端代理。
- 下载支持 `proxy` 和 `presigned` 两种模式。
- 默认下载模式会根据 `STORAGE_EXTERNAL_ENDPOINT` 自动判断:
- 未配置:默认 `proxy`
- 已配置:默认 `presigned`
### 自部署的 MinIO 和 AWS S3 ### 自部署的 MinIO 和 AWS S3
> MinIO 这类产品对 AWS S3 协议支持比较完整,因此使用 Minio 和AWS S3 配置几乎可以是相同的,只是因为服务商提供和自部署的区别,会有额外的配置。 > MinIO 这类产品对 AWS S3 协议支持比较完整,因此使用 Minio 和AWS S3 配置几乎可以是相同的,只是因为服务商提供和自部署的区别,会有额外的配置。
> 因此理论上任何对 AWS S3 协议的支持程度至少和 MinIO 相当的对象存储服务都可以使用,比如 SeaweedFS、RustFS 等。 > 因此理论上任何对 AWS S3 协议的支持程度至少和 MinIO 相当的对象存储服务都可以使用,比如 SeaweedFS、RustFS 等。
- `STORAGE_S3_ENDPOINT` 内网连接地址,可以是容器 id 连接,比如 `http://fastgpt-minio:9000` - `STORAGE_S3_ENDPOINT` 内网连接地址,可以是容器 id 连接,比如 `http://fastgpt-minio:9000`
- `STORAGE_EXTERNAL_ENDPOINT` 一个**服务器**和**客户端**均可访问到存储桶的地址,可以是固定的宿主机 IP 或者域名,注意不要填写成 127.0.0.1 或者 localhost 等本地回环地址(因为容器里无法使用)。该地址用于签发文件上传 URL 时使用 - `STORAGE_EXTERNAL_ENDPOINT` 一个**服务器**和**客户端**均可访问到存储桶的地址,可以是固定的宿主机 IP 或者域名,注意不要填写成 127.0.0.1 或者 localhost 等本地回环地址(因为容器里无法使用)。配置后,默认下载模式会自动切换为 `presigned`
- `STORAGE_S3_FORCE_PATH_STYLE` 【可选】虚拟主机风格路由或路径路由风格,其中如果厂商填写了 `minio` 的话,该值被固定为 `true` - `STORAGE_S3_FORCE_PATH_STYLE` 【可选】虚拟主机风格路由或路径路由风格,其中如果厂商填写了 `minio` 的话,该值被固定为 `true`
- `STORAGE_S3_MAX_RETRIES` 【可选】请求最大尝试次数,默认为 3 次 - `STORAGE_S3_MAX_RETRIES` 【可选】请求最大尝试次数,默认为 3 次
......
...@@ -173,7 +173,7 @@ Run in the same directory as docker-compose.yml. Ensure `docker-compose` version ...@@ -173,7 +173,7 @@ Run in the same directory as docker-compose.yml. Ensure `docker-compose` version
```bash ```bash
# Start containers # Start containers
docker compose --profile prepull pull agent-sandbox-image opensandbox-execd-image opensandbox-egress-image && docker compose up -d docker compose --profile prepull pull opensandbox-agent-sandbox-image opensandbox-execd-image opensandbox-egress-image && dockercompose up -d
``` ```
### 5. Access FastGPT ### 5. Access FastGPT
...@@ -204,8 +204,9 @@ Starting from V4.14.0, the fastgpt-plugin image only provides the runtime enviro ...@@ -204,8 +204,9 @@ Starting from V4.14.0, the fastgpt-plugin image only provides the runtime enviro
| FastGPT-plugin Version | FastGPT Main Service | | FastGPT-plugin Version | FastGPT Main Service |
| ---------------------- | -------------------- | | ---------------------- | -------------------- |
| 0.5.x | >= 4.14.6 | | 0.6.x | >= 4.14.11 |
| < 0.5.0 | < 4.14.6 | | 0.5.x | >= 4.14.6, < 4.14.11 |
| < 0.5.0 | < 4.14.6
### S3 Connection Issues ### S3 Connection Issues
......
...@@ -173,7 +173,7 @@ bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) ...@@ -173,7 +173,7 @@ bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh)
```bash ```bash
# 启动容器 # 启动容器
docker compose --profile prepull pull agent-sandbox-image opensandbox-execd-image opensandbox-egress-image && dockercompose up -d docker compose --profile prepull pull opensandbox-agent-sandbox-image opensandbox-execd-image opensandbox-egress-image && dockercompose up -d
``` ```
...@@ -205,7 +205,8 @@ docker compose --profile prepull pull agent-sandbox-image opensandbox-execd-imag ...@@ -205,7 +205,8 @@ docker compose --profile prepull pull agent-sandbox-image opensandbox-execd-imag
| FastGPT-plugin 版本 | FastGPT 主服务 | | FastGPT-plugin 版本 | FastGPT 主服务 |
| ------------------- | ---------------- | | ------------------- | ---------------- |
| 0.5.x | >= 4.14.6 | | 0.6.x | >= 4.14.11 |
| 0.5.x | >= 4.14.6, < 4.14.11 |
| < 0.5.0 | < 4.14.6 | | < 0.5.0 | < 4.14.6 |
### S3 无法正常连接 ### S3 无法正常连接
......
...@@ -3,16 +3,40 @@ title: 'V4.14.11(进行中)' ...@@ -3,16 +3,40 @@ title: 'V4.14.11(进行中)'
description: 'FastGPT V4.14.11 更新说明' description: 'FastGPT V4.14.11 更新说明'
--- ---
{/* ## 升级指南
### 1. 更新镜像 tag
- 更新 fastgpt-app(fastgpt 主服务) 镜像 tag: v4.14.11
- 更新 fastpgt-pro(商业版) 镜像 tag: v4.14.1011
- 更新 code-sandbox 镜像 tag: v4.14.11
- 更新 fastgpt-plugin 镜像 tag: v0.6.0
- 更新 Aiproxy 镜像 tag: v0.5.3 */}
## 🚀 新增内容 ## 🚀 新增内容
1. 对话流响应恢复功能。
2. 并行执行节点。
3. 调整变量更新节点交互,以及增加更多数字操作和数组操作。
4. S3 上传统一文件,支持通过 fastgpt 代理传入 s3 以及代理访问 s3,减少预签名配置问题。
5. 支持部分沙盒文件类型直接预览。并优化大文件下载。
## ⚙️ 优化 ## ⚙️ 优化
1. 对大量接口增加了 zod 参数校验,减少攻击和错误参数类型风险。 1. 对大量接口增加了 zod 参数校验,减少攻击和错误参数类型风险。
2. 优化模型渠道管理代码。
3. 知识库创建接口,增加默认 vlm 模型。
## 🐛 修复 ## 🐛 修复
1. 对话 Agent 模式,模型存在刷新后被重置问题。 1. 对话 Agent 模式,模型存在刷新后被重置问题。
2. 部分接口未正确进行权限校验。 2. 部分接口未正确进行权限校验。
3. API 推送接口,计费异常。 3. API 推送知识库数据接口,计费异常。
\ No newline at end of file 4. 修复知识库上传 Markdown 文档时,因文件前部英文较多被误判为 `ascii`,导致中文乱码问题。
5. python 代码执行,如果入参为空,会导致该参数被忽略。
6. 工作流,全局变量多选框,删除 enum 时候未清理默认值。
7. 工作流添加子工作流时,子工作流全局变量默认值未显示。
8. 工作流代码运行节点,AI 生成代码后,会讲输出值的 id 全部替换,优化成相同 key 的 id 不替换。
9. 工作流中,父级节点受到辅助线自动对齐时候,其子节点位置会偏移。
10. 评估列表权限过滤未覆盖继承权限。
11. MCP 工具 raw schema 未成功保存,导致工具调用时候,schema 不准确。
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"title": "4.14.x", "title": "4.14.x",
"description": "", "description": "",
"pages": [ "pages": [
"41411",
"41410", "41410",
"4149", "4149",
"4148", "4148",
......
...@@ -39,6 +39,7 @@ description: FastGPT Toc ...@@ -39,6 +39,7 @@ description: FastGPT Toc
- [/en/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge](/en/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge) - [/en/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge](/en/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge)
- [/en/docs/introduction/guide/dashboard/workflow/laf](/en/docs/introduction/guide/dashboard/workflow/laf) - [/en/docs/introduction/guide/dashboard/workflow/laf](/en/docs/introduction/guide/dashboard/workflow/laf)
- [/en/docs/introduction/guide/dashboard/workflow/loop](/en/docs/introduction/guide/dashboard/workflow/loop) - [/en/docs/introduction/guide/dashboard/workflow/loop](/en/docs/introduction/guide/dashboard/workflow/loop)
- [/en/docs/introduction/guide/dashboard/workflow/parallel_run](/en/docs/introduction/guide/dashboard/workflow/parallel_run)
- [/en/docs/introduction/guide/dashboard/workflow/question_classify](/en/docs/introduction/guide/dashboard/workflow/question_classify) - [/en/docs/introduction/guide/dashboard/workflow/question_classify](/en/docs/introduction/guide/dashboard/workflow/question_classify)
- [/en/docs/introduction/guide/dashboard/workflow/reply](/en/docs/introduction/guide/dashboard/workflow/reply) - [/en/docs/introduction/guide/dashboard/workflow/reply](/en/docs/introduction/guide/dashboard/workflow/reply)
- [/en/docs/introduction/guide/dashboard/workflow/sandbox](/en/docs/introduction/guide/dashboard/workflow/sandbox) - [/en/docs/introduction/guide/dashboard/workflow/sandbox](/en/docs/introduction/guide/dashboard/workflow/sandbox)
......
...@@ -39,6 +39,7 @@ description: FastGPT 文档目录 ...@@ -39,6 +39,7 @@ description: FastGPT 文档目录
- [/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge](/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge) - [/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge](/docs/introduction/guide/dashboard/workflow/knowledge_base_search_merge)
- [/docs/introduction/guide/dashboard/workflow/laf](/docs/introduction/guide/dashboard/workflow/laf) - [/docs/introduction/guide/dashboard/workflow/laf](/docs/introduction/guide/dashboard/workflow/laf)
- [/docs/introduction/guide/dashboard/workflow/loop](/docs/introduction/guide/dashboard/workflow/loop) - [/docs/introduction/guide/dashboard/workflow/loop](/docs/introduction/guide/dashboard/workflow/loop)
- [/docs/introduction/guide/dashboard/workflow/parallel_run](/docs/introduction/guide/dashboard/workflow/parallel_run)
- [/docs/introduction/guide/dashboard/workflow/question_classify](/docs/introduction/guide/dashboard/workflow/question_classify) - [/docs/introduction/guide/dashboard/workflow/question_classify](/docs/introduction/guide/dashboard/workflow/question_classify)
- [/docs/introduction/guide/dashboard/workflow/reply](/docs/introduction/guide/dashboard/workflow/reply) - [/docs/introduction/guide/dashboard/workflow/reply](/docs/introduction/guide/dashboard/workflow/reply)
- [/docs/introduction/guide/dashboard/workflow/sandbox](/docs/introduction/guide/dashboard/workflow/sandbox) - [/docs/introduction/guide/dashboard/workflow/sandbox](/docs/introduction/guide/dashboard/workflow/sandbox)
......
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
"document/content/docs/introduction/guide/dashboard/workflow/laf.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/guide/dashboard/workflow/laf.mdx": "2025-07-23T21:35:03+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/loop.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/introduction/guide/dashboard/workflow/loop.en.mdx": "2026-02-26T22:14:30+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/loop.mdx": "2025-09-17T22:29:56+08:00", "document/content/docs/introduction/guide/dashboard/workflow/loop.mdx": "2025-09-17T22:29:56+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/parallel_run.en.mdx": "2026-04-17T15:12:11+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/parallel_run.mdx": "2026-04-17T15:12:11+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/question_classify.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/introduction/guide/dashboard/workflow/question_classify.en.mdx": "2026-02-26T22:14:30+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/question_classify.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/introduction/guide/dashboard/workflow/question_classify.mdx": "2025-07-23T21:35:03+08:00",
"document/content/docs/introduction/guide/dashboard/workflow/reply.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/introduction/guide/dashboard/workflow/reply.en.mdx": "2026-02-26T22:14:30+08:00",
...@@ -138,7 +140,7 @@ ...@@ -138,7 +140,7 @@
"document/content/docs/openapi/chat.en.mdx": "2026-03-16T17:09:25+08:00", "document/content/docs/openapi/chat.en.mdx": "2026-03-16T17:09:25+08:00",
"document/content/docs/openapi/chat.mdx": "2026-03-16T17:09:25+08:00", "document/content/docs/openapi/chat.mdx": "2026-03-16T17:09:25+08:00",
"document/content/docs/openapi/dataset.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/openapi/dataset.en.mdx": "2026-02-26T22:14:30+08:00",
"document/content/docs/openapi/dataset.mdx": "2026-02-12T18:45:30+08:00", "document/content/docs/openapi/dataset.mdx": "2026-04-13T11:25:12+08:00",
"document/content/docs/openapi/index.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/openapi/index.en.mdx": "2026-02-26T22:14:30+08:00",
"document/content/docs/openapi/index.mdx": "2026-02-12T18:45:30+08:00", "document/content/docs/openapi/index.mdx": "2026-02-12T18:45:30+08:00",
"document/content/docs/openapi/intro.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/openapi/intro.en.mdx": "2026-02-26T22:14:30+08:00",
...@@ -153,8 +155,8 @@ ...@@ -153,8 +155,8 @@
"document/content/docs/self-host/config/model/minimax.mdx": "2026-03-19T09:32:57-05:00", "document/content/docs/self-host/config/model/minimax.mdx": "2026-03-19T09:32:57-05:00",
"document/content/docs/self-host/config/model/siliconCloud.en.mdx": "2026-03-19T14:09:03+08:00", "document/content/docs/self-host/config/model/siliconCloud.en.mdx": "2026-03-19T14:09:03+08:00",
"document/content/docs/self-host/config/model/siliconCloud.mdx": "2026-03-19T14:09:03+08:00", "document/content/docs/self-host/config/model/siliconCloud.mdx": "2026-03-19T14:09:03+08:00",
"document/content/docs/self-host/config/object-storage.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/config/object-storage.en.mdx": "2026-04-13T17:52:30+08:00",
"document/content/docs/self-host/config/object-storage.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/config/object-storage.mdx": "2026-04-13T17:52:30+08:00",
"document/content/docs/self-host/config/signoz.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/config/signoz.en.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/config/signoz.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/config/signoz.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/custom-models/bge-rerank.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/custom-models/bge-rerank.en.mdx": "2026-03-03T17:39:47+08:00",
...@@ -173,8 +175,8 @@ ...@@ -173,8 +175,8 @@
"document/content/docs/self-host/custom-models/ollama.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/custom-models/ollama.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/custom-models/xinference.en.mdx": "2026-03-30T10:05:42+08:00", "document/content/docs/self-host/custom-models/xinference.en.mdx": "2026-03-30T10:05:42+08:00",
"document/content/docs/self-host/custom-models/xinference.mdx": "2026-03-30T10:05:42+08:00", "document/content/docs/self-host/custom-models/xinference.mdx": "2026-03-30T10:05:42+08:00",
"document/content/docs/self-host/deploy/docker.en.mdx": "2026-04-02T23:10:34+08:00", "document/content/docs/self-host/deploy/docker.en.mdx": "2026-04-16T15:22:51+08:00",
"document/content/docs/self-host/deploy/docker.mdx": "2026-04-02T23:10:34+08:00", "document/content/docs/self-host/deploy/docker.mdx": "2026-04-16T15:22:51+08:00",
"document/content/docs/self-host/deploy/sealos.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/deploy/sealos.en.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/deploy/sealos.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/deploy/sealos.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/design/dataset.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/design/dataset.en.mdx": "2026-03-03T17:39:47+08:00",
...@@ -222,7 +224,7 @@ ...@@ -222,7 +224,7 @@
"document/content/docs/self-host/upgrading/4-14/4141.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4141.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/upgrading/4-14/41410.en.mdx": "2026-03-31T23:15:29+08:00", "document/content/docs/self-host/upgrading/4-14/41410.en.mdx": "2026-03-31T23:15:29+08:00",
"document/content/docs/self-host/upgrading/4-14/41410.mdx": "2026-04-08T16:15:25+08:00", "document/content/docs/self-host/upgrading/4-14/41410.mdx": "2026-04-08T16:15:25+08:00",
"document/content/docs/self-host/upgrading/4-14/41411.mdx": "2026-04-12T10:39:41+08:00", "document/content/docs/self-host/upgrading/4-14/41411.mdx": "2026-04-17T17:46:20+08:00",
"document/content/docs/self-host/upgrading/4-14/4142.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4142.en.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/upgrading/4-14/4142.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4142.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/upgrading/4-14/4143.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/4-14/4143.en.mdx": "2026-03-03T17:39:47+08:00",
...@@ -383,8 +385,8 @@ ...@@ -383,8 +385,8 @@
"document/content/docs/self-host/upgrading/outdated/499.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/outdated/499.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/upgrading/upgrade-intruction.en.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/upgrade-intruction.en.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/self-host/upgrading/upgrade-intruction.mdx": "2026-03-03T17:39:47+08:00", "document/content/docs/self-host/upgrading/upgrade-intruction.mdx": "2026-03-03T17:39:47+08:00",
"document/content/docs/toc.en.mdx": "2026-03-31T23:15:29+08:00", "document/content/docs/toc.en.mdx": "2026-04-17T15:12:11+08:00",
"document/content/docs/toc.mdx": "2026-04-07T21:48:43+08:00", "document/content/docs/toc.mdx": "2026-04-17T15:12:11+08:00",
"document/content/docs/use-cases/app-cases/dalle3.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/use-cases/app-cases/dalle3.en.mdx": "2026-02-26T22:14:30+08:00",
"document/content/docs/use-cases/app-cases/dalle3.mdx": "2025-07-23T21:35:03+08:00", "document/content/docs/use-cases/app-cases/dalle3.mdx": "2025-07-23T21:35:03+08:00",
"document/content/docs/use-cases/app-cases/english_essay_correction_bot.en.mdx": "2026-02-26T22:14:30+08:00", "document/content/docs/use-cases/app-cases/english_essay_correction_bot.en.mdx": "2026-02-26T22:14:30+08:00",
......
...@@ -41,7 +41,7 @@ x-log-config: &x-log-config ...@@ -41,7 +41,7 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
MILVUS_ADDRESS: http://fastgpt-milvus-standalone:19530 MILVUS_ADDRESS: http://fastgpt-vector:19530
MILVUS_TOKEN: none MILVUS_TOKEN: none
...@@ -82,7 +82,7 @@ services: ...@@ -82,7 +82,7 @@ services:
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
fastgpt-milvus-standalone: fastgpt-vector:
container_name: fastgpt-milvus-standalone container_name: fastgpt-milvus-standalone
image: milvusdb/milvus:v2.4.3 image: milvusdb/milvus:v2.4.3
command: ['milvus', 'run', 'standalone'] command: ['milvus', 'run', 'standalone']
...@@ -92,8 +92,7 @@ services: ...@@ -92,8 +92,7 @@ services:
ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379 ETCD_ENDPOINTS: fastgpt-milvus-etcd:2379
MINIO_ADDRESS: fastgpt-milvus-minio:9000 MINIO_ADDRESS: fastgpt-milvus-minio:9000
networks: networks:
- fastgpt - data
- vector
volumes: volumes:
- fastgpt-milvus-data:/var/lib/milvus - fastgpt-milvus-data:/var/lib/milvus
healthcheck: healthcheck:
...@@ -111,7 +110,7 @@ services: ...@@ -111,7 +110,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -158,7 +157,7 @@ services: ...@@ -158,7 +157,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -178,7 +177,7 @@ services: ...@@ -178,7 +177,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -197,15 +196,28 @@ services: ...@@ -197,15 +196,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-milvus-standalone fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -245,6 +257,7 @@ services: ...@@ -245,6 +257,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -283,7 +296,7 @@ services: ...@@ -283,7 +296,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -318,9 +331,13 @@ services: ...@@ -318,9 +331,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -328,7 +345,7 @@ services: ...@@ -328,7 +345,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -340,7 +357,8 @@ services: ...@@ -340,7 +357,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -351,6 +369,8 @@ services: ...@@ -351,6 +369,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -367,16 +387,24 @@ services: ...@@ -367,16 +387,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -399,9 +427,9 @@ services: ...@@ -399,9 +427,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -430,7 +458,6 @@ services: ...@@ -430,7 +458,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -469,9 +496,11 @@ services: ...@@ -469,9 +496,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -503,7 +532,7 @@ configs: ...@@ -503,7 +532,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,19 +41,19 @@ x-log-config: &x-log-config ...@@ -41,19 +41,19 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-ob:2881/mysql OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@fastgpt-vector:2881/mysql
services: services:
# Vector DB # Vector DB
fastgpt-ob: fastgpt-vector:
image: oceanbase/oceanbase-ce:4.3.5-lts image: oceanbase/oceanbase-ce:4.3.5-lts
container_name: fastgpt-ob container_name: fastgpt-ob
restart: always restart: always
# ports: # 生产环境建议不要暴露 # ports: # 生产环境建议不要暴露
# - 2881:2881 # - 2881:2881
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- OB_SYS_PASSWORD=obsyspassword - OB_SYS_PASSWORD=obsyspassword
...@@ -88,7 +88,7 @@ services: ...@@ -88,7 +88,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -135,7 +135,7 @@ services: ...@@ -135,7 +135,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -155,7 +155,7 @@ services: ...@@ -155,7 +155,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -174,15 +174,28 @@ services: ...@@ -174,15 +174,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-ob fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -222,6 +235,7 @@ services: ...@@ -222,6 +235,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -260,7 +274,7 @@ services: ...@@ -260,7 +274,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -295,9 +309,13 @@ services: ...@@ -295,9 +309,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -305,7 +323,7 @@ services: ...@@ -305,7 +323,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -317,7 +335,8 @@ services: ...@@ -317,7 +335,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -328,6 +347,8 @@ services: ...@@ -328,6 +347,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -344,16 +365,24 @@ services: ...@@ -344,16 +365,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -376,9 +405,9 @@ services: ...@@ -376,9 +405,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -407,7 +436,6 @@ services: ...@@ -407,7 +436,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -446,9 +474,11 @@ services: ...@@ -446,9 +474,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -480,7 +510,7 @@ configs: ...@@ -480,7 +510,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
...@@ -41,16 +41,16 @@ x-log-config: &x-log-config ...@@ -41,16 +41,16 @@ x-log-config: &x-log-config
# 向量库相关配置 # 向量库相关配置
x-vec-config: &x-vec-config x-vec-config: &x-vec-config
PG_URL: postgresql://username:password@fastgpt-pg:5432/postgres PG_URL: postgresql://username:password@fastgpt-vector:5432/postgres
services: services:
# Vector DB # Vector DB
fastgpt-pg: fastgpt-vector:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15
container_name: fastgpt-pg container_name: fastgpt-pg
restart: always restart: always
networks: networks:
- fastgpt - data
environment: environment:
# 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果
- POSTGRES_USER=username - POSTGRES_USER=username
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
container_name: fastgpt-mongo container_name: fastgpt-mongo
restart: always restart: always
networks: networks:
- fastgpt - data
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
- MONGO_INITDB_ROOT_USERNAME=myusername - MONGO_INITDB_ROOT_USERNAME=myusername
...@@ -116,7 +116,7 @@ services: ...@@ -116,7 +116,7 @@ services:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine image: registry.cn-hangzhou.aliyuncs.com/fastgpt/redis:7.2-alpine
container_name: fastgpt-redis container_name: fastgpt-redis
networks: networks:
- fastgpt - data
restart: always restart: always
command: | command: |
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
...@@ -136,7 +136,7 @@ services: ...@@ -136,7 +136,7 @@ services:
- 9000:9000 - 9000:9000
- 9001:9001 - 9001:9001
networks: networks:
- fastgpt - data
environment: environment:
- MINIO_ROOT_USER=minioadmin - MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin - MINIO_ROOT_PASSWORD=minioadmin
...@@ -155,15 +155,28 @@ services: ...@@ -155,15 +155,28 @@ services:
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
- fastgpt - data
- app
- codesandbox
- opensandbox
- aiproxy
depends_on: depends_on:
- fastgpt-mongo fastgpt-mongo:
- fastgpt-code-sandbox condition: service_healthy
- fastgpt-pg fastgpt-vector:
condition: service_healthy
fastgpt-redis:
condition: service_healthy
fastgpt-minio:
condition: service_healthy
fastgpt-code-sandbox:
condition: service_healthy
fastgpt-plugin:
condition: service_healthy
restart: always restart: always
environment: environment:
<<: [*x-share-db-config, *x-vec-config, *x-log-config] <<: [*x-share-db-config, *x-vec-config, *x-log-config]
HOSTNAME: 0.0.0.0
# ==================== 基础配置 ==================== # ==================== 基础配置 ====================
# 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。
FE_DOMAIN: http://localhost:3000 FE_DOMAIN: http://localhost:3000
...@@ -203,6 +216,7 @@ services: ...@@ -203,6 +216,7 @@ services:
AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker AGENT_SANDBOX_OPENSANDBOX_RUNTIME: docker
AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox AGENT_SANDBOX_OPENSANDBOX_IMAGE_REPO: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-agent-sandbox
AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1 AGENT_SANDBOX_OPENSANDBOX_IMAGE_TAG: v0.1
AGENT_SANDBOX_OPENSANDBOX_USE_SERVER_PROXY: true
# Volume 持久化配置(opensandbox provider 下可选) # Volume 持久化配置(opensandbox provider 下可选)
AGENT_SANDBOX_ENABLE_VOLUME: true AGENT_SANDBOX_ENABLE_VOLUME: true
AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000 AGENT_SANDBOX_VOLUME_MANAGER_URL: http://fastgpt-volume-manager:3000
...@@ -241,7 +255,7 @@ services: ...@@ -241,7 +255,7 @@ services:
container_name: fastgpt-code-sandbox container_name: fastgpt-code-sandbox
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-code-sandbox:v4.14.10
networks: networks:
- fastgpt - codesandbox
restart: always restart: always
environment: environment:
<<: [*x-log-config] <<: [*x-log-config]
...@@ -276,9 +290,13 @@ services: ...@@ -276,9 +290,13 @@ services:
SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring SANDBOX_JS_ALLOWED_MODULES: lodash,dayjs,moment,uuid,crypto-js,qs,url,querystring
# Python allowed modules whitelist (comma-separated) # Python allowed modules whitelist (comma-separated)
SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib SANDBOX_PYTHON_ALLOWED_MODULES: math,cmath,decimal,fractions,random,statistics,collections,array,heapq,bisect,queue,copy,itertools,functools,operator,string,re,difflib,textwrap,unicodedata,codecs,datetime,time,calendar,_strptime,json,csv,base64,binascii,struct,hashlib,hmac,secrets,uuid,typing,abc,enum,dataclasses,contextlib,pprint,weakref,numpy,pandas,matplotlib
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/health'] test: [
'CMD',
'bun',
'-e',
"fetch('http://localhost:3000/health').then((res) => { if (!res.ok) throw new Error(String(res.status)); })"
]
interval: 30s interval: 30s
timeout: 20s timeout: 20s
retries: 3 retries: 3
...@@ -286,7 +304,7 @@ services: ...@@ -286,7 +304,7 @@ services:
container_name: fastgpt-mcp-server container_name: fastgpt-mcp-server
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.10
networks: networks:
- fastgpt - app
ports: ports:
- 3003:3000 - 3003:3000
restart: always restart: always
...@@ -298,7 +316,8 @@ services: ...@@ -298,7 +316,8 @@ services:
container_name: fastgpt-plugin container_name: fastgpt-plugin
restart: always restart: always
networks: networks:
- fastgpt - data
- app
environment: environment:
<<: [*x-share-db-config, *x-log-config] <<: [*x-share-db-config, *x-log-config]
AUTH_TOKEN: *x-plugin-auth-token AUTH_TOKEN: *x-plugin-auth-token
...@@ -309,6 +328,8 @@ services: ...@@ -309,6 +328,8 @@ services:
# 传递给 OTLP 收集器的服务名称 # 传递给 OTLP 收集器的服务名称
LOG_OTEL_SERVICE_NAME: fastgpt-plugin LOG_OTEL_SERVICE_NAME: fastgpt-plugin
depends_on: depends_on:
fastgpt-mongo:
condition: service_healthy
fastgpt-minio: fastgpt-minio:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
...@@ -325,16 +346,24 @@ services: ...@@ -325,16 +346,24 @@ services:
container_name: fastgpt-opensandbox-server container_name: fastgpt-opensandbox-server
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载 - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
configs: configs:
- source: opensandbox-config - source: opensandbox-config
target: /etc/opensandbox/config.toml target: /etc/opensandbox/config.toml
environment: environment:
SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml SANDBOX_CONFIG_PATH: /etc/opensandbox/config.toml
healthcheck: healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8090/health'] test:
[
'CMD',
'python',
'-c',
'import urllib.request,sys; sys.exit(0 if urllib.request.urlopen("http://localhost:8090/health",timeout=3).status==200 else 1)'
]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
...@@ -357,9 +386,9 @@ services: ...@@ -357,9 +386,9 @@ services:
container_name: fastgpt-volume-manager container_name: fastgpt-volume-manager
restart: always restart: always
networks: networks:
- fastgpt - opensandbox
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro # Docker 模式必须挂载(只读即可) - /var/run/docker.sock:/var/run/docker.sock # Docker 模式必须挂载,需检查是否与主机的 socket 文件一致
environment: environment:
PORT: 3000 PORT: 3000
VM_RUNTIME: docker VM_RUNTIME: docker
...@@ -388,7 +417,6 @@ services: ...@@ -388,7 +417,6 @@ services:
fastgpt-aiproxy-pg: fastgpt-aiproxy-pg:
condition: service_healthy condition: service_healthy
networks: networks:
- fastgpt
- aiproxy - aiproxy
environment: environment:
# 对应 fastgpt 里的AIPROXY_API_TOKEN # 对应 fastgpt 里的AIPROXY_API_TOKEN
...@@ -427,9 +455,11 @@ services: ...@@ -427,9 +455,11 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
networks: networks:
fastgpt: data:
app:
codesandbox:
opensandbox:
aiproxy: aiproxy:
vector:
volumes: volumes:
fastgpt-pg: fastgpt-pg:
...@@ -461,7 +491,7 @@ configs: ...@@ -461,7 +491,7 @@ configs:
image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3" image = "registry.cn-hangzhou.aliyuncs.com/fastgpt/opensandbox-egress:v1.0.3"
[docker] [docker]
network_mode = "bridge" network_mode = "fastgpt_opensandbox"
# When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP). # When server runs in a container, set host_ip to the host's IP or hostname so bridge-mode endpoints are reachable (e.g. host.docker.internal or the host LAN IP).
# It's required when server deployed with docker container under host. # It's required when server deployed with docker container under host.
host_ip = "host.docker.internal" host_ip = "host.docker.internal"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment