Skip to content

Commit

Permalink
Doc: update doc (#1391)
Browse files Browse the repository at this point in the history
* Doc: update doc

* Doc: update video link
  • Loading branch information
zuoFeng59556 committed May 8, 2024
1 parent 917e4e9 commit 2230bc4
Show file tree
Hide file tree
Showing 39 changed files with 45 additions and 109 deletions.
Binary file modified docSite/assets/imgs/aichat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/aichat02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/aichat2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/chatinput.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/coreferenceResolution1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/cq1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/customfeedback1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/customfeedback2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/customfeedback3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/customfeedback4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/demo-appointment1.webp
Binary file not shown.
Binary file modified docSite/assets/imgs/demo-appointment2.webp
Binary file not shown.
Binary file modified docSite/assets/imgs/demo-appointment3.webp
Binary file not shown.
Binary file modified docSite/assets/imgs/demo-appointment4.webp
Binary file not shown.
Binary file modified docSite/assets/imgs/demo-appointment5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/demo-appointment6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/extract1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-dataset1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-intro1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-intro2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-intro3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-tool1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-tool3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/flow-tool4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/http1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/judgement1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/specialreply.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/string.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docSite/content/docs/course/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toc: true
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/BV1sH4y1T7s9)

## 知识库

Expand Down
67 changes: 28 additions & 39 deletions docSite/content/docs/workflow/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用

在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。

如下图,这是一个最简单的 AI 对话。它由用户输入的问题、聊天记录以及 AI 对话节点组成。
如下图,这是一个最简单的 AI 对话。它由用流程开始和 AI 对话节点组成。

![](/imgs/flow-intro2.png)

执行流程如下:

1. 用户输入问题后,会向服务器发送一个请求,并携带问题。从而得到【用户问题】节点的输出。
2. 根据设置的【最长记录数】来获取数据库中的记录数,从而得到【聊天记录】节点的输出。
经过上面两个流程,就得到了左侧两个蓝色点的结果。结果会被注入到右侧的【AI】对话节点。
3. 【AI 对话】节点根据传入的聊天记录和用户问题,调用对话接口,从而实现回答。(这里的对话结果输出隐藏了起来,默认只要触发了对话节点,就会往客户端输出内容)
1. 用户输入问题后,【流程开始】节点执行,用户问题被保存。
2. 【AI 对话】节点执行,此节点有两个必填参数“聊天记录” “用户问题”,聊天记录的值是默认输入的6条,表示此模块上下文长度。用户问题选择的是【流程开始】模块中保存的用户问题。
3. 【AI 对话】节点根据传入的聊天记录和用户问题,调用对话接口,从而实现回答。

### 节点分类

Expand All @@ -37,52 +35,46 @@ FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用

### 节点的组成

每个节点会包含 3 个核心部分:固定参数、外部输入(左边有个圆圈)和输出(右边有个圆圈)
每个节点会包含 3 个核心部分:输入、输出和触发器

![](/imgs/flow-intro3.png)

- 对话模型、温度、回复上限、系统提示词和限定词为固定参数,同时系统提示词和限定词也可以作为外部输入,意味着如果你有输入流向了系统提示词,那么原本填写的内容就会被**覆盖**
- 触发器、引用内容、聊天记录和用户问题则为外部输入,需要从其他节点的输出流入
- 回复结束则为该节点的输出
- AI模型、提示词、聊天记录、用户问题,知识库引用为输入,节点的输入可以是手动输入也可以是变量引用,变量引用的范围包括“全局变量”和之前任意一个节点的输出
- 新的上下文和AI回复内容为输出,输出可以被之后任意节点变量引用
- 节点的上下左右有四个“触发器”可以被用来连接,被连接的节点按顺序决定是否执行

## 重点 - 工作流是如何运行的

与单出入口的工作流不同,FastGPT的工作流可以指定**不同的入口**,并且没有**固定的出口**,而是以节点运行结束作为出口,如果在一个轮调用中,所有节点都不再允许,则工作流结束。

不过为了方便阅读,大部分时候,我们仍是设置一个模块作为入口,在工作流中,它被叫做`对话入口`。下面我们来看下,工作流是如何运行的,以及每个节点何时被触发执行。
FastGPT的工作流从【流程开始】节点开始执行,可以理解为从用户输入问题开始,没有**固定的出口**,是以节点运行结束作为出口,如果在一个轮调用中,所有节点都不再允许,则工作流结束。

记住3个**节点可执行**的原则:
下面我们来看下,工作流是如何运行的,以及每个节点何时被触发执行。

1. 仅关心**已连接的**外部输入,即左边的圆圈被连接了参数。
2.**已连接的**内容都被赋值的时候触发。(这个地方经常会遇到,连接了很多根输入线,但是只要有一个输入没有值,这个节点也不会执行)
3. 可以多个输出连接到一个输入,后续的值会覆盖前面的值。
![](/imgs/flow-intro1.png)

