Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4fbe27f2df | ||
|
|
e53242e8bc | ||
|
|
f175a1a30c | ||
|
|
ab743b9358 | ||
|
|
6fb93ef8a5 | ||
|
|
b0a48603f8 | ||
|
|
2fea73bb68 | ||
|
|
4f95f6867e | ||
|
|
36821600a4 | ||
|
|
5631ec781e | ||
|
|
d398c9cd39 | ||
|
|
5231f4281f | ||
|
|
ea7c37745a | ||
|
|
c6fe6f18da | ||
|
|
0d88761378 | ||
|
|
527237d019 | ||
|
|
44c0e9e83f | ||
|
|
7f715a8752 | ||
|
|
cffe395e9a | ||
|
|
09b9fa517b | ||
|
|
463b02d127 | ||
|
|
abc2b6d20d | ||
|
|
285e2b5c93 | ||
|
|
71936eeb1d | ||
|
|
0e3676579d | ||
|
|
7bfd02a490 | ||
|
|
106417b109 | ||
|
|
af669a1cfc | ||
|
|
13681c9246 | ||
|
|
0b02f66283 | ||
|
|
8ad9e15571 | ||
|
|
b22ba1aa53 | ||
|
|
805cd33a77 | ||
|
|
eaeabf825a | ||
|
|
2da73a6555 | ||
|
|
ed1623bd7f | ||
|
|
2dd48afe39 | ||
|
|
36d1ff3679 | ||
|
|
d354fd4d67 | ||
|
|
bdee2db74a | ||
|
|
44f95038b0 | ||
|
|
e979f69cba | ||
|
|
5aaf123135 | ||
|
|
2ccb5b50c6 | ||
|
|
9d72f238c0 | ||
|
|
003e66883c | ||
|
|
48aaa73f3d | ||
|
|
c1ac30ef2e | ||
|
|
f192c8aaa3 | ||
|
|
e191ea4915 | ||
|
|
670c3ca3b0 | ||
|
|
2213e95b48 | ||
|
|
36ea6700b7 | ||
|
|
735a6722b5 | ||
|
|
a56e5dd55a | ||
|
|
e93cc8afa4 | ||
|
|
499b797d0d | ||
|
|
b0a58b98f1 | ||
|
|
a7929bd565 | ||
|
|
9890911be1 | ||
|
|
f1253a1f5a | ||
|
|
ac1a07d91c | ||
|
|
88805564ad | ||
|
|
dbcf5b003d | ||
|
|
58000324e2 | ||
|
|
91156f13e7 | ||
|
|
c1c2b46884 | ||
|
|
6c759a76ab | ||
|
|
f08f3a8a26 | ||
|
|
6adee71c7a | ||
|
|
3f47b58a73 | ||
|
|
64759b862f | ||
|
|
88331e4659 | ||
|
|
b6d3083585 | ||
|
|
29e9e3fecd | ||
|
|
7b82e1dcf8 | ||
|
|
2c681bcdd1 | ||
|
|
e7eb44650e | ||
|
|
1b08a043a6 | ||
|
|
18efdb5421 | ||
|
|
fea7c51d87 | ||
|
|
b0c6e687aa | ||
|
|
48c0c150eb | ||
|
|
21de152fd7 | ||
|
|
fa163a5456 | ||
|
|
21b9f61506 | ||
|
|
245d6e0d02 | ||
|
|
3a5318c012 | ||
|
|
8eb6f37b30 | ||
|
|
d571c768ea | ||
|
|
74e16204e3 | ||
|
|
8ca5ebecd4 | ||
|
|
7225ebec01 | ||
|
|
1f9c8d32ac | ||
|
|
edf06a0ffe | ||
|
|
57e37c91d3 | ||
|
|
7aaa28ed08 | ||
|
|
89ca81d1a4 | ||
|
|
bf33f7af2e | ||
|
|
45869fa058 | ||
|
|
adf9981845 | ||
|
|
3a030e8c33 | ||
|
|
c9edba3539 | ||
|
|
5163e704ed | ||
|
|
44e87e3053 | ||
|
|
a499d05a02 | ||
|
|
fac170306e | ||
|
|
f79dbf8e8d | ||
|
|
e1b616a4e4 | ||
|
|
f7448fb2b1 | ||
|
|
3bd9b61bd4 | ||
|
|
d87771a14a | ||
|
|
68271c0846 | ||
|
|
038fee2130 | ||
|
|
b59f2ccf1d | ||
|
|
ca274feb2e | ||
|
|
5054ccd487 | ||
|
|
44e9299d5e | ||
|
|
ca3053f04d | ||
|
|
703ef2cd56 | ||
|
|
2d0a956e60 | ||
|
|
1ab2e922ec | ||
|
|
19846905ff | ||
|
|
12096f6c58 | ||
|
|
9ea1cbf19e | ||
|
|
c6dfaaea8e | ||
|
|
2beb217006 | ||
|
|
7dcff442fd | ||
|
|
aba0b4c824 | ||
|
|
7942805af9 | ||
|
|
b8c2c7ad98 | ||
|
|
69559814e7 | ||
|
|
1d2fe012bf |
|
|
@ -0,0 +1,126 @@
|
|||
# CLAUDE.md
|
||||
|
||||
本文件为 Claude Code (claude.ai/code) 在本仓库中工作时提供指导说明。
|
||||
|
||||
## 输出要求
|
||||
|
||||
1. 输出语言:中文
|
||||
2. 输出的设计文档位置:.claude/design,以 Markdown 文件为主。
|
||||
3. 输出 Plan 时,均需写入 .claude/plan 目录下,以 Markdown 文件为主。
|
||||
|
||||
## 项目概述
|
||||
|
||||
FastGPT 是一个 AI Agent 构建平台,通过 Flow 提供开箱即用的数据处理、模型调用能力和可视化工作流编排。这是一个基于 NextJS 构建的全栈 TypeScript 应用,后端使用 MongoDB/PostgreSQL。
|
||||
|
||||
**技术栈**: NextJS + TypeScript + ChakraUI + MongoDB + PostgreSQL (PG Vector)/Milvus
|
||||
|
||||
## 架构
|
||||
|
||||
这是一个使用 pnpm workspaces 的 monorepo,主要结构如下:
|
||||
|
||||
### Packages (库代码)
|
||||
- `packages/global/` - 所有项目共享的类型、常量、工具函数
|
||||
- `packages/service/` - 后端服务、数据库模型、API 控制器、工作流引擎
|
||||
- `packages/web/` - 共享的前端组件、hooks、样式、国际化
|
||||
- `packages/templates/` - 模板市场的应用模板
|
||||
|
||||
### Projects (应用程序)
|
||||
- `projects/app/` - 主 NextJS Web 应用(前端 + API 路由)
|
||||
- `projects/sandbox/` - NestJS 代码执行沙箱服务
|
||||
- `projects/mcp_server/` - Model Context Protocol 服务器实现
|
||||
|
||||
### 关键目录
|
||||
- `document/` - 文档站点(NextJS 应用及内容)
|
||||
- `plugins/` - 外部插件(模型、爬虫等)
|
||||
- `deploy/` - Docker 和 Helm 部署配置
|
||||
- `test/` - 集中的测试文件和工具
|
||||
|
||||
## 开发命令
|
||||
|
||||
### 主要命令(从项目根目录运行)
|
||||
- `pnpm dev` - 启动所有项目的开发环境(使用 package.json 的 workspace 脚本)
|
||||
- `pnpm build` - 构建所有项目
|
||||
- `pnpm test` - 使用 Vitest 运行测试
|
||||
- `pnpm test:workflow` - 运行工作流相关测试
|
||||
- `pnpm lint` - 对所有 TypeScript 文件运行 ESLint 并自动修复
|
||||
- `pnpm format-code` - 使用 Prettier 格式化代码
|
||||
|
||||
### 项目专用命令
|
||||
**主应用 (projects/app/)**:
|
||||
- `cd projects/app && pnpm dev` - 启动 NextJS 开发服务器
|
||||
- `cd projects/app && pnpm build` - 构建 NextJS 应用
|
||||
- `cd projects/app && pnpm start` - 启动生产服务器
|
||||
|
||||
**沙箱 (projects/sandbox/)**:
|
||||
- `cd projects/sandbox && pnpm dev` - 以监视模式启动 NestJS 开发服务器
|
||||
- `cd projects/sandbox && pnpm build` - 构建 NestJS 应用
|
||||
- `cd projects/sandbox && pnpm test` - 运行 Jest 测试
|
||||
|
||||
**MCP 服务器 (projects/mcp_server/)**:
|
||||
- `cd projects/mcp_server && bun dev` - 使用 Bun 以监视模式启动
|
||||
- `cd projects/mcp_server && bun build` - 构建 MCP 服务器
|
||||
- `cd projects/mcp_server && bun start` - 启动 MCP 服务器
|
||||
|
||||
### 工具命令
|
||||
- `pnpm create:i18n` - 生成国际化翻译文件
|
||||
- `pnpm api:gen` - 生成 OpenAPI 文档
|
||||
- `pnpm initIcon` - 初始化图标资源
|
||||
- `pnpm gen:theme-typings` - 生成 Chakra UI 主题类型定义
|
||||
|
||||
## 测试
|
||||
|
||||
项目使用 Vitest 进行测试并生成覆盖率报告。主要测试命令:
|
||||
- `pnpm test` - 运行所有测试
|
||||
- `pnpm test:workflow` - 专门运行工作流测试
|
||||
- 测试文件位于 `test/` 目录和 `projects/app/test/`
|
||||
- 覆盖率报告生成在 `coverage/` 目录
|
||||
|
||||
## 代码组织模式
|
||||
|
||||
### Monorepo 结构
|
||||
- 共享代码存放在 `packages/` 中,通过 workspace 引用导入
|
||||
- `projects/` 中的每个项目都是独立的应用程序
|
||||
- 使用 `@fastgpt/global`、`@fastgpt/service`、`@fastgpt/web` 导入共享包
|
||||
|
||||
### API 结构
|
||||
- NextJS API 路由在 `projects/app/src/pages/api/`
|
||||
- API 路由合约定义在`packages/global/openapi/`, 对应的
|
||||
- 通用服务端业务逻辑在 `packages/service/`和`projects/app/src/service`
|
||||
- 数据库模型在 `packages/service/` 中,使用 MongoDB/Mongoose
|
||||
|
||||
### 前端架构
|
||||
- React 组件在 `projects/app/src/components/` 和 `packages/web/components/`
|
||||
- 使用 Chakra UI 进行样式设计,自定义主题在 `packages/web/styles/theme.ts`
|
||||
- 国际化支持文件在 `packages/web/i18n/`
|
||||
- 使用 React Context 和 Zustand 进行状态管理
|
||||
|
||||
## 开发注意事项
|
||||
|
||||
- **包管理器**: 使用 pnpm 及 workspace 配置
|
||||
- **Node 版本**: 需要 Node.js >=18.16.0, pnpm >=9.0.0
|
||||
- **数据库**: 支持 MongoDB、带 pgvector 的 PostgreSQL 或 Milvus 向量存储
|
||||
- **AI 集成**: 通过统一接口支持多个 AI 提供商
|
||||
- **国际化**: 完整支持中文、英文和日文
|
||||
|
||||
## 关键文件模式
|
||||
|
||||
- `.ts` 和 `.tsx` 文件全部使用 TypeScript
|
||||
- 数据库模型使用 Mongoose 配合 TypeScript
|
||||
- API 路由遵循 NextJS 约定
|
||||
- 组件文件使用 React 函数式组件和 hooks
|
||||
- 共享类型定义在 `packages/global/` 的 `.d.ts` 文件中
|
||||
|
||||
## 环境配置
|
||||
|
||||
- 配置文件在 `projects/app/data/config.json`
|
||||
- 支持特定环境配置
|
||||
- 模型配置在 `packages/service/core/ai/config/`
|
||||
|
||||
## 代码规范
|
||||
|
||||
- 尽可能使用 type 进行类型声明,而不是 interface。
|
||||
|
||||
## Agent 设计规范
|
||||
|
||||
1. 对于功能的实习和复杂问题修复,优先进行文档设计,并于让用户确认后,再进行执行修复。
|
||||
2. 采用"设计文档-测试示例-代码编写-测试运行-修正代码/文档"的工作模式,以测试为核心来确保设计的正确性。
|
||||
|
|
@ -0,0 +1,604 @@
|
|||
---
|
||||
name: workflow-agent
|
||||
description: 当用户需要开发工作流代码时候,可调用此 Agent。
|
||||
model: inherit
|
||||
color: green
|
||||
---
|
||||
|
||||
# FastGPT 工作流系统架构文档
|
||||
|
||||
## 概述
|
||||
|
||||
FastGPT 工作流系统是一个基于 Node.js/TypeScript 的可视化工作流引擎,支持拖拽式节点编排、实时执行、并发控制和交互式调试。系统采用队列式执行架构,通过有向图模型实现复杂的业务逻辑编排。
|
||||
|
||||
## 核心架构
|
||||
|
||||
### 1. 项目结构
|
||||
|
||||
```
|
||||
FastGPT/
|
||||
├── packages/
|
||||
│ ├── global/core/workflow/ # 全局工作流类型和常量
|
||||
│ │ ├── constants.ts # 工作流常量定义
|
||||
│ │ ├── node/ # 节点类型定义
|
||||
│ │ │ └── constant.ts # 节点枚举和配置
|
||||
│ │ ├── runtime/ # 运行时类型和工具
|
||||
│ │ │ ├── constants.ts # 运行时常量
|
||||
│ │ │ ├── type.d.ts # 运行时类型定义
|
||||
│ │ │ └── utils.ts # 运行时工具函数
|
||||
│ │ ├── template/ # 节点模板定义
|
||||
│ │ │ └── system/ # 系统节点模板
|
||||
│ │ └── type/ # 类型定义
|
||||
│ │ ├── node.d.ts # 节点类型
|
||||
│ │ ├── edge.d.ts # 边类型
|
||||
│ │ └── io.d.ts # 输入输出类型
|
||||
│ └── service/core/workflow/ # 工作流服务层
|
||||
│ ├── constants.ts # 服务常量
|
||||
│ ├── dispatch/ # 调度器核心
|
||||
│ │ ├── index.ts # 工作流执行引擎 ⭐
|
||||
│ │ ├── constants.ts # 节点调度映射表
|
||||
│ │ ├── type.d.ts # 调度器类型
|
||||
│ │ ├── ai/ # AI相关节点
|
||||
│ │ ├── tools/ # 工具节点
|
||||
│ │ ├── dataset/ # 数据集节点
|
||||
│ │ ├── interactive/ # 交互节点
|
||||
│ │ ├── loop/ # 循环节点
|
||||
│ │ └── plugin/ # 插件节点
|
||||
│ └── utils.ts # 工作流工具函数
|
||||
└── projects/app/src/
|
||||
├── pages/api/v1/chat/completions.ts # 聊天API入口
|
||||
└── pages/api/core/workflow/debug.ts # 工作流调试API
|
||||
```
|
||||
|
||||
### 2. 执行引擎核心 (dispatch/index.ts)
|
||||
|
||||
#### 核心类:WorkflowQueue
|
||||
|
||||
工作流执行引擎采用队列式架构,主要特点:
|
||||
|
||||
- **并发控制**: 支持最大并发数量限制(默认10个)
|
||||
- **状态管理**: 维护节点执行状态(waiting/active/skipped)
|
||||
- **错误处理**: 支持节点级错误捕获和跳过机制
|
||||
- **交互支持**: 支持用户交互节点暂停和恢复
|
||||
|
||||
#### 执行流程
|
||||
|
||||
```typescript
|
||||
1. 初始化 WorkflowQueue 实例
|
||||
2. 识别入口节点(isEntry=true)
|
||||
3. 将入口节点加入 activeRunQueue
|
||||
4. 循环处理活跃节点队列:
|
||||
- 检查节点执行条件
|
||||
- 执行节点或跳过节点
|
||||
- 更新边状态
|
||||
- 将后续节点加入队列
|
||||
5. 处理跳过节点队列
|
||||
6. 返回执行结果
|
||||
```
|
||||
|
||||
### 3. 节点系统
|
||||
|
||||
#### 节点类型枚举 (FlowNodeTypeEnum)
|
||||
|
||||
```typescript
|
||||
enum FlowNodeTypeEnum {
|
||||
// 基础节点
|
||||
workflowStart: 'workflowStart', // 工作流开始
|
||||
chatNode: 'chatNode', // AI对话
|
||||
answerNode: 'answerNode', // 回答节点
|
||||
|
||||
// 数据集相关
|
||||
datasetSearchNode: 'datasetSearchNode', // 数据集搜索
|
||||
datasetConcatNode: 'datasetConcatNode', // 数据集拼接
|
||||
|
||||
// 控制流节点
|
||||
ifElseNode: 'ifElseNode', // 条件判断
|
||||
loop: 'loop', // 循环
|
||||
loopStart: 'loopStart', // 循环开始
|
||||
loopEnd: 'loopEnd', // 循环结束
|
||||
|
||||
// 交互节点
|
||||
userSelect: 'userSelect', // 用户选择
|
||||
formInput: 'formInput', // 表单输入
|
||||
|
||||
// 工具节点
|
||||
httpRequest468: 'httpRequest468', // HTTP请求
|
||||
code: 'code', // 代码执行
|
||||
readFiles: 'readFiles', // 文件读取
|
||||
variableUpdate: 'variableUpdate', // 变量更新
|
||||
|
||||
// AI相关
|
||||
classifyQuestion: 'classifyQuestion', // 问题分类
|
||||
contentExtract: 'contentExtract', // 内容提取
|
||||
agent: 'tools', // 智能体
|
||||
queryExtension: 'cfr', // 查询扩展
|
||||
|
||||
// 插件系统
|
||||
pluginModule: 'pluginModule', // 插件模块
|
||||
appModule: 'appModule', // 应用模块
|
||||
tool: 'tool', // 工具调用
|
||||
|
||||
// 系统节点
|
||||
systemConfig: 'userGuide', // 系统配置
|
||||
globalVariable: 'globalVariable', // 全局变量
|
||||
comment: 'comment' // 注释节点
|
||||
}
|
||||
```
|
||||
|
||||
#### 节点调度映射 (callbackMap)
|
||||
|
||||
每个节点类型都有对应的调度函数:
|
||||
|
||||
```typescript
|
||||
export const callbackMap: Record<FlowNodeTypeEnum, Function> = {
|
||||
[FlowNodeTypeEnum.workflowStart]: dispatchWorkflowStart,
|
||||
[FlowNodeTypeEnum.chatNode]: dispatchChatCompletion,
|
||||
[FlowNodeTypeEnum.datasetSearchNode]: dispatchDatasetSearch,
|
||||
[FlowNodeTypeEnum.httpRequest468]: dispatchHttp468Request,
|
||||
[FlowNodeTypeEnum.ifElseNode]: dispatchIfElse,
|
||||
[FlowNodeTypeEnum.agent]: dispatchRunTools,
|
||||
// ... 更多节点调度函数
|
||||
};
|
||||
```
|
||||
|
||||
### 4. 数据流系统
|
||||
|
||||
#### 输入输出类型 (WorkflowIOValueTypeEnum)
|
||||
|
||||
```typescript
|
||||
enum WorkflowIOValueTypeEnum {
|
||||
string: 'string',
|
||||
number: 'number',
|
||||
boolean: 'boolean',
|
||||
object: 'object',
|
||||
arrayString: 'arrayString',
|
||||
arrayNumber: 'arrayNumber',
|
||||
arrayBoolean: 'arrayBoolean',
|
||||
arrayObject: 'arrayObject',
|
||||
chatHistory: 'chatHistory', // 聊天历史
|
||||
datasetQuote: 'datasetQuote', // 数据集引用
|
||||
dynamic: 'dynamic', // 动态类型
|
||||
any: 'any'
|
||||
}
|
||||
```
|
||||
|
||||
#### 变量系统
|
||||
|
||||
- **系统变量**: userId, appId, chatId, cTime等
|
||||
- **用户变量**: 通过variables参数传入的全局变量
|
||||
- **节点变量**: 节点间传递的引用变量
|
||||
- **动态变量**: 支持{{$variable}}语法引用
|
||||
|
||||
### 5. 状态管理
|
||||
|
||||
#### 运行时状态
|
||||
|
||||
```typescript
|
||||
interface RuntimeNodeItemType {
|
||||
nodeId: string;
|
||||
name: string;
|
||||
flowNodeType: FlowNodeTypeEnum;
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
isEntry?: boolean;
|
||||
catchError?: boolean;
|
||||
}
|
||||
|
||||
interface RuntimeEdgeItemType {
|
||||
source: string;
|
||||
target: string;
|
||||
sourceHandle: string;
|
||||
targetHandle: string;
|
||||
status: 'waiting' | 'active' | 'skipped';
|
||||
}
|
||||
```
|
||||
|
||||
#### 执行状态
|
||||
|
||||
```typescript
|
||||
enum RuntimeEdgeStatusEnum {
|
||||
waiting: 'waiting', // 等待执行
|
||||
active: 'active', // 活跃状态
|
||||
skipped: 'skipped' // 已跳过
|
||||
}
|
||||
```
|
||||
|
||||
### 6. API接口设计
|
||||
|
||||
#### 主要API端点
|
||||
|
||||
1. **工作流调试**: `/api/core/workflow/debug`
|
||||
- POST方法,支持工作流测试和调试
|
||||
- 返回详细的执行结果和状态信息
|
||||
|
||||
2. **聊天完成**: `/api/v1/chat/completions`
|
||||
- OpenAI兼容的聊天API
|
||||
- 集成工作流执行引擎
|
||||
|
||||
3. **优化代码**: `/api/core/workflow/optimizeCode`
|
||||
- 工作流代码优化功能
|
||||
|
||||
#### 请求/响应类型
|
||||
|
||||
```typescript
|
||||
interface DispatchFlowResponse {
|
||||
flowResponses: ChatHistoryItemResType[];
|
||||
flowUsages: ChatNodeUsageType[];
|
||||
debugResponse: WorkflowDebugResponse;
|
||||
workflowInteractiveResponse?: WorkflowInteractiveResponseType;
|
||||
toolResponses: ToolRunResponseItemType;
|
||||
assistantResponses: AIChatItemValueItemType[];
|
||||
runTimes: number;
|
||||
newVariables: Record<string, string>;
|
||||
durationSeconds: number;
|
||||
}
|
||||
```
|
||||
|
||||
## 核心特性
|
||||
|
||||
### 1. 并发控制
|
||||
- 支持最大并发节点数限制
|
||||
- 队列式调度避免资源竞争
|
||||
- 节点级执行状态管理
|
||||
|
||||
### 2. 错误处理
|
||||
- 节点级错误捕获
|
||||
- catchError配置控制错误传播
|
||||
- 错误跳过和继续执行机制
|
||||
|
||||
### 3. 交互式执行
|
||||
- 支持用户交互节点(userSelect, formInput)
|
||||
- 工作流暂停和恢复
|
||||
- 交互状态持久化
|
||||
|
||||
### 4. 调试支持
|
||||
- Debug模式提供详细执行信息
|
||||
- 节点执行状态可视化
|
||||
- 变量值追踪和检查
|
||||
|
||||
### 5. 扩展性
|
||||
- 插件系统支持自定义节点
|
||||
- 模块化架构便于扩展
|
||||
- 工具集成(HTTP, 代码执行等)
|
||||
|
||||
## 开发指南
|
||||
|
||||
### 添加新节点类型
|
||||
|
||||
1. 在 `FlowNodeTypeEnum` 中添加新类型
|
||||
2. 在 `callbackMap` 中注册调度函数
|
||||
3. 在 `dispatch/` 目录下实现节点逻辑
|
||||
4. 在 `template/system/` 中定义节点模板
|
||||
|
||||
### 自定义工具集成
|
||||
|
||||
1. 实现工具调度函数
|
||||
2. 定义工具输入输出类型
|
||||
3. 注册到callbackMap
|
||||
4. 添加前端配置界面
|
||||
|
||||
### 调试和测试
|
||||
|
||||
1. 使用 `/api/core/workflow/debug` 进行测试
|
||||
2. 启用debug模式查看详细执行信息
|
||||
3. 检查节点执行状态和数据流
|
||||
4. 使用skipNodeQueue控制执行路径
|
||||
|
||||
## 性能优化
|
||||
|
||||
1. **并发控制**: 合理设置maxConcurrency避免资源过载
|
||||
2. **缓存机制**: 利用节点输出缓存减少重复计算
|
||||
3. **流式响应**: 支持SSE实时返回执行状态
|
||||
4. **资源管理**: 及时清理临时数据和状态
|
||||
|
||||
---
|
||||
|
||||
## 前端架构设计
|
||||
|
||||
### 1. 前端项目结构
|
||||
|
||||
```
|
||||
projects/app/src/
|
||||
├── pageComponents/app/detail/ # 应用详情页面
|
||||
│ ├── Workflow/ # 工作流主页面
|
||||
│ │ ├── Header.tsx # 工作流头部
|
||||
│ │ └── index.tsx # 工作流入口
|
||||
│ ├── WorkflowComponents/ # 工作流核心组件
|
||||
│ │ ├── context/ # 状态管理上下文
|
||||
│ │ │ ├── index.tsx # 主上下文提供者 ⭐
|
||||
│ │ │ ├── workflowInitContext.tsx # 初始化上下文
|
||||
│ │ │ ├── workflowEventContext.tsx # 事件上下文
|
||||
│ │ │ └── workflowStatusContext.tsx # 状态上下文
|
||||
│ │ ├── Flow/ # ReactFlow核心组件
|
||||
│ │ │ ├── index.tsx # 工作流画布 ⭐
|
||||
│ │ │ ├── components/ # 工作流UI组件
|
||||
│ │ │ ├── hooks/ # 工作流逻辑钩子
|
||||
│ │ │ └── nodes/ # 节点渲染组件
|
||||
│ │ ├── constants.tsx # 常量定义
|
||||
│ │ └── utils.ts # 工具函数
|
||||
│ └── HTTPTools/ # HTTP工具页面
|
||||
│ └── Edit.tsx # HTTP工具编辑器
|
||||
├── web/core/workflow/ # 工作流核心逻辑
|
||||
│ ├── api.ts # API调用 ⭐
|
||||
│ ├── adapt.ts # 数据适配
|
||||
│ ├── type.d.ts # 类型定义
|
||||
│ └── utils.ts # 工具函数
|
||||
└── global/core/workflow/ # 全局工作流定义
|
||||
└── api.d.ts # API类型定义
|
||||
```
|
||||
|
||||
### 2. 核心状态管理架构
|
||||
|
||||
#### Context分层设计
|
||||
|
||||
前端采用分层Context架构,实现状态的高效管理和组件间通信:
|
||||
|
||||
```typescript
|
||||
// 1. ReactFlowCustomProvider - 最外层提供者
|
||||
ReactFlowProvider → WorkflowInitContextProvider →
|
||||
WorkflowContextProvider → WorkflowEventContextProvider →
|
||||
WorkflowStatusContextProvider → children
|
||||
|
||||
// 2. 四层核心Context
|
||||
- WorkflowInitContext: 节点数据和基础状态
|
||||
- WorkflowDataContext: 节点/边操作和状态
|
||||
- WorkflowEventContext: 事件处理和UI控制
|
||||
- WorkflowStatusContext: 保存状态和父节点管理
|
||||
```
|
||||
|
||||
#### 主Context功能 (context/index.tsx)
|
||||
|
||||
```typescript
|
||||
interface WorkflowContextType {
|
||||
// 节点管理
|
||||
nodeList: FlowNodeItemType[];
|
||||
onChangeNode: (props: FlowNodeChangeProps) => void;
|
||||
onUpdateNodeError: (nodeId: string, isError: boolean) => void;
|
||||
getNodeDynamicInputs: (nodeId: string) => FlowNodeInputItemType[];
|
||||
|
||||
// 边管理
|
||||
onDelEdge: (edgeProps: EdgeDeleteProps) => void;
|
||||
|
||||
// 版本控制
|
||||
past: WorkflowSnapshotsType[];
|
||||
future: WorkflowSnapshotsType[];
|
||||
undo: () => void;
|
||||
redo: () => void;
|
||||
pushPastSnapshot: (snapshot: SnapshotProps) => boolean;
|
||||
|
||||
// 调试功能
|
||||
workflowDebugData?: DebugDataType;
|
||||
onNextNodeDebug: (debugData: DebugDataType) => Promise<void>;
|
||||
onStartNodeDebug: (debugProps: DebugStartProps) => Promise<void>;
|
||||
onStopNodeDebug: () => void;
|
||||
|
||||
// 数据转换
|
||||
flowData2StoreData: () => StoreWorkflowType;
|
||||
splitToolInputs: (inputs, nodeId) => ToolInputsResult;
|
||||
}
|
||||
```
|
||||
|
||||
### 3. ReactFlow集成
|
||||
|
||||
#### 节点类型映射 (Flow/index.tsx)
|
||||
|
||||
```typescript
|
||||
const nodeTypes: Record<FlowNodeTypeEnum, React.ComponentType> = {
|
||||
[FlowNodeTypeEnum.workflowStart]: NodeWorkflowStart,
|
||||
[FlowNodeTypeEnum.chatNode]: NodeSimple,
|
||||
[FlowNodeTypeEnum.datasetSearchNode]: NodeSimple,
|
||||
[FlowNodeTypeEnum.httpRequest468]: NodeHttp,
|
||||
[FlowNodeTypeEnum.ifElseNode]: NodeIfElse,
|
||||
[FlowNodeTypeEnum.agent]: NodeAgent,
|
||||
[FlowNodeTypeEnum.code]: NodeCode,
|
||||
[FlowNodeTypeEnum.loop]: NodeLoop,
|
||||
[FlowNodeTypeEnum.userSelect]: NodeUserSelect,
|
||||
[FlowNodeTypeEnum.formInput]: NodeFormInput,
|
||||
// ... 40+ 种节点类型
|
||||
};
|
||||
```
|
||||
|
||||
#### 工作流核心功能
|
||||
|
||||
- **拖拽编排**: 基于ReactFlow的可视化节点编辑
|
||||
- **实时连接**: 节点间的动态连接和断开
|
||||
- **缩放控制**: 支持画布缩放和平移
|
||||
- **选择操作**: 多选、批量操作支持
|
||||
- **辅助线**: 节点对齐和位置吸附
|
||||
|
||||
### 4. 节点组件系统
|
||||
|
||||
#### 节点渲染架构
|
||||
|
||||
```
|
||||
nodes/
|
||||
├── NodeSimple.tsx # 通用简单节点
|
||||
├── NodeWorkflowStart.tsx # 工作流开始节点
|
||||
├── NodeAgent.tsx # AI智能体节点
|
||||
├── NodeHttp/ # HTTP请求节点
|
||||
├── NodeCode/ # 代码执行节点
|
||||
├── Loop/ # 循环节点组
|
||||
├── NodeFormInput/ # 表单输入节点
|
||||
├── NodePluginIO/ # 插件IO节点
|
||||
├── NodeToolParams/ # 工具参数节点
|
||||
└── render/ # 渲染组件库
|
||||
├── NodeCard.tsx # 节点卡片容器
|
||||
├── RenderInput/ # 输入渲染器
|
||||
├── RenderOutput/ # 输出渲染器
|
||||
└── templates/ # 输入模板组件
|
||||
```
|
||||
|
||||
#### 动态输入系统
|
||||
|
||||
```typescript
|
||||
// 支持多种输入类型
|
||||
const inputTemplates = {
|
||||
reference: ReferenceTemplate, // 引用其他节点
|
||||
input: TextInput, // 文本输入
|
||||
textarea: TextareaInput, // 多行文本
|
||||
selectApp: AppSelector, // 应用选择器
|
||||
selectDataset: DatasetSelector, // 数据集选择
|
||||
settingLLMModel: LLMModelConfig, // AI模型配置
|
||||
// ... 更多模板类型
|
||||
};
|
||||
```
|
||||
|
||||
### 5. 调试和测试系统
|
||||
|
||||
#### 调试功能
|
||||
|
||||
```typescript
|
||||
interface DebugDataType {
|
||||
runtimeNodes: RuntimeNodeItemType[];
|
||||
runtimeEdges: RuntimeEdgeItemType[];
|
||||
entryNodeIds: string[];
|
||||
variables: Record<string, any>;
|
||||
history?: ChatItemType[];
|
||||
query?: UserChatItemValueItemType[];
|
||||
workflowInteractiveResponse?: WorkflowInteractiveResponseType;
|
||||
}
|
||||
```
|
||||
|
||||
- **单步调试**: 支持逐个节点执行调试
|
||||
- **断点设置**: 在任意节点设置断点
|
||||
- **状态查看**: 实时查看节点执行状态
|
||||
- **变量追踪**: 监控变量在节点间的传递
|
||||
- **错误定位**: 精确定位执行错误节点
|
||||
|
||||
#### 聊天测试
|
||||
|
||||
```typescript
|
||||
// ChatTest组件提供实时工作流测试
|
||||
<ChatTest
|
||||
isOpen={isOpenTest}
|
||||
nodes={workflowTestData?.nodes}
|
||||
edges={workflowTestData?.edges}
|
||||
onClose={onCloseTest}
|
||||
chatId={chatId}
|
||||
/>
|
||||
```
|
||||
|
||||
### 6. API集成层
|
||||
|
||||
#### 工作流API (web/core/workflow/api.ts)
|
||||
|
||||
```typescript
|
||||
// 工作流调试API
|
||||
export const postWorkflowDebug = (data: PostWorkflowDebugProps) =>
|
||||
POST<PostWorkflowDebugResponse>(
|
||||
'/core/workflow/debug',
|
||||
{ ...data, mode: 'debug' },
|
||||
{ timeout: 300000 }
|
||||
);
|
||||
|
||||
// 支持的API操作
|
||||
- 工作流调试和测试
|
||||
- 节点模板获取
|
||||
- 插件配置管理
|
||||
- 版本控制操作
|
||||
```
|
||||
|
||||
#### 数据适配器
|
||||
|
||||
```typescript
|
||||
// 数据转换适配
|
||||
- storeNode2FlowNode: 存储节点 → Flow节点
|
||||
- storeEdge2RenderEdge: 存储边 → 渲染边
|
||||
- uiWorkflow2StoreWorkflow: UI工作流 → 存储格式
|
||||
- adaptCatchError: 错误处理适配
|
||||
```
|
||||
|
||||
### 7. 交互逻辑设计
|
||||
|
||||
#### 键盘快捷键 (hooks/useKeyboard.tsx)
|
||||
|
||||
```typescript
|
||||
const keyboardShortcuts = {
|
||||
'Ctrl+Z': undo, // 撤销
|
||||
'Ctrl+Y': redo, // 重做
|
||||
'Ctrl+S': saveWorkflow, // 保存工作流
|
||||
'Delete': deleteSelectedNodes, // 删除选中节点
|
||||
'Escape': cancelCurrentOperation, // 取消当前操作
|
||||
};
|
||||
```
|
||||
|
||||
#### 节点操作
|
||||
|
||||
- **拖拽创建**: 从模板拖拽创建节点
|
||||
- **连线操作**: 节点间的连接管理
|
||||
- **批量操作**: 多选节点的批量编辑
|
||||
- **右键菜单**: 上下文操作菜单
|
||||
- **搜索定位**: 节点搜索和快速定位
|
||||
|
||||
#### 版本控制
|
||||
|
||||
```typescript
|
||||
// 快照系统
|
||||
interface WorkflowSnapshotsType {
|
||||
nodes: Node[];
|
||||
edges: Edge[];
|
||||
chatConfig: AppChatConfigType;
|
||||
title: string;
|
||||
isSaved?: boolean;
|
||||
}
|
||||
```
|
||||
|
||||
- **自动快照**: 节点变更时自动保存快照
|
||||
- **版本历史**: 支持多版本切换
|
||||
- **云端同步**: 与服务端版本同步
|
||||
- **协作支持**: 团队协作版本管理
|
||||
|
||||
### 8. 性能优化策略
|
||||
|
||||
#### 渲染优化
|
||||
|
||||
```typescript
|
||||
// 动态加载节点组件
|
||||
const nodeTypes: Record<FlowNodeTypeEnum, any> = {
|
||||
[FlowNodeTypeEnum.workflowStart]: dynamic(() => import('./nodes/NodeWorkflowStart')),
|
||||
[FlowNodeTypeEnum.httpRequest468]: dynamic(() => import('./nodes/NodeHttp')),
|
||||
// ... 按需加载
|
||||
};
|
||||
```
|
||||
|
||||
- **懒加载**: 节点组件按需动态加载
|
||||
- **虚拟化**: 大型工作流的虚拟渲染
|
||||
- **防抖操作**: 频繁操作的性能优化
|
||||
- **缓存策略**: 模板和数据的缓存机制
|
||||
|
||||
#### 状态优化
|
||||
|
||||
- **Context分割**: 避免不必要的重渲染
|
||||
- **useMemo/useCallback**: 优化计算和函数创建
|
||||
- **选择器模式**: 精确订阅状态变化
|
||||
- **批量更新**: 合并多个状态更新
|
||||
|
||||
### 9. 扩展性设计
|
||||
|
||||
#### 插件系统
|
||||
|
||||
```typescript
|
||||
// 节点模板扩展
|
||||
interface NodeTemplateListItemType {
|
||||
id: string;
|
||||
flowNodeType: FlowNodeTypeEnum;
|
||||
templateType: string;
|
||||
avatar?: string;
|
||||
name: string;
|
||||
intro?: string;
|
||||
isTool?: boolean;
|
||||
pluginId?: string;
|
||||
}
|
||||
```
|
||||
|
||||
- **自定义节点**: 支持第三方节点开发
|
||||
- **模板市场**: 节点模板的共享和分发
|
||||
- **插件生态**: 丰富的节点插件生态
|
||||
- **开放API**: 标准化的节点开发接口
|
||||
|
||||
#### 主题定制
|
||||
|
||||
- **节点样式**: 可定制的节点外观
|
||||
- **连线样式**: 自定义连线类型和颜色
|
||||
- **布局配置**: 多种布局算法支持
|
||||
- **国际化**: 多语言界面支持
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# 服务端资源版本 ID 缓存方案
|
||||
|
||||
## 背景
|
||||
|
||||
FastGPT 会采用多节点部署方式,有部分数据缓存会存储在内存里。当需要使用这部分数据时(不管是通过 API 获取,还是后端服务自己获取),都是直接拉取内存数据,这可能会导致数据不一致问题,尤其是用户通过 API 更新数据后再获取,就容易获取未修改数据的节点。
|
||||
|
||||
## 解决方案
|
||||
|
||||
1. 给每一个缓存数据加上一个版本 ID。
|
||||
2. 获取该数据时候,不直接引用该数据,而是通过一个 function 获取,该 function 可选的传入一个 versionId。
|
||||
3. 获取数据时,先检查该 versionId 与 redis 中,资源版本id 与传入的 versionId 是否一致。
|
||||
4. 如果数据一致,则直接返回数据。
|
||||
5. 如果数据不一致,则重新获取数据,并返回最新的 versionId。调用方则需要更新其缓存的 versionId。
|
||||
|
||||
## 代码方案
|
||||
|
||||
* 获取和更新缓存的代码,直接复用 FastGPT/packages/service/common/redis/cache.ts
|
||||
* 每个资源,自己维护一个 cacheKey
|
||||
* 每次更新资源/触发拉取最新资源时,都需要更新 cacheKey 的值。
|
||||
|
||||
## 涉及的业务
|
||||
|
||||
* [ ] FastGPT/projects/app/src/pages/api/common/system/getInitData.ts,获取初始数据
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# 背景
|
||||
|
||||
一个通用表格多选 hook/component, 它可以实现表格每一行数据的选择,并且在触发一次选择后,会有特殊的按键进行批量操作。
|
||||
|
||||
# 具体描述
|
||||
|
||||
当有一行被选中时,底部会出现悬浮层,可以进行批量操作(具体有哪些批量操作由外部决定)
|
||||
|
||||

