Compare commits
65 Commits
v4.8.5-alp
...
v4.8.8-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d25a1d3ec | ||
|
|
2d1e53c3b5 | ||
|
|
71d0093768 | ||
|
|
cd554f573e | ||
|
|
2d016b7462 | ||
|
|
65515e7952 | ||
|
|
5906daff9f | ||
|
|
55cefccad1 | ||
|
|
87dac54f1e | ||
|
|
45b8d7e8de | ||
|
|
a478621730 | ||
|
|
a233ab9584 | ||
|
|
8d2a192515 | ||
|
|
dcaf972767 | ||
|
|
f9d43ac009 | ||
|
|
abcf48d5ec | ||
|
|
bf5145e632 | ||
|
|
f37cdabb15 | ||
|
|
e99c91aaa6 | ||
|
|
a4787bce5c | ||
|
|
f24e41f5ec | ||
|
|
85de3c1d64 | ||
|
|
c6f682310c | ||
|
|
991398b8d2 | ||
|
|
f452554663 | ||
|
|
57ff38e16f | ||
|
|
f7b55b501f | ||
|
|
cf7145ab54 | ||
|
|
1eedb9caba | ||
|
|
6390d64417 | ||
|
|
3d80eb288b | ||
|
|
5cb196535f | ||
|
|
982325d066 | ||
|
|
36f8755d09 | ||
|
|
fc96bb99cc | ||
|
|
1e4ffc2481 | ||
|
|
ee7496467b | ||
|
|
b5c98a4f63 | ||
|
|
090c880860 | ||
|
|
dd2a9bdee5 | ||
|
|
8d60ef505f | ||
|
|
b14514c105 | ||
|
|
11ffaaf2c5 | ||
|
|
e2ae571d15 | ||
|
|
f548e24e7d | ||
|
|
5605f1a892 | ||
|
|
88d10451c9 | ||
|
|
8a7bd689ae | ||
|
|
a9cdece341 | ||
|
|
babf03c218 | ||
|
|
9e169a48e3 | ||
|
|
e223390231 | ||
|
|
3257744c76 | ||
|
|
e1e112eaff | ||
|
|
5c37d29451 | ||
|
|
3a16f1a21c | ||
|
|
fa7b73f942 | ||
|
|
f8610d750d | ||
|
|
96a03e9927 | ||
|
|
a3b0ef066b | ||
|
|
9d084b633c | ||
|
|
4b4bea196a | ||
|
|
e247545afa | ||
|
|
93b44fc8f5 | ||
|
|
9aa6fd4904 |
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: 微信交流群
|
- name: 飞书话题群
|
||||||
url: https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg
|
url: https://oss.laf.run/otnvvf-imgs/1719505774252.jpg
|
||||||
about: FastGPT 全是问题群
|
about: FastGPT 全是问题群
|
||||||
|
|||||||
3
.github/workflows/docs-deploy-kubeconfig.yml
vendored
3
.github/workflows/docs-deploy-kubeconfig.yml
vendored
@@ -16,6 +16,9 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Change baseURL
|
||||||
|
run: sed -i 's|^baseURL =.*|baseURL = "https://doc.fastgpt.cn"|g' ./docSite/hugo.toml
|
||||||
|
|
||||||
- name: Get current date and time
|
- name: Get current date and time
|
||||||
id: datetime
|
id: datetime
|
||||||
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
|
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
|
||||||
|
|||||||
2
.github/workflows/preview-image.yml
vendored
2
.github/workflows/preview-image.yml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-fastgpt-images:
|
preview-fastgpt-images:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
1
.npmrc
1
.npmrc
@@ -1,2 +1,3 @@
|
|||||||
public-hoist-pattern[]=*tiktoken*
|
public-hoist-pattern[]=*tiktoken*
|
||||||
public-hoist-pattern[]=*@zilliz/milvus2-sdk-node*
|
public-hoist-pattern[]=*@zilliz/milvus2-sdk-node*
|
||||||
|
registry=https://registry.npmjs.org/
|
||||||
@@ -3,4 +3,6 @@ dist
|
|||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
docSite/
|
docSite/
|
||||||
*.md
|
*.md
|
||||||
|
|
||||||
|
cl100l_base.ts
|
||||||
5
.vscode/extensions.json
vendored
5
.vscode/extensions.json
vendored
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": [
|
|
||||||
"inlang.vs-code-extension"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
6
.vscode/i18n-ally-custom-framework.yml
vendored
6
.vscode/i18n-ally-custom-framework.yml
vendored
@@ -26,13 +26,14 @@ usageMatchRegex:
|
|||||||
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
||||||
- "[^\\w\\d]userT\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]userT\\(['\"`]({key})['\"`]"
|
||||||
- "[^\\w\\d]chatT\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]chatT\\(['\"`]({key})['\"`]"
|
||||||
|
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
||||||
|
|
||||||
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
||||||
# and works like how the i18next framework identifies the namespace scope from the
|
# and works like how the i18next framework identifies the namespace scope from the
|
||||||
# useTranslation() hook.
|
# useTranslation() hook.
|
||||||
# You should unescape RegEx strings in order to fit in the YAML file
|
# You should unescape RegEx strings in order to fit in the YAML file
|
||||||
# To help with this, you can use https://www.freeformatter.com/json-escape.html
|
# To help with this, you can use https://www.freeformatter.com/json-escape.html
|
||||||
scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"
|
scopeRangeRegex: "([^:]+):"
|
||||||
|
|
||||||
# An array of strings containing refactor templates.
|
# An array of strings containing refactor templates.
|
||||||
# The "$1" will be replaced by the keypath specified.
|
# The "$1" will be replaced by the keypath specified.
|
||||||
@@ -41,6 +42,5 @@ scopeRangeRegex: "useTranslation\\(\\s*\\[?\\s*['\"`](.*?)['\"`]"
|
|||||||
# refactorTemplates:
|
# refactorTemplates:
|
||||||
# - i18n.get("$1")
|
# - i18n.get("$1")
|
||||||
|
|
||||||
|
|
||||||
# If set to true, only enables this custom framework (will disable all built-in frameworks)
|
# If set to true, only enables this custom framework (will disable all built-in frameworks)
|
||||||
monopoly: true
|
monopoly: false
|
||||||
|
|||||||
16
.vscode/settings.json
vendored
16
.vscode/settings.json
vendored
@@ -2,16 +2,26 @@
|
|||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.mouseWheelZoom": true,
|
"editor.mouseWheelZoom": true,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
"prettier.prettierPath": "../node_modules/prettier",
|
"prettier.prettierPath": "node_modules/prettier",
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"i18n-ally.localesPaths": [
|
"i18n-ally.localesPaths": [
|
||||||
"packages/web/i18n",
|
"packages/web/i18n",
|
||||||
],
|
],
|
||||||
"i18n-ally.enabledParsers": ["json", "yaml", "js", "ts"],
|
"i18n-ally.enabledParsers": [
|
||||||
|
"json",
|
||||||
|
"yaml",
|
||||||
|
"js",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
"i18n-ally.keystyle": "nested",
|
"i18n-ally.keystyle": "nested",
|
||||||
"i18n-ally.sortKeys": true,
|
"i18n-ally.sortKeys": true,
|
||||||
"i18n-ally.keepFulfilled": false,
|
"i18n-ally.keepFulfilled": false,
|
||||||
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
|
"i18n-ally.sourceLanguage": "zh", // 根据此语言文件翻译其他语言文件的变量和内容
|
||||||
"i18n-ally.displayLanguage": "zh", // 显示语言
|
"i18n-ally.displayLanguage": "zh", // 显示语言
|
||||||
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key"
|
"i18n-ally.namespace": true,
|
||||||
|
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
|
||||||
|
"i18n-ally.extract.targetPickingStrategy": "most-similar-by-key",
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -120,9 +120,9 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
|
|||||||
|
|
||||||
## 🏘️ 社区交流群
|
## 🏘️ 社区交流群
|
||||||
|
|
||||||
wx 扫一下加入:
|
扫码加入飞书话题群 (新开,逐渐弃用微信群):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href="#readme">
|
<a href="#readme">
|
||||||
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
<img src="https://img.shields.io/badge/-返回顶部-7d09f1.svg" alt="#" align="right">
|
||||||
|
|||||||
72
dev.md
72
dev.md
@@ -23,6 +23,77 @@ pnpm dev
|
|||||||
make dev name=app
|
make dev name=app
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: If the Node version is >= 20, you need to pass the `--no-node-snapshot` parameter to Node when running `pnpm i`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
NODE_OPTIONS=--no-node-snapshot pnpm i
|
||||||
|
```
|
||||||
|
|
||||||
|
## I18N
|
||||||
|
|
||||||
|
### Install i18n-ally Plugin
|
||||||
|
|
||||||
|
1. Open the Extensions Marketplace in VSCode, search for and install the `i18n Ally` plugin.
|
||||||
|
|
||||||
|
### Code Optimization Examples
|
||||||
|
|
||||||
|
#### Fetch Specific Namespace Translations in `getServerSideProps`
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// pages/yourPage.tsx
|
||||||
|
export async function getServerSideProps(context: any) {
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
currentTab: context?.query?.currentTab || TabEnum.info,
|
||||||
|
...(await serverSideTranslations(context.locale, ['publish', 'user']))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Use useTranslation Hook in Page
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// pages/yourPage.tsx
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
|
|
||||||
|
const YourComponent = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
mr={2}
|
||||||
|
onClick={() => setShowSelected(false)}
|
||||||
|
>
|
||||||
|
{t('common:close')}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default YourComponent;
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Handle Static File Translations
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// utils/i18n.ts
|
||||||
|
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||||
|
|
||||||
|
const staticContent = {
|
||||||
|
id: 'simpleChat',
|
||||||
|
avatar: 'core/workflow/template/aiChat',
|
||||||
|
name: i18nT('app:template.simple_robot'),
|
||||||
|
};
|
||||||
|
|
||||||
|
export default staticContent;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Standardize Translation Format
|
||||||
|
|
||||||
|
- Use the t(namespace:key) format to ensure consistent naming.
|
||||||
|
- Translation keys should use lowercase letters and underscores, e.g., common.close.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@@ -37,4 +108,3 @@ docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/f
|
|||||||
# Make cmd: Build image with proxy
|
# Make cmd: Build image with proxy
|
||||||
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 proxy=taobao
|
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 proxy=taobao
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ FastGPT 商业版是基于 FastGPT 开源版的增强版本,增加了一些独
|
|||||||
| 应用管理与高级编排 | ✅ | ✅ | ✅ |
|
| 应用管理与高级编排 | ✅ | ✅ | ✅ |
|
||||||
| 文档知识库 | ✅ | ✅ | ✅ |
|
| 文档知识库 | ✅ | ✅ | ✅ |
|
||||||
| 外部使用 | ✅ | ✅ | ✅ |
|
| 外部使用 | ✅ | ✅ | ✅ |
|
||||||
|
| 最大应用数量 | 500 | 无限制 | 由付费套餐决定 |
|
||||||
|
| 最大知识库数量(单个知识库内容无限制) | 30 | 无限制 | 由付费套餐决定 |
|
||||||
| 自定义版权信息 | ❌ | ✅ | 设计中 |
|
| 自定义版权信息 | ❌ | ✅ | 设计中 |
|
||||||
| 多租户与支付 | ❌ | ✅ | ✅ |
|
| 多租户与支付 | ❌ | ✅ | ✅ |
|
||||||
| 团队空间 | ❌ | ✅ | ✅ |
|
| 团队空间 | ❌ | ✅ | ✅ |
|
||||||
| 应用发布安全配置 | ❌ | ✅ | ✅ |
|
| 应用发布安全配置 | ❌ | ✅ | ✅ |
|
||||||
| 内容审核 | ❌ | ✅ | ✅ |
|
| 内容审核 | ❌ | ✅ | ✅ |
|
||||||
| web站点同步 | ❌ | ✅ | ✅ |
|
| web站点同步 | ❌ | ✅ | ✅ |
|
||||||
| 管理后台 | ❌ | ✅ | ✅ |
|
| 管理后台 | ❌ | ✅ | 不需要 |
|
||||||
| 增强训练模式 | ❌ | ✅ | ✅ |
|
| 增强训练模式 | ❌ | ✅ | ✅ |
|
||||||
| 图片知识库 | ❌ | 设计中 | 设计中 |
|
| 图片知识库 | ❌ | 设计中 | 设计中 |
|
||||||
| 自动规划召回 | ❌ | 设计中 | 设计中 |
|
| 自动规划召回 | ❌ | 设计中 | 设计中 |
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ weight: 707
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
{{% alert icon="🤖" context="success" %}}
|
{{% alert icon="🤖" context="success" %}}
|
||||||
|
|
||||||
- MongoDB:用于存储除了向量外的各类数据
|
- MongoDB:用于存储除了向量外的各类数据
|
||||||
@@ -105,20 +104,18 @@ brew install orbstack
|
|||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
|
||||||
## 开始部署
|
## 开始部署
|
||||||
|
|
||||||
### 1. 下载 docker-compose.yml
|
### 1. 下载 docker-compose.yml
|
||||||
|
|
||||||
|
非 Linux 环境或无法访问外网环境,可手动创建一个目录,并下载配置文件和对应版本的`docker-compose.yml`,在这个文件夹中依据下载的配置文件运行docker,若作为本地开发使用推荐`docker-compose-pgvector`版本,并且自行拉取并运行`sandbox`和`fastgpt`,并在docker配置文件中注释掉`sandbox`和`fastgpt`的部分
|
||||||
非 Linux 环境或无法访问外网环境,可手动创建一个目录,并下载配置文件和对应版本的`docker-compose.yml`
|
|
||||||
|
|
||||||
- [config.json](https://github.com/labring/FastGPT/blob/main/projects/app/data/config.json)
|
- [config.json](https://github.com/labring/FastGPT/blob/main/projects/app/data/config.json)
|
||||||
- [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/files/docker) (注意,不同向量库版本的文件不一样)
|
- [docker-compose.yml](https://github.com/labring/FastGPT/blob/main/files/docker) (注意,不同向量库版本的文件不一样)
|
||||||
|
|
||||||
{{% alert icon="🤖" context="success" %}}
|
{{% alert icon="🤖" context="success" %}}
|
||||||
|
|
||||||
所有 `docker-compose.yml` 配置文件中 `MongoDB` 为 5.x,需要用到AUX指令集,部分 CPU 不支持,需手动更改其镜像版本为 4.4.24**(需要自己在docker hub下载,阿里云镜像没做备份)
|
所有 `docker-compose.yml` 配置文件中 `MongoDB` 为 5.x,需要用到AVX指令集,部分 CPU 不支持,需手动更改其镜像版本为 4.4.24**(需要自己在docker hub下载,阿里云镜像没做备份)
|
||||||
|
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
@@ -271,7 +268,6 @@ rs.status()
|
|||||||
|
|
||||||
默认是写了OneAPi的连接地址和密钥,可以通过修改`docker-compose.yml`中,fastgpt容器的环境变量实现。
|
默认是写了OneAPi的连接地址和密钥,可以通过修改`docker-compose.yml`中,fastgpt容器的环境变量实现。
|
||||||
|
|
||||||
|
|
||||||
`OPENAI_BASE_URL`(API 接口的地址,需要加/v1)
|
`OPENAI_BASE_URL`(API 接口的地址,需要加/v1)
|
||||||
`CHAT_API_KEY`(API 接口的凭证)。
|
`CHAT_API_KEY`(API 接口的凭证)。
|
||||||
|
|
||||||
@@ -315,8 +311,7 @@ docker-compose up -d
|
|||||||
1. `docker exec -it fastgpt sh` 进入 FastGPT 容器。
|
1. `docker exec -it fastgpt sh` 进入 FastGPT 容器。
|
||||||
2. 直接输入`env`命令查看所有环境变量。
|
2. 直接输入`env`命令查看所有环境变量。
|
||||||
|
|
||||||
|
### 为什么无法连接`本地模型`镜像
|
||||||
### 为什么无法连接`本地模型`镜像。
|
|
||||||
|
|
||||||
`docker-compose.yml`中使用了桥接的模式建立了`fastgpt`网络,如想通过0.0.0.0或镜像名访问其它镜像,需将其它镜像也加入到网络中。
|
`docker-compose.yml`中使用了桥接的模式建立了`fastgpt`网络,如想通过0.0.0.0或镜像名访问其它镜像,需将其它镜像也加入到网络中。
|
||||||
|
|
||||||
@@ -368,9 +363,9 @@ mongo连接失败,查看mongo的运行状态**对应日志**。
|
|||||||
|
|
||||||
由于服务初始化错误,系统重启导致。
|
由于服务初始化错误,系统重启导致。
|
||||||
|
|
||||||
* 90%是由于配置文件写不对,导致 JSON 解析报错
|
- 90%是由于配置文件写不对,导致 JSON 解析报错
|
||||||
* 剩下的基本是因为向量数据库连不上
|
- 剩下的基本是因为向量数据库连不上
|
||||||
|
|
||||||
### 如何修改密码
|
### 如何修改密码
|
||||||
|
|
||||||
修改`docker-compose.yml`文件中`DEFAULT_ROOT_PSW`并重启即可,密码会自动更新。
|
修改`docker-compose.yml`文件中`DEFAULT_ROOT_PSW`并重启即可,密码会自动更新。
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ toc: true
|
|||||||
weight: 705
|
weight: 705
|
||||||
---
|
---
|
||||||
|
|
||||||
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://fastgpt.in)。
|
本文档介绍了如何设置开发环境以构建和测试 [FastGPT](https://fastgpt.in),。
|
||||||
|
|
||||||
|
|
||||||
## 前置依赖项
|
## 前置依赖项
|
||||||
|
|
||||||
@@ -16,13 +15,14 @@ weight: 705
|
|||||||
|
|
||||||
- [Git](http://git-scm.com/)
|
- [Git](http://git-scm.com/)
|
||||||
- [Docker](https://www.docker.com/)(构建镜像)
|
- [Docker](https://www.docker.com/)(构建镜像)
|
||||||
- [Node.js v18.17 / v20.x](http://nodejs.org)
|
- [Node.js v18.17 / v20.x](http://nodejs.org)(版本尽量一样,可以使用nvm管理node版本)
|
||||||
- [pnpm](https://pnpm.io/) 版本 8.6.0 (目前官方的开发环境)
|
- [pnpm](https://pnpm.io/) 版本 8.6.0 (目前官方的开发环境)
|
||||||
- make命令: 根据不同平台,百度安装 (官方是GNU Make 4.3)
|
- make命令: 根据不同平台,百度安装 (官方是GNU Make 4.3)
|
||||||
|
|
||||||
## 开始本地开发
|
## 开始本地开发
|
||||||
|
|
||||||
{{% alert context="success" %}}
|
{{% alert context="success" %}}
|
||||||
|
|
||||||
1. 用户默认的时区为 `Asia/Shanghai`,非 linux 环境时候,获取系统时间会异常,本地开发时候,可以将用户的时区调整成 UTC(+0)。
|
1. 用户默认的时区为 `Asia/Shanghai`,非 linux 环境时候,获取系统时间会异常,本地开发时候,可以将用户的时区调整成 UTC(+0)。
|
||||||
2. 建议先服务器装好**数据库**,再进行本地开发。
|
2. 建议先服务器装好**数据库**,再进行本地开发。
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
@@ -47,9 +47,10 @@ git clone git@github.com:<github_username>/FastGPT.git
|
|||||||
|
|
||||||
### 3. 安装数据库
|
### 3. 安装数据库
|
||||||
|
|
||||||
第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践。数据库部署教程:[Docker 快速部署](/docs/development/docker/)。部署完了,可以本地访问其数据库。
|
第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践,或者新建文件夹并配置相关文件用以运行docker。数据库部署教程:[Docker 快速部署](/docs/development/docker/)。部署完了,可以本地访问其数据库。
|
||||||
|
{{% alert context="warning" %}}
|
||||||
Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnection=true` 参数,才能连接上副本集的数据库。
|
Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnection=true` 参数,才能连接上副本集的数据库。
|
||||||
|
{{% /alert %}}
|
||||||
|
|
||||||
### 4. 初始配置
|
### 4. 初始配置
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnec
|
|||||||
|
|
||||||
**1. 环境变量**
|
**1. 环境变量**
|
||||||
|
|
||||||
复制`.env.template`文件,在同级目录下生成一个`.env.local` 文件,修改`.env.local` 里内容才是有效的变量。变量说明见 .env.template
|
复制`.env.template`文件,在同级目录下生成一个`.env.local` 文件,修改`.env.local` 里内容才是有效的变量。变量说明见 .env.template,主要需要修改`API_KEY`和数据库的地址与端口以及数据库账号的用户名和密码,具体配置需要和docker配置文件相同,其中用户名和密码如需修改需要修改docker配置文件、数据库和`.env.local`文件,不能只改一处。
|
||||||
|
|
||||||
**2. config 配置文件**
|
**2. config 配置文件**
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnec
|
|||||||
|
|
||||||
### 5. 运行
|
### 5. 运行
|
||||||
|
|
||||||
可参考项目根目录下的 `dev.md`
|
可参考项目根目录下的 `dev.md`,第一次编译运行可能会有点慢,需要点耐心哦
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 给自动化脚本代码执行权限(非 linux 系统, 可以手动执行里面的 postinstall.sh 文件内容)
|
# 给自动化脚本代码执行权限(非 linux 系统, 可以手动执行里面的 postinstall.sh 文件内容)
|
||||||
@@ -114,7 +115,6 @@ make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8
|
|||||||
|
|
||||||
如果遇到问题,比如合并冲突或不知道如何打开拉取请求,请查看 GitHub 的[拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests),了解如何解决合并冲突和其他问题。一旦您的 PR 被合并,您将自豪地被列为[贡献者表](https://github.com/labring/FastGPT/graphs/contributors)中的一员。
|
如果遇到问题,比如合并冲突或不知道如何打开拉取请求,请查看 GitHub 的[拉取请求教程](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests),了解如何解决合并冲突和其他问题。一旦您的 PR 被合并,您将自豪地被列为[贡献者表](https://github.com/labring/FastGPT/graphs/contributors)中的一员。
|
||||||
|
|
||||||
|
|
||||||
## QA
|
## QA
|
||||||
|
|
||||||
### 本地数据库无法连接
|
### 本地数据库无法连接
|
||||||
@@ -130,6 +130,7 @@ make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8
|
|||||||
FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI`的`Type`。如果没有权限,可以先执行`chmod -R +x ./scripts/`,再执行`pnpm i`。
|
FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI`的`Type`。如果没有权限,可以先执行`chmod -R +x ./scripts/`,再执行`pnpm i`。
|
||||||
|
|
||||||
仍不可行的话,可以手动执行`./scripts/postinstall.sh`里的内容。
|
仍不可行的话,可以手动执行`./scripts/postinstall.sh`里的内容。
|
||||||
|
*如果是Windows下的话,可以使用git bash给`postinstall`脚本添加执行权限并执行sh脚本*
|
||||||
|
|
||||||
### TypeError: Cannot read properties of null (reading 'useMemo' )
|
### TypeError: Cannot read properties of null (reading 'useMemo' )
|
||||||
|
|
||||||
@@ -141,6 +142,9 @@ FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI
|
|||||||
4. `cd projects/app`
|
4. `cd projects/app`
|
||||||
5. `pnpm dev`
|
5. `pnpm dev`
|
||||||
|
|
||||||
|
### Error response from daemon: error while creating mount source path 'XXX': mkdir XXX: file exists
|
||||||
|
|
||||||
|
这个错误可能是之前停止容器时有文件残留导致的,首先需要确认相关镜像都全部关闭,然后手动删除相关文件或者重启docker即可
|
||||||
|
|
||||||
## 加入社区
|
## 加入社区
|
||||||
|
|
||||||
@@ -155,6 +159,7 @@ FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI
|
|||||||
FastGPT 使用了 nextjs 的 page route 作为框架。为了区分好前后端代码,在目录分配上会分成 global, service, web 3个自目录,分别对应着 `前后端共用`、`后端专用`、`前端专用`的代码。
|
FastGPT 使用了 nextjs 的 page route 作为框架。为了区分好前后端代码,在目录分配上会分成 global, service, web 3个自目录,分别对应着 `前后端共用`、`后端专用`、`前端专用`的代码。
|
||||||
|
|
||||||
### monorepo
|
### monorepo
|
||||||
|
|
||||||
FastGPT 采用 pnpm workspace 方式构建 monorepo 项目,主要分为两个部分:
|
FastGPT 采用 pnpm workspace 方式构建 monorepo 项目,主要分为两个部分:
|
||||||
|
|
||||||
- projects/app - FastGPT 主项目
|
- projects/app - FastGPT 主项目
|
||||||
@@ -173,6 +178,7 @@ support - 支撑功能(用户体系,计费,鉴权等)
|
|||||||
common - 基础功能(日志管理,文件读写等)
|
common - 基础功能(日志管理,文件读写等)
|
||||||
|
|
||||||
{{% details title="代码结构说明" closed="true" %}}
|
{{% details title="代码结构说明" closed="true" %}}
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── .github // github 相关配置
|
├── .github // github 相关配置
|
||||||
@@ -200,4 +206,5 @@ common - 基础功能(日志管理,文件读写等)
|
|||||||
├── README_ja.md
|
├── README_ja.md
|
||||||
├── dev.md
|
├── dev.md
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /details %}}
|
{{% /details %}}
|
||||||
|
|||||||
@@ -7,18 +7,22 @@ toc: true
|
|||||||
weight: 852
|
weight: 852
|
||||||
---
|
---
|
||||||
|
|
||||||
## 发起对话
|
|
||||||
|
|
||||||
{{% alert icon="🤖 " context="success" %}}
|
{{% alert icon="🤖 " context="success" %}}
|
||||||
该接口的 API Key 需使用`应用特定的 key`,否则会报错。
|
该接口的 API Key 需使用`应用特定的 key`,否则会报错。
|
||||||
|
|
||||||
有些包调用时,`BaseUrl`需要添加`v1`路径,有些不需要,如果出现404情况,可补充`v1`重试。
|
有些包调用时,`BaseUrl`需要添加`v1`路径,有些不需要,如果出现404情况,可补充`v1`重试。
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
|
## 发起对话(简易应用和工作流)
|
||||||
|
|
||||||
**对话接口兼容`GPT`的接口!如果你的项目使用的是标准的`GPT`官方接口,可以直接通过修改`BaseUrl`和 `Authorization`来访问 FastGpt 应用。**
|
对话接口兼容`GPT`的接口!如果你的项目使用的是标准的`GPT`官方接口,可以直接通过修改`BaseUrl`和 `Authorization`来访问 FastGpt 应用,不过需要注意下面几个规则:
|
||||||
|
|
||||||
## 请求
|
{{% alert icon="🤖 " context="success" %}}
|
||||||
|
* 传入的`model`,`temperature`等参数字段均无效,这些字段由编排决定。
|
||||||
|
* 不会返回实际消耗`Token`值,如果需要,可以设置`detail=true`,并手动计算 `responseData` 里的`tokens`值。
|
||||||
|
{{% /alert %}}
|
||||||
|
|
||||||
|
### 请求
|
||||||
|
|
||||||
{{< tabs tabTotal="2" >}}
|
{{< tabs tabTotal="2" >}}
|
||||||
{{< tab tabName="请求示例" >}}
|
{{< tab tabName="请求示例" >}}
|
||||||
@@ -67,7 +71,7 @@ curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions'
|
|||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
## 响应
|
### 响应
|
||||||
|
|
||||||
{{< tabs tabTotal="5" >}}
|
{{< tabs tabTotal="5" >}}
|
||||||
{{< tab tabName="detail=false,stream=false 响应" >}}
|
{{< tab tabName="detail=false,stream=false 响应" >}}
|
||||||
@@ -245,7 +249,7 @@ data: [{"moduleName":"知识库搜索","moduleType":"datasetSearchNode","running
|
|||||||
{{< /markdownify >}}
|
{{< /markdownify >}}
|
||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
|
|
||||||
{{< tab tabName="detail=true,stream=true 时,event值" >}}
|
{{< tab tabName="event值" >}}
|
||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
event取值:
|
event取值:
|
||||||
@@ -265,6 +269,192 @@ event取值:
|
|||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 请求插件
|
||||||
|
|
||||||
|
插件的接口与对话接口一致,仅请求参数略有区别,有以下规定:
|
||||||
|
|
||||||
|
* 调用插件类型的应用时,接口默认为`detail`模式。
|
||||||
|
* 无需传入 `chatId`,因为插件只能运行一轮。
|
||||||
|
* 无需传入`messages`。
|
||||||
|
* 通过传递`variables`来代表插件的输入。
|
||||||
|
* 通过获取`pluginData`来获取插件输出。
|
||||||
|
|
||||||
|
### 请求示例
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \
|
||||||
|
--header 'Authorization: Bearer test-xxxxx' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"stream": false,
|
||||||
|
"chatId": "test",
|
||||||
|
"variables": {
|
||||||
|
"query":"你好" # 我的插件输入有一个参数,变量名叫 query
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 响应示例
|
||||||
|
|
||||||
|
{{< tabs tabTotal="3" >}}
|
||||||
|
|
||||||
|
{{< tab tabName="detail=true,stream=false 响应" >}}
|
||||||
|
{{< markdownify >}}
|
||||||
|
|
||||||
|
* 插件的输出可以通过查找`responseData`中, `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。
|
||||||
|
* 流输出,仍可以通过`choices`进行获取。
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"responseData": [
|
||||||
|
{
|
||||||
|
"nodeId": "fdDgXQ6SYn8v",
|
||||||
|
"moduleName": "AI 对话",
|
||||||
|
"moduleType": "chatNode",
|
||||||
|
"totalPoints": 0.685,
|
||||||
|
"model": "FastAI-3.5",
|
||||||
|
"tokens": 685,
|
||||||
|
"query": "你好",
|
||||||
|
"maxToken": 2000,
|
||||||
|
"historyPreview": [
|
||||||
|
{
|
||||||
|
"obj": "Human",
|
||||||
|
"value": "你好"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"obj": "AI",
|
||||||
|
"value": "你好!有什么可以帮助你的吗?欢迎向我提问。"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"contextTotalLen": 14,
|
||||||
|
"runningTime": 1.73
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nodeId": "pluginOutput",
|
||||||
|
"moduleName": "自定义插件输出",
|
||||||
|
"moduleType": "pluginOutput",
|
||||||
|
"totalPoints": 0,
|
||||||
|
"pluginOutput": {
|
||||||
|
"result": "你好!有什么可以帮助你的吗?欢迎向我提问。"
|
||||||
|
},
|
||||||
|
"runningTime": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"newVariables": {
|
||||||
|
"query": "你好"
|
||||||
|
},
|
||||||
|
"id": "safsafsa",
|
||||||
|
"model": "",
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": 1,
|
||||||
|
"completion_tokens": 1,
|
||||||
|
"total_tokens": 1
|
||||||
|
},
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "你好!有什么可以帮助你的吗?欢迎向我提问。"
|
||||||
|
},
|
||||||
|
"finish_reason": "stop",
|
||||||
|
"index": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /markdownify >}}
|
||||||
|
{{< /tab >}}
|
||||||
|
|
||||||
|
|
||||||
|
{{< tab tabName="detail=true,stream=true 响应" >}}
|
||||||
|
{{< markdownify >}}
|
||||||
|
|
||||||
|
* 插件的输出可以通过获取`event=flowResponses`中的字符串,并将其反序列化后得到一个数组。同样的,查找 `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。
|
||||||
|
* 流输出,仍和对话接口一样获取。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
event: flowNodeStatus
|
||||||
|
data: {"status":"running","name":"AI 对话"}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"好"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"!"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"有"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"什"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"么"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"可以"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"帮"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"助"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"的"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"吗"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"?"},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":""},"index":0,"finish_reason":null}]}
|
||||||
|
|
||||||
|
event: answer
|
||||||
|
data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
|
||||||
|
|
||||||
|
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}]
|
||||||
|
```
|
||||||
|
|
||||||
|
{{< /markdownify >}}
|
||||||
|
{{< /tab >}}
|
||||||
|
|
||||||
|
{{< tab tabName="输出获取" >}}
|
||||||
|
{{< markdownify >}}
|
||||||
|
|
||||||
|
event取值:
|
||||||
|
|
||||||
|
- answer: 返回给客户端的文本(最终会算作回答)
|
||||||
|
- fastAnswer: 指定回复返回给客户端的文本(最终会算作回答)
|
||||||
|
- toolCall: 执行工具
|
||||||
|
- toolParams: 工具参数
|
||||||
|
- toolResponse: 工具返回
|
||||||
|
- flowNodeStatus: 运行到的节点状态
|
||||||
|
- flowResponses: 节点完整响应
|
||||||
|
- updateVariables: 更新变量
|
||||||
|
- error: 报错
|
||||||
|
|
||||||
|
{{< /markdownify >}}
|
||||||
|
{{< /tab >}}
|
||||||
|
{{< /tabs >}}
|
||||||
|
|
||||||
## 使用案例
|
## 使用案例
|
||||||
|
|
||||||
- [接入 NextWeb/ChatGPT web 等应用](/docs/use-cases/openapi)
|
- [接入 NextWeb/ChatGPT web 等应用](/docs/use-cases/openapi)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ weight: 853
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 创建训练订单(4.6.9地址发生改动)
|
## 创建训练订单
|
||||||
|
|
||||||
{{< tabs tabTotal="2" >}}
|
{{< tabs tabTotal="2" >}}
|
||||||
{{< tab tabName="请求示例" >}}
|
{{< tab tabName="请求示例" >}}
|
||||||
@@ -26,6 +26,7 @@ curl --location --request POST 'https://api.fastgpt.in/api/support/wallet/usage/
|
|||||||
--header 'Authorization: Bearer {{apikey}}' \
|
--header 'Authorization: Bearer {{apikey}}' \
|
||||||
--header 'Content-Type: application/json' \
|
--header 'Content-Type: application/json' \
|
||||||
--data-raw '{
|
--data-raw '{
|
||||||
|
"datasetId": "知识库 ID",
|
||||||
"name": "可选,自定义订单名称,例如:文档训练-fastgpt.docx"
|
"name": "可选,自定义订单名称,例如:文档训练-fastgpt.docx"
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
@@ -127,8 +128,12 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \
|
|||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --location --request GET 'http://localhost:3000/api/core/dataset/list?parentId=' \
|
curl --location --request POST 'http://localhost:3000/api/core/dataset/list?parentId=' \
|
||||||
--header 'Authorization: Bearer {{authorization}}' \
|
--header 'Authorization: Bearer xxxx' \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data-raw '{
|
||||||
|
"parentId":""
|
||||||
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
{{< /markdownify >}}
|
{{< /markdownify >}}
|
||||||
@@ -138,7 +143,7 @@ curl --location --request GET 'http://localhost:3000/api/core/dataset/list?paren
|
|||||||
{{< markdownify >}}
|
{{< markdownify >}}
|
||||||
|
|
||||||
{{% alert icon=" " context="success" %}}
|
{{% alert icon=" " context="success" %}}
|
||||||
- parentId - 父级ID,不传或为空,代表获取根目录下的知识库
|
- parentId - 父级ID,传空字符串或者null,代表获取根目录下的知识库
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
{{< /markdownify >}}
|
{{< /markdownify >}}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ docker-compose up -d
|
|||||||
|
|
||||||
商业版用户需要执行一个初始化,格式化团队信息。
|
商业版用户需要执行一个初始化,格式化团队信息。
|
||||||
|
|
||||||
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`,{{host}} 替换成自己域名)
|
发起 1 个 HTTP 请求 ({{rootkey}} 替换成环境变量里的 `rootkey`,{{host}} 替换成商业版域名)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --location --request POST 'https://{{host}}/api/init/v468' \
|
curl --location --request POST 'https://{{host}}/api/init/v468' \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 'V4.8.4'
|
title: 'V4.8.4(需要初始化)'
|
||||||
description: 'FastGPT V4.8.4 更新说明'
|
description: 'FastGPT V4.8.4 更新说明'
|
||||||
icon: 'upgrade'
|
icon: 'upgrade'
|
||||||
draft: false
|
draft: false
|
||||||
@@ -35,4 +35,4 @@ curl --location --request POST 'https://{{host}}/api/admin/init/484' \
|
|||||||
6. 修复 - 定时执行初始化错误。
|
6. 修复 - 定时执行初始化错误。
|
||||||
7. 修复 - 应用调用传参异常。
|
7. 修复 - 应用调用传参异常。
|
||||||
8. 修复 - ctrl + cv 复杂节点时,nodeId错误。
|
8. 修复 - ctrl + cv 复杂节点时,nodeId错误。
|
||||||
9. 调整组件库全局theme。
|
9. 调整组件库全局theme。
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 'V4.8.5(进行中)'
|
title: 'V4.8.5(需要初始化)'
|
||||||
description: 'FastGPT V4.8.5 更新说明'
|
description: 'FastGPT V4.8.5 更新说明'
|
||||||
icon: 'upgrade'
|
icon: 'upgrade'
|
||||||
draft: false
|
draft: false
|
||||||
@@ -13,8 +13,8 @@ weight: 819
|
|||||||
|
|
||||||
### 2. 修改镜像
|
### 2. 修改镜像
|
||||||
|
|
||||||
- fastgpt 镜像 tag 修改成 v4.8.5-alpha
|
- fastgpt 镜像 tag 修改成 v4.8.5
|
||||||
- 商业版镜像 tag 修改成 v4.8.5 -alpha
|
- 商业版镜像 tag 修改成 v4.8.5
|
||||||
|
|
||||||
### 3. 执行初始化
|
### 3. 执行初始化
|
||||||
|
|
||||||
@@ -48,12 +48,14 @@ curl --location --request POST 'https://{{host}}/api/admin/init/485' \
|
|||||||
2. 新增 - 应用创建副本功能
|
2. 新增 - 应用创建副本功能
|
||||||
3. 新增 - 应用创建模板
|
3. 新增 - 应用创建模板
|
||||||
4. 新增 - 支持代码运行结果作为工具输出。
|
4. 新增 - 支持代码运行结果作为工具输出。
|
||||||
5. 优化 - 原文件编码存取
|
5. 新增 - Markdown 图片输出,支持移动端放大缩放。
|
||||||
6. 优化 - 文件夹读取,支持单个文件夹超出 100 个文件
|
6. 优化 - 原文件编码存取
|
||||||
7. 优化 - 问答拆分/手动录入,当有`a`字段时,自动将`q`作为补充索引。
|
7. 优化 - 知识库删除后,简易模式会过滤掉删除的知识库,避免错误判断。
|
||||||
8. 优化 - 对话框页面代码
|
8. 优化 - 文件夹读取,支持单个文件夹超出 100 个文件
|
||||||
9. 修复 - SSR渲染
|
9. 优化 - 问答拆分/手动录入,当有`a`字段时,自动将`q`作为补充索引。
|
||||||
10. 修复 - 定时任务无法实际关闭
|
10. 优化 - 对话框页面代码
|
||||||
11. 修复 - 输入引导特殊字符导致正则报错
|
11. 优化 - 工作流新节点自动增加序号名
|
||||||
12. 修复 - 文件包含特殊字符`%`,且为转义时会导致页面崩溃
|
12. 修复 - 定时任务无法实际关闭
|
||||||
13. 修复 - 自定义输入选择知识库引用时页面崩溃
|
13. 修复 - 输入引导特殊字符导致正则报错
|
||||||
|
14. 修复 - 文件包含特殊字符`%`,且为转义时会导致页面崩溃
|
||||||
|
15. 修复 - 自定义输入选择知识库引用时页面崩溃
|
||||||
|
|||||||
51
docSite/content/zh-cn/docs/development/upgrading/486.md
Normal file
51
docSite/content/zh-cn/docs/development/upgrading/486.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.8.6(需要初始化)'
|
||||||
|
description: 'FastGPT V4.8.6 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 818
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据库备份
|
||||||
|
|
||||||
|
### 2. 修改镜像
|
||||||
|
|
||||||
|
- fastgpt 镜像 tag 修改成 v4.8.6
|
||||||
|
- fastgpt-sandbox 镜像 tag 修改成 v4.8.6
|
||||||
|
- 商业版镜像 tag 修改成 v4.8.6
|
||||||
|
|
||||||
|
### 3. 执行初始化
|
||||||
|
|
||||||
|
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request POST 'https://{{host}}/api/admin/initv486' \
|
||||||
|
--header 'rootkey: {{rootkey}}' \
|
||||||
|
--header 'Content-Type: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
会初始化应用的继承权限
|
||||||
|
|
||||||
|
-------
|
||||||
|
|
||||||
|
## V4.8.6 更新说明
|
||||||
|
|
||||||
|
1. 新增 - 应用权限继承
|
||||||
|
2. 新增 - 知识库支持单个集合禁用功能
|
||||||
|
3. 新增 - 系统插件模式变更,新增链接读取和数学计算器插件,正式版会更新如何自定义系统插件
|
||||||
|
4. 新增 - 代码沙盒运行参数
|
||||||
|
5. 新增 - AI对话时隐藏头部的功能,主要是适配移动端
|
||||||
|
6. 优化 - 文件读取,Mongo 默认使用从节点,减轻主节点压力
|
||||||
|
7. 优化 - 提示词模板
|
||||||
|
8. 优化 - Mongo model 重复加载
|
||||||
|
9. 修复 - 创建链接集合未返回 id
|
||||||
|
10. 修复 - 文档接口说明
|
||||||
|
11. 修复 - api system 提示合并
|
||||||
|
12. 修复 - 团队插件目录内的内容无法加载
|
||||||
|
13. 修复 - 知识库集合目录面包屑无法加载
|
||||||
|
14. 修复 - Markdown 导出对话异常
|
||||||
|
15. 修复 - 提示模板结束标签错误
|
||||||
|
16. 修复 - 文档描述
|
||||||
29
docSite/content/zh-cn/docs/development/upgrading/487.md
Normal file
29
docSite/content/zh-cn/docs/development/upgrading/487.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.8.7'
|
||||||
|
description: 'FastGPT V4.8.7 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 817
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据库备份
|
||||||
|
|
||||||
|
### 2. 修改镜像
|
||||||
|
|
||||||
|
- fastgpt 镜像 tag 修改成 v4.8.7
|
||||||
|
- 商业版镜像 tag 修改成 v4.8.7
|
||||||
|
|
||||||
|
-------
|
||||||
|
|
||||||
|
## V4.8.7 更新说明
|
||||||
|
|
||||||
|
1. 新增 - 插件支持独立运行,发布和日志查看
|
||||||
|
2. 新增 - 应用搜索
|
||||||
|
3. 优化 - 对话框代码
|
||||||
|
4. 优化 - 升级 Dockerfile node 和 pnpm 版本
|
||||||
|
5. 优化 - local 域名部署,也可以正常使用 vision 模式
|
||||||
|
6. 修复 - 简易模式无法变更全局变量
|
||||||
|
7. 修复 - gpt4o 无法同时使用工具和图片
|
||||||
49
docSite/content/zh-cn/docs/development/upgrading/488.md
Normal file
49
docSite/content/zh-cn/docs/development/upgrading/488.md
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.8.8(进行中)'
|
||||||
|
description: 'FastGPT V4.8.8 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 816
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据库备份
|
||||||
|
|
||||||
|
### 2. 修改镜像
|
||||||
|
|
||||||
|
- fastgpt 镜像 tag 修改成 v4.8.8-alpha
|
||||||
|
- 商业版镜像 tag 修改成 v4.8.8-alpha
|
||||||
|
|
||||||
|
### 3. 执行初始化
|
||||||
|
|
||||||
|
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location --request POST 'https://{{host}}/api/admin/initv488' \
|
||||||
|
--header 'rootkey: {{rootkey}}' \
|
||||||
|
--header 'Content-Type: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
会初始化知识库的继承权限
|
||||||
|
|
||||||
|
-------
|
||||||
|
|
||||||
|
## V4.8.8 更新说明
|
||||||
|
|
||||||
|
1. 新增 - 重构系统插件的结构。允许向开源社区 PR 系统插件,具体可见: [如何向 FastGPT 社区提交系统插件](https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh)。
|
||||||
|
2. 新增 - DuckDuckGo 系统插件。
|
||||||
|
3. 新增 - 飞书 webhook 系统插件。
|
||||||
|
4. 新增 - 修改变量填写方式。提示词输入框以以及工作流中所有 Textarea 输入框,支持输入 / 唤起变量选择,可直接选择所有上游输出值,无需动态引入。
|
||||||
|
5. 商业版新增 - 知识库权限继承。
|
||||||
|
6. 优化 - 移动端快速切换应用交互。
|
||||||
|
7. 优化 - 节点图标。
|
||||||
|
8. 优化 - 对话框引用增加额外复制案件,便于复制。增加引用内容折叠。
|
||||||
|
9. 优化 - OpenAI sdk 升级,并自定义了 whisper 模型接口(未仔细查看 sdk 实现,但 sdk 中 whisper 接口,似乎无法适配一般 fastapi 接口)
|
||||||
|
10. 修复 - Permission 表声明问题。
|
||||||
|
11. 修复 - 并行执行节点,运行时间未正确记录。
|
||||||
|
12. 修复 - 运行详情未正确展示嵌套节点信息。
|
||||||
|
13. 修复 - 简易模式,首次进入,无法正确获取知识库配置。
|
||||||
|
14. 修复 - Log debug level 配置无效。
|
||||||
|
15. 修复 - 插件独立运行时,会将插件输入的值进行变量替换,可能导致后续节点变量异常。
|
||||||
@@ -78,7 +78,7 @@ weight: 404
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nodeId": "u6IAOEssxoZT",
|
"nodeId": "u6IAOEssxoZT",
|
||||||
"name": "工具调用(实验)",
|
"name": "工具调用",
|
||||||
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
||||||
"avatar": "/imgs/workflow/tool.svg",
|
"avatar": "/imgs/workflow/tool.svg",
|
||||||
"flowNodeType": "tools",
|
"flowNodeType": "tools",
|
||||||
@@ -201,7 +201,7 @@ weight: 404
|
|||||||
"x": 1623.9214305901633,
|
"x": 1623.9214305901633,
|
||||||
"y": 22.777089001645862
|
"y": 22.777089001645862
|
||||||
},
|
},
|
||||||
"version": "481",
|
"version": "486",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"key": "system_addInputParam",
|
"key": "system_addInputParam",
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export default async function (ctx: FunctionContext) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nodeId": "NOgbnBzUwDgT",
|
"nodeId": "NOgbnBzUwDgT",
|
||||||
"name": "工具调用(实验)",
|
"name": "工具调用",
|
||||||
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
||||||
"avatar": "/imgs/workflow/tool.svg",
|
"avatar": "/imgs/workflow/tool.svg",
|
||||||
"flowNodeType": "tools",
|
"flowNodeType": "tools",
|
||||||
|
|||||||
@@ -436,7 +436,7 @@ HTTP模块中,需要设置 3 个工具参数:
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nodeId": "fYxwWym8flYL",
|
"nodeId": "fYxwWym8flYL",
|
||||||
"name": "工具调用(实验)",
|
"name": "工具调用",
|
||||||
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
|
||||||
"avatar": "/imgs/workflow/tool.svg",
|
"avatar": "/imgs/workflow/tool.svg",
|
||||||
"flowNodeType": "tools",
|
"flowNodeType": "tools",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ enableEmoji = true
|
|||||||
enableGitInfo = false # N.B. .GitInfo does not currently function with git submodule content directories
|
enableGitInfo = false # N.B. .GitInfo does not currently function with git submodule content directories
|
||||||
|
|
||||||
defaultContentLanguage = 'zh-cn'
|
defaultContentLanguage = 'zh-cn'
|
||||||
|
defaultContentLanguageInSubdir = false
|
||||||
[languages]
|
[languages]
|
||||||
[languages.zh-cn]
|
[languages.zh-cn]
|
||||||
title = "FastGPT"
|
title = "FastGPT"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- change -->
|
<!-- change -->
|
||||||
{{ $repoURL = $repoURL | append "docSite/content" .Site.LanguagePrefix $filePath }}
|
{{ $repoURL = $repoURL | append "docSite/content" .Site.Language.Lang $filePath }}
|
||||||
{{ $repoURL = delimit $repoURL "/" }}
|
{{ $repoURL = delimit $repoURL "/" }}
|
||||||
{{ $editPageURL := replaceRE "(https?://)|(/)+" "$1$2" $repoURL }}
|
{{ $editPageURL := replaceRE "(https?://)|(/)+" "$1$2" $repoURL }}
|
||||||
|
|
||||||
|
|||||||
@@ -114,15 +114,15 @@ services:
|
|||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt-sandbox:latest # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:latest # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt:v4.8.7 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.7 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -156,6 +156,7 @@ services:
|
|||||||
- SANDBOX_URL=http://sandbox:3000
|
- SANDBOX_URL=http://sandbox:3000
|
||||||
# 日志等级: debug, info, warn, error
|
# 日志等级: debug, info, warn, error
|
||||||
- LOG_LEVEL=info
|
- LOG_LEVEL=info
|
||||||
|
- STORE_LOG_LEVEL=warn
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/data/config.json
|
- ./config.json:/app/data/config.json
|
||||||
|
|
||||||
@@ -178,7 +179,8 @@ services:
|
|||||||
- ./mysql:/var/lib/mysql
|
- ./mysql:/var/lib/mysql
|
||||||
oneapi:
|
oneapi:
|
||||||
container_name: oneapi
|
container_name: oneapi
|
||||||
image: ghcr.io/songquanpeng/one-api:latest
|
image: ghcr.io/songquanpeng/one-api:0.6.7
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3001:3000
|
- 3001:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ services:
|
|||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt-sandbox:latest # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:latest # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt:v4.8.7 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.7 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -113,13 +113,14 @@ services:
|
|||||||
- SANDBOX_URL=http://sandbox:3000
|
- SANDBOX_URL=http://sandbox:3000
|
||||||
# 日志等级: debug, info, warn, error
|
# 日志等级: debug, info, warn, error
|
||||||
- LOG_LEVEL=info
|
- LOG_LEVEL=info
|
||||||
|
- STORE_LOG_LEVEL=warn
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/data/config.json
|
- ./config.json:/app/data/config.json
|
||||||
|
|
||||||
# oneapi
|
# oneapi
|
||||||
mysql:
|
mysql:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mysql:8.0.36 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mysql:8.0.36 # 阿里云
|
||||||
# image: mysql:8.0.36
|
image: mysql:8.0.36
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
@@ -135,7 +136,8 @@ services:
|
|||||||
- ./mysql:/var/lib/mysql
|
- ./mysql:/var/lib/mysql
|
||||||
oneapi:
|
oneapi:
|
||||||
container_name: oneapi
|
container_name: oneapi
|
||||||
image: ghcr.io/songquanpeng/one-api:latest
|
image: ghcr.io/songquanpeng/one-api:0.6.7
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3001:3000
|
- 3001:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -53,15 +53,15 @@ services:
|
|||||||
wait $$!
|
wait $$!
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt-sandbox:latest # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:latest # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.8.4 # git
|
image: ghcr.io/labring/fastgpt:v4.8.7 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.4 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.7 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -94,6 +94,7 @@ services:
|
|||||||
- SANDBOX_URL=http://sandbox:3000
|
- SANDBOX_URL=http://sandbox:3000
|
||||||
# 日志等级: debug, info, warn, error
|
# 日志等级: debug, info, warn, error
|
||||||
- LOG_LEVEL=info
|
- LOG_LEVEL=info
|
||||||
|
- STORE_LOG_LEVEL=warn
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/data/config.json
|
- ./config.json:/app/data/config.json
|
||||||
|
|
||||||
@@ -116,7 +117,8 @@ services:
|
|||||||
- ./mysql:/var/lib/mysql
|
- ./mysql:/var/lib/mysql
|
||||||
oneapi:
|
oneapi:
|
||||||
container_name: oneapi
|
container_name: oneapi
|
||||||
image: ghcr.io/songquanpeng/one-api:latest
|
image: ghcr.io/songquanpeng/one-api:0.6.7
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/one-api:v0.6.6 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3001:3000
|
- 3001:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
15
package.json
15
package.json
@@ -9,16 +9,17 @@
|
|||||||
"gen:theme-typings": "chakra-cli tokens packages/web/styles/theme.ts --out node_modules/.pnpm/node_modules/@chakra-ui/styled-system/dist/theming.types.d.ts",
|
"gen:theme-typings": "chakra-cli tokens packages/web/styles/theme.ts --out node_modules/.pnpm/node_modules/@chakra-ui/styled-system/dist/theming.types.d.ts",
|
||||||
"postinstall": "sh ./scripts/postinstall.sh",
|
"postinstall": "sh ./scripts/postinstall.sh",
|
||||||
"initIcon": "node ./scripts/icon/init.js",
|
"initIcon": "node ./scripts/icon/init.js",
|
||||||
"previewIcon": "node ./scripts/icon/index.js"
|
"previewIcon": "node ./scripts/icon/index.js",
|
||||||
|
"checkI18n": "node ./scripts/i18n/delete-unused-keys.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@chakra-ui/cli": "^2.4.1",
|
"@chakra-ui/cli": "^2.4.1",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"i18next": "23.10.0",
|
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^13.3.0",
|
||||||
"next-i18next": "15.2.0",
|
"i18next": "23.11.5",
|
||||||
|
"next-i18next": "15.3.0",
|
||||||
|
"react-i18next": "14.1.2",
|
||||||
"prettier": "3.2.4",
|
"prettier": "3.2.4",
|
||||||
"react-i18next": "13.5.0",
|
|
||||||
"zhlint": "^0.7.4"
|
"zhlint": "^0.7.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
"./docSite/**/**/*.md": "npm run format-doc"
|
"./docSite/**/**/*.md": "npm run format-doc"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0",
|
"node": ">=18.16.0",
|
||||||
"pnpm": ">=8.6.0"
|
"pnpm": ">=9.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,8 @@ const startCode = 507000;
|
|||||||
export enum CommonErrEnum {
|
export enum CommonErrEnum {
|
||||||
fileNotFound = 'fileNotFound',
|
fileNotFound = 'fileNotFound',
|
||||||
unAuthFile = 'unAuthFile',
|
unAuthFile = 'unAuthFile',
|
||||||
missingParams = 'missingParams'
|
missingParams = 'missingParams',
|
||||||
|
inheritPermissionError = 'inheritPermissionError'
|
||||||
}
|
}
|
||||||
const datasetErr = [
|
const datasetErr = [
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,10 @@ const datasetErr = [
|
|||||||
{
|
{
|
||||||
statusText: CommonErrEnum.missingParams,
|
statusText: CommonErrEnum.missingParams,
|
||||||
message: 'error.missingParams'
|
message: 'error.missingParams'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: CommonErrEnum.inheritPermissionError,
|
||||||
|
message: 'error.inheritPermissionError'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export default datasetErr.reduce((acc, cur, index) => {
|
export default datasetErr.reduce((acc, cur, index) => {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ export enum DatasetErrEnum {
|
|||||||
unAuthDatasetCollection = 'unAuthDatasetCollection',
|
unAuthDatasetCollection = 'unAuthDatasetCollection',
|
||||||
unAuthDatasetData = 'unAuthDatasetData',
|
unAuthDatasetData = 'unAuthDatasetData',
|
||||||
unAuthDatasetFile = 'unAuthDatasetFile',
|
unAuthDatasetFile = 'unAuthDatasetFile',
|
||||||
|
unLinkCollection = 'unLinkCollection',
|
||||||
unLinkCollection = 'unLinkCollection'
|
invalidVectorModelOrQAModel = 'invalidVectorModelOrQAModel'
|
||||||
}
|
}
|
||||||
const datasetErr = [
|
const datasetErr = [
|
||||||
{
|
{
|
||||||
@@ -39,6 +39,10 @@ const datasetErr = [
|
|||||||
{
|
{
|
||||||
statusText: DatasetErrEnum.unLinkCollection,
|
statusText: DatasetErrEnum.unLinkCollection,
|
||||||
message: 'core.dataset.error.unLinkCollection'
|
message: 'core.dataset.error.unLinkCollection'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: DatasetErrEnum.invalidVectorModelOrQAModel,
|
||||||
|
message: 'core.dataset.error.invalidVectorModelOrQAModel'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export default datasetErr.reduce((acc, cur, index) => {
|
export default datasetErr.reduce((acc, cur, index) => {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { ErrType } from '../errorCode';
|
|||||||
/* dataset: 506000 */
|
/* dataset: 506000 */
|
||||||
export enum OpenApiErrEnum {
|
export enum OpenApiErrEnum {
|
||||||
unExist = 'openapiUnExist',
|
unExist = 'openapiUnExist',
|
||||||
unAuth = 'openapiUnAuth'
|
unAuth = 'openapiUnAuth',
|
||||||
|
exceedLimit = 'openapiExceedLimit'
|
||||||
}
|
}
|
||||||
const errList = [
|
const errList = [
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,10 @@ const errList = [
|
|||||||
{
|
{
|
||||||
statusText: OpenApiErrEnum.unAuth,
|
statusText: OpenApiErrEnum.unAuth,
|
||||||
message: '无权操作该 Api Key'
|
message: '无权操作该 Api Key'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
statusText: OpenApiErrEnum.exceedLimit,
|
||||||
|
message: '最多 10 组 API 密钥'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export default errList.reduce((acc, cur, index) => {
|
export default errList.reduce((acc, cur, index) => {
|
||||||
|
|||||||
1
packages/global/common/file/image/type.d.ts
vendored
1
packages/global/common/file/image/type.d.ts
vendored
@@ -9,6 +9,7 @@ export type MongoImageSchemaType = {
|
|||||||
type: `${MongoImageTypeEnum}`;
|
type: `${MongoImageTypeEnum}`;
|
||||||
|
|
||||||
metadata?: {
|
metadata?: {
|
||||||
|
mime?: string; // image mime type.
|
||||||
relatedId?: string; // This id is associated with a set of images
|
relatedId?: string; // This id is associated with a set of images
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCustomSteep = checkIsCustomStep(step);
|
const isCustomStep = checkIsCustomStep(step);
|
||||||
const isMarkdownSplit = checkIsMarkdownSplit(step);
|
const isMarkdownSplit = checkIsMarkdownSplit(step);
|
||||||
const independentChunk = checkIndependentChunk(step);
|
const independentChunk = checkIndependentChunk(step);
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ const commonSplit = (props: SplitProps): SplitResponse => {
|
|||||||
.replace(
|
.replace(
|
||||||
reg,
|
reg,
|
||||||
(() => {
|
(() => {
|
||||||
if (isCustomSteep) return splitMarker;
|
if (isCustomStep) return splitMarker;
|
||||||
if (independentChunk) return `${splitMarker}$1`;
|
if (independentChunk) return `${splitMarker}$1`;
|
||||||
return `$1${splitMarker}`;
|
return `$1${splitMarker}`;
|
||||||
})()
|
})()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import cronParser from 'cron-parser';
|
import cronParser from 'cron-parser';
|
||||||
|
|
||||||
|
export const formatTime2YMDHMW = (time?: Date) => dayjs(time).format('YYYY-MM-DD HH:mm:ss dddd');
|
||||||
export const formatTime2YMDHM = (time?: Date) =>
|
export const formatTime2YMDHM = (time?: Date) =>
|
||||||
time ? dayjs(time).format('YYYY-MM-DD HH:mm') : '';
|
time ? dayjs(time).format('YYYY-MM-DD HH:mm') : '';
|
||||||
export const formatTime2YMD = (time?: Date) => (time ? dayjs(time).format('YYYY-MM-DD') : '');
|
export const formatTime2YMD = (time?: Date) => (time ? dayjs(time).format('YYYY-MM-DD') : '');
|
||||||
|
|||||||
@@ -32,9 +32,12 @@ export type FastGPTFeConfigsType = {
|
|||||||
show_promotion?: boolean;
|
show_promotion?: boolean;
|
||||||
show_team_chat?: boolean;
|
show_team_chat?: boolean;
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
|
|
||||||
docUrl?: string;
|
docUrl?: string;
|
||||||
chatbotUrl?: string;
|
chatbotUrl?: string;
|
||||||
openAPIDocUrl?: string;
|
openAPIDocUrl?: string;
|
||||||
|
systemPluginCourseUrl?: string;
|
||||||
|
|
||||||
systemTitle?: string;
|
systemTitle?: string;
|
||||||
systemDescription?: string;
|
systemDescription?: string;
|
||||||
googleClientVerKey?: string;
|
googleClientVerKey?: string;
|
||||||
@@ -70,9 +73,3 @@ export type SystemEnvType = {
|
|||||||
oneapiUrl?: string;
|
oneapiUrl?: string;
|
||||||
chatApiKey?: string;
|
chatApiKey?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// declare global {
|
|
||||||
// var feConfigs: FastGPTFeConfigsType;
|
|
||||||
// var systemEnv: SystemEnvType;
|
|
||||||
// var systemInitd: boolean;
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import type { LLMModelItemType, VectorModelItemType } from './model.d';
|
|||||||
|
|
||||||
export const defaultQAModels: LLMModelItemType[] = [
|
export const defaultQAModels: LLMModelItemType[] = [
|
||||||
{
|
{
|
||||||
model: 'gpt-3.5-turbo',
|
model: 'gpt-4o-mini',
|
||||||
name: 'gpt-3.5-turbo',
|
name: 'gpt-4o-mini',
|
||||||
maxContext: 16000,
|
maxContext: 16000,
|
||||||
maxResponse: 16000,
|
maxResponse: 16000,
|
||||||
quoteMaxToken: 13000,
|
quoteMaxToken: 13000,
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
|||||||
|
|
||||||
<QA>
|
<QA>
|
||||||
{{quote}}
|
{{quote}}
|
||||||
</QA>}
|
</QA>
|
||||||
|
|
||||||
思考流程:
|
思考流程:
|
||||||
1. 判断问题是否与 <QA></QA> 标记中的内容有关。
|
1. 判断问题是否与 <QA></QA> 标记中的内容有关。
|
||||||
@@ -109,7 +109,12 @@ export const Prompt_QuotePromptList: PromptTemplateItem[] = [
|
|||||||
4. 如果有相同的问题,直接输出对应答案。
|
4. 如果有相同的问题,直接输出对应答案。
|
||||||
5. 如果只有相近的问题,请把相近的问题和答案一起输出。
|
5. 如果只有相近的问题,请把相近的问题和答案一起输出。
|
||||||
|
|
||||||
最后,避免提及你是从 QA 获取的知识,只需要回复答案。
|
回答要求:
|
||||||
|
- 如果没有相关的问答对,你需要澄清。
|
||||||
|
- 回答的内容应尽可能与 <QA></QA> 标记中的内容一致。
|
||||||
|
- 避免提及你是从 QA 获取的知识,只需要回复答案。
|
||||||
|
- 使用 Markdown 语法优化回答格式。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
|
||||||
问题:"""{{question}}"""`
|
问题:"""{{question}}"""`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ A2:
|
|||||||
|
|
||||||
<Context>
|
<Context>
|
||||||
{{text}}
|
{{text}}
|
||||||
<Context/>
|
</Context>
|
||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export enum AppTypeEnum {
|
|||||||
httpPlugin = 'httpPlugin'
|
httpPlugin = 'httpPlugin'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const AppFolderTypeList = [AppTypeEnum.folder, AppTypeEnum.httpPlugin];
|
||||||
|
|
||||||
export const defaultTTSConfig: AppTTSConfigType = { type: 'web' };
|
export const defaultTTSConfig: AppTTSConfigType = { type: 'web' };
|
||||||
|
|
||||||
export const defaultWhisperConfig: AppWhisperConfigType = {
|
export const defaultWhisperConfig: AppWhisperConfigType = {
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import yaml from 'js-yaml';
|
|||||||
import { OpenAPIV3 } from 'openapi-types';
|
import { OpenAPIV3 } from 'openapi-types';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
|
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
||||||
import { NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||||
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
||||||
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
||||||
import { HttpModule468 } from '../../workflow/template/system/http468';
|
import { HttpNode468 } from '../../workflow/template/system/http468';
|
||||||
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
||||||
import { StoreNodeItemType } from '../../workflow/type';
|
import { StoreNodeItemType } from '../../workflow/type/node';
|
||||||
import { HttpImgUrl } from '../../../common/file/image/constants';
|
import { HttpImgUrl } from '../../../common/file/image/constants';
|
||||||
import SwaggerParser from '@apidevtools/swagger-parser';
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
||||||
import { getHandleId } from '../../workflow/utils';
|
import { getHandleId } from '../../workflow/utils';
|
||||||
@@ -116,16 +116,7 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
required: param.required,
|
required: param.required,
|
||||||
description: param.description,
|
description: param.description,
|
||||||
toolDescription: param.description,
|
toolDescription: param.description,
|
||||||
canEdit: true,
|
canEdit: true
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
name: true,
|
|
||||||
description: true,
|
|
||||||
required: true,
|
|
||||||
dataType: true,
|
|
||||||
inputType: true,
|
|
||||||
isToolInput: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}) || []),
|
}) || []),
|
||||||
...(propsKeys?.map((key) => {
|
...(propsKeys?.map((key) => {
|
||||||
@@ -138,16 +129,7 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
required: false,
|
required: false,
|
||||||
description: prop.description,
|
description: prop.description,
|
||||||
toolDescription: prop.description,
|
toolDescription: prop.description,
|
||||||
canEdit: true,
|
canEdit: true
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
name: true,
|
|
||||||
description: true,
|
|
||||||
required: true,
|
|
||||||
dataType: true,
|
|
||||||
inputType: true,
|
|
||||||
isToolInput: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}) || [])
|
}) || [])
|
||||||
];
|
];
|
||||||
@@ -186,10 +168,6 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
label: param.name,
|
label: param.name,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||||
canEdit: true,
|
canEdit: true,
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
valueType: true
|
|
||||||
},
|
|
||||||
value: [pluginInputId, inputIdMap.get(param.name)]
|
value: [pluginInputId, inputIdMap.get(param.name)]
|
||||||
};
|
};
|
||||||
}) || []),
|
}) || []),
|
||||||
@@ -200,10 +178,6 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
label: key,
|
label: key,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||||
canEdit: true,
|
canEdit: true,
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
valueType: true
|
|
||||||
},
|
|
||||||
value: [pluginInputId, inputIdMap.get(key)]
|
value: [pluginInputId, inputIdMap.get(key)]
|
||||||
};
|
};
|
||||||
}) || [])
|
}) || [])
|
||||||
@@ -271,7 +245,7 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Combine complete modules */
|
/* Combine complete modules */
|
||||||
const modules: StoreNodeItemType[] = [
|
const nodes: StoreNodeItemType[] = [
|
||||||
{
|
{
|
||||||
nodeId: pluginInputId,
|
nodeId: pluginInputId,
|
||||||
name: PluginInputModule.name,
|
name: PluginInputModule.name,
|
||||||
@@ -280,8 +254,8 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
flowNodeType: PluginInputModule.flowNodeType,
|
flowNodeType: PluginInputModule.flowNodeType,
|
||||||
showStatus: PluginInputModule.showStatus,
|
showStatus: PluginInputModule.showStatus,
|
||||||
position: {
|
position: {
|
||||||
x: 616.4226348688949,
|
x: 473.55206291900333,
|
||||||
y: -165.05298493910115
|
y: -145.65080850146154
|
||||||
},
|
},
|
||||||
version: PluginInputModule.version,
|
version: PluginInputModule.version,
|
||||||
inputs: pluginInputs,
|
inputs: pluginInputs,
|
||||||
@@ -295,8 +269,8 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
flowNodeType: PluginOutputModule.flowNodeType,
|
flowNodeType: PluginOutputModule.flowNodeType,
|
||||||
showStatus: PluginOutputModule.showStatus,
|
showStatus: PluginOutputModule.showStatus,
|
||||||
position: {
|
position: {
|
||||||
x: 1607.7142331269126,
|
x: 1847.5956872650024,
|
||||||
y: -151.8669210746189
|
y: 5.114324648101558
|
||||||
},
|
},
|
||||||
version: PluginOutputModule.version,
|
version: PluginOutputModule.version,
|
||||||
inputs: [
|
inputs: [
|
||||||
@@ -308,11 +282,6 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
required: false,
|
required: false,
|
||||||
description: '',
|
description: '',
|
||||||
canEdit: true,
|
canEdit: true,
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
description: true,
|
|
||||||
valueType: true
|
|
||||||
},
|
|
||||||
value: [httpId, 'httpRawResponse']
|
value: [httpId, 'httpRawResponse']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -328,29 +297,18 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
nodeId: httpId,
|
nodeId: httpId,
|
||||||
name: HttpModule468.name,
|
name: HttpNode468.name,
|
||||||
intro: HttpModule468.intro,
|
intro: HttpNode468.intro,
|
||||||
avatar: HttpModule468.avatar,
|
avatar: HttpNode468.avatar,
|
||||||
flowNodeType: HttpModule468.flowNodeType,
|
flowNodeType: HttpNode468.flowNodeType,
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
position: {
|
position: {
|
||||||
x: 1042.549746602742,
|
x: 1188.947986995841,
|
||||||
y: -447.77496332641647
|
y: -473.52694296182904
|
||||||
},
|
},
|
||||||
version: HttpModule468.version,
|
version: HttpNode468.version,
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
HttpNode468.inputs[0],
|
||||||
key: NodeInputKeyEnum.addInputParam,
|
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
|
|
||||||
valueType: WorkflowIOValueTypeEnum.dynamic,
|
|
||||||
label: '',
|
|
||||||
required: false,
|
|
||||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
valueType: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
...httpInputs,
|
...httpInputs,
|
||||||
{
|
{
|
||||||
key: 'system_httpMethod',
|
key: 'system_httpMethod',
|
||||||
@@ -397,7 +355,7 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
outputs: HttpModule468.outputs
|
outputs: HttpNode468.outputs
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -422,7 +380,7 @@ export const httpApiSchema2Plugins = async ({
|
|||||||
intro: item.description,
|
intro: item.description,
|
||||||
parentId,
|
parentId,
|
||||||
type: AppTypeEnum.plugin,
|
type: AppTypeEnum.plugin,
|
||||||
modules,
|
modules: nodes,
|
||||||
edges,
|
edges,
|
||||||
pluginData: {
|
pluginData: {
|
||||||
pluginUniId: item.name
|
pluginUniId: item.name
|
||||||
|
|||||||
10
packages/global/core/app/plugin/utils.ts
Normal file
10
packages/global/core/app/plugin/utils.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { StoreNodeItemType } from '../../workflow/type/node';
|
||||||
|
import { FlowNodeInputItemType } from '../../workflow/type/io';
|
||||||
|
import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
||||||
|
|
||||||
|
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
||||||
|
return nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)?.inputs || [];
|
||||||
|
};
|
||||||
|
export const getPluginRunContent = (e: { pluginInputs: FlowNodeInputItemType[] }) => {
|
||||||
|
return JSON.stringify(e);
|
||||||
|
};
|
||||||
13
packages/global/core/app/type.d.ts
vendored
13
packages/global/core/app/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type';
|
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { AppTypeEnum } from './constants';
|
import { AppTypeEnum } from './constants';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import { VariableInputEnum } from '../workflow/constants';
|
import { VariableInputEnum } from '../workflow/constants';
|
||||||
@@ -6,7 +6,7 @@ import { SelectedDatasetType } from '../workflow/api';
|
|||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { PermissionValueType } from '../../support/permission/type';
|
import { PermissionSchemaType, PermissionValueType } from '../../support/permission/type';
|
||||||
import { AppPermission } from '../../support/permission/app/controller';
|
import { AppPermission } from '../../support/permission/app/controller';
|
||||||
import { ParentIdType } from '../../common/parentFolder/type';
|
import { ParentIdType } from '../../common/parentFolder/type';
|
||||||
|
|
||||||
@@ -21,6 +21,7 @@ export type AppSchema = {
|
|||||||
name: string;
|
name: string;
|
||||||
avatar: string;
|
avatar: string;
|
||||||
intro: string;
|
intro: string;
|
||||||
|
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
|
|
||||||
modules: StoreNodeItemType[];
|
modules: StoreNodeItemType[];
|
||||||
@@ -39,8 +40,7 @@ export type AppSchema = {
|
|||||||
|
|
||||||
inited?: boolean;
|
inited?: boolean;
|
||||||
teamTags: string[];
|
teamTags: string[];
|
||||||
defaultPermission: PermissionValueType;
|
} & PermissionSchemaType;
|
||||||
};
|
|
||||||
|
|
||||||
export type AppListItemType = {
|
export type AppListItemType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -50,10 +50,9 @@ export type AppListItemType = {
|
|||||||
intro: string;
|
intro: string;
|
||||||
type: AppTypeEnum;
|
type: AppTypeEnum;
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
defaultPermission: PermissionValueType;
|
|
||||||
permission: AppPermission;
|
|
||||||
pluginData?: AppSchema['pluginData'];
|
pluginData?: AppSchema['pluginData'];
|
||||||
};
|
permission: AppPermission;
|
||||||
|
} & PermissionSchemaType;
|
||||||
|
|
||||||
export type AppDetailType = AppSchema & {
|
export type AppDetailType = AppSchema & {
|
||||||
permission: AppPermission;
|
permission: AppPermission;
|
||||||
|
|||||||
@@ -3,30 +3,32 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
|||||||
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
||||||
import { getAppChatConfig } from '../workflow/utils';
|
import { getAppChatConfig } from '../workflow/utils';
|
||||||
import { StoreNodeItemType } from '../workflow/type';
|
import { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
|
|
||||||
export const getDefaultAppForm = (): AppSimpleEditFormType => ({
|
export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
||||||
aiSettings: {
|
return {
|
||||||
model: 'gpt-3.5-turbo',
|
aiSettings: {
|
||||||
systemPrompt: '',
|
model: 'gpt-4o-mini',
|
||||||
temperature: 0,
|
systemPrompt: '',
|
||||||
isResponseAnswerText: true,
|
temperature: 0,
|
||||||
maxHistories: 6,
|
isResponseAnswerText: true,
|
||||||
maxToken: 4000
|
maxHistories: 6,
|
||||||
},
|
maxToken: 4000
|
||||||
dataset: {
|
},
|
||||||
datasets: [],
|
dataset: {
|
||||||
similarity: 0.4,
|
datasets: [],
|
||||||
limit: 1500,
|
similarity: 0.4,
|
||||||
searchMode: DatasetSearchModeEnum.embedding,
|
limit: 1500,
|
||||||
usingReRank: false,
|
searchMode: DatasetSearchModeEnum.embedding,
|
||||||
datasetSearchUsingExtensionQuery: false,
|
usingReRank: false,
|
||||||
datasetSearchExtensionBg: ''
|
datasetSearchUsingExtensionQuery: true,
|
||||||
},
|
datasetSearchExtensionBg: ''
|
||||||
selectedTools: [],
|
},
|
||||||
chatConfig: {}
|
selectedTools: [],
|
||||||
});
|
chatConfig: {}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/* format app nodes to edit form */
|
/* format app nodes to edit form */
|
||||||
export const appWorkflow2Form = ({
|
export const appWorkflow2Form = ({
|
||||||
|
|||||||
1
packages/global/core/app/version.d.ts
vendored
1
packages/global/core/app/version.d.ts
vendored
@@ -1,4 +1,3 @@
|
|||||||
import { StoreNodeItemType } from '../workflow/type';
|
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { AppChatConfigType, AppSchema } from './type';
|
import { AppChatConfigType, AppSchema } from './type';
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,10 @@ export const chats2GPTMessages = ({
|
|||||||
text: item.text?.content || ''
|
text: item.text?.content || ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (item.type === 'file' && item.file?.type === ChatFileTypeEnum.image) {
|
if (
|
||||||
|
item.type === ChatItemValueTypeEnum.file &&
|
||||||
|
item.file?.type === ChatFileTypeEnum.image
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
type: 'image_url',
|
type: 'image_url',
|
||||||
image_url: {
|
image_url: {
|
||||||
@@ -64,7 +67,6 @@ export const chats2GPTMessages = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
})
|
})
|
||||||
.filter(Boolean) as ChatCompletionContentPart[];
|
.filter(Boolean) as ChatCompletionContentPart[];
|
||||||
|
|
||||||
@@ -166,7 +168,7 @@ export const GPTMessages2Chats = (
|
|||||||
} else if (item.type === 'image_url') {
|
} else if (item.type === 'image_url') {
|
||||||
value.push({
|
value.push({
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
type: 'file',
|
type: ChatItemValueTypeEnum.file,
|
||||||
file: {
|
file: {
|
||||||
type: ChatFileTypeEnum.image,
|
type: ChatFileTypeEnum.image,
|
||||||
name: '',
|
name: '',
|
||||||
@@ -175,7 +177,6 @@ export const GPTMessages2Chats = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @ts-ignore
|
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
obj === ChatRoleEnum.AI &&
|
obj === ChatRoleEnum.AI &&
|
||||||
|
|||||||
@@ -56,7 +56,4 @@ export enum ChatStatusEnum {
|
|||||||
finish = 'finish'
|
finish = 'finish'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IMG_BLOCK_KEY = 'img-block';
|
|
||||||
export const FILE_BLOCK_KEY = 'file-block';
|
|
||||||
|
|
||||||
export const MARKDOWN_QUOTE_SIGN = 'QUOTE SIGN';
|
export const MARKDOWN_QUOTE_SIGN = 'QUOTE SIGN';
|
||||||
|
|||||||
5
packages/global/core/chat/type.d.ts
vendored
5
packages/global/core/chat/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { ClassifyQuestionAgentItemType } from '../workflow/type';
|
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
||||||
import { SearchDataResponseItemType } from '../dataset/type';
|
import { SearchDataResponseItemType } from '../dataset/type';
|
||||||
import {
|
import {
|
||||||
ChatFileTypeEnum,
|
ChatFileTypeEnum,
|
||||||
@@ -13,8 +13,8 @@ import { DispatchNodeResponseKeyEnum } from '../workflow/runtime/constants';
|
|||||||
import { AppChatConfigType, AppSchema, VariableItemType } from '../app/type';
|
import { AppChatConfigType, AppSchema, VariableItemType } from '../app/type';
|
||||||
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { ChatBoxInputType } from '../../../../projects/app/src/components/ChatBox/type';
|
|
||||||
import { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
import { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
||||||
|
import { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
||||||
|
|
||||||
export type ChatSchema = {
|
export type ChatSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -115,6 +115,7 @@ export type ChatSiteItemType = (UserChatItemType | SystemChatItemType | AIChatIt
|
|||||||
status: `${ChatStatusEnum}`;
|
status: `${ChatStatusEnum}`;
|
||||||
moduleName?: string;
|
moduleName?: string;
|
||||||
ttsBuffer?: Uint8Array;
|
ttsBuffer?: Uint8Array;
|
||||||
|
responseData?: ChatHistoryItemResType[];
|
||||||
} & ChatBoxInputType;
|
} & ChatBoxInputType;
|
||||||
|
|
||||||
/* --------- team chat --------- */
|
/* --------- team chat --------- */
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
|||||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from './constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum } from './constants';
|
||||||
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
|
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
|
||||||
|
|
||||||
|
// Concat 2 -> 1, and sort by role
|
||||||
|
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
|
||||||
|
const newHistories = [...histories1, ...histories2];
|
||||||
|
return newHistories.sort((a, b) => {
|
||||||
|
if (a.obj === ChatRoleEnum.System) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const getChatTitleFromChatMessage = (message?: ChatItemType, defaultValue = '新对话') => {
|
export const getChatTitleFromChatMessage = (message?: ChatItemType, defaultValue = '新对话') => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const textMsg = message?.value.find((item) => item.type === ChatItemValueTypeEnum.text);
|
const textMsg = message?.value.find((item) => item.type === ChatItemValueTypeEnum.text);
|
||||||
@@ -54,11 +65,12 @@ export const filterPublicNodeResponseData = ({
|
|||||||
}: {
|
}: {
|
||||||
flowResponses?: ChatHistoryItemResType[];
|
flowResponses?: ChatHistoryItemResType[];
|
||||||
}) => {
|
}) => {
|
||||||
const filedList = ['quoteList', 'moduleType'];
|
const filedList = ['quoteList', 'moduleType', 'pluginOutput'];
|
||||||
const filterModuleTypeList: any[] = [
|
const filterModuleTypeList: any[] = [
|
||||||
FlowNodeTypeEnum.pluginModule,
|
FlowNodeTypeEnum.pluginModule,
|
||||||
FlowNodeTypeEnum.datasetSearchNode,
|
FlowNodeTypeEnum.datasetSearchNode,
|
||||||
FlowNodeTypeEnum.tools
|
FlowNodeTypeEnum.tools,
|
||||||
|
FlowNodeTypeEnum.pluginOutput
|
||||||
];
|
];
|
||||||
|
|
||||||
return flowResponses
|
return flowResponses
|
||||||
@@ -78,14 +90,22 @@ export const filterPublicNodeResponseData = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeEmptyUserInput = (input: UserChatItemValueItemType[]) => {
|
export const removeEmptyUserInput = (input?: UserChatItemValueItemType[]) => {
|
||||||
return input.filter((item) => {
|
return (
|
||||||
if (item.type === ChatItemValueTypeEnum.text && !item.text?.content?.trim()) {
|
input?.filter((item) => {
|
||||||
return false;
|
if (item.type === ChatItemValueTypeEnum.text && !item.text?.content?.trim()) {
|
||||||
}
|
return false;
|
||||||
if (item.type === ChatItemValueTypeEnum.file && !item.file?.url) {
|
}
|
||||||
return false;
|
if (item.type === ChatItemValueTypeEnum.file && !item.file?.url) {
|
||||||
}
|
return false;
|
||||||
return true;
|
}
|
||||||
});
|
return true;
|
||||||
|
}) || []
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getPluginOutputsFromChatResponses = (responses: ChatHistoryItemResType[]) => {
|
||||||
|
const outputs =
|
||||||
|
responses.find((item) => item.moduleType === FlowNodeTypeEnum.pluginOutput)?.pluginOutput ?? {};
|
||||||
|
return outputs;
|
||||||
};
|
};
|
||||||
|
|||||||
1
packages/global/core/dataset/api.d.ts
vendored
1
packages/global/core/dataset/api.d.ts
vendored
@@ -10,7 +10,6 @@ export type DatasetUpdateBody = {
|
|||||||
name?: string;
|
name?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
intro?: string;
|
intro?: string;
|
||||||
permission?: DatasetSchemaType['permission']; // TODO: Should be deleted.
|
|
||||||
agentModel?: LLMModelItemType;
|
agentModel?: LLMModelItemType;
|
||||||
status?: DatasetSchemaType['status'];
|
status?: DatasetSchemaType['status'];
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { DatasetCollectionTypeEnum, TrainingModeEnum, TrainingTypeMap } from '../constants';
|
||||||
import { CollectionWithDatasetType, DatasetCollectionSchemaType } from '../type';
|
import { CollectionWithDatasetType, DatasetCollectionSchemaType } from '../type';
|
||||||
|
|
||||||
export const getCollectionSourceData = (
|
export const getCollectionSourceData = (
|
||||||
@@ -12,3 +13,13 @@ export const getCollectionSourceData = (
|
|||||||
sourceName: collection?.name || ''
|
sourceName: collection?.name || ''
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const checkCollectionIsFolder = (type: DatasetCollectionTypeEnum) => {
|
||||||
|
return type === DatasetCollectionTypeEnum.folder || type === DatasetCollectionTypeEnum.virtual;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getTrainingTypeLabel = (type?: TrainingModeEnum) => {
|
||||||
|
if (!type) return '';
|
||||||
|
if (!TrainingTypeMap[type]) return '';
|
||||||
|
return TrainingTypeMap[type].label;
|
||||||
|
};
|
||||||
|
|||||||
@@ -8,22 +8,22 @@ export enum DatasetTypeEnum {
|
|||||||
export const DatasetTypeMap = {
|
export const DatasetTypeMap = {
|
||||||
[DatasetTypeEnum.folder]: {
|
[DatasetTypeEnum.folder]: {
|
||||||
icon: 'common/folderFill',
|
icon: 'common/folderFill',
|
||||||
label: 'Folder Dataset',
|
label: 'folder_dataset',
|
||||||
collectionLabel: 'common.Folder'
|
collectionLabel: 'common.Folder'
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.dataset]: {
|
[DatasetTypeEnum.dataset]: {
|
||||||
icon: 'core/dataset/commonDataset',
|
icon: 'core/dataset/commonDataset',
|
||||||
label: 'Common Dataset',
|
label: 'common_dataset',
|
||||||
collectionLabel: 'common.File'
|
collectionLabel: 'common.File'
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.websiteDataset]: {
|
[DatasetTypeEnum.websiteDataset]: {
|
||||||
icon: 'core/dataset/websiteDataset',
|
icon: 'core/dataset/websiteDataset',
|
||||||
label: 'Website Dataset',
|
label: 'website_dataset',
|
||||||
collectionLabel: 'common.Website'
|
collectionLabel: 'common.Website'
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.externalFile]: {
|
[DatasetTypeEnum.externalFile]: {
|
||||||
icon: 'core/dataset/externalDataset',
|
icon: 'core/dataset/externalDataset',
|
||||||
label: 'External File',
|
label: 'external_file',
|
||||||
collectionLabel: 'common.File'
|
collectionLabel: 'common.File'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
24
packages/global/core/dataset/type.d.ts
vendored
24
packages/global/core/dataset/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { PermissionValueType } from 'support/permission/type';
|
import { PermissionSchemaType } from '../../support/permission/type';
|
||||||
import type { LLMModelItemType, VectorModelItemType } from '../../core/ai/model.d';
|
import type { LLMModelItemType, VectorModelItemType } from '../../core/ai/model.d';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import { PushDatasetDataChunkProps } from './api';
|
import { PushDatasetDataChunkProps } from './api';
|
||||||
@@ -12,31 +12,28 @@ import {
|
|||||||
import { DatasetPermission } from '../../support/permission/dataset/controller';
|
import { DatasetPermission } from '../../support/permission/dataset/controller';
|
||||||
import { Permission } from '../../support/permission/controller';
|
import { Permission } from '../../support/permission/controller';
|
||||||
|
|
||||||
/* schema */
|
|
||||||
export type DatasetSchemaType = {
|
export type DatasetSchemaType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
parentId: string;
|
parentId?: string;
|
||||||
userId: string;
|
userId: string;
|
||||||
teamId: string;
|
teamId: string;
|
||||||
tmbId: string;
|
tmbId: string;
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
|
|
||||||
avatar: string;
|
avatar: string;
|
||||||
name: string;
|
name: string;
|
||||||
vectorModel: string;
|
vectorModel: string;
|
||||||
agentModel: string;
|
agentModel: string;
|
||||||
intro: string;
|
intro: string;
|
||||||
type: DatasetTypeEnum;
|
type: `${DatasetTypeEnum}`;
|
||||||
status: `${DatasetStatusEnum}`;
|
status: `${DatasetStatusEnum}`;
|
||||||
permission: DatasetPermission;
|
|
||||||
|
|
||||||
// metadata
|
|
||||||
websiteConfig?: {
|
websiteConfig?: {
|
||||||
url: string;
|
url: string;
|
||||||
selector: string;
|
selector: string;
|
||||||
};
|
};
|
||||||
externalReadUrl?: string;
|
externalReadUrl?: string;
|
||||||
defaultPermission: PermissionValueType;
|
} & PermissionSchemaType;
|
||||||
};
|
// } & PermissionSchemaType;
|
||||||
|
|
||||||
export type DatasetCollectionSchemaType = {
|
export type DatasetCollectionSchemaType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -48,6 +45,7 @@ export type DatasetCollectionSchemaType = {
|
|||||||
type: DatasetCollectionTypeEnum;
|
type: DatasetCollectionTypeEnum;
|
||||||
createTime: Date;
|
createTime: Date;
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
|
forbid?: boolean;
|
||||||
|
|
||||||
trainingType: TrainingModeEnum;
|
trainingType: TrainingModeEnum;
|
||||||
chunkSize: number;
|
chunkSize: number;
|
||||||
@@ -89,6 +87,7 @@ export type DatasetDataSchemaType = {
|
|||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
q: string; // large chunks or question
|
q: string; // large chunks or question
|
||||||
a: string; // answer or custom content
|
a: string; // answer or custom content
|
||||||
|
forbid?: boolean;
|
||||||
fullTextToken: string;
|
fullTextToken: string;
|
||||||
indexes: DatasetDataIndexItemType[];
|
indexes: DatasetDataIndexItemType[];
|
||||||
rebuilding?: boolean;
|
rebuilding?: boolean;
|
||||||
@@ -131,19 +130,18 @@ export type DatasetSimpleItemType = {
|
|||||||
};
|
};
|
||||||
export type DatasetListItemType = {
|
export type DatasetListItemType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
parentId: string;
|
|
||||||
avatar: string;
|
avatar: string;
|
||||||
name: string;
|
name: string;
|
||||||
intro: string;
|
intro: string;
|
||||||
type: DatasetTypeEnum;
|
type: `${DatasetTypeEnum}`;
|
||||||
permission: DatasetPermission;
|
permission: DatasetPermission;
|
||||||
vectorModel: VectorModelItemType;
|
vectorModel: VectorModelItemType;
|
||||||
defaultPermission: PermissionValueType;
|
} & PermissionSchemaType;
|
||||||
};
|
|
||||||
|
|
||||||
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
|
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
|
||||||
vectorModel: VectorModelItemType;
|
vectorModel: VectorModelItemType;
|
||||||
agentModel: LLMModelItemType;
|
agentModel: LLMModelItemType;
|
||||||
|
permission: DatasetPermission;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================= collection ===================== */
|
/* ================= collection ===================== */
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { StoreNodeItemType } from '../workflow/type';
|
|
||||||
|
|
||||||
export enum PluginTypeEnum {
|
export enum PluginTypeEnum {
|
||||||
folder = 'folder',
|
folder = 'folder',
|
||||||
custom = 'custom',
|
custom = 'custom',
|
||||||
|
|||||||
2
packages/global/core/plugin/controller.d.ts
vendored
2
packages/global/core/plugin/controller.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import type { StoreNodeItemType } from '../workflow/type';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginTypeEnum } from './constants';
|
import { PluginTypeEnum } from './constants';
|
||||||
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
||||||
|
|
||||||
|
|||||||
5
packages/global/core/plugin/type.d.ts
vendored
5
packages/global/core/plugin/type.d.ts
vendored
@@ -1,8 +1,9 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { FlowModuleTemplateType, StoreNodeItemType } from '../workflow/type';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
||||||
import { MethodType } from './controller';
|
import { MethodType } from './controller';
|
||||||
|
import { FlowNodeTemplateType } from '../workflow/type/node';
|
||||||
|
|
||||||
export type PluginItemSchema = {
|
export type PluginItemSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -31,7 +32,7 @@ export type PluginItemSchema = {
|
|||||||
export type PluginTemplateType = PluginRuntimeType & {
|
export type PluginTemplateType = PluginRuntimeType & {
|
||||||
author?: string;
|
author?: string;
|
||||||
id: string;
|
id: string;
|
||||||
source: `${PluginSourceEnum}`;
|
source: PluginSourceEnum;
|
||||||
templateType: FlowNodeTemplateType['templateType'];
|
templateType: FlowNodeTemplateType['templateType'];
|
||||||
intro: string;
|
intro: string;
|
||||||
version: string;
|
version: string;
|
||||||
|
|||||||
2
packages/global/core/workflow/api.d.ts
vendored
2
packages/global/core/workflow/api.d.ts
vendored
@@ -4,7 +4,7 @@ import { NodeInputKeyEnum } from './constants';
|
|||||||
export type SelectedDatasetType = { datasetId: string }[];
|
export type SelectedDatasetType = { datasetId: string }[];
|
||||||
|
|
||||||
export type HttpBodyType<T = Record<string, any>> = {
|
export type HttpBodyType<T = Record<string, any>> = {
|
||||||
[NodeInputKeyEnum.addInputParam]: Record<string, any>;
|
// [NodeInputKeyEnum.addInputParam]: Record<string, any>;
|
||||||
} & T;
|
} & T;
|
||||||
export type HttpQueryType = {
|
export type HttpQueryType = {
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
export enum FlowNodeTemplateTypeEnum {
|
export enum FlowNodeTemplateTypeEnum {
|
||||||
systemInput = 'systemInput',
|
systemInput = 'systemInput',
|
||||||
|
ai = 'ai',
|
||||||
|
function = 'function',
|
||||||
tools = 'tools',
|
tools = 'tools',
|
||||||
textAnswer = 'textAnswer',
|
|
||||||
functionCall = 'functionCall',
|
|
||||||
externalCall = 'externalCall',
|
|
||||||
|
|
||||||
personalPlugin = 'personalPlugin',
|
search = 'search',
|
||||||
|
multimodal = 'multimodal',
|
||||||
|
communication = 'communication',
|
||||||
|
|
||||||
other = 'other'
|
other = 'other',
|
||||||
|
teamApp = 'teamApp'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum WorkflowIOValueTypeEnum {
|
export enum WorkflowIOValueTypeEnum {
|
||||||
@@ -84,6 +86,9 @@ export enum NodeInputKeyEnum {
|
|||||||
datasetSearchExtensionModel = 'datasetSearchExtensionModel',
|
datasetSearchExtensionModel = 'datasetSearchExtensionModel',
|
||||||
datasetSearchExtensionBg = 'datasetSearchExtensionBg',
|
datasetSearchExtensionBg = 'datasetSearchExtensionBg',
|
||||||
|
|
||||||
|
// concat dataset
|
||||||
|
datasetQuoteList = 'system_datasetQuoteList',
|
||||||
|
|
||||||
// context extract
|
// context extract
|
||||||
contextExtractInput = 'content',
|
contextExtractInput = 'content',
|
||||||
extractKeys = 'extractKeys',
|
extractKeys = 'extractKeys',
|
||||||
@@ -180,8 +185,6 @@ export const variableMap = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DYNAMIC_INPUT_REFERENCE_KEY = 'DYNAMIC_INPUT_REFERENCE_KEY';
|
|
||||||
|
|
||||||
/* run time */
|
/* run time */
|
||||||
export enum RuntimeEdgeStatusEnum {
|
export enum RuntimeEdgeStatusEnum {
|
||||||
'waiting' = 'waiting',
|
'waiting' = 'waiting',
|
||||||
@@ -190,3 +193,4 @@ export enum RuntimeEdgeStatusEnum {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const VARIABLE_NODE_ID = 'VARIABLE_NODE_ID';
|
export const VARIABLE_NODE_ID = 'VARIABLE_NODE_ID';
|
||||||
|
export const DYNAMIC_INPUT_REFERENCE_KEY = 'DYNAMIC_INPUT_REFERENCE_KEY';
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||||
|
|
||||||
export enum FlowNodeInputTypeEnum { // render ui
|
export enum FlowNodeInputTypeEnum { // render ui
|
||||||
reference = 'reference', // reference to other node output
|
reference = 'reference', // reference to other node output
|
||||||
input = 'input', // one line input
|
input = 'input', // one line input
|
||||||
numberInput = 'numberInput',
|
numberInput = 'numberInput',
|
||||||
switch = 'switch', // true/false
|
switch = 'switch', // true/false
|
||||||
|
select = 'select',
|
||||||
|
|
||||||
// editor
|
// editor
|
||||||
textarea = 'textarea',
|
textarea = 'textarea',
|
||||||
@@ -22,8 +25,6 @@ export enum FlowNodeInputTypeEnum { // render ui
|
|||||||
selectDatasetParamsModal = 'selectDatasetParamsModal',
|
selectDatasetParamsModal = 'selectDatasetParamsModal',
|
||||||
settingDatasetQuotePrompt = 'settingDatasetQuotePrompt',
|
settingDatasetQuotePrompt = 'settingDatasetQuotePrompt',
|
||||||
|
|
||||||
select = 'select',
|
|
||||||
|
|
||||||
hidden = 'hidden',
|
hidden = 'hidden',
|
||||||
custom = 'custom'
|
custom = 'custom'
|
||||||
}
|
}
|
||||||
@@ -114,8 +115,97 @@ export enum FlowNodeTypeEnum {
|
|||||||
lafModule = 'lafModule',
|
lafModule = 'lafModule',
|
||||||
ifElseNode = 'ifElseNode',
|
ifElseNode = 'ifElseNode',
|
||||||
variableUpdate = 'variableUpdate',
|
variableUpdate = 'variableUpdate',
|
||||||
code = 'code'
|
code = 'code',
|
||||||
|
textEditor = 'textEditor',
|
||||||
|
customFeedback = 'customFeedback'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// node IO value type
|
||||||
|
export const FlowValueTypeMap = {
|
||||||
|
[WorkflowIOValueTypeEnum.string]: {
|
||||||
|
label: 'string',
|
||||||
|
value: WorkflowIOValueTypeEnum.string,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.number]: {
|
||||||
|
label: 'number',
|
||||||
|
value: WorkflowIOValueTypeEnum.number,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.boolean]: {
|
||||||
|
label: 'boolean',
|
||||||
|
value: WorkflowIOValueTypeEnum.boolean,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.object]: {
|
||||||
|
label: 'object',
|
||||||
|
value: WorkflowIOValueTypeEnum.object,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.arrayString]: {
|
||||||
|
label: 'array<string>',
|
||||||
|
value: WorkflowIOValueTypeEnum.arrayString,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.arrayNumber]: {
|
||||||
|
label: 'array<number>',
|
||||||
|
value: WorkflowIOValueTypeEnum.arrayNumber,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.arrayBoolean]: {
|
||||||
|
label: 'array<boolean>',
|
||||||
|
value: WorkflowIOValueTypeEnum.arrayBoolean,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.arrayObject]: {
|
||||||
|
label: 'array<object>',
|
||||||
|
value: WorkflowIOValueTypeEnum.arrayObject,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.any]: {
|
||||||
|
label: 'any',
|
||||||
|
value: WorkflowIOValueTypeEnum.any,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.chatHistory]: {
|
||||||
|
label: '历史记录',
|
||||||
|
value: WorkflowIOValueTypeEnum.chatHistory,
|
||||||
|
description: `{
|
||||||
|
obj: System | Human | AI;
|
||||||
|
value: string;
|
||||||
|
}[]`
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.datasetQuote]: {
|
||||||
|
label: '知识库引用',
|
||||||
|
value: WorkflowIOValueTypeEnum.datasetQuote,
|
||||||
|
description: `{
|
||||||
|
id: string;
|
||||||
|
datasetId: string;
|
||||||
|
collectionId: string;
|
||||||
|
sourceName: string;
|
||||||
|
sourceId?: string;
|
||||||
|
q: string;
|
||||||
|
a: string
|
||||||
|
}[]`
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.selectApp]: {
|
||||||
|
label: '选择应用',
|
||||||
|
value: WorkflowIOValueTypeEnum.selectApp,
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.selectDataset]: {
|
||||||
|
label: '选择知识库',
|
||||||
|
value: WorkflowIOValueTypeEnum.selectDataset,
|
||||||
|
description: `{
|
||||||
|
datasetId: string;
|
||||||
|
}`
|
||||||
|
},
|
||||||
|
[WorkflowIOValueTypeEnum.dynamic]: {
|
||||||
|
label: '动态输入',
|
||||||
|
value: WorkflowIOValueTypeEnum.dynamic,
|
||||||
|
description: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const EDGE_TYPE = 'default';
|
export const EDGE_TYPE = 'default';
|
||||||
export const defaultNodeVersion = '481';
|
export const defaultNodeVersion = '481';
|
||||||
|
|||||||
17
packages/global/core/workflow/node/io/utils.ts
Normal file
17
packages/global/core/workflow/node/io/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { FlowNodeInputItemType } from '../../type/io';
|
||||||
|
|
||||||
|
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
||||||
|
return {
|
||||||
|
referencePlaceholder: input.referencePlaceholder,
|
||||||
|
placeholder: input.placeholder,
|
||||||
|
maxLength: input.maxLength,
|
||||||
|
list: input.list,
|
||||||
|
markList: input.markList,
|
||||||
|
step: input.step,
|
||||||
|
max: input.max,
|
||||||
|
min: input.min,
|
||||||
|
defaultValue: input.defaultValue,
|
||||||
|
llmModelType: input.llmModelType,
|
||||||
|
customInputConfig: input.customInputConfig
|
||||||
|
};
|
||||||
|
};
|
||||||
39
packages/global/core/workflow/node/type.d.ts
vendored
39
packages/global/core/workflow/node/type.d.ts
vendored
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
react flow type
|
|
||||||
*/
|
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from './constant';
|
|
||||||
import { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
|
||||||
import { SelectedDatasetType } from '../api';
|
|
||||||
import { LLMModelTypeEnum } from '../../ai/constants';
|
|
||||||
|
|
||||||
/* --------------- edit field ------------------- */
|
|
||||||
export type EditInputFieldMapType = EditOutputFieldMapType & {
|
|
||||||
inputType?: boolean;
|
|
||||||
};
|
|
||||||
export type EditOutputFieldMapType = {
|
|
||||||
key?: boolean;
|
|
||||||
description?: boolean;
|
|
||||||
valueType?: boolean; // output
|
|
||||||
required?: boolean;
|
|
||||||
defaultValue?: boolean;
|
|
||||||
};
|
|
||||||
export type EditNodeFieldType = {
|
|
||||||
inputType?: FlowNodeInputTypeEnum; // input type
|
|
||||||
valueType?: WorkflowIOValueTypeEnum;
|
|
||||||
required?: boolean;
|
|
||||||
key?: string;
|
|
||||||
label?: string;
|
|
||||||
description?: string;
|
|
||||||
isToolInput?: boolean;
|
|
||||||
|
|
||||||
defaultValue?: string;
|
|
||||||
maxLength?: number;
|
|
||||||
max?: number;
|
|
||||||
min?: number;
|
|
||||||
editField?: EditInputFieldMapType;
|
|
||||||
dynamicParamDefaultValue?: {
|
|
||||||
inputType?: FlowNodeInputTypeEnum; // input type
|
|
||||||
valueType?: WorkflowIOValueTypeEnum;
|
|
||||||
required?: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
63
packages/global/core/workflow/runtime/type.d.ts
vendored
63
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -1,11 +1,56 @@
|
|||||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||||
import { ChatItemValueItemType, ToolRunResponseItemType } from '../../chat/type';
|
import {
|
||||||
|
ChatItemType,
|
||||||
|
UserChatItemValueItemType,
|
||||||
|
ChatItemValueItemType,
|
||||||
|
ToolRunResponseItemType
|
||||||
|
} from '../../chat/type';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
||||||
import { StoreNodeItemType } from '../type';
|
import { StoreNodeItemType } from '../type/node';
|
||||||
import { DispatchNodeResponseKeyEnum } from './constants';
|
import { DispatchNodeResponseKeyEnum } from './constants';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import { StoreEdgeItemType } from '../type/edge';
|
||||||
import { NodeInputKeyEnum } from '../constants';
|
import { NodeInputKeyEnum } from '../constants';
|
||||||
|
import { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
||||||
|
import { NextApiResponse } from 'next';
|
||||||
|
import { UserModelSchema } from '../../../support/user/type';
|
||||||
|
import { AppDetailType, AppSchema } from '../../app/type';
|
||||||
|
import { RuntimeNodeItemType } from '../runtime/type';
|
||||||
|
import { RuntimeEdgeItemType } from './edge';
|
||||||
|
|
||||||
|
/* workflow props */
|
||||||
|
export type ChatDispatchProps = {
|
||||||
|
res?: NextApiResponse;
|
||||||
|
mode: 'test' | 'chat' | 'debug';
|
||||||
|
teamId: string;
|
||||||
|
tmbId: string;
|
||||||
|
user: UserModelSchema;
|
||||||
|
app: AppDetailType | AppSchema;
|
||||||
|
chatId?: string;
|
||||||
|
responseChatItemId?: string;
|
||||||
|
histories: ChatItemType[];
|
||||||
|
variables: Record<string, any>; // global variable
|
||||||
|
query: UserChatItemValueItemType[]; // trigger query
|
||||||
|
stream: boolean;
|
||||||
|
detail: boolean; // response detail
|
||||||
|
maxRunTimes: number;
|
||||||
|
isToolCall?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||||
|
node: RuntimeNodeItemType;
|
||||||
|
runtimeNodes: RuntimeNodeItemType[];
|
||||||
|
runtimeEdges: RuntimeEdgeItemType[];
|
||||||
|
params: T;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SystemVariablesType = {
|
||||||
|
appId: string;
|
||||||
|
chatId?: string;
|
||||||
|
responseChatItemId?: string;
|
||||||
|
histories: ChatItemType[];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* node props */
|
||||||
export type RuntimeNodeItemType = {
|
export type RuntimeNodeItemType = {
|
||||||
nodeId: StoreNodeItemType['nodeId'];
|
nodeId: StoreNodeItemType['nodeId'];
|
||||||
name: StoreNodeItemType['name'];
|
name: StoreNodeItemType['name'];
|
||||||
@@ -21,6 +66,17 @@ export type RuntimeNodeItemType = {
|
|||||||
pluginId?: string;
|
pluginId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PluginRuntimeType = {
|
||||||
|
id: string;
|
||||||
|
teamId?: string;
|
||||||
|
name: string;
|
||||||
|
avatar: string;
|
||||||
|
showStatus?: boolean;
|
||||||
|
currentCost?: number;
|
||||||
|
nodes: StoreNodeItemType[];
|
||||||
|
edges: StoreEdgeItemType[];
|
||||||
|
};
|
||||||
|
|
||||||
export type RuntimeEdgeItemType = StoreEdgeItemType & {
|
export type RuntimeEdgeItemType = StoreEdgeItemType & {
|
||||||
status: 'waiting' | 'active' | 'skipped';
|
status: 'waiting' | 'active' | 'skipped';
|
||||||
};
|
};
|
||||||
@@ -87,6 +143,9 @@ export type DispatchNodeResponseType = {
|
|||||||
|
|
||||||
// code
|
// code
|
||||||
codeLog?: string;
|
codeLog?: string;
|
||||||
|
|
||||||
|
// plugin
|
||||||
|
pluginOutput?: Record<string, any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DispatchNodeResultType<T> = {
|
export type DispatchNodeResultType<T> = {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
||||||
import { NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
import { NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
||||||
import { FlowNodeTypeEnum } from '../node/constant';
|
import { FlowNodeTypeEnum } from '../node/constant';
|
||||||
import { StoreNodeItemType } from '../type';
|
import { StoreNodeItemType } from '../type/node';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import { StoreEdgeItemType } from '../type/edge';
|
||||||
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
||||||
import { VARIABLE_NODE_ID } from '../constants';
|
import { VARIABLE_NODE_ID } from '../constants';
|
||||||
@@ -123,6 +123,7 @@ export const checkNodeRunStatus = ({
|
|||||||
(item) => item.target === node.nodeId
|
(item) => item.target === node.nodeId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Entry
|
||||||
if (workflowEdges.length === 0) {
|
if (workflowEdges.length === 0) {
|
||||||
return 'run';
|
return 'run';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,47 +5,51 @@ import { AiChatModule } from './system/aiChat';
|
|||||||
import { DatasetSearchModule } from './system/datasetSearch';
|
import { DatasetSearchModule } from './system/datasetSearch';
|
||||||
import { DatasetConcatModule } from './system/datasetConcat';
|
import { DatasetConcatModule } from './system/datasetConcat';
|
||||||
import { AssignedAnswerModule } from './system/assignedAnswer';
|
import { AssignedAnswerModule } from './system/assignedAnswer';
|
||||||
import { ClassifyQuestionModule } from './system/classifyQuestion';
|
import { ClassifyQuestionModule } from './system/classifyQuestion/index';
|
||||||
import { ContextExtractModule } from './system/contextExtract';
|
import { ContextExtractModule } from './system/contextExtract/index';
|
||||||
import { HttpModule468 } from './system/http468';
|
import { HttpNode468 } from './system/http468';
|
||||||
|
|
||||||
import { ToolModule } from './system/tools';
|
import { ToolModule } from './system/tools';
|
||||||
import { StopToolNode } from './system/stopTool';
|
import { StopToolNode } from './system/stopTool';
|
||||||
|
|
||||||
import { RunAppModule } from './system/runApp';
|
import { RunAppModule } from './system/runApp/index';
|
||||||
import { PluginInputModule } from './system/pluginInput';
|
import { PluginInputModule } from './system/pluginInput';
|
||||||
import { PluginOutputModule } from './system/pluginOutput';
|
import { PluginOutputModule } from './system/pluginOutput';
|
||||||
import { RunPluginModule } from './system/runPlugin';
|
import { RunPluginModule } from './system/runPlugin';
|
||||||
import { AiQueryExtension } from './system/queryExtension';
|
import { AiQueryExtension } from './system/queryExtension';
|
||||||
|
|
||||||
import type { FlowNodeTemplateType } from '../type';
|
import type { FlowNodeTemplateType } from '../type/node';
|
||||||
import { LafModule } from './system/laf';
|
import { LafModule } from './system/laf';
|
||||||
import { IfElseNode } from './system/ifElse/index';
|
import { IfElseNode } from './system/ifElse/index';
|
||||||
import { VariableUpdateNode } from './system/variableUpdate';
|
import { VariableUpdateNode } from './system/variableUpdate';
|
||||||
import { CodeNode } from './system/sandbox';
|
import { CodeNode } from './system/sandbox';
|
||||||
|
import { TextEditorNode } from './system/textEditor';
|
||||||
|
import { CustomFeedbackNode } from './system/customFeedback';
|
||||||
|
|
||||||
const systemNodes: FlowNodeTemplateType[] = [
|
const systemNodes: FlowNodeTemplateType[] = [
|
||||||
AiChatModule,
|
AiChatModule,
|
||||||
|
TextEditorNode,
|
||||||
AssignedAnswerModule,
|
AssignedAnswerModule,
|
||||||
DatasetSearchModule,
|
DatasetSearchModule,
|
||||||
DatasetConcatModule,
|
DatasetConcatModule,
|
||||||
RunAppModule,
|
|
||||||
ToolModule,
|
ToolModule,
|
||||||
StopToolNode,
|
StopToolNode,
|
||||||
ClassifyQuestionModule,
|
ClassifyQuestionModule,
|
||||||
ContextExtractModule,
|
ContextExtractModule,
|
||||||
HttpModule468,
|
HttpNode468,
|
||||||
AiQueryExtension,
|
AiQueryExtension,
|
||||||
LafModule,
|
LafModule,
|
||||||
IfElseNode,
|
IfElseNode,
|
||||||
VariableUpdateNode,
|
VariableUpdateNode,
|
||||||
CodeNode
|
CodeNode,
|
||||||
|
RunAppModule
|
||||||
];
|
];
|
||||||
/* app flow module templates */
|
/* app flow module templates */
|
||||||
export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||||
SystemConfigNode,
|
SystemConfigNode,
|
||||||
WorkflowStart,
|
WorkflowStart,
|
||||||
...systemNodes
|
...systemNodes,
|
||||||
|
CustomFeedbackNode
|
||||||
];
|
];
|
||||||
/* plugin flow module templates */
|
/* plugin flow module templates */
|
||||||
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||||
@@ -56,11 +60,11 @@ export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
|||||||
|
|
||||||
/* all module */
|
/* all module */
|
||||||
export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
||||||
...systemNodes,
|
...appSystemModuleTemplates.concat(
|
||||||
|
pluginSystemModuleTemplates.filter(
|
||||||
|
(item) => !appSystemModuleTemplates.find((app) => app.id === item.id)
|
||||||
|
)
|
||||||
|
),
|
||||||
EmptyNode,
|
EmptyNode,
|
||||||
SystemConfigNode,
|
|
||||||
WorkflowStart,
|
|
||||||
PluginInputModule,
|
|
||||||
PluginOutputModule,
|
|
||||||
RunPluginModule
|
RunPluginModule
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ export const Output_Template_AddOutput: FlowNodeOutputItemType = {
|
|||||||
type: FlowNodeOutputTypeEnum.dynamic,
|
type: FlowNodeOutputTypeEnum.dynamic,
|
||||||
valueType: WorkflowIOValueTypeEnum.dynamic,
|
valueType: WorkflowIOValueTypeEnum.dynamic,
|
||||||
label: '',
|
label: '',
|
||||||
|
customFieldConfig: {
|
||||||
editField: {
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
key: true,
|
showDescription: false,
|
||||||
valueType: true
|
showDefaultValue: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -22,11 +22,11 @@ import { getHandleConfig } from '../utils';
|
|||||||
|
|
||||||
export const AiChatModule: FlowNodeTemplateType = {
|
export const AiChatModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.chatNode,
|
id: FlowNodeTypeEnum.chatNode,
|
||||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
flowNodeType: FlowNodeTypeEnum.chatNode,
|
flowNodeType: FlowNodeTypeEnum.chatNode,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/AI.png',
|
avatar: 'core/workflow/template/aiChat',
|
||||||
name: 'AI 对话',
|
name: 'AI 对话',
|
||||||
intro: 'AI 大模型对话',
|
intro: 'AI 大模型对话',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -9,11 +9,11 @@ import { getHandleConfig } from '../utils';
|
|||||||
|
|
||||||
export const AssignedAnswerModule: FlowNodeTemplateType = {
|
export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.answerNode,
|
id: FlowNodeTypeEnum.answerNode,
|
||||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||||
flowNodeType: FlowNodeTypeEnum.answerNode,
|
flowNodeType: FlowNodeTypeEnum.answerNode,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/reply.png',
|
avatar: 'core/workflow/template/reply',
|
||||||
name: '指定回复',
|
name: '指定回复',
|
||||||
intro:
|
intro:
|
||||||
'该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。',
|
'该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。',
|
||||||
|
|||||||
@@ -2,30 +2,30 @@ import {
|
|||||||
FlowNodeInputTypeEnum,
|
FlowNodeInputTypeEnum,
|
||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeOutputKeyEnum
|
NodeOutputKeyEnum
|
||||||
} from '../../constants';
|
} from '../../../constants';
|
||||||
import {
|
import {
|
||||||
Input_Template_SelectAIModel,
|
Input_Template_SelectAIModel,
|
||||||
Input_Template_History,
|
Input_Template_History,
|
||||||
Input_Template_UserChatInput
|
Input_Template_UserChatInput
|
||||||
} from '../input';
|
} from '../../input';
|
||||||
import { Input_Template_System_Prompt } from '../input';
|
import { Input_Template_System_Prompt } from '../../input';
|
||||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.classifyQuestion,
|
id: FlowNodeTypeEnum.classifyQuestion,
|
||||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
flowNodeType: FlowNodeTypeEnum.classifyQuestion,
|
flowNodeType: FlowNodeTypeEnum.classifyQuestion,
|
||||||
sourceHandle: getHandleConfig(false, false, false, false),
|
sourceHandle: getHandleConfig(false, false, false, false),
|
||||||
targetHandle: getHandleConfig(true, false, true, true),
|
targetHandle: getHandleConfig(true, false, true, true),
|
||||||
avatar: '/imgs/workflow/cq.png',
|
avatar: 'core/workflow/template/questionClassify',
|
||||||
name: '问题分类',
|
name: '问题分类',
|
||||||
intro: `根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品“使用”问题\n类型3: 关于商品“购买”问题\n类型4: 其他问题`,
|
intro: `根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品“使用”问题\n类型3: 关于商品“购买”问题\n类型4: 其他问题`,
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
4
packages/global/core/workflow/template/system/classifyQuestion/type.d.ts
vendored
Normal file
4
packages/global/core/workflow/template/system/classifyQuestion/type.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export type ClassifyQuestionAgentItemType = {
|
||||||
|
value: string;
|
||||||
|
key: string;
|
||||||
|
};
|
||||||
@@ -2,25 +2,25 @@ import {
|
|||||||
FlowNodeInputTypeEnum,
|
FlowNodeInputTypeEnum,
|
||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
NodeOutputKeyEnum,
|
NodeOutputKeyEnum,
|
||||||
FlowNodeTemplateTypeEnum
|
FlowNodeTemplateTypeEnum
|
||||||
} from '../../constants';
|
} from '../../../constants';
|
||||||
import { Input_Template_SelectAIModel, Input_Template_History } from '../input';
|
import { Input_Template_SelectAIModel, Input_Template_History } from '../../input';
|
||||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const ContextExtractModule: FlowNodeTemplateType = {
|
export const ContextExtractModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.contentExtract,
|
id: FlowNodeTypeEnum.contentExtract,
|
||||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
flowNodeType: FlowNodeTypeEnum.contentExtract,
|
flowNodeType: FlowNodeTypeEnum.contentExtract,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/extract.png',
|
avatar: 'core/workflow/template/extractJson',
|
||||||
name: '文本内容提取',
|
name: '文本内容提取',
|
||||||
intro: '可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等',
|
intro: '可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
8
packages/global/core/workflow/template/system/contextExtract/type.d.ts
vendored
Normal file
8
packages/global/core/workflow/template/system/contextExtract/type.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
export type ContextExtractAgentItemType = {
|
||||||
|
valueType: 'string' | 'number' | 'boolean';
|
||||||
|
desc: string;
|
||||||
|
key: string;
|
||||||
|
required: boolean;
|
||||||
|
defaultValue?: string;
|
||||||
|
enum?: string;
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
|
import {
|
||||||
|
WorkflowIOValueTypeEnum,
|
||||||
|
FlowNodeTemplateTypeEnum,
|
||||||
|
NodeInputKeyEnum
|
||||||
|
} from '../../constants';
|
||||||
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
|
export const CustomFeedbackNode: FlowNodeTemplateType = {
|
||||||
|
id: FlowNodeTypeEnum.customFeedback,
|
||||||
|
templateType: FlowNodeTemplateTypeEnum.other,
|
||||||
|
flowNodeType: FlowNodeTypeEnum.customFeedback,
|
||||||
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
|
avatar: 'core/workflow/template/customFeedback',
|
||||||
|
name: '自定义反馈',
|
||||||
|
intro: '该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。',
|
||||||
|
version: '486',
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
key: NodeInputKeyEnum.textareaInput,
|
||||||
|
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||||
|
valueType: WorkflowIOValueTypeEnum.string,
|
||||||
|
required: true,
|
||||||
|
label: '反馈的文本'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outputs: []
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -27,8 +27,7 @@ export const getOneQuoteInputTemplate = ({
|
|||||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||||
label: `引用${index}`,
|
label: `引用${index}`,
|
||||||
debugLabel: '知识库引用',
|
debugLabel: '知识库引用',
|
||||||
canEdit: key !== defaultQuoteKey,
|
canEdit: true,
|
||||||
description: '',
|
|
||||||
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -38,11 +37,11 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
|||||||
templateType: FlowNodeTemplateTypeEnum.other,
|
templateType: FlowNodeTemplateTypeEnum.other,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/concat.svg',
|
avatar: 'core/workflow/template/datasetConcat',
|
||||||
name: '知识库搜索引用合并',
|
name: '知识库搜索引用合并',
|
||||||
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
|
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '481',
|
version: '486',
|
||||||
inputs: [
|
inputs: [
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||||
@@ -52,11 +51,11 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
|||||||
valueType: WorkflowIOValueTypeEnum.number
|
valueType: WorkflowIOValueTypeEnum.number
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'customComponent',
|
key: NodeInputKeyEnum.datasetQuoteList,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||||
label: ''
|
label: ''
|
||||||
},
|
}
|
||||||
getOneQuoteInputTemplate({ key: defaultQuoteKey, index: 1 })
|
// getOneQuoteInputTemplate({ key: defaultQuoteKey, index: 1 })
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -19,11 +19,11 @@ export const Dataset_SEARCH_DESC =
|
|||||||
|
|
||||||
export const DatasetSearchModule: FlowNodeTemplateType = {
|
export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.datasetSearchNode,
|
id: FlowNodeTypeEnum.datasetSearchNode,
|
||||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
flowNodeType: FlowNodeTypeEnum.datasetSearchNode,
|
flowNodeType: FlowNodeTypeEnum.datasetSearchNode,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/db.png',
|
avatar: 'core/workflow/template/datasetSearch',
|
||||||
name: '知识库搜索',
|
name: '知识库搜索',
|
||||||
intro: Dataset_SEARCH_DESC,
|
intro: Dataset_SEARCH_DESC,
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -14,13 +14,13 @@ import { Input_Template_DynamicInput } from '../input';
|
|||||||
import { Output_Template_AddOutput } from '../output';
|
import { Output_Template_AddOutput } from '../output';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const HttpModule468: FlowNodeTemplateType = {
|
export const HttpNode468: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.httpRequest468,
|
id: FlowNodeTypeEnum.httpRequest468,
|
||||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||||
flowNodeType: FlowNodeTypeEnum.httpRequest468,
|
flowNodeType: FlowNodeTypeEnum.httpRequest468,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/http.png',
|
avatar: 'core/workflow/template/httpRequest',
|
||||||
name: 'HTTP 请求',
|
name: 'HTTP 请求',
|
||||||
intro: '可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)',
|
intro: '可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
@@ -30,9 +30,10 @@ export const HttpModule468: FlowNodeTemplateType = {
|
|||||||
{
|
{
|
||||||
...Input_Template_DynamicInput,
|
...Input_Template_DynamicInput,
|
||||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
description: 'core.module.input.description.HTTP Dynamic Input',
|
||||||
editField: {
|
customInputConfig: {
|
||||||
key: true,
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
valueType: true
|
showDescription: false,
|
||||||
|
showDefaultValue: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,9 @@ export const HttpModule468: FlowNodeTemplateType = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
outputs: [
|
outputs: [
|
||||||
Output_Template_AddOutput,
|
{
|
||||||
|
...Output_Template_AddOutput
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: NodeOutputKeyEnum.error,
|
id: NodeOutputKeyEnum.error,
|
||||||
key: NodeOutputKeyEnum.error,
|
key: NodeOutputKeyEnum.error,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type';
|
import { FlowNodeTemplateType } from '../../../type/node';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const IfElseNode: FlowNodeTemplateType = {
|
export const IfElseNode: FlowNodeTemplateType = {
|
||||||
@@ -18,7 +18,7 @@ export const IfElseNode: FlowNodeTemplateType = {
|
|||||||
flowNodeType: FlowNodeTypeEnum.ifElseNode,
|
flowNodeType: FlowNodeTypeEnum.ifElseNode,
|
||||||
sourceHandle: getHandleConfig(false, false, false, false),
|
sourceHandle: getHandleConfig(false, false, false, false),
|
||||||
targetHandle: getHandleConfig(true, false, true, true),
|
targetHandle: getHandleConfig(true, false, true, true),
|
||||||
avatar: '/imgs/workflow/ifElse.svg',
|
avatar: 'core/workflow/template/ifelse',
|
||||||
name: '判断器',
|
name: '判断器',
|
||||||
intro: '根据一定的条件,执行不同的分支。',
|
intro: '根据一定的条件,执行不同的分支。',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -14,13 +14,19 @@ import { Input_Template_DynamicInput } from '../input';
|
|||||||
import { Output_Template_AddOutput } from '../output';
|
import { Output_Template_AddOutput } from '../output';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
|
export const nodeLafCustomInputConfig = {
|
||||||
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
|
showDescription: false,
|
||||||
|
showDefaultValue: true
|
||||||
|
};
|
||||||
|
|
||||||
export const LafModule: FlowNodeTemplateType = {
|
export const LafModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.lafModule,
|
id: FlowNodeTypeEnum.lafModule,
|
||||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
templateType: FlowNodeTemplateTypeEnum.other,
|
||||||
flowNodeType: FlowNodeTypeEnum.lafModule,
|
flowNodeType: FlowNodeTypeEnum.lafModule,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/laf.png',
|
avatar: 'core/workflow/template/lafDispatch',
|
||||||
name: 'Laf 函数调用(测试)',
|
name: 'Laf 函数调用(测试)',
|
||||||
intro: '可以调用Laf账号下的云函数。',
|
intro: '可以调用Laf账号下的云函数。',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
@@ -30,10 +36,7 @@ export const LafModule: FlowNodeTemplateType = {
|
|||||||
{
|
{
|
||||||
...Input_Template_DynamicInput,
|
...Input_Template_DynamicInput,
|
||||||
description: '接收前方节点的输出值作为变量,这些变量可以被 Laf 请求参数使用。',
|
description: '接收前方节点的输出值作为变量,这些变量可以被 Laf 请求参数使用。',
|
||||||
editField: {
|
customInputConfig: nodeLafCustomInputConfig
|
||||||
key: true,
|
|
||||||
valueType: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.httpReqUrl,
|
key: NodeInputKeyEnum.httpReqUrl,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const PluginInputModule: FlowNodeTemplateType = {
|
export const PluginInputModule: FlowNodeTemplateType = {
|
||||||
@@ -11,9 +11,9 @@ export const PluginInputModule: FlowNodeTemplateType = {
|
|||||||
targetHandle: getHandleConfig(false, false, false, false),
|
targetHandle: getHandleConfig(false, false, false, false),
|
||||||
unique: true,
|
unique: true,
|
||||||
forbidDelete: true,
|
forbidDelete: true,
|
||||||
avatar: '/imgs/workflow/input.png',
|
avatar: 'core/workflow/template/workflowStart',
|
||||||
name: '自定义插件输入',
|
name: '插件输入',
|
||||||
intro: '自定义配置外部输入,使用插件时,仅暴露自定义配置的输入',
|
intro: '可以配置插件需要哪些输入,利用这些输入来运行插件',
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
version: '481',
|
version: '481',
|
||||||
inputs: [],
|
inputs: [],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const PluginOutputModule: FlowNodeTemplateType = {
|
export const PluginOutputModule: FlowNodeTemplateType = {
|
||||||
@@ -11,7 +11,7 @@ export const PluginOutputModule: FlowNodeTemplateType = {
|
|||||||
targetHandle: getHandleConfig(false, false, false, true),
|
targetHandle: getHandleConfig(false, false, false, true),
|
||||||
unique: true,
|
unique: true,
|
||||||
forbidDelete: true,
|
forbidDelete: true,
|
||||||
avatar: '/imgs/workflow/output.png',
|
avatar: 'core/workflow/template/pluginOutput',
|
||||||
name: '自定义插件输出',
|
name: '自定义插件输出',
|
||||||
intro: '自定义配置外部输出,使用插件时,仅暴露自定义配置的输出',
|
intro: '自定义配置外部输出,使用插件时,仅暴露自定义配置的输出',
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -19,12 +19,12 @@ import { LLMModelTypeEnum } from '../../../ai/constants';
|
|||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const AiQueryExtension: FlowNodeTemplateType = {
|
export const AiQueryExtension: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.chatNode,
|
id: FlowNodeTypeEnum.queryExtension,
|
||||||
templateType: FlowNodeTemplateTypeEnum.other,
|
templateType: FlowNodeTemplateTypeEnum.other,
|
||||||
flowNodeType: FlowNodeTypeEnum.queryExtension,
|
flowNodeType: FlowNodeTypeEnum.queryExtension,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/cfr.svg',
|
avatar: 'core/workflow/template/queryExtension',
|
||||||
name: '问题优化',
|
name: '问题优化',
|
||||||
intro:
|
intro:
|
||||||
'使用问题优化功能,可以提高知识库连续对话时搜索的精度。使用该功能后,会先利用 AI 根据上下文构建一个或多个新的检索词,这些检索词更利于进行知识库搜索。该模块已内置在知识库搜索模块中,如果您仅进行一次知识库搜索,可直接使用知识库内置的补全功能。',
|
'使用问题优化功能,可以提高知识库连续对话时搜索的精度。使用该功能后,会先利用 AI 根据上下文构建一个或多个新的检索词,这些检索词更利于进行知识库搜索。该模块已内置在知识库搜索模块中,如果您仅进行一次知识库搜索,可直接使用知识库内置的补全功能。',
|
||||||
|
|||||||
@@ -2,24 +2,24 @@ import {
|
|||||||
FlowNodeInputTypeEnum,
|
FlowNodeInputTypeEnum,
|
||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
NodeOutputKeyEnum,
|
NodeOutputKeyEnum,
|
||||||
FlowNodeTemplateTypeEnum
|
FlowNodeTemplateTypeEnum
|
||||||
} from '../../constants';
|
} from '../../../constants';
|
||||||
import { Input_Template_History, Input_Template_UserChatInput } from '../input';
|
import { Input_Template_History, Input_Template_UserChatInput } from '../../input';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
|
|
||||||
export const RunAppModule: FlowNodeTemplateType = {
|
export const RunAppModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.runApp,
|
id: FlowNodeTypeEnum.runApp,
|
||||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||||
flowNodeType: FlowNodeTypeEnum.runApp,
|
flowNodeType: FlowNodeTypeEnum.runApp,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/app.png',
|
avatar: 'core/workflow/template/runApp',
|
||||||
name: '应用调用',
|
name: '应用调用',
|
||||||
intro: '可以选择一个其他应用进行调用',
|
intro: '可以选择一个其他应用进行调用',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
5
packages/global/core/workflow/template/system/runApp/type.d.ts
vendored
Normal file
5
packages/global/core/workflow/template/system/runApp/type.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export type SelectAppItemType = {
|
||||||
|
id: string;
|
||||||
|
// name: string;
|
||||||
|
// logo?: string;
|
||||||
|
};
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const RunPluginModule: FlowNodeTemplateType = {
|
export const RunPluginModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.pluginModule,
|
id: FlowNodeTypeEnum.pluginModule,
|
||||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
templateType: FlowNodeTemplateTypeEnum.other,
|
||||||
flowNodeType: FlowNodeTypeEnum.pluginModule,
|
flowNodeType: FlowNodeTypeEnum.pluginModule,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type';
|
import { FlowNodeTemplateType } from '../../../type/node';
|
||||||
import { getHandleConfig } from '../../utils';
|
import { getHandleConfig } from '../../utils';
|
||||||
import { Input_Template_DynamicInput } from '../../input';
|
import { Input_Template_DynamicInput } from '../../input';
|
||||||
import { Output_Template_AddOutput } from '../../output';
|
import { Output_Template_AddOutput } from '../../output';
|
||||||
@@ -21,7 +21,7 @@ export const CodeNode: FlowNodeTemplateType = {
|
|||||||
flowNodeType: FlowNodeTypeEnum.code,
|
flowNodeType: FlowNodeTypeEnum.code,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/code.svg',
|
avatar: 'core/workflow/template/codeRun',
|
||||||
name: '代码运行',
|
name: '代码运行',
|
||||||
intro: '执行一段简单的脚本代码,通常用于进行复杂的数据处理。',
|
intro: '执行一段简单的脚本代码,通常用于进行复杂的数据处理。',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
@@ -30,11 +30,38 @@ export const CodeNode: FlowNodeTemplateType = {
|
|||||||
{
|
{
|
||||||
...Input_Template_DynamicInput,
|
...Input_Template_DynamicInput,
|
||||||
description: '这些变量会作为代码的运行的输入参数',
|
description: '这些变量会作为代码的运行的输入参数',
|
||||||
editField: {
|
customInputConfig: {
|
||||||
key: true,
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
valueType: true
|
showDescription: false,
|
||||||
|
showDefaultValue: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||||
|
valueType: WorkflowIOValueTypeEnum.string,
|
||||||
|
canEdit: true,
|
||||||
|
key: 'data1',
|
||||||
|
label: 'data1',
|
||||||
|
customInputConfig: {
|
||||||
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
|
showDescription: false,
|
||||||
|
showDefaultValue: true
|
||||||
|
},
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||||
|
valueType: WorkflowIOValueTypeEnum.string,
|
||||||
|
canEdit: true,
|
||||||
|
key: 'data2',
|
||||||
|
label: 'data2',
|
||||||
|
customInputConfig: {
|
||||||
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
|
showDescription: false,
|
||||||
|
showDefaultValue: true
|
||||||
|
},
|
||||||
|
required: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: NodeInputKeyEnum.codeType,
|
key: NodeInputKeyEnum.codeType,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||||
@@ -51,7 +78,7 @@ export const CodeNode: FlowNodeTemplateType = {
|
|||||||
outputs: [
|
outputs: [
|
||||||
{
|
{
|
||||||
...Output_Template_AddOutput,
|
...Output_Template_AddOutput,
|
||||||
description: '将代码中 return 的对象作为输出,传递给后续的节点'
|
description: '将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: NodeOutputKeyEnum.rawResponse,
|
id: NodeOutputKeyEnum.rawResponse,
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type';
|
import { FlowNodeTemplateType } from '../../type/node';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
export const StopToolNode: FlowNodeTemplateType = {
|
export const StopToolNode: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.stopTool,
|
id: FlowNodeTypeEnum.stopTool,
|
||||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
flowNodeType: FlowNodeTypeEnum.stopTool,
|
flowNodeType: FlowNodeTypeEnum.stopTool,
|
||||||
sourceHandle: getHandleConfig(false, false, false, false),
|
sourceHandle: getHandleConfig(false, false, false, false),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/toolStop.svg',
|
avatar: 'core/workflow/template/stopTool',
|
||||||
name: '工具调用终止',
|
name: '工具调用终止',
|
||||||
intro:
|
intro:
|
||||||
'该模块需配置工具调用使用。当该模块被执行时,本次工具调用将会强制结束,并且不再调用AI针对工具调用结果回答问题。',
|
'该模块需配置工具调用使用。当该模块被执行时,本次工具调用将会强制结束,并且不再调用AI针对工具调用结果回答问题。',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ export const SystemConfigNode: FlowNodeTemplateType = {
|
|||||||
flowNodeType: FlowNodeTypeEnum.systemConfig,
|
flowNodeType: FlowNodeTypeEnum.systemConfig,
|
||||||
sourceHandle: getHandleConfig(false, false, false, false),
|
sourceHandle: getHandleConfig(false, false, false, false),
|
||||||
targetHandle: getHandleConfig(false, false, false, false),
|
targetHandle: getHandleConfig(false, false, false, false),
|
||||||
avatar: '/imgs/workflow/userGuide.png',
|
avatar: 'core/workflow/template/systemConfig',
|
||||||
name: '系统配置',
|
name: '系统配置',
|
||||||
intro: '可以配置应用的系统参数。',
|
intro: '可以配置应用的系统参数。',
|
||||||
unique: true,
|
unique: true,
|
||||||
|
|||||||
54
packages/global/core/workflow/template/system/textEditor.ts
Normal file
54
packages/global/core/workflow/template/system/textEditor.ts
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import {
|
||||||
|
FlowNodeInputTypeEnum,
|
||||||
|
FlowNodeOutputTypeEnum,
|
||||||
|
FlowNodeTypeEnum
|
||||||
|
} from '../../node/constant';
|
||||||
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
|
import {
|
||||||
|
WorkflowIOValueTypeEnum,
|
||||||
|
NodeOutputKeyEnum,
|
||||||
|
FlowNodeTemplateTypeEnum,
|
||||||
|
NodeInputKeyEnum
|
||||||
|
} from '../../constants';
|
||||||
|
import { getHandleConfig } from '../utils';
|
||||||
|
import { Input_Template_DynamicInput } from '../input';
|
||||||
|
|
||||||
|
export const TextEditorNode: FlowNodeTemplateType = {
|
||||||
|
id: FlowNodeTypeEnum.textEditor,
|
||||||
|
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||||
|
flowNodeType: FlowNodeTypeEnum.textEditor,
|
||||||
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
|
avatar: 'core/workflow/template/textConcat',
|
||||||
|
name: '文本拼接',
|
||||||
|
intro: '可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。',
|
||||||
|
version: '486',
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
...Input_Template_DynamicInput,
|
||||||
|
description: '可以引用其他节点的输出,作为文本拼接的变量,通过 {{字段名}} 来引用变量',
|
||||||
|
customInputConfig: {
|
||||||
|
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||||
|
showDescription: false,
|
||||||
|
showDefaultValue: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: NodeInputKeyEnum.textareaInput,
|
||||||
|
renderTypeList: [FlowNodeInputTypeEnum.textarea],
|
||||||
|
valueType: WorkflowIOValueTypeEnum.string,
|
||||||
|
required: true,
|
||||||
|
label: '拼接文本',
|
||||||
|
placeholder: '可通过 {{字段名}} 来引用变量'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{
|
||||||
|
id: NodeOutputKeyEnum.text,
|
||||||
|
key: NodeOutputKeyEnum.text,
|
||||||
|
label: '拼接结果',
|
||||||
|
type: FlowNodeOutputTypeEnum.static,
|
||||||
|
valueType: WorkflowIOValueTypeEnum.string
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeOutputKeyEnum,
|
NodeOutputKeyEnum,
|
||||||
@@ -23,11 +23,11 @@ import { getHandleConfig } from '../utils';
|
|||||||
export const ToolModule: FlowNodeTemplateType = {
|
export const ToolModule: FlowNodeTemplateType = {
|
||||||
id: FlowNodeTypeEnum.tools,
|
id: FlowNodeTypeEnum.tools,
|
||||||
flowNodeType: FlowNodeTypeEnum.tools,
|
flowNodeType: FlowNodeTypeEnum.tools,
|
||||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||||
sourceHandle: getHandleConfig(true, true, false, true),
|
sourceHandle: getHandleConfig(true, true, false, true),
|
||||||
targetHandle: getHandleConfig(true, true, false, true),
|
targetHandle: getHandleConfig(true, true, false, true),
|
||||||
avatar: '/imgs/workflow/tool.svg',
|
avatar: 'core/workflow/template/toolCall',
|
||||||
name: '工具调用(实验)',
|
name: '工具调用',
|
||||||
intro: '通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。',
|
intro: '通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。',
|
||||||
showStatus: true,
|
showStatus: true,
|
||||||
version: '481',
|
version: '481',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/index.d';
|
import { FlowNodeTemplateType } from '../../../type/node.d';
|
||||||
import {
|
import {
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -13,7 +13,7 @@ export const VariableUpdateNode: FlowNodeTemplateType = {
|
|||||||
flowNodeType: FlowNodeTypeEnum.variableUpdate,
|
flowNodeType: FlowNodeTypeEnum.variableUpdate,
|
||||||
sourceHandle: getHandleConfig(true, true, true, true),
|
sourceHandle: getHandleConfig(true, true, true, true),
|
||||||
targetHandle: getHandleConfig(true, true, true, true),
|
targetHandle: getHandleConfig(true, true, true, true),
|
||||||
avatar: '/imgs/workflow/variable.png',
|
avatar: 'core/workflow/template/variableUpdate',
|
||||||
name: '变量更新',
|
name: '变量更新',
|
||||||
intro: '可以更新指定节点的输出值或更新全局变量',
|
intro: '可以更新指定节点的输出值或更新全局变量',
|
||||||
showStatus: false,
|
showStatus: false,
|
||||||
@@ -25,10 +25,6 @@ export const VariableUpdateNode: FlowNodeTemplateType = {
|
|||||||
valueType: WorkflowIOValueTypeEnum.any,
|
valueType: WorkflowIOValueTypeEnum.any,
|
||||||
label: '',
|
label: '',
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||||
editField: {
|
|
||||||
key: true,
|
|
||||||
valueType: true
|
|
||||||
},
|
|
||||||
value: [
|
value: [
|
||||||
{
|
{
|
||||||
variable: ['', ''],
|
variable: ['', ''],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeOutputKeyEnum,
|
NodeOutputKeyEnum,
|
||||||
@@ -14,7 +14,7 @@ export const WorkflowStart: FlowNodeTemplateType = {
|
|||||||
flowNodeType: FlowNodeTypeEnum.workflowStart,
|
flowNodeType: FlowNodeTypeEnum.workflowStart,
|
||||||
sourceHandle: getHandleConfig(false, true, false, false),
|
sourceHandle: getHandleConfig(false, true, false, false),
|
||||||
targetHandle: getHandleConfig(false, false, false, false),
|
targetHandle: getHandleConfig(false, false, false, false),
|
||||||
avatar: '/imgs/workflow/userChatInput.svg',
|
avatar: 'core/workflow/template/workflowStart',
|
||||||
name: '流程开始',
|
name: '流程开始',
|
||||||
intro: '',
|
intro: '',
|
||||||
forbidDelete: true,
|
forbidDelete: true,
|
||||||
@@ -31,3 +31,6 @@ export const WorkflowStart: FlowNodeTemplateType = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isWorkflowStartOutput = (key?: string) =>
|
||||||
|
!!WorkflowStart.outputs.find((output) => output.key === key);
|
||||||
|
|||||||
14
packages/global/core/workflow/type/fe.d.ts
vendored
14
packages/global/core/workflow/type/fe.d.ts
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io';
|
||||||
|
|
||||||
export type FlowNodeChangeProps = { nodeId: string } & (
|
export type FlowNodeChangeProps = { nodeId: string } & (
|
||||||
| {
|
| {
|
||||||
type: 'attr'; // key: attr, value: new value
|
type: 'attr'; // key: attr, value: new value
|
||||||
@@ -7,16 +9,16 @@ export type FlowNodeChangeProps = { nodeId: string } & (
|
|||||||
| {
|
| {
|
||||||
type: 'updateInput'; // key: update input key, value: new input value
|
type: 'updateInput'; // key: update input key, value: new input value
|
||||||
key: string;
|
key: string;
|
||||||
value: any;
|
value: FlowNodeInputItemType;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'replaceInput'; // key: old input key, value: new input value
|
type: 'replaceInput'; // key: old input key, value: new input value
|
||||||
key: string;
|
key: string;
|
||||||
value: any;
|
value: FlowNodeInputItemType;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'addInput'; // key: null, value: new input value
|
type: 'addInput'; // key: null, value: new input value
|
||||||
value: any;
|
value: FlowNodeInputItemType;
|
||||||
index?: number;
|
index?: number;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
@@ -26,16 +28,16 @@ export type FlowNodeChangeProps = { nodeId: string } & (
|
|||||||
| {
|
| {
|
||||||
type: 'updateOutput'; // key: update output key, value: new output value
|
type: 'updateOutput'; // key: update output key, value: new output value
|
||||||
key: string;
|
key: string;
|
||||||
value: any;
|
value: FlowNodeOutputItemType;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'replaceOutput'; // key: old output key, value: new output value
|
type: 'replaceOutput'; // key: old output key, value: new output value
|
||||||
key: string;
|
key: string;
|
||||||
value: any;
|
value: FlowNodeOutputItemType;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'addOutput'; // key: null, value: new output value
|
type: 'addOutput'; // key: null, value: new output value
|
||||||
value: any;
|
value: FlowNodeOutputItemType;
|
||||||
index?: number;
|
index?: number;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
|||||||
162
packages/global/core/workflow/type/index.d.ts
vendored
162
packages/global/core/workflow/type/index.d.ts
vendored
@@ -6,148 +6,66 @@ import {
|
|||||||
VariableInputEnum
|
VariableInputEnum
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
|
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
import { CustomInputItemType, FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
||||||
import { UserModelSchema } from '../../../support/user/type';
|
|
||||||
import {
|
import {
|
||||||
ChatHistoryItemResType,
|
ChatHistoryItemResType,
|
||||||
ChatItemType,
|
ChatItemType,
|
||||||
ChatItemValueItemType,
|
ChatItemValueItemType,
|
||||||
ToolRunResponseItemType,
|
ToolRunResponseItemType
|
||||||
UserChatItemValueItemType
|
|
||||||
} from '../../chat/type';
|
} from '../../chat/type';
|
||||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||||
import { RuntimeNodeItemType } from '../runtime/type';
|
|
||||||
import { PluginTypeEnum } from '../../plugin/constants';
|
import { PluginTypeEnum } from '../../plugin/constants';
|
||||||
import { RuntimeEdgeItemType, StoreEdgeItemType } from './edge';
|
import { StoreEdgeItemType } from './edge';
|
||||||
import { NextApiResponse } from 'next';
|
import { AppChatConfigType } from '../../app/type';
|
||||||
import { AppDetailType, AppSchema } from '../../app/type';
|
|
||||||
import { ParentIdType } from 'common/parentFolder/type';
|
import { ParentIdType } from 'common/parentFolder/type';
|
||||||
import { AppTypeEnum } from 'core/app/constants';
|
import { AppTypeEnum } from 'core/app/constants';
|
||||||
|
import { FlowNodeTemplateType, StoreNodeItemType } from './node';
|
||||||
|
|
||||||
export type FlowNodeCommonType = {
|
export type WorkflowTemplateBasicType = {
|
||||||
flowNodeType: FlowNodeTypeEnum; // render node card
|
nodes: StoreNodeItemType[];
|
||||||
|
edges: StoreEdgeItemType[];
|
||||||
|
chatConfigs?: AppChatConfigType;
|
||||||
|
};
|
||||||
|
export type WorkflowTemplateType = {
|
||||||
|
id: string;
|
||||||
|
parentId?: string;
|
||||||
|
isFolder?: boolean;
|
||||||
|
|
||||||
avatar?: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
intro?: string; // template list intro
|
avatar: string;
|
||||||
showStatus?: boolean; // chatting response step status
|
intro?: string;
|
||||||
|
author?: string;
|
||||||
|
inputExplanationUrl?: string;
|
||||||
version: string;
|
version: string;
|
||||||
|
|
||||||
// data
|
showStatus?: boolean;
|
||||||
inputs: FlowNodeInputItemType[];
|
weight?: number;
|
||||||
outputs: FlowNodeOutputItemType[];
|
|
||||||
|
|
||||||
// plugin data
|
workflow: WorkflowTemplateBasicType;
|
||||||
pluginId?: string;
|
|
||||||
pluginType?: AppTypeEnum;
|
|
||||||
// parentId: ParentIdType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FlowNodeTemplateType = FlowNodeCommonType & {
|
// template market
|
||||||
id: string; // node id, unique
|
export type TemplateMarketItemType = WorkflowTemplateType & {
|
||||||
templateType: `${FlowNodeTemplateTypeEnum}`;
|
tags?: { id: string; label: string }[];
|
||||||
|
|
||||||
// show handle
|
|
||||||
sourceHandle?: {
|
|
||||||
left: boolean;
|
|
||||||
right: boolean;
|
|
||||||
top: boolean;
|
|
||||||
bottom: boolean;
|
|
||||||
};
|
|
||||||
targetHandle?: {
|
|
||||||
left: boolean;
|
|
||||||
right: boolean;
|
|
||||||
top: boolean;
|
|
||||||
bottom: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
// info
|
|
||||||
isTool?: boolean; // can be connected by tool
|
|
||||||
|
|
||||||
// action
|
|
||||||
forbidDelete?: boolean; // forbid delete
|
|
||||||
unique?: boolean;
|
|
||||||
};
|
|
||||||
export type FlowNodeItemType = FlowNodeTemplateType & {
|
|
||||||
nodeId: string;
|
|
||||||
isError?: boolean;
|
|
||||||
debugResult?: {
|
|
||||||
status: 'running' | 'success' | 'skipped' | 'failed';
|
|
||||||
message?: string;
|
|
||||||
showResult?: boolean; // show and hide result modal
|
|
||||||
response?: ChatHistoryItemResType;
|
|
||||||
isExpired?: boolean;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export type nodeTemplateListType = {
|
|
||||||
type: `${FlowNodeTemplateTypeEnum}`;
|
|
||||||
label: string;
|
|
||||||
list: FlowNodeTemplateType[];
|
|
||||||
}[];
|
|
||||||
|
|
||||||
// store node type
|
|
||||||
export type StoreNodeItemType = FlowNodeCommonType & {
|
|
||||||
nodeId: string;
|
|
||||||
position?: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* connection type */
|
// system plugin
|
||||||
export type NodeTargetNodeItemType = {
|
export type SystemPluginTemplateItemType = WorkflowTemplateType & {
|
||||||
nodeId: string;
|
templateType: FlowNodeTemplateTypeEnum;
|
||||||
sourceHandle: string;
|
isTool?: boolean;
|
||||||
targetHandle: string;
|
|
||||||
};
|
|
||||||
export type NodeSourceNodeItemType = {
|
|
||||||
nodeId: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* --------------- function type -------------------- */
|
// commercial plugin config
|
||||||
export type SelectAppItemType = {
|
originCost: number; // n points/one time
|
||||||
id: string;
|
currentCost: number;
|
||||||
// name: string;
|
|
||||||
// logo?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* agent */
|
isActive?: boolean;
|
||||||
export type ClassifyQuestionAgentItemType = {
|
inputConfig?: {
|
||||||
value: string;
|
// Render config input form. Find the corresponding node and replace the variable directly
|
||||||
key: string;
|
key: string;
|
||||||
};
|
label: string;
|
||||||
export type ContextExtractAgentItemType = {
|
description: string;
|
||||||
valueType: 'string' | 'number' | 'boolean';
|
value?: any;
|
||||||
desc: string;
|
}[];
|
||||||
key: string;
|
|
||||||
required: boolean;
|
|
||||||
defaultValue?: string;
|
|
||||||
enum?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* -------------- running module -------------- */
|
workflow: WorkflowTemplateBasicType;
|
||||||
|
|
||||||
export type ChatDispatchProps = {
|
|
||||||
res?: NextApiResponse;
|
|
||||||
mode: 'test' | 'chat' | 'debug';
|
|
||||||
teamId: string;
|
|
||||||
tmbId: string;
|
|
||||||
user: UserModelSchema;
|
|
||||||
app: AppDetailType | AppSchema;
|
|
||||||
chatId?: string;
|
|
||||||
responseChatItemId?: string;
|
|
||||||
histories: ChatItemType[];
|
|
||||||
variables: Record<string, any>; // global variable
|
|
||||||
query: UserChatItemValueItemType[]; // trigger query
|
|
||||||
stream: boolean;
|
|
||||||
detail: boolean; // response detail
|
|
||||||
maxRunTimes: number;
|
|
||||||
isToolCall?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
|
||||||
node: RuntimeNodeItemType;
|
|
||||||
runtimeNodes: RuntimeNodeItemType[];
|
|
||||||
runtimeEdges: RuntimeEdgeItemType[];
|
|
||||||
params: T;
|
|
||||||
};
|
};
|
||||||
|
|||||||
64
packages/global/core/workflow/type/io.d.ts
vendored
64
packages/global/core/workflow/type/io.d.ts
vendored
@@ -1,9 +1,43 @@
|
|||||||
import { LLMModelTypeEnum } from '../../ai/constants';
|
import { LLMModelTypeEnum } from '../../ai/constants';
|
||||||
import { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
import { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../node/constant';
|
||||||
import { EditInputFieldMapType, EditNodeFieldType, EditOutputFieldMapType } from '../node/type';
|
|
||||||
|
|
||||||
export type FlowNodeInputItemType = {
|
// Dynamic input field configuration
|
||||||
|
export type CustomFieldConfigType = {
|
||||||
|
// selectInputTypeList: FlowNodeInputTypeEnum[]; // 可以选哪些输入类型, 只有1个话,则默认选择
|
||||||
|
|
||||||
|
// reference
|
||||||
|
selectValueTypeList?: WorkflowIOValueTypeEnum[]; // 可以选哪个数据类型, 只有1个的话,则默认选择
|
||||||
|
|
||||||
|
// showIsToolParam?: boolean; // 是否作为工具参数
|
||||||
|
|
||||||
|
// showRequired?: boolean;
|
||||||
|
// defaultRequired?: boolean;
|
||||||
|
|
||||||
|
showDefaultValue?: boolean;
|
||||||
|
showDescription?: boolean;
|
||||||
|
};
|
||||||
|
export type InputComponentPropsType = {
|
||||||
|
referencePlaceholder?: string;
|
||||||
|
placeholder?: string; // input,textarea
|
||||||
|
maxLength?: number; // input,textarea
|
||||||
|
|
||||||
|
list?: { label: string; value: string }[]; // select
|
||||||
|
|
||||||
|
markList?: { label: string; value: number }[]; // slider
|
||||||
|
step?: number; // slider
|
||||||
|
max?: number; // slider, number input
|
||||||
|
min?: number; // slider, number input
|
||||||
|
|
||||||
|
defaultValue?: string;
|
||||||
|
|
||||||
|
llmModelType?: `${LLMModelTypeEnum}`;
|
||||||
|
|
||||||
|
// dynamic input
|
||||||
|
customInputConfig?: CustomFieldConfigType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type FlowNodeInputItemType = InputComponentPropsType & {
|
||||||
selectedTypeIndex?: number;
|
selectedTypeIndex?: number;
|
||||||
renderTypeList: FlowNodeInputTypeEnum[]; // Node Type. Decide on a render style
|
renderTypeList: FlowNodeInputTypeEnum[]; // Node Type. Decide on a render style
|
||||||
|
|
||||||
@@ -16,29 +50,8 @@ export type FlowNodeInputItemType = {
|
|||||||
required?: boolean;
|
required?: boolean;
|
||||||
toolDescription?: string; // If this field is not empty, it is entered as a tool
|
toolDescription?: string; // If this field is not empty, it is entered as a tool
|
||||||
|
|
||||||
maxLength?: number; // input,textarea
|
|
||||||
|
|
||||||
// edit
|
|
||||||
canEdit?: boolean;
|
|
||||||
|
|
||||||
// render components params
|
// render components params
|
||||||
referencePlaceholder?: string;
|
canEdit?: boolean; // dynamic inputs
|
||||||
placeholder?: string; // input,textarea
|
|
||||||
|
|
||||||
list?: { label: string; value: any }[]; // select
|
|
||||||
|
|
||||||
markList?: { label: string; value: any }[]; // slider
|
|
||||||
step?: number; // slider
|
|
||||||
max?: number; // slider, number input
|
|
||||||
min?: number; // slider, number input
|
|
||||||
|
|
||||||
defaultValue?: string;
|
|
||||||
|
|
||||||
// dynamic input
|
|
||||||
editField?: EditNodeFieldType['editField'];
|
|
||||||
dynamicParamDefaultValue?: EditNodeFieldType['dynamicParamDefaultValue'];
|
|
||||||
|
|
||||||
llmModelType?: `${LLMModelTypeEnum}`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FlowNodeOutputItemType = {
|
export type FlowNodeOutputItemType = {
|
||||||
@@ -54,8 +67,7 @@ export type FlowNodeOutputItemType = {
|
|||||||
required?: boolean;
|
required?: boolean;
|
||||||
|
|
||||||
// component params
|
// component params
|
||||||
canEdit?: boolean;
|
customFieldConfig?: CustomFieldConfigType;
|
||||||
editField?: EditOutputFieldMapType; // 添加
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ReferenceValueProps = [string, string | undefined];
|
export type ReferenceValueProps = [string, string | undefined];
|
||||||
|
|||||||
113
packages/global/core/workflow/type/node.d.ts
vendored
Normal file
113
packages/global/core/workflow/type/node.d.ts
vendored
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
import { FlowNodeTypeEnum } from '../node/constant';
|
||||||
|
import {
|
||||||
|
WorkflowIOValueTypeEnum,
|
||||||
|
NodeOutputKeyEnum,
|
||||||
|
FlowNodeTemplateTypeEnum,
|
||||||
|
VariableInputEnum
|
||||||
|
} from '../constants';
|
||||||
|
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
|
||||||
|
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
||||||
|
import { UserModelSchema } from '../../../support/user/type';
|
||||||
|
import {
|
||||||
|
ChatHistoryItemResType,
|
||||||
|
ChatItemType,
|
||||||
|
ChatItemValueItemType,
|
||||||
|
ToolRunResponseItemType,
|
||||||
|
UserChatItemValueItemType
|
||||||
|
} from '../../chat/type';
|
||||||
|
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||||
|
import { RuntimeNodeItemType } from '../runtime/type';
|
||||||
|
import { PluginTypeEnum } from '../../plugin/constants';
|
||||||
|
import { RuntimeEdgeItemType, StoreEdgeItemType } from './edge';
|
||||||
|
import { NextApiResponse } from 'next';
|
||||||
|
import { AppDetailType, AppSchema } from '../../app/type';
|
||||||
|
import { ParentIdType } from 'common/parentFolder/type';
|
||||||
|
import { AppTypeEnum } from 'core/app/constants';
|
||||||
|
|
||||||
|
export type FlowNodeCommonType = {
|
||||||
|
flowNodeType: FlowNodeTypeEnum; // render node card
|
||||||
|
abandon?: boolean; // abandon node
|
||||||
|
|
||||||
|
avatar?: string;
|
||||||
|
name: string;
|
||||||
|
intro?: string; // template list intro
|
||||||
|
inputExplanationUrl?: string;
|
||||||
|
showStatus?: boolean; // chatting response step status
|
||||||
|
version: string;
|
||||||
|
|
||||||
|
// data
|
||||||
|
inputs: FlowNodeInputItemType[];
|
||||||
|
outputs: FlowNodeOutputItemType[];
|
||||||
|
|
||||||
|
// plugin data
|
||||||
|
pluginId?: string;
|
||||||
|
isFolder?: boolean;
|
||||||
|
// pluginType?: AppTypeEnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
type HandleType = {
|
||||||
|
left: boolean;
|
||||||
|
right: boolean;
|
||||||
|
top: boolean;
|
||||||
|
bottom: boolean;
|
||||||
|
};
|
||||||
|
// system template
|
||||||
|
export type FlowNodeTemplateType = FlowNodeCommonType & {
|
||||||
|
id: string; // node id, unique
|
||||||
|
templateType: FlowNodeTemplateTypeEnum;
|
||||||
|
|
||||||
|
// show handle
|
||||||
|
sourceHandle?: HandleType;
|
||||||
|
targetHandle?: HandleType;
|
||||||
|
|
||||||
|
// info
|
||||||
|
isTool?: boolean; // can be connected by tool
|
||||||
|
|
||||||
|
// action
|
||||||
|
forbidDelete?: boolean; // forbid delete
|
||||||
|
unique?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NodeTemplateListItemType = {
|
||||||
|
id: string; // 系统节点-系统节点的 id, 系统插件-插件的 id,团队应用的 id
|
||||||
|
flowNodeType: FlowNodeTypeEnum; // render node card
|
||||||
|
parentId?: ParentIdType;
|
||||||
|
isFolder?: boolean;
|
||||||
|
templateType: FlowNodeTemplateTypeEnum;
|
||||||
|
avatar?: string;
|
||||||
|
name: string;
|
||||||
|
intro?: string; // template list intro
|
||||||
|
isTool?: boolean;
|
||||||
|
author?: string;
|
||||||
|
unique?: boolean; // 唯一的
|
||||||
|
currentCost?: number; // 当前积分消耗
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NodeTemplateListType = {
|
||||||
|
type: FlowNodeTemplateTypeEnum;
|
||||||
|
label: string;
|
||||||
|
list: NodeTemplateListItemType[];
|
||||||
|
}[];
|
||||||
|
|
||||||
|
// react flow node type
|
||||||
|
export type FlowNodeItemType = FlowNodeTemplateType & {
|
||||||
|
nodeId: string;
|
||||||
|
isError?: boolean;
|
||||||
|
debugResult?: {
|
||||||
|
status: 'running' | 'success' | 'skipped' | 'failed';
|
||||||
|
message?: string;
|
||||||
|
showResult?: boolean; // show and hide result modal
|
||||||
|
response?: ChatHistoryItemResType;
|
||||||
|
isExpired?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// store node type
|
||||||
|
export type StoreNodeItemType = FlowNodeCommonType & {
|
||||||
|
nodeId: string;
|
||||||
|
// isEntry: boolean;
|
||||||
|
position?: {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -3,10 +3,11 @@ import {
|
|||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
VariableInputEnum,
|
VariableInputEnum,
|
||||||
variableMap
|
variableMap,
|
||||||
|
VARIABLE_NODE_ID
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './type/io.d';
|
import { FlowNodeInputItemType, FlowNodeOutputItemType, ReferenceValueProps } from './type/io.d';
|
||||||
import { StoreNodeItemType } from './type';
|
import { StoreNodeItemType } from './type/node';
|
||||||
import type {
|
import type {
|
||||||
VariableItemType,
|
VariableItemType,
|
||||||
AppTTSConfigType,
|
AppTTSConfigType,
|
||||||
@@ -22,6 +23,8 @@ import {
|
|||||||
defaultWhisperConfig
|
defaultWhisperConfig
|
||||||
} from '../app/constants';
|
} from '../app/constants';
|
||||||
import { IfElseResultEnum } from './template/system/ifElse/constant';
|
import { IfElseResultEnum } from './template/system/ifElse/constant';
|
||||||
|
import { RuntimeNodeItemType } from './runtime/type';
|
||||||
|
import { getReferenceVariableValue } from './runtime/utils';
|
||||||
|
|
||||||
export const getHandleId = (nodeId: string, type: 'source' | 'target', key: string) => {
|
export const getHandleId = (nodeId: string, type: 'source' | 'target', key: string) => {
|
||||||
return `${nodeId}-${type}-${key}`;
|
return `${nodeId}-${type}-${key}`;
|
||||||
@@ -190,3 +193,125 @@ export const isReferenceValue = (value: any): boolean => {
|
|||||||
export const getElseIFLabel = (i: number) => {
|
export const getElseIFLabel = (i: number) => {
|
||||||
return i === 0 ? IfElseResultEnum.IF : `${IfElseResultEnum.ELSE_IF} ${i}`;
|
return i === 0 ? IfElseResultEnum.IF : `${IfElseResultEnum.ELSE_IF} ${i}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// add value to plugin input node when run plugin
|
||||||
|
export const updatePluginInputByVariables = (
|
||||||
|
nodes: RuntimeNodeItemType[],
|
||||||
|
variables: Record<string, any>
|
||||||
|
) => {
|
||||||
|
return nodes.map((node) =>
|
||||||
|
node.flowNodeType === FlowNodeTypeEnum.pluginInput
|
||||||
|
? {
|
||||||
|
...node,
|
||||||
|
inputs: node.inputs.map((input) => {
|
||||||
|
const parseValue = (() => {
|
||||||
|
try {
|
||||||
|
if (
|
||||||
|
input.valueType === WorkflowIOValueTypeEnum.string ||
|
||||||
|
input.valueType === WorkflowIOValueTypeEnum.number ||
|
||||||
|
input.valueType === WorkflowIOValueTypeEnum.boolean
|
||||||
|
)
|
||||||
|
return variables[input.key];
|
||||||
|
|
||||||
|
return JSON.parse(variables[input.key]);
|
||||||
|
} catch (e) {
|
||||||
|
return variables[input.key];
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
return {
|
||||||
|
...input,
|
||||||
|
value: parseValue ?? input.value
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
: node
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removePluginInputVariables = (
|
||||||
|
variables: Record<string, any>,
|
||||||
|
nodes: RuntimeNodeItemType[]
|
||||||
|
) => {
|
||||||
|
const pluginInputNode = nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput);
|
||||||
|
|
||||||
|
if (!pluginInputNode) return variables;
|
||||||
|
return Object.keys(variables).reduce(
|
||||||
|
(acc, key) => {
|
||||||
|
if (!pluginInputNode.inputs.find((input) => input.key === key)) {
|
||||||
|
acc[key] = variables[key];
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, any>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export function replaceVariableLabel({
|
||||||
|
text,
|
||||||
|
nodes,
|
||||||
|
variables,
|
||||||
|
runningNode
|
||||||
|
}: {
|
||||||
|
text: any;
|
||||||
|
nodes: RuntimeNodeItemType[];
|
||||||
|
variables: Record<string, string | number>;
|
||||||
|
runningNode: RuntimeNodeItemType;
|
||||||
|
}) {
|
||||||
|
if (typeof text !== 'string') return text;
|
||||||
|
|
||||||
|
const globalVariables = Object.keys(variables).map((key) => {
|
||||||
|
return {
|
||||||
|
nodeId: VARIABLE_NODE_ID,
|
||||||
|
id: key,
|
||||||
|
value: variables[key]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upstream node outputs
|
||||||
|
const nodeVariables = nodes
|
||||||
|
.map((node) => {
|
||||||
|
return node.outputs.map((output) => {
|
||||||
|
return {
|
||||||
|
nodeId: node.nodeId,
|
||||||
|
id: output.id,
|
||||||
|
value: output.value
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.flat();
|
||||||
|
|
||||||
|
// Get runningNode inputs(Will be replaced with reference)
|
||||||
|
const customInputs = runningNode.inputs.flatMap((item) => {
|
||||||
|
if (Array.isArray(item.value)) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: item.key,
|
||||||
|
value: getReferenceVariableValue({
|
||||||
|
value: item.value as ReferenceValueProps,
|
||||||
|
nodes,
|
||||||
|
variables
|
||||||
|
}),
|
||||||
|
nodeId: runningNode.nodeId
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
|
||||||
|
const allVariables = [...globalVariables, ...nodeVariables, ...customInputs];
|
||||||
|
|
||||||
|
// Replace {{$xxx.xxx$}} to value
|
||||||
|
for (const key in allVariables) {
|
||||||
|
const val = allVariables[key];
|
||||||
|
const regex = new RegExp(`\\{\\{\\$(${val.nodeId}\\.${val.id})\\$\\}\\}`, 'g');
|
||||||
|
if (['string', 'number'].includes(typeof val.value)) {
|
||||||
|
text = text.replace(regex, String(val.value));
|
||||||
|
} else if (['object'].includes(typeof val.value)) {
|
||||||
|
text = text.replace(regex, JSON.stringify(val.value));
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text || '';
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"jschardet": "3.1.1",
|
"jschardet": "3.1.1",
|
||||||
"nanoid": "^4.0.1",
|
"nanoid": "^4.0.1",
|
||||||
"next": "14.2.3",
|
"next": "14.2.5",
|
||||||
"openai": "4.28.0",
|
"openai": "4.53.0",
|
||||||
"openapi-types": "^12.1.3",
|
"openapi-types": "^12.1.3",
|
||||||
"timezones-list": "^3.0.2"
|
"timezones-list": "^3.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/node": "^20.14.2"
|
"@types/node": "20.14.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
packages/global/support/permission/type.d.ts
vendored
19
packages/global/support/permission/type.d.ts
vendored
@@ -1,11 +1,13 @@
|
|||||||
import { TeamMemberWithUserSchema } from '../user/team/type';
|
import { TeamMemberWithUserSchema } from '../user/team/type';
|
||||||
import { AuthUserTypeEnum, PermissionKeyEnum } from './constant';
|
import { AuthUserTypeEnum, PermissionKeyEnum, PerResourceTypeEnum } from './constant';
|
||||||
|
|
||||||
// PermissionValueType, the type of permission's value is a number, which is a bit field actually.
|
// PermissionValueType, the type of permission's value is a number, which is a bit field actually.
|
||||||
// It is spired by the permission system in Linux.
|
// It is spired by the permission system in Linux.
|
||||||
// The lowest 3 bits present the permission of reading, writing and managing.
|
// The lowest 3 bits present the permission of reading, writing and managing.
|
||||||
// The higher bits are advanced permissions or extended permissions, which could be customized.
|
// The higher bits are advanced permissions or extended permissions, which could be customized.
|
||||||
export type PermissionValueType = number;
|
export type PermissionValueType = number;
|
||||||
|
export type ResourceType = `${PerResourceTypeEnum}`;
|
||||||
|
|
||||||
export type PermissionListType<T = {}> = Record<
|
export type PermissionListType<T = {}> = Record<
|
||||||
T | PermissionKeyEnum,
|
T | PermissionKeyEnum,
|
||||||
{
|
{
|
||||||
@@ -16,16 +18,6 @@ export type PermissionListType<T = {}> = Record<
|
|||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type AuthResponseType = {
|
|
||||||
teamId: string;
|
|
||||||
tmbId: string;
|
|
||||||
isOwner: boolean;
|
|
||||||
canWrite: boolean;
|
|
||||||
authType?: `${AuthUserTypeEnum}`;
|
|
||||||
appId?: string;
|
|
||||||
apikey?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ResourcePermissionType = {
|
export type ResourcePermissionType = {
|
||||||
teamId: string;
|
teamId: string;
|
||||||
tmbId: string;
|
tmbId: string;
|
||||||
@@ -37,3 +29,8 @@ export type ResourcePermissionType = {
|
|||||||
export type ResourcePerWithTmbWithUser = Omit<ResourcePermissionType, 'tmbId'> & {
|
export type ResourcePerWithTmbWithUser = Omit<ResourcePermissionType, 'tmbId'> & {
|
||||||
tmbId: TeamMemberWithUserSchema;
|
tmbId: TeamMemberWithUserSchema;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PermissionSchemaType = {
|
||||||
|
defaultPermission: PermissionValueType;
|
||||||
|
inheritPermission: boolean;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { TeamMemberRoleEnum } from '../user/team/constant';
|
import { PermissionValueType } from './type';
|
||||||
import { PermissionTypeEnum } from './constant';
|
import { NullPermission, PermissionTypeEnum } from './constant';
|
||||||
import { Permission } from './controller';
|
import { Permission } from './controller';
|
||||||
|
|
||||||
/* team public source, or owner source in team */
|
/* team public source, or owner source in team */
|
||||||
@@ -28,3 +28,17 @@ export function mongoOwnerPermission({ teamId, tmbId }: { teamId: string; tmbId:
|
|||||||
tmbId
|
tmbId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return permission-related schema to define the schema of resources
|
||||||
|
export function getPermissionSchema(defaultPermission: PermissionValueType = NullPermission) {
|
||||||
|
return {
|
||||||
|
defaultPermission: {
|
||||||
|
type: Number,
|
||||||
|
default: defaultPermission
|
||||||
|
},
|
||||||
|
inheritPermission: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user