![](/imgs/workflow_process.png)
如上图所示节点会“被连接”也会“连接其他节点”,我们称“被连接”的那根线为前置线,“连接其他节点的线”为后置线。上图例子中【知识库搜索】模块左侧有一根前置线,右侧有一根后置线。而【AI对话】节点只有左侧一根前置线。

### 示例 1:
FastGPT工作流中的线有以下几种状态:
- `waiting`:被连接的节点等待执行。
- `active`:被连接的节点可以执行。
- `skip`:被连接的节点不需要执行跳过。

聊天记录节点会自动执行,因此聊天记录输入会自动赋值。当用户发送问题时,【用户问题】节点会输出值,此时【AI 对话】节点的用户问题输入也会被赋值。两个连接的输入都被赋值后,会执行 【AI 对话】节点。

![](/imgs/flow-intro1.png)
节点执行的原则:

### 例子 2:
1. 判断前置线中有没有状态为 `waiting` 的,如果有则等待。
2. 判断前置线中状态有没有状态为 `active` 如果有则执行。
3. 如果前置线中状态即没有 `waiting` 也没有 `active` 则认为此节点需要跳过。
4. 节点执行完毕后,需要根据实际情况更改后置线的状态为`active``skip`并且更改前置线状态为`waiting`等待下一轮执行。

下图是一个知识库搜索例子。

1. 历史记录会流入【AI 对话】节点。
2. 用户的问题会流入【知识库搜索】和【AI 对话】节点,由于【AI 对话】节点的触发器和引用内容还是空,此时不会执行。
3. 【知识库搜索】节点仅一个外部输入,并且被赋值,开始执行。
4. 【知识库搜索】结果为空时,“搜索结果不为空”的值为空,不会输出,因此【AI 对话】节点会因为触发器没有赋值而无法执行。而“搜索结果为空”会有输出,流向指定回复的触发器,因此【指定回复】节点进行输出。
5. 【知识库搜索】结果不为空时,“搜索结果不为空”和“引用内容”都有输出,会流向【AI 对话】,此时【AI 对话】的 4 个外部输入都被赋值,开始执行。

![](/imgs/flow-intro4.png)
让我们看一下上面例子的执行过程:
1. 【流程开始】节点执行完毕,更改后置线为`active`
2. 【知识库搜索】节点判断前置线状态为`active`开始执行,执行完毕后更改后置线状态为`active` 前置线状态为`waiting`
3. 【AI对话】节点判断前置线状态为`active`开始执行,流程执行结束。

## 如何连接节点

1. 为了方便识别不同输入输出的类型,FastGPT 给每个节点的输入输出连接点赋予不同的颜色,你可以把相同颜色的连接点连接起来。其中,灰色代表任意类型,可以随意连接。
2. 位于左侧的连接点为输入,右侧的为输出,连接只能将一个输入和输出连接起来,不能连接“输入和输入”或者“输出和输出”。
3. 可以点击连接线中间的 x 来删除连接线。
4. 可以左键点击选中连接线
1. 为了方便连接,FastGPT 每个节点的上下左右都有连接点,左和上是前置线连接点,右和下是后置线连接点。
2. 可以点击连接线中间的 x 来删除连接线。
3. 可以左键点击选中连接线

## 如何阅读?

Expand All @@ -98,7 +90,4 @@ FastGPT 从 V4 版本开始采用新的交互方式来构建 AI 应用。使用
2. 知识库搜索合并,可以合并多个知识库搜索结果
3. 其他结果,无法直接合并,可以考虑传入到`HTTP`节点中进行合并,使用`[Laf](https://laf.run/)`可以快速实现一个无服务器HTTP接口。

### 节点为什么有2个用户问题

左侧的`用户问题`是指该节点所需的输入。右侧的`用户问题`是为了方便后续的连线,输出的值和传入的用户问题一样。

2 changes: 0 additions & 2 deletions docSite/content/docs/workflow/modules/ai_chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ weight: 351
## 特点

- 可重复添加
- 有外部输入
- 有静态配置
- 触发执行
- 核心模块

Expand Down
3 changes: 0 additions & 3 deletions docSite/content/docs/workflow/modules/content_extract.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ weight: 352
## 特点

- 可重复添加
- 有外部输入
- 需要手动配置
- 触发执行
- function_call 模块
Expand Down Expand Up @@ -54,7 +53,5 @@ weight: 352

## 输出介绍

- **字段完全提取**:说明用户的问题中包含需要提取的所有内容。
- **提取字段缺失**:与 “字段完全提取” 对立,有缺失提取的字段时触发。
- **完整提取结果**: 一个 JSON 字符串,包含所有字段的提取结果。
- **目标字段提取结果**:类型均为字符串。
10 changes: 0 additions & 10 deletions docSite/content/docs/workflow/modules/dataset_search.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ weight: 357

