Compare commits
74 Commits
v4.9.7-fix
...
test-html
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7a722a609 | ||
|
|
0f866fc552 | ||
|
|
05c7ba4483 | ||
|
|
fa80ce3a77 | ||
|
|
830358aa72 | ||
|
|
02b214b3ec | ||
|
|
a171c7b11c | ||
|
|
802de11363 | ||
|
|
b4ecfb0b79 | ||
|
|
331b851a78 | ||
|
|
50d235c42a | ||
|
|
9838593451 | ||
|
|
c25cd48e72 | ||
|
|
874300a56a | ||
|
|
1dea2b71b4 | ||
|
|
a8673344b1 | ||
|
|
9709ae7a4f | ||
|
|
fae76e887a | ||
|
|
9af92d1eae | ||
|
|
6a6719e93d | ||
|
|
50481f4ca8 | ||
|
|
88bd3aaa9e | ||
|
|
dd3c251603 | ||
|
|
aa55f059d4 | ||
|
|
89c9a02650 | ||
|
|
0f3bfa280a | ||
|
|
593ebfd269 | ||
|
|
f6dc2204f5 | ||
|
|
d44c338059 | ||
|
|
1dac2b70ec | ||
|
|
9fef3e15fb | ||
|
|
2d2d0fffe9 | ||
|
|
c6e0b5a1e7 | ||
|
|
932aa28a1f | ||
|
|
9c59bc2c17 | ||
|
|
e145f63554 | ||
|
|
554b2ca8dc | ||
|
|
4e83840c14 | ||
|
|
a6c80684d1 | ||
|
|
a4db03a3b7 | ||
|
|
cba8f773fe | ||
|
|
bd93f28d6f | ||
|
|
2063cb6314 | ||
|
|
12acaf491c | ||
|
|
3688842cc7 | ||
|
|
398d131bac | ||
|
|
d5f188a1a4 | ||
|
|
1edca309c4 | ||
|
|
1470c37ef1 | ||
|
|
bdb1221d94 | ||
|
|
cac4b1d435 | ||
|
|
0ef3d40296 | ||
|
|
3cc6b8a17a | ||
|
|
681ec30c38 | ||
|
|
24cd1c98dc | ||
|
|
eaceabcc43 | ||
|
|
a7f9411dca | ||
|
|
657fa32217 | ||
|
|
12d6948ba7 | ||
|
|
83d54d046d | ||
|
|
c75f154728 | ||
|
|
96e7dd581e | ||
|
|
2d3117c5da | ||
|
|
5361674a2c | ||
|
|
ef537f391c | ||
|
|
367ee517ec | ||
|
|
39cf001358 | ||
|
|
7b9f935119 | ||
|
|
a6fbfac96f | ||
|
|
864eff47c7 | ||
|
|
fdd4e9edbd | ||
|
|
683ab6c17d | ||
|
|
9f21add7b5 | ||
|
|
4b8db293ce |
25
.eslintignore
Normal file
25
.eslintignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# 构建输出目录
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
.next/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# 依赖目录
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# 缓存和生成文件
|
||||||
|
coverage/
|
||||||
|
.coverage/
|
||||||
|
.nyc_output/
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# 其他不需要检查的文件
|
||||||
|
*.min.js
|
||||||
|
*.config.js
|
||||||
|
vitest.config.mts
|
||||||
|
|
||||||
|
# 特定目录
|
||||||
|
bin/
|
||||||
|
scripts/
|
||||||
|
deploy/
|
||||||
|
docSite/
|
||||||
17
.eslintrc.json
Normal file
17
.eslintrc.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"extends": ["next/core-web-vitals"],
|
||||||
|
"rules": {
|
||||||
|
"react-hooks/rules-of-hooks": 0,
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"prefer": "type-imports",
|
||||||
|
"disallowTypeAnnotations": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ignorePatterns": ["node_modules/", "dist/", "build/", "coverage/"]
|
||||||
|
}
|
||||||
3
.vscode/i18n-ally-custom-framework.yml
vendored
3
.vscode/i18n-ally-custom-framework.yml
vendored
@@ -16,9 +16,6 @@ usageMatchRegex:
|
|||||||
# the `{key}` will be placed by a proper keypath matching regex,
|
# the `{key}` will be placed by a proper keypath matching regex,
|
||||||
# you can ignore it and use your own matching rules as well
|
# you can ignore it and use your own matching rules as well
|
||||||
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
|
||||||
- "[^\\w\\d]commonT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]fileT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
||||||
|
|
||||||
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
||||||
|
|||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -21,7 +21,7 @@
|
|||||||
"i18n-ally.namespace": true,
|
"i18n-ally.namespace": true,
|
||||||
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
|
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
|
||||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
|
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
|
||||||
"i18n-ally.translate.engines": ["google"],
|
"i18n-ally.translate.engines": ["deepl","google"],
|
||||||
"[typescript]": {
|
"[typescript]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -132,15 +132,15 @@ services:
|
|||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt-mcp-server:
|
fastgpt-mcp-server:
|
||||||
container_name: fastgpt-mcp-server
|
container_name: fastgpt-mcp-server
|
||||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3005:3000
|
- 3005:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -150,8 +150,8 @@ services:
|
|||||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -109,15 +109,15 @@ services:
|
|||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt-mcp-server:
|
fastgpt-mcp-server:
|
||||||
container_name: fastgpt-mcp-server
|
container_name: fastgpt-mcp-server
|
||||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3005:3000
|
- 3005:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -127,8 +127,8 @@ services:
|
|||||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./pg/data:/var/lib/postgresql/data
|
- ./pg/data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'aiproxy']
|
test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'postgres']
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
@@ -96,15 +96,15 @@ services:
|
|||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt-mcp-server:
|
fastgpt-mcp-server:
|
||||||
container_name: fastgpt-mcp-server
|
container_name: fastgpt-mcp-server
|
||||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3005:3000
|
- 3005:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -114,8 +114,8 @@ services:
|
|||||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ services:
|
|||||||
|
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.10-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt-mcp-server:
|
fastgpt-mcp-server:
|
||||||
container_name: fastgpt-mcp-server
|
container_name: fastgpt-mcp-server
|
||||||
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3005:3000
|
- 3005:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -90,8 +90,8 @@ services:
|
|||||||
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
image: ghcr.io/labring/fastgpt:v4.9.10-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.10-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
BIN
docSite/assets/imgs/official_account_faq.png
Normal file
BIN
docSite/assets/imgs/official_account_faq.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 386 KiB |
@@ -959,10 +959,16 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories
|
|||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
{{% alert icon=" " context="success" %}}
|
{{% alert icon=" " context="success" %}}
|
||||||
|
目前仅能获取到当前 API key 的创建者的对话。
|
||||||
|
|
||||||
- appId - 应用 Id
|
- appId - 应用 Id
|
||||||
- offset - 偏移量,即从第几条数据开始取
|
- offset - 偏移量,即从第几条数据开始取
|
||||||
- pageSize - 记录数量
|
- pageSize - 记录数量
|
||||||
- source - 对话源。source=api,表示获取通过 API 创建的对话(不会获取到页面上的对话记录)
|
- source - 对话源。source=api,表示获取通过 API 创建的对话(不会获取到页面上的对话记录)
|
||||||
|
- startCreateTime - 开始创建时间(可选)
|
||||||
|
- endCreateTime - 结束创建时间(可选)
|
||||||
|
- startUpdateTime - 开始更新时间(可选)
|
||||||
|
- endUpdateTime - 结束更新时间(可选)
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
{{< /markdownify >}}
|
{{< /markdownify >}}
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?
|
|||||||
| datasetId | 知识库ID | ✅ |
|
| datasetId | 知识库ID | ✅ |
|
||||||
| parentId: | 父级ID,不填则默认为根目录 | |
|
| parentId: | 父级ID,不填则默认为根目录 | |
|
||||||
| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ |
|
| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ |
|
||||||
|
| customPdfParse | PDF增强解析。true: 开启PDF增强解析;不填则默认为false | |
|
||||||
| autoIndexes | 是否自动生成索引(仅商业版支持) | |
|
| autoIndexes | 是否自动生成索引(仅商业版支持) | |
|
||||||
| imageIndex | 是否自动生成图片索引(仅商业版支持) | |
|
| imageIndex | 是否自动生成图片索引(仅商业版支持) | |
|
||||||
| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | |
|
| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | |
|
||||||
|
|||||||
50
docSite/content/zh-cn/docs/development/upgrading/4910.md
Normal file
50
docSite/content/zh-cn/docs/development/upgrading/4910.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.9.10'
|
||||||
|
description: 'FastGPT V4.9.10 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 790
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
重要提示:本次更新会重新构建全文索引,构建期间,全文检索结果会为空,4c16g 700 万组全文索引大致消耗 25 分钟。如需无缝升级,需自行做表同步工程。
|
||||||
|
|
||||||
|
### 1. 做好数据备份
|
||||||
|
|
||||||
|
### 2. 更新镜像 tag
|
||||||
|
|
||||||
|
- 更新 FastGPT 镜像 tag: v4.9.10-fix2
|
||||||
|
- 更新 FastGPT 商业版镜像 tag: v4.9.10-fix2
|
||||||
|
- mcp_server 无需更新
|
||||||
|
- Sandbox 无需更新
|
||||||
|
- AIProxy 无需更新
|
||||||
|
|
||||||
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
1. 支持 PG 设置`systemEnv.hnswMaxScanTuples`参数,提高迭代搜索的数据总量。
|
||||||
|
2. 知识库预处理参数增加 “分块条件”,可控制某些情况下不进行分块处理。
|
||||||
|
3. 知识库预处理参数增加 “段落优先” 模式,可控制最大段落深度。原“长度优先”模式,不再内嵌段落优先逻辑。
|
||||||
|
4. 工作流调整为单向接入和接出,支持快速的添加下一步节点。
|
||||||
|
5. 开放飞书和语雀知识库到开源版。
|
||||||
|
6. gemini 和 claude 最新模型预设。
|
||||||
|
|
||||||
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. LLM stream调用,默认超时调大。
|
||||||
|
2. 部分确认交互优化。
|
||||||
|
3. 纠正原先知识库的“表格数据集”名称,改成“备份导入”。同时支持知识库索引的导出和导入。
|
||||||
|
4. 工作流知识库引用上限,如果工作流中没有相关 AI 节点,则交互模式改成纯手动输入,并且上限为 1000万。
|
||||||
|
5. 语音输入,移动端判断逻辑,准确判断是否为手机,而不是小屏。
|
||||||
|
6. 优化上下文截取算法,至少保证留下一组 Human 信息。
|
||||||
|
|
||||||
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 全文检索多知识库时排序得分排序不正确。
|
||||||
|
2. 流响应捕获 finish_reason 可能不正确。
|
||||||
|
3. 工具调用模式,未保存思考输出。
|
||||||
|
4. 知识库 indexSize 参数未生效。
|
||||||
|
5. 工作流嵌套 2 层后,获取预览引用、上下文不正确。
|
||||||
|
6. xlsx 转成 Markdown 时候,前面会多出一个空格。
|
||||||
|
7. 读取 Markdown 文件时,Base64 图片未进行额外抓换保存。
|
||||||
25
docSite/content/zh-cn/docs/development/upgrading/4911.md
Normal file
25
docSite/content/zh-cn/docs/development/upgrading/4911.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.9.11(进行中)'
|
||||||
|
description: 'FastGPT V4.9.11 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 789
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
1. 工作流中增加节点搜索功能。
|
||||||
|
2. 工作流中,子流程版本控制,可选择“保持最新版本”,无需手动更新。
|
||||||
|
|
||||||
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. 原文缓存改用 gridfs 存储,提高上限。
|
||||||
|
|
||||||
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 工作流中,管理员声明的全局系统工具,无法进行版本管理。
|
||||||
|
2. 工具调用节点前,有交互节点时,上下文异常。
|
||||||
|
3. 修复备份导入,小于 1000 字时,无法分块问题。
|
||||||
|
4. 自定义 PDF 解析,无法保存 base64 图片。
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 'V4.9.8(进行中)'
|
title: 'V4.9.8'
|
||||||
description: 'FastGPT V4.9.8 更新说明'
|
description: 'FastGPT V4.9.8 更新说明'
|
||||||
icon: 'upgrade'
|
icon: 'upgrade'
|
||||||
draft: false
|
draft: false
|
||||||
@@ -7,15 +7,43 @@ toc: true
|
|||||||
weight: 792
|
weight: 792
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据备份
|
||||||
|
|
||||||
|
### 2. 更新镜像 tag
|
||||||
|
|
||||||
|
- 更新 FastGPT 镜像 tag: v4.9.8
|
||||||
|
- 更新 FastGPT 商业版镜像 tag: v4.9.8
|
||||||
|
- mcp_server 无需更新
|
||||||
|
- Sandbox 无需更新
|
||||||
|
- AIProxy 无需更新
|
||||||
|
|
||||||
## 🚀 新增内容
|
## 🚀 新增内容
|
||||||
|
|
||||||
1. qwen3 模型预设
|
1. 支持 Toolcalls 并行执行。
|
||||||
|
2. 将所有内置任务,从非 stream 模式调整成 stream 模式,避免部分模型不支持非 stream 模式。如需覆盖,则可以在模型`额外 Body`参数中,强制指定`stream=false`。
|
||||||
|
3. qwen3 模型预设
|
||||||
|
4. 语雀知识库支持设置根目录。
|
||||||
|
5. 可配置密码过期时间,过期后下次登录会强制要求修改密码。
|
||||||
|
6. 密码登录增加 preLogin 临时密钥校验。
|
||||||
|
7. 支持 Admin 后台配置发布渠道和第三方知识库的显示隐藏。
|
||||||
|
|
||||||
## ⚙️ 优化
|
## ⚙️ 优化
|
||||||
|
|
||||||
1. Chat log list 优化,避免大数据时超出内存限制。
|
1. Chat log list 优化,避免大数据时超出内存限制。
|
||||||
|
2. 预加载 token 计算 worker,避免主任务中并发创建导致线程阻塞。
|
||||||
|
3. 工作流节点版本控制交互优化。
|
||||||
|
4. 网络获取以及 html2md 优化,支持视频和音频标签的转换。
|
||||||
|
|
||||||
## 🐛 修复
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 应用列表/知识库列表,删除行权限展示问题。
|
||||||
|
2. 打开知识库搜索参数后,重排选项自动被打开。
|
||||||
|
3. LLM json_schema 模式 API 请求格式错误。
|
||||||
|
4. 重新训练时,图片过期索引未成功清除,导致图片会丢失。
|
||||||
|
5. 重新训练权限问题。
|
||||||
|
6. 文档链接地址。
|
||||||
|
7. Claude 工具调用,由于 index 为空,导致工具调用失败。
|
||||||
|
8. 嵌套工作流,工具调用下包含交互节点时,流程异常。
|
||||||
|
|
||||||
|
|||||||
43
docSite/content/zh-cn/docs/development/upgrading/499.md
Normal file
43
docSite/content/zh-cn/docs/development/upgrading/499.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.9.9'
|
||||||
|
description: 'FastGPT V4.9.9 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 791
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据备份
|
||||||
|
|
||||||
|
### 2. 商业版用户替换新 License
|
||||||
|
|
||||||
|
商业版用户可以联系 FastGPT 团队支持同学,获取 License 替换方案。替换后,可以直接升级系统,管理后台会提示输入新 License。
|
||||||
|
|
||||||
|
### 3. 更新镜像 tag
|
||||||
|
|
||||||
|
- 更新 FastGPT 镜像 tag: v4.9.9
|
||||||
|
- 更新 FastGPT 商业版镜像 tag: v4.9.9
|
||||||
|
- mcp_server 无需更新
|
||||||
|
- Sandbox 无需更新
|
||||||
|
- AIProxy 无需更新
|
||||||
|
|
||||||
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
1. 切换 SessionId 来替代 JWT 实现登录鉴权,可控制最大登录客户端数量。
|
||||||
|
2. 新的商业版 License 管理模式。
|
||||||
|
3. 公众号调用,显示记录 chat 对话错误,方便排查。
|
||||||
|
4. API 知识库支持 BasePath 选择,需增加 API 接口,具体可见[API 知识库介绍](/docs/guide/knowledge_base/api_dataset/#4-获取文件详细信息用于获取文件信息)
|
||||||
|
|
||||||
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. 优化工具调用,新工具的判断逻辑。
|
||||||
|
2. 调整 Cite 引用提示词。
|
||||||
|
|
||||||
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 无法正常获取应用历史保存/发布记录。
|
||||||
|
2. 成员创建 MCP 工具权限问题。
|
||||||
|
3. 来源引用展示,存在 ID 传递错误,导致提示无权操作该文件。
|
||||||
|
4. 回答标注前端数据报错。
|
||||||
@@ -43,7 +43,7 @@ type ResponseType = {
|
|||||||
// 文件列表中,单项的文件类型
|
// 文件列表中,单项的文件类型
|
||||||
type FileListItem = {
|
type FileListItem = {
|
||||||
id: string;
|
id: string;
|
||||||
parentId: string | null;
|
parentId: string //也可能为 null 或者 undefined 类型;
|
||||||
name: string;
|
name: string;
|
||||||
type: 'file' | 'folder';
|
type: 'file' | 'folder';
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
@@ -59,7 +59,7 @@ type FileListItem = {
|
|||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
{{% alert icon=" " context="success" %}}
|
{{% alert icon=" " context="success" %}}
|
||||||
- parentId - 父级 id,可选,或者 null。
|
- parentId - 父级 id,可选,或者 null | undefined。
|
||||||
- searchKey - 检索词,可选
|
- searchKey - 检索词,可选
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ curl --location --request POST '{{baseURL}}/v1/file/list' \
|
|||||||
--header 'Authorization: Bearer {{authorization}}' \
|
--header 'Authorization: Bearer {{authorization}}' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--data-raw '{
|
--data-raw '{
|
||||||
"parentId": null,
|
"parentId": "",
|
||||||
"searchKey": ""
|
"searchKey": ""
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
@@ -185,3 +185,40 @@ curl --location --request GET '{{baseURL}}/v1/file/read?id=xx' \
|
|||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
|
||||||
|
### 4. 获取文件详细信息(用于获取文件信息)
|
||||||
|
|
||||||
|
{{< tabs tabTotal="2" >}}
|
||||||
|
{{< tab tabName="请求示例" >}}
|
||||||
|
{{< markdownify >}}
|
||||||
|
|
||||||
|
id 为文件的 id。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \
|
||||||
|
--header 'Authorization: Bearer {{authorization}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /markdownify >}}
|
||||||
|
{{< /tab >}}
|
||||||
|
|
||||||
|
{{< tab tabName="响应示例" >}}
|
||||||
|
{{< markdownify >}}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"success": true,
|
||||||
|
"message": "",
|
||||||
|
"data": {
|
||||||
|
"id": "docs",
|
||||||
|
"parentId": "",
|
||||||
|
"name": "docs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /markdownify >}}
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ FastGPT 商业版是基于 FastGPT 开源版的增强版本,增加了一些独
|
|||||||
| 应用发布安全配置 | ❌ | ✅ | ✅ |
|
| 应用发布安全配置 | ❌ | ✅ | ✅ |
|
||||||
| 内容审核 | ❌ | ✅ | ✅ |
|
| 内容审核 | ❌ | ✅ | ✅ |
|
||||||
| web站点同步 | ❌ | ✅ | ✅ |
|
| web站点同步 | ❌ | ✅ | ✅ |
|
||||||
| 主流文档库接入(目前支持:语雀、飞书) | ❌ | ✅ | ✅ |
|
|
||||||
| 增强训练模式 | ❌ | ✅ | ✅ |
|
| 增强训练模式 | ❌ | ✅ | ✅ |
|
||||||
| 第三方应用快速接入(飞书、公众号) | ❌ | ✅ | ✅ |
|
| 第三方应用快速接入(飞书、公众号) | ❌ | ✅ | ✅ |
|
||||||
| 管理后台 | ❌ | ✅ | 不需要 |
|
| 管理后台 | ❌ | ✅ | 不需要 |
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ HTTP模块中,需要设置 3 个工具参数:
|
|||||||
"hidden"
|
"hidden"
|
||||||
],
|
],
|
||||||
"label": "",
|
"label": "",
|
||||||
"value": 1500,
|
"value": 5000,
|
||||||
"valueType": "number"
|
"valueType": "number"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ weight: 506
|
|||||||
121.196.228.45
|
121.196.228.45
|
||||||
121.43.126.202
|
121.43.126.202
|
||||||
120.26.144.37
|
120.26.144.37
|
||||||
|
47.98.196.113
|
||||||
|
47.97.204.90
|
||||||
|
118.31.41.236
|
||||||
|
118.178.185.61
|
||||||
```
|
```
|
||||||
|
|
||||||
## 4. 获取AES Key,选择加密方式
|
## 4. 获取AES Key,选择加密方式
|
||||||
@@ -125,6 +129,13 @@ weight: 506
|
|||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
### 公众号没响应
|
||||||
|
|
||||||
|
检查应用对话日志,如果有对话日志,但是微信公众号无响应,则是白名单 IP未成功。
|
||||||
|
添加白名单IP 后,通常需要等待几分钟微信更新。可以在对话日志中,找点错误日志。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### 如何新开一个聊天记录
|
### 如何新开一个聊天记录
|
||||||
|
|
||||||
如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。
|
如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。
|
||||||
4
env.d.ts
vendored
4
env.d.ts
vendored
@@ -4,7 +4,6 @@ declare global {
|
|||||||
LOG_DEPTH: string;
|
LOG_DEPTH: string;
|
||||||
DEFAULT_ROOT_PSW: string;
|
DEFAULT_ROOT_PSW: string;
|
||||||
DB_MAX_LINK: string;
|
DB_MAX_LINK: string;
|
||||||
TOKEN_KEY: string;
|
|
||||||
FILE_TOKEN_KEY: string;
|
FILE_TOKEN_KEY: string;
|
||||||
ROOT_KEY: string;
|
ROOT_KEY: string;
|
||||||
OPENAI_BASE_URL: string;
|
OPENAI_BASE_URL: string;
|
||||||
@@ -35,6 +34,9 @@ declare global {
|
|||||||
ALLOWED_ORIGINS?: string;
|
ALLOWED_ORIGINS?: string;
|
||||||
SHOW_COUPON?: string;
|
SHOW_COUPON?: string;
|
||||||
CONFIG_JSON_PATH?: string;
|
CONFIG_JSON_PATH?: string;
|
||||||
|
PASSWORD_LOGIN_LOCK_SECONDS?: string;
|
||||||
|
PASSWORD_EXPIRED_MONTH?: string;
|
||||||
|
MAX_LOGIN_SESSION?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -13,12 +13,18 @@
|
|||||||
"previewIcon": "node ./scripts/icon/index.js",
|
"previewIcon": "node ./scripts/icon/index.js",
|
||||||
"api:gen": "tsc ./scripts/openapi/index.ts && node ./scripts/openapi/index.js && npx @redocly/cli build-docs ./scripts/openapi/openapi.json -o ./projects/app/public/openapi/index.html",
|
"api:gen": "tsc ./scripts/openapi/index.ts && node ./scripts/openapi/index.js && npx @redocly/cli build-docs ./scripts/openapi/openapi.json -o ./projects/app/public/openapi/index.html",
|
||||||
"create:i18n": "node ./scripts/i18n/index.js",
|
"create:i18n": "node ./scripts/i18n/index.js",
|
||||||
|
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path .eslintignore",
|
||||||
|
"lint:fix": "eslint \"**/*.{ts,tsx}\" --fix --ignore-path .eslintignore",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:workflow": "vitest run workflow"
|
"test:workflow": "vitest run workflow"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@chakra-ui/cli": "^2.4.1",
|
"@chakra-ui/cli": "^2.4.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
"@vitest/coverage-v8": "^3.0.9",
|
"@vitest/coverage-v8": "^3.0.9",
|
||||||
|
"eslint": "^8.57.0",
|
||||||
|
"eslint-config-next": "^14.1.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"i18next": "23.16.8",
|
"i18next": "23.16.8",
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^13.3.0",
|
||||||
@@ -31,7 +37,10 @@
|
|||||||
"zhlint": "^0.7.4"
|
"zhlint": "^0.7.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"./**/**/*.{ts,tsx,scss}": "npm run format-code",
|
"./**/**/*.{ts,tsx,scss}": [
|
||||||
|
"npm run format-code",
|
||||||
|
"npm run lint:fix"
|
||||||
|
],
|
||||||
"./docSite/**/**/*.md": "npm run format-doc && npm run gen:llms"
|
"./docSite/**/**/*.md": "npm run format-doc && npm run gen:llms"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 502000 */
|
/* dataset: 502000 */
|
||||||
export enum AppErrEnum {
|
export enum AppErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 504000 */
|
/* dataset: 504000 */
|
||||||
export enum ChatErrEnum {
|
export enum ChatErrEnum {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
|
|
||||||
/* dataset: 507000 */
|
/* dataset: 507000 */
|
||||||
const startCode = 507000;
|
const startCode = 507000;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
|
|
||||||
/* dataset: 501000 */
|
/* dataset: 501000 */
|
||||||
export enum DatasetErrEnum {
|
export enum DatasetErrEnum {
|
||||||
@@ -27,7 +27,7 @@ const datasetErr = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
statusText: DatasetErrEnum.unExist,
|
statusText: DatasetErrEnum.unExist,
|
||||||
message: 'core.dataset.error.unExistDataset'
|
message: i18nT('common:core.dataset.error.unExistDataset')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
statusText: DatasetErrEnum.unExistCollection,
|
statusText: DatasetErrEnum.unExistCollection,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 506000 */
|
/* dataset: 506000 */
|
||||||
export enum OpenApiErrEnum {
|
export enum OpenApiErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 505000 */
|
/* dataset: 505000 */
|
||||||
export enum OutLinkErrEnum {
|
export enum OutLinkErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 508000 */
|
/* dataset: 508000 */
|
||||||
export enum PluginErrEnum {
|
export enum PluginErrEnum {
|
||||||
|
|||||||
@@ -1,14 +1,29 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 509000 */
|
/* dataset: 509000 */
|
||||||
export enum SystemErrEnum {
|
export enum SystemErrEnum {
|
||||||
communityVersionNumLimit = 'communityVersionNumLimit'
|
communityVersionNumLimit = 'communityVersionNumLimit',
|
||||||
|
licenseAppAmountLimit = 'licenseAppAmountLimit',
|
||||||
|
licenseDatasetAmountLimit = 'licenseDatasetAmountLimit',
|
||||||
|
licenseUserAmountLimit = 'licenseUserAmountLimit'
|
||||||
}
|
}
|
||||||
|
|
||||||
const systemErr = [
|
const systemErr = [
|
||||||
{
|
{
|
||||||
statusText: SystemErrEnum.communityVersionNumLimit,
|
statusText: SystemErrEnum.communityVersionNumLimit,
|
||||||
message: i18nT('common:code_error.system_error.community_version_num_limit')
|
message: i18nT('common:code_error.system_error.community_version_num_limit')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: SystemErrEnum.licenseAppAmountLimit,
|
||||||
|
message: i18nT('common:code_error.system_error.license_app_amount_limit')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: SystemErrEnum.licenseDatasetAmountLimit,
|
||||||
|
message: i18nT('common:code_error.system_error.license_dataset_amount_limit')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: SystemErrEnum.licenseUserAmountLimit,
|
||||||
|
message: i18nT('common:code_error.system_error.license_user_amount_limit')
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* team: 503000 */
|
/* team: 503000 */
|
||||||
export enum UserErrEnum {
|
export enum UserErrEnum {
|
||||||
|
|||||||
2
packages/global/common/file/api.d.ts
vendored
2
packages/global/common/file/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { OutLinkChatAuthProps } from '../../support/permission/chat.d';
|
import type { OutLinkChatAuthProps } from '../../support/permission/chat.d';
|
||||||
|
|
||||||
export type preUploadImgProps = OutLinkChatAuthProps & {
|
export type preUploadImgProps = OutLinkChatAuthProps & {
|
||||||
// expiredTime?: Date;
|
// expiredTime?: Date;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { detect } from 'jschardet';
|
import { detect } from 'jschardet';
|
||||||
import { documentFileType } from './constants';
|
import { documentFileType } from './constants';
|
||||||
import { ChatFileTypeEnum } from '../../core/chat/constants';
|
import { ChatFileTypeEnum } from '../../core/chat/constants';
|
||||||
import { UserChatItemValueItemType } from '../../core/chat/type';
|
import { type UserChatItemValueItemType } from '../../core/chat/type';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export const formatFileSize = (bytes: number): string => {
|
export const formatFileSize = (bytes: number): string => {
|
||||||
|
|||||||
2
packages/global/common/file/type.d.ts
vendored
2
packages/global/common/file/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { BucketNameEnum } from './constants';
|
import type { BucketNameEnum } from './constants';
|
||||||
|
|
||||||
export type FileTokenQuery = {
|
export type FileTokenQuery = {
|
||||||
bucketName: `${BucketNameEnum}`;
|
bucketName: `${BucketNameEnum}`;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TrackEnum } from './constants';
|
import type { TrackEnum } from './constants';
|
||||||
import { OAuthEnum } from '../../../support/user/constant';
|
import { OAuthEnum } from '../../../support/user/constant';
|
||||||
import { AppTypeEnum } from '../../../core/app/constants';
|
import { AppTypeEnum } from '../../../core/app/constants';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ParentIdType } from './type';
|
import { type ParentIdType } from './type';
|
||||||
|
|
||||||
export const parseParentIdInMongo = (parentId: ParentIdType) => {
|
export const parseParentIdInMongo = (parentId: ParentIdType) => {
|
||||||
if (parentId === undefined) return {};
|
if (parentId === undefined) return {};
|
||||||
|
|||||||
18
packages/global/common/string/password.ts
Normal file
18
packages/global/common/string/password.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export const checkPasswordRule = (password: string) => {
|
||||||
|
const patterns = [
|
||||||
|
/\d/, // Contains digits
|
||||||
|
/[a-z]/, // Contains lowercase letters
|
||||||
|
/[A-Z]/, // Contains uppercase letters
|
||||||
|
/[!@#$%^&*()_+=-]/ // Contains special characters
|
||||||
|
];
|
||||||
|
const validChars = /^[\dA-Za-z!@#$%^&*()_+=-]{8,100}$/;
|
||||||
|
|
||||||
|
// Check length and valid characters
|
||||||
|
if (!validChars.test(password)) return false;
|
||||||
|
|
||||||
|
// Count how many patterns are satisfied
|
||||||
|
const matchCount = patterns.filter((pattern) => pattern.test(password)).length;
|
||||||
|
|
||||||
|
// Must satisfy at least 2 patterns
|
||||||
|
return matchCount >= 2;
|
||||||
|
};
|
||||||
@@ -7,6 +7,10 @@ export const CUSTOM_SPLIT_SIGN = '-----CUSTOM_SPLIT_SIGN-----';
|
|||||||
type SplitProps = {
|
type SplitProps = {
|
||||||
text: string;
|
text: string;
|
||||||
chunkSize: number;
|
chunkSize: number;
|
||||||
|
|
||||||
|
paragraphChunkDeep?: number; // Paragraph deep
|
||||||
|
paragraphChunkMinSize?: number; // Paragraph min size, if too small, it will merge
|
||||||
|
|
||||||
maxSize?: number;
|
maxSize?: number;
|
||||||
overlapRatio?: number;
|
overlapRatio?: number;
|
||||||
customReg?: string[];
|
customReg?: string[];
|
||||||
@@ -108,6 +112,8 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
let {
|
let {
|
||||||
text = '',
|
text = '',
|
||||||
chunkSize,
|
chunkSize,
|
||||||
|
paragraphChunkDeep = 5,
|
||||||
|
paragraphChunkMinSize = 100,
|
||||||
maxSize = defaultMaxChunkSize,
|
maxSize = defaultMaxChunkSize,
|
||||||
overlapRatio = 0.15,
|
overlapRatio = 0.15,
|
||||||
customReg = []
|
customReg = []
|
||||||
@@ -123,7 +129,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
text = text.replace(/(```[\s\S]*?```|~~~[\s\S]*?~~~)/g, function (match) {
|
text = text.replace(/(```[\s\S]*?```|~~~[\s\S]*?~~~)/g, function (match) {
|
||||||
return match.replace(/\n/g, codeBlockMarker);
|
return match.replace(/\n/g, codeBlockMarker);
|
||||||
});
|
});
|
||||||
// 2. 表格处理 - 单独提取表格出来,进行表头合并
|
// 2. Markdown 表格处理 - 单独提取表格出来,进行表头合并
|
||||||
const tableReg =
|
const tableReg =
|
||||||
/(\n\|(?:(?:[^\n|]+\|){1,})\n\|(?:[:\-\s]+\|){1,}\n(?:\|(?:[^\n|]+\|)*\n?)*)(?:\n|$)/g;
|
/(\n\|(?:(?:[^\n|]+\|){1,})\n\|(?:[:\-\s]+\|){1,}\n(?:\|(?:[^\n|]+\|)*\n?)*)(?:\n|$)/g;
|
||||||
const tableDataList = text.match(tableReg);
|
const tableDataList = text.match(tableReg);
|
||||||
@@ -143,25 +149,40 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
text = text.replace(/(\r?\n|\r){3,}/g, '\n\n\n');
|
text = text.replace(/(\r?\n|\r){3,}/g, '\n\n\n');
|
||||||
|
|
||||||
// The larger maxLen is, the next sentence is less likely to trigger splitting
|
// The larger maxLen is, the next sentence is less likely to trigger splitting
|
||||||
const markdownIndex = 4;
|
const customRegLen = customReg.length;
|
||||||
const forbidOverlapIndex = 8;
|
const markdownIndex = paragraphChunkDeep - 1;
|
||||||
|
const forbidOverlapIndex = customRegLen + markdownIndex + 4;
|
||||||
|
|
||||||
|
const markdownHeaderRules = ((deep?: number): { reg: RegExp; maxLen: number }[] => {
|
||||||
|
if (!deep || deep === 0) return [];
|
||||||
|
|
||||||
|
const maxDeep = Math.min(deep, 8); // Maximum 8 levels
|
||||||
|
const rules: { reg: RegExp; maxLen: number }[] = [];
|
||||||
|
|
||||||
|
for (let i = 1; i <= maxDeep; i++) {
|
||||||
|
const hashSymbols = '#'.repeat(i);
|
||||||
|
rules.push({
|
||||||
|
reg: new RegExp(`^(${hashSymbols}\\s[^\\n]+\\n)`, 'gm'),
|
||||||
|
maxLen: chunkSize
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return rules;
|
||||||
|
})(paragraphChunkDeep);
|
||||||
|
|
||||||
const stepReges: { reg: RegExp | string; maxLen: number }[] = [
|
const stepReges: { reg: RegExp | string; maxLen: number }[] = [
|
||||||
...customReg.map((text) => ({
|
...customReg.map((text) => ({
|
||||||
reg: text.replaceAll('\\n', '\n'),
|
reg: text.replaceAll('\\n', '\n'),
|
||||||
maxLen: chunkSize
|
maxLen: chunkSize
|
||||||
})),
|
})),
|
||||||
{ reg: /^(#\s[^\n]+\n)/gm, maxLen: chunkSize },
|
...markdownHeaderRules,
|
||||||
{ reg: /^(##\s[^\n]+\n)/gm, maxLen: chunkSize },
|
|
||||||
{ reg: /^(###\s[^\n]+\n)/gm, maxLen: chunkSize },
|
|
||||||
{ reg: /^(####\s[^\n]+\n)/gm, maxLen: chunkSize },
|
|
||||||
{ reg: /^(#####\s[^\n]+\n)/gm, maxLen: chunkSize },
|
|
||||||
|
|
||||||
{ reg: /([\n](```[\s\S]*?```|~~~[\s\S]*?~~~))/g, maxLen: maxSize }, // code block
|
{ reg: /([\n](```[\s\S]*?```|~~~[\s\S]*?~~~))/g, maxLen: maxSize }, // code block
|
||||||
|
// HTML Table tag 尽可能保障完整
|
||||||
{
|
{
|
||||||
reg: /(\n\|(?:(?:[^\n|]+\|){1,})\n\|(?:[:\-\s]+\|){1,}\n(?:\|(?:[^\n|]+\|)*\n)*)/g,
|
reg: /(\n\|(?:(?:[^\n|]+\|){1,})\n\|(?:[:\-\s]+\|){1,}\n(?:\|(?:[^\n|]+\|)*\n)*)/g,
|
||||||
maxLen: Math.min(chunkSize * 1.5, maxSize)
|
maxLen: chunkSize
|
||||||
}, // Table 尽可能保证完整性
|
}, // Markdown Table 尽可能保证完整性
|
||||||
{ reg: /(\n{2,})/g, maxLen: chunkSize },
|
{ reg: /(\n{2,})/g, maxLen: chunkSize },
|
||||||
{ reg: /([\n])/g, maxLen: chunkSize },
|
{ reg: /([\n])/g, maxLen: chunkSize },
|
||||||
// ------ There's no overlap on the top
|
// ------ There's no overlap on the top
|
||||||
@@ -172,12 +193,10 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
{ reg: /([,]|,\s)/g, maxLen: chunkSize }
|
{ reg: /([,]|,\s)/g, maxLen: chunkSize }
|
||||||
];
|
];
|
||||||
|
|
||||||
const customRegLen = customReg.length;
|
|
||||||
const checkIsCustomStep = (step: number) => step < customRegLen;
|
const checkIsCustomStep = (step: number) => step < customRegLen;
|
||||||
const checkIsMarkdownSplit = (step: number) =>
|
const checkIsMarkdownSplit = (step: number) =>
|
||||||
step >= customRegLen && step <= markdownIndex + customRegLen;
|
step >= customRegLen && step <= markdownIndex + customRegLen;
|
||||||
|
const checkForbidOverlap = (step: number) => step <= forbidOverlapIndex;
|
||||||
const checkForbidOverlap = (step: number) => step <= forbidOverlapIndex + customRegLen;
|
|
||||||
|
|
||||||
// if use markdown title split, Separate record title
|
// if use markdown title split, Separate record title
|
||||||
const getSplitTexts = ({ text, step }: { text: string; step: number }) => {
|
const getSplitTexts = ({ text, step }: { text: string; step: number }) => {
|
||||||
@@ -301,6 +320,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
const splitTexts = getSplitTexts({ text, step });
|
const splitTexts = getSplitTexts({ text, step });
|
||||||
|
|
||||||
const chunks: string[] = [];
|
const chunks: string[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < splitTexts.length; i++) {
|
for (let i = 0; i < splitTexts.length; i++) {
|
||||||
const item = splitTexts[i];
|
const item = splitTexts[i];
|
||||||
|
|
||||||
@@ -443,7 +463,6 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
*/
|
*/
|
||||||
export const splitText2Chunks = (props: SplitProps): SplitResponse => {
|
export const splitText2Chunks = (props: SplitProps): SplitResponse => {
|
||||||
let { text = '' } = props;
|
let { text = '' } = props;
|
||||||
const start = Date.now();
|
|
||||||
const splitWithCustomSign = text.split(CUSTOM_SPLIT_SIGN);
|
const splitWithCustomSign = text.split(CUSTOM_SPLIT_SIGN);
|
||||||
|
|
||||||
const splitResult = splitWithCustomSign.map((item) => {
|
const splitResult = splitWithCustomSign.map((item) => {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
export enum SystemConfigsTypeEnum {
|
export enum SystemConfigsTypeEnum {
|
||||||
fastgpt = 'fastgpt',
|
fastgpt = 'fastgpt',
|
||||||
fastgptPro = 'fastgptPro',
|
fastgptPro = 'fastgptPro',
|
||||||
systemMsgModal = 'systemMsgModal'
|
systemMsgModal = 'systemMsgModal',
|
||||||
|
license = 'license'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SystemConfigsTypeMap = {
|
export const SystemConfigsTypeMap = {
|
||||||
@@ -13,5 +14,8 @@ export const SystemConfigsTypeMap = {
|
|||||||
},
|
},
|
||||||
[SystemConfigsTypeEnum.systemMsgModal]: {
|
[SystemConfigsTypeEnum.systemMsgModal]: {
|
||||||
label: 'systemMsgModal'
|
label: 'systemMsgModal'
|
||||||
|
},
|
||||||
|
[SystemConfigsTypeEnum.license]: {
|
||||||
|
label: 'license'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SystemConfigsTypeEnum } from "./constants";
|
import type { SystemConfigsTypeEnum } from './constants';
|
||||||
|
|
||||||
export type SystemConfigsType = {
|
export type SystemConfigsType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
34
packages/global/common/system/types/index.d.ts
vendored
34
packages/global/common/system/types/index.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
import { StandSubPlanLevelMapType, SubPlanType } from '../../../support/wallet/sub/type';
|
import type { SubPlanType } from '../../../support/wallet/sub/type';
|
||||||
|
import { StandSubPlanLevelMapType } from '../../../support/wallet/sub/type';
|
||||||
import type {
|
import type {
|
||||||
ChatModelItemType,
|
ChatModelItemType,
|
||||||
FunctionModelItemType,
|
FunctionModelItemType,
|
||||||
@@ -63,6 +64,15 @@ export type FastGPTFeConfigsType = {
|
|||||||
show_coupon?: boolean;
|
show_coupon?: boolean;
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
|
|
||||||
|
show_dataset_feishu?: boolean;
|
||||||
|
show_dataset_yuque?: boolean;
|
||||||
|
show_publish_feishu?: boolean;
|
||||||
|
show_publish_dingtalk?: boolean;
|
||||||
|
show_publish_offiaccount?: boolean;
|
||||||
|
|
||||||
|
show_dataset_enhance?: boolean;
|
||||||
|
show_batch_eval?: boolean;
|
||||||
|
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
docUrl?: string;
|
docUrl?: string;
|
||||||
openAPIDocUrl?: string;
|
openAPIDocUrl?: string;
|
||||||
@@ -120,9 +130,11 @@ export type SystemEnvType = {
|
|||||||
vectorMaxProcess: number;
|
vectorMaxProcess: number;
|
||||||
qaMaxProcess: number;
|
qaMaxProcess: number;
|
||||||
vlmMaxProcess: number;
|
vlmMaxProcess: number;
|
||||||
hnswEfSearch: number;
|
|
||||||
tokenWorkers: number; // token count max worker
|
tokenWorkers: number; // token count max worker
|
||||||
|
|
||||||
|
hnswEfSearch: number;
|
||||||
|
hnswMaxScanTuples: number;
|
||||||
|
|
||||||
oneapiUrl?: string;
|
oneapiUrl?: string;
|
||||||
chatApiKey?: string;
|
chatApiKey?: string;
|
||||||
|
|
||||||
@@ -135,3 +147,21 @@ export type customPdfParseType = {
|
|||||||
doc2xKey?: string;
|
doc2xKey?: string;
|
||||||
price?: number;
|
price?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type LicenseDataType = {
|
||||||
|
startTime: string;
|
||||||
|
expiredTime: string;
|
||||||
|
company: string;
|
||||||
|
description?: string; // 描述
|
||||||
|
hosts?: string[]; // 管理端有效域名
|
||||||
|
maxUsers?: number; // 最大用户数,不填默认不上限
|
||||||
|
maxApps?: number; // 最大应用数,不填默认不上限
|
||||||
|
maxDatasets?: number; // 最大数据集数,不填默认不上限
|
||||||
|
functions: {
|
||||||
|
sso: boolean;
|
||||||
|
pay: boolean;
|
||||||
|
customTemplates: boolean;
|
||||||
|
datasetEnhance: boolean;
|
||||||
|
batchEval: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|||||||
2
packages/global/core/ai/model.d.ts
vendored
2
packages/global/core/ai/model.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { ModelTypeEnum } from './model';
|
import type { ModelTypeEnum } from './model';
|
||||||
import type { ModelProviderIdType } from './provider';
|
import type { ModelProviderIdType } from './provider';
|
||||||
|
|
||||||
type PriceType = {
|
type PriceType = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { i18nT } from '../../../web/i18n/utils';
|
import { i18nT } from '../../../web/i18n/utils';
|
||||||
import type { LLMModelItemType, STTModelType, EmbeddingModelItemType } from './model.d';
|
import type { LLMModelItemType, STTModelType, EmbeddingModelItemType } from './model.d';
|
||||||
import { getModelProvider, ModelProviderIdType } from './provider';
|
import { getModelProvider, type ModelProviderIdType } from './provider';
|
||||||
|
|
||||||
export enum ModelTypeEnum {
|
export enum ModelTypeEnum {
|
||||||
llm = 'llm',
|
llm = 'llm',
|
||||||
|
|||||||
@@ -1,7 +1,249 @@
|
|||||||
import { PromptTemplateItem } from '../type.d';
|
import { type PromptTemplateItem } from '../type.d';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { getPromptByVersion } from './utils';
|
import { getPromptByVersion } from './utils';
|
||||||
|
|
||||||
|
export const Prompt_userQuotePromptList: PromptTemplateItem[] = [
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.standard_template'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
你是一个知识库回答助手,可以使用 <Cites></Cites> 中的内容作为你本次回答的参考。
|
||||||
|
同时,为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记,标识参考了哪些内容。
|
||||||
|
|
||||||
|
## 追溯展示规则
|
||||||
|
|
||||||
|
- 使用 [id](CITE) 的格式来引用 <Cites></Cites> 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在 **每段话结尾** 自然地整合引用。例如: "Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)。"。
|
||||||
|
- 每段话**至少包含一个引用**,多个引用时按顺序排列,例如:"Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)[67e517e74767063e882d6862](CITE)。\n 它的特点是非常轻量[67e517e74767063e882d6863](CITE)。"
|
||||||
|
- 不要把示例作为知识点。
|
||||||
|
- 不要伪造 id,返回的 id 必须都存在 <Cites></Cites> 中!
|
||||||
|
|
||||||
|
## 通用规则
|
||||||
|
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Cites></Cites> 获取的知识。
|
||||||
|
- 保持答案与 <Cites></Cites> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
<Cites>
|
||||||
|
{{quote}}
|
||||||
|
</Cites>
|
||||||
|
|
||||||
|
## 用户问题
|
||||||
|
|
||||||
|
{{question}}
|
||||||
|
|
||||||
|
## 回答
|
||||||
|
`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.qa_template'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
作为一个问答助手,你会使用 <QA></QA> 标记中的提供的数据对进行内容回答。
|
||||||
|
|
||||||
|
## 回答要求
|
||||||
|
- 选择其中一个或多个问答对进行回答。
|
||||||
|
- 回答的内容应尽可能与 <Answer></Answer> 中的内容一致。
|
||||||
|
- 如果没有相关的问答对,你需要澄清。
|
||||||
|
- 避免提及你是从 <QA></QA> 获取的知识,只需要回复答案。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
<QA>
|
||||||
|
{{quote}}
|
||||||
|
</QA>
|
||||||
|
|
||||||
|
## 用户问题
|
||||||
|
|
||||||
|
{{question}}
|
||||||
|
|
||||||
|
## 回答
|
||||||
|
`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.standard_strict'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
你是一个知识库回答助手,可以使用 <Cites></Cites> 中的内容作为你本次回答的参考。
|
||||||
|
同时,为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记,标识参考了哪些内容。
|
||||||
|
|
||||||
|
## 追溯展示规则
|
||||||
|
|
||||||
|
- 使用 [id](CITE) 的格式来引用 <Cites></Cites> 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在 **每段话结尾** 自然地整合引用。例如: "Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)。"。
|
||||||
|
- 每段话**至少包含一个引用**,多个引用时按顺序排列,例如:"Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)[67e517e74767063e882d6862](CITE)。\n 它的特点是非常轻量[67e517e74767063e882d6863](CITE)。"
|
||||||
|
- 不要把示例作为知识点。
|
||||||
|
- 不要伪造 id,返回的 id 必须都存在 <Cites></Cites> 中!
|
||||||
|
|
||||||
|
## 通用规则
|
||||||
|
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Cites></Cites> 获取的知识。
|
||||||
|
- 保持答案与 <Cites></Cites> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
## 严格要求
|
||||||
|
|
||||||
|
你只能使用 <Cites></Cites> 标记中的内容作为参考,不能使用自身的知识,并且回答的内容需严格与 <Cites></Cites> 中的内容一致。
|
||||||
|
|
||||||
|
<Cites>
|
||||||
|
{{quote}}
|
||||||
|
</Cites>
|
||||||
|
|
||||||
|
## 用户问题
|
||||||
|
|
||||||
|
{{question}}
|
||||||
|
|
||||||
|
## 回答
|
||||||
|
`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.hard_strict'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
作为一个问答助手,你会使用 <QA></QA> 标记中的提供的数据对进行内容回答。
|
||||||
|
|
||||||
|
## 回答要求
|
||||||
|
- 选择其中一个或多个问答对进行回答。
|
||||||
|
- 回答的内容应尽可能与 <Answer></Answer> 中的内容一致。
|
||||||
|
- 如果没有相关的问答对,你需要澄清。
|
||||||
|
- 避免提及你是从 <QA></QA> 获取的知识,只需要回复答案。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
## 严格要求
|
||||||
|
|
||||||
|
你只能使用 <QA></QA> 标记中的内容作为参考,不能使用自身的知识,并且回答的内容需严格与 <QA></QA> 中的内容一致。
|
||||||
|
|
||||||
|
<QA>
|
||||||
|
{{quote}}
|
||||||
|
</QA>
|
||||||
|
|
||||||
|
## 用户问题
|
||||||
|
|
||||||
|
{{question}}
|
||||||
|
|
||||||
|
## 回答
|
||||||
|
`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const Prompt_systemQuotePromptList: PromptTemplateItem[] = [
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.standard_template'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
你是一个知识库回答助手,可以使用 <Cites></Cites> 中的内容作为你本次回答的参考。
|
||||||
|
同时,为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记,标识参考了哪些内容。
|
||||||
|
|
||||||
|
## 追溯展示规则
|
||||||
|
|
||||||
|
- 使用 [id](CITE) 的格式来引用 <Cites></Cites> 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在 **每段话结尾** 自然地整合引用。例如: "Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)。"。
|
||||||
|
- 每段话**至少包含一个引用**,多个引用时按顺序排列,例如:"Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)[67e517e74767063e882d6862](CITE)。\n 它的特点是非常轻量[67e517e74767063e882d6863](CITE)。"
|
||||||
|
- 不要把示例作为知识点。
|
||||||
|
- 不要伪造 id,返回的 id 必须都存在 <Cites></Cites> 中!
|
||||||
|
|
||||||
|
## 通用规则
|
||||||
|
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Cites></Cites> 获取的知识。
|
||||||
|
- 保持答案与 <Cites></Cites> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
<Cites>
|
||||||
|
{{quote}}
|
||||||
|
</Cites>`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.qa_template'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.8']: `## 任务描述
|
||||||
|
作为一个问答助手,你会使用 <QA></QA> 标记中的提供的数据对进行内容回答。
|
||||||
|
|
||||||
|
## 回答要求
|
||||||
|
- 选择其中一个或多个问答对进行回答。
|
||||||
|
- 回答的内容应尽可能与 <Answer></Answer> 中的内容一致。
|
||||||
|
- 如果没有相关的问答对,你需要澄清。
|
||||||
|
- 避免提及你是从 <QA></QA> 获取的知识,只需要回复答案。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
<QA>
|
||||||
|
{{quote}}
|
||||||
|
</QA>`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.standard_strict'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
你是一个知识库回答助手,可以使用 <Cites></Cites> 中的内容作为你本次回答的参考。
|
||||||
|
同时,为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记,标识参考了哪些内容。
|
||||||
|
|
||||||
|
## 追溯展示规则
|
||||||
|
|
||||||
|
- 使用 [id](CITE) 的格式来引用 <Cites></Cites> 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在 **每段话结尾** 自然地整合引用。例如: "Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)。"。
|
||||||
|
- 每段话**至少包含一个引用**,多个引用时按顺序排列,例如:"Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)[67e517e74767063e882d6862](CITE)。\n 它的特点是非常轻量[67e517e74767063e882d6863](CITE)。"
|
||||||
|
- 不要把示例作为知识点。
|
||||||
|
- 不要伪造 id,返回的 id 必须都存在 <Cites></Cites> 中!
|
||||||
|
|
||||||
|
## 通用规则
|
||||||
|
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Cites></Cites> 获取的知识。
|
||||||
|
- 保持答案与 <Cites></Cites> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
## 严格要求
|
||||||
|
|
||||||
|
你只能使用 <Cites></Cites> 标记中的内容作为参考,不能使用自身的知识,并且回答的内容需严格与 <Cites></Cites> 中的内容一致。
|
||||||
|
|
||||||
|
<Cites>
|
||||||
|
{{quote}}
|
||||||
|
</Cites>`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18nT('app:template.hard_strict'),
|
||||||
|
desc: '',
|
||||||
|
value: {
|
||||||
|
['4.9.7']: `## 任务描述
|
||||||
|
作为一个问答助手,你会使用 <QA></QA> 标记中的提供的数据对进行内容回答。
|
||||||
|
|
||||||
|
## 回答要求
|
||||||
|
- 选择其中一个或多个问答对进行回答。
|
||||||
|
- 回答的内容应尽可能与 <Answer></Answer> 中的内容一致。
|
||||||
|
- 如果没有相关的问答对,你需要澄清。
|
||||||
|
- 避免提及你是从 <QA></QA> 获取的知识,只需要回复答案。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
|
## 严格要求
|
||||||
|
|
||||||
|
你只能使用 <QA></QA> 标记中的内容作为参考,不能使用自身的知识,并且回答的内容需严格与 <QA></QA> 中的内容一致。
|
||||||
|
|
||||||
|
<QA>
|
||||||
|
{{quote}}
|
||||||
|
</QA>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||||
{
|
{
|
||||||
title: i18nT('app:template.standard_template'),
|
title: i18nT('app:template.standard_template'),
|
||||||
@@ -10,11 +252,6 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
['4.9.7']: `{
|
['4.9.7']: `{
|
||||||
"id": "{{id}}",
|
"id": "{{id}}",
|
||||||
"sourceName": "{{source}}",
|
"sourceName": "{{source}}",
|
||||||
"content": "{{q}}\n{{a}}"
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
['4.9.2']: `{
|
|
||||||
"sourceName": "{{source}}",
|
|
||||||
"updateTime": "{{updateTime}}",
|
"updateTime": "{{updateTime}}",
|
||||||
"content": "{{q}}\n{{a}}"
|
"content": "{{q}}\n{{a}}"
|
||||||
}
|
}
|
||||||
@@ -25,7 +262,7 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.qa_template'),
|
title: i18nT('app:template.qa_template'),
|
||||||
desc: i18nT('app:template.qa_template_des'),
|
desc: i18nT('app:template.qa_template_des'),
|
||||||
value: {
|
value: {
|
||||||
['4.9.2']: `<Question>
|
['4.9.7']: `<Question>
|
||||||
{{q}}
|
{{q}}
|
||||||
</Question>
|
</Question>
|
||||||
<Answer>
|
<Answer>
|
||||||
@@ -40,11 +277,6 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
['4.9.7']: `{
|
['4.9.7']: `{
|
||||||
"id": "{{id}}",
|
"id": "{{id}}",
|
||||||
"sourceName": "{{source}}",
|
"sourceName": "{{source}}",
|
||||||
"content": "{{q}}\n{{a}}"
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
['4.9.2']: `{
|
|
||||||
"sourceName": "{{source}}",
|
|
||||||
"updateTime": "{{updateTime}}",
|
"updateTime": "{{updateTime}}",
|
||||||
"content": "{{q}}\n{{a}}"
|
"content": "{{q}}\n{{a}}"
|
||||||
}
|
}
|
||||||
@@ -55,7 +287,7 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.hard_strict'),
|
title: i18nT('app:template.hard_strict'),
|
||||||
desc: i18nT('app:template.hard_strict_des'),
|
desc: i18nT('app:template.hard_strict_des'),
|
||||||
value: {
|
value: {
|
||||||
['4.9.2']: `<Question>
|
['4.9.7']: `<Question>
|
||||||
{{q}}
|
{{q}}
|
||||||
</Question>
|
</Question>
|
||||||
<Answer>
|
<Answer>
|
||||||
@@ -64,287 +296,25 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const getQuoteTemplate = (version?: string) => {
|
export const getQuoteTemplate = (version?: string) => {
|
||||||
const defaultTemplate = Prompt_QuoteTemplateList[0].value;
|
const defaultTemplate = Prompt_QuoteTemplateList[0].value;
|
||||||
|
|
||||||
return getPromptByVersion(version, defaultTemplate);
|
return getPromptByVersion(version, defaultTemplate);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Prompt_userQuotePromptList: PromptTemplateItem[] = [
|
export const getQuotePrompt = (version?: string, role: 'user' | 'system' = 'user') => {
|
||||||
{
|
|
||||||
title: i18nT('app:template.standard_template'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.7']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果你不清楚答案,你需要澄清。
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
- 使用 [id](QUOTE) 格式来引用<Reference></Reference>中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`,
|
|
||||||
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果你不清楚答案,你需要澄清。
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.qa_template'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.2']: `使用 <QA></QA> 标记中的问答对进行回答。
|
|
||||||
|
|
||||||
<QA>
|
|
||||||
{{quote}}
|
|
||||||
</QA>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 选择其中一个或多个问答对进行回答。
|
|
||||||
- 回答的内容应尽可能与 <答案></答案> 中的内容一致。
|
|
||||||
- 如果没有相关的问答对,你需要澄清。
|
|
||||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.standard_strict'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.7']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
|
||||||
2. 如果有关,你按下面的要求回答。
|
|
||||||
3. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
- 使用 [id](QUOTE) 格式来引用<Reference></Reference>中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`,
|
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
|
||||||
2. 如果有关,你按下面的要求回答。
|
|
||||||
3. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.hard_strict'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
|
||||||
|
|
||||||
<QA>
|
|
||||||
{{quote}}
|
|
||||||
</QA>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <QA></QA> 标记中的内容有关。
|
|
||||||
2. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
3. 判断是否有相近或相同的问题。
|
|
||||||
4. 如果有相同的问题,直接输出对应答案。
|
|
||||||
5. 如果只有相近的问题,请把相近的问题和答案一起输出。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果没有相关的问答对,你需要澄清。
|
|
||||||
- 回答的内容应尽可能与 <QA></QA> 标记中的内容一致。
|
|
||||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
export const Prompt_systemQuotePromptList: PromptTemplateItem[] = [
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.standard_template'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.7']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果你不清楚答案,你需要澄清。
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
- 使用 [id](QUOTE) 格式来引用<Reference></Reference>中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`,
|
|
||||||
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果你不清楚答案,你需要澄清。
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.qa_template'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.2']: `使用 <QA></QA> 标记中的问答对进行回答。
|
|
||||||
|
|
||||||
<QA>
|
|
||||||
{{quote}}
|
|
||||||
</QA>
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 选择其中一个或多个问答对进行回答。
|
|
||||||
- 回答的内容应尽可能与 <答案></答案> 中的内容一致。
|
|
||||||
- 如果没有相关的问答对,你需要澄清。
|
|
||||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.standard_strict'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.7']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
|
||||||
2. 如果有关,你按下面的要求回答。
|
|
||||||
3. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
- 使用 [id](QUOTE) 格式来引用<Reference></Reference>中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。
|
|
||||||
|
|
||||||
问题:"""{{question}}"""`,
|
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
|
||||||
|
|
||||||
<Reference>
|
|
||||||
{{quote}}
|
|
||||||
</Reference>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
|
||||||
2. 如果有关,你按下面的要求回答。
|
|
||||||
3. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
|
||||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: i18nT('app:template.hard_strict'),
|
|
||||||
desc: '',
|
|
||||||
value: {
|
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
|
||||||
|
|
||||||
<QA>
|
|
||||||
{{quote}}
|
|
||||||
</QA>
|
|
||||||
|
|
||||||
思考流程:
|
|
||||||
1. 判断问题是否与 <QA></QA> 标记中的内容有关。
|
|
||||||
2. 如果无关,你直接拒绝回答本次问题。
|
|
||||||
3. 判断是否有相近或相同的问题。
|
|
||||||
4. 如果有相同的问题,直接输出对应答案。
|
|
||||||
5. 如果只有相近的问题,请把相近的问题和答案一起输出。
|
|
||||||
|
|
||||||
回答要求:
|
|
||||||
- 如果没有相关的问答对,你需要澄清。
|
|
||||||
- 回答的内容应尽可能与 <QA></QA> 标记中的内容一致。
|
|
||||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。
|
|
||||||
- 使用 Markdown 语法优化回答格式。
|
|
||||||
- 使用与问题相同的语言回答。`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
export const getQuotePrompt = (
|
|
||||||
version?: string,
|
|
||||||
role: 'user' | 'system' = 'user',
|
|
||||||
parseQuote = true
|
|
||||||
) => {
|
|
||||||
const quotePromptTemplates =
|
const quotePromptTemplates =
|
||||||
role === 'user' ? Prompt_userQuotePromptList : Prompt_systemQuotePromptList;
|
role === 'user' ? Prompt_userQuotePromptList : Prompt_systemQuotePromptList;
|
||||||
|
|
||||||
const defaultTemplate = quotePromptTemplates[0].value;
|
const defaultTemplate = quotePromptTemplates[0].value;
|
||||||
|
|
||||||
return parseQuote
|
return getPromptByVersion(version, defaultTemplate);
|
||||||
? getPromptByVersion(version, defaultTemplate)
|
|
||||||
: getPromptByVersion(version, defaultTemplate).replace(
|
|
||||||
`- 使用 [id](QUOTE) 格式来引用<Reference></Reference>中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`,
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Document quote prompt
|
// Document quote prompt
|
||||||
export const getDocumentQuotePrompt = (version: string) => {
|
export const getDocumentQuotePrompt = (version?: string) => {
|
||||||
const promptMap = {
|
const promptMap = {
|
||||||
['4.9.2']: `将 <FilesContent></FilesContent> 中的内容作为本次对话的参考:
|
['4.9.7']: `将 <FilesContent></FilesContent> 中的内容作为本次对话的参考:
|
||||||
<FilesContent>
|
<FilesContent>
|
||||||
{{quote}}
|
{{quote}}
|
||||||
</FilesContent>
|
</FilesContent>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const getExtractJsonToolPrompt = (version?: string) => {
|
|||||||
"""
|
"""
|
||||||
- {{description}}
|
- {{description}}
|
||||||
- 不是每个参数都是必须生成的,如果没有合适的参数值,不要生成该参数,或返回空字符串。
|
- 不是每个参数都是必须生成的,如果没有合适的参数值,不要生成该参数,或返回空字符串。
|
||||||
- 需要结合前面的对话内容,一起生成合适的参数。
|
- 需要结合历史记录,一起生成合适的参数。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
本次输入内容: """{{content}}"""
|
本次输入内容: """{{content}}"""
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
export const getDatasetSearchToolResponsePrompt = (parseQuote: boolean) => {
|
export const getDatasetSearchToolResponsePrompt = () => {
|
||||||
return parseQuote
|
return `## Role
|
||||||
? `## Role
|
你是一个知识库回答助手,可以 "cites" 中的内容作为本次对话的参考。为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记,标识参考了哪些内容。
|
||||||
你是一个知识库回答助手,可以 "quotes" 中的内容作为本次对话的参考。为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记。
|
|
||||||
|
|
||||||
## Rules
|
## 追溯展示规则
|
||||||
- 如果你不清楚答案,你需要澄清。
|
|
||||||
- 避免提及你是从 "quotes" 获取的知识。
|
|
||||||
- 保持答案与 "quotes" 中描述的一致。
|
|
||||||
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
|
||||||
- 使用与问题相同的语言回答。
|
|
||||||
- 使用 [id](QUOTE) 格式来引用 "quotes" 中的知识,其中 QUOTE 是固定常量, id 为引文中的 id。
|
|
||||||
- 在每段话结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](QUOTE)。"
|
|
||||||
- 每段话至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`
|
|
||||||
: `## Role
|
|
||||||
你是一个知识库回答助手,可以 "quotes" 中的内容作为本次对话的参考。
|
|
||||||
|
|
||||||
## Rules
|
- 使用 **[id](CITE)** 格式来引用 "cites" 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在 **每段话结尾** 自然地整合引用。例如: "Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)。"。
|
||||||
|
- 每段话**至少包含一个引用**,多个引用时按顺序排列,例如:"Nginx是一款轻量级的Web服务器、反向代理服务器[67e517e74767063e882d6861](CITE)[67e517e74767063e882d6862](CITE)。\n 它的特点是非常轻量[67e517e74767063e882d6863](CITE)。"
|
||||||
|
- 不要把示例作为知识点。
|
||||||
|
- 不要伪造 id,返回的 id 必须都存在 cites 中!
|
||||||
|
|
||||||
|
## 通用规则
|
||||||
- 如果你不清楚答案,你需要澄清。
|
- 如果你不清楚答案,你需要澄清。
|
||||||
- 避免提及你是从 "quotes" 获取的知识。
|
- 避免提及你是从 "cites" 获取的知识。
|
||||||
- 保持答案与 "quotes" 中描述的一致。
|
- 保持答案与 "cites" 中描述的一致。
|
||||||
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
- 使用与问题相同的语言回答。`;
|
- 使用与问题相同的语言回答。`;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export const getPromptByVersion = (version?: string, promptMap: Record<string, string> = {}) => {
|
export const getPromptByVersion = (version?: string, promptMap: Record<string, string> = {}) => {
|
||||||
|
// 版本号大的在前面
|
||||||
const versions = Object.keys(promptMap).sort((a, b) => {
|
const versions = Object.keys(promptMap).sort((a, b) => {
|
||||||
const [majorA, minorA, patchA] = a.split('.').map(Number);
|
const [majorA, minorA, patchA] = a.split('.').map(Number);
|
||||||
const [majorB, minorB, patchB] = b.split('.').map(Number);
|
const [majorB, minorB, patchB] = b.split('.').map(Number);
|
||||||
@@ -15,5 +16,5 @@ export const getPromptByVersion = (version?: string, promptMap: Record<string, s
|
|||||||
if (version in promptMap) {
|
if (version in promptMap) {
|
||||||
return promptMap[version];
|
return promptMap[version];
|
||||||
}
|
}
|
||||||
return promptMap[versions[versions.length - 1]];
|
return promptMap[versions[0]];
|
||||||
};
|
};
|
||||||
|
|||||||
5
packages/global/core/ai/type.d.ts
vendored
5
packages/global/core/ai/type.d.ts
vendored
@@ -9,8 +9,8 @@ import type {
|
|||||||
ChatCompletionAssistantMessageParam as SdkChatCompletionAssistantMessageParam
|
ChatCompletionAssistantMessageParam as SdkChatCompletionAssistantMessageParam
|
||||||
} from 'openai/resources';
|
} from 'openai/resources';
|
||||||
import { ChatMessageTypeEnum } from './constants';
|
import { ChatMessageTypeEnum } from './constants';
|
||||||
import { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
import type { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
||||||
import { Stream } from 'openai/streaming';
|
import type { Stream } from 'openai/streaming';
|
||||||
export * from 'openai/resources';
|
export * from 'openai/resources';
|
||||||
|
|
||||||
// Extension of ChatCompletionMessageParam, Add file url type
|
// Extension of ChatCompletionMessageParam, Add file url type
|
||||||
@@ -60,6 +60,7 @@ export type ChatCompletionAssistantToolParam = {
|
|||||||
tool_calls: ChatCompletionMessageToolCall[];
|
tool_calls: ChatCompletionMessageToolCall[];
|
||||||
};
|
};
|
||||||
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
|
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
|
||||||
|
index?: number;
|
||||||
toolName?: string;
|
toolName?: string;
|
||||||
toolAvatar?: string;
|
toolAvatar?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
AppTTSConfigType,
|
type AppTTSConfigType,
|
||||||
AppFileSelectConfigType,
|
type AppFileSelectConfigType,
|
||||||
AppWhisperConfigType,
|
type AppWhisperConfigType,
|
||||||
AppAutoExecuteConfigType,
|
type AppAutoExecuteConfigType,
|
||||||
AppQGConfigType
|
type AppQGConfigType
|
||||||
} from './type';
|
} from './type';
|
||||||
|
|
||||||
export enum AppTypeEnum {
|
export enum AppTypeEnum {
|
||||||
@@ -60,5 +60,3 @@ export enum AppTemplateTypeEnum {
|
|||||||
// special type
|
// special type
|
||||||
contribute = 'contribute'
|
contribute = 'contribute'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultDatasetMaxTokens = 16000;
|
|
||||||
|
|||||||
6
packages/global/core/app/controller.d.ts
vendored
6
packages/global/core/app/controller.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { ParentIdType } from 'common/parentFolder/type';
|
import type { ParentIdType } from 'common/parentFolder/type';
|
||||||
import { AppSchema } from './type';
|
import type { AppSchema } from './type';
|
||||||
import { AppTypeEnum } from './constants';
|
import type { AppTypeEnum } from './constants';
|
||||||
|
|
||||||
export type CreateAppProps = {
|
export type CreateAppProps = {
|
||||||
parentId?: ParentIdType;
|
parentId?: ParentIdType;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { getNanoid } from '../../../common/string/tools';
|
import { getNanoid } from '../../../common/string/tools';
|
||||||
import { OpenApiJsonSchema } from './type';
|
import { type OpenApiJsonSchema } from './type';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { OpenAPIV3 } from 'openapi-types';
|
import type { OpenAPIV3 } from 'openapi-types';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
|
import { type FlowNodeInputItemType, type FlowNodeOutputItemType } from '../../workflow/type/io';
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
||||||
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||||
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
||||||
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
||||||
import { HttpNode468 } from '../../workflow/template/system/http468';
|
import { HttpNode468 } from '../../workflow/template/system/http468';
|
||||||
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
import { type HttpParamAndHeaderItemType } from '../../workflow/api';
|
||||||
import { StoreNodeItemType } from '../../workflow/type/node';
|
import { type StoreNodeItemType } from '../../workflow/type/node';
|
||||||
import { HttpImgUrl } from '../../../common/file/image/constants';
|
import { HttpImgUrl } from '../../../common/file/image/constants';
|
||||||
import SwaggerParser from '@apidevtools/swagger-parser';
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
||||||
import { getHandleId } from '../../workflow/utils';
|
import { getHandleId } from '../../workflow/utils';
|
||||||
import { CreateHttpPluginChildrenPros } from '../controller';
|
import { type CreateHttpPluginChildrenPros } from '../controller';
|
||||||
import { AppTypeEnum } from '../constants';
|
import { AppTypeEnum } from '../constants';
|
||||||
import type { StoreEdgeItemType } from '../../workflow/type/edge';
|
import type { StoreEdgeItemType } from '../../workflow/type/edge';
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../workflow/node/constant';
|
} from '../../workflow/node/constant';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { ToolType } from '../type';
|
import { type McpToolConfigType } from '../type';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { RuntimeNodeItemType } from '../../workflow/runtime/type';
|
import { type RuntimeNodeItemType } from '../../workflow/runtime/type';
|
||||||
|
|
||||||
export const getMCPToolSetRuntimeNode = ({
|
export const getMCPToolSetRuntimeNode = ({
|
||||||
url,
|
url,
|
||||||
@@ -16,7 +16,7 @@ export const getMCPToolSetRuntimeNode = ({
|
|||||||
avatar
|
avatar
|
||||||
}: {
|
}: {
|
||||||
url: string;
|
url: string;
|
||||||
toolList: ToolType[];
|
toolList: McpToolConfigType[];
|
||||||
name?: string;
|
name?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
}): RuntimeNodeItemType => {
|
}): RuntimeNodeItemType => {
|
||||||
@@ -45,7 +45,7 @@ export const getMCPToolRuntimeNode = ({
|
|||||||
url,
|
url,
|
||||||
avatar = 'core/app/type/mcpToolsFill'
|
avatar = 'core/app/type/mcpToolsFill'
|
||||||
}: {
|
}: {
|
||||||
tool: ToolType;
|
tool: McpToolConfigType;
|
||||||
url: string;
|
url: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
}): RuntimeNodeItemType => {
|
}): RuntimeNodeItemType => {
|
||||||
@@ -65,7 +65,7 @@ export const getMCPToolRuntimeNode = ({
|
|||||||
...Object.entries(tool.inputSchema?.properties || {}).map(([key, value]) => ({
|
...Object.entries(tool.inputSchema?.properties || {}).map(([key, value]) => ({
|
||||||
key,
|
key,
|
||||||
label: key,
|
label: key,
|
||||||
valueType: value.type as WorkflowIOValueTypeEnum,
|
valueType: value.type as WorkflowIOValueTypeEnum, // TODO: 这里需要做一个映射
|
||||||
description: value.description,
|
description: value.description,
|
||||||
toolDescription: value.description || key,
|
toolDescription: value.description || key,
|
||||||
required: tool.inputSchema?.required?.includes(key) || false,
|
required: tool.inputSchema?.required?.includes(key) || false,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { StoreNodeItemType } from '../../workflow/type/node';
|
import { type StoreNodeItemType } from '../../workflow/type/node';
|
||||||
import { FlowNodeInputItemType } from '../../workflow/type/io';
|
import { type FlowNodeInputItemType } from '../../workflow/type/io';
|
||||||
import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
||||||
|
|
||||||
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
||||||
|
|||||||
38
packages/global/core/app/type.d.ts
vendored
38
packages/global/core/app/type.d.ts
vendored
@@ -1,30 +1,20 @@
|
|||||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { AppTypeEnum } from './constants';
|
import type { AppTypeEnum } from './constants';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import {
|
import type {
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
VariableInputEnum,
|
VariableInputEnum,
|
||||||
WorkflowIOValueTypeEnum
|
WorkflowIOValueTypeEnum
|
||||||
} from '../workflow/constants';
|
} from '../workflow/constants';
|
||||||
import { SelectedDatasetType } from '../workflow/api';
|
import type { SelectedDatasetType } from '../workflow/api';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import type { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import type { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { AppPermission } from '../../support/permission/app/controller';
|
import type { AppPermission } from '../../support/permission/app/controller';
|
||||||
import { ParentIdType } from '../../common/parentFolder/type';
|
import type { ParentIdType } from '../../common/parentFolder/type';
|
||||||
import { FlowNodeInputTypeEnum } from '../../core/workflow/node/constant';
|
import { FlowNodeInputTypeEnum } from '../../core/workflow/node/constant';
|
||||||
import { WorkflowTemplateBasicType } from '@fastgpt/global/core/workflow/type';
|
import type { WorkflowTemplateBasicType } from '@fastgpt/global/core/workflow/type';
|
||||||
import { SourceMemberType } from '../../support/user/type';
|
import type { SourceMemberType } from '../../support/user/type';
|
||||||
|
|
||||||
export type ToolType = {
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
inputSchema: {
|
|
||||||
type: string;
|
|
||||||
properties?: Record<string, { type: string; description?: string }>;
|
|
||||||
required?: string[];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AppSchema = {
|
export type AppSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -117,6 +107,16 @@ export type AppSimpleEditFormType = {
|
|||||||
chatConfig: AppChatConfigType;
|
chatConfig: AppChatConfigType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type McpToolConfigType = {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
inputSchema: {
|
||||||
|
type: string;
|
||||||
|
properties?: Record<string, { type: string; description?: string }>;
|
||||||
|
required?: string[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/* app chat config type */
|
/* app chat config type */
|
||||||
export type AppChatConfigType = {
|
export type AppChatConfigType = {
|
||||||
welcomeText?: string;
|
welcomeText?: string;
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
|||||||
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
||||||
import { getAppChatConfig } from '../workflow/utils';
|
import { getAppChatConfig } from '../workflow/utils';
|
||||||
import { StoreNodeItemType } from '../workflow/type/node';
|
import { type StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { WorkflowTemplateBasicType } from '../workflow/type';
|
import { type WorkflowTemplateBasicType } from '../workflow/type';
|
||||||
import { AppTypeEnum } from './constants';
|
import { AppTypeEnum } from './constants';
|
||||||
import { AppErrEnum } from '../../common/error/code/app';
|
import { AppErrEnum } from '../../common/error/code/app';
|
||||||
import { PluginErrEnum } from '../../common/error/code/plugin';
|
import { PluginErrEnum } from '../../common/error/code/plugin';
|
||||||
|
import { i18nT } from '../../../web/i18n/utils';
|
||||||
|
import appErrList from '../../common/error/code/app';
|
||||||
|
import pluginErrList from '../../common/error/code/plugin';
|
||||||
|
|
||||||
export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
||||||
return {
|
return {
|
||||||
@@ -189,17 +192,10 @@ export const getAppType = (config?: WorkflowTemplateBasicType | AppSimpleEditFor
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkAppUnExistError = (error?: string) => {
|
export const formatToolError = (error?: any) => {
|
||||||
const unExistError: Array<string> = [
|
if (!error || typeof error !== 'string') return;
|
||||||
AppErrEnum.unAuthApp,
|
|
||||||
AppErrEnum.unExist,
|
|
||||||
PluginErrEnum.unAuth,
|
|
||||||
PluginErrEnum.unExist
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!!error && unExistError.includes(error)) {
|
const errorText = appErrList[error]?.message || pluginErrList[error]?.message;
|
||||||
return error;
|
|
||||||
} else {
|
return errorText || error;
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
5
packages/global/core/app/version.d.ts
vendored
5
packages/global/core/app/version.d.ts
vendored
@@ -1,7 +1,8 @@
|
|||||||
import { TeamMemberStatusEnum } from 'support/user/team/constant';
|
import { TeamMemberStatusEnum } from 'support/user/team/constant';
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { AppChatConfigType, AppSchema } from './type';
|
import type { AppSchema } from './type';
|
||||||
import { SourceMemberType } from 'support/user/type';
|
import { AppChatConfigType } from './type';
|
||||||
|
import type { SourceMemberType } from 'support/user/type';
|
||||||
|
|
||||||
export type AppVersionSchemaType = {
|
export type AppVersionSchemaType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
2
packages/global/core/chat/api.d.ts
vendored
2
packages/global/core/chat/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { OutLinkChatAuthProps } from '../../support/permission/chat';
|
import type { OutLinkChatAuthProps } from '../../support/permission/chat';
|
||||||
|
|
||||||
export type UpdateChatFeedbackProps = OutLinkChatAuthProps & {
|
export type UpdateChatFeedbackProps = OutLinkChatAuthProps & {
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|||||||
24
packages/global/core/chat/type.d.ts
vendored
24
packages/global/core/chat/type.d.ts
vendored
@@ -1,22 +1,23 @@
|
|||||||
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
||||||
import { SearchDataResponseItemType } from '../dataset/type';
|
import type { SearchDataResponseItemType } from '../dataset/type';
|
||||||
import {
|
import type {
|
||||||
ChatFileTypeEnum,
|
ChatFileTypeEnum,
|
||||||
ChatItemValueTypeEnum,
|
ChatItemValueTypeEnum,
|
||||||
ChatRoleEnum,
|
ChatRoleEnum,
|
||||||
ChatSourceEnum,
|
ChatSourceEnum,
|
||||||
ChatStatusEnum
|
ChatStatusEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
import type { FlowNodeTypeEnum } from '../workflow/node/constant';
|
||||||
import { NodeOutputKeyEnum } from '../workflow/constants';
|
import type { NodeOutputKeyEnum } from '../workflow/constants';
|
||||||
import { DispatchNodeResponseKeyEnum } from '../workflow/runtime/constants';
|
import type { DispatchNodeResponseKeyEnum } from '../workflow/runtime/constants';
|
||||||
import { AppChatConfigType, AppSchema, VariableItemType } from '../app/type';
|
import type { AppSchema, VariableItemType } from '../app/type';
|
||||||
|
import { AppChatConfigType } from '../app/type';
|
||||||
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
import type { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
||||||
import { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
import type { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
||||||
import { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
import type { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
||||||
import { FlowNodeInputItemType } from '../workflow/type/io';
|
import type { FlowNodeInputItemType } from '../workflow/type/io';
|
||||||
|
|
||||||
export type ChatSchema = {
|
export type ChatSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -25,6 +26,7 @@ export type ChatSchema = {
|
|||||||
teamId: string;
|
teamId: string;
|
||||||
tmbId: string;
|
tmbId: string;
|
||||||
appId: string;
|
appId: string;
|
||||||
|
createTime: Date;
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
title: string;
|
title: string;
|
||||||
customTitle: string;
|
customTitle: string;
|
||||||
@@ -111,6 +113,7 @@ export type ChatItemSchema = (UserChatItemType | SystemChatItemType | AIChatItem
|
|||||||
appId: string;
|
appId: string;
|
||||||
time: Date;
|
time: Date;
|
||||||
durationSeconds?: number;
|
durationSeconds?: number;
|
||||||
|
errorMsg?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AdminFbkType = {
|
export type AdminFbkType = {
|
||||||
@@ -142,6 +145,7 @@ export type ChatSiteItemType = (UserChatItemType | SystemChatItemType | AIChatIt
|
|||||||
responseData?: ChatHistoryItemResType[];
|
responseData?: ChatHistoryItemResType[];
|
||||||
time?: Date;
|
time?: Date;
|
||||||
durationSeconds?: number;
|
durationSeconds?: number;
|
||||||
|
errorMsg?: string;
|
||||||
} & ChatBoxInputType &
|
} & ChatBoxInputType &
|
||||||
ResponseTagItemType;
|
ResponseTagItemType;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { DispatchNodeResponseType } from '../workflow/runtime/type';
|
import { type DispatchNodeResponseType } from '../workflow/runtime/type';
|
||||||
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
||||||
import { ChatItemValueTypeEnum, ChatRoleEnum, ChatSourceEnum } from './constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum, ChatSourceEnum } from './constants';
|
||||||
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
|
import {
|
||||||
|
type AIChatItemValueItemType,
|
||||||
|
type ChatHistoryItemResType,
|
||||||
|
type ChatItemType,
|
||||||
|
type UserChatItemValueItemType
|
||||||
|
} from './type.d';
|
||||||
import { sliceStrStartEnd } from '../../common/string/tools';
|
import { sliceStrStartEnd } from '../../common/string/tools';
|
||||||
import { PublishChannelEnum } from '../../support/outLink/constant';
|
import { PublishChannelEnum } from '../../support/outLink/constant';
|
||||||
|
import { removeDatasetCiteText } from '../../../service/core/ai/utils';
|
||||||
|
|
||||||
// Concat 2 -> 1, and sort by role
|
// Concat 2 -> 1, and sort by role
|
||||||
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
|
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
|
||||||
@@ -77,6 +83,7 @@ export const getHistoryPreview = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Filter workflow public response
|
||||||
export const filterPublicNodeResponseData = ({
|
export const filterPublicNodeResponseData = ({
|
||||||
flowResponses = [],
|
flowResponses = [],
|
||||||
responseDetail = false
|
responseDetail = false
|
||||||
@@ -112,6 +119,40 @@ export const filterPublicNodeResponseData = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove dataset cite in ai response
|
||||||
|
export const removeAIResponseCite = <T extends AIChatItemValueItemType[] | string>(
|
||||||
|
value: T,
|
||||||
|
retainCite: boolean
|
||||||
|
): T => {
|
||||||
|
if (retainCite) return value;
|
||||||
|
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return removeDatasetCiteText(value, false) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.map<AIChatItemValueItemType>((item) => {
|
||||||
|
if (item.text?.content) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
text: {
|
||||||
|
...item.text,
|
||||||
|
content: removeDatasetCiteText(item.text.content, false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item.reasoning?.content) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
reasoning: {
|
||||||
|
...item.reasoning,
|
||||||
|
content: removeDatasetCiteText(item.reasoning.content, false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}) as T;
|
||||||
|
};
|
||||||
|
|
||||||
export const removeEmptyUserInput = (input?: UserChatItemValueItemType[]) => {
|
export const removeEmptyUserInput = (input?: UserChatItemValueItemType[]) => {
|
||||||
return (
|
return (
|
||||||
input?.filter((item) => {
|
input?.filter((item) => {
|
||||||
|
|||||||
35
packages/global/core/dataset/api.d.ts
vendored
35
packages/global/core/dataset/api.d.ts
vendored
@@ -1,12 +1,14 @@
|
|||||||
import { DatasetDataIndexItemType, DatasetSchemaType } from './type';
|
import type { ChunkSettingsType, DatasetDataIndexItemType, DatasetSchemaType } from './type';
|
||||||
import {
|
import type {
|
||||||
DatasetCollectionTypeEnum,
|
DatasetCollectionTypeEnum,
|
||||||
DatasetCollectionDataProcessModeEnum,
|
DatasetCollectionDataProcessModeEnum,
|
||||||
ChunkSettingModeEnum,
|
ChunkSettingModeEnum,
|
||||||
DataChunkSplitModeEnum
|
DataChunkSplitModeEnum,
|
||||||
|
ChunkTriggerConfigTypeEnum,
|
||||||
|
ParagraphChunkAIModeEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import type { LLMModelItemType } from '../ai/model.d';
|
import type { LLMModelItemType } from '../ai/model.d';
|
||||||
import { ParentIdType } from 'common/parentFolder/type';
|
import type { ParentIdType } from 'common/parentFolder/type';
|
||||||
|
|
||||||
/* ================= dataset ===================== */
|
/* ================= dataset ===================== */
|
||||||
export type DatasetUpdateBody = {
|
export type DatasetUpdateBody = {
|
||||||
@@ -32,26 +34,16 @@ export type DatasetUpdateBody = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* ================= collection ===================== */
|
/* ================= collection ===================== */
|
||||||
export type DatasetCollectionChunkMetadataType = {
|
// Input + store params
|
||||||
|
type DatasetCollectionStoreDataType = ChunkSettingsType & {
|
||||||
parentId?: string;
|
parentId?: string;
|
||||||
customPdfParse?: boolean;
|
|
||||||
trainingType?: DatasetCollectionDataProcessModeEnum;
|
|
||||||
imageIndex?: boolean;
|
|
||||||
autoIndexes?: boolean;
|
|
||||||
|
|
||||||
chunkSettingMode?: ChunkSettingModeEnum;
|
|
||||||
chunkSplitMode?: DataChunkSplitModeEnum;
|
|
||||||
|
|
||||||
chunkSize?: number;
|
|
||||||
indexSize?: number;
|
|
||||||
|
|
||||||
chunkSplitter?: string;
|
|
||||||
qaPrompt?: string;
|
|
||||||
metadata?: Record<string, any>;
|
metadata?: Record<string, any>;
|
||||||
|
|
||||||
|
customPdfParse?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// create collection params
|
// create collection params
|
||||||
export type CreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
|
export type CreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: DatasetCollectionTypeEnum;
|
type: DatasetCollectionTypeEnum;
|
||||||
@@ -72,7 +64,7 @@ export type CreateDatasetCollectionParams = DatasetCollectionChunkMetadataType &
|
|||||||
nextSyncTime?: Date;
|
nextSyncTime?: Date;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ApiCreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
|
export type ApiCreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
};
|
};
|
||||||
@@ -90,7 +82,7 @@ export type ApiDatasetCreateDatasetCollectionParams = ApiCreateDatasetCollection
|
|||||||
export type FileIdCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
export type FileIdCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
||||||
fileId: string;
|
fileId: string;
|
||||||
};
|
};
|
||||||
export type reTrainingDatasetFileCollectionParams = DatasetCollectionChunkMetadataType & {
|
export type reTrainingDatasetFileCollectionParams = DatasetCollectionStoreDataType & {
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
};
|
};
|
||||||
@@ -147,6 +139,7 @@ export type PushDatasetDataProps = {
|
|||||||
collectionId: string;
|
collectionId: string;
|
||||||
data: PushDatasetDataChunkProps[];
|
data: PushDatasetDataChunkProps[];
|
||||||
trainingType?: DatasetCollectionDataProcessModeEnum;
|
trainingType?: DatasetCollectionDataProcessModeEnum;
|
||||||
|
indexSize?: number;
|
||||||
autoIndexes?: boolean;
|
autoIndexes?: boolean;
|
||||||
imageIndex?: boolean;
|
imageIndex?: boolean;
|
||||||
prompt?: string;
|
prompt?: string;
|
||||||
|
|||||||
32
packages/global/core/dataset/apiDataset.d.ts
vendored
32
packages/global/core/dataset/apiDataset.d.ts
vendored
@@ -1,8 +1,9 @@
|
|||||||
import { RequireOnlyOne } from '../../common/type/utils';
|
import { RequireOnlyOne } from '../../common/type/utils';
|
||||||
|
import type { ParentIdType } from '../../common/parentFolder/type.d';
|
||||||
|
|
||||||
export type APIFileItem = {
|
export type APIFileItem = {
|
||||||
id: string;
|
id: string;
|
||||||
parentId: string | null;
|
parentId: ParentIdType;
|
||||||
name: string;
|
name: string;
|
||||||
type: 'file' | 'folder';
|
type: 'file' | 'folder';
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
@@ -10,10 +11,24 @@ export type APIFileItem = {
|
|||||||
hasChild?: boolean;
|
hasChild?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Api dataset config
|
||||||
export type APIFileServer = {
|
export type APIFileServer = {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
authorization: string;
|
authorization?: string;
|
||||||
|
basePath?: string;
|
||||||
};
|
};
|
||||||
|
export type FeishuServer = {
|
||||||
|
appId: string;
|
||||||
|
appSecret?: string;
|
||||||
|
folderToken: string;
|
||||||
|
};
|
||||||
|
export type YuqueServer = {
|
||||||
|
userId: string;
|
||||||
|
token?: string;
|
||||||
|
basePath?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Api dataset api
|
||||||
|
|
||||||
export type APIFileListResponse = APIFileItem[];
|
export type APIFileListResponse = APIFileItem[];
|
||||||
|
|
||||||
@@ -26,13 +41,8 @@ export type APIFileReadResponse = {
|
|||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FeishuServer = {
|
export type ApiDatasetDetailResponse = {
|
||||||
appId: string;
|
id: string;
|
||||||
appSecret: string;
|
name: string;
|
||||||
folderToken: string;
|
parentId: ParentIdType;
|
||||||
};
|
|
||||||
|
|
||||||
export type YuqueServer = {
|
|
||||||
userId: string;
|
|
||||||
token: string;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { UpdateClbPermissionProps } from '../../support/permission/collaborator';
|
import type { UpdateClbPermissionProps } from '../../support/permission/collaborator';
|
||||||
import { PermissionValueType } from '../../support/permission/type';
|
import { PermissionValueType } from '../../support/permission/type';
|
||||||
import { RequireOnlyOne } from '../../common/type/utils';
|
import type { RequireOnlyOne } from '../../common/type/utils';
|
||||||
|
|
||||||
export type UpdateDatasetCollaboratorBody = UpdateClbPermissionProps & {
|
export type UpdateDatasetCollaboratorBody = UpdateClbPermissionProps & {
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DatasetCollectionTypeEnum } from '../constants';
|
import { DatasetCollectionTypeEnum } from '../constants';
|
||||||
import { DatasetCollectionSchemaType } from '../type';
|
import { type DatasetCollectionSchemaType } from '../type';
|
||||||
|
|
||||||
export const getCollectionSourceData = (collection?: DatasetCollectionSchemaType) => {
|
export const getCollectionSourceData = (collection?: DatasetCollectionSchemaType) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -19,32 +19,32 @@ export const DatasetTypeMap = {
|
|||||||
[DatasetTypeEnum.dataset]: {
|
[DatasetTypeEnum.dataset]: {
|
||||||
icon: 'core/dataset/commonDatasetOutline',
|
icon: 'core/dataset/commonDatasetOutline',
|
||||||
label: i18nT('dataset:common_dataset'),
|
label: i18nT('dataset:common_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.websiteDataset]: {
|
[DatasetTypeEnum.websiteDataset]: {
|
||||||
icon: 'core/dataset/websiteDatasetOutline',
|
icon: 'core/dataset/websiteDatasetOutline',
|
||||||
label: i18nT('dataset:website_dataset'),
|
label: i18nT('dataset:website_dataset'),
|
||||||
collectionLabel: i18nT('common:common.Website')
|
collectionLabel: i18nT('common:Website')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.externalFile]: {
|
[DatasetTypeEnum.externalFile]: {
|
||||||
icon: 'core/dataset/externalDatasetOutline',
|
icon: 'core/dataset/externalDatasetOutline',
|
||||||
label: i18nT('dataset:external_file'),
|
label: i18nT('dataset:external_file'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.apiDataset]: {
|
[DatasetTypeEnum.apiDataset]: {
|
||||||
icon: 'core/dataset/externalDatasetOutline',
|
icon: 'core/dataset/externalDatasetOutline',
|
||||||
label: i18nT('dataset:api_file'),
|
label: i18nT('dataset:api_file'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.feishu]: {
|
[DatasetTypeEnum.feishu]: {
|
||||||
icon: 'core/dataset/feishuDatasetOutline',
|
icon: 'core/dataset/feishuDatasetOutline',
|
||||||
label: i18nT('dataset:feishu_dataset'),
|
label: i18nT('dataset:feishu_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.yuque]: {
|
[DatasetTypeEnum.yuque]: {
|
||||||
icon: 'core/dataset/yuqueDatasetOutline',
|
icon: 'core/dataset/yuqueDatasetOutline',
|
||||||
label: i18nT('dataset:yuque_dataset'),
|
label: i18nT('dataset:yuque_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -120,6 +120,8 @@ export const DatasetCollectionSyncResultMap = {
|
|||||||
export enum DatasetCollectionDataProcessModeEnum {
|
export enum DatasetCollectionDataProcessModeEnum {
|
||||||
chunk = 'chunk',
|
chunk = 'chunk',
|
||||||
qa = 'qa',
|
qa = 'qa',
|
||||||
|
backup = 'backup',
|
||||||
|
|
||||||
auto = 'auto' // abandon
|
auto = 'auto' // abandon
|
||||||
}
|
}
|
||||||
export const DatasetCollectionDataProcessModeMap = {
|
export const DatasetCollectionDataProcessModeMap = {
|
||||||
@@ -131,21 +133,35 @@ export const DatasetCollectionDataProcessModeMap = {
|
|||||||
label: i18nT('common:core.dataset.training.QA mode'),
|
label: i18nT('common:core.dataset.training.QA mode'),
|
||||||
tooltip: i18nT('common:core.dataset.import.QA Import Tip')
|
tooltip: i18nT('common:core.dataset.import.QA Import Tip')
|
||||||
},
|
},
|
||||||
|
[DatasetCollectionDataProcessModeEnum.backup]: {
|
||||||
|
label: i18nT('dataset:backup_mode'),
|
||||||
|
tooltip: i18nT('dataset:backup_mode')
|
||||||
|
},
|
||||||
[DatasetCollectionDataProcessModeEnum.auto]: {
|
[DatasetCollectionDataProcessModeEnum.auto]: {
|
||||||
label: i18nT('common:core.dataset.training.Auto mode'),
|
label: i18nT('common:core.dataset.training.Auto mode'),
|
||||||
tooltip: i18nT('common:core.dataset.training.Auto mode Tip')
|
tooltip: i18nT('common:core.dataset.training.Auto mode Tip')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export enum ChunkTriggerConfigTypeEnum {
|
||||||
|
minSize = 'minSize',
|
||||||
|
forceChunk = 'forceChunk',
|
||||||
|
maxSize = 'maxSize'
|
||||||
|
}
|
||||||
export enum ChunkSettingModeEnum {
|
export enum ChunkSettingModeEnum {
|
||||||
auto = 'auto',
|
auto = 'auto',
|
||||||
custom = 'custom'
|
custom = 'custom'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DataChunkSplitModeEnum {
|
export enum DataChunkSplitModeEnum {
|
||||||
|
paragraph = 'paragraph',
|
||||||
size = 'size',
|
size = 'size',
|
||||||
char = 'char'
|
char = 'char'
|
||||||
}
|
}
|
||||||
|
export enum ParagraphChunkAIModeEnum {
|
||||||
|
auto = 'auto',
|
||||||
|
force = 'force'
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------ data -------------- */
|
/* ------------ data -------------- */
|
||||||
|
|
||||||
@@ -154,7 +170,6 @@ export enum ImportDataSourceEnum {
|
|||||||
fileLocal = 'fileLocal',
|
fileLocal = 'fileLocal',
|
||||||
fileLink = 'fileLink',
|
fileLink = 'fileLink',
|
||||||
fileCustom = 'fileCustom',
|
fileCustom = 'fileCustom',
|
||||||
csvTable = 'csvTable',
|
|
||||||
externalFile = 'externalFile',
|
externalFile = 'externalFile',
|
||||||
apiDataset = 'apiDataset',
|
apiDataset = 'apiDataset',
|
||||||
reTraining = 'reTraining'
|
reTraining = 'reTraining'
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const DatasetDataIndexMap: Record<
|
|||||||
color: 'red'
|
color: 'red'
|
||||||
},
|
},
|
||||||
[DatasetDataIndexTypeEnum.image]: {
|
[DatasetDataIndexTypeEnum.image]: {
|
||||||
label: i18nT('common:data_index_image'),
|
label: i18nT('dataset:data_index_image'),
|
||||||
color: 'purple'
|
color: 'purple'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { SearchScoreTypeEnum } from '../constants';
|
import { SearchScoreTypeEnum } from '../constants';
|
||||||
import { SearchDataResponseItemType } from '../type';
|
import { type SearchDataResponseItemType } from '../type';
|
||||||
|
|
||||||
/* dataset search result concat */
|
/* dataset search result concat */
|
||||||
export const datasetSearchResultConcat = (
|
export const datasetSearchResultConcat = (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { PushDatasetDataChunkProps } from '../api';
|
import type { PushDatasetDataChunkProps } from '../api';
|
||||||
import { TrainingModeEnum } from '../constants';
|
import type { TrainingModeEnum } from '../constants';
|
||||||
|
|
||||||
export type PushDataToTrainingQueueProps = {
|
export type PushDataToTrainingQueueProps = {
|
||||||
teamId: string;
|
teamId: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EmbeddingModelItemType, LLMModelItemType } from '../../../core/ai/model.d';
|
import { type EmbeddingModelItemType, type LLMModelItemType } from '../../../core/ai/model.d';
|
||||||
import {
|
import {
|
||||||
ChunkSettingModeEnum,
|
ChunkSettingModeEnum,
|
||||||
DataChunkSplitModeEnum,
|
DataChunkSplitModeEnum,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
export const minChunkSize = 64; // min index and chunk size
|
export const minChunkSize = 64; // min index and chunk size
|
||||||
|
|
||||||
// Chunk size
|
// Chunk size
|
||||||
export const chunkAutoChunkSize = 1500;
|
export const chunkAutoChunkSize = 1000;
|
||||||
export const getMaxChunkSize = (model: LLMModelItemType) => {
|
export const getMaxChunkSize = (model: LLMModelItemType) => {
|
||||||
return Math.max(model.maxContext - model.maxResponse, 2000);
|
return Math.max(model.maxContext - model.maxResponse, 2000);
|
||||||
};
|
};
|
||||||
@@ -118,9 +118,8 @@ export const computeChunkSize = (params: {
|
|||||||
return getLLMMaxChunkSize(params.llmModel);
|
return getLLMMaxChunkSize(params.llmModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Math.min(params.chunkSize || chunkAutoChunkSize, getLLMMaxChunkSize(params.llmModel));
|
return Math.min(params.chunkSize ?? chunkAutoChunkSize, getLLMMaxChunkSize(params.llmModel));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const computeChunkSplitter = (params: {
|
export const computeChunkSplitter = (params: {
|
||||||
chunkSettingMode?: ChunkSettingModeEnum;
|
chunkSettingMode?: ChunkSettingModeEnum;
|
||||||
chunkSplitMode?: DataChunkSplitModeEnum;
|
chunkSplitMode?: DataChunkSplitModeEnum;
|
||||||
@@ -129,8 +128,21 @@ export const computeChunkSplitter = (params: {
|
|||||||
if (params.chunkSettingMode === ChunkSettingModeEnum.auto) {
|
if (params.chunkSettingMode === ChunkSettingModeEnum.auto) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (params.chunkSplitMode === DataChunkSplitModeEnum.size) {
|
if (params.chunkSplitMode !== DataChunkSplitModeEnum.char) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return params.chunkSplitter;
|
return params.chunkSplitter;
|
||||||
};
|
};
|
||||||
|
export const computeParagraphChunkDeep = (params: {
|
||||||
|
chunkSettingMode?: ChunkSettingModeEnum;
|
||||||
|
chunkSplitMode?: DataChunkSplitModeEnum;
|
||||||
|
paragraphChunkDeep?: number;
|
||||||
|
}) => {
|
||||||
|
if (params.chunkSettingMode === ChunkSettingModeEnum.auto) {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
if (params.chunkSplitMode === DataChunkSplitModeEnum.paragraph) {
|
||||||
|
return params.paragraphChunkDeep;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|||||||
58
packages/global/core/dataset/type.d.ts
vendored
58
packages/global/core/dataset/type.d.ts
vendored
@@ -1,33 +1,49 @@
|
|||||||
import type { LLMModelItemType, EmbeddingModelItemType } from '../../core/ai/model.d';
|
import type { LLMModelItemType, EmbeddingModelItemType } from '../../core/ai/model.d';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import { PushDatasetDataChunkProps } from './api';
|
import { PushDatasetDataChunkProps } from './api';
|
||||||
import {
|
import type {
|
||||||
DataChunkSplitModeEnum,
|
DataChunkSplitModeEnum,
|
||||||
DatasetCollectionDataProcessModeEnum,
|
DatasetCollectionDataProcessModeEnum,
|
||||||
DatasetCollectionTypeEnum,
|
DatasetCollectionTypeEnum,
|
||||||
DatasetStatusEnum,
|
DatasetStatusEnum,
|
||||||
DatasetTypeEnum,
|
DatasetTypeEnum,
|
||||||
SearchScoreTypeEnum,
|
SearchScoreTypeEnum,
|
||||||
TrainingModeEnum
|
TrainingModeEnum,
|
||||||
|
ChunkSettingModeEnum,
|
||||||
|
ChunkTriggerConfigTypeEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { DatasetPermission } from '../../support/permission/dataset/controller';
|
import type { DatasetPermission } from '../../support/permission/dataset/controller';
|
||||||
import { Permission } from '../../support/permission/controller';
|
import type { APIFileServer, FeishuServer, YuqueServer } from './apiDataset';
|
||||||
import { APIFileServer, FeishuServer, YuqueServer } from './apiDataset';
|
import type { SourceMemberType } from 'support/user/type';
|
||||||
import { SourceMemberType } from 'support/user/type';
|
import type { DatasetDataIndexTypeEnum } from './data/constants';
|
||||||
import { DatasetDataIndexTypeEnum } from './data/constants';
|
|
||||||
import { ChunkSettingModeEnum } from './constants';
|
|
||||||
|
|
||||||
export type ChunkSettingsType = {
|
export type ChunkSettingsType = {
|
||||||
trainingType: DatasetCollectionDataProcessModeEnum;
|
trainingType?: DatasetCollectionDataProcessModeEnum;
|
||||||
autoIndexes?: boolean;
|
|
||||||
|
// Chunk trigger
|
||||||
|
chunkTriggerType?: ChunkTriggerConfigTypeEnum;
|
||||||
|
chunkTriggerMinSize?: number; // maxSize from agent model, not store
|
||||||
|
|
||||||
|
// Data enhance
|
||||||
|
dataEnhanceCollectionName?: boolean; // Auto add collection name to data
|
||||||
|
|
||||||
|
// Index enhance
|
||||||
imageIndex?: boolean;
|
imageIndex?: boolean;
|
||||||
|
autoIndexes?: boolean;
|
||||||
|
|
||||||
chunkSettingMode?: ChunkSettingModeEnum;
|
// Chunk setting
|
||||||
|
chunkSettingMode?: ChunkSettingModeEnum; // 系统参数/自定义参数
|
||||||
chunkSplitMode?: DataChunkSplitModeEnum;
|
chunkSplitMode?: DataChunkSplitModeEnum;
|
||||||
|
// Paragraph split
|
||||||
chunkSize?: number;
|
paragraphChunkAIMode?: ParagraphChunkAIModeEnum;
|
||||||
|
paragraphChunkDeep?: number; // Paragraph deep
|
||||||
|
paragraphChunkMinSize?: number; // Paragraph min size, if too small, it will merge
|
||||||
|
// Size split
|
||||||
|
chunkSize?: number; // chunk/qa chunk size, Paragraph max chunk size.
|
||||||
|
// Char split
|
||||||
|
chunkSplitter?: string; // chunk/qa chunk splitter
|
||||||
indexSize?: number;
|
indexSize?: number;
|
||||||
chunkSplitter?: string;
|
|
||||||
qaPrompt?: string;
|
qaPrompt?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,7 +82,7 @@ export type DatasetSchemaType = {
|
|||||||
defaultPermission?: number;
|
defaultPermission?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DatasetCollectionSchemaType = {
|
export type DatasetCollectionSchemaType = ChunkSettingsType & {
|
||||||
_id: string;
|
_id: string;
|
||||||
teamId: string;
|
teamId: string;
|
||||||
tmbId: string;
|
tmbId: string;
|
||||||
@@ -101,18 +117,7 @@ export type DatasetCollectionSchemaType = {
|
|||||||
|
|
||||||
// Parse settings
|
// Parse settings
|
||||||
customPdfParse?: boolean;
|
customPdfParse?: boolean;
|
||||||
// Chunk settings
|
|
||||||
autoIndexes?: boolean;
|
|
||||||
imageIndex?: boolean;
|
|
||||||
trainingType: DatasetCollectionDataProcessModeEnum;
|
trainingType: DatasetCollectionDataProcessModeEnum;
|
||||||
|
|
||||||
chunkSettingMode?: ChunkSettingModeEnum;
|
|
||||||
chunkSplitMode?: DataChunkSplitModeEnum;
|
|
||||||
|
|
||||||
chunkSize?: number;
|
|
||||||
indexSize?: number;
|
|
||||||
chunkSplitter?: string;
|
|
||||||
qaPrompt?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DatasetCollectionTagsSchemaType = {
|
export type DatasetCollectionTagsSchemaType = {
|
||||||
@@ -175,6 +180,7 @@ export type DatasetTrainingSchemaType = {
|
|||||||
q: string;
|
q: string;
|
||||||
a: string;
|
a: string;
|
||||||
chunkIndex: number;
|
chunkIndex: number;
|
||||||
|
indexSize?: number;
|
||||||
weight: number;
|
weight: number;
|
||||||
indexes: Omit<DatasetDataIndexItemType, 'dataId'>[];
|
indexes: Omit<DatasetDataIndexItemType, 'dataId'>[];
|
||||||
retryCount: number;
|
retryCount: number;
|
||||||
|
|||||||
@@ -40,5 +40,6 @@ export function getSourceNameIcon({
|
|||||||
export const predictDataLimitLength = (mode: TrainingModeEnum, data: any[]) => {
|
export const predictDataLimitLength = (mode: TrainingModeEnum, data: any[]) => {
|
||||||
if (mode === TrainingModeEnum.qa) return data.length * 20;
|
if (mode === TrainingModeEnum.qa) return data.length * 20;
|
||||||
if (mode === TrainingModeEnum.auto) return data.length * 5;
|
if (mode === TrainingModeEnum.auto) return data.length * 5;
|
||||||
|
if (mode === TrainingModeEnum.image) return data.length * 2;
|
||||||
return data.length;
|
return data.length;
|
||||||
};
|
};
|
||||||
|
|||||||
4
packages/global/core/plugin/controller.d.ts
vendored
4
packages/global/core/plugin/controller.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginTypeEnum } from './constants';
|
import type { PluginTypeEnum } from './constants';
|
||||||
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
||||||
|
|
||||||
export type CreateOnePluginParams = {
|
export type CreateOnePluginParams = {
|
||||||
|
|||||||
6
packages/global/core/plugin/type.d.ts
vendored
6
packages/global/core/plugin/type.d.ts
vendored
@@ -1,9 +1,9 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
import type { PluginSourceEnum, PluginTypeEnum } from './constants';
|
||||||
import { MethodType } from './controller';
|
import { MethodType } from './controller';
|
||||||
import { FlowNodeTemplateType } from '../workflow/type/node';
|
import type { FlowNodeTemplateType } from '../workflow/type/node';
|
||||||
|
|
||||||
export type PluginItemSchema = {
|
export type PluginItemSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
2
packages/global/core/workflow/api.d.ts
vendored
2
packages/global/core/workflow/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { EmbeddingModelItemType } from '../ai/model.d';
|
import type { EmbeddingModelItemType } from '../ai/model.d';
|
||||||
import { NodeInputKeyEnum } from './constants';
|
import { NodeInputKeyEnum } from './constants';
|
||||||
|
|
||||||
export type SelectedDatasetType = {
|
export type SelectedDatasetType = {
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ export const FlowValueTypeMap: Record<
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const EDGE_TYPE = 'default';
|
export const EDGE_TYPE = 'default';
|
||||||
export const defaultNodeVersion = '481';
|
|
||||||
|
|
||||||
export const chatHistoryValueDesc = `{
|
export const chatHistoryValueDesc = `{
|
||||||
obj: System | Human | AI;
|
obj: System | Human | AI;
|
||||||
@@ -236,3 +235,10 @@ export const datasetQuoteValueDesc = `{
|
|||||||
export const datasetSelectValueDesc = `{
|
export const datasetSelectValueDesc = `{
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
}[]`;
|
}[]`;
|
||||||
|
|
||||||
|
export const AppNodeFlowNodeTypeMap: Record<any, boolean> = {
|
||||||
|
[FlowNodeTypeEnum.pluginModule]: true,
|
||||||
|
[FlowNodeTypeEnum.appModule]: true,
|
||||||
|
[FlowNodeTypeEnum.tool]: true,
|
||||||
|
[FlowNodeTypeEnum.toolSet]: true
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FlowNodeInputItemType } from '../../type/io';
|
import { type FlowNodeInputItemType } from '../../type/io';
|
||||||
|
|
||||||
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
51
packages/global/core/workflow/runtime/type.d.ts
vendored
51
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -1,30 +1,32 @@
|
|||||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
import type { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||||
import {
|
import type {
|
||||||
ChatItemType,
|
ChatItemType,
|
||||||
UserChatItemValueItemType,
|
UserChatItemValueItemType,
|
||||||
ToolRunResponseItemType,
|
ToolRunResponseItemType,
|
||||||
NodeOutputItemType,
|
|
||||||
AIChatItemValueItemType
|
AIChatItemValueItemType
|
||||||
} from '../../chat/type';
|
} from '../../chat/type';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
import { NodeOutputItemType } from '../../chat/type';
|
||||||
import { StoreNodeItemType } from '../type/node';
|
import type { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
||||||
import { DispatchNodeResponseKeyEnum } from './constants';
|
import type { NodeToolConfigType, StoreNodeItemType } from '../type/node';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import type { DispatchNodeResponseKeyEnum } from './constants';
|
||||||
import { NodeInputKeyEnum } from '../constants';
|
import type { StoreEdgeItemType } from '../type/edge';
|
||||||
import { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
import type { NodeInputKeyEnum } from '../constants';
|
||||||
import { NextApiResponse } from 'next';
|
import type { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
||||||
|
import type { NextApiResponse } from 'next';
|
||||||
import { UserModelSchema } from '../../../support/user/type';
|
import { UserModelSchema } from '../../../support/user/type';
|
||||||
import { AppDetailType, AppSchema } from '../../app/type';
|
import type { AppSchema } from '../../app/type';
|
||||||
import { RuntimeNodeItemType } from '../runtime/type';
|
import { AppDetailType } from '../../app/type';
|
||||||
import { RuntimeEdgeItemType } from './edge';
|
import type { RuntimeNodeItemType } from '../runtime/type';
|
||||||
import { ReadFileNodeResponse } from '../template/system/readFiles/type';
|
import type { RuntimeEdgeItemType } from './edge';
|
||||||
|
import type { ReadFileNodeResponse } from '../template/system/readFiles/type';
|
||||||
import { UserSelectOptionType } from '../template/system/userSelect/type';
|
import { UserSelectOptionType } from '../template/system/userSelect/type';
|
||||||
import { WorkflowResponseType } from '../../../../service/core/workflow/dispatch/type';
|
import type { WorkflowResponseType } from '../../../../service/core/workflow/dispatch/type';
|
||||||
import { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
import type { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
||||||
import { LafAccountType, OpenaiAccountType } from '../../../support/user/team/type';
|
import type { OpenaiAccountType } from '../../../support/user/team/type';
|
||||||
import { CompletionFinishReason } from '../../ai/type';
|
import { LafAccountType } from '../../../support/user/team/type';
|
||||||
import { WorkflowInteractiveResponseType } from '../template/system/interactive/type';
|
import type { CompletionFinishReason } from '../../ai/type';
|
||||||
import { SearchDataResponseItemType } from '../../dataset/type';
|
import type { WorkflowInteractiveResponseType } from '../template/system/interactive/type';
|
||||||
|
import type { SearchDataResponseItemType } from '../../dataset/type';
|
||||||
export type ExternalProviderType = {
|
export type ExternalProviderType = {
|
||||||
openaiAccount?: OpenaiAccountType;
|
openaiAccount?: OpenaiAccountType;
|
||||||
externalWorkflowVariables?: Record<string, string>;
|
externalWorkflowVariables?: Record<string, string>;
|
||||||
@@ -58,7 +60,7 @@ export type ChatDispatchProps = {
|
|||||||
chatConfig: AppSchema['chatConfig'];
|
chatConfig: AppSchema['chatConfig'];
|
||||||
lastInteractive?: WorkflowInteractiveResponseType; // last interactive response
|
lastInteractive?: WorkflowInteractiveResponseType; // last interactive response
|
||||||
stream: boolean;
|
stream: boolean;
|
||||||
parseQuote?: boolean;
|
retainDatasetCite?: boolean;
|
||||||
maxRunTimes: number;
|
maxRunTimes: number;
|
||||||
isToolCall?: boolean;
|
isToolCall?: boolean;
|
||||||
workflowStreamResponse?: WorkflowResponseType;
|
workflowStreamResponse?: WorkflowResponseType;
|
||||||
@@ -99,7 +101,10 @@ export type RuntimeNodeItemType = {
|
|||||||
outputs: FlowNodeOutputItemType[];
|
outputs: FlowNodeOutputItemType[];
|
||||||
|
|
||||||
pluginId?: string; // workflow id / plugin id
|
pluginId?: string; // workflow id / plugin id
|
||||||
version: string;
|
version?: string;
|
||||||
|
|
||||||
|
// tool
|
||||||
|
toolConfig?: NodeToolConfigType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RuntimeEdgeItemType = StoreEdgeItemType & {
|
export type RuntimeEdgeItemType = StoreEdgeItemType & {
|
||||||
@@ -112,7 +117,7 @@ export type DispatchNodeResponseType = {
|
|||||||
runningTime?: number;
|
runningTime?: number;
|
||||||
query?: string;
|
query?: string;
|
||||||
textOutput?: string;
|
textOutput?: string;
|
||||||
error?: Record<string, any>;
|
error?: Record<string, any> | string;
|
||||||
customInputs?: Record<string, any>;
|
customInputs?: Record<string, any>;
|
||||||
customOutputs?: Record<string, any>;
|
customOutputs?: Record<string, any>;
|
||||||
nodeInputs?: Record<string, any>;
|
nodeInputs?: Record<string, any>;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
||||||
import { NodeInputKeyEnum, NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../constants';
|
import { NodeInputKeyEnum, NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../constants';
|
||||||
import { FlowNodeTypeEnum } from '../node/constant';
|
import { FlowNodeTypeEnum } from '../node/constant';
|
||||||
import { StoreNodeItemType } from '../type/node';
|
import { type StoreNodeItemType } from '../type/node';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import { type StoreEdgeItemType } from '../type/edge';
|
||||||
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
import { type RuntimeEdgeItemType, type RuntimeNodeItemType } from './type';
|
||||||
import { VARIABLE_NODE_ID } from '../constants';
|
import { VARIABLE_NODE_ID } from '../constants';
|
||||||
import { isValidReferenceValueFormat } from '../utils';
|
import { isValidReferenceValueFormat } from '../utils';
|
||||||
import { FlowNodeOutputItemType, ReferenceValueType } from '../type/io';
|
import { type FlowNodeOutputItemType, type ReferenceValueType } from '../type/io';
|
||||||
import { ChatItemType, NodeOutputItemType } from '../../../core/chat/type';
|
import { type ChatItemType, type NodeOutputItemType } from '../../../core/chat/type';
|
||||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
|
||||||
import { replaceVariable, valToStr } from '../../../common/string/tools';
|
import { replaceVariable, valToStr } from '../../../common/string/tools';
|
||||||
import json5 from 'json5';
|
import json5 from 'json5';
|
||||||
import {
|
import {
|
||||||
InteractiveNodeResponseType,
|
type InteractiveNodeResponseType,
|
||||||
WorkflowInteractiveResponseType
|
type WorkflowInteractiveResponseType
|
||||||
} from '../template/system/interactive/type';
|
} from '../template/system/interactive/type';
|
||||||
|
|
||||||
export const extractDeepestInteractive = (
|
export const extractDeepestInteractive = (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { NodeInputKeyEnum } from '../constants';
|
|||||||
import { FlowNodeInputTypeEnum } from '../node/constant';
|
import { FlowNodeInputTypeEnum } from '../node/constant';
|
||||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||||
import { chatNodeSystemPromptTip, systemPromptTip } from './tip';
|
import { chatNodeSystemPromptTip, systemPromptTip } from './tip';
|
||||||
import { FlowNodeInputItemType } from '../type/io';
|
import { type FlowNodeInputItemType } from '../type/io';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
|
|
||||||
export const Input_Template_History: FlowNodeInputItemType = {
|
export const Input_Template_History: FlowNodeInputItemType = {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../../node/constant';
|
} from '../../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -25,7 +25,6 @@ export const RunAppModule: FlowNodeTemplateType = {
|
|||||||
name: i18nT('workflow:application_call'),
|
name: i18nT('workflow:application_call'),
|
||||||
intro: i18nT('workflow:select_another_application_to_call'),
|
intro: i18nT('workflow:select_another_application_to_call'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
version: '481',
|
|
||||||
isTool: true,
|
isTool: true,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -19,7 +19,6 @@ import {
|
|||||||
Input_Template_UserChatInput,
|
Input_Template_UserChatInput,
|
||||||
Input_Template_File_Link
|
Input_Template_File_Link
|
||||||
} from '../../input';
|
} from '../../input';
|
||||||
import { chatNodeSystemPromptTip, systemPromptTip } from '../../tip';
|
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||||
|
|
||||||
@@ -54,7 +53,7 @@ export const AiChatModule: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:template.ai_chat_intro'),
|
intro: i18nT('workflow:template.ai_chat_intro'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/ai_chat/',
|
courseUrl: '/docs/guide/dashboard/workflow/ai_chat/',
|
||||||
version: '4.9.7',
|
version: '4.9.7',
|
||||||
inputs: [
|
inputs: [
|
||||||
Input_Template_SettingAiModel,
|
Input_Template_SettingAiModel,
|
||||||
@@ -121,12 +120,7 @@ export const AiChatModule: FlowNodeTemplateType = {
|
|||||||
valueType: WorkflowIOValueTypeEnum.string
|
valueType: WorkflowIOValueTypeEnum.string
|
||||||
},
|
},
|
||||||
// settings modal ---
|
// settings modal ---
|
||||||
{
|
Input_Template_System_Prompt,
|
||||||
...Input_Template_System_Prompt,
|
|
||||||
label: i18nT('common:core.ai.Prompt'),
|
|
||||||
description: systemPromptTip,
|
|
||||||
placeholder: chatNodeSystemPromptTip
|
|
||||||
},
|
|
||||||
Input_Template_History,
|
Input_Template_History,
|
||||||
Input_Template_Dataset_Quote,
|
Input_Template_Dataset_Quote,
|
||||||
Input_Template_File_Link,
|
Input_Template_File_Link,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -17,8 +17,7 @@ export const AssignedAnswerModule: FlowNodeTemplateType = {
|
|||||||
avatar: 'core/workflow/template/reply',
|
avatar: 'core/workflow/template/reply',
|
||||||
name: i18nT('workflow:assigned_reply'),
|
name: i18nT('workflow:assigned_reply'),
|
||||||
intro: i18nT('workflow:intro_assigned_reply'),
|
intro: i18nT('workflow:intro_assigned_reply'),
|
||||||
courseUrl: '/docs/guide/workbench/workflow/reply/',
|
courseUrl: '/docs/guide/dashboard/workflow/reply/',
|
||||||
version: '481',
|
|
||||||
isTool: true,
|
isTool: true,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -31,7 +31,7 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:intro_question_classification'),
|
intro: i18nT('workflow:intro_question_classification'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
version: '4.9.2',
|
version: '4.9.2',
|
||||||
courseUrl: '/docs/guide/workbench/workflow/question_classify/',
|
courseUrl: '/docs/guide/dashboard/workflow/question_classify/',
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
...Input_Template_SelectAIModel,
|
...Input_Template_SelectAIModel,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -26,7 +26,7 @@ export const ContextExtractModule: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:intro_text_content_extraction'),
|
intro: i18nT('workflow:intro_text_content_extraction'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/content_extract/',
|
courseUrl: '/docs/guide/dashboard/workflow/content_extract/',
|
||||||
version: '4.9.2',
|
version: '4.9.2',
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { WorkflowIOValueTypeEnum } from '../../../constants';
|
import type { WorkflowIOValueTypeEnum } from '../../../constants';
|
||||||
|
|
||||||
export type ContextExtractAgentItemType = {
|
export type ContextExtractAgentItemType = {
|
||||||
valueType:
|
valueType:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
@@ -17,8 +17,7 @@ export const CustomFeedbackNode: FlowNodeTemplateType = {
|
|||||||
avatar: 'core/workflow/template/customFeedback',
|
avatar: 'core/workflow/template/customFeedback',
|
||||||
name: i18nT('workflow:custom_feedback'),
|
name: i18nT('workflow:custom_feedback'),
|
||||||
intro: i18nT('workflow:intro_custom_feedback'),
|
intro: i18nT('workflow:intro_custom_feedback'),
|
||||||
courseUrl: '/docs/guide/workbench/workflow/custom_feedback/',
|
courseUrl: '/docs/guide/dashboard/workflow/custom_feedback/',
|
||||||
version: '486',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.textareaInput,
|
key: NodeInputKeyEnum.textareaInput,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
import { getNanoid } from '../../../../common/string/tools';
|
import { getNanoid } from '../../../../common/string/tools';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
import { FlowNodeInputItemType } from '../../type/io.d';
|
import { type FlowNodeInputItemType } from '../../type/io.d';
|
||||||
import { i18nT } from '../../../../../web/i18n/utils';
|
import { i18nT } from '../../../../../web/i18n/utils';
|
||||||
|
|
||||||
export const getOneQuoteInputTemplate = ({
|
export const getOneQuoteInputTemplate = ({
|
||||||
@@ -42,8 +42,7 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:intro_knowledge_base_search_merge'),
|
intro: i18nT('workflow:intro_knowledge_base_search_merge'),
|
||||||
|
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '486',
|
courseUrl: '/docs/guide/dashboard/workflow/knowledge_base_search_merge/',
|
||||||
courseUrl: '/docs/guide/workbench/workflow/knowledge_base_search_merge/',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -30,7 +30,7 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
|||||||
intro: Dataset_SEARCH_DESC,
|
intro: Dataset_SEARCH_DESC,
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/dataset_search/',
|
courseUrl: '/docs/guide/dashboard/workflow/dataset_search/',
|
||||||
version: '4.9.2',
|
version: '4.9.2',
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
|||||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||||
label: '',
|
label: '',
|
||||||
value: 1500,
|
value: 5000,
|
||||||
valueType: WorkflowIOValueTypeEnum.number
|
valueType: WorkflowIOValueTypeEnum.number
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -27,8 +27,7 @@ export const HttpNode468: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:intro_http_request'),
|
intro: i18nT('workflow:intro_http_request'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/http/',
|
courseUrl: '/docs/guide/dashboard/workflow/http/',
|
||||||
version: '481',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
...Input_Template_DynamicInput,
|
...Input_Template_DynamicInput,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const IfElseNode: FlowNodeTemplateType = {
|
export const IfElseNode: FlowNodeTemplateType = {
|
||||||
@@ -23,8 +23,7 @@ export const IfElseNode: FlowNodeTemplateType = {
|
|||||||
name: i18nT('workflow:condition_checker'),
|
name: i18nT('workflow:condition_checker'),
|
||||||
intro: i18nT('workflow:execute_different_branches_based_on_conditions'),
|
intro: i18nT('workflow:execute_different_branches_based_on_conditions'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/tfswitch/',
|
courseUrl: '/docs/guide/dashboard/workflow/tfswitch/',
|
||||||
version: '481',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.ifElseList,
|
key: NodeInputKeyEnum.ifElseList,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ReferenceItemValueType } from '../../../type/io';
|
import type { ReferenceItemValueType } from '../../../type/io';
|
||||||
import { VariableConditionEnum } from './constant';
|
import type { VariableConditionEnum } from './constant';
|
||||||
|
|
||||||
export type IfElseConditionType = 'AND' | 'OR';
|
export type IfElseConditionType = 'AND' | 'OR';
|
||||||
export type ConditionListItemType = {
|
export type ConditionListItemType = {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const FormInputNode: FlowNodeTemplateType = {
|
export const FormInputNode: FlowNodeTemplateType = {
|
||||||
@@ -23,7 +23,6 @@ export const FormInputNode: FlowNodeTemplateType = {
|
|||||||
name: i18nT('app:workflow.form_input'),
|
name: i18nT('app:workflow.form_input'),
|
||||||
intro: i18nT(`app:workflow.form_input_tip`),
|
intro: i18nT(`app:workflow.form_input_tip`),
|
||||||
isTool: true,
|
isTool: true,
|
||||||
version: '4811',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.description,
|
key: NodeInputKeyEnum.description,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { NodeOutputItemType } from '../../../../chat/type';
|
import type { NodeOutputItemType } from '../../../../chat/type';
|
||||||
import type { FlowNodeOutputItemType } from '../../../type/io';
|
import type { FlowNodeOutputItemType } from '../../../type/io';
|
||||||
import { FlowNodeInputTypeEnum } from 'core/workflow/node/constant';
|
import type { FlowNodeInputTypeEnum } from 'core/workflow/node/constant';
|
||||||
import { WorkflowIOValueTypeEnum } from 'core/workflow/constants';
|
import type { WorkflowIOValueTypeEnum } from 'core/workflow/constants';
|
||||||
import type { ChatCompletionMessageParam } from '../../../../ai/type';
|
import type { ChatCompletionMessageParam } from '../../../../ai/type';
|
||||||
|
|
||||||
type InteractiveBasicType = {
|
type InteractiveBasicType = {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../../type/node.d';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const UserSelectNode: FlowNodeTemplateType = {
|
export const UserSelectNode: FlowNodeTemplateType = {
|
||||||
@@ -24,8 +24,7 @@ export const UserSelectNode: FlowNodeTemplateType = {
|
|||||||
name: i18nT('app:workflow.user_select'),
|
name: i18nT('app:workflow.user_select'),
|
||||||
intro: i18nT(`app:workflow.user_select_tip`),
|
intro: i18nT(`app:workflow.user_select_tip`),
|
||||||
isTool: true,
|
isTool: true,
|
||||||
version: '489',
|
courseUrl: '/docs/guide/dashboard/workflow/user-selection/',
|
||||||
courseUrl: '/docs/guide/workbench/workflow/user-selection/',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.description,
|
key: NodeInputKeyEnum.description,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -32,8 +32,7 @@ export const LafModule: FlowNodeTemplateType = {
|
|||||||
intro: i18nT('workflow:intro_laf_function_call'),
|
intro: i18nT('workflow:intro_laf_function_call'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/laf/',
|
courseUrl: '/docs/guide/dashboard/workflow/laf/',
|
||||||
version: '481',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
...Input_Template_DynamicInput,
|
...Input_Template_DynamicInput,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -29,8 +29,7 @@ export const LoopNode: FlowNodeTemplateType = {
|
|||||||
name: i18nT('workflow:loop'),
|
name: i18nT('workflow:loop'),
|
||||||
intro: i18nT('workflow:intro_loop'),
|
intro: i18nT('workflow:intro_loop'),
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
version: '4811',
|
courseUrl: '/docs/guide/dashboard/workflow/loop/',
|
||||||
courseUrl: '/docs/guide/workbench/workflow/loop/',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.loopInputArray,
|
key: NodeInputKeyEnum.loopInputArray,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
WorkflowIOValueTypeEnum
|
WorkflowIOValueTypeEnum
|
||||||
} from '../../../constants';
|
} from '../../../constants';
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const LoopEndNode: FlowNodeTemplateType = {
|
export const LoopEndNode: FlowNodeTemplateType = {
|
||||||
@@ -19,7 +19,6 @@ export const LoopEndNode: FlowNodeTemplateType = {
|
|||||||
avatar: 'core/workflow/template/loopEnd',
|
avatar: 'core/workflow/template/loopEnd',
|
||||||
name: i18nT('workflow:loop_end'),
|
name: i18nT('workflow:loop_end'),
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '4811',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.loopEndInput,
|
key: NodeInputKeyEnum.loopEndInput,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../../type/node.d';
|
||||||
import {
|
import {
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -24,7 +24,6 @@ export const LoopStartNode: FlowNodeTemplateType = {
|
|||||||
unique: true,
|
unique: true,
|
||||||
forbidDelete: true,
|
forbidDelete: true,
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '4811',
|
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.loopStartInput,
|
key: NodeInputKeyEnum.loopStartInput,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
import { i18nT } from '../../../../../web/i18n/utils';
|
import { i18nT } from '../../../../../web/i18n/utils';
|
||||||
@@ -15,7 +15,6 @@ export const PluginConfigNode: FlowNodeTemplateType = {
|
|||||||
intro: '',
|
intro: '',
|
||||||
unique: true,
|
unique: true,
|
||||||
forbidDelete: true,
|
forbidDelete: true,
|
||||||
version: '4811',
|
|
||||||
inputs: [],
|
inputs: [],
|
||||||
outputs: []
|
outputs: []
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { i18nT } from '../../../../../web/i18n/utils';
|
import { i18nT } from '../../../../../web/i18n/utils';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const PluginInputModule: FlowNodeTemplateType = {
|
export const PluginInputModule: FlowNodeTemplateType = {
|
||||||
@@ -16,7 +16,6 @@ export const PluginInputModule: FlowNodeTemplateType = {
|
|||||||
name: i18nT('workflow:plugin_input'),
|
name: i18nT('workflow:plugin_input'),
|
||||||
intro: i18nT('workflow:intro_plugin_input'),
|
intro: i18nT('workflow:intro_plugin_input'),
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '481',
|
|
||||||
inputs: [],
|
inputs: [],
|
||||||
outputs: []
|
outputs: []
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user