|
||||
|
||||
# 预期封装
|
||||
|
||||
1. 选中的值存储在 hook 里,便于判断是否触发底部悬浮层
|
||||
2. 悬浮层外层 Box 在 hook 里,child 由调用组件实现
|
||||
3. FastGPT/packages/web/hooks/useTableMultipleSelect.tsx 在这个文件下实现
|
||||
|
|
@ -0,0 +1,534 @@
|
|||
---
|
||||
name: workflow-interactive-dev
|
||||
description: 用于开发 FastGPT 工作流中的交互响应。详细说明了交互节点的架构、开发流程和需要修改的文件。
|
||||
---
|
||||
|
||||
# 交互节点开发指南
|
||||
|
||||
## 概述
|
||||
|
||||
FastGPT 工作流支持多种交互节点类型,允许在工作流执行过程中暂停并等待用户输入。本指南详细说明了如何开发新的交互节点。
|
||||
|
||||
## 现有交互节点类型
|
||||
|
||||
当前系统支持以下交互节点类型:
|
||||
|
||||
1. **userSelect** - 用户选择节点(单选)
|
||||
2. **formInput** - 表单输入节点(多字段表单)
|
||||
3. **childrenInteractive** - 子工作流交互
|
||||
4. **loopInteractive** - 循环交互
|
||||
5. **paymentPause** - 欠费暂停交互
|
||||
|
||||
## 交互节点架构
|
||||
|
||||
### 核心类型定义
|
||||
|
||||
交互节点的类型定义位于 `packages/global/core/workflow/template/system/interactive/type.d.ts`
|
||||
|
||||
```typescript
|
||||
// 基础交互结构
|
||||
type InteractiveBasicType = {
|
||||
entryNodeIds: string[]; // 入口节点ID列表
|
||||
memoryEdges: RuntimeEdgeItemType[]; // 需要记忆的边
|
||||
nodeOutputs: NodeOutputItemType[]; // 节点输出
|
||||
skipNodeQueue?: Array; // 跳过的节点队列
|
||||
usageId?: string; // 用量记录ID
|
||||
};
|
||||
|
||||
// 具体交互节点类型
|
||||
type YourInteractiveNode = InteractiveNodeType & {
|
||||
type: 'yourNodeType';
|
||||
params: {
|
||||
// 节点特定参数
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
### 工作流执行机制
|
||||
|
||||
交互节点在工作流执行中的特殊处理(位于 `packages/service/core/workflow/dispatch/index.ts:1012-1019`):
|
||||
|
||||
```typescript
|
||||
// 部分交互节点不会自动重置 isEntry 标志(因为需要根据 isEntry 字段来判断是首次进入还是流程进入)
|
||||
runtimeNodes.forEach((item) => {
|
||||
if (
|
||||
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
|
||||
item.flowNodeType !== FlowNodeTypeEnum.formInput &&
|
||||
item.flowNodeType !== FlowNodeTypeEnum.agent
|
||||
) {
|
||||
item.isEntry = false;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## 开发新交互响应的步骤
|
||||
|
||||
### 步骤 1: 定义节点类型
|
||||
|
||||
**文件**: `packages/global/core/workflow/template/system/interactive/type.d.ts`
|
||||
|
||||
```typescript
|
||||
export type YourInputItemType = {
|
||||
// 定义输入项的结构
|
||||
key: string;
|
||||
label: string;
|
||||
value: any;
|
||||
// ... 其他字段
|
||||
};
|
||||
|
||||
type YourInteractiveNode = InteractiveNodeType & {
|
||||
type: 'yourNodeType';
|
||||
params: {
|
||||
description: string;
|
||||
yourInputField: YourInputItemType[];
|
||||
submitted?: boolean; // 可选:是否已提交
|
||||
};
|
||||
};
|
||||
|
||||
// 添加到联合类型
|
||||
export type InteractiveNodeResponseType =
|
||||
| UserSelectInteractive
|
||||
| UserInputInteractive
|
||||
| YourInteractiveNode // 新增
|
||||
| ChildrenInteractive
|
||||
| LoopInteractive
|
||||
| PaymentPauseInteractive;
|
||||
```
|
||||
|
||||
### 步骤 2: 定义节点枚举(可选)
|
||||
|
||||
**文件**: `packages/global/core/workflow/node/constant.ts`
|
||||
|
||||
如果不需要添加新的节点类型,则不需要修改这个文件。
|
||||
|
||||
```typescript
|
||||
export enum FlowNodeTypeEnum {
|
||||
// ... 现有类型
|
||||
yourNodeType = 'yourNodeType', // 新增节点类型
|
||||
}
|
||||
```
|
||||
|
||||
### 步骤 3: 创建节点模板(可选)
|
||||
|
||||
**文件**: `packages/global/core/workflow/template/system/interactive/yourNode.ts`
|
||||
|
||||
```typescript
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
import {
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
WorkflowIOValueTypeEnum
|
||||
} from '../../../constants';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../../node/constant';
|
||||
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||
|
||||
export const YourNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.yourNodeType,
|
||||
templateType: FlowNodeTemplateTypeEnum.interactive,
|
||||
flowNodeType: FlowNodeTypeEnum.yourNodeType,
|
||||
showSourceHandle: true, // 是否显示源连接点
|
||||
showTargetHandle: true, // 是否显示目标连接点
|
||||
avatar: 'core/workflow/template/yourNode',
|
||||
name: i18nT('app:workflow.your_node'),
|
||||
intro: i18nT('app:workflow.your_node_tip'),
|
||||
isTool: true, // 标记为工具节点
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.description,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: i18nT('app:workflow.node_description'),
|
||||
placeholder: i18nT('app:workflow.your_node_placeholder')
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.yourInputField,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
label: '',
|
||||
value: [] // 默认值
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: NodeOutputKeyEnum.yourResult,
|
||||
key: NodeOutputKeyEnum.yourResult,
|
||||
required: true,
|
||||
label: i18nT('workflow:your_result'),
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
### 步骤 4: 创建节点执行逻辑或在需要处理交互逻辑的节点上增加新逻辑
|
||||
|
||||
**文件**: `packages/service/core/workflow/dispatch/interactive/yourNode.ts`
|
||||
|
||||
```typescript
|
||||
import { DispatchNodeResponseKeyEnum } from '@fastgpt/global/core/workflow/runtime/constants';
|
||||
import type {
|
||||
DispatchNodeResultType,
|
||||
ModuleDispatchProps
|
||||
} from '@fastgpt/global/core/workflow/runtime/type';
|
||||
import type { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import type { YourInputItemType } from '@fastgpt/global/core/workflow/template/system/interactive/type';
|
||||
import { chatValue2RuntimePrompt } from '@fastgpt/global/core/chat/adapt';
|
||||
|
||||
type Props = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.description]: string;
|
||||
[NodeInputKeyEnum.yourInputField]: YourInputItemType[];
|
||||
}>;
|
||||
|
||||
type YourNodeResponse = DispatchNodeResultType<{
|
||||
[NodeOutputKeyEnum.yourResult]?: Record<string, any>;
|
||||
}>;
|
||||
|
||||
export const dispatchYourNode = async (props: Props): Promise<YourNodeResponse> => {
|
||||
const {
|
||||
histories,
|
||||
node,
|
||||
params: { description, yourInputField },
|
||||
query,
|
||||
lastInteractive
|
||||
} = props;
|
||||
const { isEntry } = node;
|
||||
|
||||
// 第一阶段:非入口节点或不是对应的交互类型,返回交互请求
|
||||
if (!isEntry || lastInteractive?.type !== 'yourNodeType') {
|
||||
return {
|
||||
[DispatchNodeResponseKeyEnum.interactive]: {
|
||||
type: 'yourNodeType',
|
||||
params: {
|
||||
description,
|
||||
yourInputField
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 第二阶段:处理用户提交的数据
|
||||
node.isEntry = false; // 重要:重置入口标志
|
||||
|
||||
const { text } = chatValue2RuntimePrompt(query);
|
||||
const userInputVal = (() => {
|
||||
try {
|
||||
return JSON.parse(text); // 根据实际格式解析
|
||||
} catch (error) {
|
||||
return {};
|
||||
}
|
||||
})();
|
||||
|
||||
return {
|
||||
data: {
|
||||
[NodeOutputKeyEnum.yourResult]: userInputVal
|
||||
},
|
||||
// 移除当前交互的历史记录(最后2条)
|
||||
[DispatchNodeResponseKeyEnum.rewriteHistories]: histories.slice(0, -2),
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: userInputVal,
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
yourResult: userInputVal
|
||||
}
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
### 步骤 5: 注册节点回调
|
||||
|
||||
**文件**: `packages/service/core/workflow/dispatch/constants.ts`
|
||||
|
||||
```typescript
|
||||
import { dispatchYourNode } from './interactive/yourNode';
|
||||
|
||||
export const callbackMap: Record<FlowNodeTypeEnum, any> = {
|
||||
// ... 现有节点
|
||||
[FlowNodeTypeEnum.yourNodeType]: dispatchYourNode,
|
||||
};
|
||||
```
|
||||
|
||||
### 步骤 6: 创建前端渲染组件
|
||||
|
||||
#### 6.1 聊天界面交互组件
|
||||
|
||||
**文件**: `projects/app/src/components/core/chat/components/Interactive/InteractiveComponents.tsx`
|
||||
|
||||
```typescript
|
||||
export const YourNodeComponent = React.memo(function YourNodeComponent({
|
||||
interactiveParams: { description, yourInputField, submitted },
|
||||
defaultValues = {},
|
||||
SubmitButton
|
||||
}: {
|
||||
interactiveParams: YourInteractiveNode['params'];
|
||||
defaultValues?: Record<string, any>;
|
||||
SubmitButton: (e: { onSubmit: UseFormHandleSubmit<Record<string, any>> }) => React.JSX.Element;
|
||||
}) {
|
||||
const { handleSubmit, control } = useForm({
|
||||
defaultValues
|
||||
});
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<DescriptionBox description={description} />
|
||||
<Flex flexDirection={'column'} gap={3}>
|
||||
{yourInputField.map((input) => (
|
||||
<Box key={input.key}>
|
||||
{/* 渲染你的输入组件 */}
|
||||
<Controller
|
||||
control={control}
|
||||
name={input.key}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<YourInputComponent
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
isDisabled={submitted}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Box>
|
||||
))}
|
||||
</Flex>
|
||||
|
||||
{!submitted && (
|
||||
<Flex justifyContent={'flex-end'} mt={4}>
|
||||
<SubmitButton onSubmit={handleSubmit} />
|
||||
</Flex>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
#### 6.2 工作流编辑器节点组件
|
||||
|
||||
**文件**: `projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/NodeYourNode.tsx`
|
||||
|
||||
```typescript
|
||||
import React, { useMemo } from 'react';
|
||||
import { type NodeProps } from 'reactflow';
|
||||
import { Box, Button } from '@chakra-ui/react';
|
||||
import NodeCard from './render/NodeCard';
|
||||
import { type FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node.d';
|
||||
import Container from '../components/Container';
|
||||
import RenderInput from './render/RenderInput';
|
||||
import { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { type FlowNodeInputItemType } from '@fastgpt/global/core/workflow/type/io.d';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import IOTitle from '../components/IOTitle';
|
||||
import RenderOutput from './render/RenderOutput';
|
||||
import { WorkflowActionsContext } from '../../context/workflowActionsContext';
|
||||
|
||||
const NodeYourNode = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
const { t } = useTranslation();
|
||||
const { nodeId, inputs, outputs } = data;
|
||||
const onChangeNode = useContextSelector(WorkflowActionsContext, (v) => v.onChangeNode);
|
||||
|
||||
const CustomComponent = useMemo(
|
||||
() => ({
|
||||
[NodeInputKeyEnum.yourInputField]: (v: FlowNodeInputItemType) => {
|
||||
// 自定义渲染逻辑
|
||||
return (
|
||||
<Box>
|
||||
{/* 你的自定义UI */}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
}),
|
||||
[nodeId, onChangeNode, t]
|
||||
);
|
||||
|
||||
return (
|
||||
<NodeCard minW={'400px'} selected={selected} {...data}>
|
||||
<Container>
|
||||
<RenderInput nodeId={nodeId} flowInputList={inputs} CustomComponent={CustomComponent} />
|
||||
</Container>
|
||||
<Container>
|
||||
<IOTitle text={t('common:Output')} />
|
||||
<RenderOutput nodeId={nodeId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(NodeYourNode);
|
||||
```
|
||||
|
||||
### 步骤 7: 注册节点组件
|
||||
|
||||
需要在节点注册表中添加你的节点组件(具体位置根据项目配置而定)。
|
||||
|
||||
### 步骤 8: 添加国际化
|
||||
|
||||
**文件**: `packages/web/i18n/zh-CN/app.json` 和其他语言文件
|
||||
|
||||
```json
|
||||
{
|
||||
"workflow": {
|
||||
"your_node": "你的节点名称",
|
||||
"your_node_tip": "节点功能说明",
|
||||
"your_node_placeholder": "提示文本"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 步骤9 调整保存对话记录逻辑
|
||||
|
||||
**文件**: `FastGPT/packages/service/core/chat/saveChat.ts`
|
||||
|
||||
修改 `updateInteractiveChat` 方法,支持新的交互
|
||||
|
||||
### 步骤10 根据历史记录获取/设置交互状态
|
||||
|
||||
**文件**: `FastGPT/projects/app/src/components/core/chat/ChatContainer/ChatBox/utils.ts`
|
||||
**文件**: `FastGPT/packages/global/core/workflow/runtime/utils.ts`
|
||||
|
||||
调整`setInteractiveResultToHistories`, `getInteractiveByHistories` 和 `getLastInteractiveValue`方法。
|
||||
|
||||
## 关键注意事项
|
||||
|
||||
### 1. isEntry 标志管理
|
||||
|
||||
交互节点需要保持 `isEntry` 标志在工作流恢复时有效:
|
||||
|
||||
```typescript
|
||||
// 在 packages/service/core/workflow/dispatch/index.ts 中
|
||||
// 确保你的节点类型被添加到白名单
|
||||
if (
|
||||
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
|
||||
item.flowNodeType !== FlowNodeTypeEnum.formInput &&
|
||||
item.flowNodeType !== FlowNodeTypeEnum.yourNodeType // 新增
|
||||
) {
|
||||
item.isEntry = false;
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 交互响应流程
|
||||
|
||||
交互节点有两个执行阶段:
|
||||
|
||||
1. **第一次执行**: 返回 `interactive` 响应,暂停工作流
|
||||
2. **第二次执行**: 接收用户输入,继续工作流
|
||||
|
||||
```typescript
|
||||
// 第一阶段
|
||||
if (!isEntry || lastInteractive?.type !== 'yourNodeType') {
|
||||
return {
|
||||
[DispatchNodeResponseKeyEnum.interactive]: {
|
||||
type: 'yourNodeType',
|
||||
params: { /* ... */ }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 第二阶段
|
||||
node.isEntry = false; // 重要!重置标志
|
||||
// 处理用户输入...
|
||||
```
|
||||
|
||||
### 3. 历史记录管理
|
||||
|
||||
交互节点需要正确处理历史记录:
|
||||
|
||||
```typescript
|
||||
return {
|
||||
// 移除交互对话的历史记录(用户问题 + 系统响应)
|
||||
[DispatchNodeResponseKeyEnum.rewriteHistories]: histories.slice(0, -2),
|
||||
// ... 其他返回值
|
||||
};
|
||||
```
|
||||
|
||||
### 4. Skip 节点队列
|
||||
|
||||
交互节点触发时,系统会保存 `skipNodeQueue` 以便恢复时跳过已处理的节点。
|
||||
|
||||
### 5. 工具调用支持
|
||||
|
||||
如果节点需要在工具调用中使用,设置 `isTool: true`。
|
||||
|
||||
## 测试清单
|
||||
|
||||
开发完成后,请测试以下场景:
|
||||
|
||||
- [ ] 节点在工作流编辑器中正常显示
|
||||
- [ ] 节点配置保存和加载正确
|
||||
- [ ] 交互请求正确发送到前端
|
||||
- [ ] 前端组件正确渲染交互界面
|
||||
- [ ] 用户输入正确传回后端
|
||||
- [ ] 工作流正确恢复并继续执行
|
||||
- [ ] 历史记录正确更新
|
||||
- [ ] 节点输出正确连接到后续节点
|
||||
- [ ] 错误情况处理正确
|
||||
- [ ] 多语言支持完整
|
||||
|
||||
## 参考实现
|
||||
|
||||
可以参考以下现有实现:
|
||||
|
||||
1. **简单单选**: `userSelect` 节点
|
||||
- 类型定义: `packages/global/core/workflow/template/system/interactive/type.d.ts:48-55`
|
||||
- 执行逻辑: `packages/service/core/workflow/dispatch/interactive/userSelect.ts`
|
||||
- 前端组件: `projects/app/src/components/core/chat/components/Interactive/InteractiveComponents.tsx:29-63`
|
||||
|
||||
2. **复杂表单**: `formInput` 节点
|
||||
- 类型定义: `packages/global/core/workflow/template/system/interactive/type.d.ts:57-82`
|
||||
- 执行逻辑: `packages/service/core/workflow/dispatch/interactive/formInput.ts`
|
||||
- 前端组件: `projects/app/src/components/core/chat/components/Interactive/InteractiveComponents.tsx:65-126`
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q: 交互节点执行了两次?
|
||||
A: 这是正常的。第一次返回交互请求,第二次处理用户输入。确保在第二次执行时设置 `node.isEntry = false`。
|
||||
|
||||
### Q: 工作流恢复后没有继续执行?
|
||||
A: 检查你的节点类型是否在 `isEntry` 白名单中(dispatch/index.ts:1013-1018)。
|
||||
|
||||
### Q: 用户输入格式不对?
|
||||
A: 检查 `chatValue2RuntimePrompt` 的返回值,根据你的数据格式进行解析。
|
||||
|
||||
### Q: 如何支持多个交互节点串联?
|
||||
A: 每个交互节点都会暂停工作流,用户完成后会自动继续到下一个节点。
|
||||
|
||||
## 文件清单总结
|
||||
|
||||
开发新交互节点需要修改/创建以下文件:
|
||||
|
||||
### 后端核心文件
|
||||
1. `packages/global/core/workflow/template/system/interactive/type.d.ts` - 类型定义
|
||||
2. `packages/global/core/workflow/node/constant.ts` - 节点枚举
|
||||
3. `packages/global/core/workflow/template/system/interactive/yourNode.ts` - 节点模板
|
||||
4. `packages/service/core/workflow/dispatch/interactive/yourNode.ts` - 执行逻辑
|
||||
5. `packages/service/core/workflow/dispatch/constants.ts` - 回调注册
|
||||
6. `packages/service/core/workflow/dispatch/index.ts` - isEntry 白名单
|
||||
|
||||
### 前端组件文件
|
||||
7. `projects/app/src/components/core/chat/components/Interactive/InteractiveComponents.tsx` - 聊天交互组件
|
||||
8. `projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/NodeYourNode.tsx` - 工作流编辑器组件
|
||||
|
||||
### 国际化文件
|
||||
9. `packages/web/i18n/zh-CN/app.json` - 中文翻译
|
||||
10. `packages/web/i18n/en/app.json` - 英文翻译
|
||||
11. `packages/web/i18n/zh-Hant/app.json` - 繁体中文翻译
|
||||
|
||||
## 附录:关键输入输出键定义
|
||||
|
||||
如果需要新的输入输出键,在以下文件中定义:
|
||||
|
||||
**文件**: `packages/global/core/workflow/constants.ts`
|
||||
|
||||
```typescript
|
||||
export enum NodeInputKeyEnum {
|
||||
// ... 现有键
|
||||
yourInputKey = 'yourInputKey',
|
||||
}
|
||||
|
||||
export enum NodeOutputKeyEnum {
|
||||
// ... 现有键
|
||||
yourOutputKey = 'yourOutputKey',
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,672 @@
|
|||
---
|
||||
name: workflow-stop-design
|
||||
description: 工作流暂停逻辑设计方案
|
||||
---
|
||||
|
||||
## 1. Redis 状态管理方案
|
||||
|
||||
### 1.1 状态键设计
|
||||
|
||||
**Redis Key 结构:**
|
||||
```typescript
|
||||
// Key 格式: agent_runtime_stopping:{appId}:{chatId}
|
||||
const WORKFLOW_STATUS_PREFIX = 'agent_runtime_stopping';
|
||||
|
||||
type WorkflowStatusKey = `${typeof WORKFLOW_STATUS_PREFIX}:${string}:${string}`;
|
||||
|
||||
// 示例: agent_runtime_stopping:app_123456:chat_789012
|
||||
```
|
||||
|
||||
**状态值设计:**
|
||||
- **存在键 (值为 1)**: 工作流应该停止
|
||||
- **不存在键**: 工作流正常运行
|
||||
- **设计简化**: 不使用状态枚举,仅通过键的存在与否判断
|
||||
|
||||
**参数类型定义:**
|
||||
```typescript
|
||||
type WorkflowStatusParams = {
|
||||
appId: string;
|
||||
chatId: string;
|
||||
};
|
||||
```
|
||||
|
||||
### 1.2 状态生命周期管理
|
||||
|
||||
**状态转换流程:**
|
||||
```
|
||||
正常运行(无键) → 停止中(键存在) → 完成(删除键)
|
||||
```
|
||||
|
||||
**TTL 设置:**
|
||||
- **停止标志 TTL**: 60 秒
|
||||
- 原因: 避免因意外情况导致的键泄漏
|
||||
- 正常情况下会在工作流完成时主动删除
|
||||
- **工作流完成后**: 直接删除 Redis 键
|
||||
- 原因: 不需要保留终态,减少 Redis 内存占用
|
||||
|
||||
### 1.3 核心函数说明
|
||||
|
||||
**1. setAgentRuntimeStop**
|
||||
- **功能**: 设置停止标志
|
||||
- **参数**: `{ appId, chatId }`
|
||||
- **实现**: 使用 `SETEX` 命令,设置键值为 1,TTL 60 秒
|
||||
|
||||
**2. shouldWorkflowStop**
|
||||
- **功能**: 检查工作流是否应该停止
|
||||
- **参数**: `{ appId, chatId }`
|
||||
- **返回**: `Promise<boolean>` - true=应该停止, false=继续运行
|
||||
- **实现**: GET 命令获取键值,存在则返回 true
|
||||
|
||||
**3. delAgentRuntimeStopSign**
|
||||
- **功能**: 删除停止标志
|
||||
- **参数**: `{ appId, chatId }`
|
||||
- **实现**: DEL 命令删除键
|
||||
|
||||
**4. waitForWorkflowComplete**
|
||||
- **功能**: 等待工作流完成(停止标志被删除)
|
||||
- **参数**: `{ appId, chatId, timeout?, pollInterval? }`
|
||||
- **实现**: 轮询检查停止标志是否被删除,超时返回
|
||||
|
||||
### 1.4 边界情况处理
|
||||
|
||||
**1. Redis 操作失败**
|
||||
- **错误处理**: 所有 Redis 操作都包含 `.catch()` 错误处理
|
||||
- **降级策略**:
|
||||
- `shouldWorkflowStop`: 出错时返回 `false` (认为不需要停止,继续运行)
|
||||
- `delAgentRuntimeStopSign`: 出错时记录错误日志,但不影响主流程
|
||||
- **设计原因**: Redis 异常不应阻塞工作流运行,降级到继续执行策略
|
||||
|
||||
**2. TTL 自动清理**
|
||||
- **TTL 设置**: 60 秒
|
||||
- **清理时机**: Redis 自动清理过期键
|
||||
- **设计原因**:
|
||||
- 避免因异常情况导致的 Redis 键泄漏
|
||||
- 自动清理减少手动维护成本
|
||||
- 60 秒足够大多数工作流完成停止操作
|
||||
|
||||
**3. stop 接口等待超时**
|
||||
- **超时时间**: 5 秒
|
||||
- **超时策略**: `waitForWorkflowComplete` 在 5 秒内轮询检查停止标志是否被删除
|
||||
- **超时处理**: 5 秒后直接返回,不影响工作流继续执行
|
||||
- **设计原因**:
|
||||
- 避免前端长时间等待
|
||||
- 5 秒足够大多数节点完成当前操作
|
||||
- 用户体验优先,超时后前端可选择重试或放弃
|
||||
|
||||
**4. 并发停止请求**
|
||||
- **处理方式**: 多次调用 `setAgentRuntimeStop` 是安全的,Redis SETEX 是幂等操作
|
||||
- **设计原因**: 避免用户多次点击停止按钮导致的问题
|
||||
|
||||
---
|
||||
|
||||
## 2. Redis 工具函数实现
|
||||
|
||||
**位置**: `packages/service/core/workflow/dispatch/workflowStatus.ts`
|
||||
|
||||
```typescript
|
||||
import { addLog } from '../../../common/system/log';
|
||||
import { getGlobalRedisConnection } from '../../../common/redis/index';
|
||||
import { delay } from '@fastgpt/global/common/system/utils';
|
||||
|
||||
const WORKFLOW_STATUS_PREFIX = 'agent_runtime_stopping';
|
||||
const TTL = 60; // 60秒
|
||||
|
||||
export const StopStatus = 'STOPPING';
|
||||
|
||||
export type WorkflowStatusParams = {
|
||||
appId: string;
|
||||
chatId: string;
|
||||
};
|
||||
|
||||
// 获取工作流状态键
|
||||
export const getRuntimeStatusKey = (params: WorkflowStatusParams): string => {
|
||||
return `${WORKFLOW_STATUS_PREFIX}:${params.appId}:${params.chatId}`;
|
||||
};
|
||||
|
||||
// 设置停止标志
|
||||
export const setAgentRuntimeStop = async (params: WorkflowStatusParams): Promise<void> => {
|
||||
const redis = getGlobalRedisConnection();
|
||||
const key = getRuntimeStatusKey(params);
|
||||
await redis.setex(key, TTL, 1);
|
||||
};
|
||||
|
||||
// 删除停止标志
|
||||
export const delAgentRuntimeStopSign = async (params: WorkflowStatusParams): Promise<void> => {
|
||||
const redis = getGlobalRedisConnection();
|
||||
const key = getRuntimeStatusKey(params);
|
||||
await redis.del(key).catch((err) => {
|
||||
addLog.error(`[Agent Runtime Stop] Delete stop sign error`, err);
|
||||
});
|
||||
};
|
||||
|
||||
// 检查工作流是否应该停止
|
||||
export const shouldWorkflowStop = (params: WorkflowStatusParams): Promise<boolean> => {
|
||||
const redis = getGlobalRedisConnection();
|
||||
const key = getRuntimeStatusKey(params);
|
||||
return redis
|
||||
.get(key)
|
||||
.then((res) => !!res)
|
||||
.catch(() => false);
|
||||
};
|
||||
|
||||
/**
|
||||
* 等待工作流完成(停止标志被删除)
|
||||
* @param params 工作流参数
|
||||
* @param timeout 超时时间(毫秒),默认5秒
|
||||
* @param pollInterval 轮询间隔(毫秒),默认50毫秒
|
||||
*/
|
||||
export const waitForWorkflowComplete = async ({
|
||||
appId,
|
||||
chatId,
|
||||
timeout = 5000,
|
||||
pollInterval = 50
|
||||
}: {
|
||||
appId: string;
|
||||
chatId: string;
|
||||
timeout?: number;
|
||||
pollInterval?: number;
|
||||
}) => {
|
||||
const startTime = Date.now();
|
||||
|
||||
while (Date.now() - startTime < timeout) {
|
||||
const sign = await shouldWorkflowStop({ appId, chatId });
|
||||
|
||||
// 如果停止标志已被删除,说明工作流已完成
|
||||
if (!sign) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 等待下一次轮询
|
||||
await delay(pollInterval);
|
||||
}
|
||||
|
||||
// 超时后直接返回
|
||||
return;
|
||||
};
|
||||
```
|
||||
|
||||
**测试用例位置**: `test/cases/service/core/app/workflow/workflowStatus.test.ts`
|
||||
|
||||
```typescript
|
||||
import { describe, test, expect, beforeEach } from 'vitest';
|
||||
import {
|
||||
setAgentRuntimeStop,
|
||||
delAgentRuntimeStopSign,
|
||||
shouldWorkflowStop,
|
||||
waitForWorkflowComplete
|
||||
} from '@fastgpt/service/core/workflow/dispatch/workflowStatus';
|
||||
|
||||
describe('Workflow Status Redis Functions', () => {
|
||||
const testAppId = 'test_app_123';
|
||||
const testChatId = 'test_chat_456';
|
||||
|
||||
beforeEach(async () => {
|
||||
// 清理测试数据
|
||||
await delAgentRuntimeStopSign({ appId: testAppId, chatId: testChatId });
|
||||
});
|
||||
|
||||
test('should set stopping sign', async () => {
|
||||
await setAgentRuntimeStop({ appId: testAppId, chatId: testChatId });
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(true);
|
||||
});
|
||||
|
||||
test('should return false for non-existent status', async () => {
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(false);
|
||||
});
|
||||
|
||||
test('should return false after deleting stop sign', async () => {
|
||||
await setAgentRuntimeStop({ appId: testAppId, chatId: testChatId });
|
||||
await delAgentRuntimeStopSign({ appId: testAppId, chatId: testChatId });
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(false);
|
||||
});
|
||||
|
||||
test('should wait for workflow completion', async () => {
|
||||
// 设置初始停止标志
|
||||
await setAgentRuntimeStop({ appId: testAppId, chatId: testChatId });
|
||||
|
||||
// 模拟异步完成(删除停止标志)
|
||||
setTimeout(async () => {
|
||||
await delAgentRuntimeStopSign({ appId: testAppId, chatId: testChatId });
|
||||
}, 500);
|
||||
|
||||
// 等待完成
|
||||
await waitForWorkflowComplete({
|
||||
appId: testAppId,
|
||||
chatId: testChatId,
|
||||
timeout: 2000
|
||||
});
|
||||
|
||||
// 验证停止标志已被删除
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(false);
|
||||
});
|
||||
|
||||
test('should timeout when waiting too long', async () => {
|
||||
await setAgentRuntimeStop({ appId: testAppId, chatId: testChatId });
|
||||
|
||||
// 等待超时(不删除标志)
|
||||
await waitForWorkflowComplete({
|
||||
appId: testAppId,
|
||||
chatId: testChatId,
|
||||
timeout: 100
|
||||
});
|
||||
|
||||
// 验证停止标志仍然存在
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(true);
|
||||
});
|
||||
|
||||
test('should handle concurrent stop sign operations', async () => {
|
||||
// 并发设置停止标志
|
||||
await Promise.all([
|
||||
setAgentRuntimeStop({ appId: testAppId, chatId: testChatId }),
|
||||
setAgentRuntimeStop({ appId: testAppId, chatId: testChatId })
|
||||
]);
|
||||
|
||||
// 停止标志应该存在
|
||||
const shouldStop = await shouldWorkflowStop({ appId: testAppId, chatId: testChatId });
|
||||
expect(shouldStop).toBe(true);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## 3. 工作流停止检测机制改造
|
||||
|
||||
### 3.1 修改位置
|
||||
|
||||
**文件**: `packages/service/core/workflow/dispatch/index.ts`
|
||||
|
||||
### 3.2 工作流启动时的停止检测机制
|
||||
|
||||
**改造点 1: 停止检测逻辑 (行 196-216)**
|
||||
|
||||
使用内存变量 + 定时轮询 Redis 的方式:
|
||||
|
||||
```typescript
|
||||
import { delAgentRuntimeStopSign, shouldWorkflowStop } from './workflowStatus';
|
||||
|
||||
// 初始化停止检测
|
||||
let stopping = false;
|
||||
const checkIsStopping = (): boolean => {
|
||||
if (apiVersion === 'v2') {
|
||||
return stopping;
|
||||
}
|
||||
if (apiVersion === 'v1') {
|
||||
if (!res) return false;
|
||||
return res.closed || !!res.errored;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// v2 版本: 启动定时器定期检查 Redis
|
||||
const checkStoppingTimer =
|
||||
apiVersion === 'v2'
|
||||
? setInterval(async () => {
|
||||
stopping = await shouldWorkflowStop({
|
||||
appId: runningAppInfo.id,
|
||||
chatId
|
||||
});
|
||||
}, 100)
|
||||
: undefined;
|
||||
```
|
||||
|
||||
**设计要点**:
|
||||
- v2 版本使用内存变量 `stopping` + 100ms 定时器轮询 Redis
|
||||
- v1 版本仍使用原有的 `res.closed/res.errored` 检测
|
||||
- 轮询频率 100ms,平衡性能和响应速度
|
||||
|
||||
**改造点 2: 工作流完成后清理 (行 232-249)**
|
||||
|
||||
```typescript
|
||||
return runWorkflow({
|
||||
...data,
|
||||
checkIsStopping, // 传递检测函数
|
||||
query,
|
||||
histories,
|
||||
// ... 其他参数
|
||||
}).finally(async () => {
|
||||
// 清理定时器
|
||||
if (streamCheckTimer) {
|
||||
clearInterval(streamCheckTimer);
|
||||
}
|
||||
if (checkStoppingTimer) {
|
||||
clearInterval(checkStoppingTimer);
|
||||
}
|
||||
|
||||
// Close mcpClient connections
|
||||
Object.values(mcpClientMemory).forEach((client) => {
|
||||
client.closeConnection();
|
||||
});
|
||||
|
||||
// 工作流完成后删除 Redis 记录
|
||||
await delAgentRuntimeStopSign({
|
||||
appId: runningAppInfo.id,
|
||||
chatId
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### 3.3 节点执行前的停止检测
|
||||
|
||||
**位置**: `packages/service/core/workflow/dispatch/index.ts:861-868`
|
||||
|
||||
在 `checkNodeCanRun` 方法中,每个节点执行前检查:
|
||||
|
||||
```typescript
|
||||
private async checkNodeCanRun(
|
||||
node: RuntimeNodeItemType,
|
||||
skippedNodeIdList = new Set<string>()
|
||||
) {
|
||||
// ... 其他检查逻辑 ...
|
||||
|
||||
// Check queue status
|
||||
if (data.maxRunTimes <= 0) {
|
||||
addLog.error('Max run times is 0', {
|
||||
appId: data.runningAppInfo.id
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 停止检测
|
||||
if (checkIsStopping()) {
|
||||
addLog.warn('Workflow stopped', {
|
||||
appId: data.runningAppInfo.id,
|
||||
nodeId: node.nodeId,
|
||||
nodeName: node.name
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// ... 执行节点逻辑 ...
|
||||
}
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 直接调用 `checkIsStopping()` 同步方法
|
||||
- 内部会检查内存变量 `stopping`
|
||||
- 定时器每 100ms 更新一次该变量
|
||||
- 检测到停止时记录日志并直接返回,不执行节点
|
||||
|
||||
## 4. v2/chat/stop 接口设计
|
||||
|
||||
### 4.1 接口规范
|
||||
|
||||
**接口路径**: `/api/v2/chat/stop`
|
||||
|
||||
**Schema 位置**: `packages/global/openapi/core/chat/api.ts`
|
||||
|
||||
**接口文档位置**: `packages/global/openapi/core/chat/index.ts`
|
||||
|
||||
**请求方法**: POST
|
||||
|
||||
**请求参数**:
|
||||
```typescript
|
||||
// packages/global/openapi/core/chat/api.ts
|
||||
export const StopV2ChatSchema = z
|
||||
.object({
|
||||
appId: ObjectIdSchema.describe('应用ID'),
|
||||
chatId: z.string().min(1).describe('对话ID'),
|
||||
outLinkAuthData: OutLinkChatAuthSchema.optional().describe('外链鉴权数据')
|
||||
});
|
||||
|
||||
export type StopV2ChatParams = z.infer<typeof StopV2ChatSchema>;
|
||||
```
|
||||
|
||||
**响应格式**:
|
||||
```typescript
|
||||
export const StopV2ChatResponseSchema = z
|
||||
.object({
|
||||
success: z.boolean().describe('是否成功停止')
|
||||
});
|
||||
|
||||
export type StopV2ChatResponse = z.infer<typeof StopV2ChatResponseSchema>;
|
||||
```
|
||||
|
||||
### 4.2 接口实现
|
||||
|
||||
**文件位置**: `projects/app/src/pages/api/v2/chat/stop.ts`
|
||||
|
||||
```typescript
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { authChatCrud } from '@/service/support/permission/auth/chat';
|
||||
import {
|
||||
setAgentRuntimeStop,
|
||||
waitForWorkflowComplete
|
||||
} from '@fastgpt/service/core/workflow/dispatch/workflowStatus';
|
||||
import { StopV2ChatSchema, type StopV2ChatResponse } from '@fastgpt/global/openapi/core/chat/controler/api';
|
||||
|
||||
async function handler(req: NextApiRequest, res: NextApiResponse): Promise<StopV2ChatResponse> {
|
||||
const { appId, chatId, outLinkAuthData } = StopV2ChatSchema.parse(req.body);
|
||||
|
||||
// 鉴权 (复用聊天 CRUD 鉴权)
|
||||
await authChatCrud({
|
||||
req,
|
||||
authToken: true,
|
||||
authApiKey: true,
|
||||
appId,
|
||||
chatId,
|
||||
...outLinkAuthData
|
||||
});
|
||||
|
||||
// 设置停止标志
|
||||
await setAgentRuntimeStop({
|
||||
appId,
|
||||
chatId
|
||||
});
|
||||
|
||||
// 等待工作流完成 (最多等待 5 秒)
|
||||
await waitForWorkflowComplete({ appId, chatId, timeout: 5000 });
|
||||
|
||||
return {
|
||||
success: true
|
||||
};
|
||||
}
|
||||
|
||||
export default NextAPI(handler);
|
||||
```
|
||||
|
||||
**接口文档** (`packages/global/openapi/core/chat/index.ts`):
|
||||
|
||||
```typescript
|
||||
export const ChatPath: OpenAPIPath = {
|
||||
// ... 其他路径
|
||||
|
||||
'/v2/chat/stop': {
|
||||
post: {
|
||||
summary: '停止 Agent 运行',
|
||||
description: `优雅停止正在运行的 Agent, 会尝试等待当前节点结束后返回,最长 5s,超过 5s 仍未结束,则会返回成功。
|
||||
LLM 节点,流输出时会同时被终止,但 HTTP 请求节点这种可能长时间运行的,不会被终止。`,
|
||||
tags: [TagsMap.chatPage],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: StopV2ChatSchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功停止工作流',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: StopV2ChatResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
**说明**:
|
||||
- 接口使用 `authChatCrud` 进行鉴权,支持 Token 和 API Key
|
||||
- 支持分享链接和团队空间的鉴权数据
|
||||
- 设置停止标志后等待最多 5 秒
|
||||
- 无论是否超时,都返回 `success: true`
|
||||
|
||||
## 5. 前端改造
|
||||
|
||||
由于当前代码已经能够正常工作,且 v2 版本的后端已经实现了基于 Redis 的停止机制,前端可以保持现有的简单实现:
|
||||
|
||||
**保持现有实现的原因**:
|
||||
1. 后端已经通过定时器轮询 Redis 实现了停止检测
|
||||
2. 前端调用 `abort()` 后,后端会在下个检测周期(100ms内)发现停止标志
|
||||
3. 简化前端逻辑,避免增加复杂性
|
||||
4. 用户体验上,立即中断连接响应更快
|
||||
|
||||
**可选的增强方案**:
|
||||
|
||||
如果需要在前端显示更详细的停止状态,可以添加 API 客户端函数:
|
||||
|
||||
**文件位置**: `projects/app/src/web/core/chat/api.ts`
|
||||
|
||||
```typescript
|
||||
import { POST } from '@/web/common/api/request';
|
||||
import type { StopV2ChatParams, StopV2ChatResponse } from '@fastgpt/global/openapi/core/chat/controler/api';
|
||||
|
||||
/**
|
||||
* 停止 v2 版本工作流运行
|
||||
*/
|
||||
export const stopV2Chat = (data: StopV2ChatParams) =>
|
||||
POST<StopV2ChatResponse>('/api/v2/chat/stop', data);
|
||||
```
|
||||
|
||||
**增强的 abortRequest 函数**:
|
||||
|
||||
```typescript
|
||||
/* Abort chat completions, questionGuide */
|
||||
const abortRequest = useMemoizedFn(async (reason: string = 'stop') => {
|
||||
// 先调用 abort 中断连接
|
||||
chatController.current?.abort(new Error(reason));
|
||||
questionGuideController.current?.abort(new Error(reason));
|
||||
pluginController.current?.abort(new Error(reason));
|
||||
|
||||
// v2 版本: 可选地通知后端优雅停止
|
||||
if (chatBoxData?.app?.version === 'v2' && appId && chatId) {
|
||||
try {
|
||||
await stopV2Chat({
|
||||
appId,
|
||||
chatId,
|
||||
outLinkAuthData
|
||||
});
|
||||
} catch (error) {
|
||||
// 静默失败,不影响用户体验
|
||||
console.warn('Failed to notify backend to stop workflow', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
**建议**:
|
||||
- **推荐**: 保持当前简单实现,后端已经足够健壮
|
||||
- **可选**: 如果需要更精确的停止状态追踪,可以实现上述增强方案
|
||||
|
||||
## 6. 完整调用流程
|
||||
|
||||
### 6.1 正常停止流程
|
||||
|
||||
```
|
||||
用户点击停止按钮
|
||||
↓
|
||||
前端: abortRequest()
|
||||
↓
|
||||
前端: chatController.abort() [立即中断 HTTP 连接]
|
||||
↓
|
||||
[可选] 前端: POST /api/v2/chat/stop
|
||||
↓
|
||||
后端: setAgentRuntimeStop(appId, chatId) [设置停止标志]
|
||||
↓
|
||||
后端: 定时器检测到 Redis 停止标志,更新内存变量 stopping = true
|
||||
↓
|
||||
后端: 下个节点执行前 checkIsStopping() 返回 true
|
||||
↓
|
||||
后端: 停止处理新节点,记录日志
|
||||
↓
|
||||
后端: 工作流 finally 块删除 Redis 停止标志
|
||||
↓
|
||||
[可选] 后端: waitForWorkflowComplete() 检测到停止标志被删除
|
||||
↓
|
||||
[可选] 前端: 显示停止成功提示
|
||||
```
|
||||
|
||||
### 6.2 超时流程
|
||||
|
||||
```
|
||||
[可选] 前端: POST /api/v2/chat/stop
|
||||
↓
|
||||
后端: setAgentRuntimeStop(appId, chatId)
|
||||
↓
|
||||
后端: waitForWorkflowComplete(timeout=5s)
|
||||
↓
|
||||
后端: 5秒后停止标志仍存在
|
||||
↓
|
||||
后端: 返回成功响应 (不区分超时)
|
||||
↓
|
||||
[可选] 前端: 显示成功提示
|
||||
↓
|
||||
后端: 工作流继续运行,最终完成后删除停止标志
|
||||
```
|
||||
|
||||
### 6.3 工作流自然完成流程
|
||||
|
||||
```
|
||||
工作流运行中
|
||||
↓
|
||||
所有节点执行完成
|
||||
↓
|
||||
dispatchWorkFlow.finally()
|
||||
↓
|
||||
删除 Redis 停止标志
|
||||
↓
|
||||
清理定时器
|
||||
↓
|
||||
60秒 TTL 确保即使删除失败也会自动清理
|
||||
```
|
||||
|
||||
### 6.4 时序说明
|
||||
|
||||
**关键时间点**:
|
||||
- **100ms**: 后端定时器检查 Redis 停止标志的频率
|
||||
- **5s**: stop 接口等待工作流完成的超时时间
|
||||
- **60s**: Redis 键的 TTL,自动清理时间
|
||||
|
||||
**响应时间**:
|
||||
- 用户点击停止 → HTTP 连接中断: **立即** (前端 abort)
|
||||
- 停止标志写入 Redis: **< 50ms** (Redis SETEX 操作)
|
||||
- 后端检测到停止: **< 100ms** (定时器轮询周期)
|
||||
- 当前节点停止执行: **取决于节点类型**
|
||||
- LLM 流式输出: **立即**中断流
|
||||
- HTTP 请求节点: **等待请求完成**
|
||||
- 其他节点: **等待当前操作完成**
|
||||
|
||||
## 7. 测试策略
|
||||
|
||||
### 7.1 单元测试
|
||||
|
||||
**Redis 工具函数测试**:
|
||||
- `setAgentRuntimeStop` / `shouldWorkflowStop` 基本功能
|
||||
- `delAgentRuntimeStopSign` 删除功能
|
||||
- `waitForWorkflowComplete` 等待机制和超时
|
||||
- 并发操作安全性
|
||||
|
||||
**文件位置**: `test/cases/service/core/app/workflow/workflowStatus.test.ts`
|
||||
|
||||
**测试用例**:
|
||||
```typescript
|
||||
describe('Workflow Status Redis Functions', () => {
|
||||
test('should set stopping sign')
|
||||
test('should return false for non-existent status')
|
||||
test('should detect stopping status')
|
||||
test('should return false after deleting stop sign')
|
||||
test('should wait for workflow completion')
|
||||
test('should timeout when waiting too long')
|
||||
test('should delete workflow stop sign')
|
||||
test('should handle concurrent stop sign operations')
|
||||
});
|
||||
```
|
||||
|
||||
|
|
@ -0,0 +1,475 @@
|
|||
---
|
||||
name: create-skill-file
|
||||
description: Guides Claude in creating well-structured SKILL.md files following best practices. Provides clear guidelines for naming, structure, and content organization to make skills easy to discover and execute.
|
||||
---
|
||||
|
||||
# Claude Agent Skill 编写规范
|
||||
|
||||
> 如何创建高质量的 SKILL.md 文件
|
||||
|
||||
## 目录
|
||||
|
||||
- [快速开始](#快速开始)
|
||||
- [核心原则](#核心原则)
|
||||
- [文件结构规范](#文件结构规范)
|
||||
- [命名和描述规范](#命名和描述规范)
|
||||
- [内容编写指南](#内容编写指南)
|
||||
- [质量检查清单](#质量检查清单)
|
||||
|
||||
---
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 3步创建 Skill
|
||||
|
||||
**第1步: 创建目录**
|
||||
|
||||
```bash
|
||||
mkdir -p .claude/skill/your-skill-name
|
||||
cd .claude/skill/your-skill-name
|
||||
```
|
||||
|
||||
**第2步: 创建 SKILL.md**
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: your-skill-name
|
||||
description: Brief description with trigger keywords and scenarios
|
||||
---
|
||||
|
||||
# Your Skill Title
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to [specific scenario]
|
||||
- User mentions "[keyword]"
|
||||
|
||||
## How It Works
|
||||
|
||||
1. Step 1: [Action]
|
||||
2. Step 2: [Action]
|
||||
|
||||
## Examples
|
||||
|
||||
**Input**: User request
|
||||
**Output**: Expected result
|
||||
```
|
||||
|
||||
**第3步: 测试**
|
||||
- 在对话中使用 description 中的关键词触发
|
||||
- 观察 Claude 是否正确执行
|
||||
- 根据效果调整
|
||||
|
||||
---
|
||||
|
||||
## 核心原则
|
||||
|
||||
### 1. 保持简洁
|
||||
|
||||
只添加 Claude **不知道**的新知识:
|
||||
- ✅ 项目特定的工作流程
|
||||
- ✅ 特殊的命名规范或格式要求
|
||||
- ✅ 自定义工具和脚本的使用方法
|
||||
- ❌ 通用编程知识
|
||||
- ❌ 显而易见的步骤
|
||||
|
||||
**示例对比**:
|
||||
|
||||
```markdown
|
||||
# ❌ 过度详细
|
||||
1. 创建 Python 文件
|
||||
2. 导入必要的库
|
||||
3. 定义函数
|
||||
4. 编写主程序逻辑
|
||||
|
||||
# ✅ 简洁有效
|
||||
使用 `scripts/api_client.py` 调用内部 API。
|
||||
请求头必须包含 `X-Internal-Token`(从环境变量 `INTERNAL_API_KEY` 获取)。
|
||||
```
|
||||
|
||||
### 2. 设定合适的自由度
|
||||
|
||||
| 自由度 | 适用场景 | 编写方式 |
|
||||
|--------|---------|---------|
|
||||
| **高** | 需要创造性、多种解决方案 | 提供指导原则,不限定具体步骤 |
|
||||
| **中** | 有推荐模式但允许变化 | 提供参数化示例和默认流程 |
|
||||
| **低** | 容易出错、需严格执行 | 提供详细的分步指令或脚本 |
|
||||
|
||||
**判断标准**:
|
||||
- 任务是否有明确的"正确答案"? → 低自由度
|
||||
- 是否需要适应不同场景? → 高自由度
|
||||
- 错误的代价有多大? → 代价高则用低自由度
|
||||
|
||||
### 3. 渐进式披露
|
||||
|
||||
将复杂内容分层组织:
|
||||
|
||||
```
|
||||
SKILL.md (主文档, 200-500行)
|
||||
├── reference.md (详细文档)
|
||||
├── examples.md (完整示例)
|
||||
└── scripts/ (可执行脚本)
|
||||
```
|
||||
|
||||
**规则**:
|
||||
- SKILL.md 超过 500行 → 拆分子文件
|
||||
- 子文件超过 100行 → 添加目录
|
||||
- 引用深度 ≤ 1层
|
||||
|
||||
---
|
||||
|
||||
## 文件结构规范
|
||||
|
||||
### YAML Frontmatter
|
||||
|
||||
```yaml
|
||||
---
|
||||
name: skill-name-here
|
||||
description: Clear description of what this skill does and when to activate it
|
||||
---
|
||||
```
|
||||
|
||||
**字段规范**:
|
||||
|
||||
| 字段 | 要求 | 说明 |
|
||||
|------|------|------|
|
||||
| `name` | 小写字母、数字、短横线,≤64字符 | 必须与目录名一致 |
|
||||
| `description` | 纯文本,≤1024字符 | 用于检索和激活 |
|
||||
|
||||
**命名禁忌**:
|
||||
- ❌ XML 标签、保留字(`anthropic`, `claude`)
|
||||
- ❌ 模糊词汇(`helper`, `utility`, `manager`)
|
||||
- ❌ 空格或下划线(用短横线 `-`)
|
||||
|
||||
**Description 技巧**:
|
||||
|
||||
```yaml
|
||||
# ❌ 过于泛化
|
||||
description: Helps with code tasks
|
||||
|
||||
# ✅ 具体且包含关键词
|
||||
description: Processes CSV files and generates Excel reports with charts. Use when user asks to convert data formats or create visual reports.
|
||||
|
||||
# ✅ 说明触发场景
|
||||
description: Analyzes Python code for security vulnerabilities using bandit. Activates when user mentions "security audit" or "vulnerability scan".
|
||||
```
|
||||
|
||||
### 目录组织
|
||||
|
||||
**基础结构**(简单 Skill):
|
||||
```
|
||||
skill-name/
|
||||
└── SKILL.md
|
||||
```
|
||||
|
||||
**标准结构**(推荐):
|
||||
```
|
||||
skill-name/
|
||||
├── SKILL.md
|
||||
├── templates/
|
||||
│ └── template.md
|
||||
└── scripts/
|
||||
└── script.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 命名和描述规范
|
||||
|
||||
### Skill 命名
|
||||
|
||||
**推荐格式**: 动名词形式 (verb-ing + noun)
|
||||
|
||||
```
|
||||
✅ 好的命名:
|
||||
- processing-csv-files
|
||||
- generating-api-docs
|
||||
- managing-database-migrations
|
||||
|
||||
❌ 不好的命名:
|
||||
- csv (过于简短)
|
||||
- data_processor (使用下划线)
|
||||
- helper (过于模糊)
|
||||
```
|
||||
|
||||
### Description 编写
|
||||
|
||||
**必须使用第三人称**:
|
||||
|
||||
```yaml
|
||||
# ❌ 错误
|
||||
description: I help you process PDFs
|
||||
|
||||
# ✅ 正确
|
||||
description: Processes PDF documents and extracts structured data
|
||||
```
|
||||
|
||||
**4C 原则**:
|
||||
- **Clear** (清晰): 避免术语和模糊词汇
|
||||
- **Concise** (简洁): 1-2句话说明核心功能
|
||||
- **Contextual** (上下文): 说明适用场景
|
||||
- **Complete** (完整): 功能 + 触发条件
|
||||
|
||||
---
|
||||
|
||||
## 内容编写指南
|
||||
|
||||
### "When to Use" 章节
|
||||
|
||||
明确说明触发场景:
|
||||
|
||||
```markdown
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to analyze Python code for type errors
|
||||
- User mentions "mypy" or "type checking"
|
||||
- User is working in a Python project with type hints
|
||||
- User needs to add type annotations
|
||||
```
|
||||
|
||||
**模式**:
|
||||
- 直接请求: "User asks to X"
|
||||
- 关键词: "User mentions 'keyword'"
|
||||
- 上下文: "User is working with X"
|
||||
- 任务类型: "User needs to X"
|
||||
|
||||
### 工作流设计
|
||||
|
||||
**简单线性流程**:
|
||||
|
||||
```markdown
|
||||
## How It Works
|
||||
|
||||
1. Scan the project for all `.py` files
|
||||
2. Run `mypy --strict` on each file
|
||||
3. Parse error output and categorize by severity
|
||||
4. Generate summary report with fix suggestions
|
||||
```
|
||||
|
||||
**条件分支流程**:
|
||||
|
||||
```markdown
|
||||
## Workflow
|
||||
|
||||
1. **Check project type**
|
||||
- If Django → Use `django-stubs` config
|
||||
- If Flask → Use `flask-stubs` config
|
||||
- Otherwise → Use default mypy config
|
||||
|
||||
2. **Run type checking**
|
||||
- If errors found → Proceed to step 3
|
||||
- If no errors → Report success and exit
|
||||
```
|
||||
|
||||
**Checklist 模式**(验证型任务):
|
||||
|
||||
```markdown
|
||||
## Pre-deployment Checklist
|
||||
|
||||
Execute in order. Stop if any step fails.
|
||||
|
||||
- [ ] Run tests: `npm test` (must pass)
|
||||
- [ ] Build: `npm run build` (no errors)
|
||||
- [ ] Check deps: `npm audit` (no critical vulnerabilities)
|
||||
```
|
||||
|
||||
### 示例和模板
|
||||
|
||||
**输入-输出示例**:
|
||||
|
||||
```markdown
|
||||
## Examples
|
||||
|
||||
### Example 1: Basic Check
|
||||
|
||||
**User Request**: "Check my code for type errors"
|
||||
|
||||
**Action**:
|
||||
1. Scan for `.py` files
|
||||
2. Run `mypy` on all files
|
||||
|
||||
**Output**:
|
||||
|
||||
Found 3 type errors in 2 files:
|
||||
src/main.py:15: error: Missing return type
|
||||
src/utils.py:42: error: Incompatible types
|
||||
|
||||
```
|
||||
|
||||
### 脚本集成
|
||||
|
||||
**何时使用脚本**:
|
||||
- 简单命令 → 直接在 SKILL.md 中说明
|
||||
- 复杂流程 → 提供独立脚本
|
||||
|
||||
**脚本编写规范**:
|
||||
|
||||
```python
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Brief description of what this script does.
|
||||
|
||||
Usage:
|
||||
python script.py <arg> [--option value]
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
||||
DEFAULT_VALUE = 80 # Use constants, not magic numbers
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("directory", help="Directory to process")
|
||||
parser.add_argument("--threshold", type=int, default=DEFAULT_VALUE)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Validate inputs
|
||||
if not Path(args.directory).is_dir():
|
||||
print(f"Error: {args.directory} not found")
|
||||
return 1
|
||||
|
||||
# Execute
|
||||
result = process(args.directory, args.threshold)
|
||||
|
||||
# Report
|
||||
print(f"Processed {result['count']} files")
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(main())
|
||||
```
|
||||
|
||||
**关键规范**:
|
||||
- ✅ Shebang 行和 docstring
|
||||
- ✅ 类型注解和常量
|
||||
- ✅ 参数验证和错误处理
|
||||
- ✅ 清晰的返回值(0=成功, 1=失败)
|
||||
|
||||
### 最佳实践
|
||||
|
||||
**Do**:
|
||||
- ✅ 提供可执行的命令和脚本
|
||||
- ✅ 包含输入-输出示例
|
||||
- ✅ 说明验证标准和成功条件
|
||||
- ✅ 包含 Do/Don't 清单
|
||||
|
||||
**Don't**:
|
||||
- ❌ 包含 Claude 已知的通用知识
|
||||
- ❌ 使用抽象描述而非具体步骤
|
||||
- ❌ 遗漏错误处理指导
|
||||
- ❌ 示例使用伪代码而非真实代码
|
||||
|
||||
---
|
||||
|
||||
## 质量检查清单
|
||||
|
||||
### 核心质量
|
||||
|
||||
- [ ] `name` 符合命名规范(小写、短横线、≤64字符)
|
||||
- [ ] `description` 包含触发关键词和场景(≤1024字符)
|
||||
- [ ] 名称与目录名一致
|
||||
- [ ] 只包含 Claude 不知道的信息
|
||||
- [ ] 没有冗余或重复内容
|
||||
|
||||
### 功能完整性
|
||||
|
||||
- [ ] 有"When to Use"章节,列出 3-5 个触发场景
|
||||
- [ ] 有清晰的执行流程或步骤
|
||||
- [ ] 至少 2-3 个完整示例
|
||||
- [ ] 包含输入和预期输出
|
||||
- [ ] 错误处理有指导
|
||||
|
||||
### 结构规范
|
||||
|
||||
- [ ] 章节组织清晰
|
||||
- [ ] 超过 200行有目录导航
|
||||
- [ ] 引用层级 ≤ 1层
|
||||
- [ ] 所有路径使用正斜杠 `/`
|
||||
- [ ] 术语使用一致
|
||||
|
||||
### 脚本和模板
|
||||
|
||||
- [ ] 脚本包含使用说明和参数文档
|
||||
- [ ] 脚本有错误处理
|
||||
- [ ] 避免魔法数字,使用配置
|
||||
- [ ] 模板格式清晰易用
|
||||
|
||||
### 最终检查
|
||||
|
||||
- [ ] 通读全文,确保流畅易读
|
||||
- [ ] 使用实际场景测试触发
|
||||
- [ ] 长度适中(200-500行,或已拆分)
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q: Skill 多长才合适?**
|
||||
- 最小: 50-100行
|
||||
- 理想: 200-500行
|
||||
- 最大: 500行(超过则拆分)
|
||||
|
||||
**Q: 如何让 Skill 更容易激活?**
|
||||
- 在 `description` 中使用用户会说的关键词
|
||||
- 说明具体场景("when user asks to X")
|
||||
- 提及相关工具名称
|
||||
|
||||
**Q: 多个 Skill 功能重叠怎么办?**
|
||||
- 使用更具体的 `description` 区分
|
||||
- 在"When to Use"中说明关系
|
||||
- 考虑合并为一个 Skill
|
||||
|
||||
**Q: Skill 需要维护吗?**
|
||||
- 每季度审查一次,更新过时信息
|
||||
- 根据使用反馈迭代
|
||||
- 工具或 API 变更时及时更新
|
||||
|
||||
---
|
||||
|
||||
## 快速参考
|
||||
|
||||
### Frontmatter 模板
|
||||
|
||||
```yaml
|
||||
---
|
||||
name: skill-name
|
||||
description: Brief description with trigger keywords
|
||||
---
|
||||
```
|
||||
|
||||
### 基础结构模板
|
||||
|
||||
```markdown
|
||||
# Skill Title
|
||||
|
||||
## When to Use This Skill
|
||||
- Scenario 1
|
||||
- Scenario 2
|
||||
|
||||
## How It Works
|
||||
1. Step 1
|
||||
2. Step 2
|
||||
|
||||
## Examples
|
||||
### Example 1
|
||||
...
|
||||
|
||||
## References
|
||||
- [Link](url)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 相关资源
|
||||
|
||||
- [Claude Agent Skills 官方文档](https://docs.claude.com/en/docs/agents-and-tools/agent-skills)
|
||||
- [Best Practices Checklist](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices)
|
||||
- [模板文件](templates/) - 开箱即用的模板
|
||||
- [基础 skill 的模板](templates/basic-skill-template.md)
|
||||
- [工作流 skill 的模板](templates/workflow-skill-template.md)
|
||||
- [示例库](examples/) - 完整的 Skill 示例
|
||||
- [优秀示例](examples/good-example.md)
|
||||
- [常见错误示例](examples/bad-example.md)
|
||||
|
||||
---
|
||||
|
|
@ -0,0 +1,867 @@
|
|||
# 不好的 Skill 示例与改进建议
|
||||
|
||||
本文档展示常见的 Skill 编写错误,并提供改进建议。
|
||||
|
||||
---
|
||||
|
||||
## 示例 1: 过于模糊的 Skill
|
||||
|
||||
### ❌ 不好的版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: helper
|
||||
description: Helps with code
|
||||
---
|
||||
|
||||
# Code Helper
|
||||
|
||||
This skill helps you with coding tasks.
|
||||
|
||||
## Usage
|
||||
|
||||
Use this when you need help with code.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. Analyzes your code
|
||||
2. Provides suggestions
|
||||
3. Helps improve it
|
||||
```
|
||||
|
||||
### 问题分析
|
||||
|
||||
| 问题 | 说明 | 影响 |
|
||||
|------|------|------|
|
||||
| **模糊的名称** | "helper" 太泛化,没有说明具体做什么 | Claude 不知道何时激活 |
|
||||
| **无关键词** | description 缺少具体触发词 | 用户很难激活这个 Skill |
|
||||
| **无具体场景** | 没说明适用什么类型的代码 | 适用范围不清 |
|
||||
| **抽象的步骤** | "Provides suggestions" 太模糊 | Claude 不知道具体做什么 |
|
||||
| **无示例** | 没有实际例子 | 用户和 Claude 都不清楚预期输出 |
|
||||
|
||||
### ✅ 改进版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: python-code-refactoring
|
||||
description: Refactors Python code to improve readability and maintainability using standard patterns. Activates when user asks to clean up code, improve structure, or mentions refactoring. Focuses on function extraction, variable naming, and removing code smells.
|
||||
---
|
||||
|
||||
# Python Code Refactoring Skill
|
||||
|
||||
Improves Python code quality through systematic refactoring.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to "refactor this code", "clean up this function", or "improve readability"
|
||||
- User mentions "code smell", "technical debt", or "maintainability"
|
||||
- User is working with Python code that has:
|
||||
- Long functions (>50 lines)
|
||||
- Nested conditionals (>3 levels)
|
||||
- Repeated code patterns
|
||||
- Unclear variable names
|
||||
|
||||
## How It Works
|
||||
|
||||
### 1. Identify Refactoring Opportunities
|
||||
|
||||
Scan code for common issues:
|
||||
- Functions longer than 50 lines
|
||||
- Repeated code blocks (DRY violations)
|
||||
- Magic numbers without constants
|
||||
- Unclear variable names (x, temp, data)
|
||||
- Deep nesting (>3 levels)
|
||||
|
||||
### 2. Prioritize Changes
|
||||
|
||||
Focus on high-impact refactorings:
|
||||
- **High**: Extract complex nested logic to functions
|
||||
- **Medium**: Rename unclear variables
|
||||
- **Low**: Minor style improvements
|
||||
|
||||
### 3. Apply Refactorings
|
||||
|
||||
**Extract Method**:
|
||||
```python
|
||||
# Before
|
||||
def process_order(order):
|
||||
# 50 lines of validation logic
|
||||
# 30 lines of payment processing
|
||||
# 20 lines of email notification
|
||||
|
||||
# After
|
||||
def process_order(order):
|
||||
validate_order(order)
|
||||
process_payment(order)
|
||||
send_confirmation_email(order)
|
||||
```
|
||||
|
||||
**Replace Magic Numbers**:
|
||||
```python
|
||||
# Before
|
||||
if user.age < 18:
|
||||
return False
|
||||
|
||||
# After
|
||||
MINIMUM_AGE = 18
|
||||
if user.age < MINIMUM_AGE:
|
||||
return False
|
||||
```
|
||||
|
||||
**Simplify Conditionals**:
|
||||
```python
|
||||
# Before
|
||||
if user.role == 'admin':
|
||||
return True
|
||||
elif user.role == 'moderator':
|
||||
return True
|
||||
elif user.role == 'editor':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# After
|
||||
PRIVILEGED_ROLES = {'admin', 'moderator', 'editor'}
|
||||
return user.role in PRIVILEGED_ROLES
|
||||
```
|
||||
|
||||
### 4. Verify Improvements
|
||||
|
||||
After refactoring:
|
||||
- Run existing tests (all must pass)
|
||||
- Check code length reduced
|
||||
- Verify improved readability
|
||||
|
||||
## Example
|
||||
|
||||
**User Request**: "Refactor this function, it's too long"
|
||||
|
||||
```python
|
||||
def process_user_registration(data):
|
||||
if not data.get('email'):
|
||||
return {'error': 'Email required'}
|
||||
if '@' not in data['email']:
|
||||
return {'error': 'Invalid email'}
|
||||
if not data.get('password'):
|
||||
return {'error': 'Password required'}
|
||||
if len(data['password']) < 8:
|
||||
return {'error': 'Password too short'}
|
||||
if not any(c.isupper() for c in data['password']):
|
||||
return {'error': 'Password needs uppercase'}
|
||||
existing = db.query(User).filter_by(email=data['email']).first()
|
||||
if existing:
|
||||
return {'error': 'Email already registered'}
|
||||
salt = bcrypt.gensalt()
|
||||
hashed = bcrypt.hashpw(data['password'].encode(), salt)
|
||||
user = User(email=data['email'], password_hash=hashed)
|
||||
db.add(user)
|
||||
db.commit()
|
||||
token = jwt.encode({'user_id': user.id}, SECRET_KEY)
|
||||
send_email(data['email'], 'Welcome!', 'Thanks for registering')
|
||||
return {'success': True, 'token': token}
|
||||
```
|
||||
|
||||
**Refactored**:
|
||||
|
||||
```python
|
||||
def process_user_registration(data):
|
||||
"""Register new user with validation and email confirmation."""
|
||||
# Validation
|
||||
validation_error = validate_registration_data(data)
|
||||
if validation_error:
|
||||
return {'error': validation_error}
|
||||
|
||||
# Check uniqueness
|
||||
if user_exists(data['email']):
|
||||
return {'error': 'Email already registered'}
|
||||
|
||||
# Create user
|
||||
user = create_user(data['email'], data['password'])
|
||||
|
||||
# Generate token
|
||||
token = generate_auth_token(user.id)
|
||||
|
||||
# Send welcome email
|
||||
send_welcome_email(user.email)
|
||||
|
||||
return {'success': True, 'token': token}
|
||||
|
||||
|
||||
def validate_registration_data(data):
|
||||
"""Validate registration data, return error message or None."""
|
||||
if not data.get('email'):
|
||||
return 'Email required'
|
||||
if '@' not in data['email']:
|
||||
return 'Invalid email'
|
||||
if not data.get('password'):
|
||||
return 'Password required'
|
||||
return validate_password_strength(data['password'])
|
||||
|
||||
|
||||
def validate_password_strength(password):
|
||||
"""Check password meets security requirements."""
|
||||
MIN_PASSWORD_LENGTH = 8
|
||||
if len(password) < MIN_PASSWORD_LENGTH:
|
||||
return f'Password must be at least {MIN_PASSWORD_LENGTH} characters'
|
||||
if not any(c.isupper() for c in password):
|
||||
return 'Password must contain uppercase letter'
|
||||
return None
|
||||
|
||||
|
||||
def user_exists(email):
|
||||
"""Check if user with given email already exists."""
|
||||
return db.query(User).filter_by(email=email).first() is not None
|
||||
|
||||
|
||||
def create_user(email, password):
|
||||
"""Create and save new user with hashed password."""
|
||||
salt = bcrypt.gensalt()
|
||||
hashed = bcrypt.hashpw(password.encode(), salt)
|
||||
user = User(email=email, password_hash=hashed)
|
||||
db.add(user)
|
||||
db.commit()
|
||||
return user
|
||||
|
||||
|
||||
def generate_auth_token(user_id):
|
||||
"""Generate JWT authentication token."""
|
||||
return jwt.encode({'user_id': user_id}, SECRET_KEY)
|
||||
|
||||
|
||||
def send_welcome_email(email):
|
||||
"""Send welcome email to new user."""
|
||||
send_email(email, 'Welcome!', 'Thanks for registering')
|
||||
```
|
||||
|
||||
**Improvements**:
|
||||
- ✅ Main function reduced from 20 lines to 15 lines
|
||||
- ✅ Each function has single responsibility
|
||||
- ✅ Magic number (8) extracted to constant
|
||||
- ✅ All functions documented with docstrings
|
||||
- ✅ Easier to test individual functions
|
||||
- ✅ Easier to modify validation rules
|
||||
|
||||
## Best Practices
|
||||
|
||||
- ✅ Extract functions with clear names
|
||||
- ✅ Use constants instead of magic numbers
|
||||
- ✅ Keep functions under 30 lines
|
||||
- ✅ Maximum nesting depth of 2-3 levels
|
||||
- ✅ Write docstrings for extracted functions
|
||||
```
|
||||
|
||||
### 改进要点
|
||||
|
||||
1. ✅ 具体的名称: `python-code-refactoring` 而非 `helper`
|
||||
2. ✅ 详细的 description: 包含触发词和适用场景
|
||||
3. ✅ 明确的触发条件: 列出具体的使用场景
|
||||
4. ✅ 可执行的步骤: 每个步骤都有具体操作
|
||||
5. ✅ 实际代码示例: 展示完整的重构过程
|
||||
6. ✅ 具体的改进指标: 列出可验证的改进效果
|
||||
|
||||
---
|
||||
|
||||
## 示例 2: 过度冗长的 Skill
|
||||
|
||||
### ❌ 不好的版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: python-basics
|
||||
description: Teaches Python programming basics
|
||||
---
|
||||
|
||||
# Python Basics
|
||||
|
||||
This skill helps you learn Python programming.
|
||||
|
||||
## Variables
|
||||
|
||||
In Python, you can create variables like this:
|
||||
|
||||
```python
|
||||
x = 5
|
||||
y = "hello"
|
||||
z = 3.14
|
||||
```
|
||||
|
||||
Python supports different data types:
|
||||
- Integers (int): whole numbers like 1, 2, 3
|
||||
- Floats (float): decimal numbers like 3.14, 2.5
|
||||
- Strings (str): text like "hello", 'world'
|
||||
- Booleans (bool): True or False
|
||||
|
||||
## Conditional Statements
|
||||
|
||||
You can use if statements to make decisions:
|
||||
|
||||
```python
|
||||
if x > 0:
|
||||
print("Positive")
|
||||
elif x < 0:
|
||||
print("Negative")
|
||||
else:
|
||||
print("Zero")
|
||||
```
|
||||
|
||||
The if statement checks a condition. If True, it runs the indented code.
|
||||
The elif means "else if" and provides an alternative condition.
|
||||
The else runs if none of the above conditions are True.
|
||||
|
||||
## Loops
|
||||
|
||||
Python has two main types of loops:
|
||||
|
||||
### For Loops
|
||||
|
||||
For loops iterate over a sequence:
|
||||
|
||||
```python
|
||||
for i in range(5):
|
||||
print(i)
|
||||
```
|
||||
|
||||
This prints numbers 0 through 4. The range() function generates numbers.
|
||||
|
||||
### While Loops
|
||||
|
||||
While loops continue while a condition is True:
|
||||
|
||||
```python
|
||||
i = 0
|
||||
while i < 5:
|
||||
print(i)
|
||||
i += 1
|
||||
```
|
||||
|
||||
This does the same thing as the for loop above.
|
||||
|
||||
## Functions
|
||||
|
||||
Functions are reusable blocks of code:
|
||||
|
||||
```python
|
||||
def greet(name):
|
||||
return f"Hello, {name}!"
|
||||
```
|
||||
|
||||
The def keyword defines a function. The function name is greet.
|
||||
It takes one parameter called name. The return statement sends back a value.
|
||||
|
||||
## Lists
|
||||
|
||||
Lists store multiple items:
|
||||
|
||||
```python
|
||||
fruits = ["apple", "banana", "orange"]
|
||||
```
|
||||
|
||||
You can access items by index:
|
||||
|
||||
```python
|
||||
first_fruit = fruits[0] # "apple"
|
||||
```
|
||||
|
||||
... [continues for 50 more sections about Python basics]
|
||||
```
|
||||
|
||||
### 问题分析
|
||||
|
||||
| 问题 | 说明 | 影响 |
|
||||
|------|------|------|
|
||||
| **包含通用知识** | Python 基础知识 Claude 已经知道 | 浪费 token,增加检索成本 |
|
||||
| **教程式内容** | 像教程而非工作指南 | Claude 不需要学习,需要的是工作指导 |
|
||||
| **过度详细** | 解释显而易见的概念 | 信息过载,难以找到关键信息 |
|
||||
| **缺少项目特定信息** | 没有项目相关的规范或约定 | 无法提供项目特定价值 |
|
||||
|
||||
### ✅ 改进版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: project-python-conventions
|
||||
description: Enforces Python coding conventions specific to this project. Activates when user writes Python code or asks about code style. Covers naming, imports, error handling, and project-specific patterns.
|
||||
---
|
||||
|
||||
# Project Python Conventions
|
||||
|
||||
Project-specific Python coding standards and patterns.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User is writing or reviewing Python code
|
||||
- User asks about code style or conventions
|
||||
- User needs guidance on project patterns
|
||||
|
||||
## Import Organization
|
||||
|
||||
Follow this order:
|
||||
|
||||
```python
|
||||
# 1. Standard library
|
||||
import os
|
||||
import sys
|
||||
from typing import Optional, List
|
||||
|
||||
# 2. Third-party packages
|
||||
import numpy as np
|
||||
from fastapi import FastAPI
|
||||
|
||||
# 3. Local application imports
|
||||
from core.models import User
|
||||
from utils.helpers import format_date
|
||||
```
|
||||
|
||||
## Naming Conventions
|
||||
|
||||
### Project-Specific Rules
|
||||
|
||||
| Type | Pattern | Example |
|
||||
|------|---------|---------|
|
||||
| API endpoints | `/api/v1/{resource}` | `/api/v1/users` |
|
||||
| Database tables | `{resource}_table` | `users_table` |
|
||||
| Environment variables | `APP_{NAME}` | `APP_DATABASE_URL` |
|
||||
| Config files | `{env}.config.py` | `prod.config.py` |
|
||||
|
||||
### Forbidden Patterns
|
||||
|
||||
```python
|
||||
# ❌ Don't use single-letter variables (except i, j, k in loops)
|
||||
d = get_data()
|
||||
|
||||
# ✅ Do use descriptive names
|
||||
user_data = get_data()
|
||||
|
||||
# ❌ Don't use abbreviations
|
||||
usr_mgr = UserManager()
|
||||
|
||||
# ✅ Do use full words
|
||||
user_manager = UserManager()
|
||||
```
|
||||
|
||||
## Error Handling Pattern
|
||||
|
||||
Use project's custom exceptions:
|
||||
|
||||
```python
|
||||
from core.exceptions import UserNotFoundError, ValidationError
|
||||
|
||||
def get_user(user_id: int) -> User:
|
||||
"""
|
||||
Retrieve user by ID.
|
||||
|
||||
Raises:
|
||||
UserNotFoundError: If user doesn't exist
|
||||
ValidationError: If user_id is invalid
|
||||
"""
|
||||
if not isinstance(user_id, int) or user_id <= 0:
|
||||
raise ValidationError(f"Invalid user_id: {user_id}")
|
||||
|
||||
user = db.query(User).get(user_id)
|
||||
if user is None:
|
||||
raise UserNotFoundError(f"User {user_id} not found")
|
||||
|
||||
return user
|
||||
```
|
||||
|
||||
**Never** use bare `except:` - always catch specific exceptions.
|
||||
|
||||
## Database Queries
|
||||
|
||||
Always use the project's query helper:
|
||||
|
||||
```python
|
||||
# ❌ Don't use raw SQLAlchemy queries
|
||||
users = db.query(User).filter(User.age > 18).all()
|
||||
|
||||
# ✅ Do use query helper
|
||||
from core.database import QueryBuilder
|
||||
|
||||
users = QueryBuilder(User).where('age', '>', 18).get()
|
||||
```
|
||||
|
||||
## API Response Format
|
||||
|
||||
All API endpoints must return this format:
|
||||
|
||||
```python
|
||||
{
|
||||
"success": True,
|
||||
"data": {
|
||||
# ... response data
|
||||
},
|
||||
"error": None,
|
||||
"meta": {
|
||||
"timestamp": "2025-01-31T12:00:00Z",
|
||||
"version": "1.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use the response helper:
|
||||
|
||||
```python
|
||||
from core.responses import success_response, error_response
|
||||
|
||||
@app.get("/users/{id}")
|
||||
async def get_user(id: int):
|
||||
try:
|
||||
user = get_user_data(id)
|
||||
return success_response(user)
|
||||
except UserNotFoundError as e:
|
||||
return error_response(str(e), status_code=404)
|
||||
```
|
||||
|
||||
## Testing Patterns
|
||||
|
||||
### Test File Location
|
||||
|
||||
```
|
||||
project/
|
||||
├── src/
|
||||
│ └── services/
|
||||
│ └── user_service.py
|
||||
└── tests/
|
||||
└── services/
|
||||
└── test_user_service.py
|
||||
```
|
||||
|
||||
### Test Naming
|
||||
|
||||
```python
|
||||
# Format: test_{function_name}_{scenario}_{expected_result}
|
||||
|
||||
def test_get_user_valid_id_returns_user():
|
||||
"""Test getting user with valid ID returns User object."""
|
||||
pass
|
||||
|
||||
def test_get_user_invalid_id_raises_validation_error():
|
||||
"""Test getting user with invalid ID raises ValidationError."""
|
||||
pass
|
||||
|
||||
def test_get_user_nonexistent_id_raises_not_found_error():
|
||||
"""Test getting non-existent user raises UserNotFoundError."""
|
||||
pass
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [Full Style Guide](docs/STYLE_GUIDE.md)
|
||||
- [API Standards](docs/API_STANDARDS.md)
|
||||
- [Database Conventions](docs/DATABASE.md)
|
||||
```
|
||||
|
||||
### 改进要点
|
||||
|
||||
1. ✅ 只包含项目特定信息: 不教 Python 基础
|
||||
2. ✅ 简洁明了: 200 行 vs 原来的 500+ 行
|
||||
3. ✅ 实用的规则: 直接可应用的约定
|
||||
4. ✅ 清晰的示例: Do/Don't 对比
|
||||
5. ✅ 引用详细文档: 用链接而非全部内容
|
||||
|
||||
---
|
||||
|
||||
## 示例 3: 缺少上下文的 Skill
|
||||
|
||||
### ❌ 不好的版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: deployment
|
||||
description: Deploys code
|
||||
---
|
||||
|
||||
# Deployment
|
||||
|
||||
## Steps
|
||||
|
||||
1. Build the code
|
||||
2. Run tests
|
||||
3. Deploy to server
|
||||
4. Verify deployment
|
||||
```
|
||||
|
||||
### 问题分析
|
||||
|
||||
| 问题 | 说明 | 影响 |
|
||||
|------|------|------|
|
||||
| **无具体命令** | 没说明如何 build, test, deploy | Claude 无法执行 |
|
||||
| **无环境区分** | 开发、测试、生产部署可能不同 | 可能部署到错误环境 |
|
||||
| **无错误处理** | 没说明出错时怎么办 | 失败时不知如何恢复 |
|
||||
| **无验证标准** | "Verify" 太模糊 | 不知道检查什么 |
|
||||
|
||||
### ✅ 改进版本
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: deploy-to-production
|
||||
description: Deploys application to production environment on AWS. Activates when user asks to deploy to prod or mentions production deployment. Includes pre-flight checks, blue-green deployment, and rollback procedures.
|
||||
---
|
||||
|
||||
# Production Deployment
|
||||
|
||||
Safely deploy application to production with zero downtime.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to "deploy to production" or "push to prod"
|
||||
- User mentions "production deployment", "go live"
|
||||
- User needs to rollback a deployment
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before deployment, verify:
|
||||
|
||||
```bash
|
||||
# 1. On main branch
|
||||
git branch --show-current # Must be "main"
|
||||
|
||||
# 2. All tests pass
|
||||
npm test # Exit code must be 0
|
||||
|
||||
# 3. Build succeeds
|
||||
npm run build # Must complete without errors
|
||||
|
||||
# 4. No uncommitted changes
|
||||
git status # Must show "nothing to commit"
|
||||
|
||||
# 5. Latest code pulled
|
||||
git pull origin main # Must be up to date
|
||||
```
|
||||
|
||||
If any prerequisite fails, **stop** and fix the issue.
|
||||
|
||||
## Deployment Process
|
||||
|
||||
### Step 1: Pre-flight Checks
|
||||
|
||||
```bash
|
||||
# Run deployment readiness script
|
||||
./scripts/preflight-check.sh
|
||||
|
||||
# Expected output:
|
||||
# ✓ Tests passed
|
||||
# ✓ Build succeeded
|
||||
# ✓ Environment variables configured
|
||||
# ✓ Database migrations ready
|
||||
# ✓ Ready to deploy
|
||||
```
|
||||
|
||||
### Step 2: Database Migrations (if needed)
|
||||
|
||||
```bash
|
||||
# Connect to production database
|
||||
aws rds describe-db-instances --db-instance-identifier prod-db
|
||||
|
||||
# Backup before migration
|
||||
./scripts/backup-database.sh prod
|
||||
|
||||
# Run migrations
|
||||
NODE_ENV=production npm run migrate
|
||||
|
||||
# Verify migration succeeded
|
||||
npm run migrate:status
|
||||
```
|
||||
|
||||
### Step 3: Blue-Green Deployment
|
||||
|
||||
```bash
|
||||
# Deploy to green environment (inactive)
|
||||
aws elasticbeanstalk create-environment \
|
||||
--application-name myapp \
|
||||
--environment-name myapp-prod-green \
|
||||
--solution-stack-name "64bit Amazon Linux 2 v5.x.x running Node.js 18"
|
||||
|
||||
# Wait for green environment to be healthy
|
||||
aws elasticbeanstalk wait environment-updated \
|
||||
--environment-name myapp-prod-green
|
||||
|
||||
# Check green environment health
|
||||
curl https://myapp-prod-green.aws.com/health
|
||||
# Expected: {"status": "healthy"}
|
||||
```
|
||||
|
||||
### Step 4: Smoke Tests
|
||||
|
||||
```bash
|
||||
# Run smoke tests against green environment
|
||||
BASE_URL=https://myapp-prod-green.aws.com npm run test:smoke
|
||||
|
||||
# Tests must include:
|
||||
# - Health check endpoint
|
||||
# - Authentication flow
|
||||
# - Critical API endpoints
|
||||
# - Database connectivity
|
||||
```
|
||||
|
||||
### Step 5: Switch Traffic
|
||||
|
||||
```bash
|
||||
# Swap URLs (blue becomes green, green becomes blue)
|
||||
aws elasticbeanstalk swap-environment-cnames \
|
||||
--source-environment-name myapp-prod-blue \
|
||||
--destination-environment-name myapp-prod-green
|
||||
|
||||
# Wait 5 minutes for DNS propagation
|
||||
echo "Waiting for DNS propagation..."
|
||||
sleep 300
|
||||
|
||||
# Verify production URL serves new version
|
||||
curl https://myapp.com/version
|
||||
# Expected: {"version": "1.2.3"} (new version)
|
||||
```
|
||||
|
||||
### Step 6: Monitor
|
||||
|
||||
```bash
|
||||
# Monitor error rates for 15 minutes
|
||||
aws cloudwatch get-metric-statistics \
|
||||
--namespace AWS/ELB \
|
||||
--metric-name HTTPCode_Backend_5XX \
|
||||
--start-time $(date -u -d '15 minutes ago' +%Y-%m-%dT%H:%M:%S) \
|
||||
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
|
||||
--period 300 \
|
||||
--statistics Sum
|
||||
|
||||
# Error rate must be < 1%
|
||||
```
|
||||
|
||||
If error rate exceeds 1%:
|
||||
- **Rollback immediately** (see Rollback section)
|
||||
- Investigate issue
|
||||
- Fix and redeploy
|
||||
|
||||
### Step 7: Cleanup
|
||||
|
||||
```bash
|
||||
# After 24 hours, if no issues:
|
||||
# Terminate old blue environment
|
||||
aws elasticbeanstalk terminate-environment \
|
||||
--environment-name myapp-prod-blue
|
||||
```
|
||||
|
||||
## Rollback Procedure
|
||||
|
||||
If deployment fails:
|
||||
|
||||
```bash
|
||||
# 1. Swap back to previous version
|
||||
aws elasticbeanstalk swap-environment-cnames \
|
||||
--source-environment-name myapp-prod-green \
|
||||
--destination-environment-name myapp-prod-blue
|
||||
|
||||
# 2. Verify old version is serving
|
||||
curl https://myapp.com/version
|
||||
# Expected: {"version": "1.2.2"} (old version)
|
||||
|
||||
# 3. Rollback database migrations (if ran)
|
||||
NODE_ENV=production npm run migrate:rollback
|
||||
|
||||
# 4. Notify team
|
||||
./scripts/notify-rollback.sh "Deployment rolled back due to [reason]"
|
||||
```
|
||||
|
||||
## Example Deployment
|
||||
|
||||
**User Request**: "Deploy v1.2.3 to production"
|
||||
|
||||
**Execution Log**:
|
||||
|
||||
```
|
||||
[14:00:00] Starting deployment of v1.2.3 to production
|
||||
[14:00:05] ✓ Pre-flight checks passed
|
||||
[14:00:10] ✓ Database backup completed
|
||||
[14:00:30] ✓ Database migrations applied (3 migrations)
|
||||
[14:01:00] → Creating green environment
|
||||
[14:05:00] ✓ Green environment healthy
|
||||
[14:05:30] ✓ Smoke tests passed (12/12)
|
||||
[14:06:00] → Switching traffic to green environment
|
||||
[14:11:00] ✓ DNS propagated
|
||||
[14:11:05] ✓ Production serving v1.2.3
|
||||
[14:11:10] → Monitoring for 15 minutes
|
||||
[14:26:10] ✓ Error rate: 0.05% (within threshold)
|
||||
[14:26:15] ✓ Deployment successful
|
||||
[14:26:20] → Old environment will be terminated in 24h
|
||||
|
||||
Deployment completed successfully in 26 minutes
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [AWS Deployment Guide](docs/AWS_DEPLOYMENT.md)
|
||||
- [Runbook](docs/RUNBOOK.md)
|
||||
- [On-Call Procedures](docs/ONCALL.md)
|
||||
```
|
||||
|
||||
### 改进要点
|
||||
|
||||
1. ✅ 具体命令: 每个步骤都有可执行的命令
|
||||
2. ✅ 环境明确: 专注于生产环境部署
|
||||
3. ✅ 验证标准: 说明检查什么和预期结果
|
||||
4. ✅ 错误处理: 包含完整的回滚流程
|
||||
5. ✅ 实际输出: 展示命令的预期输出
|
||||
6. ✅ 监控指标: 定义具体的成功标准
|
||||
|
||||
---
|
||||
|
||||
## 常见错误总结
|
||||
|
||||
### 1. 命名和描述问题
|
||||
|
||||
| 错误 | 示例 | 改进 |
|
||||
|------|------|------|
|
||||
| 过于泛化 | `name: helper` | `name: python-type-hints` |
|
||||
| 缺少关键词 | `description: Helps with code` | `description: Adds type hints to Python using mypy` |
|
||||
| 使用第一人称 | `description: I help you...` | `description: Adds type hints...` |
|
||||
|
||||
### 2. 内容问题
|
||||
|
||||
| 错误 | 说明 | 改进 |
|
||||
|------|------|------|
|
||||
| 包含通用知识 | 教 Python 基础语法 | 只包含项目特定规范 |
|
||||
| 过于抽象 | "分析代码并提供建议" | "检查函数长度、变量命名、重复代码" |
|
||||
| 缺少示例 | 只有文字描述 | 包含输入-输出示例 |
|
||||
|
||||
### 3. 结构问题
|
||||
|
||||
| 错误 | 说明 | 改进 |
|
||||
|------|------|------|
|
||||
| 无层次结构 | 所有内容混在一起 | 使用标题、列表、代码块组织 |
|
||||
| 缺少"When to Use" | 不知道何时激活 | 列出 3-5 个触发场景 |
|
||||
| 无验证步骤 | 不知道如何确认成功 | 说明检查项和预期结果 |
|
||||
|
||||
### 4. 自由度问题
|
||||
|
||||
| 错误 | 说明 | 改进 |
|
||||
|------|------|------|
|
||||
| 创意任务低自由度 | 为架构设计提供分步指令 | 提供指导原则和考虑因素 |
|
||||
| 危险任务高自由度 | 生产部署没有具体步骤 | 提供详细的检查清单 |
|
||||
| 不匹配任务类型 | 代码生成用教程式内容 | 提供模板和实际示例 |
|
||||
|
||||
---
|
||||
|
||||
## 快速检查清单
|
||||
|
||||
在发布 Skill 之前,问自己:
|
||||
|
||||
### 基础检查
|
||||
|
||||
- [ ] Name 是否具体且描述性强?
|
||||
- [ ] Description 包含触发关键词和场景?
|
||||
- [ ] 有明确的"When to Use"章节?
|
||||
- [ ] 内容只包含 Claude 不知道的信息?
|
||||
|
||||
### 内容检查
|
||||
|
||||
- [ ] 是否有实际的代码示例?
|
||||
- [ ] 步骤是否具体可执行?
|
||||
- [ ] 是否说明了如何验证成功?
|
||||
- [ ] 是否包含错误处理指导?
|
||||
|
||||
### 结构检查
|
||||
|
||||
- [ ] 内容组织清晰(使用标题、列表)?
|
||||
- [ ] 自由度设定合适(匹配任务类型)?
|
||||
- [ ] 长度合适(200-500行,或拆分子文件)?
|
||||
- [ ] 包含 Do/Don't 最佳实践?
|
||||
|
||||
如果有任何一项答"否",参考本文档的改进建议进行修改。
|
||||
|
|
@ -0,0 +1,908 @@
|
|||
# 好的 Skill 示例
|
||||
|
||||
本文档展示几个编写良好的 SKILL.md 示例,说明最佳实践的实际应用。
|
||||
|
||||
---
|
||||
|
||||
## 示例 1: 数据库迁移 Skill (高质量基础 Skill)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: database-migration
|
||||
description: Manages database schema migrations using Alembic for SQLAlchemy projects. Activates when user asks to create migrations, upgrade/downgrade database, or mentions Alembic. Handles both development and production scenarios with safety checks.
|
||||
---
|
||||
|
||||
# Database Migration Skill
|
||||
|
||||
Automates database schema migration management using Alembic.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to "create migration", "update database schema", or "rollback migration"
|
||||
- User mentions "Alembic", "database migration", or "schema change"
|
||||
- User is working in a Python project with SQLAlchemy models
|
||||
- User needs to apply or revert database changes
|
||||
|
||||
## Quick Start
|
||||
|
||||
Create a new migration:
|
||||
```bash
|
||||
alembic revision --autogenerate -m "Description of changes"
|
||||
```
|
||||
|
||||
Apply migrations:
|
||||
```bash
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
### Creating Migrations
|
||||
|
||||
1. **Detect model changes**
|
||||
- Scan SQLAlchemy models in `models/` directory
|
||||
- Compare with current database schema
|
||||
- Identify additions, modifications, deletions
|
||||
|
||||
2. **Generate migration script**
|
||||
- Run `alembic revision --autogenerate`
|
||||
- Review generated script for accuracy
|
||||
- Edit if necessary (Alembic can't auto-detect everything)
|
||||
|
||||
3. **Verify migration**
|
||||
- Check upgrade() function is correct
|
||||
- Ensure downgrade() function reverses changes
|
||||
- Test on development database first
|
||||
|
||||
### Applying Migrations
|
||||
|
||||
1. **Safety checks**
|
||||
- Backup database (production only)
|
||||
- Verify no pending migrations
|
||||
- Check database connectivity
|
||||
|
||||
2. **Execute migration**
|
||||
- Run `alembic upgrade head`
|
||||
- Monitor for errors
|
||||
- Verify schema matches expected state
|
||||
|
||||
3. **Post-migration validation**
|
||||
- Run application tests
|
||||
- Check data integrity
|
||||
- Confirm application starts successfully
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Add New Column
|
||||
|
||||
**User Request**: "Add an email column to the users table"
|
||||
|
||||
**Step 1**: Update the model
|
||||
```python
|
||||
# models/user.py
|
||||
class User(Base):
|
||||
__tablename__ = 'users'
|
||||
id = Column(Integer, primary_key=True)
|
||||
username = Column(String(50), nullable=False)
|
||||
email = Column(String(120), nullable=True) # ← New field
|
||||
```
|
||||
|
||||
**Step 2**: Generate migration
|
||||
```bash
|
||||
alembic revision --autogenerate -m "Add email column to users table"
|
||||
```
|
||||
|
||||
**Generated migration** (alembic/versions/abc123_add_email.py):
|
||||
```python
|
||||
def upgrade():
|
||||
op.add_column('users', sa.Column('email', sa.String(120), nullable=True))
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('users', 'email')
|
||||
```
|
||||
|
||||
**Step 3**: Review and apply
|
||||
```bash
|
||||
# Review the migration file
|
||||
cat alembic/versions/abc123_add_email.py
|
||||
|
||||
# Apply migration
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
**Output**:
|
||||
```
|
||||
INFO [alembic.runtime.migration] Running upgrade xyz789 -> abc123, Add email column to users table
|
||||
```
|
||||
|
||||
### Example 2: Complex Migration with Data Changes
|
||||
|
||||
**User Request**: "Split the 'name' column into 'first_name' and 'last_name'"
|
||||
|
||||
**Step 1**: Create empty migration (can't auto-generate data changes)
|
||||
```bash
|
||||
alembic revision -m "Split name into first_name and last_name"
|
||||
```
|
||||
|
||||
**Step 2**: Write custom migration
|
||||
```python
|
||||
def upgrade():
|
||||
# Add new columns
|
||||
op.add_column('users', sa.Column('first_name', sa.String(50)))
|
||||
op.add_column('users', sa.Column('last_name', sa.String(50)))
|
||||
|
||||
# Migrate existing data
|
||||
connection = op.get_bind()
|
||||
users = connection.execute("SELECT id, name FROM users")
|
||||
for user_id, name in users:
|
||||
parts = name.split(' ', 1)
|
||||
first = parts[0]
|
||||
last = parts[1] if len(parts) > 1 else ''
|
||||
connection.execute(
|
||||
"UPDATE users SET first_name = %s, last_name = %s WHERE id = %s",
|
||||
(first, last, user_id)
|
||||
)
|
||||
|
||||
# Make new columns non-nullable and drop old column
|
||||
op.alter_column('users', 'first_name', nullable=False)
|
||||
op.alter_column('users', 'last_name', nullable=False)
|
||||
op.drop_column('users', 'name')
|
||||
|
||||
def downgrade():
|
||||
# Add back name column
|
||||
op.add_column('users', sa.Column('name', sa.String(100)))
|
||||
|
||||
# Restore data
|
||||
connection = op.get_bind()
|
||||
users = connection.execute("SELECT id, first_name, last_name FROM users")
|
||||
for user_id, first, last in users:
|
||||
full_name = f"{first} {last}".strip()
|
||||
connection.execute(
|
||||
"UPDATE users SET name = %s WHERE id = %s",
|
||||
(full_name, user_id)
|
||||
)
|
||||
|
||||
op.alter_column('users', 'name', nullable=False)
|
||||
op.drop_column('users', 'first_name')
|
||||
op.drop_column('users', 'last_name')
|
||||
```
|
||||
|
||||
**Step 3**: Test thoroughly
|
||||
```bash
|
||||
# Apply migration
|
||||
alembic upgrade head
|
||||
|
||||
# Verify data
|
||||
python -c "from models import User; print(User.query.first().first_name)"
|
||||
|
||||
# Test rollback
|
||||
alembic downgrade -1
|
||||
python -c "from models import User; print(User.query.first().name)"
|
||||
|
||||
# Reapply
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Do
|
||||
|
||||
- ✅ Always review auto-generated migrations before applying
|
||||
- ✅ Test migrations on development database first
|
||||
- ✅ Write reversible downgrade() functions
|
||||
- ✅ Backup production databases before major migrations
|
||||
- ✅ Use meaningful migration messages
|
||||
|
||||
### Don't
|
||||
|
||||
- ❌ Trust auto-generated migrations blindly
|
||||
- ❌ Skip downgrade() implementation
|
||||
- ❌ Apply untested migrations to production
|
||||
- ❌ Modify existing migration files after they're committed
|
||||
- ❌ Use raw SQL without bind parameters
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Target database is not up to date"
|
||||
|
||||
**Problem**: Someone else applied migrations you don't have locally
|
||||
|
||||
**Solution**:
|
||||
```bash
|
||||
git pull # Get latest migrations
|
||||
alembic upgrade head # Apply them locally
|
||||
```
|
||||
|
||||
### "Can't locate revision identified by 'xyz'"
|
||||
|
||||
**Problem**: Migration file deleted or branch conflict
|
||||
|
||||
**Solution**:
|
||||
1. Check if migration file exists in `alembic/versions/`
|
||||
2. If missing, restore from git history
|
||||
3. If branch conflict, merge migration branches:
|
||||
```bash
|
||||
alembic merge -m "Merge migration branches" head1 head2
|
||||
```
|
||||
|
||||
### Migration fails mid-execution
|
||||
|
||||
**Problem**: Error occurred during migration
|
||||
|
||||
**Solution**:
|
||||
1. Check error message for specifics
|
||||
2. Manually fix database to consistent state if needed
|
||||
3. Update migration script to fix the issue
|
||||
4. Mark migration as completed or retry:
|
||||
```bash
|
||||
# Mark as done without running
|
||||
alembic stamp head
|
||||
|
||||
# Or fix and retry
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
project/
|
||||
├── alembic/
|
||||
│ ├── versions/ # Migration scripts
|
||||
│ ├── env.py # Alembic environment
|
||||
│ └── script.py.mako # Migration template
|
||||
├── alembic.ini # Alembic configuration
|
||||
└── models/ # SQLAlchemy models
|
||||
├── __init__.py
|
||||
├── user.py
|
||||
└── post.py
|
||||
```
|
||||
|
||||
### alembic.ini Configuration
|
||||
```ini
|
||||
[alembic]
|
||||
script_location = alembic
|
||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers = console
|
||||
qualname = alembic
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [Alembic Documentation](https://alembic.sqlalchemy.org/)
|
||||
- [SQLAlchemy Documentation](https://docs.sqlalchemy.org/)
|
||||
- [Project Migration Guidelines](docs/database-migrations.md)
|
||||
```
|
||||
|
||||
### 为什么这是好的 Skill?
|
||||
|
||||
1. ✅ **清晰的 description**: 包含触发关键词 ("Alembic", "create migrations") 和场景 ("SQLAlchemy projects")
|
||||
2. ✅ **具体的触发条件**: "When to Use" 列出 4 个明确场景
|
||||
3. ✅ **分步工作流**: 每个操作都有清晰的 1-2-3 步骤
|
||||
4. ✅ **实际示例**: 包含简单和复杂两个示例,有完整代码
|
||||
5. ✅ **最佳实践**: Do/Don't 清单易于遵循
|
||||
6. ✅ **故障排除**: 覆盖 3 个常见问题及解决方案
|
||||
7. ✅ **项目特定信息**: 包含配置和目录结构
|
||||
|
||||
---
|
||||
|
||||
## 示例 2: API 文档生成 Skill (优秀的工作流 Skill)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: api-documentation-generation
|
||||
description: Generates OpenAPI/Swagger documentation from FastAPI or Flask applications. Activates when user asks to create API docs, generate OpenAPI spec, or needs to document REST endpoints. Supports automatic extraction and custom annotations.
|
||||
---
|
||||
|
||||
# API Documentation Generation Skill
|
||||
|
||||
Automates creation of comprehensive API documentation from Python web applications.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to "generate API docs" or "create OpenAPI spec"
|
||||
- User mentions "Swagger", "OpenAPI", "API documentation"
|
||||
- User has a FastAPI or Flask application
|
||||
- User needs to document REST API endpoints
|
||||
|
||||
## Workflow
|
||||
|
||||
### Phase 1: Discovery
|
||||
|
||||
1. **Identify framework**
|
||||
- Check for FastAPI: `from fastapi import FastAPI` in codebase
|
||||
- Check for Flask: `from flask import Flask` in codebase
|
||||
- Check for Flask-RESTful: `from flask_restful import Resource`
|
||||
|
||||
2. **Locate API definitions**
|
||||
- Scan for route decorators: `@app.get()`, `@app.post()`, `@app.route()`
|
||||
- Find API routers and blueprints
|
||||
- Identify request/response models
|
||||
|
||||
3. **Extract metadata**
|
||||
- Endpoint paths and HTTP methods
|
||||
- Request parameters (path, query, body)
|
||||
- Response schemas and status codes
|
||||
- Authentication requirements
|
||||
|
||||
### Phase 2: Enhancement
|
||||
|
||||
1. **Review docstrings**
|
||||
- Check if endpoints have docstrings
|
||||
- Verify docstrings follow format (summary, description, params, returns)
|
||||
- Flag missing documentation
|
||||
|
||||
2. **Add missing docs** (if user approves)
|
||||
- Generate docstrings based on type hints
|
||||
- Infer descriptions from parameter names
|
||||
- Add example requests/responses
|
||||
|
||||
3. **Validate schemas**
|
||||
- Ensure Pydantic models are well-documented
|
||||
- Check for missing field descriptions
|
||||
- Verify example values are provided
|
||||
|
||||
### Phase 3: Generation
|
||||
|
||||
1. **Generate OpenAPI spec**
|
||||
```bash
|
||||
# For FastAPI
|
||||
python -c "from main import app; import json; print(json.dumps(app.openapi()))" > openapi.json
|
||||
|
||||
# For Flask with flasgger
|
||||
python scripts/generate_swagger.py > swagger.json
|
||||
```
|
||||
|
||||
2. **Create Swagger UI**
|
||||
- Copy Swagger UI static files to `docs/api/`
|
||||
- Configure to load generated spec
|
||||
- Test in browser: `http://localhost:8000/docs`
|
||||
|
||||
3. **Generate Markdown docs**
|
||||
- Use `openapi-to-md` to create human-readable docs
|
||||
- Organize by tags/resource groups
|
||||
- Add navigation and table of contents
|
||||
|
||||
### Phase 4: Validation
|
||||
|
||||
1. **Check completeness**
|
||||
- All endpoints documented?
|
||||
- All parameters described?
|
||||
- Example requests provided?
|
||||
|
||||
2. **Validate spec**
|
||||
```bash
|
||||
openapi-spec-validator openapi.json
|
||||
```
|
||||
|
||||
3. **Test interactive docs**
|
||||
- Try sample requests in Swagger UI
|
||||
- Verify authentication flows work
|
||||
- Check response schemas match actual responses
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: FastAPI Application
|
||||
|
||||
**User Request**: "Generate API documentation for my FastAPI app"
|
||||
|
||||
**Discovery**:
|
||||
```
|
||||
Found FastAPI application in: main.py
|
||||
Endpoints discovered:
|
||||
- GET /users (List users)
|
||||
- POST /users (Create user)
|
||||
- GET /users/{id} (Get user by ID)
|
||||
- PUT /users/{id} (Update user)
|
||||
- DELETE /users/{id} (Delete user)
|
||||
```
|
||||
|
||||
**Enhancement**:
|
||||
```
|
||||
Checking documentation coverage...
|
||||
✓ GET /users - Well documented
|
||||
✗ POST /users - Missing response examples
|
||||
✗ GET /users/{id} - No description
|
||||
✗ PUT /users/{id} - No description
|
||||
✗ DELETE /users/{id} - No description
|
||||
|
||||
Would you like me to add missing documentation?
|
||||
```
|
||||
|
||||
**User**: Yes
|
||||
|
||||
**Adding docs**:
|
||||
```python
|
||||
@app.get("/users/{id}", summary="Get user by ID")
|
||||
async def get_user(id: int):
|
||||
"""
|
||||
Retrieve a single user by their unique ID.
|
||||
|
||||
Args:
|
||||
id: The unique identifier of the user
|
||||
|
||||
Returns:
|
||||
User object with id, name, email, and created_at fields
|
||||
|
||||
Raises:
|
||||
404: User not found
|
||||
"""
|
||||
# ... implementation
|
||||
```
|
||||
|
||||
**Generation**:
|
||||
```bash
|
||||
Generating OpenAPI specification...
|
||||
✓ openapi.json created (15.2 KB)
|
||||
✓ Swagger UI deployed to docs/api/
|
||||
✓ Markdown docs created in docs/api/endpoints/
|
||||
|
||||
View documentation at: http://localhost:8000/docs
|
||||
```
|
||||
|
||||
### Example 2: Flask Application with Custom Schemas
|
||||
|
||||
**User Request**: "Document my Flask API and include request/response examples"
|
||||
|
||||
**Discovery**:
|
||||
```
|
||||
Found Flask application with Flask-RESTful
|
||||
Endpoints:
|
||||
- GET /api/products
|
||||
- POST /api/products
|
||||
- GET /api/products/<id>
|
||||
- PATCH /api/products/<id>
|
||||
- DELETE /api/products/<id>
|
||||
```
|
||||
|
||||
**Custom Examples Added**:
|
||||
```python
|
||||
class ProductList(Resource):
|
||||
def get(self):
|
||||
"""
|
||||
Get all products
|
||||
|
||||
Example Response:
|
||||
```json
|
||||
{
|
||||
"products": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Widget",
|
||||
"price": 29.99,
|
||||
"stock": 100
|
||||
}
|
||||
],
|
||||
"total": 1
|
||||
}
|
||||
```
|
||||
"""
|
||||
pass
|
||||
|
||||
def post(self):
|
||||
"""
|
||||
Create a new product
|
||||
|
||||
Example Request:
|
||||
```json
|
||||
{
|
||||
"name": "New Widget",
|
||||
"price": 39.99,
|
||||
"stock": 50
|
||||
}
|
||||
```
|
||||
|
||||
Example Response:
|
||||
```json
|
||||
{
|
||||
"id": 2,
|
||||
"name": "New Widget",
|
||||
"price": 39.99,
|
||||
"stock": 50,
|
||||
"created_at": "2025-01-31T12:00:00Z"
|
||||
}
|
||||
```
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
**Result**:
|
||||
```
|
||||
Generated documentation:
|
||||
- openapi.json (with examples)
|
||||
- Swagger UI at /api/docs
|
||||
- Postman collection at docs/api/postman_collection.json
|
||||
- Markdown API reference at docs/api/README.md
|
||||
|
||||
All endpoints now include:
|
||||
✓ Request examples
|
||||
✓ Response examples
|
||||
✓ Error codes
|
||||
✓ Authentication requirements
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### FastAPI Projects
|
||||
|
||||
No additional configuration needed! FastAPI auto-generates OpenAPI docs.
|
||||
|
||||
Access at:
|
||||
- Swagger UI: `http://localhost:8000/docs`
|
||||
- ReDoc: `http://localhost:8000/redoc`
|
||||
- OpenAPI JSON: `http://localhost:8000/openapi.json`
|
||||
|
||||
### Flask Projects
|
||||
|
||||
Install flasgger:
|
||||
```bash
|
||||
pip install flasgger
|
||||
```
|
||||
|
||||
Configure in app:
|
||||
```python
|
||||
from flasgger import Swagger
|
||||
|
||||
app = Flask(__name__)
|
||||
swagger = Swagger(app, template={
|
||||
"info": {
|
||||
"title": "My API",
|
||||
"description": "API for managing resources",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- ✅ Use type hints - enables automatic schema generation
|
||||
- ✅ Write descriptive docstrings for all endpoints
|
||||
- ✅ Provide example requests and responses
|
||||
- ✅ Document error codes and edge cases
|
||||
- ✅ Keep docs in sync with code (auto-generate when possible)
|
||||
|
||||
## Tools Used
|
||||
|
||||
- **FastAPI**: Built-in OpenAPI support
|
||||
- **flasgger**: Swagger for Flask
|
||||
- **openapi-spec-validator**: Validates OpenAPI specs
|
||||
- **openapi-to-md**: Converts OpenAPI to Markdown
|
||||
|
||||
## References
|
||||
|
||||
- [OpenAPI Specification](https://spec.openapis.org/oas/latest.html)
|
||||
- [FastAPI Documentation](https://fastapi.tiangolo.com/)
|
||||
- [Swagger Documentation](https://swagger.io/docs/)
|
||||
```
|
||||
|
||||
### 为什么这是优秀的工作流 Skill?
|
||||
|
||||
1. ✅ **清晰的工作流阶段**: 4 个阶段 (Discovery, Enhancement, Generation, Validation)
|
||||
2. ✅ **决策点**: Phase 2 询问用户是否添加缺失文档
|
||||
3. ✅ **实际输出示例**: 展示了命令输出和生成的代码
|
||||
4. ✅ **多框架支持**: 处理 FastAPI 和 Flask 两种情况
|
||||
5. ✅ **工具集成**: 列出所需工具及其用途
|
||||
6. ✅ **可执行命令**: 提供完整的命令示例
|
||||
7. ✅ **验证步骤**: Phase 4 确保生成的文档质量
|
||||
|
||||
---
|
||||
|
||||
## 示例 3: 代码审查 Skill (高自由度 Skill)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: code-review
|
||||
description: Performs comprehensive code reviews focusing on best practices, security, performance, and maintainability. Activates when user asks to review code, check pull request, or mentions code quality. Provides actionable feedback with severity ratings.
|
||||
---
|
||||
|
||||
# Code Review Skill
|
||||
|
||||
Conducts thorough code reviews with focus on quality, security, and best practices.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to "review my code" or "check this PR"
|
||||
- User mentions "code review", "code quality", or "best practices"
|
||||
- User wants feedback on specific code changes
|
||||
- User needs security or performance analysis
|
||||
|
||||
## Review Criteria
|
||||
|
||||
Code is evaluated across 5 dimensions:
|
||||
|
||||
### 1. Correctness
|
||||
- Logic errors and bugs
|
||||
- Edge case handling
|
||||
- Error handling and validation
|
||||
- Type safety
|
||||
|
||||
### 2. Security
|
||||
- SQL injection vulnerabilities
|
||||
- XSS vulnerabilities
|
||||
- Authentication/authorization issues
|
||||
- Sensitive data exposure
|
||||
- Dependency vulnerabilities
|
||||
|
||||
### 3. Performance
|
||||
- Algorithm efficiency
|
||||
- Database query optimization
|
||||
- Memory leaks
|
||||
- Unnecessary computations
|
||||
- Caching opportunities
|
||||
|
||||
### 4. Maintainability
|
||||
- Code clarity and readability
|
||||
- Function/class size
|
||||
- Code duplication
|
||||
- Naming conventions
|
||||
- Documentation
|
||||
|
||||
### 5. Best Practices
|
||||
- Language-specific idioms
|
||||
- Design patterns
|
||||
- SOLID principles
|
||||
- Testing coverage
|
||||
- Error handling patterns
|
||||
|
||||
## Review Process
|
||||
|
||||
1. **Understand context**
|
||||
- What does this code do?
|
||||
- What problem does it solve?
|
||||
- Are there any constraints or requirements?
|
||||
|
||||
2. **Identify issues**
|
||||
- Scan for common anti-patterns
|
||||
- Check against language best practices
|
||||
- Look for security vulnerabilities
|
||||
- Assess performance implications
|
||||
|
||||
3. **Prioritize feedback**
|
||||
- **Critical**: Security issues, data loss risks, crashes
|
||||
- **High**: Bugs, major performance issues
|
||||
- **Medium**: Code smells, maintainability concerns
|
||||
- **Low**: Style preferences, minor optimizations
|
||||
|
||||
4. **Provide suggestions**
|
||||
- Explain the issue clearly
|
||||
- Show better alternative (code example)
|
||||
- Explain why the alternative is better
|
||||
|
||||
## Example Review
|
||||
|
||||
### Code Submitted
|
||||
|
||||
```python
|
||||
def get_user_data(user_id):
|
||||
conn = sqlite3.connect('users.db')
|
||||
cursor = conn.cursor()
|
||||
query = "SELECT * FROM users WHERE id = " + str(user_id)
|
||||
cursor.execute(query)
|
||||
result = cursor.fetchone()
|
||||
return result
|
||||
```
|
||||
|
||||
### Review Feedback
|
||||
|
||||
**❌ CRITICAL: SQL Injection Vulnerability**
|
||||
|
||||
The code concatenates user input directly into SQL query, allowing SQL injection attacks.
|
||||
|
||||
**Bad**:
|
||||
```python
|
||||
query = "SELECT * FROM users WHERE id = " + str(user_id)
|
||||
```
|
||||
|
||||
**Good**:
|
||||
```python
|
||||
query = "SELECT * FROM users WHERE id = ?"
|
||||
cursor.execute(query, (user_id,))
|
||||
```
|
||||
|
||||
**Why**: Parameterized queries prevent SQL injection by properly escaping user input.
|
||||
|
||||
---
|
||||
|
||||
**⚠️ HIGH: Resource Leak**
|
||||
|
||||
Database connection is never closed, leading to resource exhaustion under load.
|
||||
|
||||
**Bad**:
|
||||
```python
|
||||
conn = sqlite3.connect('users.db')
|
||||
# ... use connection
|
||||
# connection never closed
|
||||
```
|
||||
|
||||
**Good**:
|
||||
```python
|
||||
with sqlite3.connect('users.db') as conn:
|
||||
cursor = conn.cursor()
|
||||
# ... use connection
|
||||
# automatically closed when exiting with block
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**ℹ️ MEDIUM: Overly Broad SELECT**
|
||||
|
||||
Using `SELECT *` fetches unnecessary data and is fragile to schema changes.
|
||||
|
||||
**Bad**:
|
||||
```python
|
||||
query = "SELECT * FROM users WHERE id = ?"
|
||||
```
|
||||
|
||||
**Good**:
|
||||
```python
|
||||
query = "SELECT id, name, email FROM users WHERE id = ?"
|
||||
```
|
||||
|
||||
**Why**: Explicit column selection is more efficient and makes intent clear.
|
||||
|
||||
---
|
||||
|
||||
**📝 LOW: Missing Error Handling**
|
||||
|
||||
Function doesn't handle case where user doesn't exist.
|
||||
|
||||
**Suggestion**:
|
||||
```python
|
||||
def get_user_data(user_id: int) -> Optional[dict]:
|
||||
"""
|
||||
Retrieve user data by ID.
|
||||
|
||||
Args:
|
||||
user_id: The unique identifier of the user
|
||||
|
||||
Returns:
|
||||
Dictionary with user data, or None if user not found
|
||||
"""
|
||||
with sqlite3.connect('users.db') as conn:
|
||||
cursor = conn.cursor()
|
||||
query = "SELECT id, name, email FROM users WHERE id = ?"
|
||||
cursor.execute(query, (user_id,))
|
||||
result = cursor.fetchone()
|
||||
|
||||
if result is None:
|
||||
return None
|
||||
|
||||
return {
|
||||
'id': result[0],
|
||||
'name': result[1],
|
||||
'email': result[2]
|
||||
}
|
||||
```
|
||||
|
||||
### Revised Code
|
||||
|
||||
After applying all suggestions:
|
||||
|
||||
```python
|
||||
from typing import Optional
|
||||
import sqlite3
|
||||
|
||||
def get_user_data(user_id: int) -> Optional[dict]:
|
||||
"""
|
||||
Retrieve user data by ID.
|
||||
|
||||
Args:
|
||||
user_id: The unique identifier of the user
|
||||
|
||||
Returns:
|
||||
Dictionary with user data, or None if user not found
|
||||
|
||||
Raises:
|
||||
ValueError: If user_id is not a positive integer
|
||||
"""
|
||||
if not isinstance(user_id, int) or user_id <= 0:
|
||||
raise ValueError(f"Invalid user_id: {user_id}")
|
||||
|
||||
with sqlite3.connect('users.db') as conn:
|
||||
conn.row_factory = sqlite3.Row # Enable dict-like access
|
||||
cursor = conn.cursor()
|
||||
|
||||
query = "SELECT id, name, email, created_at FROM users WHERE id = ?"
|
||||
cursor.execute(query, (user_id,))
|
||||
result = cursor.fetchone()
|
||||
|
||||
if result is None:
|
||||
return None
|
||||
|
||||
return dict(result) # Convert Row to dict
|
||||
```
|
||||
|
||||
### Summary
|
||||
|
||||
**Issues Found**: 4
|
||||
- 1 Critical (SQL Injection)
|
||||
- 1 High (Resource Leak)
|
||||
- 1 Medium (Inefficient Query)
|
||||
- 1 Low (Missing Error Handling)
|
||||
|
||||
**All Issues Addressed**: ✓
|
||||
|
||||
## Best Practices
|
||||
|
||||
### When Reviewing
|
||||
|
||||
- 🎯 Focus on impact - prioritize critical issues
|
||||
- 📝 Be specific - provide code examples
|
||||
- 🎓 Be educational - explain why, not just what
|
||||
- 🤝 Be constructive - suggest improvements, don't just criticize
|
||||
- ⚖️ Be balanced - acknowledge good practices too
|
||||
|
||||
### What to Look For
|
||||
|
||||
**Python-specific**:
|
||||
- Use of `with` for resource management
|
||||
- Type hints on function signatures
|
||||
- Proper exception handling
|
||||
- List comprehensions vs loops
|
||||
- Dictionary vs if-elif chains
|
||||
|
||||
**General**:
|
||||
- DRY principle violations
|
||||
- Magic numbers
|
||||
- Long functions (>50 lines)
|
||||
- Deep nesting (>3 levels)
|
||||
- Missing tests for critical paths
|
||||
|
||||
## Automated Tools
|
||||
|
||||
Complement manual review with automated tools:
|
||||
|
||||
```bash
|
||||
# Linting
|
||||
pylint mycode.py
|
||||
flake8 mycode.py
|
||||
|
||||
# Type checking
|
||||
mypy mycode.py
|
||||
|
||||
# Security scanning
|
||||
bandit -r .
|
||||
safety check
|
||||
|
||||
# Code complexity
|
||||
radon cc mycode.py -a
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
||||
- [Python Best Practices](https://docs.python-guide.org/)
|
||||
- [Clean Code Principles](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
|
||||
```
|
||||
|
||||
### 为什么这是高自由度 Skill?
|
||||
|
||||
1. ✅ **指导原则而非严格步骤**: 提供评审维度,不限定具体流程
|
||||
2. ✅ **情境适应**: 根据代码类型和问题严重性调整重点
|
||||
3. ✅ **教育性**: 解释"为什么",帮助 Claude 做出判断
|
||||
4. ✅ **优先级框架**: 定义严重性级别,让 Claude 自行判断
|
||||
5. ✅ **完整示例**: 展示从问题识别到解决的完整流程
|
||||
6. ✅ **工具集成**: 提到自动化工具,但不强制使用
|
||||
|
||||
---
|
||||
|
||||
## 总结: 好 Skill 的共同特征
|
||||
|
||||
| 特征 | 说明 | 示例位置 |
|
||||
|------|------|---------|
|
||||
| **清晰触发** | description 包含关键词和场景 | 所有 frontmatter |
|
||||
| **结构化内容** | 使用标题、列表、代码块组织信息 | 所有示例 |
|
||||
| **实际示例** | 真实代码,不是伪代码 | Example sections |
|
||||
| **决策指导** | 告诉 Claude 何时做什么 | 工作流 Skill 的 Phase 2 |
|
||||
| **可执行命令** | 提供完整的命令,不是抽象描述 | 迁移 Skill 的命令 |
|
||||
| **错误处理** | 包含故障排除章节 | 所有 Troubleshooting |
|
||||
| **最佳实践** | Do/Don't 清单 | 所有 Best Practices |
|
||||
| **工具引用** | 说明使用哪些工具及如何使用 | API 文档 Skill |
|
||||
| **验证步骤** | 说明如何确认操作成功 | 迁移 Skill 的验证 |
|
||||
| **合适的自由度** | 根据任务特性选择指导程度 | 代码审查 Skill |
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
name: your-skill-name
|
||||
description: Brief description of what this skill does and when to activate it. Include trigger keywords and scenarios where this skill should be used.
|
||||
---
|
||||
|
||||
# Your Skill Title
|
||||
|
||||
> Brief one-line summary of what this skill accomplishes
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User asks to [specific action or task]
|
||||
- User mentions keywords like "[keyword1]", "[keyword2]", or "[keyword3]"
|
||||
- User is working with [specific technology/framework/tool]
|
||||
- User needs to [specific outcome or goal]
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Basic usage example
|
||||
command-to-run --option value
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Step 1**: Brief description of first step
|
||||
- Detail about what happens
|
||||
- Any prerequisites or conditions
|
||||
|
||||
2. **Step 2**: Brief description of second step
|
||||
- Key actions taken
|
||||
- Expected outputs
|
||||
|
||||
3. **Step 3**: Brief description of final step
|
||||
- Validation or verification
|
||||
- Success criteria
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Basic Usage
|
||||
|
||||
**User Request**: "Example of what user might say"
|
||||
|
||||
**Action**: What Claude does in response
|
||||
|
||||
**Output**:
|
||||
```
|
||||
Expected output or result
|
||||
```
|
||||
|
||||
### Example 2: Advanced Usage
|
||||
|
||||
**User Request**: "More complex user request"
|
||||
|
||||
**Action**:
|
||||
1. First action taken
|
||||
2. Second action taken
|
||||
3. Final action
|
||||
|
||||
**Output**:
|
||||
```
|
||||
Expected output showing more complex results
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- ✅ Do this for best results
|
||||
- ✅ Follow this pattern
|
||||
- ❌ Avoid this common mistake
|
||||
- ❌ Don't do this
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issue 1
|
||||
|
||||
**Problem**: Description of the problem
|
||||
|
||||
**Solution**: How to fix it
|
||||
|
||||
### Common Issue 2
|
||||
|
||||
**Problem**: Description of another problem
|
||||
|
||||
**Solution**: Steps to resolve
|
||||
|
||||
## References
|
||||
|
||||
- [Related Documentation](link-to-docs)
|
||||
- [Official Guide](link-to-guide)
|
||||
- [Additional Resources](link-to-resources)
|
||||
|
||||
---
|
||||
|
||||
**Version**: 1.0
|
||||
**Last Updated**: YYYY-MM-DD
|
||||
|
|
@ -0,0 +1,402 @@
|
|||
---
|
||||
name: your-workflow-skill
|
||||
description: Guides Claude through a multi-step workflow for [specific task]. Activates when user needs to [trigger scenario] or mentions [key terms].
|
||||
---
|
||||
|
||||
# Your Workflow Skill Title
|
||||
|
||||
> Automates a complex multi-step process with decision points and validation
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- User needs to execute a multi-step workflow
|
||||
- User asks to "[workflow trigger phrase]"
|
||||
- User is working on [specific type of project or task]
|
||||
- Task requires validation and error handling at each step
|
||||
|
||||
## Workflow Overview
|
||||
|
||||
```
|
||||
┌─────────────┐
|
||||
│ Start │
|
||||
└──────┬──────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ Preparation │
|
||||
│ & Validation │
|
||||
└────────┬────────┘
|
||||
│
|
||||
┌────▼────┐
|
||||
│ Step 1 │
|
||||
└────┬────┘
|
||||
│
|
||||
┌────▼────┐
|
||||
│ Step 2 │──┐
|
||||
└────┬────┘ │ (Loop if needed)
|
||||
│ │
|
||||
└───────┘
|
||||
│
|
||||
┌────▼────┐
|
||||
│ Step 3 │
|
||||
└────┬────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────┐
|
||||
│ Complete │
|
||||
│ & Report │
|
||||
└─────────────┘
|
||||
```
|
||||
|
||||
## Detailed Workflow
|
||||
|
||||
### Preparation Phase
|
||||
|
||||
Before starting the main workflow:
|
||||
|
||||
- [ ] Check prerequisite 1
|
||||
- [ ] Validate prerequisite 2
|
||||
- [ ] Ensure prerequisite 3 is met
|
||||
|
||||
If any prerequisite fails:
|
||||
- Stop execution
|
||||
- Report which prerequisite failed
|
||||
- Provide remediation steps
|
||||
|
||||
### Step 1: [Step Name]
|
||||
|
||||
**Purpose**: What this step accomplishes
|
||||
|
||||
**Actions**:
|
||||
1. Action 1
|
||||
2. Action 2
|
||||
3. Action 3
|
||||
|
||||
**Validation**:
|
||||
- Check condition 1
|
||||
- Verify condition 2
|
||||
|
||||
**On Success**: → Proceed to Step 2
|
||||
**On Failure**: → [Error handling procedure]
|
||||
|
||||
### Step 2: [Step Name]
|
||||
|
||||
**Purpose**: What this step accomplishes
|
||||
|
||||
**Actions**:
|
||||
1. Action 1
|
||||
2. Action 2
|
||||
|
||||
**Decision Point**:
|
||||
- If condition A: → Action X
|
||||
- If condition B: → Action Y
|
||||
- Otherwise: → Default action
|
||||
|
||||
**Validation**:
|
||||
- Verify expected output
|
||||
- Check for errors
|
||||
|
||||
**On Success**: → Proceed to Step 3
|
||||
**On Failure**: → [Error handling procedure]
|
||||
|
||||
### Step 3: [Step Name]
|
||||
|
||||
**Purpose**: Final actions and cleanup
|
||||
|
||||
**Actions**:
|
||||
1. Finalize changes
|
||||
2. Run validation tests
|
||||
3. Generate summary report
|
||||
|
||||
**Success Criteria**:
|
||||
- All tests pass
|
||||
- No errors in logs
|
||||
- Expected artifacts created
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Standard Workflow Execution
|
||||
|
||||
**User Request**: "Run the [workflow name]"
|
||||
|
||||
**Execution**:
|
||||
|
||||
**Preparation Phase** ✓
|
||||
```
|
||||
✓ Prerequisite 1 met
|
||||
✓ Prerequisite 2 validated
|
||||
✓ Ready to begin
|
||||
```
|
||||
|
||||
**Step 1: [Step Name]** ✓
|
||||
```
|
||||
→ Action 1 completed
|
||||
→ Action 2 completed
|
||||
→ Validation passed
|
||||
```
|
||||
|
||||
**Step 2: [Step Name]** ✓
|
||||
```
|
||||
→ Decision: Condition A detected
|
||||
→ Executing Action X
|
||||
→ Validation passed
|
||||
```
|
||||
|
||||
**Step 3: [Step Name]** ✓
|
||||
```
|
||||
→ Finalization complete
|
||||
→ All tests passed
|
||||
→ Summary generated
|
||||
```
|
||||
|
||||
**Result**: Workflow completed successfully
|
||||
|
||||
### Example 2: Workflow with Error Recovery
|
||||
|
||||
**User Request**: "Execute [workflow name]"
|
||||
|
||||
**Execution**:
|
||||
|
||||
**Step 1** ✓
|
||||
```
|
||||
→ Completed successfully
|
||||
```
|
||||
|
||||
**Step 2** ⚠️
|
||||
```
|
||||
→ Action 1 completed
|
||||
→ Action 2 failed: [Error message]
|
||||
```
|
||||
|
||||
**Error Recovery**:
|
||||
1. Identified root cause: [Explanation]
|
||||
2. Applied fix: [Fix description]
|
||||
3. Retrying Step 2...
|
||||
|
||||
**Step 2 (Retry)** ✓
|
||||
```
|
||||
→ Completed after fix
|
||||
```
|
||||
|
||||
**Step 3** ✓
|
||||
```
|
||||
→ Completed successfully
|
||||
```
|
||||
|
||||
**Result**: Workflow completed with 1 retry
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Error Categories
|
||||
|
||||
| Category | Action |
|
||||
|----------|--------|
|
||||
| **Recoverable** | Attempt automatic fix, retry up to 3 times |
|
||||
| **User Input Needed** | Pause workflow, ask user for guidance |
|
||||
| **Critical** | Stop workflow, rollback changes if possible |
|
||||
|
||||
### Common Errors
|
||||
|
||||
**Error 1: [Error Name]**
|
||||
- **Cause**: What causes this error
|
||||
- **Detection**: How to identify it
|
||||
- **Recovery**: Steps to fix
|
||||
1. Recovery action 1
|
||||
2. Recovery action 2
|
||||
3. Retry from failed step
|
||||
|
||||
**Error 2: [Error Name]**
|
||||
- **Cause**: What causes this error
|
||||
- **Detection**: How to identify it
|
||||
- **Recovery**: Manual intervention required
|
||||
- Ask user: "[Question to ask]"
|
||||
- Wait for user input
|
||||
- Apply user's guidance
|
||||
- Resume workflow
|
||||
|
||||
## Rollback Procedure
|
||||
|
||||
If the workflow fails critically:
|
||||
|
||||
1. **Identify last successful step**
|
||||
- Step 1: ✓ Completed
|
||||
- Step 2: ❌ Failed at action 3
|
||||
|
||||
2. **Undo changes from failed step**
|
||||
- Revert action 1
|
||||
- Revert action 2
|
||||
- Clean up partial state
|
||||
|
||||
3. **Verify system state**
|
||||
- Confirm rollback successful
|
||||
- Check for side effects
|
||||
|
||||
4. **Report to user**
|
||||
```
|
||||
Workflow failed at Step 2, action 3
|
||||
Reason: [Error message]
|
||||
All changes have been rolled back
|
||||
System is back to pre-workflow state
|
||||
```
|
||||
|
||||
## Workflow Variations
|
||||
|
||||
### Variation 1: Quick Mode
|
||||
|
||||
**When to use**: User needs faster execution, can accept lower validation
|
||||
|
||||
**Changes**:
|
||||
- Skip optional validations
|
||||
- Use cached data where available
|
||||
- Reduce logging verbosity
|
||||
|
||||
**Trade-offs**:
|
||||
- ⚡ 50% faster
|
||||
- ⚠️ Less detailed error messages
|
||||
|
||||
### Variation 2: Strict Mode
|
||||
|
||||
**When to use**: Production deployments, critical changes
|
||||
|
||||
**Changes**:
|
||||
- Enable all validations
|
||||
- Require explicit user confirmation at each step
|
||||
- Generate detailed audit logs
|
||||
|
||||
**Trade-offs**:
|
||||
- 🛡️ Maximum safety
|
||||
- 🐢 Slower execution
|
||||
|
||||
## Monitoring and Logging
|
||||
|
||||
Throughout the workflow:
|
||||
|
||||
```
|
||||
[TIMESTAMP] [STEP] [STATUS] Message
|
||||
|
||||
[2025-01-31 14:30:01] [PREP] [INFO] Starting preparation phase
|
||||
[2025-01-31 14:30:02] [PREP] [OK] All prerequisites met
|
||||
[2025-01-31 14:30:03] [STEP1] [INFO] Beginning Step 1
|
||||
[2025-01-31 14:30:05] [STEP1] [OK] Step 1 completed successfully
|
||||
[2025-01-31 14:30:06] [STEP2] [INFO] Beginning Step 2
|
||||
[2025-01-31 14:30:08] [STEP2] [WARN] Condition B detected, using fallback
|
||||
[2025-01-31 14:30:10] [STEP2] [OK] Step 2 completed with warnings
|
||||
[2025-01-31 14:30:11] [STEP3] [INFO] Beginning Step 3
|
||||
[2025-01-31 14:30:15] [STEP3] [OK] Step 3 completed successfully
|
||||
[2025-01-31 14:30:16] [COMPLETE] [OK] Workflow finished successfully
|
||||
```
|
||||
|
||||
## Post-Workflow Report
|
||||
|
||||
After completion, generate a summary:
|
||||
|
||||
```markdown
|
||||
# Workflow Execution Report
|
||||
|
||||
**Workflow**: [Workflow Name]
|
||||
**Started**: 2025-01-31 14:30:01
|
||||
**Completed**: 2025-01-31 14:30:16
|
||||
**Duration**: 15 seconds
|
||||
**Status**: ✓ Success
|
||||
|
||||
## Steps Executed
|
||||
|
||||
1. ✓ Preparation Phase (1s)
|
||||
2. ✓ Step 1: [Step Name] (2s)
|
||||
3. ✓ Step 2: [Step Name] (4s) - 1 warning
|
||||
4. ✓ Step 3: [Step Name] (4s)
|
||||
|
||||
## Warnings
|
||||
|
||||
- Step 2: Condition B detected, used fallback action
|
||||
|
||||
## Artifacts Generated
|
||||
|
||||
- `/path/to/output1.txt`
|
||||
- `/path/to/output2.json`
|
||||
- `/path/to/report.html`
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Review generated artifacts
|
||||
- Deploy to production (if applicable)
|
||||
- Archive logs to `/logs/workflow-20250131-143001.log`
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Do
|
||||
|
||||
- ✅ Validate inputs before starting workflow
|
||||
- ✅ Provide clear progress updates at each step
|
||||
- ✅ Log all decisions and actions
|
||||
- ✅ Handle errors gracefully with recovery options
|
||||
- ✅ Generate summary report at completion
|
||||
|
||||
### Don't
|
||||
|
||||
- ❌ Skip validation steps to save time
|
||||
- ❌ Continue after critical errors
|
||||
- ❌ Assume prerequisites are met without checking
|
||||
- ❌ Lose partial progress on failure
|
||||
- ❌ Leave system in inconsistent state
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Parallel Execution
|
||||
|
||||
Some steps can run in parallel:
|
||||
|
||||
```
|
||||
Step 1 ─┬─→ Step 2A ─┐
|
||||
│ ├─→ Step 3
|
||||
└─→ Step 2B ─┘
|
||||
```
|
||||
|
||||
**Requirements**:
|
||||
- Steps 2A and 2B must be independent
|
||||
- Both must complete before Step 3
|
||||
|
||||
**Implementation**:
|
||||
1. Start Step 2A in background
|
||||
2. Start Step 2B in background
|
||||
3. Wait for both to complete
|
||||
4. Verify both succeeded
|
||||
5. Proceed to Step 3
|
||||
|
||||
### Conditional Branching
|
||||
|
||||
```
|
||||
Step 1 → Decision
|
||||
├─→ [Condition A] → Path A → Step 3
|
||||
├─→ [Condition B] → Path B → Step 3
|
||||
└─→ [Default] → Path C → Step 3
|
||||
```
|
||||
|
||||
## Testing This Workflow
|
||||
|
||||
To test the workflow without side effects:
|
||||
|
||||
1. Use `--dry-run` flag to simulate execution
|
||||
2. Check that all steps are logged correctly
|
||||
3. Verify error handling with intentional failures
|
||||
4. Confirm rollback procedure works
|
||||
|
||||
Example:
|
||||
```bash
|
||||
workflow-runner --dry-run --inject-error step2
|
||||
```
|
||||
|
||||
Expected output:
|
||||
```
|
||||
[DRY RUN] Step 1: Would execute [actions]
|
||||
[DRY RUN] Step 2: Injected error as requested
|
||||
[DRY RUN] Error Recovery: Would attempt fix
|
||||
[DRY RUN] Rollback: Would undo Step 1 changes
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Version**: 1.0
|
||||
**Last Updated**: YYYY-MM-DD
|
||||
**Maintainer**: Team Name
|
||||
|
|
@ -9,4 +9,5 @@ README.md
|
|||
.yalc/
|
||||
yalc.lock
|
||||
testApi/
|
||||
*.local.*
|
||||
*.local.*
|
||||
*.local
|
||||
|
|
@ -23,4 +23,6 @@ vitest.config.mts
|
|||
bin/
|
||||
scripts/
|
||||
deploy/
|
||||
document/
|
||||
document/
|
||||
|
||||
projects/marketplace
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ jobs:
|
|||
--label "org.opencontainers.image.description=${{ steps.config.outputs.DESCRIPTION }}" \
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${{ steps.config.outputs.DOCKER_REPO_TAGGED }} \
|
||||
.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
name: Build fastgpt-marketplace images
|
||||
on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build-fastgpt-marketplace-images:
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
attestations: write
|
||||
id-token: write
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch: amd64
|
||||
- arch: arm64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }}
|
||||
steps:
|
||||
# install env
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
driver-opts: network=host
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-marketplace-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-marketplace-buildx-
|
||||
|
||||
# login docker
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
|
||||
- name: Build for ${{ matrix.arch }}
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: projects/marketplace/Dockerfile
|
||||
platforms: linux/${{ matrix.arch }}
|
||||
labels: |
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.description=fastgpt-marketplace image
|
||||
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace,${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace",push-by-digest=true,push=true
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
|
||||
- name: Export digest
|
||||
run: |
|
||||
mkdir -p ${{ runner.temp }}/digests
|
||||
digest="${{ steps.build.outputs.digest }}"
|
||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
||||
|
||||
- name: Upload digest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: digests-fastgpt-marketplace-${{ github.sha }}-${{ matrix.arch }}
|
||||
path: ${{ runner.temp }}/digests/*
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
release-fastgpt-marketplace-images:
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
attestations: write
|
||||
id-token: write
|
||||
needs: build-fastgpt-marketplace-images
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
|
||||
- name: Download digests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ${{ runner.temp }}/digests
|
||||
pattern: digests-fastgpt-marketplace-${{ github.sha }}-*
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Generate random tag
|
||||
id: tag
|
||||
run: |
|
||||
# Generate random hash tag (8 characters)
|
||||
TAG=$(echo $RANDOM | md5sum | head -c 8)
|
||||
echo "RANDOM_TAG=$TAG" >> $GITHUB_ENV
|
||||
echo "Generated tag: $TAG"
|
||||
|
||||
- name: Set image name and tag
|
||||
run: |
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace:${{ env.RANDOM_TAG }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: ${{ runner.temp }}/digests
|
||||
run: |
|
||||
echo "Pushing image with tag: ${{ env.RANDOM_TAG }}"
|
||||
echo "Available digests:"
|
||||
ls -la
|
||||
echo ""
|
||||
|
||||
# Create manifest for GitHub Container Registry
|
||||
echo "Creating manifest for GitHub: ${Git_Tag}"
|
||||
docker buildx imagetools create -t ${Git_Tag} \
|
||||
$(printf 'ghcr.io/${{ github.repository_owner }}/fastgpt-marketplace@sha256:%s ' *)
|
||||
echo "✅ GitHub manifest created"
|
||||
sleep 5
|
||||
|
||||
# Create manifest for Ali Cloud
|
||||
echo "Creating manifest for Ali Cloud: ${Ali_Tag}"
|
||||
docker buildx imagetools create -t ${Ali_Tag} \
|
||||
$(printf '${{ secrets.ALI_IMAGE_NAME }}/fastgpt-marketplace@sha256:%s ' *)
|
||||
echo "✅ Ali Cloud manifest created"
|
||||
|
||||
echo ""
|
||||
echo "✅ All images pushed successfully:"
|
||||
echo " - ${{ env.Git_Tag }}"
|
||||
echo " - ${{ env.Ali_Tag }}"
|
||||
|
|
@ -37,4 +37,6 @@ files/helm/fastgpt/charts/*.tgz
|
|||
|
||||
tmp/
|
||||
coverage
|
||||
document/.source
|
||||
document/.source
|
||||
|
||||
projects/app/worker/
|
||||
|
|
@ -1,35 +1,33 @@
|
|||
{
|
||||
// Place your FastGPT 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
|
||||
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
|
||||
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
|
||||
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
||||
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
|
||||
// Place your FastGPT 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
|
||||
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
|
||||
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
|
||||
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
|
||||
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
|
||||
// Placeholders with the same ids are connected.
|
||||
// Example:
|
||||
"Next api template": {
|
||||
"scope": "javascript,typescript",
|
||||
"prefix": "nextapi",
|
||||
"body": [
|
||||
"import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';",
|
||||
"import { NextAPI } from '@/service/middleware/entry';",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Query = {};",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Body = {};",
|
||||
"",
|
||||
"export type ${TM_FILENAME_BASE}Response = {};",
|
||||
"",
|
||||
"async function handler(",
|
||||
" req: ApiRequestProps<${TM_FILENAME_BASE}Body, ${TM_FILENAME_BASE}Query>,",
|
||||
" res: ApiResponseType<any>",
|
||||
"): Promise<${TM_FILENAME_BASE}Response> {",
|
||||
" $1",
|
||||
" return {}",
|
||||
"}",
|
||||
"",
|
||||
"export default NextAPI(handler);"
|
||||
"import { NextAPI } from '@/service/middleware/entry';",
|
||||
"import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';",
|
||||
"",
|
||||
"async function handler(",
|
||||
" req: ApiRequestProps,",
|
||||
" res: ApiResponseType<${1}ResponseType>",
|
||||
"): Promise<${1}ResponseType> {",
|
||||
" const body = ${1}BodySchema.parse(req.body);",
|
||||
" const query = ${1}QuerySchema.parse(req.query);",
|
||||
"",
|
||||
" ${2}",
|
||||
"",
|
||||
" return {};",
|
||||
"}",
|
||||
"",
|
||||
"export default NextAPI(handler);"
|
||||
],
|
||||
"description": "FastGPT Next API template"
|
||||
"description": "FastGPT Next API template with Zod validation"
|
||||
},
|
||||
"use context template": {
|
||||
"scope": "typescriptreact",
|
||||
|
|
@ -38,7 +36,7 @@
|
|||
"import React, { ReactNode } from 'react';",
|
||||
"import { createContext } from 'use-context-selector';",
|
||||
"",
|
||||
"type ContextType = {$1};",
|
||||
"type ContextType = {${1}};",
|
||||
"",
|
||||
"export const Context = createContext<ContextType>({});",
|
||||
"",
|
||||
|
|
@ -65,4 +63,4 @@
|
|||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
116
CLAUDE.md
|
|
@ -1,116 +0,0 @@
|
|||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
FastGPT is an AI Agent construction platform providing out-of-the-box data processing, model invocation capabilities, and visual workflow orchestration through Flow. This is a full-stack TypeScript application built on NextJS with MongoDB/PostgreSQL backends.
|
||||
|
||||
**Tech Stack**: NextJS + TypeScript + ChakraUI + MongoDB + PostgreSQL (PG Vector)/Milvus
|
||||
|
||||
## Architecture
|
||||
|
||||
This is a monorepo using pnpm workspaces with the following key structure:
|
||||
|
||||
### Packages (Library Code)
|
||||
- `packages/global/` - Shared types, constants, utilities used across all projects
|
||||
- `packages/service/` - Backend services, database schemas, API controllers, workflow engine
|
||||
- `packages/web/` - Shared frontend components, hooks, styles, i18n
|
||||
- `packages/templates/` - Application templates for the template market
|
||||
|
||||
### Projects (Applications)
|
||||
- `projects/app/` - Main NextJS web application (frontend + API routes)
|
||||
- `projects/sandbox/` - NestJS code execution sandbox service
|
||||
- `projects/mcp_server/` - Model Context Protocol server implementation
|
||||
|
||||
### Key Directories
|
||||
- `document/` - Documentation site (NextJS app with content)
|
||||
- `plugins/` - External plugins (models, crawlers, etc.)
|
||||
- `deploy/` - Docker and Helm deployment configurations
|
||||
- `test/` - Centralized test files and utilities
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Main Commands (run from project root)
|
||||
- `pnpm dev` - Start development for all projects (uses package.json workspace scripts)
|
||||
- `pnpm build` - Build all projects
|
||||
- `pnpm test` - Run tests using Vitest
|
||||
- `pnpm test:workflow` - Run workflow-specific tests
|
||||
- `pnpm lint` - Run ESLint across all TypeScript files with auto-fix
|
||||
- `pnpm format-code` - Format code using Prettier
|
||||
|
||||
### Project-Specific Commands
|
||||
**Main App (projects/app/)**:
|
||||
- `cd projects/app && pnpm dev` - Start NextJS dev server
|
||||
- `cd projects/app && pnpm build` - Build NextJS app
|
||||
- `cd projects/app && pnpm start` - Start production server
|
||||
|
||||
**Sandbox (projects/sandbox/)**:
|
||||
- `cd projects/sandbox && pnpm dev` - Start NestJS dev server with watch mode
|
||||
- `cd projects/sandbox && pnpm build` - Build NestJS app
|
||||
- `cd projects/sandbox && pnpm test` - Run Jest tests
|
||||
|
||||
**MCP Server (projects/mcp_server/)**:
|
||||
- `cd projects/mcp_server && bun dev` - Start with Bun in watch mode
|
||||
- `cd projects/mcp_server && bun build` - Build MCP server
|
||||
- `cd projects/mcp_server && bun start` - Start MCP server
|
||||
|
||||
### Utility Commands
|
||||
- `pnpm create:i18n` - Generate i18n translation files
|
||||
- `pnpm api:gen` - Generate OpenAPI documentation
|
||||
- `pnpm initIcon` - Initialize icon assets
|
||||
- `pnpm gen:theme-typings` - Generate Chakra UI theme typings
|
||||
|
||||
## Testing
|
||||
|
||||
The project uses Vitest for testing with coverage reporting. Key test commands:
|
||||
- `pnpm test` - Run all tests
|
||||
- `pnpm test:workflow` - Run workflow tests specifically
|
||||
- Test files are located in `test/` directory and `projects/app/test/`
|
||||
- Coverage reports are generated in `coverage/` directory
|
||||
|
||||
## Code Organization Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
- Shared code lives in `packages/` and is imported using workspace references
|
||||
- Each project in `projects/` is a standalone application
|
||||
- Use `@fastgpt/global`, `@fastgpt/service`, `@fastgpt/web` imports for shared packages
|
||||
|
||||
### API Structure
|
||||
- NextJS API routes in `projects/app/src/pages/api/`
|
||||
- Core business logic in `packages/service/core/`
|
||||
- Database schemas in `packages/service/` with MongoDB/Mongoose
|
||||
|
||||
### Frontend Architecture
|
||||
- React components in `projects/app/src/components/` and `packages/web/components/`
|
||||
- Chakra UI for styling with custom theme in `packages/web/styles/theme.ts`
|
||||
- i18n support with files in `packages/web/i18n/`
|
||||
- State management using React Context and Zustand
|
||||
|
||||
### Workflow System
|
||||
- Visual workflow editor using ReactFlow
|
||||
- Workflow engine in `packages/service/core/workflow/`
|
||||
- Node definitions in `packages/global/core/workflow/template/`
|
||||
- Dispatch system for executing workflow nodes
|
||||
|
||||
## Development Notes
|
||||
|
||||
- **Package Manager**: Uses pnpm with workspace configuration
|
||||
- **Node Version**: Requires Node.js >=18.16.0, pnpm >=9.0.0
|
||||
- **Database**: Supports MongoDB, PostgreSQL with pgvector, or Milvus for vector storage
|
||||
- **AI Integration**: Supports multiple AI providers through unified interface
|
||||
- **Internationalization**: Full i18n support for Chinese, English, and Japanese
|
||||
|
||||
## Key File Patterns
|
||||
|
||||
- `.ts` and `.tsx` files use TypeScript throughout
|
||||
- Database schemas use Mongoose with TypeScript
|
||||
- API routes follow NextJS conventions
|
||||
- Component files use React functional components with hooks
|
||||
- Shared types defined in `packages/global/` with `.d.ts` files
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
- Configuration files in `projects/app/data/config.json`
|
||||
- Environment-specific configs supported
|
||||
- Model configurations in `packages/service/core/ai/config/`
|
||||
2
Makefile
|
|
@ -21,5 +21,5 @@ ifeq ($(proxy), taobao)
|
|||
else ifeq ($(proxy), clash)
|
||||
docker build -f $(filePath) -t $(image) . --network host --build-arg HTTP_PROXY=http://127.0.0.1:7890 --build-arg HTTPS_PROXY=http://127.0.0.1:7890
|
||||
else
|
||||
docker build -f $(filePath) -t $(image) .
|
||||
docker build --progress=plain -f $(filePath) -t $(image) .
|
||||
endif
|
||||
|
|
@ -57,7 +57,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
|||
- [x] 知识库单点搜索测试
|
||||
- [x] 对话时反馈引用并可修改与删除
|
||||
- [x] 完整调用链路日志
|
||||
- [ ] 应用评测
|
||||
- [x] 应用评测
|
||||
- [ ] 高级编排 DeBug 调试模式
|
||||
- [ ] 应用节点日志
|
||||
|
||||
|
|
@ -114,10 +114,6 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
|||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
</a>
|
||||
|
||||
## 🏘️ 加入我们
|
||||
|
||||
我们正在寻找志同道合的小伙伴,加速 FastGPT 的发展。你可以通过 [FastGPT 2025 招聘](https://fael3z0zfze.feishu.cn/wiki/P7FOwEmPziVcaYkvVaacnVX1nvg)了解 FastGPT 的招聘信息。
|
||||
|
||||
## 💪 相关项目
|
||||
|
||||
- [FastGPT-plugin](https://github.com/labring/fastgpt-plugin)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
如果您发现了 FastGPT 的安全漏洞,请按照以下步骤进行报告:
|
||||
|
||||
1. **报告方式**
|
||||
发送邮件至:yujinlong@sealos.io
|
||||
发送邮件至:archer@fastgpt.io
|
||||
请备注版本以及您的 GitHub 账号
|
||||
|
||||
3. **响应时间**
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
### 加向量库
|
||||
|
||||
比如添加 `exampleDB` 向量库:
|
||||
1. 添加 vector service 配置在 `templates/vector` 下面,例如 `templates/vector/exampleDB.txt` 内容可以参考其他 txt,注意缩进,image 名字也要替换成 ${{exampleDB.image}}:${{exampleDB:tag}}
|
||||
1. 添加 vector service 配置在 `templates/vector` 下面,例如 `templates/vector/exampleDB.txt` 内容可以参考其他 txt,注意缩进,image 名字也要替换成 ${{exampleDB.image}}:${{exampleDB:tag}}, service name 必须是 `vectorDB`
|
||||
2. 在 `args.json` 中添加 `exampleDB` 的配置
|
||||
3. init.mjs vector enum 中添加 `vector`
|
||||
4. init.mjs 中添加 vector 的相关配置:
|
||||
|
|
@ -34,7 +34,7 @@ const vector = {
|
|||
```
|
||||
|
||||
5. init.mjs 读入 vector 配置
|
||||
|
||||
|
||||
```json
|
||||
{ // 这是个块作用域, 直接搜 read in Vectors
|
||||
// read in Vectors
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"tags": {
|
||||
"fastgpt": "v4.13.0",
|
||||
"fastgpt-sandbox": "v4.13.0",
|
||||
"fastgpt-mcp_server": "v4.13.0",
|
||||
"fastgpt-plugin": "v0.2.0",
|
||||
"fastgpt": "v4.14.4",
|
||||
"fastgpt-sandbox": "v4.14.4",
|
||||
"fastgpt-mcp_server": "v4.14.4",
|
||||
"fastgpt-plugin": "v0.3.4",
|
||||
"aiproxy": "v0.3.2",
|
||||
"aiproxy-pg": "0.8.0-pg15",
|
||||
"mongo": "5.0.18",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,24 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mongo',
|
||||
'-u',
|
||||
'myusername',
|
||||
'-p',
|
||||
'mypassword',
|
||||
'--authenticationDatabase',
|
||||
'admin',
|
||||
'--eval',
|
||||
"db.adminCommand('ping')"
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -118,7 +136,7 @@ services:
|
|||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
ports:
|
||||
- 3002:3000
|
||||
networks:
|
||||
|
|
@ -126,7 +144,7 @@ services:
|
|||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
ports:
|
||||
- 3005:3000
|
||||
networks:
|
||||
|
|
@ -135,7 +153,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
ports:
|
||||
|
|
@ -144,15 +162,14 @@ services:
|
|||
- fastgpt
|
||||
environment:
|
||||
- AUTH_TOKEN=token
|
||||
- S3_EXTERNAL_BASE_URL=http://127.0.0.1:9000 # TODO: 改为你 Minio 的实际的 ip 地址
|
||||
- S3_ENDPOINT=fastgpt-minio
|
||||
- S3_PORT=9000
|
||||
- S3_USE_SSL=false
|
||||
- S3_ACCESS_KEY=minioadmin
|
||||
- S3_SECRET_KEY=minioadmin
|
||||
- S3_BUCKET=fastgpt-plugins
|
||||
- S3_TOOL_BUCKET=fastgpt-tool # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PLUGIN_BUCKET=fastgpt-plugin # 系统插件热安装文件的桶,私有读写。
|
||||
- RETENTION_DAYS=15 # 系统工具临时文件保存天数
|
||||
- S3_PUBLIC_BUCKET=fastgpt-public # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PRIVATE_BUCKET=fastgpt-private # 系统插件热安装文件的桶,私有读写。
|
||||
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin&directConnection=true
|
||||
- REDIS_URL=redis://default:mypassword@redis:6379
|
||||
depends_on:
|
||||
|
|
|
|||
|
|
@ -48,6 +48,24 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mongo',
|
||||
'-u',
|
||||
'myusername',
|
||||
'-p',
|
||||
'mypassword',
|
||||
'--authenticationDatabase',
|
||||
'admin',
|
||||
'--eval',
|
||||
"db.adminCommand('ping')"
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -118,7 +136,7 @@ services:
|
|||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
ports:
|
||||
- 3002:3000
|
||||
networks:
|
||||
|
|
@ -126,7 +144,7 @@ services:
|
|||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
ports:
|
||||
- 3005:3000
|
||||
networks:
|
||||
|
|
@ -135,7 +153,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
ports:
|
||||
|
|
@ -144,15 +162,14 @@ services:
|
|||
- fastgpt
|
||||
environment:
|
||||
- AUTH_TOKEN=token
|
||||
- S3_EXTERNAL_BASE_URL=http://127.0.0.1:9000 # TODO: 改为你 Minio 的实际的 ip 地址
|
||||
- S3_ENDPOINT=fastgpt-minio
|
||||
- S3_PORT=9000
|
||||
- S3_USE_SSL=false
|
||||
- S3_ACCESS_KEY=minioadmin
|
||||
- S3_SECRET_KEY=minioadmin
|
||||
- S3_BUCKET=fastgpt-plugins
|
||||
- S3_TOOL_BUCKET=fastgpt-tool # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PLUGIN_BUCKET=fastgpt-plugin # 系统插件热安装文件的桶,私有读写。
|
||||
- RETENTION_DAYS=15 # 系统工具临时文件保存天数
|
||||
- S3_PUBLIC_BUCKET=fastgpt-public # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PRIVATE_BUCKET=fastgpt-private # 系统插件热安装文件的桶,私有读写。
|
||||
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin&directConnection=true
|
||||
- REDIS_URL=redis://default:mypassword@redis:6379
|
||||
depends_on:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -47,7 +49,6 @@ services:
|
|||
# milvus
|
||||
milvus-etcd:
|
||||
container_name: milvus-etcd
|
||||
image:
|
||||
image: quay.io/coreos/etcd:v3.5.5
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
|
|
@ -64,7 +65,7 @@ services:
|
|||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
milvusStandalone:
|
||||
vectorDB:
|
||||
container_name: milvusStandalone
|
||||
image: milvusdb/milvus:v2.4.3
|
||||
command: ['milvus', 'run', 'standalone']
|
||||
|
|
@ -101,6 +102,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -147,10 +154,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -158,7 +185,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -185,9 +212,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -201,33 +225,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -236,7 +242,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -244,7 +250,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,23 +9,27 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
undefined
|
||||
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||
|
||||
|
||||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
ob:
|
||||
vectorDB:
|
||||
image: oceanbase/oceanbase-ce:4.3.5-lts
|
||||
container_name: ob
|
||||
restart: always
|
||||
|
|
@ -76,6 +79,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -122,10 +131,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -133,7 +162,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -160,9 +189,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -176,33 +202,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -211,7 +219,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -219,7 +227,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -26,7 +28,7 @@ x-vec-config: &x-vec-config
|
|||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
pg:
|
||||
vectorDB:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15
|
||||
container_name: pg
|
||||
restart: always
|
||||
|
|
@ -58,6 +60,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -104,10 +112,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -115,7 +143,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -142,9 +170,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -158,33 +183,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -193,7 +200,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -201,7 +208,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -41,6 +43,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -87,10 +95,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -98,7 +126,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -125,9 +153,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -141,33 +166,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -176,7 +183,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -184,7 +191,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -47,7 +49,6 @@ services:
|
|||
# milvus
|
||||
milvus-etcd:
|
||||
container_name: milvus-etcd
|
||||
image:
|
||||
image: quay.io/coreos/etcd:v3.5.5
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
|
|
@ -64,7 +65,7 @@ services:
|
|||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
milvusStandalone:
|
||||
vectorDB:
|
||||
container_name: milvusStandalone
|
||||
image: milvusdb/milvus:v2.4.3
|
||||
command: ['milvus', 'run', 'standalone']
|
||||
|
|
@ -101,6 +102,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -147,10 +154,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -158,7 +185,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -185,9 +212,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -201,33 +225,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -236,7 +242,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -244,7 +250,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,23 +9,27 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
undefined
|
||||
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||
|
||||
|
||||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
ob:
|
||||
vectorDB:
|
||||
image: oceanbase/oceanbase-ce:4.3.5-lts
|
||||
container_name: ob
|
||||
restart: always
|
||||
|
|
@ -76,6 +79,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -122,10 +131,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -133,7 +162,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -160,9 +189,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -176,33 +202,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -211,7 +219,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -219,7 +227,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -26,7 +28,7 @@ x-vec-config: &x-vec-config
|
|||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
pg:
|
||||
vectorDB:
|
||||
image: pgvector/pgvector:0.8.0-pg15
|
||||
container_name: pg
|
||||
restart: always
|
||||
|
|
@ -58,6 +60,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -104,10 +112,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -115,7 +143,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -142,9 +170,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -158,33 +183,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -193,7 +200,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -201,7 +208,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -41,6 +43,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -87,10 +95,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -98,7 +126,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -125,9 +153,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -141,33 +166,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -176,7 +183,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -184,7 +191,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ const vector = {
|
|||
},
|
||||
ob: {
|
||||
db: '',
|
||||
cofig: `\
|
||||
config: `\
|
||||
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||
`,
|
||||
extra: `\
|
||||
|
|
|
|||
|
|
@ -48,6 +48,24 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'mongo',
|
||||
'-u',
|
||||
'myusername',
|
||||
'-p',
|
||||
'mypassword',
|
||||
'--authenticationDatabase',
|
||||
'admin',
|
||||
'--eval',
|
||||
"db.adminCommand('ping')"
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -144,15 +162,14 @@ services:
|
|||
- fastgpt
|
||||
environment:
|
||||
- AUTH_TOKEN=token
|
||||
- S3_EXTERNAL_BASE_URL=http://127.0.0.1:9000 # TODO: 改为你 Minio 的实际的 ip 地址
|
||||
- S3_ENDPOINT=fastgpt-minio
|
||||
- S3_PORT=9000
|
||||
- S3_USE_SSL=false
|
||||
- S3_ACCESS_KEY=minioadmin
|
||||
- S3_SECRET_KEY=minioadmin
|
||||
- S3_BUCKET=fastgpt-plugins
|
||||
- S3_TOOL_BUCKET=fastgpt-tool # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PLUGIN_BUCKET=fastgpt-plugin # 系统插件热安装文件的桶,私有读写。
|
||||
- RETENTION_DAYS=15 # 系统工具临时文件保存天数
|
||||
- S3_PUBLIC_BUCKET=fastgpt-public # 系统工具,创建的临时文件,存储的桶,要求公开读私有写。
|
||||
- S3_PRIVATE_BUCKET=fastgpt-private # 系统插件热安装文件的桶,私有读写。
|
||||
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin&directConnection=true
|
||||
- REDIS_URL=redis://default:mypassword@redis:6379
|
||||
depends_on:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -40,6 +42,12 @@ ${{vec.db}}
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -86,6 +94,26 @@ ${{vec.db}}
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: ${{minio.image}}:${{minio.tag}}
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
|
|
@ -97,7 +125,7 @@ ${{vec.db}}
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -124,9 +152,6 @@ ${{vec.db}}
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -140,24 +165,6 @@ ${{vec.db}}
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: ${{minio.image}}:${{minio.tag}}
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ${{fastgpt-sandbox.image}}:${{fastgpt-sandbox.tag}}
|
||||
|
|
@ -183,7 +190,6 @@ ${{vec.db}}
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
# milvus
|
||||
milvus-etcd:
|
||||
container_name: milvus-etcd
|
||||
image:
|
||||
image: ${{milvus-etcd.image}}:${{milvus-etcd.tag}}
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
|
|
@ -34,7 +33,7 @@
|
|||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
milvusStandalone:
|
||||
vectorDB:
|
||||
container_name: milvusStandalone
|
||||
image: ${{milvus-standalone.image}}:${{milvus-standalone.tag}}
|
||||
command: ['milvus', 'run', 'standalone']
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ob:
|
||||
vectorDB:
|
||||
image: ${{oceanbase.image}}:${{oceanbase.tag}}
|
||||
container_name: ob
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
pg:
|
||||
vectorDB:
|
||||
image: ${{pg.image}}:${{pg.tag}}
|
||||
container_name: pg
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# FastGPT 文档
|
||||
|
||||
这是FastGPT的官方文档,采用fumadoc框架。
|
||||
这是FastGPT的官方文档,采用 fumadoc 框架。
|
||||
## 运行项目
|
||||
|
||||
要运行文档,首先需要进行环境变量配置,在文档的根目录下创建`.env.local`文件,填写以下环境变量:
|
||||
|
|
@ -12,7 +12,7 @@ FASTGPT_HOME_DOMAIN = #要跳转的FastGPT项目的域名,默认海外版
|
|||
你可以在FastGPT项目根目录下执行以下命令来运行文档。
|
||||
|
||||
```bash
|
||||
npm install #只能npm install,不能pnpm
|
||||
npm install # 只能 npm install,不能 pnpm
|
||||
npm run dev
|
||||
```
|
||||
项目会默认跑在`http:localhost:3000`端口
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ title: 报错
|
|||
|
||||
1. ### 当前分组上游负载已饱和,请稍后再试(request id:202407100753411462086782835521)
|
||||
|
||||
是oneapi渠道的问题,可以换个模型用or换一家中转站
|
||||
是oneapi渠道的问题,可以换个模型用或者换一家中转站
|
||||
|
||||
1. ### 使用API时在日志中报错Connection Error
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ description: FastGPT 系统插件设计方案
|
|||
|
||||
1. 使用 ts-rest 作为 RPC 框架进行交互,提供 sdk 供 FastGPT 主项目调用
|
||||
2. 使用 zod 进行类型验证
|
||||
3. 用 bun 进行编译,每个工具编译为单一的 `.js` 文件,支持热插拔。
|
||||
3. 用 bun 进行编译,每个工具编译为单一的 `.pkg` 文件,支持热插拔。
|
||||
|
||||
## 项目结构
|
||||
|
||||
|
|
@ -48,10 +48,11 @@ description: FastGPT 系统插件设计方案
|
|||
- **model** 模型预设
|
||||
- **scripts** 脚本(编译、创建新工具)
|
||||
- **sdk**: SDK 定义,供外部调用,发布到了 npm
|
||||
- **src**: 运行时,express 服务
|
||||
- **runtime**: 运行时,express 服务
|
||||
- **lib**: 库文件,提供工具函数和类库
|
||||
- **test**: 测试相关
|
||||
|
||||
系统工具的结构可以参考 [如何开发系统工具](/docs/introduction/guide/plugins/dev_system_tool)。
|
||||
系统工具的结构可以参考 [如何开发系统插件](/docs/introduction/guide/plugins/dev_system_tool)。
|
||||
|
||||
## 技术细节
|
||||
|
||||
|
|
@ -78,7 +79,7 @@ zod 可以实现在运行时的类型校验,也可以提供更高级的功能
|
|||
|
||||
### 使用 bun 进行打包
|
||||
|
||||
将插件 bundle 为一个单一的 `.js` 文件是一个重要的设计。这样可以将插件发布出来直接通过网络挂载等的形式使用。
|
||||
将插件 bundle 为一个单一的 `.pkg` 文件是一个重要的设计。这样可以将插件发布出来直接通过网络挂载等的形式使用。
|
||||
|
||||
## 未来规划
|
||||
|
||||
|
|
|
|||
|
|
@ -191,15 +191,24 @@ bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) --region=global --ve
|
|||
|
||||
</Alert>
|
||||
|
||||
### 2. 修改环境变量
|
||||
按照您的需求自行修改环境变量,建议在生产环境修改账号密码等。
|
||||
对于 Zilliz 版本 还需要获取密钥,参考 [部署 Zilliz 版本获取账号和密钥](#部署-zilliz-版本获取账号和密钥)
|
||||
### 2. 开放外网端口/配置域名
|
||||
|
||||
### 3. 修改 config.json 配置文件
|
||||
以下两个端口必须被访问到:
|
||||
|
||||
1. 指向 3000 端口(FastGPT 主服务)
|
||||
2. 指向 9000 端口(S3 服务)
|
||||
|
||||
### 3. 修改环境变量
|
||||
|
||||
1. 修改 yml 文件顶部的`S3_EXTERNAL_BASE_URL`变量,改成 S3 的可访问地址(要求使用者可以访问)
|
||||
2. 按照您的需求自行修改环境变量,建议在生产环境修改账号密码等。
|
||||
3. 对于 Zilliz 版本 还需要获取密钥,参考 [部署 Zilliz 版本获取账号和密钥](#部署-zilliz-版本获取账号和密钥)
|
||||
|
||||
### 4. 修改 config.json 配置文件
|
||||
|
||||
修改`config.json`文件中的`mcpServerProxyEndpoint`值,设置成`mcp server`的公网可访问地址,yml 文件中默认给出了映射到 3005 端口,如通过 IP 访问,则可能是:`120.172.2.10:3005`。
|
||||
|
||||
### 4. 启动容器
|
||||
### 5. 启动容器
|
||||
|
||||
在 docker-compose.yml 同级目录下执行。请确保`docker-compose`版本最好在2.17以上,否则可能无法执行自动化命令。
|
||||
|
||||
|
|
@ -208,20 +217,28 @@ bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) --region=global --ve
|
|||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 5. 访问 FastGPT
|
||||
### 6. 访问 FastGPT
|
||||
|
||||
目前可以通过 `ip:3000` 直接访问(注意开放防火墙)。登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW`。
|
||||
可通过第二步开放的端口/域名访问 FastGPT。
|
||||
登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW`。
|
||||
每次重启容器,都会自动初始化 root 用户,密码为 `1234`(与环境变量中的`DEFAULT_ROOT_PSW`一致)。
|
||||
|
||||
如果需要域名访问,请自行安装并配置 Nginx。
|
||||
|
||||
首次运行,会自动初始化 root 用户,密码为 `1234`(与环境变量中的`DEFAULT_ROOT_PSW`一致),日志可能会提示一次`MongoServerError: Unable to read from a snapshot due to pending collection catalog changes;`可忽略。
|
||||
|
||||
### 6. 配置模型
|
||||
### 7. 配置模型
|
||||
|
||||
- 首次登录FastGPT后,系统会提示未配置`语言模型`和`索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。
|
||||
- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/introduction/development/modelConfig/ai-proxy)
|
||||
- 目前已知可能问题:首次进入系统后,整个浏览器 tab 无法响应。此时需要删除该tab,重新打开一次即可。
|
||||
|
||||
### 8. 安装系统插件
|
||||
|
||||
从 V4.14.0 版本开始,fastgpt-plugin 镜像仅提供运行环境,不再预装系统插件,所有 FastGPT 系统需手动安装系统插件。
|
||||
|
||||
* 通过插件市场安装,默认会向公开的 FastGPT Marketplace 获取数据进行安装。
|
||||
* 如果你的 FastGPT 无法访问插件市场,则可以手动访问[FastGPT 插件市场](https://marketplace.fastgpt.cn/),先下载 .pkg 文件,再通过文件导入的方式安装到系统里。
|
||||
* 除了安装外,还可对工具进行排序、默认安装、标签管理等。
|
||||
|
||||

|
||||
|
||||
## FAQ
|
||||
|
||||
### 登录系统后,浏览器无法响应
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import { Alert } from '@/components/docs/Alert';
|
|||
### 2. 配置介绍
|
||||
|
||||
<Alert icon="🤖" context="success">
|
||||
注意: 1. 目前语音识别模型和重排模型仅会生效一个,所以配置时候,只需要配置一个即可。 2.
|
||||
注意: 1. 目前语音识别模型仅会生效一个,所以配置时候,只需要配置一个即可。 2.
|
||||
系统至少需要一个语言模型和一个索引模型才能正常使用。
|
||||
</Alert>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ description: FastGPT OpenAPI 对话接口
|
|||
|
||||
{/* * 对话现在有`v1`和`v2`两个接口,可以按需使用,v2 自 4.9.4 版本新增,v1 接口同时不再维护 */}
|
||||
|
||||
## 请求简易应用和工作流
|
||||
## 请求对话 Agent 和工作流
|
||||
|
||||
`v1`对话接口兼容`GPT`的接口!如果你的项目使用的是标准的`GPT`官方接口,可以直接通过修改`BaseUrl`和 `Authorization`来访问 FastGpt 应用,不过需要注意下面几个规则:
|
||||
|
||||
|
|
@ -616,7 +616,7 @@ event取值:
|
|||
<Tab value="请求示例">
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories' \
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/history/getHistories' \
|
||||
--header 'Authorization: Bearer [apikey]' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
|
@ -679,7 +679,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories
|
|||
<Tab value="请求示例">
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistory' \
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/history/updateHistory' \
|
||||
--header 'Authorization: Bearer [apikey]' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
|
@ -721,7 +721,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor
|
|||
<Tab value="请求示例">
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistory' \
|
||||
curl --location --request POST 'http://localhost:3000/api/core/chat/history/updateHistory' \
|
||||
--header 'Authorization: Bearer [apikey]' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
|
@ -763,7 +763,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor
|
|||
<Tab value="请求示例">
|
||||
|
||||
```bash
|
||||
curl --location --request DELETE 'http://localhost:3000/api/core/chat/delHistory?chatId=[chatId]&appId=[appId]' \
|
||||
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/delHistory?chatId=[chatId]&appId=[appId]' \
|
||||
--header 'Authorization: Bearer [apikey]'
|
||||
```
|
||||
|
||||
|
|
@ -800,7 +800,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/delHistory
|
|||
<Tab value="请求示例">
|
||||
|
||||
```bash
|
||||
curl --location --request DELETE 'http://localhost:3000/api/core/chat/clearHistories?appId=[appId]' \
|
||||
curl --location --request DELETE 'http://localhost:3000/api/core/chat/history/clearHistories?appId=[appId]' \
|
||||
--header 'Authorization: Bearer [apikey]'
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ description: FastGPT 分享链接身份鉴权
|
|||
|
||||
### 接口统一响应格式
|
||||
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"success": true,
|
||||
"message": "错误提示",
|
||||
"msg": "同message, 错误提示",
|
||||
"data": {
|
||||
"uid": "用户唯一凭证"
|
||||
"uid": "用户唯一凭证" // 必须返回
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`FastGPT` 将会判断`success`是否为`true`决定是允许用户继续操作。`message`与`msg`是等同的,你可以选择返回其中一个,当`success`不为`true`时,将会提示这个错误。
|
||||
|
||||
`uid`是用户的唯一凭证,将会用于拉取对话记录以及保存对话记录。可参考下方实践案例。
|
||||
`uid` 是用户的唯一凭证,必须返回该 ID 且 ID 的格式为不包含 "|"、"/“、"\\" 字符的、小于等于 255 **字节长度**的字符串,否则会返回 `Invalid UID` 的错误。`uid` 将会用于拉取对话记录以及保存对话记录,可参考下方实践案例。
|
||||
|
||||
### 触发流程
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bash <(curl -fsSL https://doc.fastgpt.cn/deploy/install.sh) --region=global --ve
|
|||
- [非国内镜像版本的 docker-compose.yml](https://doc.fastgpt.cn/deploy/docker/global/docker-compose.pg.yml)
|
||||
|
||||
下载 config.json
|
||||
- [config.json](https://doc.fastgpt.cn/deploy/config.json)
|
||||
- [config.json](https://doc.fastgpt.cn/deploy/config/config.json)
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据
|
|||
SYSTEM_NAME=FastGPT
|
||||
SYSTEM_DESCRIPTION=
|
||||
SYSTEM_FAVICON=/favicon.ico
|
||||
HOME_URL=/dashboard/apps
|
||||
HOME_URL=/dashboard/agent
|
||||
```
|
||||
|
||||
SYSTEM_FAVICON 可以是一个网络地址
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { Alert } from '@/components/docs/Alert';
|
|||
|
||||
为了方便地接入**外部成员系统**,FastGPT 提供一套接入外部系统的**标准接口**,以及一个 FastGPT-SSO-Service 镜像作为**适配器**。
|
||||
|
||||
通过这套标注接口,你可以可以实现:
|
||||
通过这套标准接口,你可以可以实现:
|
||||
|
||||
1. SSO 登录。从外部系统回调后,在 FastGPT 中创建一个用户。
|
||||
2. 成员和组织架构同步(下面都简称成员同步)。
|
||||
|
|
@ -125,9 +125,9 @@ env:
|
|||
|
||||
设置 fastgpt-pro 环境变量则可开启自动成员同步
|
||||
|
||||
```bash
|
||||
```yaml
|
||||
env:
|
||||
- "SYNC_MEMBER_CRON=0 0 * * *" # Cron 表达式,每天 0 点执行
|
||||
- "SYNC_MEMBER_CRON=0 0 * * *" # Cron 表达式,每天 0 点执行,注意需要以 UTC (0时区)为准,例如如果设置北京时间 12:00 进行同步,则此处需要配置为 "0 4 * * *" (UTC 4:00执行)
|
||||
```
|
||||
|
||||
## 内置的通用协议/IM 配置示例
|
||||
|
|
@ -148,23 +148,37 @@ env:
|
|||
|
||||

|
||||
|
||||
对于开通用户SSO登录而言,开启用户身份权限的以下内容
|
||||
可以使用**批量导入/导出权限** 功能,导入如下权限配置:
|
||||
|
||||
1. ***获取通讯录基本信息***
|
||||
2. ***获取用户基本信息***
|
||||
3. ***获取用户邮箱信息***
|
||||
4. ***获取用户 user ID***
|
||||
```json
|
||||
{
|
||||
"scopes": {
|
||||
"tenant": [
|
||||
"contact:user.phone:readonly",
|
||||
"contact:contact.base:readonly",
|
||||
"contact:department.base:readonly",
|
||||
"contact:department.organize:readonly",
|
||||
"contact:user.base:readonly",
|
||||
"contact:user.department:readonly",
|
||||
"contact:user.email:readonly",
|
||||
"contact:user.employee_id:readonly"
|
||||
],
|
||||
"user": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
对于开启企业同步相关内容而言,开启身份权限的内容与上面一致,但要注意是开启应用权限
|
||||
注意:可访问的数据范围需要开启全员可见
|
||||
|
||||
#### 3. 重定向URL
|
||||
|
||||
进入开发者后台,点击企业自建应用,在开发配置的安全设置中设置重定向URL
|
||||
进入开发者后台,点击企业自建应用,在开发配置的安全设置中设置重定向URL,
|
||||
重定向 URL 形如 `https://www.fastgpt.cn/login/provider` 前面的域名修改为部署后公开可访问的 fastgpt 的域名
|
||||

|
||||
|
||||
#### 4. yml 配置示例
|
||||
|
||||
```bash
|
||||
```yaml
|
||||
fastgpt-sso:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
||||
container_name: fastgpt-sso
|
||||
|
|
@ -172,21 +186,19 @@ fastgpt-sso:
|
|||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- SSO_PROVIDER=example
|
||||
- AUTH_TOKEN=xxxxx
|
||||
# 飞书 - feishu -如果是私有化部署,这里的配置前缀可能会有变化
|
||||
- SSO_PROVIDER=feishu
|
||||
# oauth 接口(公开的飞书不用改)
|
||||
- AUTH_TOKEN=xxxxx
|
||||
# oauth 接口(私有化部署的飞书改为私有化的地址, 下同)
|
||||
- SSO_TARGET_URL=https://accounts.feishu.cn/open-apis/authen/v1/authorize
|
||||
# 获取token 接口(公开的飞书不用改)
|
||||
# 获取token 接口
|
||||
- FEISHU_TOKEN_URL=https://open.feishu.cn/open-apis/authen/v2/oauth/token
|
||||
# 获取用户信息接口(公开的飞书不用改)
|
||||
# 获取用户信息接口
|
||||
- FEISHU_GET_USER_INFO_URL=https://open.feishu.cn/open-apis/authen/v1/user_info
|
||||
# 重定向地址,因为飞书获取用户信息要校验所以需要填
|
||||
- FEISHU_REDIRECT_URI=xxx
|
||||
#飞书APP的应用ID,一般以cli开头
|
||||
# 重定向地址,设置为上面第三部中一模一样的地址
|
||||
- FEISHU_REDIRECT_URI=https://fastgpt.cn/login/provider
|
||||
# 飞书APP的应用ID,一般以cli开头
|
||||
- FEISHU_APP_ID=xxx
|
||||
#飞书APP的应用密钥
|
||||
# 飞书APP的应用密钥
|
||||
- FEISHU_APP_SECRET=xxx
|
||||
```
|
||||
|
||||
|
|
@ -217,7 +229,7 @@ fastgpt-sso:
|
|||
|
||||
#### 4. yml 配置示例
|
||||
|
||||
```bash
|
||||
```yaml
|
||||
fastgpt-sso:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
||||
container_name: fastgpt-sso
|
||||
|
|
@ -296,7 +308,7 @@ fastgpt-sso:
|
|||
|
||||
#### 2. yml 配置示例
|
||||
|
||||
```bash
|
||||
```yaml
|
||||
fastgpt-sso:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
||||
container_name: fastgpt-sso
|
||||
|
|
@ -375,7 +387,7 @@ fastgpt-sso:
|
|||
|
||||
#### 配置示例
|
||||
|
||||
```bash
|
||||
```yaml
|
||||
fastgpt-sso:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
||||
container_name: fastgpt-sso
|
||||
|
|
@ -384,6 +396,7 @@ fastgpt-sso:
|
|||
- fastgpt
|
||||
environment:
|
||||
- SSO_PROVIDER=oauth2
|
||||
- AUTH_TOKEN=xxxxx
|
||||
# OAuth2.0
|
||||
# === 请求地址 ===
|
||||
# 1. OAuth2 登陆鉴权地址 (必填)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
---
|
||||
title: 如何开发系统工具
|
||||
description: FastGPT 系统工具开发指南
|
||||
title: 如何开发系统插件
|
||||
description: FastGPT 系统插件开发指南(工具篇)
|
||||
---
|
||||
|
||||
## 介绍
|
||||
|
||||
FastGPT 系统工具项目从 4.10.0 版本后移动到独立的`fastgpt-plugin`项目中,采用纯代码的模式进行工具编写。你可以在`fastgpt-plugin`项目中进行独立开发和调试好插件后,直接向 FastGPT 官方提交 PR 即可,无需运行 FastGPT 主服务。
|
||||
FastGPT 系统插件项目从 4.10.0 版本后移动到独立的`fastgpt-plugin`项目中,采用纯代码的模式进行工具编写。
|
||||
在 4.14.0 版本插件市场更新后,系统工具开发流程有所改变,请依照最新文档贡献代码。
|
||||
|
||||
你可以在`fastgpt-plugin`项目中进行独立开发和调试好插件后,直接向 FastGPT 官方提交 PR 即可,无需运行 FastGPT 主服务。
|
||||
|
||||
目前系统插件仅支持“工具”这一种类型。
|
||||
|
||||
## 概念
|
||||
|
||||
|
|
@ -14,29 +19,74 @@ FastGPT 系统工具项目从 4.10.0 版本后移动到独立的`fastgpt-plugin`
|
|||
|
||||
在`fastgpt-plugin`中,你可以每次创建一个工具/工具集,每次提交时,仅接收一个工具/工具集。如需开发多个,可以创建多个 PR 进行提交。
|
||||
|
||||
## 1. 准备工作
|
||||
## 1. 准备开发环境
|
||||
|
||||
- Fork [fastgpt-plugin 项目](https://github.com/labring/fastgpt-plugin)
|
||||
- 安装 [Bun](https://bun.sh/)
|
||||
- 部署一套 Minio,也可以直接使用 FastGPT 的 `docker-compose.yml` 中的 Minio。
|
||||
- 本地 clone 项目 `git clone git@github.com:[your-github-username]/fastgpt-plugin.git`
|
||||
- 拷贝示例环境变量文件,并修改连接到开发环境的 Minio `cp .env.example .env.local`
|
||||
- 安装依赖 `bun install`
|
||||
- 运行开发环境 `bun run dev`
|
||||
### 1.1 安装 Bun
|
||||
|
||||
在 dev 环境下,Bun 将监听修改并热更新。
|
||||
- 安装 [Bun](https://bun.sh/), FastGPT-plugin 使用 Bun 作为包管理器
|
||||
|
||||
## 2. 初始化一个新的工具/工具集
|
||||
### 1.2 Fork FastGPT-plugin 仓库
|
||||
|
||||
### 2.1 执行创建命令
|
||||
Fork 本仓库 `https://github.com/labring/fastgpt-plugin`
|
||||
|
||||
### 1.3 搭建开发脚手架
|
||||
|
||||
<Tabs items={['通过 Bunx 一键搭建','手动搭建']}>
|
||||
<Tab value="通过 Bunx 一键搭建">
|
||||
注意:由于使用了 bun 特有的 API,必须使用 bunx 进行安装,使用 npx/npx 等会报错
|
||||
|
||||
创建一个新的目录,在该目录下执行:
|
||||
```bash
|
||||
bunx @fastgpt-sdk/plugin-cli
|
||||
```
|
||||
|
||||
上述命令会在当前目录下创建 fastgpt-plugin 目录,并且添加两个 remote:
|
||||
- upstream 指向官方仓库
|
||||
- origin 指向你自己的仓库
|
||||
|
||||
默认使用 sparse-checkout 避免拉取所有的官方插件代码
|
||||
|
||||
</Tab>
|
||||
<Tab value="手动搭建">
|
||||
- 本地在一个新建目录下初始化一个 `git`:
|
||||
|
||||
```bash
|
||||
git init
|
||||
```
|
||||
|
||||
如果配置了 Git SSH Key, 则可以:
|
||||
```bash
|
||||
git remote add origin git@github.com:[your-name]/fastgpt-plugin.git
|
||||
git remote add upstream git@github.com:labring/fastgpt-plugin.git
|
||||
```
|
||||
|
||||
否则使用 https:
|
||||
```bash
|
||||
git remote add origin https://github.com/[your-name]/fastgpt-plugin.git
|
||||
git remote add upstream https://github.com/labring/fastgpt-plugin.git
|
||||
```
|
||||
|
||||
- (可选)使用稀疏检出 (Sparse-checkout) 以避免拉取所有插件代码,如果不进行稀疏检出,则会拉取所有官方插件
|
||||
```bash
|
||||
git sparse-checkout init --no-cone
|
||||
git sparse-checkout add "/*" "!/modules/tool/packages/*"
|
||||
git pull
|
||||
```
|
||||
|
||||
使用命令创建新工具
|
||||
```bash
|
||||
bun i
|
||||
bun run new:tool
|
||||
```
|
||||
|
||||
依据提示分别选择创建工具/工具集,以及目录名(使用 camelCase 小驼峰法命名)。
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
执行完后,系统会在 `modules/tool/packages/[your-tool-name]` 下生成一个工具/工具集的目录。
|
||||
## 2. 编写工具代码
|
||||
|
||||
### 2.1 工具代码结构
|
||||
|
||||
依据提示分别选择创建工具/工具集,以及目录名(使用 camelCase 小驼峰法命名)。
|
||||
|
||||
系统工具 (Tool) 文件结构如下:
|
||||
|
||||
|
|
@ -48,6 +98,8 @@ test // 测试样例
|
|||
config.ts // 配置,配置工具的名称、描述、类型、图标等
|
||||
index.ts // 入口,不要改这个文件
|
||||
logo.svg // Logo,替换成你的工具的 Logo
|
||||
README.md // (可选)README 文件,用于展示工具的使用说明和示例
|
||||
assets/ // (可选)assets 目录,用于存放工具的资源文件,如图片、音频等
|
||||
package.json // npm 包
|
||||
```
|
||||
|
||||
|
|
@ -55,19 +107,21 @@ package.json // npm 包
|
|||
|
||||
```plaintext
|
||||
children
|
||||
└── tool // 这个里面的结构就和上面的 tool 基本一致
|
||||
└── tool // 这个里面的结构就和上面的 tool 一致,但是没有 README 和 assets 目录
|
||||
config.ts
|
||||
index.ts
|
||||
logo.svg
|
||||
README.md
|
||||
assets/
|
||||
package.json
|
||||
```
|
||||
|
||||
### 2.2 修改 config.ts
|
||||
|
||||
- **name** 和 **description** 字段为中文和英文两种语言
|
||||
- **courseUrl** 密钥获取链接,或官网链接,教程链接等。
|
||||
- **courseUrl**(可选) 密钥获取链接,或官网链接,教程链接等,如果提供 README.md,则可以写到 README 里面
|
||||
- **author** 开发者名
|
||||
- **type** 为枚举类型,目前有:
|
||||
- **tags** 工具默认的标签,有如下可选标签(枚举类型)
|
||||
- tools: 工具
|
||||
- search: 搜索
|
||||
- multimodal: 多模态
|
||||
|
|
@ -204,7 +258,7 @@ dalle3 的 outputs 参数格式如下:
|
|||
}
|
||||
```
|
||||
|
||||
## 2. 编写处理逻辑
|
||||
### 2.3 编写处理逻辑
|
||||
|
||||
在 `[your-tool-name]/src/index.ts` 为入口编写处理逻辑,需要注意:
|
||||
|
||||
|
|
@ -234,15 +288,51 @@ export async function tool(props: z.infer<typeof InputType>): Promise<z.infer<ty
|
|||
|
||||
上述例子给出了一个传入 formatStr (格式化字符串)并且返回当前时间的简单样例,如需安装包,可以在`/modules/tools/packages/[your-tool-name]`路径下,使用`bun install PACKAGE` 进行安装。
|
||||
|
||||
## 3. 调试
|
||||
## 4. 构建/打包
|
||||
|
||||
### 单测
|
||||
FastGPT v4.14.0 后,打包方式变为系统插件打包为一个 `.pkg` 文件,使用命令:
|
||||
```bash
|
||||
bun run build:pkg
|
||||
```
|
||||
将本地所有插件构建打包为 `.pkg` 文件,构建目录为 `dist/pkgs`
|
||||
|
||||
在 `test/index.test.ts` 中编写测试样例,使用 `bun run test index.test.ts完整路径` 即可运行测试。
|
||||
## 5. 单元测试
|
||||
|
||||
### 从 Scalar 进行测试
|
||||
FastGPT-plugin 使用 Vitest 作为单测框架。
|
||||
|
||||
浏览器打开`localhost:3000/openapi`可进入`fastgpt-plugin`的 OpenAPI 页面,进行 API 调试。
|
||||
### 5.1 编写单测样例
|
||||
|
||||
在 `test/index.test.ts` 中编写测试样例,使用 `bun run test index.test.ts 完整路径` 即可运行测试。
|
||||
|
||||
> 注意:不要把你的 secret 密钥等写到测试样例中
|
||||
>
|
||||
> 使用 Agent 工具编写测试样例时,可能 Agent 工具会修改您的处理逻辑甚至修改整个测试框架的逻辑。
|
||||
|
||||
### 5.2 查看测试样例覆盖率(coverage)
|
||||
|
||||
浏览器打开 coverage/index.html 可以插件各个模块的覆盖率
|
||||
|
||||
提交插件给官方仓库,必须编写单元测试样例,并且达到:
|
||||
- 90% 以上代码覆盖率
|
||||
- 100% 函数覆盖率
|
||||
- 100% 分支条件覆盖率
|
||||
|
||||
## 6. E2E (端到端)测试
|
||||
|
||||
对于简单的工具,可能并不需要进行 E2E 测试,而如果工具过于复杂,官方人员可能会要求您完成 E2E 测试。
|
||||
|
||||
### 6.1 部署 E2E 测试环境
|
||||
|
||||
1. 参考 [快速开始本地开发](/docs/introduction/development/intro),在本地部署一套 FastGPT 开发环境
|
||||
2. `cd runtime && cp .env.template .env.local` 复制环境变量样例文件,连接到上一步部署的 Minio, Mongo, Redis 中
|
||||
3. `bun run dev` 运行开发环境,修改 FastGPT 的环境变量,连接到你刚刚启动的 fastgpt-plugin
|
||||
|
||||
### 6.2 从 Scalar 进行测试
|
||||
|
||||
运行 fastgpt-plugin 开发环境
|
||||
|
||||
浏览器打开`http://localhost:PORT/openapi`可进入`fastgpt-plugin`的 OpenAPI 页面,进行 API 调试。
|
||||
PORT 为你的 fastgpt-plugin 的端口
|
||||
|
||||

|
||||
|
||||
|
|
@ -250,14 +340,18 @@ export async function tool(props: z.infer<typeof InputType>): Promise<z.infer<ty
|
|||
|
||||

|
||||
|
||||
### 从 FastGPT 主服务进行测试
|
||||
### 6.3 在开发环境下 e2e 测试(有热更新)
|
||||
|
||||
如果本地运行有`FastGPT`主服务,则可以直接添加对应的工具进行测试。
|
||||
默认情况下,fastgpt-plugin 会自动加载在 modules/tool/packages/ 下的所有工具,并自动监听文件修改并进行热更新。
|
||||
可以在 FastGPT 中使用这些工具
|
||||
|
||||
### 可视化调试(TODO)
|
||||
### 6.4 在开发环境下上传工具进行 e2e 测试(没有热更新)
|
||||
|
||||
## 4. 提交工具至官方目录
|
||||
设置 FastGPT-plugin 的环境变量 `DISABLE_DEV_TOOLS=true` 会禁用自动加载开发环境下的工具,此时可以测试工具的上传。
|
||||
|
||||
完毕上述所有内容后,向官方仓库 `https://github.com/labring/fastgpt-plugin` 提交 PR。官方人员审核通过后即可收录为 FastGPT 的官方插件。
|
||||
## 7. 提交工具至官方目录
|
||||
|
||||
如无需官方收录,可自行对该项目进行 Docker 打包,并替换官方镜像即可。
|
||||
完毕上述所有内容后,向官方仓库 `https://github.com/labring/fastgpt-plugin` 提交 PR。
|
||||
官方人员审核通过后即可收录为 FastGPT 的官方插件。
|
||||
|
||||
如无需官方收录,则可以参考 [上传系统工具](upload_system_tool) 在自己部署的 FastGPT 中使用。
|
||||
|
|
|
|||
|
|
@ -3,42 +3,38 @@ title: 如何在线上传系统工具
|
|||
description: FastGPT 系统工具在线上传指南
|
||||
---
|
||||
|
||||
> 从 FastGPT 4.14.0 版本开始,系统管理员可以通过 Web 界面直接上传和更新系统工具,无需重新部署服务
|
||||
> 从 FastGPT 4.14.0 版本开始,系统管理员可以通过 Web 界面直接上传和更新系统工具进行热更新
|
||||
|
||||
## 权限要求
|
||||
|
||||
⚠️ **重要提示**:只有 **root 用户** 才能使用在线上传系统工具功能。
|
||||
|
||||
- 确保您已使用 `root` 账户登录 FastGPT
|
||||
- 普通用户无法看到"导入/更新"按钮和删除功能
|
||||
|
||||
## 支持的文件格式
|
||||
|
||||
- **文件类型**:`.js` 文件
|
||||
- **文件大小**:最大 10MB
|
||||
- **文件数量**:每次只能上传一个文件
|
||||
- **文件类型**:`.pkg` 文件
|
||||
- **文件大小**:最大 100 MB
|
||||
- **文件数量**:每次最多上传 15 个文件
|
||||
|
||||
## 上传步骤
|
||||
|
||||
### 1. 进入系统工具页面
|
||||
### 1. 进入配置页面
|
||||
|
||||
1. 登录 FastGPT 管理后台
|
||||
2. 导航到:**工作台** → **系统工具**
|
||||
3. 确认页面右上角显示"导入/更新"按钮(只有 root 用户可见)
|
||||
|
||||

|
||||
|
||||
### 2. 准备工具文件
|
||||
|
||||
在上传之前,请确保您的 `.js` 文件是从 fastgpt-plugin 项目中通过 `bun run build` 命令打包后的 dist/tools/built-in 文件夹下得到的
|
||||
在上传之前,请确保您的 `.pkg` 文件是从 fastgpt-plugin 项目中通过 `bun run build:pkg` 命令打包后的 `dist/pkgs` 文件夹下得到的
|
||||
|
||||

|
||||

|
||||
|
||||
### 3. 执行上传
|
||||
|
||||
1. 点击 **"导入/更新"** 按钮
|
||||
2. 在弹出的对话框中,点击文件选择区域
|
||||
3. 选择您准备好的 `.js` 工具文件
|
||||
3. 选择您准备好的 `.pkg` 工具文件
|
||||
4. 确认文件信息无误后,点击 **"确认导入"**
|
||||
|
||||
### 4. 上传过程
|
||||
|
|
@ -54,70 +50,10 @@ description: FastGPT 系统工具在线上传指南
|
|||
- **上传工具**:仅 root 用户可以上传新工具或更新现有工具
|
||||
- **删除工具**:仅 root 用户可以删除已上传的工具
|
||||
|
||||
### 工具类型识别
|
||||
|
||||
系统会根据工具的配置自动识别工具类型:
|
||||
|
||||
- 🔧 **工具 (tools)**
|
||||
- 🔍 **搜索 (search)**
|
||||
- 🎨 **多模态 (multimodal)**
|
||||
- 💬 **通讯 (communication)**
|
||||
- 📦 **其他 (other)**
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q: 上传失败,提示"文件内容存在错误"
|
||||
|
||||
**可能原因:**
|
||||
- fastgpt-plugin 项目不是最新的,导致打包的 `.js` 文件缺少正确的内容
|
||||
- 工具配置格式不正确
|
||||
|
||||
**解决方案:**
|
||||
1. 拉取最新的 fastgpt-plugin 项目重新进行 `bun run build` 获得打包后的 `.js` 文件
|
||||
2. 检查本地插件运行是否成功
|
||||
|
||||
### Q: 无法看到"导入/更新"按钮
|
||||
|
||||
**原因:** 当前用户不是 root 用户
|
||||
|
||||
**解决方案:** 使用 root 账户重新登录
|
||||
|
||||
### Q: 文件上传超时
|
||||
|
||||
**可能原因:**
|
||||
- 文件过大(超过 10MB)
|
||||
- 网络连接不稳定
|
||||
|
||||
**解决方案:**
|
||||
1. 确认文件大小在限制范围内
|
||||
2. 检查网络连接
|
||||
3. 尝试重新上传
|
||||
|
||||
## 最佳实践
|
||||
|
||||
### 上传前检查
|
||||
|
||||
1. **代码测试**:在本地环境测试工具功能
|
||||
2. **格式验证**:确保符合 FastGPT 工具规范
|
||||
3. **文件大小**:保持文件在合理大小范围内
|
||||
|
||||
### 版本管理
|
||||
|
||||
- 建议为工具添加版本号注释
|
||||
- 更新工具时,先备份原有版本
|
||||
- 记录更新日志和功能变更
|
||||
|
||||
### 安全考虑
|
||||
|
||||
- 仅上传来源可信的工具文件
|
||||
- 避免包含敏感信息或凭据
|
||||
- 定期审查已安装的工具
|
||||
|
||||
### 存储方式
|
||||
|
||||
- 工具文件存储在 MinIO 中
|
||||
- 工具元数据保存在 MongoDB 中
|
||||
|
||||
---
|
||||
|
||||
通过在线上传功能,您可以快速部署和管理系统工具,提高 FastGPT 的扩展性和灵活性。如遇到问题,请参考上述常见问题或联系技术支持。
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: 配置自定义域名
|
||||
description: 如何在 FastGPT 中配置自定义域名
|
||||
---
|
||||
|
||||
FastGPT 云服务版自 v4.14.4 后支持配置自定义域名。
|
||||
|
||||
## 如何配置自定义域名
|
||||
|
||||
### 1. 打开“自定义域名”页面
|
||||
|
||||
在侧边栏选择“账号” -> “自定义域名”,打开自定义域名配置页。
|
||||
|
||||
如果您的套餐等级不支持配置,请根据页面的指引升级套餐。
|
||||
|
||||

|
||||
|
||||
### 2. 添加自定义域名
|
||||
|
||||
1. 准备好您的域名。您的域名必须先经过备案,目前支持“阿里云”、“腾讯云”、“火山引擎”三家服务商的备案域名。
|
||||
2. 点击“编辑”按钮,进入编辑状态。
|
||||
3. 填入您的域名,例如 www.example.com
|
||||
4. 在域名服务商的域名解析处,添加界面中提示的 DNS 记录,注意记录类型为 CNAME。
|
||||
5. 添加解析记录后,点击"保存"按钮。系统将自动检查 DNS 解析情况,一般情况下,在一分钟内就可以获取到解析记录。如果长时间没有获取到记录,可以重试一次。
|
||||
6. 待状态提示显示为“已生效”后,点击“确认”按钮即可。
|
||||
|
||||

|
||||
|
||||
现在您可以通过您自己的域名访问 fastgpt 服务、调用 fastgpt 的 API 了。
|
||||
|
||||
## 域名解析失效
|
||||
|
||||
系统会每天对 DNS 解析进行检查,如果发现 DNS 解析记录失效,则会停用该自定义域名,可以在"自定义域名"管理界面中点击"编辑"进行重新解析。
|
||||
|
||||

|
||||
|
||||
如果您需要修改自定义域名、或修改服务商,则需要删除自定义域名配置后进行重新配置。
|
||||
|
||||
|
||||
## 使用案例
|
||||
|
||||
- [接入企业微信智能机器人](/docs/use-cases/external-integration/wecom)
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"title": "团队与权限",
|
||||
"description": "团队管理、成员组与权限设置,确保团队协作中的数据安全和权限分配合理。",
|
||||
"pages": ["team_roles_permissions","invitation_link"]
|
||||
}
|
||||
"pages": ["team_roles_permissions","invitation_link", "customDomain"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,5 @@ Due to servers potentially being located in different countries/regions, you agr
|
|||
|
||||
**Contact Us**
|
||||
|
||||
1. For any questions, suggestions, or complaints about this policy, contact us at: yujinlong@sealos.io.
|
||||
1. For any questions, suggestions, or complaints about this policy, contact us at: archer@fastgpt.io.
|
||||
2. We will respond promptly and address your concerns.
|
||||
|
|
|
|||
|
|
@ -58,5 +58,5 @@ description: ' FastGPT 隐私政策'
|
|||
|
||||
**联系我们**
|
||||
|
||||
1. 如您对本隐私政策有任何疑问、建议或投诉,请通过以下方式与我们联系:yujinlong@sealos.io。
|
||||
1. 如您对本隐私政策有任何疑问、建议或投诉,请通过以下方式与我们联系:archer@fastgpt.io。
|
||||
2. 我们将尽快回复并解决您提出的问题。
|
||||
|
|
|
|||
|
|
@ -72,4 +72,4 @@ This FastGPT Service Agreement constitutes the terms and conditions agreed betwe
|
|||
**Article 7 Additional Provisions**
|
||||
|
||||
1. If any clause is deemed unlawful or invalid, the remaining provisions shall remain enforceable.
|
||||
2. Sealos retains final authority in interpreting this Agreement and privacy policies. For any inquiries, please contact us at yujinlong@sealos.io.
|
||||
2. Sealos retains final authority in interpreting this Agreement and privacy policies. For any inquiries, please contact us at archer@fastgpt.io.
|
||||
|
|
|
|||
|
|
@ -67,4 +67,4 @@ FastGPT 服务协议是您与珠海环界云计算有限公司(以下简称“
|
|||
**第7条 其他条款**
|
||||
|
||||
1. 如本协议中部分条款因违反法律法规而被视为无效,不影响其他条款的效力。
|
||||
2. 本公司保留对本协议及隐私政策的最终解释权。如您对本协议或隐私政策有任何疑问,请联系我们:yujinlong@sealos.io。
|
||||
2. 本公司保留对本协议及隐私政策的最终解释权。如您对本协议或隐私政策有任何疑问,请联系我们:archer@fastgpt.io。
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ description: FastGPT 文档目录
|
|||
- [/docs/introduction/guide/plugins/google_search_plugin_guide](/docs/introduction/guide/plugins/google_search_plugin_guide)
|
||||
- [/docs/introduction/guide/plugins/searxng_plugin_guide](/docs/introduction/guide/plugins/searxng_plugin_guide)
|
||||
- [/docs/introduction/guide/plugins/upload_system_tool](/docs/introduction/guide/plugins/upload_system_tool)
|
||||
- [/docs/introduction/guide/team_permissions/customDomain](/docs/introduction/guide/team_permissions/customDomain)
|
||||
- [/docs/introduction/guide/team_permissions/invitation_link](/docs/introduction/guide/team_permissions/invitation_link)
|
||||
- [/docs/introduction/guide/team_permissions/team_roles_permissions](/docs/introduction/guide/team_permissions/team_roles_permissions)
|
||||
- [/docs/introduction/index](/docs/introduction/index)
|
||||
|
|
@ -109,6 +110,13 @@ description: FastGPT 文档目录
|
|||
- [/docs/upgrading/4-12/4124](/docs/upgrading/4-12/4124)
|
||||
- [/docs/upgrading/4-13/4130](/docs/upgrading/4-13/4130)
|
||||
- [/docs/upgrading/4-13/4131](/docs/upgrading/4-13/4131)
|
||||
- [/docs/upgrading/4-13/4132](/docs/upgrading/4-13/4132)
|
||||
- [/docs/upgrading/4-14/4140](/docs/upgrading/4-14/4140)
|
||||
- [/docs/upgrading/4-14/4141](/docs/upgrading/4-14/4141)
|
||||
- [/docs/upgrading/4-14/4142](/docs/upgrading/4-14/4142)
|
||||
- [/docs/upgrading/4-14/4143](/docs/upgrading/4-14/4143)
|
||||
- [/docs/upgrading/4-14/4144](/docs/upgrading/4-14/4144)
|
||||
- [/docs/upgrading/4-14/4145](/docs/upgrading/4-14/4145)
|
||||
- [/docs/upgrading/4-8/40](/docs/upgrading/4-8/40)
|
||||
- [/docs/upgrading/4-8/41](/docs/upgrading/4-8/41)
|
||||
- [/docs/upgrading/4-8/42](/docs/upgrading/4-8/42)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: 'V4.13.0(进行中)'
|
||||
title: 'V4.13.0(包含环境变量变更)'
|
||||
description: 'FastGPT V4.13.0 更新说明'
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,18 @@
|
|||
---
|
||||
title: 'V4.13.1(进行中)'
|
||||
title: 'V4.13.1'
|
||||
description: 'FastGPT V4.13.1 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.13.1
|
||||
- 更新 FastGPT 商业版镜像tag: v4.13.1
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.2.2
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
|
|
@ -27,4 +36,5 @@ description: 'FastGPT V4.13.1 更新说明'
|
|||
1. base64 解码工具,可以转化成文本和图片。
|
||||
2. 墨迹天气工具。
|
||||
3. 必优 PPT 生成工具。
|
||||
4. 可配置最大请求体大小,以及内部网络请求最大响应大小,避免响应体过大,导致内存溢出。
|
||||
4. 可配置最大请求体大小,以及内部网络请求最大响应大小,避免响应体过大,导致内存溢出。
|
||||
5. 新增 Claude4.5, qwen3, kimi2, deepseek3.2 模型预设。
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
title: 'V4.13.2(包含升级脚本)'
|
||||
description: 'FastGPT V4.13.2 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.13.2
|
||||
- 更新 FastGPT 商业版镜像tag: v4.13.2
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.2.4
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
### 2. 增加 FastGPT/FastGPT-pro 环境变量
|
||||
|
||||
```
|
||||
S3_PUBLIC_BUCKET=fastgpt-public #(公开读公开桶名称,对应原来 plugin 项目的S3_TOOL_BUCKET)
|
||||
S3_PRIVATE_BUCKET=fastgpt-private #(私有读私有写桶名称,对应原来 plugin 项目的S3_PLUGIN_BUCKET)
|
||||
```
|
||||
|
||||
### 3. 修复 fastgpt-plugin 环境变量
|
||||
|
||||
- S3_TOOL_BUCKET 改名成 S3_PUBLIC_BUCKET
|
||||
- S3_PLUGIN_BUCKET 改名成 S3_PRIVATE_BUCKET
|
||||
|
||||
### 4. 执行升级脚本
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4132' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
会删除原先 S3 的 circleLife 策略。如果使用的是外部 S3,可能会因为不支持 circleLife 操作导致该脚本错误,可以忽略(因为设置策略也会失败)。
|
||||
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. HTTP 工具集支持手动创建模式。
|
||||
2. 项目 OpenAPI 框架引入。
|
||||
3. APIKey 有效性检测接口。
|
||||
4. 导出对话日志,末尾跟随当前版本全局变量。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 非管理员无法看到团队审计日志。
|
||||
2. 引入 S3 用于存储应用头像。
|
||||
3. 工作流画布性能。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. LLM 模型默认支持图片,导致请求错误。
|
||||
2. Mongo 多副本切换时候,watch 未重新触发。
|
||||
3. 文本分块,所有策略用完后,未处理 LastText 数据。
|
||||
4. 变量输入框,number=0 时,无法通过校验。
|
||||
5. 工作流复杂循环并行判断异常。
|
||||
|
||||
## 🔨 插件更新
|
||||
|
||||
1. 新增:Perplexity search 工具。
|
||||
2. 新增:Base64转文件工具。
|
||||
3. 新增:MiniMax TTS 文件生成工具。
|
||||
4. 新增:Openrouter nano banana 绘图工具。
|
||||
5. 新增:Redis 缓存操作工具。
|
||||
6. 新增:Tavily search 工具。
|
||||
7. 新增:硅基流动 qwen-image 和 qwen-image-edit 工具。
|
||||
8. 新增:飞书多维表格操作套件。
|
||||
9. 新增:Youtube 字幕提取。
|
||||
10. 新增:阿里百炼 qwen image edit。
|
||||
11. 新增:Markdown 转 PPT 工具。
|
||||
12. 新增:whisper 语音转文字工具。
|
||||
13. 系统工具支持配置是否需要在 Worker 中运行。
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"title": "4.13.x",
|
||||
"description": "",
|
||||
"pages": ["4131", "4130"]
|
||||
"pages": ["4132", "4131", "4130"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
title: 'V4.14.0(包含升级脚本)'
|
||||
description: 'FastGPT V4.14.0 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.14.0
|
||||
- 更新 FastGPT 商业版镜像tag: v4.14.0
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.3.0
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
### 2. 执行升级脚本
|
||||
|
||||
仅需使用过自定义系统工具的商业版用户操作。
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4140' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
会将原系统工具迁移到最新数据表中。
|
||||
|
||||
### 3. 安装系统插件至系统
|
||||
|
||||
从 V4.14.0 版本开始,fastgpt-plugin 镜像仅提供运行环境,不再预装系统插件,所有 FastGPT 系统需手动安装系统插件。
|
||||
|
||||
**注意事项**
|
||||
* 原先手动安装的 js 插件包将会失效,需重新打包安装。
|
||||
* 通过插件市场安装,默认会向公开的 FastGPT Marketplace 获取数据进行安装。
|
||||
* 如果你的 FastGPT 无法访问插件市场,则可以手动访问[FastGPT 插件市场](https://marketplace.fastgpt.cn/),先下载 .pkg 文件,再通过文件导入的方式安装到系统里。
|
||||
* 除了安装外,还可对工具进行排序、默认安装、标签管理等。
|
||||
* 目前插件里仅包含工具,后续将增加触发器,文档解析器,数据分块策略,索引增强策略等。
|
||||
* 系统安装完插件后,对于多租户的系统,团队管理员可以在插件库中激活对应工具,从而在应用中使用。对于开源版,root 团队会默认激活所有系统工具。
|
||||
|
||||
|
||||
除了安装外,还可对工具进行排序、默认安装、标签管理等。
|
||||
|
||||

|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 增加插件市场,同时移除自定义插件分组,仅保留自定义标签。本期支持系统工具,可以从 FastGPT Marketplace 统一安装系统工具。后续将支持更多插件类型:工作流触发器,数据源解析方式,数据分块,索引增强策略等。
|
||||
2. 对话框上传文件移动存储至 S3,并且不会自动过期,完全跟随对话记录删除。安全性更高,签发预览连接仅 1 小时生效,而不是长期。
|
||||
3. 全局变量支持时间点/时间范围/对话模型选择类型。
|
||||
4. 插件输入支持密码类型。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 匹配 Markdown 中 Base64 图片正则性能。
|
||||
2. 团队成员接受邀请后,默认成员名改为成员账户名。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. Prompt 编辑器存在特殊语法时候,无法解析正确内容。
|
||||
2. Claude 工具调用,如果下标从 1 开始会导致参数异常。
|
||||
3. S3 删除头像,如果 key 为空时,会抛错,导致流程阻塞。
|
||||
4. 工作流前置IO 变更时,依赖未及时刷新。
|
||||
5. 导出对话日志,缺少反馈记录。
|
||||
6. 工作流欢迎语输入框输入时,光标会偏移到最后一位。
|
||||
7. 存在交互节点和连续批量执行时,会导致工作流运行逻辑错误。
|
||||
8. 工作流 Redo 操作后,编辑记录无法再继续推送快照。
|
||||
9. HTTP 自定义输入丢失。
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
title: 'V4.14.1(包含升级脚本)'
|
||||
description: 'FastGPT V4.14.1 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.14.1
|
||||
- 更新 FastGPT 商业版镜像tag: v4.14.1
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.3.1
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
### 2. 执行升级脚本
|
||||
|
||||
仅需使用过自定义系统工具的商业版用户操作。
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4141' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
复制一份原应用目录给工具使用。
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 新工作台交互。原插件,改名"工作流工具",并移动到我的工具分类下。
|
||||
2. 工作流运行欠费后提供继续运行按键,无需从头开始。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 在同一轮对话中,MCP Client 会持久化实例,不会销毁。
|
||||
2. 模型重载时候,不会把全局模型配置清空再添加,从而导致重载阶段模型调用错误。
|
||||
3. 自动保存,增加一条团队云端保存记录。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. Debug 模式下,交互节点无法正常使用。
|
||||
2. 富文本编辑器 tab 空格未对齐。
|
||||
3. 嵌套运行 Agent 时候,跳过节点队列未初始化,导致无法正常运行。
|
||||
4. 判断器右侧是 number 引用时,会出现报错。
|
||||
5. 工作流工具入参为文件选择时,未出现选择框。
|
||||
6. HTTP 插件无法正确处理 http 协议(非 https)接口请求。
|
||||
7. 文本类型的全局变量,默认值编辑框 UI。
|
||||
8. 代码节点行数超过 100 行时显示重叠。
|
||||
9. 删除应用,未把目录内的删除。
|
||||
10. 浏览器未传递实时日期至服务器。
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: 'V4.14.2'
|
||||
description: 'FastGPT V4.14.2 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.14.2
|
||||
- 更新 FastGPT 商业版镜像tag: v4.14.2
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.3.2
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 封装底层 Agent Call 方式,支持工具连续调用时上下文的压缩。
|
||||
2. 模板市场新 UI。
|
||||
3. 支持 Agent 编辑页快速创建知识库。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 30 分钟模板市场缓存时长。
|
||||
2. 自定义分隔符块大小采用最大块大小。
|
||||
3. 避免日志记录触发递归日志风暴,排除日志模型的性能监控中间件。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. 简易应用模板未正常转化。
|
||||
2. 工具调用中,包含两个以上连续用户选择时候,第二个用户选择异常。
|
||||
3. 门户中,团队应用类型错误。
|
||||
4. 应用作为 MCP 导出,被其他应用使用时,全局变量不需要填写。
|
||||
|
||||
## 插件
|
||||
|
||||
1. 修复:子工具头像丢失。
|
||||
2. 修复:模型头像丢失。
|
||||
3. 修复:Worker 中错误引用 mongoose 依赖,导致超过 10s 的工具运行报错。
|
||||
4. 优化:开发环境热更新时,不重复上传静态文件。
|
||||
5. 新增:5118 SEO 关键词挖掘工具。
|
||||
6. 新增:Tavity 内容提取高级配置。网页站点地图工具。
|
||||
7. 新增:微信公众号工具集。
|
||||
8. 新增:文档对比工具。
|
||||
9. 新增:kimiV2 和 GPT5.1 模型预设。
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: 'V4.14.3'
|
||||
description: 'FastGPT V4.14.3 更新说明'
|
||||
---
|
||||
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.14.3
|
||||
- 更新 FastGPT 商业版镜像tag: v4.14.3
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.3.3
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
### 2. 执行升级脚本
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4143' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
会将原系统 MongoDB 的 GridFS 中的所有知识库文件迁移到 S3 中,包含文本数据集和图片数据集,但不包括文档(如 .docx)里解析出来的图片。
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 知识库文件迁移至 S3(全部使用文件的地方均已迁移)。
|
||||
2. 全局变量支持文件上传。
|
||||
3. 表单输入节点支持密码、开关、时间点、时间范围、文件上传、对话模型选择。
|
||||
4. 插件输入支持多选、时间点、时间范围、内部变量。
|
||||
5. 系统插件,插件市场中会提示是否有新版本,并提供更新按键。
|
||||
6. 工作流运行 QPM 限制。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 工作流工具,文件上传输入 UX 优化。
|
||||
2. 添加权限表校验中间件,增强权限表鲁棒性。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. 工作流调试预览窗口,重新渲染导致输入丢失。
|
||||
2. S3 服务与主服务相同 Origin 的域名会导致对 S3 的文件请求 URL 被错误替换,产生 404 报错。
|
||||
|
||||
## 插件
|
||||
|
||||
1. 工具更新逻辑,提供一个计算的 version 值来判断更新
|
||||
2. 微信公众号工具集:允许同时上传多篇文档到草稿箱
|
||||
3. 修复工具缓存没有被正确刷新
|
||||
4. 修复开发模式下刷新缓存导致静态文件重新上传
|
||||
5. 修复修复上传 pkg 后图片没有被正确上传的问题
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
---
|
||||
title: 'V4.14.4'
|
||||
description: 'FastGPT V4.14.4 更新说明'
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 FastGPT 镜像tag: v4.14.4
|
||||
- 更新 FastGPT 商业版镜像tag: v4.14.4
|
||||
- 更新 fastgpt-plugin 镜像 tag: v0.3.4
|
||||
- mcp_server 无需更新
|
||||
- Sandbox 无需更新
|
||||
- AIProxy 无需更新
|
||||
|
||||
### 2. 执行升级脚本
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4144' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
1. 将 4.14.3 中,遗留的 Dataset/local 接口上传的文件,也迁移到 S3 中。
|
||||
2. 全量计算旧的 chat 中的反馈,增加 flags 值便于筛选。该函数执行较慢,所以放到异步执行,接口不会返回结果,请关注日志中是否打印:Migration feedback completed!
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 工具调用支持配置流输出
|
||||
2. AI 积分告警通知。
|
||||
3. 对话日志支持展示 IP 地址归属地。
|
||||
4. 对话日志支持展示应用版本名(如果对话中途修改成最新版本,则会被修改成最新版本)
|
||||
5. 对话日志支持按点赞点踩过滤,并在对话详情里可以快速定位到赞/踩的记录。
|
||||
6. 通过 API 上传本地文件至知识库,保存至 S3。同时将旧版 Gridfs 代码全部移除。
|
||||
7. 新版订阅套餐逻辑。
|
||||
8. 支持配置对话文件白名单。
|
||||
9. S3 支持 pathStyle 和 region 配置。
|
||||
10. 支持通过 Sealos 来进行多租户自定义域名配置。
|
||||
11. 工作流中引用工具时,文件输入支持手动填写(原本只支持变量引用)。
|
||||
12. 支持网络代理(HTTP_PROXY,HTTPS_PROXY)
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 增加 S3 上传文件超时时长为 5 分钟。
|
||||
2. 问题优化采用 JinaAI 的边际收益公式,获取最大边际收益的检索词。
|
||||
3. 用户通知,支持中英文,以及优化模板。
|
||||
4. 删除知识库采用队列异步删除模式。
|
||||
5. LLM 请求时,图片无效报错提示。
|
||||
6. completions 接口,非 stream 模式, detail=false 时,增加返回 reason_content。
|
||||
7. 增加对于无效的 S3 key 检测。
|
||||
8. 删除应用和知识库时,强制要求输入名称校验。
|
||||
9. Mongo 慢操作日志,可以准确打印集合名和操作内容。
|
||||
10. 分享链接,自定义鉴权返回的 uid,强制要求长度小于 200(太长会影响文件上传)。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. 循环节点数组,取消过滤空内容。
|
||||
2. 工作流工具,未传递自定义 DataId,导致测试运行时,查看知识库提示无权限。
|
||||
3. 对话 Agent 工具配置中,非必填的布尔和数字类型无法直接确认。
|
||||
4. 工作台卡片在名字过长时错位。
|
||||
5. 分享链接中url query 中携带全局变量时,前端 UI 不会加载该值。
|
||||
6. window 下判断 CSV 文件异常。
|
||||
7. 模型测试时,如果模型未启动,会导致无法被测试。
|
||||
8. MCP header 中带特殊内容时,会抛错。
|
||||
9. 工作流引用其他 Agent 时,切换版本号后未及时更新 UI。
|
||||
10. http 节点使用值为空字符串的全局变量时,值会被替换为 null。
|
||||
11. 判断器节点折叠时,连线断开。
|
||||
12. 节点调试时,单选和多选类型的变量无法展示选项。
|
||||
13. 发布渠道文档链接定位错误。
|
||||
14. Checkbox 在禁用状态时,hover 样式错误。
|
||||
15. 模型头像缺失情况下,默认 huggingface.svg 图标显示错误。
|
||||
16. 日志导出时,结束时间会多出一天。
|
||||
17. 表单输入,前端默认值未传递到实体值。
|
||||
18. 工具调用时,未传递 max_tokens 参数。
|
||||
19. 工作流判断器 value 值,未结合 condition 来综合获取数据类型。
|
||||
20. 非直接分块模式的知识库数据,引用阅读器导航顺序异常。引用阅读器只会加载同一页。
|
||||
|
||||
## 插件
|
||||
|
||||
1. 新增 - GLM4.6 与 DS3.2 系列模型预设。
|
||||
2. 修复 - MinerU SaaS 插件模型版本不能选择 vlm 的问题
|
||||
3. 修复 - 微信公众号插件批量上传 markdown 参数传递问题
|
||||
4. 新增 - 获取微信公众号草稿箱列表工具
|
||||
5. 优化 - markdown 转文件支持自定义文件名
|
||||
6. 修复 - import cache 导致的插件无法被更新的问题
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: 'V4.14.5(进行中)'
|
||||
description: 'FastGPT V4.14.5 更新说明'
|
||||
---
|
||||
|
||||
|
||||
## 🚀 新增内容
|
||||
|
||||
1. 对话记录使用侧改成软删除,增加从日志管理里删除对话记录。
|
||||
2. 更新Agent/工具时,会更新其上层所有目录的更新时间,以便其会排在列表前面。
|
||||
3. 门户页支持配置单个应用运行可见度配。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
1. 优化获取 redis 所有 key 的逻辑,避免大量获取时导致阻塞。
|
||||
2. MongoDB, Redis 和 MQ 的重连逻辑优化。
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. MCP 工具创建时,使用自定义鉴权头会报错。
|
||||
2. 获取对话日志列表时,如果用户头像为空,会抛错。
|
||||
3. chatAgent 未开启问题优化时,前端 UI 显示开启。
|
||||
4. 加载默认模型时,maxTokens 字段未赋值,导致模型最大响应值配置为空。
|
||||
5. S3 文件清理队列因网络稳定问题出现阻塞,导致删除任务不再执行。
|
||||
|
||||
|
||||
## 插件
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"title": "4.14.x",
|
||||
"description": "",
|
||||
"pages": ["4145", "4144", "4143", "4142", "4141", "4140"]
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
"description": "FastGPT 版本更新介绍及升级操作",
|
||||
"pages": [
|
||||
"index",
|
||||
"---4.14.x---",
|
||||
"...4-14",
|
||||
"---4.13.x---",
|
||||
"...4-13",
|
||||
"---4.12.x---",
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import { Alert } from '@/components/docs/Alert';
|
|||
背景知识中,引导模型调用工具去执行不通的操作。
|
||||
|
||||
<Alert icon="🤗" context="success">
|
||||
**Tips:** 这里需要增加适当的上下文,方便模型结合历史纪录进行判断和决策~
|
||||
**Tips:** 这里需要增加适当的上下文,方便模型结合历史记录进行判断和决策~
|
||||
</Alert>
|
||||
|
||||
## 3. HTTP 模块
|
||||
|
|
|
|||
|
|
@ -3,119 +3,70 @@ title: 接入企微机器人教程
|
|||
description: FastGPT 接入企微机器人教程
|
||||
---
|
||||
|
||||
从 4.12.4 版本起,FastGPT 商业版支持直接接入企微机器人,无需额外的 API。
|
||||
- 从 4.12.4 版本起,FastGPT 商业版支持直接接入企微机器人,无需额外的 API。
|
||||
- 从 4.14.4 版本起,FastGPT 云服务版支持通过配置自定义域名的方式接入企微智能机器人。
|
||||
|
||||
## 1. 配置可信域名和可信IP
|
||||
## 1. (云服务版必须)配置自定义域名
|
||||
|
||||
点击企微头像,打开管理企业
|
||||
企微要求智能机器人消息推送地址必须使用企业主体域名,因此云服务版本用户必须先配置自定义域名才能使用企微机器人。
|
||||
|
||||

|
||||
- [配置自定义域名](/docs/introduction/guide/team_permissions/customDomain)
|
||||
|
||||
在应用管理中找到"自建"-"创建应用"
|
||||
若您是商业版用户,请继续使用您企业的域名。
|
||||
|
||||

|
||||
## 2. 创建智能机器人
|
||||
|
||||
创建好应用后, 下拉, 依次配置"网页授权及JS-SDK"和"企业可信IP"
|
||||
### 2.1 超级管理员登录
|
||||
|
||||

|
||||
[点击打开企业微信管理后台](https://work.weixin.qq.com/)
|
||||
|
||||
其中, 网页授权及JS-SDK要求按照企微指引,完成域名归属认证
|
||||
### 2.2 找到智能机器人入口
|
||||
|
||||

|
||||
在"安全与管理" - "管理工具"页面点击"智能机器人" ( 注意: 只有企业创建者或超级管理员才有权限看到这个入口 )
|
||||
|
||||
企业可信IP要求为企业服务器IP, 后续企微的回调URL将请求到此IP
|
||||

|
||||
|
||||

|
||||
### 2.3 选择 “API模式创建” 智能机器人
|
||||
|
||||
## 2. 创建企业自建应用
|
||||
在创建机器人页面, 下拉, 点击 "API模式创建"
|
||||
|
||||
前往 FastGPT ,选择想要接入的应用,在 发布渠道 页面,新建一个接入企微智能机器人的发布渠道,填写好基础信息。
|
||||

|
||||
|
||||

|
||||
### 2.4 获取关键密钥
|
||||
|
||||
现在回到企业微信平台,找到 Corp ID, Secret, Agent ID, Token, AES Key 信息并填写回 FastGPT 平台
|
||||
随机生成或者手动输入 Token 和 Encoding-AESKey,并且记录下来
|
||||
|
||||

|
||||

|
||||
|
||||
在"我的企业"里找到企业 ID, 填写到 FastGPT 的 Corp ID 中
|
||||
### 2.5 创建企微机器人发布渠道
|
||||
|
||||

|
||||
在 FastGPT 中,选择要使用 Agent,在发布渠道页面,选择“企业微信机器人”,点击“创建”
|
||||
|
||||
在应用中找到 Agent Id 和 Secret, 并填写回 FastGPT
|
||||

|
||||
|
||||

|
||||
### 2.6 配置发布渠道信息
|
||||
|
||||
点击"消息接收"-"设置API接收"
|
||||
配置该发布渠道的信息,需要填入 Token 和 AESKey,也就是第四步中记录下来的 Token 和 Encoding-AESKey
|
||||
|
||||

|
||||

|
||||
|
||||
随机生成或者手动输入 Token 和 Encoding-Key, 分别填写到 FastGPT 的 Token 和 AES Key 中
|
||||
### 2.7 复制回调地址
|
||||
|
||||

|
||||
点击“确认”后,选择您配置的自定义域名,复制回调地址,填回企微智能机器人配置页中。
|
||||
|
||||
填写完成后确认创建
|
||||

|
||||
|
||||
然后点击请求地址, 复制页面中的链接
|
||||
|
||||

|
||||
|
||||
回到刚才的配置详情, 将刚才复制的链接填入 URL 框中, 并点击下方的保存 ,即可完成自建应用的创建
|
||||
|
||||
注意: 若复制的链接是以 "http://localhost" 开头, 需要将本地地址改为企业主体域名
|
||||
|
||||
因为企微会给填写的 URL 发送验证密文, 若 URL 为本地地址, 则本地接收不到企微的密文
|
||||
|
||||
若 URL 不是企业主体域名, 则验证会失败
|
||||
|
||||
## 3. 创建智能机器人
|
||||
|
||||
第二步创建企业自建应用是为了验证域名和IP的合规性, 并获取 secret 参数, 下面创建智能机器人才是正式的配置流程
|
||||
|
||||
在"安全与管理" - "管理工具"页面找到"智能机器人" ( 注意: 只有企业创建者或超级管理员才有权限看到这个入口 )
|
||||
|
||||

|
||||
|
||||
创建机器人页面,下拉,找到,点击"API模式创建"
|
||||
|
||||

|
||||
|
||||
与刚才配置自建应用同理, 在 FastGPT 平台再新增一个发布渠道, 并回到企业微信配置参数
|
||||
|
||||

|
||||
|
||||
随机生成或者手动输入 Token 和 Encoding-AESKey, 分别填写到 FastGPT 的 Token 和 AES Key 中
|
||||
|
||||

|
||||
|
||||
Corp ID 和 Secret 这两个参数和刚才的自建应用保持一致
|
||||
|
||||
Agent ID 和自建应用的不同, 需要先填写一个自定义值, 后续会根据企业微信提供的数据重新更改
|
||||
|
||||
在 FastGPT 将Corp ID, Secret, Agent ID, Token, AES Key 等参数都填写完毕后, 点击确认
|
||||
|
||||
然后点击请求地址, 复制页面中的链接
|
||||
|
||||
回到企业微信, 将链接粘贴到智能机器人的 URL 配置栏, 点击创建
|
||||
|
||||
创建完成后, 找到智能机器人的配置详情
|
||||
|
||||

|
||||
|
||||
复制 Bot ID, 填写到 FastGPT 的 Agent ID 中, 即可完成智能机器人配置
|
||||
|
||||

|
||||
|
||||
## 4. 使用智能机器人
|
||||
## 3. 使用智能机器人
|
||||
|
||||
在企业微信平台的"通讯录",即可找到创建的机器人,就可以发送消息了
|
||||
|
||||

|
||||

|
||||
|
||||
## FAQ
|
||||
|
||||
### 发送了消息,没响应
|
||||
|
||||
1. 检查可信域名和可信IP是否配置正确。
|
||||
2. 检查自建应用的 Secret 参数是否与智能机器人一致。
|
||||
3. 查看 FastGPT 对话日志,是否有对应的提问记录
|
||||
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人.
|
||||
1. 检查可信域名是否配置正确。
|
||||
2. 检查 Token 和 Encoding-AESKey 是否正确。
|
||||
3. 查看 FastGPT 对话日志,是否有对应的提问记录。
|
||||
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"document/content/docs/faq/app.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/chat.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/dataset.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/error.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/error.mdx": "2025-12-10T20:07:05+08:00",
|
||||
"document/content/docs/faq/external_channel_integration.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/index.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/faq/other.mdx": "2025-08-04T22:07:52+08:00",
|
||||
|
|
@ -19,31 +19,31 @@
|
|||
"document/content/docs/introduction/development/custom-models/ollama.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/xinference.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/design/dataset.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/design/design_plugin.mdx": "2025-08-20T19:00:48+08:00",
|
||||
"document/content/docs/introduction/development/docker.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/design/design_plugin.mdx": "2025-11-06T14:47:55+08:00",
|
||||
"document/content/docs/introduction/development/docker.mdx": "2025-11-05T14:16:14+08:00",
|
||||
"document/content/docs/introduction/development/faq.mdx": "2025-08-12T22:22:18+08:00",
|
||||
"document/content/docs/introduction/development/intro.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/migration/docker_db.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/migration/docker_mongo.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/ai-proxy.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/intro.mdx": "2025-08-12T22:22:18+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/intro.mdx": "2025-12-03T08:36:19+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/one-api.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/ppio.mdx": "2025-09-29T11:52:39+08:00",
|
||||
"document/content/docs/introduction/development/modelConfig/siliconCloud.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/openapi/app.mdx": "2025-09-26T13:18:51+08:00",
|
||||
"document/content/docs/introduction/development/openapi/chat.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/openapi/chat.mdx": "2025-12-18T13:49:45+08:00",
|
||||
"document/content/docs/introduction/development/openapi/dataset.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/openapi/intro.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/openapi/share.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/openapi/share.mdx": "2025-12-09T23:33:32+08:00",
|
||||
"document/content/docs/introduction/development/proxy/cloudflare.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/proxy/http_proxy.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/proxy/nginx.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/quick-start.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/introduction/development/sealos.mdx": "2025-09-29T11:52:39+08:00",
|
||||
"document/content/docs/introduction/development/quick-start.mdx": "2025-10-21T11:58:25+08:00",
|
||||
"document/content/docs/introduction/development/sealos.mdx": "2025-11-11T14:05:02+08:00",
|
||||
"document/content/docs/introduction/development/signoz.mdx": "2025-09-17T22:29:56+08:00",
|
||||
"document/content/docs/introduction/guide/DialogBoxes/htmlRendering.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/DialogBoxes/quoteList.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/admin/sso.mdx": "2025-09-08T20:07:04+08:00",
|
||||
"document/content/docs/introduction/guide/admin/sso.mdx": "2025-11-12T10:04:39+08:00",
|
||||
"document/content/docs/introduction/guide/admin/teamMode.mdx": "2025-08-27T16:59:57+08:00",
|
||||
"document/content/docs/introduction/guide/course/ai_settings.mdx": "2025-07-24T13:00:27+08:00",
|
||||
"document/content/docs/introduction/guide/course/chat_input_guide.mdx": "2025-07-23T21:35:03+08:00",
|
||||
|
|
@ -84,11 +84,12 @@
|
|||
"document/content/docs/introduction/guide/knowledge_base/websync.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/yuque_dataset.mdx": "2025-09-17T22:29:56+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/bing_search_plugin.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/dev_system_tool.mdx": "2025-08-20T19:00:48+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/dev_system_tool.mdx": "2025-11-06T14:47:55+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/doc2x_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/google_search_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/searxng_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/upload_system_tool.mdx": "2025-09-24T22:40:31+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/upload_system_tool.mdx": "2025-11-04T16:58:12+08:00",
|
||||
"document/content/docs/introduction/guide/team_permissions/customDomain.mdx": "2025-12-10T20:07:05+08:00",
|
||||
"document/content/docs/introduction/guide/team_permissions/invitation_link.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/team_permissions/team_roles_permissions.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/index.en.mdx": "2025-07-23T21:35:03+08:00",
|
||||
|
|
@ -96,12 +97,12 @@
|
|||
"document/content/docs/protocol/index.mdx": "2025-07-30T15:38:30+08:00",
|
||||
"document/content/docs/protocol/open-source.en.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/protocol/open-source.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/protocol/privacy.en.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/protocol/privacy.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/protocol/terms.en.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/protocol/terms.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/protocol/privacy.en.mdx": "2025-12-15T23:36:54+08:00",
|
||||
"document/content/docs/protocol/privacy.mdx": "2025-12-15T23:36:54+08:00",
|
||||
"document/content/docs/protocol/terms.en.mdx": "2025-12-15T23:36:54+08:00",
|
||||
"document/content/docs/protocol/terms.mdx": "2025-12-15T23:36:54+08:00",
|
||||
"document/content/docs/toc.en.mdx": "2025-08-04T13:42:36+08:00",
|
||||
"document/content/docs/toc.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/toc.mdx": "2025-12-17T17:44:38+08:00",
|
||||
"document/content/docs/upgrading/4-10/4100.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-10/4101.mdx": "2025-09-08T20:07:20+08:00",
|
||||
"document/content/docs/upgrading/4-11/4110.mdx": "2025-08-05T23:20:39+08:00",
|
||||
|
|
@ -111,8 +112,15 @@
|
|||
"document/content/docs/upgrading/4-12/4122.mdx": "2025-09-07T14:41:48+08:00",
|
||||
"document/content/docs/upgrading/4-12/4123.mdx": "2025-09-07T20:55:14+08:00",
|
||||
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T22:29:56+08:00",
|
||||
"document/content/docs/upgrading/4-13/4130.mdx": "2025-09-26T13:32:15+08:00",
|
||||
"document/content/docs/upgrading/4-13/4131.mdx": "2025-09-30T11:21:41+08:00",
|
||||
"document/content/docs/upgrading/4-13/4130.mdx": "2025-11-04T15:06:39+08:00",
|
||||
"document/content/docs/upgrading/4-13/4131.mdx": "2025-09-30T15:47:06+08:00",
|
||||
"document/content/docs/upgrading/4-13/4132.mdx": "2025-12-15T11:50:00+08:00",
|
||||
"document/content/docs/upgrading/4-14/4140.mdx": "2025-11-06T15:43:00+08:00",
|
||||
"document/content/docs/upgrading/4-14/4141.mdx": "2025-11-19T10:15:27+08:00",
|
||||
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
|
||||
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
|
||||
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T14:56:04+08:00",
|
||||
"document/content/docs/upgrading/4-14/4145.mdx": "2025-12-21T23:28:19+08:00",
|
||||
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
|
||||
|
|
@ -184,7 +192,7 @@
|
|||
"document/content/docs/use-cases/app-cases/feishu_webhook.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/use-cases/app-cases/fixingEvidence.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/use-cases/app-cases/google_search.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/use-cases/app-cases/lab_appointment.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/use-cases/app-cases/lab_appointment.mdx": "2025-12-10T20:07:05+08:00",
|
||||
"document/content/docs/use-cases/app-cases/multi_turn_translation_bot.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/use-cases/app-cases/submit_application_template.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/use-cases/app-cases/translate-subtitle-using-gpt.mdx": "2025-07-23T21:35:03+08:00",
|
||||
|
|
@ -192,6 +200,6 @@
|
|||
"document/content/docs/use-cases/external-integration/feishu.mdx": "2025-07-24T14:23:04+08:00",
|
||||
"document/content/docs/use-cases/external-integration/official_account.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/use-cases/external-integration/openapi.mdx": "2025-09-29T11:34:11+08:00",
|
||||
"document/content/docs/use-cases/external-integration/wecom.mdx": "2025-09-16T14:22:28+08:00",
|
||||
"document/content/docs/use-cases/external-integration/wecom.mdx": "2025-12-10T20:07:05+08:00",
|
||||
"document/content/docs/use-cases/index.mdx": "2025-07-24T14:23:04+08:00"
|
||||
}
|
||||
|
|
@ -1,14 +1,6 @@
|
|||
import { createMDX } from 'fumadocs-mdx/next';
|
||||
|
||||
const withMDX = createMDX({
|
||||
mdxOptions: {
|
||||
remarkPlugins: {
|
||||
image: {
|
||||
checkImageSize: false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const withMDX = createMDX();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const config = {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"fumadocs-ui": "15.6.3",
|
||||
"gray-matter": "^4.0.3",
|
||||
"lucide-react": "^0.525.0",
|
||||
"next": "15.3.5",
|
||||
"next": "15.5.9",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-responsive": "^10.0.1",
|
||||
|
|
@ -41,212 +41,6 @@
|
|||
"zod": "^4.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-abtesting": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.34.0.tgz",
|
||||
"integrity": "sha512-d6ardhDtQsnMpyr/rPrS3YuIE9NYpY4rftkC7Ap9tyuhZ/+V3E/LH+9uEewPguKzVqduApdwJzYq2k+vAXVEbQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-analytics": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.34.0.tgz",
|
||||
"integrity": "sha512-WXIByjHNA106JO1Dj6b4viSX/yMN3oIB4qXr2MmyEmNq0MgfuPfPw8ayLRIZPa9Dp27hvM3G8MWJ4RG978HYFw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-common": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.34.0.tgz",
|
||||
"integrity": "sha512-JeN1XJLZIkkv6yK0KT93CIXXk+cDPUGNg5xeH4fN9ZykYFDWYRyqgaDo+qvg4RXC3WWkdQ+hogQuuCk4Y3Eotw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-insights": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.34.0.tgz",
|
||||
"integrity": "sha512-gdFlcQa+TWXJUsihHDlreFWniKPFIQ15i5oynCY4m9K3DCex5g5cVj9VG4Hsquxf2t6Y0yv8w6MvVTGDO8oRLw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-personalization": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.34.0.tgz",
|
||||
"integrity": "sha512-g91NHhIZDkh1IUeNtsUd8V/ZxuBc2ByOfDqhCkoQY3Z/mZszhpn3Czn6AR5pE81fx793vMaiOZvQVB5QttArkQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-query-suggestions": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.34.0.tgz",
|
||||
"integrity": "sha512-cvRApDfFrlJ3Vcn37U4Nd/7S6T8cx7FW3mVLJPqkkzixv8DQ/yV+x4VLirxOtGDdq3KohcIbIGWbg1QuyOZRvQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/client-search": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.34.0.tgz",
|
||||
"integrity": "sha512-m9tK4IqJmn+flEPRtuxuHgiHmrKV0su5fuVwVpq8/es4DMjWMgX1a7Lg1PktvO8AbKaTp9kTtBAPnwXpuCwmEg==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/ingestion": {
|
||||
"version": "1.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.34.0.tgz",
|
||||
"integrity": "sha512-2rxy4XoeRtIpzxEh5u5UgDC5HY4XbNdjzNgFx1eDrfFkSHpEVjirtLhISMy2N5uSFqYu1uUby5/NC1Soq8J7iw==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/monitoring": {
|
||||
"version": "1.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.34.0.tgz",
|
||||
"integrity": "sha512-OJiDhlJX8ZdWAndc50Z6aUEW/YmnhFK2ul3rahMw5/c9Damh7+oY9SufoK2LimJejy+65Qka06YPG29v2G/vww==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/recommend": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.34.0.tgz",
|
||||
"integrity": "sha512-fzNQZAdVxu/Gnbavy8KW5gurApwdYcPW6+pjO7Pw8V5drCR3eSqnOxSvp79rhscDX8ezwqMqqK4F3Hsq+KpRzg==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/requester-browser-xhr": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.34.0.tgz",
|
||||
"integrity": "sha512-gEI0xjzA/xvMpEdYmgQnf6AQKllhgKRtnEWmwDrnct+YPIruEHlx1dd7nRJTy/33MiYcCxkB4khXpNrHuqgp3Q==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/requester-fetch": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.34.0.tgz",
|
||||
"integrity": "sha512-5SwGOttpbACT4jXzfSJ3mnTcF46SVNSnZ1JjxC3qBa3qKi4U0CJGzuVVy3L798u8dG5H0SZ2MAB5v7180Gnqew==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@algolia/requester-node-http": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.34.0.tgz",
|
||||
"integrity": "sha512-409XlyIyEXrxyGjWxd0q5RASizHSRVUU0AXPCEdqnbcGEzbCgL1n7oYI8YxzE/RqZLha+PNwWCcTVn7EE5tyyQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-common": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
|
||||
|
|
@ -1310,15 +1104,15 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/env": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.3.5.tgz",
|
||||
"integrity": "sha512-7g06v8BUVtN2njAX/r8gheoVffhiKFVt4nx74Tt6G4Hqw9HCLYQVx/GkH2qHvPtAHZaUNZ0VXAa0pQP6v1wk7g==",
|
||||
"version": "15.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.9.tgz",
|
||||
"integrity": "sha512-4GlTZ+EJM7WaW2HEZcyU317tIQDjkQIyENDLxYJfSWlfqguN+dHkZgyQTV/7ykvobU7yEH5gKvreNrH4B6QgIg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@next/swc-darwin-arm64": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.3.5.tgz",
|
||||
"integrity": "sha512-lM/8tilIsqBq+2nq9kbTW19vfwFve0NR7MxfkuSUbRSgXlMQoJYg+31+++XwKVSXk4uT23G2eF/7BRIKdn8t8w==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.7.tgz",
|
||||
"integrity": "sha512-IZwtxCEpI91HVU/rAUOOobWSZv4P2DeTtNaCdHqLcTJU4wdNXgAySvKa/qJCgR5m6KI8UsKDXtO2B31jcaw1Yw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -1332,9 +1126,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-x64": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.3.5.tgz",
|
||||
"integrity": "sha512-WhwegPQJ5IfoUNZUVsI9TRAlKpjGVK0tpJTL6KeiC4cux9774NYE9Wu/iCfIkL/5J8rPAkqZpG7n+EfiAfidXA==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.7.tgz",
|
||||
"integrity": "sha512-UP6CaDBcqaCBuiq/gfCEJw7sPEoX1aIjZHnBWN9v9qYHQdMKvCKcAVs4OX1vIjeE+tC5EIuwDTVIoXpUes29lg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -1348,9 +1142,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-gnu": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.3.5.tgz",
|
||||
"integrity": "sha512-LVD6uMOZ7XePg3KWYdGuzuvVboxujGjbcuP2jsPAN3MnLdLoZUXKRc6ixxfs03RH7qBdEHCZjyLP/jBdCJVRJQ==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.7.tgz",
|
||||
"integrity": "sha512-NCslw3GrNIw7OgmRBxHtdWFQYhexoUCq+0oS2ccjyYLtcn1SzGzeM54jpTFonIMUjNbHmpKpziXnpxhSWLcmBA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -1364,9 +1158,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-arm64-musl": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.3.5.tgz",
|
||||
"integrity": "sha512-k8aVScYZ++BnS2P69ClK7v4nOu702jcF9AIHKu6llhHEtBSmM2zkPGl9yoqbSU/657IIIb0QHpdxEr0iW9z53A==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.7.tgz",
|
||||
"integrity": "sha512-nfymt+SE5cvtTrG9u1wdoxBr9bVB7mtKTcj0ltRn6gkP/2Nu1zM5ei8rwP9qKQP0Y//umK+TtkKgNtfboBxRrw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -1380,9 +1174,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-gnu": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.3.5.tgz",
|
||||
"integrity": "sha512-2xYU0DI9DGN/bAHzVwADid22ba5d/xrbrQlr2U+/Q5WkFUzeL0TDR963BdrtLS/4bMmKZGptLeg6282H/S2i8A==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.7.tgz",
|
||||
"integrity": "sha512-hvXcZvCaaEbCZcVzcY7E1uXN9xWZfFvkNHwbe/n4OkRhFWrs1J1QV+4U1BN06tXLdaS4DazEGXwgqnu/VMcmqw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -1396,9 +1190,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-linux-x64-musl": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.3.5.tgz",
|
||||
"integrity": "sha512-TRYIqAGf1KCbuAB0gjhdn5Ytd8fV+wJSM2Nh2is/xEqR8PZHxfQuaiNhoF50XfY90sNpaRMaGhF6E+qjV1b9Tg==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.7.tgz",
|
||||
"integrity": "sha512-4IUO539b8FmF0odY6/SqANJdgwn1xs1GkPO5doZugwZ3ETF6JUdckk7RGmsfSf7ws8Qb2YB5It33mvNL/0acqA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -1412,9 +1206,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-arm64-msvc": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.3.5.tgz",
|
||||
"integrity": "sha512-h04/7iMEUSMY6fDGCvdanKqlO1qYvzNxntZlCzfE8i5P0uqzVQWQquU1TIhlz0VqGQGXLrFDuTJVONpqGqjGKQ==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.7.tgz",
|
||||
"integrity": "sha512-CpJVTkYI3ZajQkC5vajM7/ApKJUOlm6uP4BknM3XKvJ7VXAvCqSjSLmM0LKdYzn6nBJVSjdclx8nYJSa3xlTgQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
|
|
@ -1428,9 +1222,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@next/swc-win32-x64-msvc": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.3.5.tgz",
|
||||
"integrity": "sha512-5fhH6fccXxnX2KhllnGhkYMndhOiLOLEiVGYjP2nizqeGWkN10sA9taATlXwake2E2XMvYZjjz0Uj7T0y+z1yw==",
|
||||
"version": "15.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.7.tgz",
|
||||
"integrity": "sha512-gMzgBX164I6DN+9/PGA+9dQiwmTkE4TloBNx8Kv9UiGARsr9Nba7IpcBRA1iTV9vwlYnrE3Uy6I7Aj6qLjQuqw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -2334,12 +2128,6 @@
|
|||
"integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@swc/counter": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",
|
||||
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.15",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
||||
|
|
@ -2577,6 +2365,66 @@
|
|||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
|
||||
"version": "1.4.3",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.0.2",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||
"version": "1.4.3",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.0.2",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "0.2.11",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "^1.4.3",
|
||||
"@emnapi/runtime": "^1.4.3",
|
||||
"@tybys/wasm-util": "^0.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
|
||||
"version": "0.9.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
|
||||
"version": "2.8.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||
"version": "4.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.11.tgz",
|
||||
|
|
@ -2695,6 +2543,7 @@
|
|||
"integrity": "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"csstype": "^3.0.2"
|
||||
}
|
||||
|
|
@ -2705,6 +2554,7 @@
|
|||
"integrity": "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.0.0"
|
||||
}
|
||||
|
|
@ -2726,6 +2576,7 @@
|
|||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
|
|
@ -2742,32 +2593,6 @@
|
|||
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/algoliasearch": {
|
||||
"version": "5.34.0",
|
||||
"resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.34.0.tgz",
|
||||
"integrity": "sha512-wioVnf/8uuG8Bmywhk5qKIQ3wzCCtmdvicPRb0fa3kKYGGoewfgDqLEaET1MV2NbTc3WGpPv+AgauLVBp1nB9A==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@algolia/client-abtesting": "5.34.0",
|
||||
"@algolia/client-analytics": "5.34.0",
|
||||
"@algolia/client-common": "5.34.0",
|
||||
"@algolia/client-insights": "5.34.0",
|
||||
"@algolia/client-personalization": "5.34.0",
|
||||
"@algolia/client-query-suggestions": "5.34.0",
|
||||
"@algolia/client-search": "5.34.0",
|
||||
"@algolia/ingestion": "1.34.0",
|
||||
"@algolia/monitoring": "1.34.0",
|
||||
"@algolia/recommend": "5.34.0",
|
||||
"@algolia/requester-browser-xhr": "5.34.0",
|
||||
"@algolia/requester-fetch": "5.34.0",
|
||||
"@algolia/requester-node-http": "5.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
|
|
@ -2817,17 +2642,6 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/busboy": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",
|
||||
"integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==",
|
||||
"dependencies": {
|
||||
"streamsearch": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/camelcase": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
|
||||
|
|
@ -3430,6 +3244,7 @@
|
|||
"resolved": "https://registry.npmjs.org/fumadocs-core/-/fumadocs-core-15.6.3.tgz",
|
||||
"integrity": "sha512-71IPC6Y0ZLPHlavYormnF1r2uX/lNrTFTYCEh6Akll8hWxRNbKG9Hk4xpFJDTkU83c8eLtHk2iow/ccQkcV6Hw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@formatjs/intl-localematcher": "^0.6.1",
|
||||
"@orama/orama": "^3.1.9",
|
||||
|
|
@ -3620,9 +3435,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/gray-matter/node_modules/js-yaml": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
|
||||
"integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
|
|
@ -3889,9 +3704,9 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
|
|
@ -4480,9 +4295,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/mdast-util-to-hast": {
|
||||
"version": "13.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz",
|
||||
"integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==",
|
||||
"version": "13.2.1",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",
|
||||
"integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/hast": "^3.0.0",
|
||||
|
|
@ -5358,15 +5173,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/next": {
|
||||
"version": "15.3.5",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-15.3.5.tgz",
|
||||
"integrity": "sha512-RkazLBMMDJSJ4XZQ81kolSpwiCt907l0xcgcpF4xC2Vml6QVcPNXW0NQRwQ80FFtSn7UM52XN0anaw8TEJXaiw==",
|
||||
"version": "15.5.9",
|
||||
"resolved": "https://registry.npmjs.org/next/-/next-15.5.9.tgz",
|
||||
"integrity": "sha512-agNLK89seZEtC5zUHwtut0+tNrc0Xw4FT/Dg+B/VLEo9pAcS9rtTKpek3V6kVcVwsB2YlqMaHdfZL4eLEVYuCg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@next/env": "15.3.5",
|
||||
"@swc/counter": "0.1.3",
|
||||
"@next/env": "15.5.9",
|
||||
"@swc/helpers": "0.5.15",
|
||||
"busboy": "1.6.0",
|
||||
"caniuse-lite": "^1.0.30001579",
|
||||
"postcss": "8.4.31",
|
||||
"styled-jsx": "5.1.6"
|
||||
|
|
@ -5378,19 +5192,19 @@
|
|||
"node": "^18.18.0 || ^19.8.0 || >= 20.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@next/swc-darwin-arm64": "15.3.5",
|
||||
"@next/swc-darwin-x64": "15.3.5",
|
||||
"@next/swc-linux-arm64-gnu": "15.3.5",
|
||||
"@next/swc-linux-arm64-musl": "15.3.5",
|
||||
"@next/swc-linux-x64-gnu": "15.3.5",
|
||||
"@next/swc-linux-x64-musl": "15.3.5",
|
||||
"@next/swc-win32-arm64-msvc": "15.3.5",
|
||||
"@next/swc-win32-x64-msvc": "15.3.5",
|
||||
"sharp": "^0.34.1"
|
||||
"@next/swc-darwin-arm64": "15.5.7",
|
||||
"@next/swc-darwin-x64": "15.5.7",
|
||||
"@next/swc-linux-arm64-gnu": "15.5.7",
|
||||
"@next/swc-linux-arm64-musl": "15.5.7",
|
||||
"@next/swc-linux-x64-gnu": "15.5.7",
|
||||
"@next/swc-linux-x64-musl": "15.5.7",
|
||||
"@next/swc-win32-arm64-msvc": "15.5.7",
|
||||
"@next/swc-win32-x64-msvc": "15.5.7",
|
||||
"sharp": "^0.34.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.1.0",
|
||||
"@playwright/test": "^1.41.2",
|
||||
"@playwright/test": "^1.51.1",
|
||||
"babel-plugin-react-compiler": "*",
|
||||
"react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
|
||||
"react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
|
||||
|
|
@ -5539,6 +5353,7 @@
|
|||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
|
|
@ -5654,6 +5469,7 @@
|
|||
"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz",
|
||||
"integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -5663,6 +5479,7 @@
|
|||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz",
|
||||
"integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"scheduler": "^0.26.0"
|
||||
},
|
||||
|
|
@ -6205,14 +6022,6 @@
|
|||
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/streamsearch": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
|
||||
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/stringify-entities": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz",
|
||||
|
|
@ -6292,7 +6101,8 @@
|
|||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.11.tgz",
|
||||
"integrity": "sha512-2E9TBm6MDD/xKYe+dvJZAmg3yxIEDNRc0jwlNyDg/4Fil2QcSLjFKGVff0lAf1jjeaArlG/M75Ey/EYr/OJtBA==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tapable": {
|
||||
"version": "2.2.2",
|
||||
|
|
@ -6388,6 +6198,7 @@
|
|||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
"fumadocs-ui": "15.6.3",
|
||||
"gray-matter": "^4.0.3",
|
||||
"lucide-react": "^0.525.0",
|
||||
"next": "15.3.5",
|
||||
"next": "15.5.9",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"react-responsive": "^10.0.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -47,7 +49,6 @@ services:
|
|||
# milvus
|
||||
milvus-etcd:
|
||||
container_name: milvus-etcd
|
||||
image:
|
||||
image: quay.io/coreos/etcd:v3.5.5
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
|
|
@ -64,7 +65,7 @@ services:
|
|||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
milvusStandalone:
|
||||
vectorDB:
|
||||
container_name: milvusStandalone
|
||||
image: milvusdb/milvus:v2.4.3
|
||||
command: ['milvus', 'run', 'standalone']
|
||||
|
|
@ -101,6 +102,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -147,10 +154,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -158,7 +185,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -185,9 +212,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -201,33 +225,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -236,7 +242,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -244,7 +250,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,23 +9,27 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
undefined
|
||||
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||
|
||||
|
||||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
ob:
|
||||
vectorDB:
|
||||
image: oceanbase/oceanbase-ce:4.3.5-lts
|
||||
container_name: ob
|
||||
restart: always
|
||||
|
|
@ -76,6 +79,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -122,10 +131,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -133,7 +162,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -160,9 +189,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -176,33 +202,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -211,7 +219,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -219,7 +227,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -26,7 +28,7 @@ x-vec-config: &x-vec-config
|
|||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
pg:
|
||||
vectorDB:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:0.8.0-pg15
|
||||
container_name: pg
|
||||
restart: always
|
||||
|
|
@ -58,6 +60,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -104,10 +112,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -115,7 +143,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -142,9 +170,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -158,33 +183,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -193,7 +200,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -201,7 +208,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -41,6 +43,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -87,10 +95,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.13.0 # git
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -98,7 +126,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -125,9 +153,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -141,33 +166,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.13.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -176,7 +183,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.2.0
|
||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -184,7 +191,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -47,7 +49,6 @@ services:
|
|||
# milvus
|
||||
milvus-etcd:
|
||||
container_name: milvus-etcd
|
||||
image:
|
||||
image: quay.io/coreos/etcd:v3.5.5
|
||||
environment:
|
||||
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||
|
|
@ -64,7 +65,7 @@ services:
|
|||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
milvusStandalone:
|
||||
vectorDB:
|
||||
container_name: milvusStandalone
|
||||
image: milvusdb/milvus:v2.4.3
|
||||
command: ['milvus', 'run', 'standalone']
|
||||
|
|
@ -101,6 +102,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -147,10 +154,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -158,7 +185,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -185,9 +212,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -201,33 +225,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -236,7 +242,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -244,7 +250,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,23 +9,27 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
undefined
|
||||
OCEANBASE_URL: mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||
|
||||
|
||||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
ob:
|
||||
vectorDB:
|
||||
image: oceanbase/oceanbase-ce:4.3.5-lts
|
||||
container_name: ob
|
||||
restart: always
|
||||
|
|
@ -76,6 +79,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -122,10 +131,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -133,7 +162,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -160,9 +189,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -176,33 +202,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -211,7 +219,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -219,7 +227,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -26,7 +28,7 @@ x-vec-config: &x-vec-config
|
|||
version: '3.3'
|
||||
services:
|
||||
# Vector DB
|
||||
pg:
|
||||
vectorDB:
|
||||
image: pgvector/pgvector:0.8.0-pg15
|
||||
container_name: pg
|
||||
restart: always
|
||||
|
|
@ -58,6 +60,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -104,10 +112,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -115,7 +143,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -142,9 +170,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -158,33 +183,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -193,7 +200,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -201,7 +208,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
# 用于部署的 docker-compose 文件:
|
||||
# - 向量库为 Pgvector
|
||||
# - FastGPT 端口映射为 3000:3000
|
||||
# - FastGPT-mcp-server 端口映射 3005:3000
|
||||
# - 建议修改账密后再运行
|
||||
|
|
@ -10,14 +9,17 @@ x-plugin-auth-token: &x-plugin-auth-token 'token'
|
|||
x-aiproxy-token: &x-aiproxy-token 'token'
|
||||
# 数据库连接相关配置
|
||||
x-share-db-config: &x-share-db-config
|
||||
MONGODB_URI: mongodb://username:password@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 30
|
||||
MONGODB_URI: mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||
DB_MAX_LINK: 100
|
||||
REDIS_URL: redis://default:mypassword@redis:6379
|
||||
S3_EXTERNAL_BASE_URL: https://minio.com # S3 的公网访问地址
|
||||
S3_ENDPOINT: fastgpt-minio
|
||||
S3_PORT: 9000
|
||||
S3_USE_SSL: false
|
||||
S3_ACCESS_KEY: minioadmin
|
||||
S3_SECRET_KEY: minioadmin
|
||||
S3_PUBLIC_BUCKET: fastgpt-public # 公开读私有写桶
|
||||
S3_PRIVATE_BUCKET: fastgpt-private # 私有读写桶
|
||||
|
||||
# 向量库相关配置
|
||||
x-vec-config: &x-vec-config
|
||||
|
|
@ -41,6 +43,12 @@ services:
|
|||
- MONGO_INITDB_ROOT_PASSWORD=mypassword
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongo', '-u', 'myusername', '-p', 'mypassword', '--authenticationDatabase', 'admin', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
|
|
@ -87,10 +95,30 @@ services:
|
|||
start_period: 30s
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
ports:
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
|
||||
fastgpt:
|
||||
container_name: fastgpt
|
||||
image: ghcr.io/labring/fastgpt:v4.13.0 # git
|
||||
image: ghcr.io/labring/fastgpt:v4.14.4 # git
|
||||
ports:
|
||||
- 3000:3000
|
||||
networks:
|
||||
|
|
@ -98,7 +126,7 @@ services:
|
|||
depends_on:
|
||||
- mongo
|
||||
- sandbox
|
||||
- pg
|
||||
- vectorDB
|
||||
restart: always
|
||||
environment:
|
||||
<<: [*x-share-db-config, *x-vec-config]
|
||||
|
|
@ -125,9 +153,6 @@ services:
|
|||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||
AIPROXY_API_TOKEN: *x-aiproxy-token
|
||||
|
||||
# 数据库最大连接数
|
||||
PG_URL: postgresql://username:password@pg:5432/postgres
|
||||
|
||||
# 日志等级: debug, info, warn, error
|
||||
LOG_LEVEL: info
|
||||
STORE_LOG_LEVEL: warn
|
||||
|
|
@ -141,33 +166,15 @@ services:
|
|||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
volumes:
|
||||
- ./config.json:/app/data/config.json
|
||||
|
||||
fastgpt-minio:
|
||||
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
|
||||
container_name: fastgpt-minio
|
||||
restart: always
|
||||
networks:
|
||||
- fastgpt
|
||||
environment:
|
||||
- MINIO_ROOT_USER=minioadmin
|
||||
- MINIO_ROOT_PASSWORD=minioadmin
|
||||
volumes:
|
||||
- ./fastgpt-minio:/data
|
||||
command: server /data --console-address ":9001"
|
||||
healthcheck:
|
||||
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
|
||||
interval: 30s
|
||||
timeout: 20s
|
||||
retries: 3
|
||||
sandbox:
|
||||
container_name: sandbox
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-sandbox:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
restart: always
|
||||
fastgpt-mcp-server:
|
||||
container_name: fastgpt-mcp-server
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.13.0
|
||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.14.4
|
||||
networks:
|
||||
- fastgpt
|
||||
ports:
|
||||
|
|
@ -176,7 +183,7 @@ services:
|
|||
environment:
|
||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||
fastgpt-plugin:
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.2.0
|
||||
image: ghcr.io/labring/fastgpt-plugin:v0.3.4
|
||||
container_name: fastgpt-plugin
|
||||
restart: always
|
||||
networks:
|
||||
|
|
@ -184,7 +191,10 @@ services:
|
|||
environment:
|
||||
<<: *x-share-db-config
|
||||
AUTH_TOKEN: *x-plugin-auth-token
|
||||
S3_BUCKET: fastgpt-plugins
|
||||
# 工具网络请求,最大请求和响应体
|
||||
SERVICE_REQUEST_MAX_CONTENT_LENGTH: 10
|
||||
# 最大 API 请求体大小
|
||||
MAX_API_SIZE: 10
|
||||
depends_on:
|
||||
fastgpt-minio:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 550 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 155 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 74 KiB |