[点击查看参数介绍](/docs/course/data_search/#搜索参数)

### 输出 - 搜索结果

输出部分给了两个 boolean 类型的搜索结果,以便根据搜索结果进行不同的处理,通常会有下方两个处理方式:

| 直接回复特定内容 | 对接普通的 gpt |
| ----------------------------- | ----------------------------- |
| ![](/imgs/flow-kbsearch2.png) | ![](/imgs/flow-kbsearch3.png) |

当然,你也可以连接到 HTTP 模块,从而实现无法从知识搜索到内容时,去进行联网搜索或者维基百科搜索。

### 输出 - 引用内容

以数组格式输出引用,长度可以为 0。意味着,即使没有搜索到内容,这个输出链路也会走通。
6 changes: 3 additions & 3 deletions docSite/content/docs/workflow/modules/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ weight: 355
## 特点

- 可重复添加
- 有外部输入
- 手动配置
- 触发执行
- 核中核模块
Expand All @@ -23,10 +22,11 @@ HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Pos

- Params 为路径请求参数,GET请求中用的居多。
- Body 为请求体,POST/PUT请求中用的居多。
- Headers 为请求头,用于传递一些特殊的信息。
- Headers 为请求头,用于传递一些特殊的信息。
- 自定义变量中可以接收前方节点的输出作为变量
- 3 种数据中均可以通过 `{{}}` 来引用变量。
- url 也可以通过 `{{}}` 来引用变量。
- 变量来自于`全局变量``系统变量``局部传入`
- 变量来自于`全局变量``系统变量``前方节点输出`

## 参数结构

Expand Down
3 changes: 1 addition & 2 deletions docSite/content/docs/workflow/modules/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ weight: 356

## 特点

- 可重复添加(防止复杂编排时线太乱,重复添加可以更美观)
- 无外部输入
- 流程入口
- 无输入
- 自动执行

![](/imgs/chatinput.png)
12 changes: 3 additions & 9 deletions docSite/content/docs/workflow/modules/reply.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ weight: 359
- 可外部输入
- 会输出结果给客户端

制定回复模块通常用户特殊状态回复,当然你也可以像图 2 一样,实现一些比较骚的操作~ 触发逻辑非常简单
指定回复模块通常用户特殊状态回复,回复内容有两种

1. 一种是写好回复内容,通过触发器触发
2. 一种是不写回复内容,直接由外部输入触发,并回复输入的内容
1. 一种是手动输入固定内容
2. 一种是通过变量引用

{{< figure
src="/imgs/specialreply.png"
alt=""
caption="图 1"
>}}

{{< figure
src="/imgs/specialreply2.png"
alt=""
caption="图 2"
>}}
2 changes: 1 addition & 1 deletion docSite/content/docs/workflow/modules/text_editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ weight: 363
## 功能
对输入文本进行固定加工处理,入参仅支持字符串和数字格式,入参以变量形式使用在文本编辑区域。

根据上方示例图的处理方式,对任何输入都会在前面拼接“我的问题是:”。
根据上方示例图的处理方式,对任何输入都会在前面拼接“用户的问题是:”。


## 作用
Expand Down
45 changes: 7 additions & 38 deletions docSite/content/docs/workflow/modules/tfswitch.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,13 @@ weight: 362

## 功能

对任意输入内容进行 True False 输出,默认情况下,当传入的内容为 false, undefined, null,0,none 时,会输出 false。

也可以增加自定义规则来补充输出 false 的内容,每行代表一个匹配规则,支持正则表达式。

**例子1**

不填写任何自定义 False 规则。

| 输入 | 输出 |
| --- | --- |
| 123 | true |
| 这是一段文本 | true |
| false | false |
| 0 | false |
| null | false |

**例子2**

自定义 False 规则:

```
123
你好
aa
/dd/
```

| 输入 | 输出 | 说明 |
| --- | --- | --- |
| 123 | false | 命中自定义 false 规则 |
| 这是一段文本 | true | 未命中 |
| false | false | 命中自定义 内置 规则 |
| 0 | false | 命中自定义 内置 规则 |
| null | false | 命中自定义 内置 规则 |
| aa | false | 命中自定义 false 规则 |
| aaa | true | 未命中 |
| bb | false | 命中自定义 false 规则 |
| bbb | false | 命中自定义 false 规则(正则匹配通过) |
对任意变量进行`IF`判断,若满足条件则执行`IF`分支,不满足条件执行`ELSE`分支。


上述例子中若「知识库引用」变量的长度等于0则执行`IF`分支,否则执行`ELSE`分支。


支持增加更多的判断条件和分支,同编程语言中的`IF`语句逻辑相同。

## 作用

Expand Down
2 changes: 1 addition & 1 deletion docSite/content/docs/workflow/modules/tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ weight: 356
| --- | --- |
| ![](/imgs/flow-tool3.png) | ![](/imgs/flow-tool4.png) |

高级编排中,一旦有了工具调用模块,可用的工具头部会出现一个菱形,可以将它与工具调用模块底部的菱形相连接。
高级编排中,托动工具调用的连接点,可用的工具头部会出现一个菱形,可以将它与工具调用模块底部的菱形相连接。

被连接的工具,会自动分离工具输入与普通的输入,并且可以编辑`介绍`,可以通过调整介绍,使得该工具调用时机更加精确。

Expand Down

0 comments on commit 2230bc4

Please sign in to comment.