Compare commits
145 Commits
v4.8.10-al
...
v4.8.11-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c829febec | ||
|
|
7bdff9ce9c | ||
|
|
1599d144ce | ||
|
|
f2749cbb00 | ||
|
|
f7a8203454 | ||
|
|
d95f71e9e3 | ||
|
|
a43d845298 | ||
|
|
3e64f46d92 | ||
|
|
0335f16742 | ||
|
|
98dbec2cf7 | ||
|
|
d259eda6b4 | ||
|
|
7c8f2ab6f5 | ||
|
|
691476c821 | ||
|
|
efcb53cd6d | ||
|
|
21ab855871 | ||
|
|
aee5de29c7 | ||
|
|
78d15c2a2f | ||
|
|
54e0a0eab1 | ||
|
|
e6bad93b32 | ||
|
|
12d7ba5d73 | ||
|
|
5ad8c81ef3 | ||
|
|
cb6fe9d0da | ||
|
|
1cf76ee7df | ||
|
|
edebfdf5ef | ||
|
|
86436d55ff | ||
|
|
e31d6ec2c1 | ||
|
|
6bb10ca150 | ||
|
|
7aa75f8ee0 | ||
|
|
afd2c394d8 | ||
|
|
434c03c955 | ||
|
|
f4d4d6516c | ||
|
|
b6833ca3ea | ||
|
|
3ab934771f | ||
|
|
4245ea4998 | ||
|
|
9eb02b7e38 | ||
|
|
75af549c7f | ||
|
|
5e7c97b7b8 | ||
|
|
6c2a7574c3 | ||
|
|
ca9f36ef9f | ||
|
|
265434799f | ||
|
|
258de4471e | ||
|
|
d83bb9d2c7 | ||
|
|
093bfa2134 | ||
|
|
539bc77934 | ||
|
|
aabbe06e41 | ||
|
|
bb22fa6548 | ||
|
|
bd2509bd41 | ||
|
|
561516eeef | ||
|
|
2bdda4638d | ||
|
|
1ebc95a282 | ||
|
|
d0e8f7203c | ||
|
|
092bb9ab17 | ||
|
|
9de8849193 | ||
|
|
3d5da27079 | ||
|
|
c454fe07cb | ||
|
|
3e144c4227 | ||
|
|
d8b2887625 | ||
|
|
ba3b3280b4 | ||
|
|
390b8f5b86 | ||
|
|
d74e6a47d6 | ||
|
|
424c745cbb | ||
|
|
0abbcf1401 | ||
|
|
da1126ed3c | ||
|
|
56281d92f2 | ||
|
|
fde1618af2 | ||
|
|
22bb4c1e2e | ||
|
|
6331f4b845 | ||
|
|
5101c7a6dc | ||
|
|
02bf400bf3 | ||
|
|
11cbcca2d4 | ||
|
|
34422f9549 | ||
|
|
aeba79267a | ||
|
|
7473be5922 | ||
|
|
de59b3d2e5 | ||
|
|
08190c2f0d | ||
|
|
6a85c8c2b6 | ||
|
|
bbdab1d40e | ||
|
|
78ad2791cd | ||
|
|
5f3c8e9046 | ||
|
|
30057f01a6 | ||
|
|
3ea185315d | ||
|
|
a1ae08f62b | ||
|
|
91ec895fd2 | ||
|
|
1a33642635 | ||
|
|
e9681c8ed5 | ||
|
|
69ff65973f | ||
|
|
52ac445557 | ||
|
|
d45cb2f84a | ||
|
|
1cb71c6bfb | ||
|
|
fb59b60761 | ||
|
|
9334a0dcf6 | ||
|
|
c614f8b9ca | ||
|
|
478386c612 | ||
|
|
dfcffc7fc1 | ||
|
|
b4238257b6 | ||
|
|
38f47956cd | ||
|
|
7fed4d697f | ||
|
|
5ed89130ef | ||
|
|
3671e55001 | ||
|
|
3bcc3430fb | ||
|
|
d6233cd7b1 | ||
|
|
64708ea424 | ||
|
|
85a11d08b2 | ||
|
|
a7569037fe | ||
|
|
4726034344 | ||
|
|
9a57e94b79 | ||
|
|
761e35c226 | ||
|
|
5ebe0017a0 | ||
|
|
036097243a | ||
|
|
84de95d294 | ||
|
|
fdab383b26 | ||
|
|
060492dbf7 | ||
|
|
9d5fd24085 | ||
|
|
903f39fe17 | ||
|
|
2ef98c24be | ||
|
|
6d00f73e91 | ||
|
|
813eaacfd0 | ||
|
|
322ca757af | ||
|
|
a177a302d4 | ||
|
|
034108c218 | ||
|
|
0632dfed80 | ||
|
|
6c16fa9166 | ||
|
|
ac4854a47b | ||
|
|
b9a6b71fe9 | ||
|
|
aba50e958e | ||
|
|
52cbfeace3 | ||
|
|
bebf565c06 | ||
|
|
c9bb39d802 | ||
|
|
454a479fd8 | ||
|
|
d057ad3a45 | ||
|
|
a206d77287 | ||
|
|
14bd1b5404 | ||
|
|
450167c951 | ||
|
|
67445b40bc | ||
|
|
d3731d221a | ||
|
|
f6e2d13e21 | ||
|
|
77e6cf4157 | ||
|
|
fd3f32d083 | ||
|
|
f7544ea47b | ||
|
|
a1a9a0b463 | ||
|
|
dbfe1fca31 | ||
|
|
94f3b7f2d6 | ||
|
|
22a0f6bcfa | ||
|
|
c1d08c0ccc | ||
|
|
a4c19fbd0a |
2
.github/ISSUE_TEMPLATE/bugs.md
vendored
@@ -11,7 +11,7 @@ assignees: ''
|
||||
[//]: # '方框内填 x 表示打钩'
|
||||
|
||||
- [ ] 我已确认目前没有类似 issue
|
||||
- [ ] 我已完整查看过项目 README,以及[项目文档](https://doc.fastgpt.in/docs/intro/)
|
||||
- [ ] 我已完整查看过项目 README,以及[项目文档](https://doc.tryfastgpt.ai/docs/intro/)
|
||||
- [ ] 我使用了自己的 key,并确认我的 key 是可正常使用的
|
||||
- [ ] 我理解并愿意跟进此 issue,协助测试和提供反馈
|
||||
- [x] 我理解并认可上述内容,并理解项目维护者精力有限,**不遵循规则的 issue 可能会被无视或直接关闭**
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 飞书话题群
|
||||
url: https://oss.laf.run/otnvvf-imgs/1719505774252.jpg
|
||||
url: https://oss.laf.run/otnvvf-imgs/feishu3.png
|
||||
about: FastGPT 全是问题群
|
||||
|
||||
BIN
.github/imgs/intro1.png
vendored
|
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 173 KiB |
BIN
.github/imgs/intro2.png
vendored
|
Before Width: | Height: | Size: 371 KiB After Width: | Height: | Size: 273 KiB |
BIN
.github/imgs/intro3.png
vendored
|
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 168 KiB |
BIN
.github/imgs/intro4.png
vendored
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 159 KiB |
68
.vscode/nextapi.code-snippets
vendored
@@ -50,5 +50,73 @@
|
||||
"export default ContextProvider"
|
||||
],
|
||||
"description": "FastGPT usecontext template"
|
||||
},
|
||||
|
||||
"Jest test template": {
|
||||
"scope": "typescriptreact",
|
||||
"prefix": "jesttest",
|
||||
"body": [
|
||||
"import '@/pages/api/__mocks__/base';",
|
||||
"import { root } from '@/pages/api/__mocks__/db/init';",
|
||||
"import { getTestRequest } from '@/test/utils';",
|
||||
"import { AppErrEnum } from '@fastgpt/global/common/error/code/app';",
|
||||
"import handler from './demo';",
|
||||
"",
|
||||
"// Import the schema",
|
||||
"import { MongoOutLink } from '@fastgpt/service/support/outLink/schema';",
|
||||
"",
|
||||
"beforeAll(async () => {",
|
||||
" // await MongoOutLink.create({",
|
||||
" // shareId: 'aaa',",
|
||||
" // appId: root.appId,",
|
||||
" // tmbId: root.tmbId,",
|
||||
" // teamId: root.teamId,",
|
||||
" // type: 'share',",
|
||||
" // name: 'aaa'",
|
||||
" // })",
|
||||
"});",
|
||||
"",
|
||||
"test('Should return a list of outLink', async () => {",
|
||||
" // Mock request",
|
||||
" const res = (await handler(",
|
||||
" ...getTestRequest({",
|
||||
" query: {",
|
||||
" appId: root.appId,",
|
||||
" type: 'share'",
|
||||
" },",
|
||||
" user: root",
|
||||
" })",
|
||||
" )) as any;",
|
||||
"",
|
||||
" expect(res.code).toBe(200);",
|
||||
" expect(res.data.length).toBe(2);",
|
||||
"});",
|
||||
"",
|
||||
"test('appId is required', async () => {",
|
||||
" const res = (await handler(",
|
||||
" ...getTestRequest({",
|
||||
" query: {",
|
||||
" type: 'share'",
|
||||
" },",
|
||||
" user: root",
|
||||
" })",
|
||||
" )) as any;",
|
||||
" expect(res.code).toBe(500);",
|
||||
" expect(res.error).toBe(AppErrEnum.unExist);",
|
||||
"});",
|
||||
"",
|
||||
"test('if type is not provided, return nothing', async () => {",
|
||||
" const res = (await handler(",
|
||||
" ...getTestRequest({",
|
||||
" query: {",
|
||||
" appId: root.appId",
|
||||
" },",
|
||||
" user: root",
|
||||
" })",
|
||||
" )) as any;",
|
||||
" expect(res.code).toBe(200);",
|
||||
" expect(res.data.length).toBe(0);",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
4
.vscode/settings.json
vendored
@@ -13,7 +13,7 @@
|
||||
"js",
|
||||
"ts"
|
||||
],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"i18n-ally.keystyle": "flat",
|
||||
"i18n-ally.sortKeys": true,
|
||||
"i18n-ally.keepFulfilled": false,
|
||||
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
|
||||
@@ -21,7 +21,7 @@
|
||||
"i18n-ally.namespace": true,
|
||||
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
|
||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
|
||||
"i18n-ally.translate.engines": ["deepl", "google"],
|
||||
"i18n-ally.translate.engines": ["google"],
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
}
|
||||
|
||||
46
README.md
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
<a href="https://fastgpt.in/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
<a href="https://tryfastgpt.ai/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
|
||||
# FastGPT
|
||||
|
||||
@@ -15,13 +15,13 @@ FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://fastgpt.in/">
|
||||
<a href="https://tryfastgpt.ai/">
|
||||
<img height="21" src="https://img.shields.io/badge/在线使用-d4eaf7?style=flat-square&logo=spoj&logoColor=7d09f1" alt="cloud">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/intro">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/intro">
|
||||
<img height="21" src="https://img.shields.io/badge/相关文档-7d09f1?style=flat-square" alt="document">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/development">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/development">
|
||||
<img height="21" src="https://img.shields.io/badge/本地开发-%23d4eaf7?style=flat-square&logo=xcode&logoColor=7d09f1" alt="development">
|
||||
</a>
|
||||
<a href="/#-%E7%9B%B8%E5%85%B3%E9%A1%B9%E7%9B%AE">
|
||||
@@ -36,7 +36,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
## 🛸 在线使用
|
||||
|
||||
- 🌍 海外版:[fastgpt.in](https://fastgpt.in/)
|
||||
- 🌍 国际版:[tryfastgpt.ai](https://tryfastgpt.ai/)
|
||||
|
||||
| | |
|
||||
| ---------------------------------- | ---------------------------------- |
|
||||
@@ -50,22 +50,22 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
## 💡 RoadMap
|
||||
|
||||
`1` 应用编排能力
|
||||
- [x] 提供简易模式,无需操作编排
|
||||
- [x] 工作流编排
|
||||
- [x] 对话工作流、插件工作流
|
||||
- [x] 工具调用
|
||||
- [x] 插件 - 工作流封装能力
|
||||
- [x] Code sandbox
|
||||
- [ ] 循环调用
|
||||
- [x] 循环调用
|
||||
- [x] 用户选择
|
||||
- [ ] 表单输入
|
||||
|
||||
`2` 知识库能力
|
||||
- [x] 多库复用,混用
|
||||
- [x] chunk 记录修改和删除
|
||||
- [x] 源文件存储
|
||||
- [x] 支持手动输入,直接分段,QA 拆分导入
|
||||
- [x] 支持 txt,md,html,pdf,docx,pptx,csv,xlsx (有需要更多可 PR file loader)
|
||||
- [x] 支持 url 读取、CSV 批量导入
|
||||
- [x] 混合检索 & 重排
|
||||
- [ ] 标签过滤
|
||||
- [ ] 自定义文件读取服务
|
||||
- [ ] 自定义分块服务
|
||||
|
||||
`3` 应用调试能力
|
||||
- [x] 知识库单点搜索测试
|
||||
@@ -88,7 +88,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
`6` 其他
|
||||
- [x] 支持语音输入和输出 (可配置语音输入语音回答)
|
||||
- [x] 模糊输入提示
|
||||
- [ ] 模板市场
|
||||
- [x] 模板市场
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -102,15 +102,15 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
> 使用 [Sealos](https://sealos.io) 服务,无需采购服务器、无需域名,支持高并发 & 动态伸缩,并且数据库应用采用 kubeblocks 的数据库,在 IO 性能方面,远超于简单的 Docker 容器部署。
|
||||
|
||||
[点击查看 Sealos 一键部署 FastGPT 教程](https://doc.fastgpt.in/docs/development/sealos/)
|
||||
[点击查看 Sealos 一键部署 FastGPT 教程](https://doc.tryfastgpt.ai/docs/development/sealos/)
|
||||
|
||||
* [快速开始本地开发](https://doc.fastgpt.in/docs/development/intro/)
|
||||
* [部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos)
|
||||
* [系统配置文件说明](https://doc.fastgpt.in/docs/development/configuration/)
|
||||
* [多模型配置](https://doc.fastgpt.in/docs/development/one-api/)
|
||||
* [版本更新/升级介绍](https://doc.fastgpt.in/docs/development/upgrading)
|
||||
* [OpenAPI API 文档](https://doc.fastgpt.in/docs/development/openapi/)
|
||||
* [知识库结构详解](https://doc.fastgpt.in/docs/course/dataset_engine/)
|
||||
* [快速开始本地开发](https://doc.tryfastgpt.ai/docs/development/intro/)
|
||||
* [部署 FastGPT](https://doc.tryfastgpt.ai/docs/development/sealos)
|
||||
* [系统配置文件说明](https://doc.tryfastgpt.ai/docs/development/configuration/)
|
||||
* [多模型配置](https://doc.tryfastgpt.ai/docs/development/one-api/)
|
||||
* [版本更新/升级介绍](https://doc.tryfastgpt.ai/docs/development/upgrading)
|
||||
* [OpenAPI API 文档](https://doc.tryfastgpt.ai/docs/development/openapi/)
|
||||
* [知识库结构详解](https://doc.tryfastgpt.ai/docs/course/dataset_engine/)
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -120,7 +120,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
扫码加入飞书话题群 (新开,逐渐弃用微信群):
|
||||
|
||||

|
||||

|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -149,7 +149,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
## 🌿 第三方生态
|
||||
|
||||
- [OnWeChat 个人微信/企微机器人](https://doc.fastgpt.in/docs/use-cases/onwechat/)
|
||||
- [OnWeChat 个人微信/企微机器人](https://doc.tryfastgpt.ai/docs/use-cases/onwechat/)
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||
@@ -212,4 +212,4 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
1. 允许作为后台服务直接商用,但不允许提供 SaaS 服务。
|
||||
2. 未经商业授权,任何形式的商用服务均需保留相关版权信息。
|
||||
3. 完整请查看 [FastGPT Open Source License](./LICENSE)
|
||||
4. 联系方式:Dennis@sealos.io,[点击查看商业版定价策略](https://doc.fastgpt.in/docs/commercial)
|
||||
4. 联系方式:Dennis@sealos.io,[点击查看商业版定价策略](https://doc.tryfastgpt.ai/docs/commercial)
|
||||
|
||||
22
README_en.md
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
<a href="https://fastgpt.in/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
<a href="https://tryfastgpt.ai/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
|
||||
# FastGPT
|
||||
|
||||
@@ -15,13 +15,13 @@ FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://fastgpt.in/">
|
||||
<a href="https://tryfastgpt.ai/">
|
||||
<img height="21" src="https://img.shields.io/badge/Try it Online-d4eaf7?style=flat-square&logo=spoj&logoColor=7d09f1" alt="cloud">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/intro">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/intro">
|
||||
<img height="21" src="https://img.shields.io/badge/Documents-7d09f1?style=flat-square" alt="document">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/development">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/development">
|
||||
<img height="21" src="https://img.shields.io/badge/Local Development-%23d4eaf7?style=flat-square&logo=xcode&logoColor=7d09f1" alt="development">
|
||||
</a>
|
||||
<a href="https://github.com/labring/FastGPT/blob/main/LICENSE">
|
||||
@@ -39,7 +39,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
## 🛸 Use Cloud Services
|
||||
|
||||
Cloud: [fastgpt.in](https://fastgpt.in/)
|
||||
Cloud: [tryfastgpt.ai](https://tryfastgpt.ai/)
|
||||
|
||||
| | |
|
||||
| ---------------------------------- | ---------------------------------- |
|
||||
@@ -113,16 +113,16 @@ Project tech stack: NextJs + TS + ChakraUI + Mongo + Postgres (Vector plugin)
|
||||
|
||||
Give it a 2-4 minute wait after deployment as it sets up the database. Initially, it might be a tad slow since we're using the basic settings.
|
||||
|
||||
- [Getting Started with Local Development](https://doc.fastgpt.in/docs/development)
|
||||
- [Deploying FastGPT](https://doc.fastgpt.in/docs/installation)
|
||||
- [Guide on System Configs](https://doc.fastgpt.in/docs/installation/reference)
|
||||
- [Configuring Multiple Models](https://doc.fastgpt.in/docs/installation/reference/models)
|
||||
- [Version Updates & Upgrades](https://doc.fastgpt.in/docs/installation/upgrading)
|
||||
- [Getting Started with Local Development](https://doc.tryfastgpt.ai/docs/development)
|
||||
- [Deploying FastGPT](https://doc.tryfastgpt.ai/docs/installation)
|
||||
- [Guide on System Configs](https://doc.tryfastgpt.ai/docs/installation/reference)
|
||||
- [Configuring Multiple Models](https://doc.tryfastgpt.ai/docs/installation/reference/models)
|
||||
- [Version Updates & Upgrades](https://doc.tryfastgpt.ai/docs/installation/upgrading)
|
||||
|
||||
|
||||
## 🏘️ Community & support
|
||||
|
||||
+ 🌐 Visit the [FastGPT website](https://fastgpt.in/) for full documentation and useful links.
|
||||
+ 🌐 Visit the [FastGPT website](https://tryfastgpt.ai/) for full documentation and useful links.
|
||||
+ 💬 Join our [Discord server](https://discord.gg/mp68xkZn2Q) is to chat with FastGPT developers and other FastGPT users. This is a good place to learn about FastGPT, ask questions, and share your experiences.
|
||||
+ 🐞 Create [GitHub Issues](https://github.com/labring/FastGPT/issues/new/choose) for bug reports and feature requests.
|
||||
|
||||
|
||||
20
README_ja.md
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
<a href="https://fastgpt.in/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
<a href="https://tryfastgpt.ai/"><img src="/.github/imgs/logo.svg" width="120" height="120" alt="fastgpt logo"></a>
|
||||
|
||||
# FastGPT
|
||||
|
||||
@@ -15,13 +15,13 @@ FastGPT は、LLM 上 に 構築 された 知識 ベースの Q&A システム
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://fastgpt.in/">
|
||||
<a href="https://tryfastgpt.ai/">
|
||||
<img height="21" src="https://img.shields.io/badge/在线使用-d4eaf7?style=flat-square&logo=spoj&logoColor=7d09f1" alt="cloud">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/intro">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/intro">
|
||||
<img height="21" src="https://img.shields.io/badge/相关文档-7d09f1?style=flat-square" alt="document">
|
||||
</a>
|
||||
<a href="https://doc.fastgpt.in/docs/development">
|
||||
<a href="https://doc.tryfastgpt.ai/docs/development">
|
||||
<img height="21" src="https://img.shields.io/badge/本地开发-%23d4eaf7?style=flat-square&logo=xcode&logoColor=7d09f1" alt="development">
|
||||
</a>
|
||||
<a href="/#-%E7%9B%B8%E5%85%B3%E9%A1%B9%E7%9B%AE">
|
||||
@@ -36,7 +36,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
## 🛸 クラウドサービスの 利用
|
||||
|
||||
[fastgpt.in](https://fastgpt.in/)
|
||||
[tryfastgpt.ai](https://tryfastgpt.ai/)
|
||||
|
||||
| | |
|
||||
| ---------------------------------- | ---------------------------------- |
|
||||
@@ -98,11 +98,11 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
||||
|
||||
デプロイ 後、データベースをセットアップするので、2~4分待 ってください。基本設定 を 使 っているので、最初 は 少 し 遅 いかもしれません。
|
||||
|
||||
- [ローカル 開発入門](https://doc.fastgpt.in/docs/development)
|
||||
- [FastGPT のデプロイ](https://doc.fastgpt.in/docs/installation)
|
||||
- [システム 設定 ガイド](https://doc.fastgpt.in/docs/installation/reference)
|
||||
- [複数 モデルの 設定](https://doc.fastgpt.in/docs/installation/reference/models)
|
||||
- [バージョン 更新 とアップグレード](https://doc.fastgpt.in/docs/installation/upgrading)
|
||||
- [ローカル 開発入門](https://doc.tryfastgpt.ai/docs/development)
|
||||
- [FastGPT のデプロイ](https://doc.tryfastgpt.ai/docs/installation)
|
||||
- [システム 設定 ガイド](https://doc.tryfastgpt.ai/docs/installation/reference)
|
||||
- [複数 モデルの 設定](https://doc.tryfastgpt.ai/docs/installation/reference/models)
|
||||
- [バージョン 更新 とアップグレード](https://doc.tryfastgpt.ai/docs/installation/upgrading)
|
||||
|
||||
<!-- ## :point_right: ロードマップ
|
||||
- [FastGPT ロードマップ](https://kjqvjse66l.feishu.cn/docx/RVUxdqE2WolDYyxEKATcM0XXnte) -->
|
||||
|
||||
4
dev.md
@@ -29,6 +29,10 @@ Note: If the Node version is >= 20, you need to pass the `--no-node-snapshot` pa
|
||||
NODE_OPTIONS=--no-node-snapshot pnpm i
|
||||
```
|
||||
|
||||
### Jest
|
||||
|
||||
https://fael3z0zfze.feishu.cn/docx/ZOI1dABpxoGhS7xzhkXcKPxZnDL
|
||||
|
||||
## I18N
|
||||
|
||||
### Install i18n-ally Plugin
|
||||
|
||||
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 165 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 299 KiB After Width: | Height: | Size: 298 KiB |
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 159 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 119 KiB |
@@ -11,7 +11,7 @@ FastGPT 项目在 Apache License 2.0 许可下开源,同时包含以下附加
|
||||
|
||||
+ FastGPT 允许被用于商业化,例如作为其他应用的“后端即服务”使用,或者作为应用开发平台提供给企业。然而,当满足以下条件时,必须联系作者获得商业许可:
|
||||
|
||||
+ 多租户 SaaS 服务:除非获得 FastGPT 的明确书面授权,否则不得使用 fastgpt.in 的源码来运营与 fastgpt.in 服务类似的多租户 SaaS 服务。
|
||||
+ 多租户 SaaS 服务:除非获得 FastGPT 的明确书面授权,否则不得使用 tryfastgpt.ai 的源码来运营与 tryfastgpt.ai 服务类似的多租户 SaaS 服务。
|
||||
+ LOGO 及版权信息:在使用 FastGPT 的过程中,不得移除或修改 FastGPT 控制台内的 LOGO 或版权信息。
|
||||
|
||||
请通过电子邮件 yujinlong@sealos.io 联系我们咨询许可事宜。
|
||||
|
||||
@@ -42,7 +42,7 @@ FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 Fast
|
||||
|
||||
FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引为`HNSW`。且`PostgresSQL`仅用于向量检索(该引擎可以替换成其它数据库),`MongoDB`用于其他数据的存取。
|
||||
|
||||
在`MongoDB`的`dataset.datas`表中,会存储向量原数据的信息,同时有一个`indexes`字段,会记录其对应的向量ID,这是一个数组,也就是说,一组向量可以对应多组数据。
|
||||
在`MongoDB`的`dataset.datas`表中,会存储向量原数据的信息,同时有一个`indexes`字段,会记录其对应的向量ID,这是一个数组,也就是说,一组数据可以对应多个向量。
|
||||
|
||||
在`PostgresSQL`的表中,设置一个`vector`字段用于存储向量。在检索时,会先召回向量,再根据向量的ID,去`MongoDB`中寻找原数据内容,如果对应了同一组原数据,则进行合并,向量得分取最高得分。
|
||||
|
||||
|
||||
@@ -86,3 +86,12 @@ Verification Token 默认生成的这个 Token 用于校验来源。但我们使
|
||||
然后就可以在工作台里找到你的机器人啦。接下来就是把机器人拉进群组,或者单独与它对话。
|
||||
|
||||

|
||||
|
||||
## FAQ
|
||||
|
||||
### 发送了消息,没响应
|
||||
|
||||
1. 检查飞书机器人回调地址、权限等是否正确。
|
||||
2. 查看 FastGPT 对话日志,是否有对应的提问记录
|
||||
3. 如果有记录,飞书没回应,则是没给机器人开权限。
|
||||
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。(飞书机器人无法输入全局变量、文件、图片内容)
|
||||
@@ -114,7 +114,7 @@ ${content}
|
||||
它接收一个`string`类型的输入,除了可以引用文档解析结果外,还可以实现自定义内容引用,最终会进行提示词拼接,放置在 role=system 的消息中。提示词模板如下:
|
||||
|
||||
```
|
||||
将 <Quote></Quote> 中的内容作为你的知识:
|
||||
将 <Quote></Quote> 中的内容作为本次对话的参考:
|
||||
<Quote>
|
||||
{{quote}}
|
||||
</Quote>
|
||||
|
||||
@@ -36,7 +36,7 @@ weight: 113
|
||||
|
||||
私有部署的用户可自行查阅自己的 IP 地址。
|
||||
|
||||
海外版用户(fastgpt.in)可以填写下面的 IP 白名单:
|
||||
海外版用户(cloud.tryfastgpt.ai)可以填写下面的 IP 白名单:
|
||||
|
||||
```
|
||||
34.87.20.17
|
||||
@@ -62,6 +62,23 @@ weight: 113
|
||||
34.142.157.52
|
||||
```
|
||||
|
||||
国内版用户(fastgpt.cn)可以填写下面的 IP 白名单:
|
||||
|
||||
```
|
||||
47.97.59.172
|
||||
121.43.108.48
|
||||
121.41.75.88
|
||||
121.41.178.7
|
||||
121.40.65.187
|
||||
121.196.235.183
|
||||
120.55.195.90
|
||||
120.55.193.112
|
||||
120.26.229.115
|
||||
112.124.41.79
|
||||
101.37.205.32
|
||||
47.98.190.173
|
||||
```
|
||||
|
||||
## 4. 获取AES Key,选择加密方式
|
||||
|
||||

|
||||
|
||||
@@ -27,7 +27,7 @@ Tips: 安全起见,你可以设置一个额度或者过期时间,放置 key
|
||||
## 替换三方应用的变量
|
||||
|
||||
```bash
|
||||
OPENAI_API_BASE_URL: https://api.fastgpt.in/api (改成自己部署的域名)
|
||||
OPENAI_API_BASE_URL: https://api.tryfastgpt.ai/api (改成自己部署的域名)
|
||||
OPENAI_API_KEY = 上一步获取到的密钥
|
||||
```
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Web 站点同步利用爬虫的技术,可以通过一个入口网站,自动
|
||||
Tips: 国内的媒体站点基本不可用,公众号、csdn、知乎等。可以通过终端发送`curl`请求检测是否为静态站点,例如:
|
||||
|
||||
```bash
|
||||
curl https://doc.fastgpt.in/docs/intro/
|
||||
curl https://doc.tryfastgpt.ai/docs/intro/
|
||||
```
|
||||
|
||||
## 如何使用
|
||||
|
||||
@@ -13,9 +13,7 @@ weight: 708
|
||||
|
||||
这个配置文件中包含了系统参数和各个模型配置:
|
||||
|
||||
## 4.6.8+ 版本新配置文件
|
||||
|
||||
llm模型全部合并
|
||||
## 4.6.8+ 版本新配置文件示例
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -29,16 +27,16 @@ llm模型全部合并
|
||||
},
|
||||
"llmModels": [
|
||||
{
|
||||
"model": "gpt-3.5-turbo", // 模型名(对应OneAPI中渠道的模型名)
|
||||
"name": "gpt-3.5-turbo", // 别名
|
||||
"model": "gpt-4o-mini", // 模型名(对应OneAPI中渠道的模型名)
|
||||
"name": "gpt-4o-mini", // 模型别名
|
||||
"avatar": "/imgs/model/openai.svg", // 模型的logo
|
||||
"maxContext": 16000, // 最大上下文
|
||||
"maxResponse": 4000, // 最大回复
|
||||
"quoteMaxToken": 13000, // 最大引用内容
|
||||
"maxContext": 125000, // 最大上下文
|
||||
"maxResponse": 16000, // 最大回复
|
||||
"quoteMaxToken": 120000, // 最大引用内容
|
||||
"maxTemperature": 1.2, // 最大温度
|
||||
"charsPointsPrice": 0, // n积分/1k token(商业版)
|
||||
"charsPointsPrice": 0, // n积分/1k token(商业版)
|
||||
"censor": false, // 是否开启敏感校验(商业版)
|
||||
"vision": false, // 是否支持图片输入
|
||||
"vision": true, // 是否支持图片输入
|
||||
"datasetProcess": true, // 是否设置为知识库处理模型(QA),务必保证至少有一个为true,否则知识库会报错
|
||||
"usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true)
|
||||
"usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true)
|
||||
@@ -49,20 +47,20 @@ llm模型全部合并
|
||||
"customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型
|
||||
"customExtractPrompt": "", // 自定义内容提取提示词
|
||||
"defaultSystemChatPrompt": "", // 对话默认携带的系统提示词
|
||||
"defaultConfig":{} // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p)
|
||||
"defaultConfig": {} // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p)
|
||||
},
|
||||
{
|
||||
"model": "gpt-4-0125-preview",
|
||||
"name": "gpt-4-turbo",
|
||||
"model": "gpt-4o",
|
||||
"name": "gpt-4o",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 100000,
|
||||
"quoteMaxToken": 120000,
|
||||
"maxTemperature": 1.2,
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": false,
|
||||
"vision": true,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
@@ -72,30 +70,61 @@ llm模型全部合并
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig":{}
|
||||
"defaultConfig": {}
|
||||
},
|
||||
{
|
||||
"model": "gpt-4-vision-preview",
|
||||
"name": "gpt-4-vision",
|
||||
"model": "o1-mini",
|
||||
"name": "o1-mini",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"maxContext": 128000,
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 100000,
|
||||
"quoteMaxToken": 120000,
|
||||
"maxTemperature": 1.2,
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": true,
|
||||
"datasetProcess": false,
|
||||
"usedInClassify": false,
|
||||
"usedInExtractFields": false,
|
||||
"usedInToolCall": false,
|
||||
"usedInQueryExtension": false,
|
||||
"toolChoice": true,
|
||||
"vision": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
"usedInQueryExtension": true,
|
||||
"toolChoice": false,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig":{}
|
||||
"defaultConfig": {
|
||||
"temperature": 1,
|
||||
"max_tokens": null,
|
||||
"stream": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "o1-preview",
|
||||
"name": "o1-preview",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 120000,
|
||||
"maxTemperature": 1.2,
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
"usedInQueryExtension": true,
|
||||
"toolChoice": false,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {
|
||||
"temperature": 1,
|
||||
"max_tokens": null,
|
||||
"stream": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"vectorModels": [
|
||||
@@ -107,9 +136,30 @@ llm模型全部合并
|
||||
"defaultToken": 700, // 默认文本分割时候的 token
|
||||
"maxToken": 3000, // 最大 token
|
||||
"weight": 100, // 优先训练权重
|
||||
"defaultConfig":{}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024,来返回1024维度的向量。(目前必须小于1536维度)
|
||||
"defaultConfig": {}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024,来返回1024维度的向量。(目前必须小于1536维度)
|
||||
"dbConfig": {}, // 存储时的额外参数(非对称向量模型时候需要用到)
|
||||
"queryConfig": {} // 参训时的额外参数
|
||||
},
|
||||
{
|
||||
"model": "text-embedding-3-large",
|
||||
"name": "text-embedding-3-large",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"charsPointsPrice": 0,
|
||||
"defaultToken": 512,
|
||||
"maxToken": 3000,
|
||||
"weight": 100,
|
||||
"defaultConfig": {
|
||||
"dimensions": 1024
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "text-embedding-3-small",
|
||||
"name": "text-embedding-3-small",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"charsPointsPrice": 0,
|
||||
"defaultToken": 512,
|
||||
"maxToken": 3000,
|
||||
"weight": 100
|
||||
}
|
||||
],
|
||||
"reRankModels": [],
|
||||
@@ -142,7 +192,7 @@ llm模型全部合并
|
||||
|
||||
- /imgs/model/baichuan.svg - 百川
|
||||
- /imgs/model/chatglm.svg - 智谱
|
||||
- /imgs/model/calude.svg - calude
|
||||
- /imgs/model/claude.svg - claude
|
||||
- /imgs/model/ernie.svg - 文心一言
|
||||
- /imgs/model/moonshot.svg - 月之暗面
|
||||
- /imgs/model/openai.svg - OpenAI GPT
|
||||
|
||||
@@ -110,7 +110,7 @@ brew install orbstack
|
||||
|
||||
非 Linux 环境或无法访问外网环境,可手动创建一个目录,并下载配置文件和对应版本的`docker-compose.yml`,在这个文件夹中依据下载的配置文件运行docker,若作为本地开发使用推荐`docker-compose-pgvector`版本,并且自行拉取并运行`sandbox`和`fastgpt`,并在docker配置文件中注释掉`sandbox`和`fastgpt`的部分
|
||||
|
||||
- [config.json](https://github.com/labring/FastGPT/blob/main/projects/app/data/config.json)
|
||||
- [config.json](https://raw.githubusercontent.com/labring/FastGPT/refs/heads/main/projects/app/data/config.json)
|
||||
- [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/files/docker) (注意,不同向量库版本的文件不一样)
|
||||
|
||||
{{% alert icon="🤖" context="success" %}}
|
||||
|
||||
@@ -121,4 +121,148 @@ OneAPI 的 API Key 配置错误,需要修改`OPENAI_API_KEY`环境变量,并
|
||||
|
||||
1. 模型服务不可用
|
||||
2. 模型接口参数异常(温度、max token等可能不适配)
|
||||
3. ....
|
||||
3. ....
|
||||
|
||||
|
||||
## 四、常见模型问题
|
||||
|
||||
### 报错 - 模型响应为空
|
||||
|
||||
该错误是由于 stream 模式下,oneapi 直接结束了流请求,并且未返回任何内容导致。
|
||||
|
||||
4.8.10 版本新增了错误日志,报错时,会在日志中打印出实际发送的 Body 参数,可以复制该参数后,通过 curl 向 oneapi 发起请求测试。
|
||||
|
||||
由于 oneapi 在 stream 模式下,无法正确捕获错误,可以设置成 `stream=false` 后进行测试。
|
||||
|
||||
### 如何测试模型是否支持工具调用
|
||||
|
||||
需要模型提供商和 oneapi 同时支持工具调用才可使用,测试方法如下:
|
||||
|
||||
1. 通过 `curl` 向 `oneapi` 发起第一轮 stream 模式的 tool 测试。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://oneapi.xxx/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer sk-xxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"model": "gpt-4o-mini",
|
||||
"temperature": 0.01,
|
||||
"max_tokens": 8000,
|
||||
"stream": true,
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "几点了"
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "hCVbIY",
|
||||
"description": "获取用户当前时区的时间。",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"tool_choice": "auto"
|
||||
}'
|
||||
```
|
||||
|
||||
2. 检查响应参数
|
||||
|
||||
如果能正常调用工具,会返回对应 `tool_calls` 参数。
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "chatcmpl-A7kwo1rZ3OHYSeIFgfWYxu8X2koN3",
|
||||
"object": "chat.completion.chunk",
|
||||
"created": 1726412126,
|
||||
"model": "gpt-4o-mini-2024-07-18",
|
||||
"system_fingerprint": "fp_483d39d857",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"delta": {
|
||||
"role": "assistant",
|
||||
"content": null,
|
||||
"tool_calls": [
|
||||
{
|
||||
"index": 0,
|
||||
"id": "call_0n24eiFk8OUyIyrdEbLdirU7",
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "mEYIcFl84rYC",
|
||||
"arguments": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"refusal": null
|
||||
},
|
||||
"logprobs": null,
|
||||
"finish_reason": null
|
||||
}
|
||||
],
|
||||
"usage": null
|
||||
}
|
||||
```
|
||||
|
||||
3. 通过 `curl` 向 `oneapi` 发起第二轮 stream 模式的 tool 测试。
|
||||
|
||||
第二轮请求是把工具结果发送给模型。发起后会得到模型回答的结果。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://oneapi.xxxx/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer sk-xxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"model": "gpt-4o-mini",
|
||||
"temperature": 0.01,
|
||||
"max_tokens": 8000,
|
||||
"stream": true,
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "几点了"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"tool_calls": [
|
||||
{
|
||||
"id": "kDia9S19c4RO",
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "hCVbIY",
|
||||
"arguments": "{}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tool_call_id": "kDia9S19c4RO",
|
||||
"role": "tool",
|
||||
"name": "hCVbIY",
|
||||
"content": "{\n \"time\": \"2024-09-14 22:59:21 Sunday\"\n}"
|
||||
}
|
||||
],
|
||||
"tools": [
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "hCVbIY",
|
||||
"description": "获取用户当前时区的时间。",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"tool_choice": "auto"
|
||||
}'
|
||||
```
|
||||
@@ -7,11 +7,11 @@ toc: true
|
||||
weight: 705
|
||||
---
|
||||
|
||||
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://fastgpt.in),。
|
||||
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://tryfastgpt.ai),。
|
||||
|
||||
## 前置依赖项
|
||||
|
||||
您需要在计算机上安装和配置以下依赖项才能构建 [FastGPT](https://fastgpt.in):
|
||||
您需要在计算机上安装和配置以下依赖项才能构建 [FastGPT](https://tryfastgpt.ai):
|
||||
|
||||
- [Git](http://git-scm.com/)
|
||||
- [Docker](https://www.docker.com/)(构建镜像)
|
||||
|
||||
@@ -135,7 +135,7 @@ CHAT_API_KEY=sk-xxxxxx
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false, // 是否支持图片输入
|
||||
"datasetProcess": false, // 是否设置为知识库处理模型
|
||||
"datasetProcess": true, // 是否设置为知识库处理模型
|
||||
"usedInClassify": true, // 是否用于问题分类
|
||||
"usedInExtractFields": true, // 是否用于字段提取
|
||||
"usedInToolCall": true, // 是否用于工具调用
|
||||
|
||||
@@ -32,7 +32,7 @@ FastGPT 的 API Key **有 2 类**,一类是全局通用的 key (无法直接
|
||||
OpenAPI 中,所有的接口都通过 Header.Authorization 进行鉴权。
|
||||
|
||||
```
|
||||
baseUrl: "https://api.fastgpt.in/api"
|
||||
baseUrl: "https://api.tryfastgpt.ai/api"
|
||||
headers: {
|
||||
Authorization: "Bearer {{apikey}}"
|
||||
}
|
||||
@@ -41,7 +41,7 @@ headers: {
|
||||
**发起应用对话示例**
|
||||
|
||||
```sh
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
||||
@@ -29,7 +29,7 @@ weight: 852
|
||||
{{< markdownify >}}
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
@@ -332,7 +332,7 @@ curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
|
||||
},
|
||||
{
|
||||
"nodeId": "pluginOutput",
|
||||
"moduleName": "自定义插件输出",
|
||||
"moduleName": "插件输出",
|
||||
"moduleType": "pluginOutput",
|
||||
"totalPoints": 0,
|
||||
"pluginOutput": {
|
||||
@@ -430,7 +430,7 @@ event: answer
|
||||
data: [DONE]
|
||||
|
||||
event: flowResponses
|
||||
data: [{"nodeId":"fdDgXQ6SYn8v","moduleName":"AI 对话","moduleType":"chatNode","totalPoints":0.033,"model":"FastAI-3.5","tokens":33,"query":"你好","maxToken":2000,"historyPreview":[{"obj":"Human","value":"你好"},{"obj":"AI","value":"你好!有什么可以帮助你的吗?"}],"contextTotalLen":2,"runningTime":1.42},{"nodeId":"pluginOutput","moduleName":"自定义插件输出","moduleType":"pluginOutput","totalPoints":0,"pluginOutput":{"result":"你好!有什么可以帮助你的吗?"},"runningTime":0}]
|
||||
data: [{"nodeId":"fdDgXQ6SYn8v","moduleName":"AI 对话","moduleType":"chatNode","totalPoints":0.033,"model":"FastAI-3.5","tokens":33,"query":"你好","maxToken":2000,"historyPreview":[{"obj":"Human","value":"你好"},{"obj":"AI","value":"你好!有什么可以帮助你的吗?"}],"contextTotalLen":2,"runningTime":1.42},{"nodeId":"pluginOutput","moduleName":"插件输出","moduleType":"pluginOutput","totalPoints":0,"pluginOutput":{"result":"你好!有什么可以帮助你的吗?"},"runningTime":0}]
|
||||
```
|
||||
|
||||
{{< /markdownify >}}
|
||||
|
||||
@@ -22,7 +22,7 @@ weight: 853
|
||||
**新例子**
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/support/wallet/usage/createTrainingUsage' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/support/wallet/usage/createTrainingUsage' \
|
||||
--header 'Authorization: Bearer {{apikey}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
@@ -34,7 +34,7 @@ curl --location --request POST 'https://api.fastgpt.in/api/support/wallet/usage/
|
||||
**x例子**
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/support/wallet/bill/createTrainingBill' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/support/wallet/bill/createTrainingBill' \
|
||||
--header 'Authorization: Bearer {{apikey}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
@@ -312,6 +312,8 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?
|
||||
| chunkSize | 预估块大小 | |
|
||||
| chunkSplitter | 自定义最高优先分割符号 | |
|
||||
| qaPrompt | qa拆分提示词 | |
|
||||
| tags | 集合标签(字符串数组) | |
|
||||
| createTime | 文件创建时间(Date / String) | |
|
||||
|
||||
**出参**
|
||||
|
||||
@@ -466,7 +468,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio
|
||||
--header 'Authorization: Bearer {{authorization}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"link":"https://doc.fastgpt.in/docs/course/quick-start/",
|
||||
"link":"https://doc.tryfastgpt.ai/docs/course/quick-start/",
|
||||
"datasetId":"6593e137231a2be9c5603ba7",
|
||||
"parentId": null,
|
||||
|
||||
@@ -604,9 +606,11 @@ curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/co
|
||||
--data-raw '{
|
||||
"externalFileUrl":"https://image.xxxxx.com/fastgpt-dev/%E6%91%82.pdf",
|
||||
"externalFileId":"1111",
|
||||
"filename":"自定义文件名",
|
||||
"createTime": "2024-05-01T00:00:00.000Z",
|
||||
"filename":"自定义文件名.pdf",
|
||||
"datasetId":"6642d105a5e9d2b00255b27b",
|
||||
"parentId": null,
|
||||
"tags": ["tag1","tag2"],
|
||||
|
||||
"trainingType": "chunk",
|
||||
"chunkSize":512,
|
||||
@@ -625,7 +629,8 @@ curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/co
|
||||
| --- | --- | --- |
|
||||
| externalFileUrl | 文件访问链接(可以是临时链接) | ✅ |
|
||||
| externalFileId | 外部文件ID | |
|
||||
| filename | 自定义文件名 | |
|
||||
| filename | 自定义文件名,需要带后缀 | |
|
||||
| createTime | 文件创建时间(Date ISO 字符串都 ok) | |
|
||||
|
||||
|
||||
{{< /markdownify >}}
|
||||
@@ -710,7 +715,21 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio
|
||||
"updateTime": "2099-01-01T00:00:00.000Z",
|
||||
"dataAmount": 3,
|
||||
"trainingAmount": 0,
|
||||
"canWrite": true
|
||||
"externalFileId": "1111",
|
||||
"tags": [
|
||||
"11",
|
||||
"测试的"
|
||||
],
|
||||
"forbid": false,
|
||||
"trainingType": "chunk",
|
||||
"permission": {
|
||||
"value": 4294967295,
|
||||
"isOwner": true,
|
||||
"hasManagePer": true,
|
||||
"hasWritePer": true,
|
||||
"hasReadPer": true
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
"_id": "65abd0ad9d1448617cba6031",
|
||||
@@ -718,11 +737,23 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio
|
||||
"tmbId": "65422be6aa44b7da77729ec9",
|
||||
"type": "link",
|
||||
"name": "快速上手 | FastGPT",
|
||||
"rawLink": "https://doc.fastgpt.in/docs/course/quick-start/",
|
||||
"rawLink": "https://doc.tryfastgpt.ai/docs/course/quick-start/",
|
||||
"updateTime": "2024-01-20T13:54:53.031Z",
|
||||
"dataAmount": 3,
|
||||
"trainingAmount": 0,
|
||||
"canWrite": true
|
||||
"externalFileId": "222",
|
||||
"tags": [
|
||||
"测试的"
|
||||
],
|
||||
"forbid": false,
|
||||
"trainingType": "chunk",
|
||||
"permission": {
|
||||
"value": 4294967295,
|
||||
"isOwner": true,
|
||||
"hasManagePer": true,
|
||||
"hasWritePer": true,
|
||||
"hasReadPer": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"total": 93
|
||||
@@ -813,14 +844,36 @@ curl --location --request GET 'http://localhost:3000/api/core/dataset/collection
|
||||
{{< tab tabName="请求示例" >}}
|
||||
{{< markdownify >}}
|
||||
|
||||
**通过集合 ID 修改集合信息**
|
||||
|
||||
```bash
|
||||
curl --location --request PUT 'http://localhost:3000/api/core/dataset/collection/update' \
|
||||
--header 'Authorization: Bearer {{authorization}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"id":"65abcfab9d1448617cba5f0d",
|
||||
"parentId":null,
|
||||
"name":"测2222试"
|
||||
"parentId": null,
|
||||
"name": "测2222试",
|
||||
"tags": ["tag1", "tag2"],
|
||||
"forbid": false,
|
||||
"createTime": "2024-01-01T00:00:00.000Z"
|
||||
}'
|
||||
```
|
||||
|
||||
**通过外部文件 ID 修改集合信息**, 只需要把 id 换成 datasetId 和 externalFileId。
|
||||
|
||||
```bash
|
||||
curl --location --request PUT 'http://localhost:3000/api/core/dataset/collection/update' \
|
||||
--header 'Authorization: Bearer {{authorization}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"datasetId":"6593e137231a2be9c5603ba7",
|
||||
"externalFileId":"1111",
|
||||
"parentId": null,
|
||||
"name": "测2222试",
|
||||
"tags": ["tag1", "tag2"],
|
||||
"forbid": false,
|
||||
"createTime": "2024-01-01T00:00:00.000Z"
|
||||
}'
|
||||
```
|
||||
|
||||
@@ -834,6 +887,9 @@ curl --location --request PUT 'http://localhost:3000/api/core/dataset/collection
|
||||
- id: 集合的ID
|
||||
- parentId: 修改父级ID(可选)
|
||||
- name: 修改集合名称(可选)
|
||||
- tags: 修改集合标签(可选)
|
||||
- forbid: 修改集合禁用状态(可选)
|
||||
- createTime: 修改集合创建时间(可选)
|
||||
{{% /alert %}}
|
||||
|
||||
{{< /markdownify >}}
|
||||
@@ -935,7 +991,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collect
|
||||
{{< markdownify >}}
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/data/pushData' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/core/dataset/data/pushData' \
|
||||
--header 'Authorization: Bearer apikey' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
@@ -1272,7 +1328,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/de
|
||||
{{< markdownify >}}
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/searchTest' \
|
||||
curl --location --request POST 'https://api.tryfastgpt.ai/api/core/dataset/searchTest' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
|
||||
@@ -53,9 +53,9 @@ weight: 860
|
||||
|
||||
在分享链接的地址中,增加一个额外的参数: authToken。例如:
|
||||
|
||||
原始的链接:`https://share.fastgpt.in/chat/share?shareId=648aaf5ae121349a16d62192`
|
||||
原始的链接:`https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192`
|
||||
|
||||
完整链接: `https://share.fastgpt.in/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345`
|
||||
完整链接: `https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345`
|
||||
|
||||
这个`authToken`通常是你系统生成的用户唯一凭证(Token之类的)。FastGPT 会在鉴权接口的`body`中携带 token={{authToken}} 的参数。
|
||||
|
||||
@@ -227,7 +227,7 @@ curl --location --request POST '{{host}}/shareAuth/finish' \
|
||||
"historyPreview": [
|
||||
{
|
||||
"obj": "Human",
|
||||
"value": "使用 <Data></Data> 标记中的内容作为你的知识:\n\n<Data>\n导演是谁?\n电影《铃芽之旅》的导演是新海诚。\n------\n电影《铃芽之旅》的编剧是谁?22\n新海诚是本片的编剧。\n------\n电影《铃芽之旅》的女主角是谁?\n电影的女主角是铃芽。\n------\n电影《铃芽之旅》的制作团队中有哪位著名人士?2\n川村元气是本片的制作团队成员之一。\n------\n你是谁?\n我是电影《铃芽之旅》助手\n------\n电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。\n------\n电影《铃芽之旅》的作者新海诚写了一本小说,叫什么名字?\n小说名字叫《铃芽之旅》。\n------\n电影《铃芽之旅》的女主角是谁?\n电影《铃芽之旅》的女主角是岩户铃芽,由原菜乃华配音。\n------\n电影《铃芽之旅》的故事背景是什么?\n日本\n------\n谁担任电影《铃芽之旅》中岩户环的配音?\n深津绘里担任电影《铃芽之旅》中岩户环的配音。\n</Data>\n\n回答要求:\n- 如果你不清楚答案,你需要澄清。\n- 避免提及你是从 <Data></Data> 获取的知识。\n- 保持答案与 <Data></Data> 中描述的一致。\n- 使用 Markdown 语法优化回答格式。\n- 使用与问题相同的语言回答。\n\n问题:\"\"\"导演是谁\"\"\""
|
||||
"value": "使用 <Data></Data> 标记中的内容作为本次对话的参考:\n\n<Data>\n导演是谁?\n电影《铃芽之旅》的导演是新海诚。\n------\n电影《铃芽之旅》的编剧是谁?22\n新海诚是本片的编剧。\n------\n电影《铃芽之旅》的女主角是谁?\n电影的女主角是铃芽。\n------\n电影《铃芽之旅》的制作团队中有哪位著名人士?2\n川村元气是本片的制作团队成员之一。\n------\n你是谁?\n我是电影《铃芽之旅》助手\n------\n电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。\n------\n电影《铃芽之旅》的作者新海诚写了一本小说,叫什么名字?\n小说名字叫《铃芽之旅》。\n------\n电影《铃芽之旅》的女主角是谁?\n电影《铃芽之旅》的女主角是岩户铃芽,由原菜乃华配音。\n------\n电影《铃芽之旅》的故事背景是什么?\n日本\n------\n谁担任电影《铃芽之旅》中岩户环的配音?\n深津绘里担任电影《铃芽之旅》中岩户环的配音。\n</Data>\n\n回答要求:\n- 如果你不清楚答案,你需要澄清。\n- 避免提及你是从 <Data></Data> 获取的知识。\n- 保持答案与 <Data></Data> 中描述的一致。\n- 使用 Markdown 语法优化回答格式。\n- 使用与问题相同的语言回答。\n\n问题:\"\"\"导演是谁\"\"\""
|
||||
},
|
||||
{
|
||||
"obj": "AI",
|
||||
@@ -387,9 +387,9 @@ export default async function (ctx: FunctionContext) {
|
||||
|
||||
### 3. 修改分享链接参数
|
||||
|
||||
源分享链接:`https://share.fastgpt.in/chat/share?shareId=64be36376a438af0311e599c`
|
||||
源分享链接:`https://share.tryfastgpt.ai/chat/share?shareId=64be36376a438af0311e599c`
|
||||
|
||||
修改后:`https://share.fastgpt.in/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt`
|
||||
修改后:`https://share.tryfastgpt.ai/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt`
|
||||
|
||||
### 4. 测试效果
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据
|
||||
点击右侧的详情,可以查看对应应用的详细信息。
|
||||
|
||||
### 如何更新/升级 FastGPT
|
||||
[升级脚本文档](https://doc.fastgpt.in/docs/development/upgrading/)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级!!!!!
|
||||
[升级脚本文档](https://doc.tryfastgpt.ai/docs/development/upgrading/)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级!!!!!
|
||||
|
||||
例如,目前是4.5 版本,要升级到4.5.1,就先把镜像版本改成v4.5.1,执行一下升级脚本,等待完成后再继续升级。如果目标版本不需要执行初始化,则可以跳过。
|
||||
|
||||
@@ -124,7 +124,7 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据
|
||||
|
||||

|
||||
|
||||
[配置文件参考](https://doc.fastgpt.in/docs/development/configuration/)
|
||||
[配置文件参考](https://doc.tryfastgpt.ai/docs/development/configuration/)
|
||||
|
||||
### 修改站点名称以及 favicon
|
||||
修改应用的环境变量,增加
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: 'V4.8.10(进行中)'
|
||||
title: 'V4.8.10(需要初始化)'
|
||||
description: 'FastGPT V4.8.10 更新说明'
|
||||
icon: 'upgrade'
|
||||
draft: false
|
||||
@@ -11,37 +11,94 @@ weight: 814
|
||||
|
||||
### 1. 做好数据备份
|
||||
|
||||
### 2. 更新商业版环境变量
|
||||
|
||||
### 2. 商业版 —— 修改环境变量
|
||||
|
||||
1. 需要给`fastgpt-pro`镜像,增加沙盒的环境变量:`SANDBOX_URL=http://xxxxx:3000`
|
||||
2. 给两个镜像增加环境变量,以便更好的存储系统日志:
|
||||
2. 给`fastgpt-pro`镜像和`fastgpt`镜像增加环境变量,以便更好的存储系统日志:
|
||||
|
||||
```
|
||||
LOG_LEVEL=debug
|
||||
STORE_LOG_LEVEL=warn
|
||||
```
|
||||
|
||||
### 3. 修改镜像tag
|
||||
|
||||
- 更新 FastGPT 镜像 tag: v4.8.10-fix2
|
||||
- 更新 FastGPT 商业版镜像 tag: v4.8.10-fix
|
||||
- Sandbox 镜像,可以不更新
|
||||
|
||||
## 4. 执行初始化
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4810' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
1. 初始化发布记录版本标记
|
||||
2. 初始化开票记录
|
||||
|
||||
-------
|
||||
|
||||
## V4.8.10 更新说明
|
||||
|
||||
1. 新增 - 模板市场
|
||||
2. 新增 - 工作流节点拖动自动对齐吸附
|
||||
3. 新增 - 用户选择节点(Debug 模式暂未支持)
|
||||
4. 新增 - 工作流撤销和重做
|
||||
5. 新增 - 工作流本次编辑记录,取代自动保存
|
||||
6. 新增 - 工作流版本支持重命名
|
||||
7. 商业版新增 - 飞书机器人接入
|
||||
8. 商业版新增 - 公众号接入接入
|
||||
9. 商业版新增 - 自助开票申请
|
||||
10. 商业版新增 - SSO 定制
|
||||
11. 优化 - 知识库集合禁用,目录禁用会递归修改其下所有 children 的禁用状态。
|
||||
12. 优化 - 节点选择,避免切换 tab 时候,path 加载报错。
|
||||
13. 优化 - 最新 React Markdown 组件,支持 Base64 图片。
|
||||
14. 优化 - 知识库列表 UI。
|
||||
15. 优化 - 支持无网络配置情况下运行。
|
||||
16. 修复 - Prompt 模式调用工具,stream=false 模式下,会携带 0: 开头标记。
|
||||
17. 修复 - 对话日志鉴权问题:仅为 APP 管理员的用户,无法查看对话日志详情。
|
||||
18. 修复 - 选择 Milvus 部署时,无法导出知识库。
|
||||
19. 修复 - 创建 APP 副本,无法复制系统配置。
|
||||
20. 修复 - 图片识别模式下,自动解析图片链接正则不够严谨问题。
|
||||
完整内容请见:[4.8.10 release](https://github.com/labring/FastGPT/releases/tag/v4.8.10)
|
||||
|
||||
1. 新增 - 模板市场。
|
||||
2. 新增 - 工作流节点拖动自动对齐吸附。
|
||||
3. 新增 - 用户选择节点(Debug 模式暂未支持)。
|
||||
4. 新增 - 工作流增加 uid 全局变量。
|
||||
5. 新增 - 工作流撤销和重做。
|
||||
6. 新增 - 工作流本次编辑记录,取代自动保存。
|
||||
7. 新增 - 工作流版本支持重命名。
|
||||
8. 新增 - 工作流的“应用调用”节点弃用,迁移成单独节点,与插件使用方式相同,同时可以传递全局变量和用户上传的文件。
|
||||
9. 新增 - 插件增加使用说明配置。
|
||||
10. 新增 - 插件自定义输入支持单选框。
|
||||
11. 新增 - HTTP 节点支持 text/plain 模式。
|
||||
12. 新增 - HTTP模块支持超时配置、支持更多的 Body 类型,params 和 headers 支持新的变量选择模式。
|
||||
13. 新增 - 工作流导出导入,支持直接导出和导入 JSON 文件,便于交流。
|
||||
14. 新增 - 发送验证码安全校验。
|
||||
15. 商业版新增 - 飞书机器人接入。
|
||||
16. 商业版新增 - 公众号接入接入。
|
||||
17. 商业版新增 - 自助开票申请。
|
||||
18. 商业版新增 - SSO 定制。
|
||||
19. 优化 - 工作流循环校验,避免 skip 循环空转。同时支持分支完全并发执行。
|
||||
20. 优化 - 工作流嵌套执行,参数可能存在的污染问题。
|
||||
21. 优化 - 部分全局变量,增加数据类型约束。
|
||||
22. 优化 - 节点选择,避免切换 tab 时候,path 加载报错。
|
||||
23. 优化 - 最新 React Markdown 组件,支持 Base64 图片。
|
||||
24. 优化 - 对话框性能问题。
|
||||
25. 优化 - 单选框打开后自动滚动到选中的位置。
|
||||
26. 优化 - 知识库集合禁用,目录禁用会递归修改其下所有 children 的禁用状态。
|
||||
27. 优化 - SSE 响应代码优化。
|
||||
28. 优化 - 无 SSL 证书情况下,优化复制。
|
||||
29. 优化 - 知识库列表 UI。
|
||||
30. 优化 - 知识库详情页 UI。
|
||||
31. 优化 - 支持无网络配置情况下运行。
|
||||
32. 优化 - 调整.env.template关于mongodb的说明,使得更易于理解。
|
||||
33. 优化 - 新的支付模式。
|
||||
34. 优化 - 用户默认头像。
|
||||
35. 修复 - Prompt 模式调用工具,stream=false 模式下,会携带 0: 开头标记。
|
||||
36. 修复 - 对话日志鉴权问题:仅为 APP 管理员的用户,无法查看对话日志详情。
|
||||
37. 修复 - 选择 Milvus 部署时,无法导出知识库。
|
||||
38. 修复 - 创建 APP 副本,无法复制系统配置。
|
||||
39. 修复 - 图片识别模式下,自动解析图片链接正则不够严谨问题。
|
||||
40. 修复 - 内容提取的数据类型与输出数据类型未一致。
|
||||
41. 修复 - 工作流运行时间统计错误。
|
||||
42. 修复 - stream 模式下,工具调用有可能出现 undefined。
|
||||
43. 修复 - reranker typo。
|
||||
44. 修复 - home host typo。
|
||||
45. 修复 - i18n display。
|
||||
46. 修复 - 全局变量可重复定义 key。
|
||||
47. 修复 - 全局变量在 Debug 模式下不可持久化。
|
||||
48. 修复 - 全局变量在 API 中无法持久化。
|
||||
49. 修复 - OpenAPI,detail=false模式下,不应该返回 tool 调用结果,仅返回文字。(可解决 cow 不适配问题)。
|
||||
50. 修复 - 知识库标签重复加载。
|
||||
51. 修复 - 网络链接重新获取时,自定义分割符不生效。
|
||||
52. 修复 - 插件运行时,会传递额外的全局变量,可能造成插件内变量污染。
|
||||
53. 文档 - qa docs。
|
||||
54. 文档 - Update feishu.md。
|
||||
55. 文档 - update baseURL。
|
||||
|
||||
113
docSite/content/zh-cn/docs/development/upgrading/4811.md
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
title: 'V4.8.11(进行中)'
|
||||
description: 'FastGPT V4.8.11 更新说明'
|
||||
icon: 'upgrade'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 813
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 做好数据备份
|
||||
|
||||
### 2. 修改配置文件
|
||||
|
||||
如需增加 openai o1 模型,可添加如下配置:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "o1-mini",
|
||||
"name": "o1-mini",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 120000,
|
||||
"maxTemperature": 1.2,
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
"usedInQueryExtension": true,
|
||||
"toolChoice": false,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {
|
||||
"temperature": 1,
|
||||
"stream": false
|
||||
},
|
||||
"fieldMap": {
|
||||
"max_tokens": "max_completion_tokens"
|
||||
}
|
||||
},
|
||||
{
|
||||
"model": "o1-preview",
|
||||
"name": "o1-preview",
|
||||
"avatar": "/imgs/model/openai.svg",
|
||||
"maxContext": 125000,
|
||||
"maxResponse": 4000,
|
||||
"quoteMaxToken": 120000,
|
||||
"maxTemperature": 1.2,
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
"usedInQueryExtension": true,
|
||||
"toolChoice": false,
|
||||
"functionCall": false,
|
||||
"customCQPrompt": "",
|
||||
"customExtractPrompt": "",
|
||||
"defaultSystemChatPrompt": "",
|
||||
"defaultConfig": {
|
||||
"temperature": 1,
|
||||
"stream": false
|
||||
},
|
||||
"fieldMap": {
|
||||
"max_tokens": "max_completion_tokens"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
-------
|
||||
|
||||
### 3. 修改镜像 tag 并重启
|
||||
|
||||
- 更新 FastGPT 镜像 tag: v4.8.11-alpha
|
||||
- 更新 FastGPT 商业版镜像 tag: v4.8.11-alpha
|
||||
- 更新 FastGPT Sandbox 镜像 tag: v4.8.11-alpha
|
||||
|
||||
## V4.8.11 更新说明
|
||||
|
||||
1. 新增 - 表单输入节点,允许用户在工作流中让用户输入一些信息。
|
||||
2. 新增 - 循环运行节点,可传入数组进行批量调用,目前最多支持 50 长度的数组串行执行。
|
||||
3. 新增 - 节点支持折叠。
|
||||
4. 新增 - 聊天记录滚动加载,不再只加载 30 条。
|
||||
5. 新增 - 工作流增加触摸板优先模式,可以通过工作流右下角按键进行切换。
|
||||
6. 新增 - 沙盒增加字符串转 base64 全局方法(全局变量 strToBase64)。
|
||||
7. 新增 - 支持 Openai o1 模型,需增加模型的 `defaultConfig` 配置,覆盖 `temperature`、`max_tokens` 和 `stream`配置,o1 不支持 stream 模式, 详细可重新拉取 `config.json` 配置文件查看。
|
||||
8. 新增 - AI 对话节点知识库引用,支持配置 role=system 和 role=user,已配置的过自定义提示词的节点将会保持 user 模式,其余用户将转成 system 模式。
|
||||
9. 新增 - 插件支持上传系统文件。
|
||||
10. 新增 - 子应用嵌套调用时,版本锁定。主应用未主动更新版本时,不会取最新版进行执行,保证主应用服务稳定。
|
||||
11. 新增 - 插件输出,支持指定字段作为工具响应。
|
||||
12. 新增 - 支持工作流嵌套子应用时,可以设置`非流模式`,同时简易模式也可以选择工作流作为插件了,简易模式调用子应用时,都将强制使用非流模式。
|
||||
13. 新增 - 调试模式下,子应用调用,支持返回详细运行数据。
|
||||
14. 新增 - 保留所有模式下子应用嵌套调用的日志。
|
||||
15. 优化 - 工作流嵌套层级限制 20 层,避免因编排不合理导致的无限死循环。
|
||||
16. 优化 - 工作流 handler 性能优化。
|
||||
17. 优化 - 工作流快捷键,避免调试测试时也会触发复制和回退。
|
||||
18. 修复 - 工作流工具调用中修改全局变量后,无法传递到后续流程。
|
||||
19. 优化 - 流输出,切换浏览器 Tab 后仍可以继续输出。
|
||||
20. 优化 - 完善外部文件知识库相关 API
|
||||
21. 修复 - 知识库选择权限问题。
|
||||
22. 修复 - 空 chatId 发起对话,首轮携带用户选择时会异常。
|
||||
23. 修复 - createDataset 接口,intro 为赋值。
|
||||
24. 修复 - 对话框渲染性能问题。
|
||||
25. 修复 - 工具调用历史记录存储不正确。
|
||||
@@ -60,6 +60,11 @@ docker-compose up -d
|
||||
|
||||
## QA
|
||||
|
||||
### 为什么需要初始化
|
||||
|
||||
数据表出现大幅度变更,无法通过设置默认值,或复杂度较高时,会通过初始化来更新部分数据表字段。
|
||||
严格按初始化步骤进行操作,不会造成旧数据丢失。但在初始化过程中,如果数据量大,需要初始化的时间较长,这段时间可能会造成服务无法正常使用。
|
||||
|
||||
### {{host}} 是什么
|
||||
|
||||
{{}} 代表变量, {{host}}代表一个名为 host 的变量。指的是你服务器的域名或 IP。
|
||||
@@ -85,4 +90,4 @@ sealos 中可以从上图左侧的环境变量中获取。
|
||||
4. 修改镜像到4.6,执行初始化
|
||||
5. .....
|
||||
|
||||
逐一升级
|
||||
逐一升级
|
||||
|
||||
@@ -10,7 +10,7 @@ weight: -10
|
||||
FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!
|
||||
|
||||
{{% alert icon="🤖 " context="success" %}}
|
||||
FastGPT 在线使用:[https://fastgpt.in](https://fastgpt.in)
|
||||
FastGPT 在线使用:[https://tryfastgpt.ai](https://tryfastgpt.ai)
|
||||
{{% /alert %}}
|
||||
|
||||
| | |
|
||||
|
||||
@@ -6,7 +6,7 @@ draft: false
|
||||
toc: true
|
||||
weight: 1200
|
||||
type: redirect
|
||||
target: https://cloud.fastgpt.in/price
|
||||
target: https://cloud.tryfastgpt.ai/price
|
||||
---
|
||||
|
||||
线上版价格请查看:[https://cloud.fastgpt.in/price](https://cloud.fastgpt.in/price)
|
||||
线上版价格请查看:[https://cloud.tryfastgpt.ai/price](https://cloud.tryfastgpt.ai/price)
|
||||
@@ -26,7 +26,7 @@ weight: 504
|
||||
|
||||
## 3. 创建 docker-compose.yml 文件
|
||||
|
||||
只需要修改 `OPEN_AI_API_KEY` 和 `OPEN_AI_API_BASE` 两个环境变量即可。其中 `OPEN_AI_API_KEY` 为第一步获取的密钥,`OPEN_AI_API_BASE` 为 FastGPT 的 OpenAPI 地址,例如:`https://api.fastgpt.in/api/v1`。
|
||||
只需要修改 `OPEN_AI_API_KEY` 和 `OPEN_AI_API_BASE` 两个环境变量即可。其中 `OPEN_AI_API_KEY` 为第一步获取的密钥,`OPEN_AI_API_BASE` 为 FastGPT 的 OpenAPI 地址,例如:`https://api.tryfastgpt.ai/api/v1`。
|
||||
|
||||
随便找一个目录,创建一个 docker-compose.yml 文件,将下面的代码复制进去。
|
||||
|
||||
@@ -40,7 +40,7 @@ services:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
OPEN_AI_API_KEY: 'fastgpt-z51pkjqm9nrk03a1rx2funoy'
|
||||
OPEN_AI_API_BASE: 'https://api.fastgpt.in/api/v1'
|
||||
OPEN_AI_API_BASE: 'https://api.tryfastgpt.ai/api/v1'
|
||||
MODEL: 'gpt-3.5-turbo'
|
||||
CHANNEL_TYPE: 'wx'
|
||||
PROXY: ''
|
||||
|
||||
@@ -965,7 +965,7 @@ export default async function (ctx: FunctionContext) {
|
||||
"required": true,
|
||||
"description": "",
|
||||
"canEdit": false,
|
||||
"value": "请使用下面<data> </data>中的数据作为你的知识。请直接输出答案,不要提及你是从<data> </data>中获取的知识。\n\n当前时间:{{cTime}}\n\n<data>\n{{response}}\n</data>\n\n我的问题:\"{{q}}\"",
|
||||
"value": "请使用下面<data> </data>中的数据作为本次对话的参考。请直接输出答案,不要提及你是从<data> </data>中获取的知识。\n\n当前时间:{{cTime}}\n\n<data>\n{{response}}\n</data>\n\n我的问题:\"{{q}}\"",
|
||||
"editField": {
|
||||
"key": true
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Pos
|
||||
"array": [1, 2, 3],
|
||||
"obj": {
|
||||
"name": "FastGPT",
|
||||
"url": "https://fastgpt.in"
|
||||
"url": "https://tryfastgpt.ai"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -109,7 +109,7 @@ HTTP 模块会向对应的地址发送一个 `HTTP` 请求,实际操作与 Pos
|
||||
"array2": [1, 2, 3],
|
||||
"object": {
|
||||
"name": "FastGPT",
|
||||
"url": "https://fastgpt.in"
|
||||
"url": "https://tryfastgpt.ai"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
baseURL = "https://doc.fastgpt.in"
|
||||
baseURL = "https://doc.tryfastgpt.ai"
|
||||
languageCode = "en-GB"
|
||||
contentDir = "content"
|
||||
enableEmoji = true
|
||||
@@ -113,7 +113,7 @@ defaultContentLanguageInSubdir = false
|
||||
# Link behaviour
|
||||
intLinkTooltip = true # Enable a tooltip for internal links that displays info about the destination? default false
|
||||
# extLinkNewTab = false # Open external links in a new Tab? default true
|
||||
logoLinkURL = "https://fastgpt.in/" # Set a custom URL destination for the top header logo link.
|
||||
logoLinkURL = "https://tryfastgpt.ai/" # Set a custom URL destination for the top header logo link.
|
||||
|
||||
[params.flexsearch] # Parameters for FlexSearch
|
||||
# enabled = true
|
||||
|
||||
@@ -19,7 +19,7 @@ data:
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
@@ -63,7 +63,7 @@ data:
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": false,
|
||||
"datasetProcess": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": true,
|
||||
"usedInExtractFields": true,
|
||||
"usedInToolCall": true,
|
||||
@@ -85,7 +85,7 @@ data:
|
||||
"charsPointsPrice": 0,
|
||||
"censor": false,
|
||||
"vision": true,
|
||||
"datasetProcess": false,
|
||||
"datasetProcess": true,
|
||||
"usedInClassify": false,
|
||||
"usedInExtractFields": false,
|
||||
"usedInToolCall": false,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"postinstall": "sh ./scripts/postinstall.sh",
|
||||
"initIcon": "node ./scripts/icon/init.js",
|
||||
"previewIcon": "node ./scripts/icon/index.js",
|
||||
"checkI18n": "node ./scripts/i18n/delete-unused-keys.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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chakra-ui/cli": "^2.4.1",
|
||||
@@ -30,4 +30,4 @@
|
||||
"node": ">=18.16.0",
|
||||
"pnpm": ">=9.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ export const bucketNameMap = {
|
||||
}
|
||||
};
|
||||
|
||||
export const ReadFileBaseUrl = '/api/common/file/read';
|
||||
export const ReadFileBaseUrl = `${process.env.FE_DOMAIN || ''}/api/common/file/read`;
|
||||
|
||||
export const documentFileType = '.txt, .docx, .csv, .xlsx, .pdf, .md, .html, .pptx';
|
||||
|
||||
@@ -91,6 +91,13 @@ ${mdSplitString}
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
1. 自定义分隔符:不需要重叠
|
||||
2. Markdown 标题:不需要重叠;标题嵌套共享。
|
||||
3. 特殊 markdown 语法:不需要重叠
|
||||
4. 段落:尽可能保证它是一个完整的段落。
|
||||
5. 标点分割:重叠
|
||||
*/
|
||||
const commonSplit = (props: SplitProps): SplitResponse => {
|
||||
let { text = '', chunkLen, overlapRatio = 0.2, customReg = [] } = props;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ export type FastGPTFeConfigsType = {
|
||||
show_openai_account?: boolean;
|
||||
show_promotion?: boolean;
|
||||
show_team_chat?: boolean;
|
||||
show_compliance_copywriting?: boolean;
|
||||
concatMd?: string;
|
||||
|
||||
docUrl?: string;
|
||||
|
||||
@@ -7,3 +7,7 @@ export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> &
|
||||
{
|
||||
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
||||
}[Keys];
|
||||
|
||||
export type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
};
|
||||
|
||||
1
packages/global/core/ai/model.d.ts
vendored
@@ -27,6 +27,7 @@ export type LLMModelItemType = {
|
||||
|
||||
defaultSystemChatPrompt?: string;
|
||||
defaultConfig?: Record<string, any>;
|
||||
fieldMap?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type VectorModelItemType = {
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import { PromptTemplateItem } from '../type.d';
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
|
||||
export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||
{
|
||||
title: '标准模板',
|
||||
desc: '标准提示词,用于结构不固定的知识库。',
|
||||
value: `{{q}}
|
||||
{{a}}`
|
||||
title: i18nT('app:template.standard_template'),
|
||||
desc: i18nT('app:template.standard_template_des'),
|
||||
value: `{
|
||||
"sourceName": "{{source}}",
|
||||
"updateTime": "{{updateTime}}",
|
||||
"content": "{{q}}\n{{a}}"
|
||||
}
|
||||
`
|
||||
},
|
||||
{
|
||||
title: '问答模板',
|
||||
desc: '适合 QA 问答结构的知识库,可以让AI较为严格的按预设内容回答',
|
||||
title: i18nT('app:template.qa_template'),
|
||||
desc: i18nT('app:template.qa_template_des'),
|
||||
value: `<Question>
|
||||
{{q}}
|
||||
</Question>
|
||||
@@ -18,14 +23,18 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||
</Answer>`
|
||||
},
|
||||
{
|
||||
title: '标准严格模板',
|
||||
desc: '在标准模板基础上,对模型的回答做更严格的要求。',
|
||||
value: `{{q}}
|
||||
{{a}}`
|
||||
title: i18nT('app:template.standard_strict'),
|
||||
desc: i18nT('app:template.standard_strict_des'),
|
||||
value: `{
|
||||
"sourceName": "{{source}}",
|
||||
"updateTime": "{{updateTime}}",
|
||||
"content": "{{q}}\n{{a}}"
|
||||
}
|
||||
`
|
||||
},
|
||||
{
|
||||
title: '严格问答模板',
|
||||
desc: '在问答模板基础上,对模型的回答做更严格的要求。',
|
||||
title: i18nT('app:template.hard_strict'),
|
||||
desc: i18nT('app:template.hard_strict_des'),
|
||||
value: `<Question>
|
||||
{{q}}
|
||||
</Question>
|
||||
@@ -35,27 +44,27 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
||||
}
|
||||
];
|
||||
|
||||
export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
||||
export const Prompt_userQuotePromptList: PromptTemplateItem[] = [
|
||||
{
|
||||
title: '标准模板',
|
||||
title: i18nT('app:template.standard_template'),
|
||||
desc: '',
|
||||
value: `使用 <Data></Data> 标记中的内容作为你的知识:
|
||||
value: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||
|
||||
<Data>
|
||||
<Reference>
|
||||
{{quote}}
|
||||
</Data>
|
||||
</Reference>
|
||||
|
||||
回答要求:
|
||||
- 如果你不清楚答案,你需要澄清。
|
||||
- 避免提及你是从 <Data></Data> 获取的知识。
|
||||
- 保持答案与 <Data></Data> 中描述的一致。
|
||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||
- 使用 Markdown 语法优化回答格式。
|
||||
- 使用与问题相同的语言回答。
|
||||
|
||||
问题:"""{{question}}"""`
|
||||
},
|
||||
{
|
||||
title: '问答模板',
|
||||
title: i18nT('app:template.qa_template'),
|
||||
desc: '',
|
||||
value: `使用 <QA></QA> 标记中的问答对进行回答。
|
||||
|
||||
@@ -72,29 +81,29 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
||||
问题:"""{{question}}"""`
|
||||
},
|
||||
{
|
||||
title: '标准严格模板',
|
||||
title: i18nT('app:template.standard_strict'),
|
||||
desc: '',
|
||||
value: `忘记你已有的知识,仅使用 <Data></Data> 标记中的内容作为你的知识:
|
||||
value: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||
|
||||
<Data>
|
||||
<Reference>
|
||||
{{quote}}
|
||||
</Data>
|
||||
</Reference>
|
||||
|
||||
思考流程:
|
||||
1. 判断问题是否与 <Data></Data> 标记中的内容有关。
|
||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
||||
2. 如果有关,你按下面的要求回答。
|
||||
3. 如果无关,你直接拒绝回答本次问题。
|
||||
|
||||
回答要求:
|
||||
- 避免提及你是从 <Data></Data> 获取的知识。
|
||||
- 保持答案与 <Data></Data> 中描述的一致。
|
||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||
- 使用 Markdown 语法优化回答格式。
|
||||
- 使用与问题相同的语言回答。
|
||||
|
||||
问题:"""{{question}}"""`
|
||||
},
|
||||
{
|
||||
title: '严格问答模板',
|
||||
title: i18nT('app:template.hard_strict'),
|
||||
desc: '',
|
||||
value: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
||||
|
||||
@@ -120,9 +129,86 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
||||
}
|
||||
];
|
||||
|
||||
// Document quote prompt
|
||||
export const Prompt_DocumentQuote = `将 <Quote></Quote> 中的内容作为你的知识:
|
||||
<Quote>
|
||||
export const Prompt_systemQuotePromptList: PromptTemplateItem[] = [
|
||||
{
|
||||
title: i18nT('app:template.standard_template'),
|
||||
desc: '',
|
||||
value: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||
|
||||
<Reference>
|
||||
{{quote}}
|
||||
</Quote>
|
||||
</Reference>
|
||||
|
||||
回答要求:
|
||||
- 如果你不清楚答案,你需要澄清。
|
||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||
- 使用 Markdown 语法优化回答格式。
|
||||
- 使用与问题相同的语言回答。`
|
||||
},
|
||||
{
|
||||
title: i18nT('app:template.qa_template'),
|
||||
desc: '',
|
||||
value: `使用 <QA></QA> 标记中的问答对进行回答。
|
||||
|
||||
<QA>
|
||||
{{quote}}
|
||||
</QA>
|
||||
|
||||
回答要求:
|
||||
- 选择其中一个或多个问答对进行回答。
|
||||
- 回答的内容应尽可能与 <答案></答案> 中的内容一致。
|
||||
- 如果没有相关的问答对,你需要澄清。
|
||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。`
|
||||
},
|
||||
{
|
||||
title: i18nT('app:template.standard_strict'),
|
||||
desc: '',
|
||||
value: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||
|
||||
<Reference>
|
||||
{{quote}}
|
||||
</Reference>
|
||||
|
||||
思考流程:
|
||||
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
||||
2. 如果有关,你按下面的要求回答。
|
||||
3. 如果无关,你直接拒绝回答本次问题。
|
||||
|
||||
回答要求:
|
||||
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||
- 使用 Markdown 语法优化回答格式。
|
||||
- 使用与问题相同的语言回答。`
|
||||
},
|
||||
{
|
||||
title: i18nT('app:template.hard_strict'),
|
||||
desc: '',
|
||||
value: `忘记你已有的知识,仅使用 <QA></QA> 标记中的问答对进行回答。
|
||||
|
||||
<QA>
|
||||
{{quote}}
|
||||
</QA>
|
||||
|
||||
思考流程:
|
||||
1. 判断问题是否与 <QA></QA> 标记中的内容有关。
|
||||
2. 如果无关,你直接拒绝回答本次问题。
|
||||
3. 判断是否有相近或相同的问题。
|
||||
4. 如果有相同的问题,直接输出对应答案。
|
||||
5. 如果只有相近的问题,请把相近的问题和答案一起输出。
|
||||
|
||||
回答要求:
|
||||
- 如果没有相关的问答对,你需要澄清。
|
||||
- 回答的内容应尽可能与 <QA></QA> 标记中的内容一致。
|
||||
- 避免提及你是从 QA 获取的知识,只需要回复答案。
|
||||
- 使用 Markdown 语法优化回答格式。
|
||||
- 使用与问题相同的语言回答。`
|
||||
}
|
||||
];
|
||||
|
||||
// Document quote prompt
|
||||
export const Prompt_DocumentQuote = `将 <Reference></Reference> 中的内容作为本次对话的参考:
|
||||
<Reference>
|
||||
{{quote}}
|
||||
</Reference>
|
||||
`;
|
||||
|
||||
@@ -4,6 +4,7 @@ export const Prompt_AgentQA = {
|
||||
- 答案需详细完整,尽可能保留原文描述,可以适当扩展答案描述。
|
||||
- 答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 Markdown 元素。
|
||||
- 最多提出 50 个问题。
|
||||
- 生成的问题和答案和源文本语言相同。
|
||||
`,
|
||||
fixedText: `请按以下格式整理学习成果:
|
||||
<Context>
|
||||
|
||||
3
packages/global/core/ai/type.d.ts
vendored
@@ -9,8 +9,7 @@ import type {
|
||||
ChatCompletionUserMessageParam as SdkChatCompletionUserMessageParam
|
||||
} from 'openai/resources';
|
||||
import { ChatMessageTypeEnum } from './constants';
|
||||
import { InteractiveNodeResponseItemType } from '../workflow/template/system/userSelect/type';
|
||||
|
||||
import { InteractiveNodeResponseItemType } from '../workflow/template/system/interactive/type';
|
||||
export * from 'openai/resources';
|
||||
|
||||
// Extension of ChatCompletionMessageParam, Add file url type
|
||||
|
||||
10
packages/global/core/app/type.d.ts
vendored
@@ -1,7 +1,11 @@
|
||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
||||
import { AppTypeEnum } from './constants';
|
||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||
import { NodeInputKeyEnum, VariableInputEnum } from '../workflow/constants';
|
||||
import {
|
||||
NodeInputKeyEnum,
|
||||
VariableInputEnum,
|
||||
WorkflowIOValueTypeEnum
|
||||
} from '../workflow/constants';
|
||||
import { SelectedDatasetType } from '../workflow/api';
|
||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
||||
@@ -92,6 +96,9 @@ export type AppChatConfigType = {
|
||||
scheduledTriggerConfig?: AppScheduledTriggerConfigType;
|
||||
chatInputGuide?: ChatInputGuideConfigType;
|
||||
fileSelectConfig?: AppFileSelectConfigType;
|
||||
|
||||
// plugin
|
||||
instruction?: string;
|
||||
};
|
||||
export type SettingAIDataType = {
|
||||
model: string;
|
||||
@@ -111,6 +118,7 @@ export type VariableItemType = {
|
||||
required: boolean;
|
||||
maxLen: number;
|
||||
enums: { value: string }[];
|
||||
valueType: WorkflowIOValueTypeEnum;
|
||||
};
|
||||
// tts
|
||||
export type AppTTSConfigType = {
|
||||
|
||||
@@ -97,7 +97,10 @@ export const appWorkflow2Form = ({
|
||||
node.inputs,
|
||||
NodeInputKeyEnum.datasetSearchExtensionBg
|
||||
);
|
||||
} else if (node.flowNodeType === FlowNodeTypeEnum.pluginModule) {
|
||||
} else if (
|
||||
node.flowNodeType === FlowNodeTypeEnum.pluginModule ||
|
||||
node.flowNodeType === FlowNodeTypeEnum.appModule
|
||||
) {
|
||||
if (!node.pluginId) return;
|
||||
|
||||
defaultAppForm.selectedTools.push({
|
||||
@@ -108,7 +111,7 @@ export const appWorkflow2Form = ({
|
||||
intro: node.intro || '',
|
||||
flowNodeType: node.flowNodeType,
|
||||
showStatus: node.showStatus,
|
||||
version: '481',
|
||||
version: node.version,
|
||||
inputs: node.inputs,
|
||||
outputs: node.outputs,
|
||||
templateType: FlowNodeTemplateTypeEnum.other
|
||||
|
||||
9
packages/global/core/app/version.d.ts
vendored
@@ -12,3 +12,12 @@ export type AppVersionSchemaType = {
|
||||
versionName: string;
|
||||
tmbId: string;
|
||||
};
|
||||
|
||||
export type VersionListItemType = {
|
||||
_id: string;
|
||||
appId: string;
|
||||
versionName: string;
|
||||
time: Date;
|
||||
isPublish: boolean | undefined;
|
||||
tmbId: string;
|
||||
};
|
||||
|
||||
@@ -118,7 +118,7 @@ export const chats2GPTMessages = ({
|
||||
tool_calls
|
||||
})
|
||||
.concat(toolResponse);
|
||||
} else if (value.text) {
|
||||
} else if (value.text?.content) {
|
||||
results.push({
|
||||
dataId,
|
||||
role: ChatCompletionRequestMessageRoleEnum.Assistant,
|
||||
@@ -142,7 +142,7 @@ export const GPTMessages2Chats = (
|
||||
messages: ChatCompletionMessageParam[],
|
||||
reserveTool = true
|
||||
): ChatItemType[] => {
|
||||
return messages
|
||||
const chatMessages = messages
|
||||
.map((item) => {
|
||||
const value: ChatItemType['value'] = [];
|
||||
const obj = GPT2Chat[item.role];
|
||||
@@ -151,12 +151,23 @@ export const GPTMessages2Chats = (
|
||||
obj === ChatRoleEnum.System &&
|
||||
item.role === ChatCompletionRequestMessageRoleEnum.System
|
||||
) {
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.content
|
||||
}
|
||||
});
|
||||
if (Array.isArray(item.content)) {
|
||||
item.content.forEach((item) => [
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.text
|
||||
}
|
||||
})
|
||||
]);
|
||||
} else {
|
||||
value.push({
|
||||
type: ChatItemValueTypeEnum.text,
|
||||
text: {
|
||||
content: item.content
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
obj === ChatRoleEnum.Human &&
|
||||
item.role === ChatCompletionRequestMessageRoleEnum.User
|
||||
@@ -277,6 +288,22 @@ export const GPTMessages2Chats = (
|
||||
} as ChatItemType;
|
||||
})
|
||||
.filter((item) => item.value.length > 0);
|
||||
|
||||
// Merge data with the same dataId(Sequential obj merging)
|
||||
const result = chatMessages.reduce((result: ChatItemType[], currentItem) => {
|
||||
const lastItem = result[result.length - 1];
|
||||
|
||||
if (lastItem && lastItem.dataId === currentItem.dataId && lastItem.obj === currentItem.obj) {
|
||||
// @ts-ignore
|
||||
lastItem.value = lastItem.value.concat(currentItem.value);
|
||||
} else {
|
||||
result.push(currentItem);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export const chatValue2RuntimePrompt = (value: ChatItemValueItemType[]): RuntimeUserPromptType => {
|
||||
@@ -317,7 +344,7 @@ export const runtimePrompt2ChatsValue = (
|
||||
return value;
|
||||
};
|
||||
|
||||
export const getSystemPrompt = (prompt?: string): ChatItemType[] => {
|
||||
export const getSystemPrompt_ChatItemType = (prompt?: string): ChatItemType[] => {
|
||||
if (!prompt) return [];
|
||||
return [
|
||||
{
|
||||
|
||||
3
packages/global/core/chat/type.d.ts
vendored
@@ -15,7 +15,7 @@ import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||
import { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
||||
import { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
||||
import { InteractiveNodeResponseItemType } from '../workflow/template/system/userSelect/type';
|
||||
import { InteractiveNodeResponseItemType } from '../workflow/template/system/interactive/type';
|
||||
|
||||
export type ChatSchema = {
|
||||
_id: string;
|
||||
@@ -151,6 +151,7 @@ export type ChatHistoryItemType = HistoryItemType & {
|
||||
/* ------- response data ------------ */
|
||||
export type ChatHistoryItemResType = DispatchNodeResponseType & {
|
||||
nodeId: string;
|
||||
id: string;
|
||||
moduleType: FlowNodeTypeEnum;
|
||||
moduleName: string;
|
||||
};
|
||||
|
||||
@@ -12,17 +12,17 @@ export const DatasetTypeMap = {
|
||||
collectionLabel: 'common.Folder'
|
||||
},
|
||||
[DatasetTypeEnum.dataset]: {
|
||||
icon: 'core/dataset/commonDataset',
|
||||
icon: 'core/dataset/commonDatasetOutline',
|
||||
label: 'common_dataset',
|
||||
collectionLabel: 'common.File'
|
||||
},
|
||||
[DatasetTypeEnum.websiteDataset]: {
|
||||
icon: 'core/dataset/websiteDataset',
|
||||
icon: 'core/dataset/websiteDatasetOutline',
|
||||
label: 'website_dataset',
|
||||
collectionLabel: 'common.Website'
|
||||
},
|
||||
[DatasetTypeEnum.externalFile]: {
|
||||
icon: 'core/dataset/externalDataset',
|
||||
icon: 'core/dataset/externalDatasetOutline',
|
||||
label: 'external_file',
|
||||
collectionLabel: 'common.File'
|
||||
}
|
||||
|
||||
2
packages/global/core/dataset/type.d.ts
vendored
@@ -51,6 +51,7 @@ export type DatasetCollectionSchemaType = {
|
||||
chunkSize: number;
|
||||
chunkSplitter?: string;
|
||||
qaPrompt?: string;
|
||||
ocrParse?: boolean;
|
||||
|
||||
tags?: string[];
|
||||
|
||||
@@ -177,6 +178,7 @@ export type DatasetDataItemType = {
|
||||
id: string;
|
||||
teamId: string;
|
||||
datasetId: string;
|
||||
updateTime: Date;
|
||||
collectionId: string;
|
||||
sourceName: string;
|
||||
sourceId?: string;
|
||||
|
||||
@@ -24,6 +24,7 @@ export enum WorkflowIOValueTypeEnum {
|
||||
arrayNumber = 'arrayNumber',
|
||||
arrayBoolean = 'arrayBoolean',
|
||||
arrayObject = 'arrayObject',
|
||||
arrayAny = 'arrayAny',
|
||||
any = 'any',
|
||||
|
||||
chatHistory = 'chatHistory',
|
||||
@@ -52,6 +53,9 @@ export enum NodeInputKeyEnum {
|
||||
scheduleTrigger = 'scheduleTrigger',
|
||||
chatInputGuide = 'chatInputGuide',
|
||||
|
||||
// plugin config
|
||||
instruction = 'instruction',
|
||||
|
||||
// entry
|
||||
userChatInput = 'userChatInput',
|
||||
inputFiles = 'inputFiles',
|
||||
@@ -66,6 +70,7 @@ export enum NodeInputKeyEnum {
|
||||
anyInput = 'system_anyInput',
|
||||
textareaInput = 'system_textareaInput',
|
||||
addInputParam = 'system_addInputParam',
|
||||
forbidStream = 'system_forbid_stream',
|
||||
|
||||
// history
|
||||
historyMaxAmount = 'maxContext',
|
||||
@@ -75,6 +80,7 @@ export enum NodeInputKeyEnum {
|
||||
aiChatMaxToken = 'maxToken',
|
||||
aiChatSettingModal = 'aiSettings',
|
||||
aiChatIsResponseText = 'isResponseAnswerText',
|
||||
aiChatQuoteRole = 'aiChatQuoteRole',
|
||||
aiChatQuoteTemplate = 'quoteTemplate',
|
||||
aiChatQuotePrompt = 'quotePrompt',
|
||||
aiChatDatasetQuote = 'quoteQA',
|
||||
@@ -105,6 +111,8 @@ export enum NodeInputKeyEnum {
|
||||
httpMethod = 'system_httpMethod',
|
||||
httpParams = 'system_httpParams',
|
||||
httpJsonBody = 'system_httpJsonBody',
|
||||
httpFormBody = 'system_httpFormBody',
|
||||
httpContentType = 'system_httpContentType',
|
||||
httpTimeout = 'system_httpTimeout',
|
||||
abandon_httpUrl = 'url',
|
||||
|
||||
@@ -128,8 +136,26 @@ export enum NodeInputKeyEnum {
|
||||
|
||||
// read files
|
||||
fileUrlList = 'fileUrlList',
|
||||
|
||||
// user select
|
||||
userSelectOptions = 'userSelectOptions'
|
||||
userSelectOptions = 'userSelectOptions',
|
||||
|
||||
// loop
|
||||
loopInputArray = 'loopInputArray',
|
||||
childrenNodeIdList = 'childrenNodeIdList',
|
||||
nodeWidth = 'nodeWidth',
|
||||
nodeHeight = 'nodeHeight',
|
||||
// loop start
|
||||
loopStartInput = 'loopStartInput',
|
||||
// loop end
|
||||
loopEndInput = 'loopEndInput',
|
||||
|
||||
// form input
|
||||
userInputForms = 'userInputForms',
|
||||
|
||||
// comment
|
||||
commentText = 'commentText',
|
||||
commentSize = 'commentSize'
|
||||
}
|
||||
|
||||
export enum NodeOutputKeyEnum {
|
||||
@@ -172,7 +198,16 @@ export enum NodeOutputKeyEnum {
|
||||
ifElseResult = 'ifElseResult',
|
||||
|
||||
//user select
|
||||
selectResult = 'selectResult'
|
||||
selectResult = 'selectResult',
|
||||
|
||||
// loop
|
||||
loopArray = 'loopArray',
|
||||
|
||||
// loop start
|
||||
loopStartInput = 'loopStartInput',
|
||||
|
||||
// form input
|
||||
formInputResult = 'formInputResult'
|
||||
}
|
||||
|
||||
export enum VariableInputEnum {
|
||||
@@ -213,3 +248,13 @@ export enum RuntimeEdgeStatusEnum {
|
||||
|
||||
export const VARIABLE_NODE_ID = 'VARIABLE_NODE_ID';
|
||||
export const DYNAMIC_INPUT_REFERENCE_KEY = 'DYNAMIC_INPUT_REFERENCE_KEY';
|
||||
|
||||
// http node body content type
|
||||
export enum ContentTypes {
|
||||
none = 'none',
|
||||
formData = 'form-data',
|
||||
xWwwFormUrlencoded = 'x-www-form-urlencoded',
|
||||
json = 'json',
|
||||
xml = 'xml',
|
||||
raw = 'raw-text'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
export enum FlowNodeInputTypeEnum { // render ui
|
||||
reference = 'reference', // reference to other node output
|
||||
input = 'input', // one line input
|
||||
@@ -15,6 +15,7 @@ export enum FlowNodeInputTypeEnum { // render ui
|
||||
|
||||
// special input
|
||||
selectApp = 'selectApp',
|
||||
customVariable = 'customVariable',
|
||||
|
||||
// ai model select
|
||||
selectLLMModel = 'selectLLMModel',
|
||||
@@ -44,7 +45,7 @@ export const FlowNodeInputMap: Record<
|
||||
icon: 'core/workflow/inputType/numberInput'
|
||||
},
|
||||
[FlowNodeInputTypeEnum.select]: {
|
||||
icon: 'core/workflow/inputType/input'
|
||||
icon: 'core/workflow/inputType/option'
|
||||
},
|
||||
[FlowNodeInputTypeEnum.switch]: {
|
||||
icon: 'core/workflow/inputType/switch'
|
||||
@@ -79,8 +80,11 @@ export const FlowNodeInputMap: Record<
|
||||
[FlowNodeInputTypeEnum.hidden]: {
|
||||
icon: 'core/workflow/inputType/select'
|
||||
},
|
||||
[FlowNodeInputTypeEnum.customVariable]: {
|
||||
icon: 'core/workflow/inputType/customVariable'
|
||||
},
|
||||
[FlowNodeInputTypeEnum.custom]: {
|
||||
icon: 'core/workflow/inputType/select'
|
||||
icon: 'core/workflow/inputType/custom'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,6 +98,7 @@ export enum FlowNodeOutputTypeEnum {
|
||||
export enum FlowNodeTypeEnum {
|
||||
emptyNode = 'emptyNode',
|
||||
systemConfig = 'userGuide',
|
||||
pluginConfig = 'pluginConfig',
|
||||
globalVariable = 'globalVariable',
|
||||
workflowStart = 'workflowStart',
|
||||
chatNode = 'chatNode',
|
||||
@@ -106,12 +111,14 @@ export enum FlowNodeTypeEnum {
|
||||
contentExtract = 'contentExtract',
|
||||
httpRequest468 = 'httpRequest468',
|
||||
runApp = 'app',
|
||||
appModule = 'appModule',
|
||||
pluginModule = 'pluginModule',
|
||||
pluginInput = 'pluginInput',
|
||||
pluginOutput = 'pluginOutput',
|
||||
queryExtension = 'cfr',
|
||||
tools = 'tools',
|
||||
stopTool = 'stopTool',
|
||||
toolParams = 'toolParams',
|
||||
lafModule = 'lafModule',
|
||||
ifElseNode = 'ifElseNode',
|
||||
variableUpdate = 'variableUpdate',
|
||||
@@ -119,7 +126,12 @@ export enum FlowNodeTypeEnum {
|
||||
textEditor = 'textEditor',
|
||||
customFeedback = 'customFeedback',
|
||||
readFiles = 'readFiles',
|
||||
userSelect = 'userSelect'
|
||||
userSelect = 'userSelect',
|
||||
loop = 'loop',
|
||||
loopStart = 'loopStart',
|
||||
loopEnd = 'loopEnd',
|
||||
formInput = 'formInput',
|
||||
comment = 'comment'
|
||||
}
|
||||
|
||||
// node IO value type
|
||||
@@ -156,28 +168,32 @@ export const FlowValueTypeMap = {
|
||||
label: 'array<object>',
|
||||
value: WorkflowIOValueTypeEnum.arrayObject
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.arrayAny]: {
|
||||
label: 'array',
|
||||
value: WorkflowIOValueTypeEnum.arrayAny
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.any]: {
|
||||
label: 'any',
|
||||
value: WorkflowIOValueTypeEnum.any
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.chatHistory]: {
|
||||
label: '历史记录',
|
||||
label: i18nT('common:core.chat.History'),
|
||||
value: WorkflowIOValueTypeEnum.chatHistory
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.datasetQuote]: {
|
||||
label: '知识库引用',
|
||||
label: i18nT('common:core.workflow.Dataset quote'),
|
||||
value: WorkflowIOValueTypeEnum.datasetQuote
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.selectApp]: {
|
||||
label: '选择应用',
|
||||
label: i18nT('common:plugin.App'),
|
||||
value: WorkflowIOValueTypeEnum.selectApp
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.selectDataset]: {
|
||||
label: '选择知识库',
|
||||
label: i18nT('common:core.chat.Select dataset'),
|
||||
value: WorkflowIOValueTypeEnum.selectDataset
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.dynamic]: {
|
||||
label: '动态输入',
|
||||
label: i18nT('common:core.workflow.dynamic_input'),
|
||||
value: WorkflowIOValueTypeEnum.dynamic
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,8 +22,11 @@ export enum DispatchNodeResponseKeyEnum {
|
||||
childrenResponses = 'childrenResponses', // Some nodes make recursive calls that need to be returned
|
||||
toolResponses = 'toolResponses', // The result is passed back to the tool node for use
|
||||
assistantResponses = 'assistantResponses', // assistant response
|
||||
rewriteHistories = 'rewriteHistories', // If have the response, workflow histories will be rewrite
|
||||
|
||||
interactive = 'INTERACTIVE' // is interactive
|
||||
interactive = 'INTERACTIVE', // is interactive
|
||||
runTimes = 'runTimes', // run times
|
||||
newVariables = 'newVariables' // new variables
|
||||
}
|
||||
|
||||
export const needReplaceReferenceInputTypeList = [
|
||||
|
||||
59
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -2,9 +2,9 @@ import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||
import {
|
||||
ChatItemType,
|
||||
UserChatItemValueItemType,
|
||||
ChatItemValueItemType,
|
||||
ToolRunResponseItemType,
|
||||
NodeOutputItemType
|
||||
NodeOutputItemType,
|
||||
AIChatItemValueItemType
|
||||
} from '../../chat/type';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
||||
import { StoreNodeItemType } from '../type/node';
|
||||
@@ -19,16 +19,23 @@ import { RuntimeNodeItemType } from '../runtime/type';
|
||||
import { RuntimeEdgeItemType } from './edge';
|
||||
import { ReadFileNodeResponse } from '../template/system/readFiles/type';
|
||||
import { UserSelectOptionType } from '../template/system/userSelect/type';
|
||||
import { WorkflowResponseType } from '../../../../service/core/workflow/dispatch/type';
|
||||
import { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
||||
|
||||
/* workflow props */
|
||||
export type ChatDispatchProps = {
|
||||
res?: NextApiResponse;
|
||||
requestOrigin?: string;
|
||||
mode: 'test' | 'chat' | 'debug';
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
user: UserModelSchema;
|
||||
app: AppDetailType | AppSchema;
|
||||
|
||||
runningAppInfo: {
|
||||
id: string; // May be the id of the system plug-in (cannot be used directly to look up the table)
|
||||
teamId: string;
|
||||
tmbId: string; // App tmbId
|
||||
};
|
||||
uid: string; // Who run this workflow
|
||||
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
@@ -36,9 +43,10 @@ export type ChatDispatchProps = {
|
||||
query: UserChatItemValueItemType[]; // trigger query
|
||||
chatConfig: AppSchema['chatConfig'];
|
||||
stream: boolean;
|
||||
detail: boolean; // response detail
|
||||
maxRunTimes: number;
|
||||
isToolCall?: boolean;
|
||||
workflowStreamResponse?: WorkflowResponseType;
|
||||
workflowDispatchDeep?: number;
|
||||
};
|
||||
|
||||
export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||
@@ -49,10 +57,12 @@ export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||
};
|
||||
|
||||
export type SystemVariablesType = {
|
||||
userId: string;
|
||||
appId: string;
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
cTime: string;
|
||||
};
|
||||
|
||||
/* node props */
|
||||
@@ -68,7 +78,8 @@ export type RuntimeNodeItemType = {
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
|
||||
pluginId?: string;
|
||||
pluginId?: string; // workflow id / plugin id
|
||||
version: string;
|
||||
};
|
||||
|
||||
export type PluginRuntimeType = {
|
||||
@@ -95,6 +106,8 @@ export type DispatchNodeResponseType = {
|
||||
error?: Record<string, any>;
|
||||
customInputs?: Record<string, any>;
|
||||
customOutputs?: Record<string, any>;
|
||||
nodeInputs?: Record<string, any>;
|
||||
nodeOutputs?: Record<string, any>;
|
||||
|
||||
// bill
|
||||
tokens?: number;
|
||||
@@ -158,15 +171,36 @@ export type DispatchNodeResponseType = {
|
||||
|
||||
// user select
|
||||
userSelectResult?: string;
|
||||
|
||||
// update var
|
||||
updateVarResult?: any[];
|
||||
|
||||
// loop
|
||||
loopResult?: any[];
|
||||
loopInput?: any[];
|
||||
loopDetail?: ChatHistoryItemResType[];
|
||||
// loop start
|
||||
loopInputValue?: any;
|
||||
// loop end
|
||||
loopOutputValue?: any;
|
||||
|
||||
// form input
|
||||
formInputResult?: string;
|
||||
|
||||
// tool params
|
||||
toolParamsResult?: Record<string, any>;
|
||||
};
|
||||
|
||||
export type DispatchNodeResultType<T> = {
|
||||
export type DispatchNodeResultType<T = {}> = {
|
||||
[DispatchNodeResponseKeyEnum.skipHandleId]?: string[]; // skip some edge handle id
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]?: DispatchNodeResponseType; // The node response detail
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]?: ChatNodeUsageType[]; //
|
||||
[DispatchNodeResponseKeyEnum.childrenResponses]?: DispatchNodeResultType[];
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]?: ToolRunResponseItemType;
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]?: ChatItemValueItemType[];
|
||||
[DispatchNodeResponseKeyEnum.nodeDispatchUsages]?: ChatNodeUsageType[]; // Node total usage
|
||||
[DispatchNodeResponseKeyEnum.childrenResponses]?: DispatchNodeResultType[]; // Children node response
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]?: ToolRunResponseItemType; // Tool response
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]?: AIChatItemValueItemType[]; // Assistant response(Store to db)
|
||||
[DispatchNodeResponseKeyEnum.rewriteHistories]?: ChatItemType[];
|
||||
[DispatchNodeResponseKeyEnum.runTimes]?: number;
|
||||
[DispatchNodeResponseKeyEnum.newVariables]?: Record<string, any>;
|
||||
} & T;
|
||||
|
||||
/* Single node props */
|
||||
@@ -176,6 +210,7 @@ export type AIChatNodeProps = {
|
||||
[NodeInputKeyEnum.aiChatTemperature]: number;
|
||||
[NodeInputKeyEnum.aiChatMaxToken]: number;
|
||||
[NodeInputKeyEnum.aiChatIsResponseText]: boolean;
|
||||
[NodeInputKeyEnum.aiChatQuoteRole]?: AiChatQuoteRoleType;
|
||||
[NodeInputKeyEnum.aiChatQuoteTemplate]?: string;
|
||||
[NodeInputKeyEnum.aiChatQuotePrompt]?: string;
|
||||
[NodeInputKeyEnum.aiChatVision]?: boolean;
|
||||
|
||||
@@ -27,16 +27,37 @@ export const getMaxHistoryLimitFromNodes = (nodes: StoreNodeItemType[]): number
|
||||
return limit * 2;
|
||||
};
|
||||
|
||||
/*
|
||||
Get interaction information (if any) from the last AI message.
|
||||
What can be done:
|
||||
1. Get the interactive data
|
||||
2. Check that the workflow starts at the interaction node
|
||||
*/
|
||||
export const getLastInteractiveValue = (histories: ChatItemType[]) => {
|
||||
const lastAIMessage = histories.findLast((item) => item.obj === ChatRoleEnum.AI);
|
||||
|
||||
if (lastAIMessage) {
|
||||
const interactiveValue = lastAIMessage.value.find(
|
||||
(v) => v.type === ChatItemValueTypeEnum.interactive
|
||||
);
|
||||
const lastValue = lastAIMessage.value[lastAIMessage.value.length - 1];
|
||||
|
||||
if (interactiveValue && 'interactive' in interactiveValue) {
|
||||
return interactiveValue.interactive;
|
||||
if (
|
||||
!lastValue ||
|
||||
lastValue.type !== ChatItemValueTypeEnum.interactive ||
|
||||
!lastValue.interactive
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check is user select
|
||||
if (
|
||||
lastValue.interactive.type === 'userSelect' &&
|
||||
!lastValue.interactive.params.userSelectedVal
|
||||
) {
|
||||
return lastValue.interactive;
|
||||
}
|
||||
|
||||
// Check is user input
|
||||
if (lastValue.interactive.type === 'userInput' && !lastValue.interactive.params.submitted) {
|
||||
return lastValue.interactive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +124,8 @@ export const storeNodes2RuntimeNodes = (
|
||||
isEntry: entryNodeIds.includes(node.nodeId),
|
||||
inputs: node.inputs,
|
||||
outputs: node.outputs,
|
||||
pluginId: node.pluginId
|
||||
pluginId: node.pluginId,
|
||||
version: node.version
|
||||
};
|
||||
}) || []
|
||||
);
|
||||
@@ -117,39 +139,6 @@ export const filterWorkflowEdges = (edges: RuntimeEdgeItemType[]) => {
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
区分普通连线和递归连线
|
||||
递归连线:可以通过往上查询 nodes,最终追溯到自身
|
||||
*/
|
||||
export const splitEdges2WorkflowEdges = ({
|
||||
edges,
|
||||
allEdges,
|
||||
currentNode
|
||||
}: {
|
||||
edges: RuntimeEdgeItemType[];
|
||||
allEdges: RuntimeEdgeItemType[];
|
||||
currentNode: RuntimeNodeItemType;
|
||||
}) => {
|
||||
const commonEdges: RuntimeEdgeItemType[] = [];
|
||||
const recursiveEdges: RuntimeEdgeItemType[] = [];
|
||||
|
||||
edges.forEach((edge) => {
|
||||
const checkIsCurrentNode = (edge: RuntimeEdgeItemType): boolean => {
|
||||
const sourceEdge = allEdges.find((item) => item.target === edge.source);
|
||||
if (!sourceEdge) return false;
|
||||
if (sourceEdge.source === currentNode.nodeId) return true;
|
||||
return checkIsCurrentNode(sourceEdge);
|
||||
};
|
||||
if (checkIsCurrentNode(edge)) {
|
||||
recursiveEdges.push(edge);
|
||||
} else {
|
||||
commonEdges.push(edge);
|
||||
}
|
||||
});
|
||||
|
||||
return { commonEdges, recursiveEdges };
|
||||
};
|
||||
|
||||
/*
|
||||
1. 输入线分类:普通线和递归线(可以追溯到自身)
|
||||
2. 起始线全部非 waiting 执行,或递归线全部非 waiting 执行
|
||||
@@ -161,31 +150,72 @@ export const checkNodeRunStatus = ({
|
||||
node: RuntimeNodeItemType;
|
||||
runtimeEdges: RuntimeEdgeItemType[];
|
||||
}) => {
|
||||
const workflowEdges = filterWorkflowEdges(runtimeEdges).filter(
|
||||
/*
|
||||
区分普通连线和递归连线
|
||||
递归连线:可以通过往上查询 nodes,最终追溯到自身
|
||||
*/
|
||||
const splitEdges2WorkflowEdges = ({
|
||||
sourceEdges,
|
||||
allEdges,
|
||||
currentNode
|
||||
}: {
|
||||
sourceEdges: RuntimeEdgeItemType[];
|
||||
allEdges: RuntimeEdgeItemType[];
|
||||
currentNode: RuntimeNodeItemType;
|
||||
}) => {
|
||||
const commonEdges: RuntimeEdgeItemType[] = [];
|
||||
const recursiveEdges: RuntimeEdgeItemType[] = [];
|
||||
|
||||
const checkIsCircular = (edge: RuntimeEdgeItemType, visited: Set<string>): boolean => {
|
||||
if (edge.source === currentNode.nodeId) {
|
||||
return true; // 检测到环,并且环中包含当前节点
|
||||
}
|
||||
if (visited.has(edge.source)) {
|
||||
return false; // 检测到环,但不包含当前节点(子节点成环)
|
||||
}
|
||||
visited.add(edge.source);
|
||||
|
||||
const nextEdges = allEdges.filter((item) => item.target === edge.source);
|
||||
return nextEdges.some((nextEdge) => checkIsCircular(nextEdge, new Set(visited)));
|
||||
};
|
||||
|
||||
sourceEdges.forEach((edge) => {
|
||||
if (checkIsCircular(edge, new Set([currentNode.nodeId]))) {
|
||||
recursiveEdges.push(edge);
|
||||
} else {
|
||||
commonEdges.push(edge);
|
||||
}
|
||||
});
|
||||
|
||||
return { commonEdges, recursiveEdges };
|
||||
};
|
||||
|
||||
const runtimeNodeSourceEdge = filterWorkflowEdges(runtimeEdges).filter(
|
||||
(item) => item.target === node.nodeId
|
||||
);
|
||||
|
||||
// Entry
|
||||
if (workflowEdges.length === 0) {
|
||||
if (runtimeNodeSourceEdge.length === 0) {
|
||||
return 'run';
|
||||
}
|
||||
|
||||
// Classify edges
|
||||
const { commonEdges, recursiveEdges } = splitEdges2WorkflowEdges({
|
||||
edges: workflowEdges,
|
||||
sourceEdges: runtimeNodeSourceEdge,
|
||||
allEdges: runtimeEdges,
|
||||
currentNode: node
|
||||
});
|
||||
|
||||
// check skip
|
||||
if (commonEdges.every((item) => item.status === 'skipped')) {
|
||||
// check skip(其中一组边,全 skip)
|
||||
if (commonEdges.length > 0 && commonEdges.every((item) => item.status === 'skipped')) {
|
||||
return 'skip';
|
||||
}
|
||||
if (recursiveEdges.length > 0 && recursiveEdges.every((item) => item.status === 'skipped')) {
|
||||
return 'skip';
|
||||
}
|
||||
|
||||
// check active
|
||||
if (commonEdges.every((item) => item.status !== 'waiting')) {
|
||||
// check active(有一类边,不全是 wait 即可运行)
|
||||
if (commonEdges.length > 0 && commonEdges.every((item) => item.status !== 'waiting')) {
|
||||
return 'run';
|
||||
}
|
||||
if (recursiveEdges.length > 0 && recursiveEdges.every((item) => item.status !== 'waiting')) {
|
||||
@@ -204,7 +234,8 @@ export const getReferenceVariableValue = ({
|
||||
nodes: RuntimeNodeItemType[];
|
||||
variables: Record<string, any>;
|
||||
}) => {
|
||||
if (!isReferenceValue(value)) {
|
||||
const nodeIds = nodes.map((node) => node.nodeId);
|
||||
if (!isReferenceValue(value, nodeIds)) {
|
||||
return value;
|
||||
}
|
||||
const sourceNodeId = value[0];
|
||||
@@ -236,7 +267,7 @@ export const textAdaptGptResponse = ({
|
||||
finish_reason?: null | 'stop';
|
||||
extraData?: Object;
|
||||
}) => {
|
||||
return JSON.stringify({
|
||||
return {
|
||||
...extraData,
|
||||
id: '',
|
||||
object: '',
|
||||
@@ -252,7 +283,7 @@ export const textAdaptGptResponse = ({
|
||||
finish_reason
|
||||
}
|
||||
]
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/* Update runtimeNode's outputs with interactive data from history */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { SystemConfigNode } from './system/systemConfig';
|
||||
import { PluginConfigNode } from './system/pluginConfig';
|
||||
import { EmptyNode } from './system/emptyNode';
|
||||
import { WorkflowStart } from './system/workflowStart';
|
||||
import { AiChatModule } from './system/aiChat';
|
||||
@@ -12,10 +13,11 @@ import { HttpNode468 } from './system/http468';
|
||||
import { ToolModule } from './system/tools';
|
||||
import { StopToolNode } from './system/stopTool';
|
||||
|
||||
import { RunAppModule } from './system/runApp/index';
|
||||
import { RunAppModule } from './system/abandoned/runApp/index';
|
||||
import { PluginInputModule } from './system/pluginInput';
|
||||
import { PluginOutputModule } from './system/pluginOutput';
|
||||
import { RunPluginModule } from './system/runPlugin';
|
||||
import { RunAppNode } from './system/runApp';
|
||||
import { AiQueryExtension } from './system/queryExtension';
|
||||
|
||||
import type { FlowNodeTemplateType } from '../type/node';
|
||||
@@ -25,27 +27,33 @@ import { VariableUpdateNode } from './system/variableUpdate';
|
||||
import { CodeNode } from './system/sandbox';
|
||||
import { TextEditorNode } from './system/textEditor';
|
||||
import { CustomFeedbackNode } from './system/customFeedback';
|
||||
import { ReadFilesNodes } from './system/readFiles';
|
||||
import { UserSelectNode } from './system/userSelect/index';
|
||||
import { ReadFilesNode } from './system/readFiles';
|
||||
import { UserSelectNode } from './system/interactive/userSelect';
|
||||
import { LoopNode } from './system/loop/loop';
|
||||
import { LoopStartNode } from './system/loop/loopStart';
|
||||
import { LoopEndNode } from './system/loop/loopEnd';
|
||||
import { FormInputNode } from './system/interactive/formInput';
|
||||
import { ToolParamsNode } from './system/toolParams';
|
||||
|
||||
const systemNodes: FlowNodeTemplateType[] = [
|
||||
AiChatModule,
|
||||
TextEditorNode,
|
||||
AssignedAnswerModule,
|
||||
DatasetSearchModule,
|
||||
DatasetConcatModule,
|
||||
ToolModule,
|
||||
StopToolNode,
|
||||
ClassifyQuestionModule,
|
||||
ContextExtractModule,
|
||||
ReadFilesNodes,
|
||||
DatasetConcatModule,
|
||||
ToolModule,
|
||||
ToolParamsNode,
|
||||
StopToolNode,
|
||||
ReadFilesNode,
|
||||
HttpNode468,
|
||||
AiQueryExtension,
|
||||
LafModule,
|
||||
IfElseNode,
|
||||
VariableUpdateNode,
|
||||
CodeNode,
|
||||
RunAppModule
|
||||
LoopNode
|
||||
];
|
||||
/* app flow module templates */
|
||||
export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
@@ -53,10 +61,12 @@ export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
WorkflowStart,
|
||||
...systemNodes,
|
||||
CustomFeedbackNode,
|
||||
UserSelectNode
|
||||
UserSelectNode,
|
||||
FormInputNode
|
||||
];
|
||||
/* plugin flow module templates */
|
||||
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
PluginConfigNode,
|
||||
PluginInputModule,
|
||||
PluginOutputModule,
|
||||
...systemNodes
|
||||
@@ -70,5 +80,9 @@ export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
||||
)
|
||||
),
|
||||
EmptyNode,
|
||||
RunPluginModule
|
||||
RunPluginModule,
|
||||
RunAppNode,
|
||||
RunAppModule,
|
||||
LoopStartNode,
|
||||
LoopEndNode
|
||||
];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NodeInputKeyEnum } from '../constants';
|
||||
import { FlowNodeInputTypeEnum } from '../node/constant';
|
||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||
import { chatNodeSystemPromptTip } from './tip';
|
||||
import { chatNodeSystemPromptTip, systemPromptTip } from './tip';
|
||||
import { FlowNodeInputItemType } from '../type/io';
|
||||
import { i18nT } from '../../../../web/i18n/utils';
|
||||
|
||||
@@ -9,8 +9,9 @@ export const Input_Template_History: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.history,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.numberInput, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.chatHistory,
|
||||
label: 'core.module.input.label.chat history',
|
||||
description: '最多携带多少轮对话记录',
|
||||
label: i18nT('common:core.module.input.label.chat history'),
|
||||
description: i18nT('workflow:max_dialog_rounds'),
|
||||
|
||||
required: true,
|
||||
min: 0,
|
||||
max: 50,
|
||||
@@ -21,7 +22,8 @@ export const Input_Template_UserChatInput: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.userChatInput,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '用户问题',
|
||||
label: i18nT('workflow:user_question'),
|
||||
toolDescription: i18nT('workflow:user_question_tool_desc'),
|
||||
required: true
|
||||
};
|
||||
|
||||
@@ -36,14 +38,14 @@ export const Input_Template_DynamicInput: FlowNodeInputItemType = {
|
||||
export const Input_Template_SelectAIModel: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.aiModel,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.selectLLMModel, FlowNodeInputTypeEnum.reference],
|
||||
label: 'core.module.input.label.aiModel',
|
||||
label: i18nT('common:core.module.input.label.aiModel'),
|
||||
required: true,
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
};
|
||||
export const Input_Template_SettingAiModel: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.aiModel,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.settingLLMModel, FlowNodeInputTypeEnum.reference],
|
||||
label: 'core.module.input.label.aiModel',
|
||||
label: i18nT('common:core.module.input.label.aiModel'),
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
};
|
||||
|
||||
@@ -52,8 +54,8 @@ export const Input_Template_System_Prompt: FlowNodeInputItemType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||
max: 3000,
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: 'core.ai.Prompt',
|
||||
description: chatNodeSystemPromptTip,
|
||||
label: i18nT('common:core.ai.Prompt'),
|
||||
description: systemPromptTip,
|
||||
placeholder: chatNodeSystemPromptTip
|
||||
};
|
||||
|
||||
@@ -61,7 +63,7 @@ export const Input_Template_Dataset_Quote: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.aiChatDatasetQuote,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.settingDatasetQuotePrompt],
|
||||
label: '',
|
||||
debugLabel: '知识库引用',
|
||||
debugLabel: i18nT('workflow:knowledge_base_reference'),
|
||||
description: '',
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
||||
};
|
||||
@@ -73,3 +75,43 @@ export const Input_Template_Text_Quote: FlowNodeInputItemType = {
|
||||
description: i18nT('app:document_quote_tip'),
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
};
|
||||
export const Input_Template_File_Link: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.fileUrlList,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
required: true,
|
||||
label: i18nT('app:workflow.user_file_input'),
|
||||
debugLabel: i18nT('app:workflow.user_file_input'),
|
||||
description: i18nT('app:workflow.user_file_input_desc'),
|
||||
valueType: WorkflowIOValueTypeEnum.arrayString
|
||||
};
|
||||
|
||||
export const Input_Template_Children_Node_List: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.childrenNodeIdList,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.arrayString,
|
||||
label: '',
|
||||
value: []
|
||||
};
|
||||
export const Input_Template_Node_Width: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.nodeWidth,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.number,
|
||||
label: '',
|
||||
value: 900
|
||||
};
|
||||
export const Input_Template_Node_Height: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.nodeHeight,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.number,
|
||||
label: '',
|
||||
value: 900
|
||||
};
|
||||
|
||||
export const Input_Template_Stream_MODE: FlowNodeInputItemType = {
|
||||
key: NodeInputKeyEnum.forbidStream,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.switch],
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
label: i18nT('workflow:template.forbid_stream'),
|
||||
description: i18nT('workflow:template.forbid_stream_desc'),
|
||||
value: false
|
||||
};
|
||||
|
||||
@@ -3,16 +3,17 @@ import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/node.d';
|
||||
} from '../../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../../constants';
|
||||
import { Input_Template_History, Input_Template_UserChatInput } from '../../input';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
} from '../../../../constants';
|
||||
import { Input_Template_History, Input_Template_UserChatInput } from '../../../input';
|
||||
import { getHandleConfig } from '../../../utils';
|
||||
import { i18nT } from '../../../../../../../web/i18n/utils';
|
||||
|
||||
export const RunAppModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.runApp,
|
||||
@@ -21,8 +22,8 @@ export const RunAppModule: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/runApp',
|
||||
name: '应用调用',
|
||||
intro: '可以选择一个其他应用进行调用',
|
||||
name: i18nT('workflow:application_call'),
|
||||
intro: i18nT('workflow:select_another_application_to_call'),
|
||||
showStatus: true,
|
||||
version: '481',
|
||||
isTool: true,
|
||||
@@ -31,22 +32,22 @@ export const RunAppModule: FlowNodeTemplateType = {
|
||||
key: NodeInputKeyEnum.runAppSelectApp,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.selectApp, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.selectApp,
|
||||
label: '选择一个应用',
|
||||
description: '选择一个其他应用进行调用',
|
||||
label: i18nT('workflow:select_an_application'),
|
||||
description: i18nT('workflow:choose_another_application_to_call'),
|
||||
required: true
|
||||
},
|
||||
Input_Template_History,
|
||||
{
|
||||
...Input_Template_UserChatInput,
|
||||
toolDescription: '用户问题'
|
||||
toolDescription: i18nT('workflow:user_question')
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: NodeOutputKeyEnum.history,
|
||||
key: NodeOutputKeyEnum.history,
|
||||
label: '新的上下文',
|
||||
description: '将该应用回复内容拼接到历史记录中,作为新的上下文返回',
|
||||
label: i18nT('workflow:new_context'),
|
||||
description: i18nT('workflow:append_application_reply_to_history_as_new_context'),
|
||||
valueType: WorkflowIOValueTypeEnum.chatHistory,
|
||||
valueDesc: chatHistoryValueDesc,
|
||||
required: true,
|
||||
@@ -55,8 +56,8 @@ export const RunAppModule: FlowNodeTemplateType = {
|
||||
{
|
||||
id: NodeOutputKeyEnum.answerText,
|
||||
key: NodeOutputKeyEnum.answerText,
|
||||
label: '回复的文本',
|
||||
description: '将在应用完全结束后触发',
|
||||
label: i18nT('workflow:reply_text'),
|
||||
description: i18nT('workflow:trigger_after_application_completion'),
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
@@ -3,14 +3,14 @@ import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
} from '../../../constants';
|
||||
import {
|
||||
Input_Template_SettingAiModel,
|
||||
Input_Template_Dataset_Quote,
|
||||
@@ -18,10 +18,30 @@ import {
|
||||
Input_Template_System_Prompt,
|
||||
Input_Template_UserChatInput,
|
||||
Input_Template_Text_Quote
|
||||
} from '../input';
|
||||
import { chatNodeSystemPromptTip } from '../tip';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
} from '../../input';
|
||||
import { chatNodeSystemPromptTip, systemPromptTip } from '../../tip';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
|
||||
export const AiChatQuoteRole = {
|
||||
key: NodeInputKeyEnum.aiChatQuoteRole,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: 'system' // user or system
|
||||
};
|
||||
export const AiChatQuoteTemplate = {
|
||||
key: NodeInputKeyEnum.aiChatQuoteTemplate,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
};
|
||||
export const AiChatQuotePrompt = {
|
||||
key: NodeInputKeyEnum.aiChatQuotePrompt,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
};
|
||||
|
||||
export const AiChatModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.chatNode,
|
||||
@@ -52,6 +72,7 @@ export const AiChatModule: FlowNodeTemplateType = {
|
||||
value: 2000,
|
||||
valueType: WorkflowIOValueTypeEnum.number
|
||||
},
|
||||
|
||||
{
|
||||
key: NodeInputKeyEnum.aiChatIsResponseText,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
@@ -59,18 +80,9 @@ export const AiChatModule: FlowNodeTemplateType = {
|
||||
value: true,
|
||||
valueType: WorkflowIOValueTypeEnum.boolean
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.aiChatQuoteTemplate,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.aiChatQuotePrompt,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
},
|
||||
AiChatQuoteRole,
|
||||
AiChatQuoteTemplate,
|
||||
AiChatQuotePrompt,
|
||||
{
|
||||
key: NodeInputKeyEnum.aiChatVision,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
@@ -81,22 +93,23 @@ export const AiChatModule: FlowNodeTemplateType = {
|
||||
// settings modal ---
|
||||
{
|
||||
...Input_Template_System_Prompt,
|
||||
label: 'core.ai.Prompt',
|
||||
description: chatNodeSystemPromptTip,
|
||||
label: i18nT('common:core.ai.Prompt'),
|
||||
description: systemPromptTip,
|
||||
placeholder: chatNodeSystemPromptTip
|
||||
},
|
||||
Input_Template_History,
|
||||
Input_Template_Dataset_Quote,
|
||||
Input_Template_Text_Quote,
|
||||
{ ...Input_Template_UserChatInput, toolDescription: '用户问题' }
|
||||
|
||||
{ ...Input_Template_UserChatInput, toolDescription: i18nT('workflow:user_question') }
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: NodeOutputKeyEnum.history,
|
||||
key: NodeOutputKeyEnum.history,
|
||||
required: true,
|
||||
label: 'core.module.output.label.New context',
|
||||
description: 'core.module.output.description.New context',
|
||||
label: i18nT('common:core.module.output.label.New context'),
|
||||
description: i18nT('common:core.module.output.description.New context'),
|
||||
valueType: WorkflowIOValueTypeEnum.chatHistory,
|
||||
valueDesc: chatHistoryValueDesc,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
@@ -105,8 +118,8 @@ export const AiChatModule: FlowNodeTemplateType = {
|
||||
id: NodeOutputKeyEnum.answerText,
|
||||
key: NodeOutputKeyEnum.answerText,
|
||||
required: true,
|
||||
label: 'core.module.output.label.Ai response content',
|
||||
description: 'core.module.output.description.Ai response content',
|
||||
label: i18nT('common:core.module.output.label.Ai response content'),
|
||||
description: i18nT('common:core.module.output.description.Ai response content'),
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
1
packages/global/core/workflow/template/system/aiChat/type.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export type AiChatQuoteRoleType = 'user' | 'system';
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
|
||||
export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.answerNode,
|
||||
@@ -14,9 +15,9 @@ export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/reply',
|
||||
name: '指定回复',
|
||||
intro:
|
||||
'该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。',
|
||||
name: i18nT('workflow:assigned_reply'),
|
||||
intro: i18nT('workflow:intro_assigned_reply'),
|
||||
|
||||
version: '481',
|
||||
isTool: true,
|
||||
inputs: [
|
||||
@@ -25,9 +26,9 @@ export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
required: true,
|
||||
label: 'core.module.input.label.Response content',
|
||||
description: 'core.module.input.description.Response content',
|
||||
placeholder: 'core.module.input.description.Response content'
|
||||
label: i18nT('common:core.module.input.label.Response content'),
|
||||
description: i18nT('common:core.module.input.description.Response content'),
|
||||
placeholder: i18nT('common:core.module.input.description.Response content')
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { Input_Template_System_Prompt } from '../../input';
|
||||
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
|
||||
export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.classifyQuestion,
|
||||
@@ -26,8 +27,8 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(false, false, false, false),
|
||||
targetHandle: getHandleConfig(true, false, true, true),
|
||||
avatar: 'core/workflow/template/questionClassify',
|
||||
name: '问题分类',
|
||||
intro: `根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品“使用”问题\n类型3: 关于商品“购买”问题\n类型4: 其他问题`,
|
||||
name: i18nT('workflow:question_classification'),
|
||||
intro: i18nT('workflow:intro_question_classification'),
|
||||
showStatus: true,
|
||||
version: '481',
|
||||
inputs: [
|
||||
@@ -50,15 +51,15 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
label: '',
|
||||
value: [
|
||||
{
|
||||
value: '打招呼',
|
||||
value: 'Greeting',
|
||||
key: 'wqre'
|
||||
},
|
||||
{
|
||||
value: '关于 xxx 的问题',
|
||||
value: 'Question regarding xxx',
|
||||
key: 'sdfa'
|
||||
},
|
||||
{
|
||||
value: '其他问题',
|
||||
value: 'Other Questions',
|
||||
key: 'agex'
|
||||
}
|
||||
]
|
||||
@@ -69,7 +70,7 @@ export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
id: NodeOutputKeyEnum.cqResult,
|
||||
key: NodeOutputKeyEnum.cqResult,
|
||||
required: true,
|
||||
label: '分类结果',
|
||||
label: i18nT('workflow:classification_result'),
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
|
||||
40
packages/global/core/workflow/template/system/comment.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
WorkflowIOValueTypeEnum
|
||||
} from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const CommentNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.comment,
|
||||
templateType: FlowNodeTemplateTypeEnum.systemInput,
|
||||
flowNodeType: FlowNodeTypeEnum.comment,
|
||||
sourceHandle: getHandleConfig(false, false, false, false),
|
||||
targetHandle: getHandleConfig(false, false, false, false),
|
||||
avatar: '',
|
||||
name: '',
|
||||
intro: '',
|
||||
version: '4811',
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.commentText,
|
||||
renderTypeList: [],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.commentSize,
|
||||
renderTypeList: [],
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
label: '',
|
||||
value: {
|
||||
width: 240,
|
||||
height: 140
|
||||
}
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
};
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { Input_Template_SelectAIModel, Input_Template_History } from '../../input';
|
||||
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
|
||||
export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.contentExtract,
|
||||
@@ -21,8 +22,8 @@ export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/extractJson',
|
||||
name: '文本内容提取',
|
||||
intro: '可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等',
|
||||
name: i18nT('workflow:text_content_extraction'),
|
||||
intro: i18nT('workflow:intro_text_content_extraction'),
|
||||
showStatus: true,
|
||||
isTool: true,
|
||||
version: '481',
|
||||
@@ -35,27 +36,25 @@ export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
key: NodeInputKeyEnum.description,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '提取要求描述',
|
||||
description:
|
||||
'给AI一些对应的背景知识或要求描述,引导AI更好的完成任务。\n该输入框可使用全局变量。',
|
||||
placeholder:
|
||||
'例如: \n1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。'
|
||||
label: i18nT('workflow:extraction_requirements_description'),
|
||||
description: i18nT('workflow:extraction_requirements_description_detail'),
|
||||
placeholder: i18nT('workflow:extraction_requirements_placeholder')
|
||||
},
|
||||
Input_Template_History,
|
||||
{
|
||||
key: NodeInputKeyEnum.contextExtractInput,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference, FlowNodeInputTypeEnum.textarea],
|
||||
label: '需要提取的文本',
|
||||
label: i18nT('workflow:text_to_extract'),
|
||||
required: true,
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
toolDescription: '需要检索的内容'
|
||||
toolDescription: i18nT('workflow:content_to_retrieve')
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.extractKeys,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
description: "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
|
||||
description: i18nT('workflow:target_fields_description'),
|
||||
value: [] // {valueType: string; desc: string; key: string; required: boolean; enum: string[]}[]
|
||||
}
|
||||
],
|
||||
@@ -63,18 +62,18 @@ export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
{
|
||||
id: NodeOutputKeyEnum.success,
|
||||
key: NodeOutputKeyEnum.success,
|
||||
label: '字段完全提取',
|
||||
label: i18nT('workflow:full_field_extraction'),
|
||||
required: true,
|
||||
description: '提取字段全部填充时返回 true (模型提取或使用默认值均属于成功)',
|
||||
description: i18nT('workflow:full_field_extraction_description'),
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
},
|
||||
{
|
||||
id: NodeOutputKeyEnum.contextExtractFields,
|
||||
key: NodeOutputKeyEnum.contextExtractFields,
|
||||
label: '完整提取结果',
|
||||
label: i18nT('workflow:complete_extraction_result'),
|
||||
required: true,
|
||||
description: '一个 JSON 字符串,例如:{"name:":"YY","Time":"2023/7/2 18:00"}',
|
||||
description: i18nT('workflow:complete_extraction_result_description'),
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { WorkflowIOValueTypeEnum } from '../../../constants';
|
||||
|
||||
export type ContextExtractAgentItemType = {
|
||||
valueType: 'string' | 'number' | 'boolean';
|
||||
valueType:
|
||||
| WorkflowIOValueTypeEnum.string
|
||||
| WorkflowIOValueTypeEnum.number
|
||||
| WorkflowIOValueTypeEnum.boolean;
|
||||
desc: string;
|
||||
key: string;
|
||||
required: boolean;
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
NodeInputKeyEnum
|
||||
} from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
|
||||
export const CustomFeedbackNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.customFeedback,
|
||||
@@ -14,8 +15,8 @@ export const CustomFeedbackNode: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/customFeedback',
|
||||
name: '自定义反馈',
|
||||
intro: '该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。',
|
||||
name: i18nT('workflow:custom_feedback'),
|
||||
intro: i18nT('workflow:intro_custom_feedback'),
|
||||
version: '486',
|
||||
inputs: [
|
||||
{
|
||||
@@ -23,7 +24,7 @@ export const CustomFeedbackNode: FlowNodeTemplateType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
required: true,
|
||||
label: '反馈的文本'
|
||||
label: i18nT('workflow:feedback_text')
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
import { getNanoid } from '../../../../common/string/tools';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { FlowNodeInputItemType } from '../../type/io.d';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
|
||||
export const getOneQuoteInputTemplate = ({
|
||||
key = getNanoid(),
|
||||
@@ -24,8 +25,8 @@ export const getOneQuoteInputTemplate = ({
|
||||
}): FlowNodeInputItemType => ({
|
||||
key,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
label: `引用${index}`,
|
||||
debugLabel: '知识库引用',
|
||||
label: `${i18nT('workflow:quote_num')},{ num: ${index} }`,
|
||||
debugLabel: i18nT('workflow:knowledge_base_reference'),
|
||||
canEdit: true,
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
||||
});
|
||||
@@ -37,15 +38,17 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/datasetConcat',
|
||||
name: '知识库搜索引用合并',
|
||||
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
|
||||
name: i18nT('workflow:knowledge_base_search_merge'),
|
||||
intro: i18nT('workflow:intro_knowledge_base_search_merge'),
|
||||
|
||||
showStatus: false,
|
||||
version: '486',
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
label: '最大 Tokens',
|
||||
label: i18nT('workflow:max_tokens'),
|
||||
|
||||
value: 3000,
|
||||
valueType: WorkflowIOValueTypeEnum.number
|
||||
},
|
||||
@@ -60,7 +63,7 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
||||
{
|
||||
id: NodeOutputKeyEnum.datasetQuoteQA,
|
||||
key: NodeOutputKeyEnum.datasetQuoteQA,
|
||||
label: 'core.module.Dataset quote.label',
|
||||
label: i18nT('common:core.module.Dataset quote.label'),
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote,
|
||||
valueDesc: datasetQuoteValueDesc
|
||||
|
||||
@@ -34,7 +34,7 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetSelectList,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.selectDataset, FlowNodeInputTypeEnum.reference],
|
||||
label: 'core.module.input.label.Select dataset',
|
||||
label: i18nT('common:core.module.input.label.Select dataset'),
|
||||
value: [],
|
||||
valueType: WorkflowIOValueTypeEnum.selectDataset,
|
||||
required: true
|
||||
@@ -90,34 +90,24 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||
},
|
||||
{
|
||||
...Input_Template_UserChatInput,
|
||||
toolDescription: '需要检索的内容'
|
||||
toolDescription: i18nT('workflow:content_to_search')
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.collectionFilterMatch,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.JSONEditor, FlowNodeInputTypeEnum.reference],
|
||||
label: '集合元数据过滤',
|
||||
label: i18nT('workflow:collection_metadata_filter'),
|
||||
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
isPro: true,
|
||||
description: `目前支持标签和创建时间过滤,需按照以下格式填写:
|
||||
{
|
||||
"tags": {
|
||||
"$and": ["标签 1","标签 2"],
|
||||
"$or": ["有 $and 标签时,and 生效,or 不生效"]
|
||||
},
|
||||
"createTime": {
|
||||
"$gte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间大于该时间",
|
||||
"$lte": "YYYY-MM-DD HH:mm 格式即可,集合的创建时间小于该时间,可和 $gte 共同使用"
|
||||
}
|
||||
}
|
||||
`
|
||||
description: i18nT('workflow:filter_description')
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: NodeOutputKeyEnum.datasetQuoteQA,
|
||||
key: NodeOutputKeyEnum.datasetQuoteQA,
|
||||
label: 'core.module.Dataset quote.label',
|
||||
description: '特殊数组格式,搜索结果为空时,返回空数组。',
|
||||
label: i18nT('common:core.module.Dataset quote.label'),
|
||||
description: i18nT('workflow:special_array_format'),
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote,
|
||||
valueDesc: datasetQuoteValueDesc
|
||||
|
||||
@@ -8,11 +8,13 @@ import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
FlowNodeTemplateTypeEnum,
|
||||
ContentTypes
|
||||
} from '../../constants';
|
||||
import { Input_Template_DynamicInput } from '../input';
|
||||
import { Output_Template_AddOutput } from '../output';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
|
||||
export const HttpNode468: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.httpRequest468,
|
||||
@@ -21,15 +23,15 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: 'core/workflow/template/httpRequest',
|
||||
name: 'HTTP 请求',
|
||||
intro: '可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)',
|
||||
name: i18nT('workflow:http_request'),
|
||||
intro: i18nT('workflow:intro_http_request'),
|
||||
showStatus: true,
|
||||
isTool: true,
|
||||
version: '481',
|
||||
inputs: [
|
||||
{
|
||||
...Input_Template_DynamicInput,
|
||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
||||
description: i18nT('common:core.module.input.description.HTTP Dynamic Input'),
|
||||
customInputConfig: {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
@@ -59,7 +61,7 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
label: '',
|
||||
description: 'core.module.input.description.Http Request Url',
|
||||
description: i18nT('common:core.module.input.description.Http Request Url'),
|
||||
placeholder: 'https://api.ai.com/getInventory',
|
||||
required: false
|
||||
},
|
||||
@@ -69,8 +71,8 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
value: [],
|
||||
label: '',
|
||||
description: 'core.module.input.description.Http Request Header',
|
||||
placeholder: 'core.module.input.description.Http Request Header',
|
||||
description: i18nT('common:core.module.input.description.Http Request Header'),
|
||||
placeholder: i18nT('common:core.module.input.description.Http Request Header'),
|
||||
required: false
|
||||
},
|
||||
{
|
||||
@@ -81,6 +83,7 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
label: '',
|
||||
required: false
|
||||
},
|
||||
// json body data
|
||||
{
|
||||
key: NodeInputKeyEnum.httpJsonBody,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
@@ -88,6 +91,24 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
value: '',
|
||||
label: '',
|
||||
required: false
|
||||
},
|
||||
// form body data
|
||||
{
|
||||
key: NodeInputKeyEnum.httpFormBody,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
value: [],
|
||||
label: '',
|
||||
required: false
|
||||
},
|
||||
// body data type
|
||||
{
|
||||
key: NodeInputKeyEnum.httpContentType,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: ContentTypes.json,
|
||||
label: '',
|
||||
required: false
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
@@ -97,17 +118,17 @@ export const HttpNode468: FlowNodeTemplateType = {
|
||||
{
|
||||
id: NodeOutputKeyEnum.error,
|
||||
key: NodeOutputKeyEnum.error,
|
||||
label: '请求错误',
|
||||
description: 'HTTP请求错误信息,成功时返回空',
|
||||
label: i18nT('workflow:request_error'),
|
||||
description: i18nT('workflow:http_request_error_info'),
|
||||
valueType: WorkflowIOValueTypeEnum.object,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
},
|
||||
{
|
||||
id: NodeOutputKeyEnum.httpRawResponse,
|
||||
key: NodeOutputKeyEnum.httpRawResponse,
|
||||
label: '原始响应',
|
||||
required: true,
|
||||
description: 'HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。',
|
||||
label: i18nT('workflow:raw_response'),
|
||||
description: i18nT('workflow:http_raw_response_description'),
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
type: FlowNodeOutputTypeEnum.static
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { i18nT } from '../../../../../../web/i18n/utils';
|
||||
|
||||
export enum VariableConditionEnum {
|
||||
equalTo = 'equalTo',
|
||||
notEqual = 'notEqual',
|
||||
@@ -29,64 +31,85 @@ export enum IfElseResultEnum {
|
||||
}
|
||||
|
||||
export const stringConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: '等于', value: VariableConditionEnum.equalTo },
|
||||
{ label: '不等于', value: VariableConditionEnum.notEqual },
|
||||
{ label: '正则', value: VariableConditionEnum.reg },
|
||||
{ label: '包含', value: VariableConditionEnum.include },
|
||||
{ label: '不包含', value: VariableConditionEnum.notInclude },
|
||||
{ label: '开始为', value: VariableConditionEnum.startWith },
|
||||
{ label: '结束为', value: VariableConditionEnum.endWith }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: i18nT('workflow:is_equal_to'), value: VariableConditionEnum.equalTo },
|
||||
{ label: i18nT('workflow:is_not_equal'), value: VariableConditionEnum.notEqual },
|
||||
{ label: i18nT('workflow:regex'), value: VariableConditionEnum.reg },
|
||||
{ label: i18nT('workflow:contains'), value: VariableConditionEnum.include },
|
||||
{ label: i18nT('workflow:not_contains'), value: VariableConditionEnum.notInclude },
|
||||
{ label: i18nT('workflow:start_with'), value: VariableConditionEnum.startWith },
|
||||
{ label: i18nT('workflow:end_with'), value: VariableConditionEnum.endWith }
|
||||
];
|
||||
export const numberConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: '等于', value: VariableConditionEnum.equalTo },
|
||||
{ label: '不等于', value: VariableConditionEnum.notEqual },
|
||||
{ label: '大于', value: VariableConditionEnum.greaterThan },
|
||||
{ label: '大于等于', value: VariableConditionEnum.greaterThanOrEqualTo },
|
||||
{ label: '小于', value: VariableConditionEnum.lessThan },
|
||||
{ label: '小于等于', value: VariableConditionEnum.lessThanOrEqualTo }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: i18nT('workflow:is_equal_to'), value: VariableConditionEnum.equalTo },
|
||||
{ label: i18nT('workflow:is_not_equal'), value: VariableConditionEnum.notEqual },
|
||||
{ label: i18nT('workflow:greater_than'), value: VariableConditionEnum.greaterThan },
|
||||
{
|
||||
label: i18nT('workflow:greater_than_or_equal_to'),
|
||||
value: VariableConditionEnum.greaterThanOrEqualTo
|
||||
},
|
||||
{ label: i18nT('workflow:less_than'), value: VariableConditionEnum.lessThan },
|
||||
{ label: i18nT('workflow:less_than_or_equal_to'), value: VariableConditionEnum.lessThanOrEqualTo }
|
||||
];
|
||||
export const booleanConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: '等于', value: VariableConditionEnum.equalTo }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: i18nT('workflow:is_equal_to'), value: VariableConditionEnum.equalTo }
|
||||
];
|
||||
export const arrayConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: '包含', value: VariableConditionEnum.include },
|
||||
{ label: '不包含', value: VariableConditionEnum.notInclude },
|
||||
{ label: '长度等于', value: VariableConditionEnum.lengthEqualTo },
|
||||
{ label: '长度不等于', value: VariableConditionEnum.lengthNotEqualTo },
|
||||
{ label: '长度大于', value: VariableConditionEnum.lengthGreaterThan },
|
||||
{ label: '长度大于等于', value: VariableConditionEnum.lengthGreaterThanOrEqualTo },
|
||||
{ label: '长度小于', value: VariableConditionEnum.lengthLessThan },
|
||||
{ label: '长度小于等于', value: VariableConditionEnum.lengthLessThanOrEqualTo }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: i18nT('workflow:contains'), value: VariableConditionEnum.include },
|
||||
{ label: i18nT('workflow:not_contains'), value: VariableConditionEnum.notInclude },
|
||||
{ label: i18nT('workflow:length_equal_to'), value: VariableConditionEnum.lengthEqualTo },
|
||||
{ label: i18nT('workflow:length_not_equal_to'), value: VariableConditionEnum.lengthNotEqualTo },
|
||||
{ label: i18nT('workflow:length_greater_than'), value: VariableConditionEnum.lengthGreaterThan },
|
||||
{
|
||||
label: i18nT('workflow:length_greater_than_or_equal_to'),
|
||||
value: VariableConditionEnum.lengthGreaterThanOrEqualTo
|
||||
},
|
||||
{ label: i18nT('workflow:length_less_than'), value: VariableConditionEnum.lengthLessThan },
|
||||
{
|
||||
label: i18nT('workflow:length_less_than_or_equal_to'),
|
||||
value: VariableConditionEnum.lengthLessThanOrEqualTo
|
||||
}
|
||||
];
|
||||
export const objectConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty }
|
||||
];
|
||||
export const allConditionList = [
|
||||
{ label: '为空', value: VariableConditionEnum.isEmpty },
|
||||
{ label: '不为空', value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: '等于', value: VariableConditionEnum.equalTo },
|
||||
{ label: '不等于', value: VariableConditionEnum.notEqual },
|
||||
{ label: '包含', value: VariableConditionEnum.include },
|
||||
{ label: '不包含', value: VariableConditionEnum.notInclude },
|
||||
{ label: '开始为', value: VariableConditionEnum.startWith },
|
||||
{ label: '结束为', value: VariableConditionEnum.endWith },
|
||||
{ label: '大于', value: VariableConditionEnum.greaterThan },
|
||||
{ label: '大于等于', value: VariableConditionEnum.greaterThanOrEqualTo },
|
||||
{ label: '小于', value: VariableConditionEnum.lessThan },
|
||||
{ label: '小于等于', value: VariableConditionEnum.lessThanOrEqualTo },
|
||||
{ label: '长度等于', value: VariableConditionEnum.lengthEqualTo },
|
||||
{ label: '长度不等于', value: VariableConditionEnum.lengthNotEqualTo },
|
||||
{ label: '长度大于', value: VariableConditionEnum.lengthGreaterThan },
|
||||
{ label: '长度大于等于', value: VariableConditionEnum.lengthGreaterThanOrEqualTo },
|
||||
{ label: '长度小于', value: VariableConditionEnum.lengthLessThan },
|
||||
{ label: '长度小于等于', value: VariableConditionEnum.lengthLessThanOrEqualTo }
|
||||
{ label: i18nT('workflow:is_empty'), value: VariableConditionEnum.isEmpty },
|
||||
{ label: i18nT('workflow:is_not_empty'), value: VariableConditionEnum.isNotEmpty },
|
||||
{ label: i18nT('workflow:is_equal_to'), value: VariableConditionEnum.equalTo },
|
||||
{ label: i18nT('workflow:is_not_equal'), value: VariableConditionEnum.notEqual },
|
||||
{ label: i18nT('workflow:contains'), value: VariableConditionEnum.include },
|
||||
{ label: i18nT('workflow:not_contains'), value: VariableConditionEnum.notInclude },
|
||||
{ label: i18nT('workflow:start_with'), value: VariableConditionEnum.startWith },
|
||||
{ label: i18nT('workflow:end_with'), value: VariableConditionEnum.endWith },
|
||||
{ label: i18nT('workflow:greater_than'), value: VariableConditionEnum.greaterThan },
|
||||
{
|
||||
label: i18nT('workflow:greater_than_or_equal_to'),
|
||||
value: VariableConditionEnum.greaterThanOrEqualTo
|
||||
},
|
||||
{ label: i18nT('workflow:less_than'), value: VariableConditionEnum.lessThan },
|
||||
{
|
||||
label: i18nT('workflow:less_than_or_equal_to'),
|
||||
value: VariableConditionEnum.lessThanOrEqualTo
|
||||
},
|
||||
{ label: i18nT('workflow:length_equal_to'), value: VariableConditionEnum.lengthEqualTo },
|
||||
{ label: i18nT('workflow:length_not_equal_to'), value: VariableConditionEnum.lengthNotEqualTo },
|
||||
{ label: i18nT('workflow:length_greater_than'), value: VariableConditionEnum.lengthGreaterThan },
|
||||
{
|
||||
label: i18nT('workflow:length_greater_than_or_equal_to'),
|
||||
value: VariableConditionEnum.lengthGreaterThanOrEqualTo
|
||||
},
|
||||
{ label: i18nT('workflow:length_less_than'), value: VariableConditionEnum.lengthLessThan },
|
||||
{
|
||||
label: i18nT('workflow:length_less_than_or_equal_to'),
|
||||
value: VariableConditionEnum.lengthLessThanOrEqualTo
|
||||
}
|
||||
];
|
||||
|
||||