Compare commits

...

20 Commits

Author SHA1 Message Date
Archer
84cf6b5658 v4.6.4 (#585)
* perf: md format

* add systemConfig schema (#2)

* fix: markdown

* fix: root

* fix: root

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2023-12-08 16:33:15 +08:00
Archer
b58249fc3a 4.6.4-alpha (#582) 2023-12-08 15:01:11 +08:00
angular-moon
54d52d8d25 fixed: Adjust the api authentication sequence to preferentially process authentication to avoid incorrect authentication caused by cookies (#572) 2023-12-07 18:19:18 +08:00
Carson Yang
f298b90b69 Docs: update theme version (#571)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
2023-12-07 18:07:57 +08:00
Archer
e01c38efe0 4.6.4-alpha (#569) 2023-12-07 13:43:08 +08:00
Archer
71afe71192 docker file and version intro (#556) 2023-12-05 10:46:27 +08:00
Archer
62e87551ac New dpcs structure and dataset i18n (#551)
* perf: check balance

* md

* lock way

* i18n

* docs

* doc

* i18n

* update doc

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync
2023-12-04 21:37:07 +08:00
Peter Dave Hello
c3ae38df8b Optimize apk install process in Dockerfile (#553) 2023-12-04 21:29:12 +08:00
Archer
9c77dfbddd fix: img compress (#546) 2023-12-03 23:56:45 +08:00
NongMO
7fc05af09e fix: custom chat title (#534)
* Fix: Update Custom Chat Title Based on chatId

* remove `new:true` option

* Update update.ts

---------

Co-authored-by: Archer <545436317@qq.com>
2023-12-03 21:19:22 +08:00
Archer
a9ae270335 4.6.3-website dataset (#532) 2023-12-03 20:45:57 +08:00
Archer
b916183848 4.6.3-alpha1 (#529) 2023-11-29 20:45:36 +08:00
Archer
007fce2deb system title (#526) 2023-11-29 10:56:53 +08:00
Archer
abc1e576b7 rerank api (#525) 2023-11-28 21:13:15 +08:00
Archer
a74e1d7166 v4.6.2 (#523) 2023-11-28 19:28:46 +08:00
Mufei
e765c3bf95 Update useSelectFile.tsx (#524)
修复知识库选择文件onChange事件遇到有http请求时无法响应的bug
2023-11-28 19:09:56 +08:00
Archer
933c3fdfd6 Add mongo index (#519) 2023-11-26 20:17:29 +08:00
Archer
f818260711 4.6.2-production (#518) 2023-11-26 16:13:45 +08:00
Archer
3acbf1ab17 4.6.2-alpha (#517) 2023-11-25 21:58:00 +08:00
Archer
9cb4280a16 v4.6.2-alpah (#511) 2023-11-24 15:29:43 +08:00
522 changed files with 14755 additions and 7420 deletions

View File

@@ -42,9 +42,7 @@ ARG name
RUN addgroup --system --gid 1001 nodejs RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs RUN adduser --system --uid 1001 nextjs
RUN sed -i 's/https/http/' /etc/apk/repositories RUN apk add --no-cache curl ca-certificates \
RUN apk add curl \
&& apk add ca-certificates \
&& update-ca-certificates && update-ca-certificates
# copy running files # copy running files

View File

@@ -100,10 +100,10 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。 由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。
* [快开始本地开发](https://doc.fastgpt.in/docs/development/intro/) * [快开始本地开发](https://doc.fastgpt.in/docs/development/intro/)
* [部署 FastGPT](https://doc.fastgpt.in/docs/installation) * [部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos)
* [系统配置文件说明](https://doc.fastgpt.in/docs/development/configuration/) * [系统配置文件说明](https://doc.fastgpt.in/docs/development/configuration/)
* [多模型配置](https://doc.fastgpt.in/docs/installation/one-api/) * [多模型配置](https://doc.fastgpt.in/docs/development/one-api/)
* [版本更新/升级介绍](https://doc.fastgpt.in/docs/installation/upgrading) * [版本更新/升级介绍](https://doc.fastgpt.in/docs/development/upgrading)
* [OpenAPI API 文档](https://doc.fastgpt.in/docs/development/openapi/) * [OpenAPI API 文档](https://doc.fastgpt.in/docs/development/openapi/)
* [知识库结构详解](https://doc.fastgpt.in/docs/use-cases/datasetengine/) * [知识库结构详解](https://doc.fastgpt.in/docs/use-cases/datasetengine/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

View File

@@ -1,5 +1,5 @@
--- ---
weight: 10 weight: 0
title: '文档' title: '文档'
description: 'FastGPT 官方文档' description: 'FastGPT 官方文档'
icon: menu_book icon: menu_book

View File

@@ -1,8 +1,8 @@
--- ---
weight: 1100 weight: 1200
title: '社区' title: '协议'
description: '社区相关内容' description: '社区相关内容'
icon: 'forum' icon: 'handshake'
draft: false draft: false
images: [] images: []
--- ---

View File

@@ -0,0 +1,38 @@
---
title: '免责声明'
description: ' FastGPT 免责声明'
icon: 'gavel'
draft: false
toc: true
weight: 1220
---
由于生成式 AI 的特性,其在不同国家的管控措施也会有所不同。请所有使用者务必遵守所在地的相关法律。
免责声明:以任何违反 FastGPT 可接受使用政策的方式使用,包括但不限于法律、法规、政府命令或法令禁止的任何用途,或任何侵犯他人权利的使用;由使用者自行承担。我们对由客户使用产生的问题概不负责。
下面是各国对生成式AI的管控条例的链接
[中国生成式人工智能服务管理办法(征求意见稿)](http://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm)
## 内容要求
我们禁止使用我们对接的模型服务生成可能对个人或社会造成伤害的内容。保障平台的安全性,是长期稳定运营的关键。如发现任何利用平台接入模型能力进行违规内容生成和使用,将立即封号,账号余额不退。
- 剥削和虐待
- 禁止描述、展示或宣扬儿童性剥削或性虐待的内容,无论法律是否禁止。这包括涉及儿童或使儿童色情的内容。
- 禁止描述或用于培养儿童的内容。修饰是成年人以剥削,特别是性剥削为目的与儿童建立关系的行为。这包括以性剥削、贩运或其他形式剥削为目的与儿童交流。
- 未经同意的私密内容
- 服务禁止描述、提供或宣传未经同意的亲密活动的内容。
- 禁止描述、提供特征或宣传或用于招揽商业性活动和性服务的内容。这包括鼓励和协调真正的性活动。
- 禁止描述或用于人口贩运目的的内容。这包括招募人员、便利交通、支付和助长对人的剥削,如强迫劳动、家庭奴役、役、强迫婚姻和强迫医疗程序。
- 自杀和自残,禁止描述、赞美、支持、促进、美化、鼓励和/或指导个人自残或自杀的内容。
- 暴力内容和行为
- 禁止描述、展示或宣扬血腥暴力或血腥的内容。
- 禁止描绘恐怖主义行为的内容;赞扬或支持恐怖组织、恐怖行为者或暴力恐怖意识形态;鼓励恐怖活动;向恐怖组织或恐怖事业提供援助;或协助恐怖组织招募成员。
- 禁止通过暴力威胁或煽动来鼓吹或宣扬对他人的暴力行为的内容。
- 仇恨言论和歧视
- 禁止基于实际或感知的种族、民族、国籍、性别、性别认同、性取向、宗教信仰、年龄、残疾状况、种姓或与系统性偏见或边缘化相关的任何其他特征等特征攻击、诋毁、恐吓、降级、针对或排斥个人或群体的内容。
- 禁止针对个人或群体进行威胁、恐吓、侮辱、贬低或贬低的语言或图像、宣扬身体伤害或其他虐待行为(如跟踪)的内容。
- 禁止故意欺骗并可能对公共利益产生不利影响的内容,包括与健康、安全、选举诚信或公民参与相关的欺骗性或不真实内容。
- 直接支持非法主动攻击或造成技术危害的恶意软件活动的内容,例如提供恶意可执行文件、组织拒绝服务攻击或管理命令和控制服务器。

View File

@@ -4,7 +4,7 @@ description: ' FastGPT 开源许可证'
icon: 'verified_user' icon: 'verified_user'
draft: false draft: false
toc: true toc: true
weight: 1120 weight: 1210
--- ---
FastGPT 项目在 Apache License 2.0 许可下开源,同时包含以下附加条件: FastGPT 项目在 Apache License 2.0 许可下开源,同时包含以下附加条件:

View File

@@ -0,0 +1,9 @@
---
weight: 1100
title: '商业版介绍'
description: 'FastGPT 商业版介绍'
icon: 'shopping_cart'
draft: false
images: []
---
<!-- 1100 ~ 1200 -->

View File

@@ -4,7 +4,7 @@ description: 'FastGPT 商业版相关说明'
icon: 'shopping_cart' icon: 'shopping_cart'
draft: false draft: false
toc: true toc: true
weight: 20 weight: 1001
--- ---
## FastGPT 线上服务 ## FastGPT 线上服务

View File

@@ -4,7 +4,7 @@ description: ' 加入 FastGPT 开发者社区和我们一起成长'
icon: 'forum' icon: 'forum'
draft: false draft: false
toc: true toc: true
weight: 1110 weight: 1300
--- ---
FastGPT 是一个由用户和贡献者参与推动的开源项目,如果您对产品使用存在疑问和建议,可尝试以下方式寻求支持。我们的团队与社区会竭尽所能为您提供帮助。 FastGPT 是一个由用户和贡献者参与推动的开源项目,如果您对产品使用存在疑问和建议,可尝试以下方式寻求支持。我们的团队与社区会竭尽所能为您提供帮助。

View File

@@ -0,0 +1,9 @@
---
weight: 100
title: '基础教程'
description: 'FastGPT 基础教程'
icon: 'import_contacts'
draft: false
images: []
---
<!-- 100 ~ 300 -->

View File

@@ -4,7 +4,7 @@ description: '快速体验 FastGPT 基础功能'
icon: 'rocket_launch' icon: 'rocket_launch'
draft: false draft: false
toc: true toc: true
weight: 30 weight: 101
--- ---
更多使用技巧,[查看视屏教程](https://www.bilibili.com/video/BV1n34y1A7Bo/?spm_id_from=333.337.search-card.all.click&vd_source=903c2b09b7412037c2eddc6a8fb9828b) 更多使用技巧,[查看视屏教程](https://www.bilibili.com/video/BV1n34y1A7Bo/?spm_id_from=333.337.search-card.all.click&vd_source=903c2b09b7412037c2eddc6a8fb9828b)

View File

@@ -1,8 +1,9 @@
--- ---
weight: 500 weight: 700
title: '开发指南' title: '开发与部署指南'
description: '本地开发 FastGPT 必看' description: '本地开发 FastGPT 必看'
icon: 'code_blocks' icon: 'code_blocks'
draft: false draft: false
images: [] images: []
--- ---
<!-- 700 ~ 1100 -->

View File

@@ -4,10 +4,10 @@ description: 'FastGPT 配置参数介绍'
icon: 'settings' icon: 'settings'
draft: false draft: false
toc: true toc: true
weight: 520 weight: 708
--- ---
由于环境变量不利于配置复杂的内容,新版 FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/installation/docker/) 来挂载配置文件。 由于环境变量不利于配置复杂的内容,新版 FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/development/docker/) 来挂载配置文件。
**开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。 **开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。
@@ -26,7 +26,7 @@ weight: 520
"qaMaxProcess": 15, // QA 生成最大进程,结合数据库性能和 key 来设置 "qaMaxProcess": 15, // QA 生成最大进程,结合数据库性能和 key 来设置
"pgHNSWEfSearch": 100 // pg vector 索引参数,越大精度高但速度慢 "pgHNSWEfSearch": 100 // pg vector 索引参数,越大精度高但速度慢
}, },
"ChatModels": [ "ChatModels": [ // 对话模型
{ {
"model": "gpt-3.5-turbo-1106", "model": "gpt-3.5-turbo-1106",
"name": "GPT35-1106", "name": "GPT35-1106",
@@ -76,7 +76,7 @@ weight: 520
"defaultSystemChatPrompt": "" "defaultSystemChatPrompt": ""
} }
], ],
"QAModels": [ "QAModels": [ // QA 生成模型
{ {
"model": "gpt-3.5-turbo-16k", "model": "gpt-3.5-turbo-16k",
"name": "GPT35-16k", "name": "GPT35-16k",
@@ -85,14 +85,14 @@ weight: 520
"price": 0 "price": 0
} }
], ],
"CQModels": [ "CQModels": [ // 问题分类模型
{ {
"model": "gpt-3.5-turbo-1106", "model": "gpt-3.5-turbo-1106",
"name": "GPT35-1106", "name": "GPT35-1106",
"maxContext": 16000, "maxContext": 16000,
"maxResponse": 4000, "maxResponse": 4000,
"price": 0, "price": 0,
"functionCall": true, "functionCall": true, // 是否支持function call 不支持的模型需要设置为 false会走提示词生成
"functionPrompt": "" "functionPrompt": ""
}, },
{ {
@@ -105,7 +105,7 @@ weight: 520
"functionPrompt": "" "functionPrompt": ""
} }
], ],
"ExtractModels": [ "ExtractModels": [ // 内容提取模型
{ {
"model": "gpt-3.5-turbo-1106", "model": "gpt-3.5-turbo-1106",
"name": "GPT35-1106", "name": "GPT35-1106",
@@ -116,7 +116,7 @@ weight: 520
"functionPrompt": "" "functionPrompt": ""
} }
], ],
"QGModels": [ "QGModels": [ // 生成下一步指引
{ {
"model": "gpt-3.5-turbo-1106", "model": "gpt-3.5-turbo-1106",
"name": "GPT35-1106", "name": "GPT35-1106",
@@ -125,7 +125,7 @@ weight: 520
"price": 0 "price": 0
} }
], ],
"VectorModels": [ "VectorModels": [ // 向量模型
{ {
"model": "text-embedding-ada-002", "model": "text-embedding-ada-002",
"name": "Embedding-2", "name": "Embedding-2",

View File

@@ -6,3 +6,4 @@ icon: 'model_training'
draft: false draft: false
images: [] images: []
--- ---
<!-- 900~950 -->

View File

@@ -23,7 +23,7 @@ FastGPT 默认使用了 OpenAI 的 LLM 模型和向量模型,如果想要私
也可以通过环境变量引入sk-key。有关docker环境变量引入的方法请自寻教程此处不再赘述。 也可以通过环境变量引入sk-key。有关docker环境变量引入的方法请自寻教程此处不再赘述。
``` ```
## 接入 [One API](/docs/installation/one-api/) ## 接入 [One API](/docs/development/one-api/)
为 chatglm2 和 m3e-large 各添加一个渠道,参数如下: 为 chatglm2 和 m3e-large 各添加一个渠道,参数如下:
@@ -59,7 +59,7 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
## 接入 FastGPT ## 接入 FastGPT
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 M3E 模型: 修改 config.json 配置文件,在 ChatModels 中加入 chatglm2, 在 VectorModels 中加入 M3E 模型:
```json ```json
"ChatModels": [ "ChatModels": [

View File

@@ -99,7 +99,7 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
## 接入 FastGPT ## 接入 FastGPT
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 模型: 修改 config.json 配置文件,在 ChatModels 中加入 chatglm2 模型:
```json ```json
"ChatModels": [ "ChatModels": [
@@ -107,10 +107,11 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
{ {
"model": "chatglm2", "model": "chatglm2",
"name": "chatglm2", "name": "chatglm2",
"maxToken": 8000, "maxContext": 4000,
"price": 0, "maxResponse": 4000,
"quoteMaxToken": 4000, "quoteMaxToken": 2000,
"maxTemperature": 1.2, "maxTemperature": 1,
"vision": false,
"defaultSystemChatPrompt": "" "defaultSystemChatPrompt": ""
} }
] ]

View File

@@ -1,8 +1,9 @@
--- ---
weight: 540 weight: 960
title: "设计方案" title: "设计方案"
description: "FastGPT 部分设计方案" description: "FastGPT 部分设计方案"
icon: public icon: public
draft: false draft: false
images: [] images: []
--- ---
<!-- 960~1050 -->

View File

@@ -1,5 +1,5 @@
--- ---
weight: 541 weight: 961
title: "数据集" title: "数据集"
description: "FastGPT 数据集中文件与数据的设计方案" description: "FastGPT 数据集中文件与数据的设计方案"
icon: dataset icon: dataset

View File

@@ -4,7 +4,7 @@ description: '使用 Docker Compose 快速部署 FastGPT'
icon: '' icon: ''
draft: false draft: false
toc: true toc: true
weight: 720 weight: 707
--- ---
## 准备条件 ## 准备条件
@@ -13,13 +13,13 @@ weight: 720
### 1. 准备好代理环境(国外服务器可忽略) ### 1. 准备好代理环境(国外服务器可忽略)
确保可以访问 OpenAI具体方案可以参考[代理方案](/docs/installation/proxy/)。或直接在 Sealos 上 [部署 OneAPI](/docs/installation/one-api),既解决代理问题也能实现多 Key 轮询、接入其他大模型。 确保可以访问 OpenAI具体方案可以参考[代理方案](/docs/development/proxy/)。或直接在 Sealos 上 [部署 OneAPI](/docs/development/one-api),既解决代理问题也能实现多 Key 轮询、接入其他大模型。
### 2. 多模型支持 ### 2. 多模型支持
FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、Azure 、国内主流模型和本地模型等。 FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、Azure 、国内主流模型和本地模型等。
可选择 [Sealos 快速部署 OneAPI](/docs/installation/one-api),更多部署方法可参考该项目的 [README](https://github.com/songquanpeng/one-api),也可以直接通过以下按钮一键部署: 可选择 [Sealos 快速部署 OneAPI](/docs/development/one-api),更多部署方法可参考该项目的 [README](https://github.com/songquanpeng/one-api),也可以直接通过以下按钮一键部署:
[![](https://fastly.jsdelivr.net/gh/labring-actions/templates@main/Deploy-on-Sealos.svg)](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Done-api) [![](https://fastly.jsdelivr.net/gh/labring-actions/templates@main/Deploy-on-Sealos.svg)](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Done-api)
@@ -86,7 +86,7 @@ curl -O https://raw.githubusercontent.com/labring/FastGPT/main/projects/app/data
## 三、启动容器 ## 三、启动容器
修改`docker-compose.yml`中的`OPENAI_BASE_URL``CHAT_API_KEY`即可,对应为 API 的地址和 key。 修改`docker-compose.yml`中的`OPENAI_BASE_URL``CHAT_API_KEY`即可,对应为 API 的地址(别忘记加/v1)和 key。
```bash ```bash
# 在 docker-compose.yml 同级目录下执行 # 在 docker-compose.yml 同级目录下执行

View File

@@ -1,10 +1,10 @@
--- ---
title: '快速开始' title: '快速开始本地开发'
description: '对 FastGPT 进行开发调试' description: '对 FastGPT 进行开发调试'
icon: 'developer_guide' icon: 'developer_guide'
draft: false draft: false
toc: true toc: true
weight: 510 weight: 705
--- ---
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://fastgpt.run)。 本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://fastgpt.run)。
@@ -46,7 +46,7 @@ git clone git@github.com:<github_username>/FastGPT.git
### 3. 安装数据库 ### 3. 安装数据库
第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践。数据库部署教程:[Docker 快速部署](/docs/installation/docker/)。部署完了,可以本地访问其数据库。 第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践。数据库部署教程:[Docker 快速部署](/docs/development/docker/)。部署完了,可以本地访问其数据库。
### 4. 初始配置 ### 4. 初始配置

View File

@@ -4,7 +4,7 @@ description: '通过接入 One API 来实现对各种大模型的支持'
icon: 'Api' icon: 'Api'
draft: false draft: false
toc: true toc: true
weight: 730 weight: 708
--- ---
* 默认情况下FastGPT 只配置了 GPT 的 3 个模型,如果你需要接入其他模型,需要进行一些额外配置。 * 默认情况下FastGPT 只配置了 GPT 的 3 个模型,如果你需要接入其他模型,需要进行一些额外配置。

View File

@@ -1,8 +1,9 @@
--- ---
weight: 560 weight: 850
title: "OpenAPI 接口文档" title: "OpenAPI 接口文档"
description: "FastGPT OpenAPI 文档" description: "FastGPT OpenAPI 文档"
icon: api icon: api
draft: false draft: false
images: [] images: []
--- ---
<!-- 850~900 -->

View File

@@ -4,7 +4,7 @@ description: 'FastGPT Api Key 使用与鉴权'
icon: 'key' icon: 'key'
draft: false draft: false
toc: true toc: true
weight: 561 weight: 851
--- ---
## 使用说明 ## 使用说明

View File

@@ -4,7 +4,7 @@ description: 'FastGPT OpenAPI 对话接口'
icon: 'chat' icon: 'chat'
draft: false draft: false
toc: true toc: true
weight: 562 weight: 852
--- ---
## 发起对话 ## 发起对话

View File

@@ -4,7 +4,7 @@ description: 'FastGPT OpenAPI 知识库接口'
icon: 'dataset' icon: 'dataset'
draft: false draft: false
toc: true toc: true
weight: 563 weight: 853
--- ---
| 如何获取知识库IDdatasetId | 如何获取文件集合IDcollection_id | | 如何获取知识库IDdatasetId | 如何获取文件集合IDcollection_id |
@@ -21,7 +21,9 @@ weight: 563
curl --location --request POST 'https://fastgpt.run/api/support/wallet/bill/createTrainingBill' \ curl --location --request POST 'https://fastgpt.run/api/support/wallet/bill/createTrainingBill' \
--header 'Authorization: Bearer {{apikey}}' \ --header 'Authorization: Bearer {{apikey}}' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '' --data-raw '{
"name": "可选,自定义订单名称,例如:文档训练-fastgpt.docx"
}'
``` ```
**响应结果** **响应结果**

View File

@@ -1,94 +1,175 @@
--- ---
title: '分享链接鉴权' title: '分享链接身份鉴权'
description: 'FastGPT 分享链接鉴权' description: 'FastGPT 分享链接身份鉴权'
icon: 'share' icon: 'share'
draft: false draft: false
toc: true toc: true
weight: 564 weight: 860
--- ---
## 介绍
在 FastGPT V4.6.4 中,我们修改了分享链接的数据读取方式,为每个用户生成一个 localId用于标识用户从云端拉取对话记录。但是这种方式仅能保障用户在同一设备同一浏览器中使用如果切换设备或者清空浏览器缓存则会丢失这些记录。这种方式存在一定的风险因此我们仅允许用户拉取近`30天``20条`记录。
分享链接身份鉴权设计的目的在于,将 FastGPT 的对话框快速、安全的接入到你现有的系统中,仅需 2 个接口即可实现。
## 使用说明 ## 使用说明
分享链接鉴权设计的目的在于,将 FastGPT 的对话框安全的接入你现有的系统中。 免登录链接配置中,你可以选择填写`身份验证`栏。这是一个`POST`请求的根地址。在填写该地址后,分享链接的初始化、开始对话以及对话结束都会向该地址的特定接口发送一条请求。下面以`host`来表示`凭身份验证根地址`。服务器接口仅需返回是否校验成功即可,不需要返回其他数据,格式如下:
免登录链接配置中,增加了`凭证校验服务器`后,使用分享链接时会向服务器发起请求,校验链接是否可用,并在每次对话结束后,向服务器发送对话结果。下面以`host`来表示`凭证校验服务器`。服务器接口仅需返回是否校验成功即可,不需要返回其他数据,格式如下: ### 接口统一响应格式
```json ```json
{ {
"success": true, "success": true,
"message": "错误提示", "message": "错误提示",
"msg": "同message, 错误提示" "msg": "同message, 错误提示",
"uid": "用户唯一凭证"
} }
``` ```
`FastGPT` 将会判断`success`是否为`true`决定是允许用户继续操作。`message``msg`是等同的,你可以选择返回其中一个,当`success`不为`true`时,将会提示这个错误。
`uid`是用户的唯一凭证,将会用于拉取对话记录以及保存对话记录。可参考下方实践案例。
### 触发流程
![](/imgs/sharelinkProcess.png) ![](/imgs/sharelinkProcess.png)
## 配置校验地址和校验token ## 配置教程
### 1. 配置身份校验地址
### 1. 配置校验地址的`BaseURL`、
![](/imgs/share-setlink.jpg) ![](/imgs/share-setlink.jpg)
配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。 配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。
{{% alert icon="🤖" %}}
这里仅需配置根地址,无需具体到完整请求路径。
{{% /alert %}}
### 2. 分享链接中增加额外 query ### 2. 分享链接中增加额外 query
在分享链接的地址中,增加一个额外的参数: authToken。例如 在分享链接的地址中,增加一个额外的参数: authToken。例如
原始的链接https://fastgpt.run/chat/share?shareId=648aaf5ae121349a16d62192 原始的链接:`https://fastgpt.run/chat/share?shareId=648aaf5ae121349a16d62192`
完整链接: https://fastgpt.run/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345
这个`token`通常是你系统生成的在发出校验请求时FastGPT 会在`body`中携带 token={{authToken}} 的参数。 完整链接: `https://fastgpt.run/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345`
## 聊天初始化校验 这个`authToken`通常是你系统生成的用户唯一凭证Token之类的。FastGPT 会在鉴权接口的`body`中携带 token={{authToken}} 的参数。
**FastGPT 发出的请求** ### 3. 编写聊天初始化校验接口
{{< tabs tabTotal="3" >}}
{{< tab tabName="请求示例" >}}
{{< markdownify >}}
```bash ```bash
curl --location --request POST '{{host}}/shareAuth/init' \ curl --location --request POST '{{host}}/shareAuth/init' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"token": "sintdolore" "token": "{{authToken}}"
}' }'
``` ```
**响应示例** {{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="鉴权成功" >}}
{{< markdownify >}}
```json
{
"success": true,
"uid": "username123",
}
```
系统会拉取该分享链接下uid 为 username123 的对话记录。
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="鉴权失败" >}}
{{< markdownify >}}
```json ```json
{ {
"success": false, "success": false,
"message": "分享链接无效", "message": "身份错误",
} }
``` ```
## 对话前校验 {{< /markdownify >}}
{{< /tab >}}
{{< /tabs >}}
**FastGPT 发出的请求**
### 4. 编写对话前校验接口
{{< tabs tabTotal="3" >}}
{{< tab tabName="请求示例" >}}
{{< markdownify >}}
```bash ```bash
curl --location --request POST '{{host}}/shareAuth/start' \ curl --location --request POST '{{host}}/shareAuth/start' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"token": "sintdolore", "token": "{{authToken}}",
"question": "用户问题", "question": "用户问题",
}' }'
``` ```
**响应示例** {{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="鉴权成功" >}}
{{< markdownify >}}
```json ```json
{ {
"success": true "success": true,
"uid": "username123",
} }
``` ```
## 对话结果上报 {{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="鉴权失败" >}}
{{< markdownify >}}
```json
{
"success": false,
"message": "身份验证失败",
}
```
```json
{
"success": false,
"message": "存在违规词",
}
```
{{< /markdownify >}}
{{< /tab >}}
{{< /tabs >}}
### 5. 编写对话结果上报接口(可选)
该接口无规定返回值。
响应值与[chat 接口格式相同](/docs/development/openapi/chat/#响应),仅多了一个`token`
可以重点关注`responseData`里的`price`值,`price`与实际价格的倍率为`100000`,即 100000=1元。
```bash ```bash
curl --location --request POST '{{host}}/shareAuth/finish' \ curl --location --request POST '{{host}}/shareAuth/finish' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data-raw '{ --data-raw '{
"token": "sint dolore", "token": "{{authToken}}",
"responseData": [ "responseData": [
{ {
"moduleName": "KB Search", "moduleName": "KB Search",
@@ -156,18 +237,18 @@ curl --location --request POST '{{host}}/shareAuth/finish' \
}' }'
``` ```
响应值与 chat 接口相同,增加了一个 token。可以重点关注`responseData`里的值price 与实际价格的倍率为`100000`
**此接口无需响应值**
## 使用示 ## 实践案
我们以[Laf作为服务器为例](https://laf.dev/),展示这 3 个接口的使用方式。 我们以[Laf作为服务器为例](https://laf.dev/)简单展示这 3 个接口的使用方式。
### 1. 创建3个Laf接口 ### 1. 创建3个Laf接口
![](/imgs/share-auth1.jpg) ![](/imgs/share-auth1.jpg)
{{< tabs tabTotal="3" >}} {{< tabs tabTotal="3" >}}
{{< tab tabName="/shareAuth/init" >}} {{< tab tabName="/shareAuth/init" >}}
{{< markdownify >}} {{< markdownify >}}
@@ -179,13 +260,15 @@ import cloud from '@lafjs/cloud'
export default async function (ctx: FunctionContext) { export default async function (ctx: FunctionContext) {
const { token } = ctx.body const { token } = ctx.body
// 此处省略 token 解码过程
if (token === 'fastgpt') { if (token === 'fastgpt') {
return { success: true } return { success: true, data: { uid: "user1" } }
} }
return { success: false,message: "身份错误" } return { success: false,message:"身份错误" }
} }
``` ```
{{< /markdownify >}} {{< /markdownify >}}
@@ -201,8 +284,8 @@ import cloud from '@lafjs/cloud'
export default async function (ctx: FunctionContext) { export default async function (ctx: FunctionContext) {
const { token, question } = ctx.body const { token, question } = ctx.body
console.log(token, question, 'start')
// 此处省略 token 解码过程
if (token !== 'fastgpt') { if (token !== 'fastgpt') {
return { success: false, message: "身份错误" } return { success: false, message: "身份错误" }
@@ -212,8 +295,9 @@ export default async function (ctx: FunctionContext) {
return { success: false, message: "内容不合规" } return { success: false, message: "内容不合规" }
} }
return { success: true } return { success: true, data: { uid: "user1" } }
} }
``` ```
{{< /markdownify >}} {{< /markdownify >}}
@@ -229,7 +313,12 @@ import cloud from '@lafjs/cloud'
export default async function (ctx: FunctionContext) { export default async function (ctx: FunctionContext) {
const { token, responseData } = ctx.body const { token, responseData } = ctx.body
console.log(token,responseData,'=====')
const total = responseData.reduce((sum,item) => sum + item.price,0)
const amount = total / 100000
// 省略数据库操作
return { } return { }
} }
``` ```
@@ -241,17 +330,24 @@ export default async function (ctx: FunctionContext) {
### 2. 配置校验地址 ### 2. 配置校验地址
我们随便复制3个地址中一个接口https://d8dns0.laf.dev/shareAuth/finish , 去除 /shareAuth/finish 后填入 FastGPT 中: https://d8dns0.laf.dev 我们随便复制3个地址中一个接口: `https://d8dns0.laf.dev/shareAuth/finish`, 去除`/shareAuth/finish`后填入`身份校验`:`https://d8dns0.laf.dev`
![](/imgs/share-auth2.jpg) ![](/imgs/share-auth2.jpg)
### 3. 修改分享链接参数 ### 3. 修改分享链接参数
源分享链接:[https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c](https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c) 源分享链接:`https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c`
修改后:[https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt](https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt) 修改后:`https://fastgpt.run/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt`
### 4. 测试效果 ### 4. 测试效果
1. 打开源链接或者`authToken`不等于 `fastgpt`的链接会提示身份错误。 1. 打开源链接或者`authToken`不等于`fastgpt`的链接会提示身份错误。
2. 发送内容中包含你字,会提示内容不合规。 2. 发送内容中包含你字,会提示内容不合规。
## 使用场景
这个鉴权方式通常是帮助你直接嵌入`分享链接`到你的应用中,在你的应用打开分享链接前,应做`authToken`的拼接后再打开。
除了对接已有系统的用户外,你还可以对接`余额`功能,通过`结果上报`接口扣除用户余额,通过`对话前校验`接口检查用户的余额。

View File

@@ -0,0 +1,9 @@
---
weight: 950
title: "代理方案"
description: "FastGPT 私有化部署代理方案"
icon: wify_proxy
draft: false
images: []
---
<!-- 950~960 -->

View File

@@ -4,7 +4,7 @@ description: "使用 Cloudflare Worker 实现中转"
icon: "foggy" icon: "foggy"
draft: false draft: false
toc: true toc: true
weight: 742 weight: 953
--- ---
[参考 "不做了睡觉" 的教程](https://gravel-twister-d32.notion.site/FastGPT-API-ba7bb261d5fd4fd9bbb2f0607dacdc9e) [参考 "不做了睡觉" 的教程](https://gravel-twister-d32.notion.site/FastGPT-API-ba7bb261d5fd4fd9bbb2f0607dacdc9e)

View File

@@ -4,7 +4,7 @@ description: "使用 HTTP 代理实现中转"
icon: "http" icon: "http"
draft: false draft: false
toc: true toc: true
weight: 743 weight: 952
--- ---
如果你有代理工具(例如 [Clash](https://github.com/Dreamacro/clash) 或者 [sing-box](https://github.com/SagerNet/sing-box)),也可以使用 HTTP 代理来访问 OpenAI。只需要添加以下两个环境变量即可 如果你有代理工具(例如 [Clash](https://github.com/Dreamacro/clash) 或者 [sing-box](https://github.com/SagerNet/sing-box)),也可以使用 HTTP 代理来访问 OpenAI。只需要添加以下两个环境变量即可

View File

@@ -4,7 +4,7 @@ description: "使用 Sealos 部署 Nginx 实现中转"
icon: "cloud_sync" icon: "cloud_sync"
draft: false draft: false
toc: true toc: true
weight: 741 weight: 951
--- ---
## 登录 Sealos ## 登录 Sealos

View File

@@ -4,7 +4,7 @@ description: "使用 Sealos 一键部署 FastGPT"
icon: "cloud" icon: "cloud"
draft: false draft: false
toc: true toc: true
weight: 710 weight: 706
--- ---
Sealos 的服务器在国外,不需要额外处理网络问题,无需服务器、无需魔法、无需域名,支持高并发 & 动态伸缩。点击以下按钮即可一键部署 👇 Sealos 的服务器在国外,不需要额外处理网络问题,无需服务器、无需魔法、无需域名,支持高并发 & 动态伸缩。点击以下按钮即可一键部署 👇

View File

@@ -0,0 +1,31 @@
---
title: 'V4.6.2(需要初始化)'
description: 'FastGPT V4.6.2'
icon: 'upgrade'
draft: false
toc: true
weight: 834
---
## 1。执行初始化 API
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成自己域名)
1. https://xxxxx/api/admin/initv462
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv462' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
初始化说明:
1. 初始化全文索引
## V4.6.2 功能介绍
1. 新增 - 全文索引(需配合 Rerank 模型,在看怎么放到开源版,模型接口比较特殊)
2. 新增 - 插件来源预计4.7/4.8版本会正式使用)
3. 优化 - PDF读取
4. 优化 - docx文件读取转成 markdown 并保留其图片内容
5. 修复和优化 TextSplitter 函数

View File

@@ -0,0 +1,33 @@
---
title: 'V4.6.3(需要初始化)'
description: 'FastGPT V4.6.3'
icon: 'upgrade'
draft: false
toc: true
weight: 833
---
## 1。执行初始化 API
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成自己域名)
1. https://xxxxx/api/admin/initv463
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv463' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
初始化说明:
1. 初始化Mongo 中 datasetcollection 和 data 的部分字段
## V4.6.3 功能介绍
1. 商业版新增 - web站点同步
2. 新增 - 集合元数据记录
3. 优化 - url 读取内容
4. 优化 - 流读取文件,防止内存溢出
5. 优化 - 4v模型自动将 url 转 base64本地也可调试
6. 优化 - 图片压缩等级
7. 修复 - 图片压缩失败报错,防止文件读取过程卡死。

View File

@@ -1,8 +1,9 @@
--- ---
weight: 760 weight: 750
title: "版本更新/升级操作" title: "版本更新/升级操作"
description: "FastGPT 版本更新介绍及升级操作" description: "FastGPT 版本更新介绍及升级操作"
icon: upgrade icon: upgrade
draft: false draft: false
images: [] images: []
--- ---
<!-- 750~850 -->

View File

@@ -0,0 +1,88 @@
---
title: '升级说明'
description: 'FastGPT 升级说明'
icon: 'upgrade'
draft: false
toc: true
weight: 751
---
FastGPT 升级包括两个步骤:
1. 镜像升级
2. 执行升级初始化脚本
## 镜像名
**git版**
- FastGPT 主镜像ghcr.io/labring/fastgpt:latest
- 商业版镜像ghcr.io/c121914yu/fastgpt-pro:latest
- Admin 镜像ghcr.io/c121914yu/fastgpt-admin:latest
**阿里云**
- FastGPT 主镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt
- 商业版镜像ghcr:registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pro
- Admin 镜像: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin
镜像由镜像名和`Tag`组成,例如: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.6.1 代表`4.6.3`版本镜像,具体可以看 docker hub, github 仓库。
## Sealos 修改镜像
1. 打开 [Sealos Cloud](https://cloud.sealos.io/) 找到桌面上的应用管理
![](/imgs/updateImageSealos1.jpg)
2. 选择对应的应用 - 点击右边三个点 - 变更
![](/imgs/updateImageSealos2.jpg)
3. 修改镜像 - 确认变更
如果要修改配置文件,可以拉到下面的`配置文件`进行修改。
![](/imgs/updateImageSealos3.jpg)
## Docker-Compose 修改镜像
直接修改`yml`文件中的`image: `即可。随后执行:
```bash
docker-compose pull
docker-compose up -d
```
## 执行升级初始化脚本
镜像更新完后,可以查看文档中的`版本介绍`,通常需要执行升级脚本的版本都会标明`需要初始化`,打开对应的文档,参考说明执行初始化脚本即可,大部分时候都是需要发送一个`POST`请求。
## QA
### {{host}} 是什么
{{}} 代表变量, {{host}}代表一个名为 host 的变量。指的是你服务器的域名或 IP。
Sealos 中,你可以在下图中找到你的域名:
![](/imgs/updateImageSealos4.jpg)
### 如何获取 rootkey
`docker-compose.yml`中的`environment`中获取,对应的是`ROOT_KEY`的值。
sealos 中可以从上图左侧的环境变量中获取。
### 如何跨版本升级!!
建议逐一版本升级防止脏数据。例如当前版本是4.4.7需要升级到4.6。
1. 修改镜像到4.5,执行初始化
2. 修改镜像到4.5.1,执行初始化
3. 修改镜像到4.5.2,执行初始化
4. 修改镜像到4.6,执行初始化
5. .....
逐一升级

View File

@@ -1,8 +0,0 @@
---
weight: 700
title: "私有化部署"
description: "FastGPT 私有化部署文档"
icon: menu_book
draft: false
images: []
---

View File

@@ -1,8 +0,0 @@
---
weight: 740
title: "代理方案"
description: "使用代理访问 OpenAI"
icon: public
draft: false
images: []
---

View File

@@ -52,9 +52,9 @@ FastGPT 对外的 API 接口对齐了 OpenAI 官方接口,可以直接接入
## FastGPT 特点 ## FastGPT 特点
1. **项目完全开源** 1. **项目开源**
FastGPT 遵循 Apache License 2.0 开源协议,你可以 [Fork](https://github.com/labring/FastGPT/fork) 之后进行二次开发和发布。FastGPT 社区版将保留核心功能,商业版仅在社区版基础上使用 API 的形式进行扩展,不影响学习使用。 FastGPT 遵循附加条件 Apache License 2.0 开源协议,你可以 [Fork](https://github.com/labring/FastGPT/fork) 之后进行二次开发和发布。FastGPT 社区版将保留核心功能,商业版仅在社区版基础上使用 API 的形式进行扩展,不影响学习使用。
2. **独特的 QA 结构** 2. **独特的 QA 结构**
@@ -80,34 +80,3 @@ FastGPT 对外的 API 接口对齐了 OpenAI 官方接口,可以直接接入
![](/imgs/functional-arch.webp) ![](/imgs/functional-arch.webp)
## 免责声明
由于生成式 AI 的特性,其在不同国家的管控措施也会有所不同。请所有使用者务必遵守所在地的相关法律。
免责声明:以任何违反 FastGPT 可接受使用政策的方式使用,包括但不限于法律、法规、政府命令或法令禁止的任何用途,或任何侵犯他人权利的使用;由使用者自行承担。我们对由客户使用产生的问题概不负责。
下面是各国对生成式AI的管控条例的链接
[中国生成式人工智能服务管理办法(征求意见稿)](http://www.cac.gov.cn/2023-04/11/c_1682854275475410.htm)
### 内容要求
我们禁止使用我们对接的模型服务生成可能对个人或社会造成伤害的内容。保障平台的安全性,是长期稳定运营的关键。如发现任何利用平台接入模型能力进行违规内容生成和使用,将立即封号,账号余额不退。
- 剥削和虐待
- 禁止描述、展示或宣扬儿童性剥削或性虐待的内容,无论法律是否禁止。这包括涉及儿童或使儿童色情的内容。
- 禁止描述或用于培养儿童的内容。修饰是成年人以剥削,特别是性剥削为目的与儿童建立关系的行为。这包括以性剥削、贩运或其他形式剥削为目的与儿童交流。
- 未经同意的私密内容
- 服务禁止描述、提供或宣传未经同意的亲密活动的内容。
- 禁止描述、提供特征或宣传或用于招揽商业性活动和性服务的内容。这包括鼓励和协调真正的性活动。
- 禁止描述或用于人口贩运目的的内容。这包括招募人员、便利交通、支付和助长对人的剥削,如强迫劳动、家庭奴役、役、强迫婚姻和强迫医疗程序。
- 自杀和自残,禁止描述、赞美、支持、促进、美化、鼓励和/或指导个人自残或自杀的内容。
- 暴力内容和行为
- 禁止描述、展示或宣扬血腥暴力或血腥的内容。
- 禁止描绘恐怖主义行为的内容;赞扬或支持恐怖组织、恐怖行为者或暴力恐怖意识形态;鼓励恐怖活动;向恐怖组织或恐怖事业提供援助;或协助恐怖组织招募成员。
- 禁止通过暴力威胁或煽动来鼓吹或宣扬对他人的暴力行为的内容。
- 仇恨言论和歧视
- 禁止基于实际或感知的种族、民族、国籍、性别、性别认同、性取向、宗教信仰、年龄、残疾状况、种姓或与系统性偏见或边缘化相关的任何其他特征等特征攻击、诋毁、恐吓、降级、针对或排斥个人或群体的内容。
- 禁止针对个人或群体进行威胁、恐吓、侮辱、贬低或贬低的语言或图像、宣扬身体伤害或其他虐待行为(如跟踪)的内容。
- 禁止故意欺骗并可能对公共利益产生不利影响的内容,包括与健康、安全、选举诚信或公民参与相关的欺骗性或不真实内容。
- 直接支持非法主动攻击或造成技术危害的恶意软件活动的内容,例如提供恶意可执行文件、组织拒绝服务攻击或管理命令和控制服务器。

View File

@@ -4,7 +4,7 @@ description: 'FastGPT 线上版定价'
icon: 'currency_yen' icon: 'currency_yen'
draft: false draft: false
toc: true toc: true
weight: 11 weight: 1200
--- ---
## Tokens 说明 ## Tokens 说明

View File

@@ -1,8 +1,9 @@
--- ---
weight: 300 weight: 500
title: '使用案例' title: '使用案例'
description: '有关 FastGPT 其他实践案例的更多信息' description: '有关 FastGPT 其他实践案例的更多信息'
icon: 'cases' icon: 'cases'
draft: false draft: false
images: [] images: []
--- ---
<!-- 500 ~ 700 -->

View File

@@ -4,7 +4,7 @@ description: "FastGPT AI 高级配置说明"
icon: "sign_language" icon: "sign_language"
draft: false draft: false
toc: true toc: true
weight: 310 weight: 501
--- ---
在 FastGPT 的 AI 对话模块中,有一个 AI 高级配置,里面包含了 AI 模型的参数配置,本文详细介绍这些配置的含义。 在 FastGPT 的 AI 对话模块中,有一个 AI 高级配置,里面包含了 AI 模型的参数配置,本文详细介绍这些配置的含义。

View File

@@ -4,7 +4,7 @@ description: "本节会详细介绍 FastGPT 知识库结构设计,理解其 QA
icon: "dataset" icon: "dataset"
draft: false draft: false
toc: true toc: true
weight: 311 weight: 502
--- ---
## 理解向量 ## 理解向量
@@ -84,7 +84,7 @@ FastGPT 采用了 `PostgresSQL` 的 `PG Vector` 插件作为向量检索器,
### 导入数据方案5 - API导入 ### 导入数据方案5 - API导入
参考[FastGPT OpenAPI使用](/docs/development/openapi/#知识库添加数据)。 参考[FastGPT OpenAPI使用](/docs/development/openapi)。
## QA的组合与引用提示词构建 ## QA的组合与引用提示词构建

View File

@@ -4,7 +4,7 @@ description: "FastGPT 接入飞书机器人 "
icon: "chat" icon: "chat"
draft: false draft: false
toc: true toc: true
weight: 322 weight: 503
--- ---
# FastGPT 一分钟接入飞书 # FastGPT 一分钟接入飞书

View File

@@ -1,10 +1,10 @@
--- ---
title: " 打造高质量 AI 知识库" title: " 打造高质量 AI 知识库(过期)"
description: " 利用 FastGPT 打造高质量 AI 知识库" description: " 利用 FastGPT 打造高质量 AI 知识库"
icon: "school" icon: "school"
draft: false draft: false
toc: true toc: true
weight: 340 weight: 699
--- ---
## 前言 ## 前言

View File

@@ -4,7 +4,7 @@ description: "FastGPT 对接 chatgpt-on-wechat"
icon: "chat" icon: "chat"
draft: false draft: false
toc: true toc: true
weight: 312 weight: 504
--- ---
# 1 分钟对接 chatgpt-on-wechat # 1 分钟对接 chatgpt-on-wechat

View File

@@ -4,7 +4,7 @@ description: "通过与 OpenAI 兼容的 API 对接第三方应用"
icon: "model_training" icon: "model_training"
draft: false draft: false
toc: true toc: true
weight: 312 weight: 505
--- ---
## 获取 API 秘钥 ## 获取 API 秘钥

View File

@@ -4,7 +4,7 @@ description: "FastGPT 接入微信和企业微信 "
icon: "chat" icon: "chat"
draft: false draft: false
toc: true toc: true
weight: 322 weight: 506
--- ---
# FastGPT 三分钟接入微信/企业微信 # FastGPT 三分钟接入微信/企业微信

View File

@@ -1,8 +1,9 @@
--- ---
weight: 100 weight: 300
title: '高级编排' title: '高级编排'
description: 'FastGPT 高级编排文档' description: 'FastGPT 高级编排文档'
icon: 'family_history' icon: 'family_history'
draft: false draft: false
images: [] images: []
--- ---
<!-- 300 ~ 500 -->

View File

@@ -1,5 +1,5 @@
--- ---
weight: 140 weight: 400
title: "编排示例" title: "编排示例"
description: "介绍 FastGPT 的高级编排实践案例" description: "介绍 FastGPT 的高级编排实践案例"
icon: "list" icon: "list"

View File

@@ -4,7 +4,7 @@ description: '利用指定回复,创建固定的开头和结尾'
icon: 'healing' icon: 'healing'
draft: false draft: false
toc: true toc: true
weight: 142 weight: 401
--- ---
![](/imgs/demo-fix-evidence1.png) ![](/imgs/demo-fix-evidence1.png)

View File

@@ -4,7 +4,7 @@ description: '将 FastGPT 外接搜索引擎'
icon: 'search' icon: 'search'
draft: false draft: false
toc: true toc: true
weight: 143 weight: 402
--- ---
![](/imgs/google_search_1.png) ![](/imgs/google_search_1.png)

View File

@@ -4,7 +4,7 @@ description: '展示高级编排操作数据库的能力'
icon: 'database' icon: 'database'
draft: false draft: false
toc: true toc: true
weight: 141 weight: 403
--- ---
![](/imgs/demo-appointment1.png) ![](/imgs/demo-appointment1.png)

View File

@@ -4,7 +4,7 @@ description: '利用 GPT 优化和完善知识库搜索词,实现上下文关
icon: 'search' icon: 'search'
draft: false draft: false
toc: true toc: true
weight: 144 weight: 404
--- ---
![](/imgs/demo_op_question1.png) ![](/imgs/demo_op_question1.png)

View File

@@ -4,7 +4,7 @@ description: '赋予联网功能,将用户问题进行分类,细分后对接
icon: 'search' icon: 'search'
draft: false draft: false
toc: true toc: true
weight: 143 weight: 406
--- ---
![](/imgs/versatile_assistant_1.png) ![](/imgs/versatile_assistant_1.png)

View File

@@ -4,7 +4,7 @@ description: "快速了解 FastGPT 高级编排"
icon: "circle" icon: "circle"
draft: false draft: false
toc: true toc: true
weight: 110 weight: 301
--- ---
FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用了 Flow 节点编排的方式来实现复杂工作流,提高可玩性和扩展性。但同时也提高了上手的门槛,有一定开发背景的用户使用起来会比较容易。 FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用了 Flow 节点编排的方式来实现复杂工作流,提高可玩性和扩展性。但同时也提高了上手的门槛,有一定开发背景的用户使用起来会比较容易。

View File

@@ -1,5 +1,5 @@
--- ---
weight: 120 weight: 350
title: "模块介绍" title: "模块介绍"
description: "介绍 FastGPT 的常用模块" description: "介绍 FastGPT 的常用模块"
icon: "apps" icon: "apps"

View File

@@ -4,7 +4,7 @@ description: "FastGPT AI 对话模块介绍"
icon: "chat" icon: "chat"
draft: false draft: false
toc: true toc: true
weight: 123 weight: 351
--- ---
## 特点 ## 特点
@@ -21,7 +21,7 @@ weight: 123
### 对话模型 ### 对话模型
可以通过 [config.json](/docs/installation/reference/models/) 配置可选的对话模型,通过 [one-api](/docs/installation/one-api/) 来实现多模型接入。 可以通过 [config.json](/docs/development/configuration/) 配置可选的对话模型,通过 [one-api](/docs/development/one-api/) 来实现多模型接入。
### 温度 & 回复上限 ### 温度 & 回复上限

View File

@@ -4,7 +4,7 @@ description: "FastGPT 内容提取模块介绍"
icon: "content_paste_go" icon: "content_paste_go"
draft: false draft: false
toc: true toc: true
weight: 125 weight: 352
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT 用户引导模块介绍"
icon: "psychology" icon: "psychology"
draft: false draft: false
toc: true toc: true
weight: 127 weight: 353
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT 历史记录模块介绍"
icon: "history" icon: "history"
draft: false draft: false
toc: true toc: true
weight: 128 weight: 354
--- ---
# 特点 # 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT HTTP 模块介绍"
icon: "http" icon: "http"
draft: false draft: false
toc: true toc: true
weight: 129 weight: 355
--- ---
## 特点 ## 特点
@@ -101,4 +101,4 @@ export default async function (ctx: FunctionContext) {
## 作用 ## 作用
基于 HTTP 模块可以无限扩展,比如操作数据库、执行联网搜索、发送邮箱等等。如果你有有趣的案例,欢迎提交 PR 到 [编排案例](/docs/category/examples) 基于 HTTP 模块可以无限扩展,比如操作数据库、执行联网搜索、发送邮箱等等。如果你有有趣的案例,欢迎提交 PR 到 [编排案例](/docs/workflow/examples)

View File

@@ -4,7 +4,7 @@ description: "FastGPT 用户问题模块介绍"
icon: "input" icon: "input"
draft: false draft: false
toc: true toc: true
weight: 131 weight: 356
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: 'FastGPT AI 知识库搜索模块介绍'
icon: 'chat' icon: 'chat'
draft: false draft: false
toc: true toc: true
weight: 124 weight: 357
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT 问题分类模块介绍"
icon: "quiz" icon: "quiz"
draft: false draft: false
toc: true toc: true
weight: 126 weight: 358
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT 指定回复模块介绍"
icon: "reply" icon: "reply"
draft: false draft: false
toc: true toc: true
weight: 130 weight: 359
--- ---
## 特点 ## 特点

View File

@@ -4,7 +4,7 @@ description: "FastGPT 触发器模块介绍"
icon: "work_history" icon: "work_history"
draft: false draft: false
toc: true toc: true
weight: 121 weight: 360
--- ---
细心的同学可以发现,在每个功能模块里都会有一个叫【触发器】的外部输入,并且是 any 类型。 细心的同学可以发现,在每个功能模块里都会有一个叫【触发器】的外部输入,并且是 any 类型。

View File

@@ -4,7 +4,7 @@ description: "FastGPT 全局变量模块介绍"
icon: "variables" icon: "variables"
draft: false draft: false
toc: true toc: true
weight: 122 weight: 361
--- ---
## 特点 ## 特点

View File

@@ -4,5 +4,5 @@ go 1.21
require ( require (
github.com/colinwilson/lotusdocs v0.1.0 // indirect github.com/colinwilson/lotusdocs v0.1.0 // indirect
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20003 // indirect github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20200 // indirect
) )

View File

@@ -10,5 +10,8 @@ github.com/colinwilson/lotusdocs v0.1.0 h1:oTC8pAYQp9XDNaUwE4SEY+id3ByNELxIIFrkt
github.com/colinwilson/lotusdocs v0.1.0/go.mod h1:9zu2REJDi+zdPRcR5/bRYSUR7gkNF4NQLvV38SEoCP8= github.com/colinwilson/lotusdocs v0.1.0/go.mod h1:9zu2REJDi+zdPRcR5/bRYSUR7gkNF4NQLvV38SEoCP8=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20003 h1:pt/JGVD5YYRsVVijOHPZI6YKTUvbR4e0hgV9B0S6rbI= github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20003 h1:pt/JGVD5YYRsVVijOHPZI6YKTUvbR4e0hgV9B0S6rbI=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20003/go.mod h1:mvM05r93HiefwoaxQTaYiJxtJAhTebwQtU1Xh/J+Okk= github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20003/go.mod h1:mvM05r93HiefwoaxQTaYiJxtJAhTebwQtU1Xh/J+Okk=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20200 h1:SmpwwN3DNzJWbV+IT8gaFu07ENUFpCvKou5BHYUKuVs=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20200/go.mod h1:kx8MBj9T7SFR8ZClWvKZPmmUxBaltkoXvnWlZZcSnYA=
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI= github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI=
github.com/twbs/bootstrap v5.3.0+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v5.3.0+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/twbs/bootstrap v5.3.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

View File

@@ -109,6 +109,11 @@ defaultContentLanguage = 'zh-cn'
listDescTrunc = 100 # Number of characters by which to truncate the list card description listDescTrunc = 100 # Number of characters by which to truncate the list card description
# Link behaviour
intLinkTooltip = true # Enable a tooltip for internal links that displays info about the destination? default false
# extLinkNewTab = false # Open external links in a new Tab? default true
# logoLinkURL = "" # Set a custom URL destination for the top header logo link.
[params.flexsearch] # Parameters for FlexSearch [params.flexsearch] # Parameters for FlexSearch
# enabled = true # enabled = true
# tokenize = "full" # tokenize = "full"

View File

@@ -11,9 +11,9 @@
{{ end -}} {{ end -}}
{{ if .Page.Store.Get "hasMermaid" }} {{ if .Page.Store.Get "hasMermaid" }}
{{ $mermaid := resources.Get (printf "%s/%s" ($.Scratch.Get "pathName") "js/mermaid.js") }} {{ $mermaid := resources.Get (printf "%s/%s" ($.Scratch.Get "pathName") "js/mermaid.min.js") }}
{{ if hugo.IsProduction }} {{ if hugo.IsProduction }}
{{ $mermaid = $mermaid | minify | fingerprint "sha384" }} {{ $mermaid = $mermaid | fingerprint "sha384" }}
{{ end }} {{ end }}
<script src="{{ $mermaid.RelPermalink }}" {{ if hugo.IsProduction }}integrity="{{ $mermaid.Data.Integrity }}"{{ end }}></script> <script src="{{ $mermaid.RelPermalink }}" {{ if hugo.IsProduction }}integrity="{{ $mermaid.Data.Integrity }}"{{ end }}></script>
<script> <script>

View File

@@ -2,7 +2,7 @@
<nav id="sidebar" class="sidebar-wrapper"> <nav id="sidebar" class="sidebar-wrapper">
<div class="sidebar-brand"> <div class="sidebar-brand">
<!-- change --> <!-- change -->
<a href='{{ relLangURL "" }}' aria-label="HomePage" alt="HomePage" style="text-transform: unset;"> <a href='{{ with .Site.Params.docs.logoLinkURL }}{{ . }}{{ else }}{{ relLangURL "" }}{{ end }}' aria-label="HomePage" alt="HomePage" style="text-transform: unset;">
{{ with resources.Get "images/logos/logo.svg" }} {{ with resources.Get "images/logos/logo.svg" }}
{{ .Content | safeHTML }} {{ .Content | safeHTML }}
&nbsp; &nbsp;

View File

@@ -2,7 +2,7 @@
<div id="top-header" class="top-header d-print-none"> <div id="top-header" class="top-header d-print-none">
<div class="header-bar d-flex justify-content-between"> <div class="header-bar d-flex justify-content-between">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<a href='{{ relLangURL "" }}' class="logo-icon me-3" aria-label="HomePage" alt="HomePage"> <a href='{{ with .Site.Params.docs.logoLinkURL }}{{ . }}{{ else }}{{ relLangURL "" }}{{ end }}' class="logo-icon me-3" aria-label="HomePage" alt="HomePage">
<div class="small"> <div class="small">
{{ with resources.Get "images/logos/mark.svg" }} {{ with resources.Get "images/logos/mark.svg" }}
{{ .Content | safeHTML }} {{ .Content | safeHTML }}

View File

@@ -1,4 +1,5 @@
# 非 host 版本, 不使用本机代理 # 非 host 版本, 不使用本机代理
# (不懂 Docker 的,只需要关心 OPENAI_BASE_URL 和 CHAT_API_KEY 即可!)
version: '3.3' version: '3.3'
services: services:
pg: pg:
@@ -47,7 +48,7 @@ services:
environment: environment:
# root 密码,用户名为: root # root 密码,用户名为: root
- DEFAULT_ROOT_PSW=1234 - DEFAULT_ROOT_PSW=1234
# 中转地址,如果是用官方号,不需要管 # 中转地址,如果是用官方号,不需要管。务必加 /v1
- OPENAI_BASE_URL=https://api.openai.com/v1 - OPENAI_BASE_URL=https://api.openai.com/v1
- CHAT_API_KEY=sk-xxxx - CHAT_API_KEY=sk-xxxx
- DB_MAX_LINK=5 # database max link - DB_MAX_LINK=5 # database max link

View File

@@ -0,0 +1,24 @@
import { ErrType } from '../errorCode';
/* dataset: 507000 */
const startCode = 507000;
export enum CommonErrEnum {
fileNotFound = 'fileNotFound'
}
const datasetErr = [
{
statusText: CommonErrEnum.fileNotFound,
message: 'error.fileNotFound'
}
];
export default datasetErr.reduce((acc, cur, index) => {
return {
...acc,
[cur.statusText]: {
code: startCode + index,
statusText: cur.statusText,
message: cur.message,
data: null
}
};
}, {} as ErrType<`${CommonErrEnum}`>);

View File

@@ -6,28 +6,34 @@ export enum DatasetErrEnum {
unCreateCollection = 'unCreateCollection', unCreateCollection = 'unCreateCollection',
unAuthDatasetCollection = 'unAuthDatasetCollection', unAuthDatasetCollection = 'unAuthDatasetCollection',
unAuthDatasetData = 'unAuthDatasetData', unAuthDatasetData = 'unAuthDatasetData',
unAuthDatasetFile = 'unAuthDatasetFile' unAuthDatasetFile = 'unAuthDatasetFile',
unLinkCollection = 'unLinkCollection'
} }
const datasetErr = [ const datasetErr = [
{ {
statusText: DatasetErrEnum.unAuthDataset, statusText: DatasetErrEnum.unAuthDataset,
message: '无权操作该知识库' message: 'core.dataset.error.unAuthDataset'
}, },
{ {
statusText: DatasetErrEnum.unAuthDatasetCollection, statusText: DatasetErrEnum.unAuthDatasetCollection,
message: '无权操作该数据集' message: 'core.dataset.error.unAuthDatasetCollection'
}, },
{ {
statusText: DatasetErrEnum.unAuthDatasetData, statusText: DatasetErrEnum.unAuthDatasetData,
message: '无权操作该数据' message: 'core.dataset.error.unAuthDatasetData'
}, },
{ {
statusText: DatasetErrEnum.unAuthDatasetFile, statusText: DatasetErrEnum.unAuthDatasetFile,
message: '无权操作该文件' message: 'core.dataset.error.unAuthDatasetFile'
}, },
{ {
statusText: DatasetErrEnum.unCreateCollection, statusText: DatasetErrEnum.unCreateCollection,
message: '无权创建数据集' message: 'core.dataset.error.unCreateCollection'
},
{
statusText: DatasetErrEnum.unLinkCollection,
message: 'core.dataset.error.unLinkCollection'
} }
]; ];
export default datasetErr.reduce((acc, cur, index) => { export default datasetErr.reduce((acc, cur, index) => {

View File

@@ -4,7 +4,9 @@ import { ErrType } from '../errorCode';
export enum OutLinkErrEnum { export enum OutLinkErrEnum {
unExist = 'unExist', unExist = 'unExist',
unAuthLink = 'unAuthLink', unAuthLink = 'unAuthLink',
linkUnInvalid = 'linkUnInvalid' linkUnInvalid = 'linkUnInvalid',
unAuthUser = 'unAuthUser'
} }
const errList = [ const errList = [
{ {
@@ -19,6 +21,10 @@ const errList = [
code: 501, code: 501,
statusText: OutLinkErrEnum.linkUnInvalid, statusText: OutLinkErrEnum.linkUnInvalid,
message: '分享链接无效' message: '分享链接无效'
},
{
statusText: OutLinkErrEnum.unAuthUser,
message: '身份校验失败'
} }
]; ];
export default errList.reduce((acc, cur, index) => { export default errList.reduce((acc, cur, index) => {

View File

@@ -6,6 +6,7 @@ import pluginErr from './code/plugin';
import outLinkErr from './code/outLink'; import outLinkErr from './code/outLink';
import teamErr from './code/team'; import teamErr from './code/team';
import userErr from './code/user'; import userErr from './code/user';
import commonErr from './code/common';
export const ERROR_CODE: { [key: number]: string } = { export const ERROR_CODE: { [key: number]: string } = {
400: '请求失败', 400: '请求失败',
@@ -96,5 +97,6 @@ export const ERROR_RESPONSE: Record<
...outLinkErr, ...outLinkErr,
...teamErr, ...teamErr,
...userErr, ...userErr,
...pluginErr ...pluginErr,
...commonErr
}; };

15
packages/global/common/file/api.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
export type UploadImgProps = {
base64Img: string;
expiredTime?: Date;
metadata?: Record<string, any>;
shareId?: string;
};
export type UrlFetchParams = {
urlList: string[];
selector?: string;
};
export type UrlFetchResponse = {
url: string;
content: string;
}[];

Some files were not shown because too many files have changed in this diff Show More