mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 12:20:34 +00:00
modules
This commit is contained in:
@@ -44,12 +44,16 @@ const Account = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
id: TabEnum.bill,
|
||||
Component: <BillTable />
|
||||
},
|
||||
{
|
||||
icon: 'payRecordLight',
|
||||
label: 'user.Recharge Record',
|
||||
id: TabEnum.pay,
|
||||
Component: <PayRecordTable />
|
||||
},
|
||||
...(feConfigs?.show_userDetail
|
||||
? [
|
||||
{
|
||||
icon: 'payRecordLight',
|
||||
label: 'user.Recharge Record',
|
||||
id: TabEnum.pay,
|
||||
Component: <PayRecordTable />
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: 'informLight',
|
||||
label: 'user.Notice',
|
||||
|
@@ -58,7 +58,7 @@ const NodeExtract = ({
|
||||
<Tr>
|
||||
<Th>字段 key</Th>
|
||||
<Th>字段描述</Th>
|
||||
<Th>必填</Th>
|
||||
<Th>必须</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
|
@@ -1 +1,50 @@
|
||||
# 内容提取
|
||||
# Content Extraction
|
||||
|
||||
- Repeatable addition
|
||||
- External input
|
||||
- Manual configuration
|
||||
- Trigger execution
|
||||
- function_call module
|
||||
- Core module
|
||||
|
||||

|
||||
|
||||
## Functionality
|
||||
|
||||
Extract structured data from text, usually in conjunction with the HTTP module for extension. It can also perform direct extraction operations, such as translation.
|
||||
|
||||
## Parameter Description
|
||||
|
||||
### Extraction Requirement Description
|
||||
|
||||
As the name suggests, give the model a target and specify which content needs to be extracted.
|
||||
|
||||
**Example 1**
|
||||
|
||||
> You are a lab reservation assistant, extract the name, appointment time, and lab number from the conversation. Current time is {{cTime}}.
|
||||
|
||||
**Example 2**
|
||||
|
||||
> You are a Google search assistant, extract the search keywords from the conversation.
|
||||
|
||||
**Example 3**
|
||||
|
||||
> Translate my question directly into English, do not answer the question.
|
||||
|
||||
### History Records
|
||||
|
||||
Usually, some history records are needed to extract user questions more completely. For example, in the figure above, the name, time, and lab name need to be provided in advance. The user may only provide the time and lab name at the beginning, without giving their own name. After a round of missing prompts, the user enters their name. At this time, it is necessary to combine the previous record to extract all 3 contents completely.
|
||||
|
||||
### Target Fields
|
||||
|
||||
The target fields correspond to the extracted results. From the figure above, it can be seen that for each additional field, there will be a corresponding output.
|
||||
key: The unique identifier of the field, cannot be repeated!
|
||||
Field Description: Describes what the field is about, such as name, time, search term, etc.
|
||||
Required: Whether to force the model to extract the field, it may be extracted as an empty string.
|
||||
|
||||
## Output Introduction
|
||||
|
||||
- Field fully extracted: Indicates that the user's question contains all the content that needs to be extracted.
|
||||
- Missing extracted fields: The opposite of "Field fully extracted", triggered when there are missing extracted fields.
|
||||
- Complete extraction result: A JSON string containing the extraction results of all fields.
|
||||
- Extraction results of target fields: All types are strings.
|
||||
|
69
docSite/docs/flow-modules/modules/cq.md
Normal file
69
docSite/docs/flow-modules/modules/cq.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Problem Classification
|
||||
|
||||
- Can be added repeatedly
|
||||
- Has external input
|
||||
- Manual configuration
|
||||
- Trigger execution
|
||||
- function_call module
|
||||
|
||||

|
||||
|
||||
## Functionality
|
||||
|
||||
It can classify user questions and perform different operations based on the classification. In some ambiguous scenarios, the classification effect may not be very obvious.
|
||||
|
||||
## Parameter Description
|
||||
|
||||
### System Prompt Words
|
||||
|
||||
Placed at the beginning of the conversation, it can be used to supplement the definition of the classification content. For example, questions will be classified into:
|
||||
|
||||
1. Greetings
|
||||
2. Common questions about laf
|
||||
3. Other questions
|
||||
|
||||
Because laf is not a clear concept and needs to be defined, the prompt words can be filled with the definition of laf:
|
||||
|
||||
```
|
||||
laf is a cloud development platform that allows for rapid application development.
|
||||
laf is an open-source BaaS (Backend as a Service) development platform.
|
||||
laf is a ready-to-use serverless development platform.
|
||||
laf is an all-in-one development platform that combines "function computing," "database," "object storage," and more.
|
||||
laf can be an open-source version of Tencent Cloud Development, Google Firebase, or UniCloud.
|
||||
```
|
||||
|
||||
### Chat Records
|
||||
|
||||
Adding some chat records can help with context-based classification.
|
||||
|
||||
### User Question
|
||||
|
||||
The input content from the user.
|
||||
|
||||
### Classification Content
|
||||
|
||||
Using the example of these 3 classifications, you can see the final function composition. The return value is randomly generated by the system and does not need to be concerned about.
|
||||
|
||||
1. Greetings
|
||||
2. Common questions about laf
|
||||
3. Other questions
|
||||
|
||||
```js
|
||||
const agentFunction = {
|
||||
name: agentFunName,
|
||||
description: 'Determines the type of user question and returns the corresponding enumeration field',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
description: `Greetings, return: abc; Common questions about laf, return: vvv; Other questions, return: aaa`
|
||||
enum: ["abc","vvv","aaa"]
|
||||
}
|
||||
},
|
||||
required: ['type']
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
The above function will definitely return one of the values: abc, vvv, or aaa, thereby achieving classification determination.
|
@@ -1 +1,88 @@
|
||||
# HTTP 模块
|
||||
# HTTP Module
|
||||
|
||||
- Can be added repeatedly
|
||||
- Has external input
|
||||
- Manual configuration
|
||||
- Trigger execution
|
||||
- Core module
|
||||
|
||||

|
||||
|
||||
## Introduction
|
||||
|
||||
The HTTP module sends a POST request to the corresponding address, with json parameters in the body. The specific parameters can be customized. It also receives a json response value, with customizable fields. In the above figure, we define an input parameter: extracted field (key is appointment, type is string), and an output parameter: extraction result (key is response, type is string).
|
||||
|
||||
So, the curl command for this request is:
|
||||
|
||||
```curl
|
||||
curl --location --request POST 'https://xxxx.laf.dev/appointment-lab' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"appointment":"{\"name\":\"小明\",\"time\":\"2023/08/16 15:00\",\"labname\":\"子良A323\"}"
|
||||
}'
|
||||
```
|
||||
|
||||
The response is:
|
||||
|
||||
```json
|
||||
{
|
||||
"response": "您已经有一个预约记录了,每人仅能同时预约一个实验室:\n 姓名:小明\n 时间: 2023/08/15 15:00\n 实验室: 子良A323\n "
|
||||
}
|
||||
```
|
||||
|
||||
**If you don't want to deploy additional services, you can use laf to quickly build interfaces, write and send them without deployment**
|
||||
|
||||
[laf online address](https://laf.dev/)
|
||||
|
||||
Here is a request example:
|
||||
|
||||
```ts
|
||||
import cloud from '@lafjs/cloud';
|
||||
const db = cloud.database();
|
||||
export default async function (ctx: FunctionContext) {
|
||||
const { appointment } = ctx.body;
|
||||
const { name, time, labname } = JSON.parse(appointment);
|
||||
const missData = [];
|
||||
if (!name) missData.push('你的姓名');
|
||||
if (!time) missData.push('需要预约的时间');
|
||||
if (!labname) missData.push('实验室名称');
|
||||
if (missData.length > 0) {
|
||||
return {
|
||||
response: `请提供: ${missData.join('、')}`
|
||||
};
|
||||
}
|
||||
const { data: record } = await db
|
||||
.collection('LabAppointment')
|
||||
.where({
|
||||
name,
|
||||
status: 'unStart'
|
||||
})
|
||||
.getOne();
|
||||
if (record) {
|
||||
return {
|
||||
response: `您已经有一个预约记录了,每人仅能同时预约一个实验室:
|
||||
姓名:${record.name}
|
||||
时间: ${record.time}
|
||||
实验室: ${record.labname}
|
||||
`
|
||||
};
|
||||
}
|
||||
await db.collection('LabAppointment').add({
|
||||
name,
|
||||
time,
|
||||
labname,
|
||||
status: 'unStart'
|
||||
});
|
||||
return {
|
||||
response: `预约成功。
|
||||
姓名:${name}
|
||||
时间: ${time}
|
||||
实验室: ${labname}
|
||||
`
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
With the HTTP module, you can do unlimited extensions, such as manipulating databases, performing internet searches, sending emails, and so on. If you have interesting use cases, feel free to submit a PR to [Examples](/docs/category/examples)
|
||||
|
BIN
docSite/docs/flow-modules/modules/imgs/cq1.png
Normal file
BIN
docSite/docs/flow-modules/modules/imgs/cq1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
BIN
docSite/docs/flow-modules/modules/imgs/extract1.png
Normal file
BIN
docSite/docs/flow-modules/modules/imgs/extract1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
docSite/docs/flow-modules/modules/imgs/http1.png
Normal file
BIN
docSite/docs/flow-modules/modules/imgs/http1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
@@ -1,4 +1,4 @@
|
||||
# Sealos 快速部署 OneAPI
|
||||
# 部署 OneAPI,实现多模型
|
||||
|
||||
无需魔法,部署即可使用
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
### 系统提示词(可被外部输入覆盖)
|
||||
|
||||
被防止在上下文数组的最前面,role 为 system,用于引导模型。具体用法参考各搜索引擎的教程~
|
||||
被放置在上下文数组的最前面,role 为 system,用于引导模型。具体用法参考各搜索引擎的教程~
|
||||
|
||||
### 限定词(可被外部输入覆盖)
|
||||
|
||||
|
@@ -1 +1,51 @@
|
||||
# 内容提取
|
||||
|
||||
- 可重复添加
|
||||
- 有外部输入
|
||||
- 手动配置
|
||||
- 触发执行
|
||||
- function_call 模块
|
||||
- 核心模块
|
||||
|
||||

|
||||
|
||||
## 功能
|
||||
|
||||
从文本中提取结构化数据,通常是配合 HTTP 模块实现扩展。也可以做一些直接提取操作,例如:翻译。
|
||||
|
||||
## 参数说明
|
||||
|
||||
### 提取要求描述
|
||||
|
||||
顾名思义,给模型一个要目标,需要提取哪些内容。
|
||||
|
||||
**例子 1**
|
||||
|
||||
> 你是实验室预约助手,从对话中提取出姓名,预约时间,实验室号。当前时间 {{cTime}}
|
||||
|
||||
**例子 2**
|
||||
|
||||
> 你是谷歌搜索助手,从对话中提取出搜索关键词
|
||||
|
||||
**例子 3**
|
||||
|
||||
> 将我的问题直接翻译成英文,不要回答问题
|
||||
|
||||
### 历史记录
|
||||
|
||||
通常需要一些历史记录,才能更完整的提取用户问题。例如上图中需要提前名字、时间和实验室名,用户可能一开始只给了时间和实验室名,没有给自己的名字。再经过一轮缺失提示后,用户输入了姓名,此时需要结合上一次的记录才能完整的提取出 3 个内容。
|
||||
|
||||
### 目标字段
|
||||
|
||||
目标字段与提取的结果相对应,从上图可以看到,每增加一个字段,输出会增加一个对应的出口。
|
||||
|
||||
key: 字段的唯一标识,不可重复!
|
||||
字段描述:描述该字段是关于什么的,例如:姓名、时间、搜索词等等。
|
||||
必须:是否强制模型提取该字段,可能提取出来是空字符串。
|
||||
|
||||
## 输出介绍
|
||||
|
||||
- 字段完全提取:说明用户的问题中包含需要提取的所有内容。
|
||||
- 提取字段缺失:与 “字段完全提取” 对立,有缺失提取的字段时触发。
|
||||
- 完整提取结果: 一个 json 字符串,包含所有字段的提取结果。
|
||||
- 目标字段提取结果:类型均为字符串。
|
||||
|
@@ -0,0 +1,69 @@
|
||||
# 问题分类
|
||||
|
||||
- 可重复添加
|
||||
- 有外部输入
|
||||
- 手动配置
|
||||
- 触发执行
|
||||
- function_call 模块
|
||||
|
||||

|
||||
|
||||
## 功能
|
||||
|
||||
可以将用户的问题进行分类,分类后执行不同操作。在一些较模糊的场景中,分类效果不是很明显。
|
||||
|
||||
## 参数说明
|
||||
|
||||
### 系统提示词
|
||||
|
||||
被放置在对话最前面,可用于补充说明分类内容的定义。例如问题会被分为:
|
||||
|
||||
1. 打招呼
|
||||
2. laf 常见问题
|
||||
3. 其他问题
|
||||
|
||||
由于 laf 不是一个明确的东西,需要给它一个定义,此时提示词里可以填入 laf 的定义:
|
||||
|
||||
```
|
||||
laf 是云开发平台,可以快速的开发应用
|
||||
laf 是一个开源的 BaaS 开发平台(Backend as a Service)
|
||||
laf 是一个开箱即用的 serverless 开发平台
|
||||
laf 是一个集「函数计算」、「数据库」、「对象存储」等于一身的一站式开发平台
|
||||
laf 可以是开源版的腾讯云开发、开源版的 Google Firebase、开源版的 UniCloud
|
||||
```
|
||||
|
||||
### 聊天记录
|
||||
|
||||
适当增加一些聊天记录,可以联系上下文进行分类。
|
||||
|
||||
### 用户问题
|
||||
|
||||
输入的内容。
|
||||
|
||||
### 分类内容
|
||||
|
||||
依然以这 3 个分类为例,可以看到最终组成的 function。其中返回值由系统随机生成,不需要关心。
|
||||
|
||||
1. 打招呼
|
||||
2. laf 常见问题
|
||||
3. 其他问题
|
||||
|
||||
```js
|
||||
const agentFunction = {
|
||||
name: agentFunName,
|
||||
description: '判断用户问题的类型属于哪方面,返回对应的枚举字段',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
description: `打招呼,返回: abc;laf 常见问题,返回:vvv;其他问题,返回:aaa`
|
||||
enum: ["abc","vvv","aaa"]
|
||||
}
|
||||
},
|
||||
required: ['type']
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
上面的 function 必然会返回 type = abc,vvv,aaa 其中一个值,从而实现分类判断。
|
@@ -1 +1,95 @@
|
||||
# HTTP 模块
|
||||
|
||||
- 可重复添加
|
||||
- 有外部输入
|
||||
- 手动配置
|
||||
- 触发执行
|
||||
- 核中核模块
|
||||
|
||||

|
||||
|
||||
## 介绍
|
||||
|
||||
HTTP 模块会向对应的地址发送一个 POST 请求,Body 中携带 json 类型的参数,具体的参数可自定义。并接收一个 json 响应值,字段也是自定义。如上图中,我们定义了一个入参:提取的字段(定义的 key 为 appointment,类型为 string),和一个出参:提取结果(定义的 key 为 response,类型为 string)。
|
||||
|
||||
那么,这个请求的 curl 为:
|
||||
|
||||
```curl
|
||||
curl --location --request POST 'https://xxxx.laf.dev/appointment-lab' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"appointment":"{\"name\":\"小明\",\"time\":\"2023/08/16 15:00\",\"labname\":\"子良A323\"}"
|
||||
}'
|
||||
```
|
||||
|
||||
响应为:
|
||||
|
||||
```json
|
||||
{
|
||||
"response": "您已经有一个预约记录了,每人仅能同时预约一个实验室:\n 姓名:小明\n 时间: 2023/08/15 15:00\n 实验室: 子良A323\n "
|
||||
}
|
||||
```
|
||||
|
||||
**如果你不想额外的部署服务,可以使用 laf 快速的搭建接口,即写即发,无需部署**
|
||||
|
||||
[laf 在线地址](https://laf.dev/)
|
||||
|
||||
下面是一个请求例子:
|
||||
|
||||
```ts
|
||||
import cloud from '@lafjs/cloud';
|
||||
const db = cloud.database();
|
||||
|
||||
export default async function (ctx: FunctionContext) {
|
||||
const { appointment } = ctx.body;
|
||||
const { name, time, labname } = JSON.parse(appointment);
|
||||
|
||||
const missData = [];
|
||||
if (!name) missData.push('你的姓名');
|
||||
if (!time) missData.push('需要预约的时间');
|
||||
if (!labname) missData.push('实验室名称');
|
||||
|
||||
if (missData.length > 0) {
|
||||
return {
|
||||
response: `请提供: ${missData.join('、')}`
|
||||
};
|
||||
}
|
||||
|
||||
const { data: record } = await db
|
||||
.collection('LabAppointment')
|
||||
.where({
|
||||
name,
|
||||
status: 'unStart'
|
||||
})
|
||||
.getOne();
|
||||
|
||||
if (record) {
|
||||
return {
|
||||
response: `您已经有一个预约记录了,每人仅能同时预约一个实验室:
|
||||
姓名:${record.name}
|
||||
时间: ${record.time}
|
||||
实验室: ${record.labname}
|
||||
`
|
||||
};
|
||||
}
|
||||
|
||||
await db.collection('LabAppointment').add({
|
||||
name,
|
||||
time,
|
||||
labname,
|
||||
status: 'unStart'
|
||||
});
|
||||
|
||||
return {
|
||||
response: `预约成功。
|
||||
姓名:${name}
|
||||
时间: ${time}
|
||||
实验室: ${labname}
|
||||
`
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## 作用
|
||||
|
||||
基于 HTTP 模块,你可以做无限的扩展,可以操作数据库、执行联网搜索、发送邮箱等等。如果你有有趣的案例,欢迎 PR 到 [编排案例](/docs/category/examples)
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
Reference in New Issue
Block a user