diff --git a/docSite/assets/imgs/oneapi-demo1.png b/docSite/assets/imgs/oneapi-demo1.png new file mode 100644 index 000000000..5edb2c8df Binary files /dev/null and b/docSite/assets/imgs/oneapi-demo1.png differ diff --git a/docSite/content/docs/development/_index.md b/docSite/content/docs/development/_index.md new file mode 100644 index 000000000..a603a2e08 --- /dev/null +++ b/docSite/content/docs/development/_index.md @@ -0,0 +1,8 @@ +--- +weight: 200 +title: '开发指南' +description: '本地开发 FastGPT 必看' +icon: 'code_blocks' +draft: false +images: [] +--- diff --git a/docSite/content/docs/installation/reference/configuration.md b/docSite/content/docs/development/configuration.md similarity index 99% rename from docSite/content/docs/installation/reference/configuration.md rename to docSite/content/docs/development/configuration.md index 0106aae71..ed9fbdabb 100644 --- a/docSite/content/docs/installation/reference/configuration.md +++ b/docSite/content/docs/development/configuration.md @@ -4,7 +4,7 @@ description: 'FastGPT 配置参数介绍' icon: 'settings' draft: false toc: true -weight: 751 +weight: 100 --- 由于环境变量不利于配置复杂的内容,新版 FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `client/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/installation/docker/) 来挂载配置文件。 diff --git a/docSite/content/docs/development.md b/docSite/content/docs/development/development.md similarity index 97% rename from docSite/content/docs/development.md rename to docSite/content/docs/development/development.md index 7a5835698..91be12b6e 100644 --- a/docSite/content/docs/development.md +++ b/docSite/content/docs/development/development.md @@ -1,6 +1,6 @@ --- -weight: 500 -title: '开发指南' +weight: 0 +title: '快速开始' description: '对 FastGPT 进行开发调试' icon: 'developer_guide' draft: false @@ -49,7 +49,7 @@ client 目录下为 FastGPT 核心代码。NextJS 框架前后端放在一起, **2. config 配置文件** -复制 data/config.json 文件,生成一个 data/config.local.json 配置文件。具体的参数说明,可参考 [config 配置说名](/docs/installation/reference/configuration) +复制 data/config.json 文件,生成一个 data/config.local.json 配置文件。具体的参数说明,可参考 [config 配置说名](/docs/development/configuration) **注意:json 配置文件不能包含注释,介绍中为了方便看才加入的注释** diff --git a/docSite/content/docs/installation/docker.md b/docSite/content/docs/installation/docker.md index f9967e2bd..dbe980706 100644 --- a/docSite/content/docs/installation/docker.md +++ b/docSite/content/docs/installation/docker.md @@ -162,7 +162,7 @@ docker-compose up -d ### 如何自定义配置文件? -需要在 `docker-compose.yml` 同级目录创建一个 `config.json` 文件,内容参考: [配置详解](/docs/installation/reference/configuration/) +需要在 `docker-compose.yml` 同级目录创建一个 `config.json` 文件,内容参考: [配置详解](/docs/development/configuration) 然后修改 `docker-compose.yml` 中的 `fastgpt` 容器内容,增加挂载选项即可: @@ -186,4 +186,4 @@ fastgpt: - ./config.json:/app/data/config.json ``` -> 参考[配置详解](/docs/installation/reference/configuration/) +> 参考[配置详解](/docs/development/configuration) diff --git a/docSite/content/docs/installation/one-api.md b/docSite/content/docs/installation/one-api.md index b71852dfd..601331ed7 100644 --- a/docSite/content/docs/installation/one-api.md +++ b/docSite/content/docs/installation/one-api.md @@ -7,6 +7,8 @@ toc: true weight: 730 --- +默认情况下,FastGPT 只配置了 GPT 的 3 个模型,如果你需要接入其他模型,需要进行一些额外配置。 + [one-api](https://github.com/songquanpeng/one-api) 是一个 OpenAI 接口管理 & 分发系统,可以通过标准的 OpenAI API 格式访问所有的大模型,开箱即用。 FastGPT 可以通过接入 one-api 来实现对各种大模型的支持。部署方法也很简单。 @@ -45,7 +47,7 @@ SqlLite 版本不支持多实例,适合个人小流量使用,但是价格非 ## 使用步骤 -**1. 登录 one-api** +### 1. 登录 one-api 打开 【one-api 应用详情】,找到访问地址: ![step4](/imgs/oneapi-step4.png) @@ -53,7 +55,7 @@ SqlLite 版本不支持多实例,适合个人小流量使用,但是价格非 登录 one-api ![step5](/imgs/oneapi-step5.png) -**2. 创建渠道和令牌** +### 2. 创建渠道和令牌 在 one-api 中添加对应渠道,直接点击 【添加基础模型】,不要遗漏了向量模型 ![step6](/imgs/oneapi-step6.png) @@ -61,7 +63,7 @@ SqlLite 版本不支持多实例,适合个人小流量使用,但是价格非 创建一个令牌 ![step7](/imgs/oneapi-step7.png) -**3. 修改 FastGPT 的环境变量** +### 3. 修改 FastGPT 的环境变量 有了 one-api 令牌后,FastGPT 可以通过修改 baseurl 和 key 去请求到 one-api,再由 one-api 去请求不同的模型。修改下面两个环境变量: @@ -71,3 +73,34 @@ OPENAI_BASE_URL=https://xxxx.cloud.sealos.io/v1 # 下面的 key 是由 one-api 提供的令牌 CHAT_API_KEY=sk-xxxxxx ``` + +## 接入其他模型 + +**以添加文心一言为例:** + +### 1. One-API 添加对应模型渠道 + +![](/imgs/oneapi-demo1.png) + +### 2. 修改 FastGPT 配置文件 + +可以在 `/client/src/data/config.json` 里找到配置文件(本地开发需要复制成 config.local.json),配置文件中有一项是对话模型配置: + +```json +"ChatModels": [ + ... + { + "model": "ERNIE-Bot", // 这里的模型需要对应 OneAPI 的模型 + "name": "文心一言", // 对外展示的名称 + "contextMaxToken": 4000, // 最大长下文 token,无论什么模型都按 GPT35 的计算。GPT 外的模型需要自行大致计算下这个值。可以调用官方接口去比对 Token 的倍率,然后在这里粗略计算。 + // 例如:文心一言的中英文 token 基本是 1:1,而 GPT 的中文 Token 是 2:1,如果文心一言官方最大 Token 是 4000,那么这里就可以填 8000,保险点就填 7000. + "quoteMaxToken": 2000, // 引用知识库的最大 Token + "maxTemperature": 1, // 最大温度 + "price": 0, // 1个token 价格 => 1.5 / 100000 * 1000 = 0.015元/1k token + "defaultSystem": "" // 默认的系统提示词 + } + ... +], +``` + +添加完后,重启 FastGPT 即可在选择文心一言模型进行对话。 diff --git a/docSite/content/docs/installation/reference/_index.md b/docSite/content/docs/installation/reference/_index.md deleted file mode 100644 index 87a3da882..000000000 --- a/docSite/content/docs/installation/reference/_index.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -weight: 750 -title: '配置文件' -description: 'FastGPT 配置指南' -icon: quick_reference_all -draft: false -images: [] ---- diff --git a/docSite/content/docs/installation/reference/models.md b/docSite/content/docs/installation/reference/models.md deleted file mode 100644 index 59078cc08..000000000 --- a/docSite/content/docs/installation/reference/models.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: '多模型支持' -description: '快速接入除了 GPT 以外的其他大模型' -icon: 'model_training' -draft: false -toc: true -weight: 752 ---- - -默认情况下,FastGPT 只配置了 GPT 的 3 个模型,如果你需要接入其他模型,需要进行一些额外配置。 - -## 部署 one-api - -首先你需要部署一个 [one-api](/docs/installation/one-api/),并添加对应的【渠道】和【令牌】,并修改 FastGPT 环境变量,具体可参考 [快速部署 one-api](/docs/installation/one-api) - -## 添加 FastGPT 配置文件 - -可以在 `/client/src/data/config.json` 里找到配置文件(本地开发需要复制成 config.local.json),配置文件中有一项是对话模型配置: - -```json -"ChatModels": [ - { - "model": "gpt-3.5-turbo", // 这里的模型需要对应 OneAPI 的模型 - "name": "FastAI-4k", // 对外展示的名称 - "contextMaxToken": 4000, // 最大长下文 token,无论什么模型都按 GPT35 的计算。GPT 外的模型需要自行大致计算下这个值。可以调用官方接口去比对 Token 的倍率,然后在这里粗略计算。 - // 例如:文心一言的中英文 token 基本是 1:1,而 GPT 的中文 Token 是 2:1,如果文心一言官方最大 Token 是 4000,那么这里就可以填 8000,保险点就填 7000. - "quoteMaxToken": 2000, // 引用知识库的最大 Token - "maxTemperature": 1.2, // 最大温度 - "price": 1.5, // 1个token 价格 => 1.5 / 100000 * 1000 = 0.015元/1k token - "defaultSystem": "" // 默认的系统提示词 - }, - { - "model": "gpt-3.5-turbo-16k", - "name": "FastAI-16k", - "contextMaxToken": 16000, - "quoteMaxToken": 8000, - "maxTemperature": 1.2, - "price": 3, - "defaultSystem": "" - }, - { - "model": "gpt-4", - "name": "FastAI-Plus", - "contextMaxToken": 8000, - "quoteMaxToken": 4000, - "maxTemperature": 1.2, - "price": 45, - "defaultSystem": "" - } -], -``` - -### 添加新的对话模型 - -以添加文心一言为例: - -```json -"ChatModels": [ -... -{ - "model": "ERNIE-Bot", - "name": "文心一言", - "contextMaxToken": 4000, - "quoteMaxToken": 2000, - "maxTemperature": 1, - "price": 1.2 -} -... -] -``` - -添加完后,重启 FastGPT 即可在选择文心一言模型进行对话。 diff --git a/docSite/content/docs/use-cases/_index.md b/docSite/content/docs/use-cases/_index.md index 6ca3eeb12..b2093dda7 100644 --- a/docSite/content/docs/use-cases/_index.md +++ b/docSite/content/docs/use-cases/_index.md @@ -1,8 +1,8 @@ --- -weight: 600 -title: "使用案例" -description: "有关 FastGPT 其他实践案例的更多信息" -icon: "cases" +weight: 100 +title: '使用案例' +description: '有关 FastGPT 其他实践案例的更多信息' +icon: 'cases' draft: false images: [] ---- \ No newline at end of file +--- diff --git a/docSite/content/docs/workflow/_index.md b/docSite/content/docs/workflow/_index.md index 87a714ffd..50c1ef829 100644 --- a/docSite/content/docs/workflow/_index.md +++ b/docSite/content/docs/workflow/_index.md @@ -1,8 +1,8 @@ --- -weight: 400 -title: "高级编排" -description: "FastGPT 高级编排文档" -icon: "family_history" +weight: 10 +title: '高级编排' +description: 'FastGPT 高级编排文档' +icon: 'family_history' draft: false images: [] ---- \ No newline at end of file +---