Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d3117c5da | ||
|
|
5361674a2c | ||
|
|
ef537f391c | ||
|
|
367ee517ec | ||
|
|
39cf001358 | ||
|
|
7b9f935119 | ||
|
|
a6fbfac96f | ||
|
|
864eff47c7 | ||
|
|
fdd4e9edbd | ||
|
|
683ab6c17d | ||
|
|
9f21add7b5 | ||
|
|
4b8db293ce | ||
|
|
5e3ec4d6f3 | ||
|
|
360a2ec392 | ||
|
|
b0297d2915 | ||
|
|
5023da4489 | ||
|
|
26e320b0df | ||
|
|
14ad6aef41 | ||
|
|
d2a32c363d | ||
|
|
e0b85ca4c2 | ||
|
|
3a911c5130 | ||
|
|
433e7ed911 | ||
|
|
293c0cdb40 | ||
|
|
ca8adbbf95 | ||
|
|
d91b2ae303 | ||
|
|
3313bf933c | ||
|
|
bf14506603 | ||
|
|
cc01aa4ab8 | ||
|
|
d6fed3d23a | ||
|
|
1d2026786e | ||
|
|
659b8b1106 | ||
|
|
5357aa402b | ||
|
|
9923a402d9 | ||
|
|
6763ac60d5 | ||
|
|
f0a25ff964 | ||
|
|
7d63b6bae8 | ||
|
|
229c8acdb9 | ||
|
|
1465999c46 | ||
|
|
0720bbe4da | ||
|
|
a669a60fe6 | ||
|
|
25dc8984be | ||
|
|
2a54be4d91 | ||
|
|
5c93545016 | ||
|
|
27614e9e8b | ||
|
|
2dd5cf6d1f | ||
|
|
6c61812e7a | ||
|
|
9f8b6dbc5f | ||
|
|
d8fe9806e6 | ||
|
|
9cd6d2e81f | ||
|
|
f789af51f5 | ||
|
|
4edd72b7e6 | ||
|
|
7e19628315 | ||
|
|
4ac2a2f43e | ||
|
|
61aa91b3aa | ||
|
|
d9a4a5f3e7 | ||
|
|
a18d34e40a | ||
|
|
b4aeaf10ae | ||
|
|
d71f4cee19 | ||
|
|
6ed06936a4 | ||
|
|
8d9125b0ee |
25
.eslintignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# 构建输出目录
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
.next/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# 依赖目录
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# 缓存和生成文件
|
||||||
|
coverage/
|
||||||
|
.coverage/
|
||||||
|
.nyc_output/
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# 其他不需要检查的文件
|
||||||
|
*.min.js
|
||||||
|
*.config.js
|
||||||
|
vitest.config.mts
|
||||||
|
|
||||||
|
# 特定目录
|
||||||
|
bin/
|
||||||
|
scripts/
|
||||||
|
deploy/
|
||||||
|
docSite/
|
||||||
17
.eslintrc.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
|
"extends": ["next/core-web-vitals"],
|
||||||
|
"rules": {
|
||||||
|
"react-hooks/rules-of-hooks": 0,
|
||||||
|
"@typescript-eslint/consistent-type-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"prefer": "type-imports",
|
||||||
|
"disallowTypeAnnotations": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ignorePatterns": ["node_modules/", "dist/", "build/", "coverage/"]
|
||||||
|
}
|
||||||
2
.github/workflows/docs-sync_imgs.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
uses: BetaHuhn/repo-file-sync-action@v1.21.0
|
uses: BetaHuhn/repo-file-sync-action@v1.21.0
|
||||||
with:
|
with:
|
||||||
GH_PAT: ${{ secrets.IMG_GH_PAT }}
|
GH_PAT: ${{ secrets.IMG_GH_PAT }}
|
||||||
CONFIG_PATH: .github/sync_imgs.yml
|
CONFIG_PATH: .github/doc-sync-image.yml
|
||||||
ORIGINAL_MESSAGE: true
|
ORIGINAL_MESSAGE: true
|
||||||
SKIP_PR: true
|
SKIP_PR: true
|
||||||
COMMIT_EACH_FILE: false
|
COMMIT_EACH_FILE: false
|
||||||
|
|||||||
3
.vscode/i18n-ally-custom-framework.yml
vendored
@@ -16,9 +16,6 @@ usageMatchRegex:
|
|||||||
# the `{key}` will be placed by a proper keypath matching regex,
|
# the `{key}` will be placed by a proper keypath matching regex,
|
||||||
# you can ignore it and use your own matching rules as well
|
# you can ignore it and use your own matching rules as well
|
||||||
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]t\\(['\"`]({key})['\"`]"
|
||||||
- "[^\\w\\d]commonT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]fileT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
|
|
||||||
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
|
||||||
|
|
||||||
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys
|
||||||
|
|||||||
@@ -120,21 +120,38 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
command: |
|
command: |
|
||||||
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'redis-cli', '-a', 'mypassword', 'ping']
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/data:/data
|
- ./redis/data:/data
|
||||||
|
|
||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
|
fastgpt-mcp-server:
|
||||||
|
container_name: fastgpt-mcp-server
|
||||||
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
||||||
|
ports:
|
||||||
|
- 3005:3000
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -191,8 +208,8 @@ services:
|
|||||||
|
|
||||||
# AI Proxy
|
# AI Proxy
|
||||||
aiproxy:
|
aiproxy:
|
||||||
image: ghcr.io/labring/aiproxy:v0.1.3
|
image: ghcr.io/labring/aiproxy:v0.1.7
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.7 # 阿里云
|
||||||
container_name: aiproxy
|
container_name: aiproxy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ version: '3.3'
|
|||||||
services:
|
services:
|
||||||
# vector db
|
# vector db
|
||||||
ob:
|
ob:
|
||||||
image: oceanbase/oceanbase-ce # docker hub
|
image: oceanbase/oceanbase-ce:4.3.5-lts # docker hub
|
||||||
# image: quay.io/oceanbase/oceanbase-ce:4.3.5.1-101000042025031818 # 镜像
|
# image: quay.io/oceanbase/oceanbase-ce:4.3.5-lts # 镜像
|
||||||
container_name: ob
|
container_name: ob
|
||||||
restart: always
|
restart: always
|
||||||
# ports: # 生产环境建议不要暴露
|
# ports: # 生产环境建议不要暴露
|
||||||
@@ -23,7 +23,7 @@ services:
|
|||||||
- OB_TENANT_NAME=tenantname
|
- OB_TENANT_NAME=tenantname
|
||||||
- OB_TENANT_PASSWORD=tenantpassword
|
- OB_TENANT_PASSWORD=tenantpassword
|
||||||
# MODE分为MINI和NORMAL, 后者会最大程度使用主机资源
|
# MODE分为MINI和NORMAL, 后者会最大程度使用主机资源
|
||||||
- MODE=NORMAL
|
- MODE=MINI
|
||||||
- OB_SERVER_IP=127.0.0.1
|
- OB_SERVER_IP=127.0.0.1
|
||||||
# 更多环境变量配置见oceanbase官方文档: https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002013494
|
# 更多环境变量配置见oceanbase官方文档: https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002013494
|
||||||
volumes:
|
volumes:
|
||||||
@@ -35,7 +35,7 @@ services:
|
|||||||
test:
|
test:
|
||||||
[
|
[
|
||||||
'CMD-SHELL',
|
'CMD-SHELL',
|
||||||
'obclient -h$OB_SERVER_IP -P2881 -uroot@$OB_TENANT_NAME -p$OB_TENANT_PASSWORD -e "SELECT 1;"'
|
'obclient -h$${OB_SERVER_IP} -P2881 -uroot@$${OB_TENANT_NAME} -p$${OB_TENANT_PASSWORD} -e "SELECT 1;"'
|
||||||
]
|
]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
@@ -87,19 +87,48 @@ services:
|
|||||||
|
|
||||||
# 等待docker-entrypoint.sh脚本执行的MongoDB服务进程
|
# 等待docker-entrypoint.sh脚本执行的MongoDB服务进程
|
||||||
wait $$!
|
wait $$!
|
||||||
|
redis:
|
||||||
|
image: redis:7.2-alpine
|
||||||
|
container_name: redis
|
||||||
|
# ports:
|
||||||
|
# - 6379:6379
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
command: |
|
||||||
|
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
||||||
|
volumes:
|
||||||
|
- ./redis/data:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'redis-cli', '-a', 'mypassword', 'ping']
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
|
|
||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.3 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.3 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
|
fastgpt-mcp-server:
|
||||||
|
container_name: fastgpt-mcp-server
|
||||||
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
||||||
|
ports:
|
||||||
|
- 3005:3000
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.3 # git
|
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.3 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -118,14 +147,9 @@ services:
|
|||||||
# root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
|
# root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。
|
||||||
- DEFAULT_ROOT_PSW=1234
|
- DEFAULT_ROOT_PSW=1234
|
||||||
# # AI Proxy 的地址,如果配了该地址,优先使用
|
# # AI Proxy 的地址,如果配了该地址,优先使用
|
||||||
# - AIPROXY_API_ENDPOINT=http://aiproxy:3000
|
- AIPROXY_API_ENDPOINT=http://aiproxy:3000
|
||||||
# # AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
# # AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||||
# - AIPROXY_API_TOKEN=aiproxy
|
- AIPROXY_API_TOKEN=aiproxy
|
||||||
# 模型中转地址(如果用了 AI Proxy,下面 2 个就不需要了,旧版 OneAPI 用户,使用下面的变量)
|
|
||||||
# openai 基本地址,可用作中转。
|
|
||||||
# - OPENAI_BASE_URL=https://example.com
|
|
||||||
# OpenAI API Key
|
|
||||||
# - CHAT_API_KEY=sk-example
|
|
||||||
# 数据库最大连接数
|
# 数据库最大连接数
|
||||||
- DB_MAX_LINK=30
|
- DB_MAX_LINK=30
|
||||||
# 登录凭证密钥
|
# 登录凭证密钥
|
||||||
@@ -138,6 +162,8 @@ services:
|
|||||||
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
- MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
|
||||||
# OceanBase 向量库连接参数
|
# OceanBase 向量库连接参数
|
||||||
- OCEANBASE_URL=mysql://root%40tenantname:tenantpassword@ob:2881/test
|
- OCEANBASE_URL=mysql://root%40tenantname:tenantpassword@ob:2881/test
|
||||||
|
# Redis 连接参数
|
||||||
|
- REDIS_URL=redis://default:mypassword@redis:6379
|
||||||
# sandbox 地址
|
# sandbox 地址
|
||||||
- SANDBOX_URL=http://sandbox:3000
|
- SANDBOX_URL=http://sandbox:3000
|
||||||
# 日志等级: debug, info, warn, error
|
# 日志等级: debug, info, warn, error
|
||||||
@@ -151,13 +177,15 @@ services:
|
|||||||
- ALLOWED_ORIGINS=
|
- ALLOWED_ORIGINS=
|
||||||
# 是否开启IP限制,默认不开启
|
# 是否开启IP限制,默认不开启
|
||||||
- USE_IP_LIMIT=false
|
- USE_IP_LIMIT=false
|
||||||
|
# 对话文件过期天数
|
||||||
|
- CHAT_FILE_EXPIRE_TIME=7
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/data/config.json
|
- ./config.json:/app/data/config.json
|
||||||
|
|
||||||
# AI Proxy
|
# AI Proxy
|
||||||
aiproxy:
|
aiproxy:
|
||||||
image: ghcr.io/labring/aiproxy:v0.1.5
|
image: ghcr.io/labring/aiproxy:v0.1.7
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.7 # 阿里云
|
||||||
container_name: aiproxy
|
container_name: aiproxy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ services:
|
|||||||
- POSTGRES_DB=postgres
|
- POSTGRES_DB=postgres
|
||||||
volumes:
|
volumes:
|
||||||
- ./pg/data:/var/lib/postgresql/data
|
- ./pg/data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'aiproxy']
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
mongo:
|
mongo:
|
||||||
image: mongo:5.0.18 # dockerhub
|
image: mongo:5.0.18 # dockerhub
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
|
||||||
@@ -79,21 +84,38 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
command: |
|
command: |
|
||||||
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'redis-cli', '-a', 'mypassword', 'ping']
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/data:/data
|
- ./redis/data:/data
|
||||||
|
|
||||||
# fastgpt
|
# fastgpt
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
|
fastgpt-mcp-server:
|
||||||
|
container_name: fastgpt-mcp-server
|
||||||
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
||||||
|
ports:
|
||||||
|
- 3005:3000
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -112,9 +134,6 @@ services:
|
|||||||
- AIPROXY_API_ENDPOINT=http://aiproxy:3000
|
- AIPROXY_API_ENDPOINT=http://aiproxy:3000
|
||||||
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
# AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY
|
||||||
- AIPROXY_API_TOKEN=aiproxy
|
- AIPROXY_API_TOKEN=aiproxy
|
||||||
# 模型中转地址(如果用了 AI Proxy,下面 2 个就不需要了,旧版 OneAPI 用户,使用下面的变量)
|
|
||||||
# - OPENAI_BASE_URL=http://oneapi:3000/v1
|
|
||||||
# - CHAT_API_KEY=sk-fastgpt
|
|
||||||
# 数据库最大连接数
|
# 数据库最大连接数
|
||||||
- DB_MAX_LINK=30
|
- DB_MAX_LINK=30
|
||||||
# 登录凭证密钥
|
# 登录凭证密钥
|
||||||
@@ -149,8 +168,8 @@ services:
|
|||||||
|
|
||||||
# AI Proxy
|
# AI Proxy
|
||||||
aiproxy:
|
aiproxy:
|
||||||
image: ghcr.io/labring/aiproxy:v0.1.5
|
image: ghcr.io/labring/aiproxy:v0.1.7
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.7 # 阿里云
|
||||||
container_name: aiproxy
|
container_name: aiproxy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -61,20 +61,37 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
command: |
|
command: |
|
||||||
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction
|
||||||
|
healthcheck:
|
||||||
|
test: ['CMD', 'redis-cli', '-a', 'mypassword', 'ping']
|
||||||
|
interval: 10s
|
||||||
|
timeout: 3s
|
||||||
|
retries: 3
|
||||||
|
start_period: 30s
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis/data:/data
|
- ./redis/data:/data
|
||||||
|
|
||||||
sandbox:
|
sandbox:
|
||||||
container_name: sandbox
|
container_name: sandbox
|
||||||
image: ghcr.io/labring/fastgpt-sandbox:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
restart: always
|
restart: always
|
||||||
|
fastgpt-mcp-server:
|
||||||
|
container_name: fastgpt-mcp-server
|
||||||
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git
|
||||||
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云
|
||||||
|
ports:
|
||||||
|
- 3005:3000
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
fastgpt:
|
fastgpt:
|
||||||
container_name: fastgpt
|
container_name: fastgpt
|
||||||
image: ghcr.io/labring/fastgpt:v4.9.5 # git
|
image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.5 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
networks:
|
networks:
|
||||||
@@ -130,8 +147,8 @@ services:
|
|||||||
|
|
||||||
# AI Proxy
|
# AI Proxy
|
||||||
aiproxy:
|
aiproxy:
|
||||||
image: ghcr.io/labring/aiproxy:v0.1.3
|
image: ghcr.io/labring/aiproxy:v0.1.7
|
||||||
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
|
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.7 # 阿里云
|
||||||
container_name: aiproxy
|
container_name: aiproxy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ FROM fholzer/nginx-brotli:latest
|
|||||||
|
|
||||||
LABEL org.opencontainers.image.source https://github.com/labring/FastGPT
|
LABEL org.opencontainers.image.source https://github.com/labring/FastGPT
|
||||||
|
|
||||||
COPY --from=builder /app/hugo/public /usr/share/nginx/html
|
COPY --from=builder /app/hugo/public /usr/share/nginx/html
|
||||||
|
|
||||||
|
COPY ./docSite/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 105 KiB |
BIN
docSite/assets/imgs/webSync2.jpg
Normal file
|
After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 43 KiB |
BIN
docSite/assets/imgs/webSync3.jpg
Normal file
|
After Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 64 KiB |
BIN
docSite/assets/imgs/webSync4.jpg
Normal file
|
After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 50 KiB |
BIN
docSite/assets/imgs/webSync5-1.jpg
Normal file
|
After Width: | Height: | Size: 150 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 160 KiB |
BIN
docSite/assets/imgs/webSync6.jpg
Normal file
|
After Width: | Height: | Size: 330 KiB |
|
Before Width: | Height: | Size: 161 KiB |
@@ -187,7 +187,11 @@ curl -o docker-compose.yml https://raw.githubusercontent.com/labring/FastGPT/mai
|
|||||||
{{< /tab >}}
|
{{< /tab >}}
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
### 3. 启动容器
|
### 3. 修改 config.json 配置文件
|
||||||
|
|
||||||
|
修改`config.json`文件中的`mcpServerProxyEndpoint`值,设置成`mcp server`的公网可访问地址,yml 文件中默认给出了映射到 3005 端口,如通过 IP 访问,则可能是:`120.172.2.10:3005`。
|
||||||
|
|
||||||
|
### 4. 启动容器
|
||||||
|
|
||||||
在 docker-compose.yml 同级目录下执行。请确保`docker-compose`版本最好在2.17以上,否则可能无法执行自动化命令。
|
在 docker-compose.yml 同级目录下执行。请确保`docker-compose`版本最好在2.17以上,否则可能无法执行自动化命令。
|
||||||
|
|
||||||
@@ -196,7 +200,7 @@ curl -o docker-compose.yml https://raw.githubusercontent.com/labring/FastGPT/mai
|
|||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. 访问 FastGPT
|
### 5. 访问 FastGPT
|
||||||
|
|
||||||
目前可以通过 `ip:3000` 直接访问(注意开放防火墙)。登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW`。
|
目前可以通过 `ip:3000` 直接访问(注意开放防火墙)。登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW`。
|
||||||
|
|
||||||
@@ -204,7 +208,7 @@ docker-compose up -d
|
|||||||
|
|
||||||
首次运行,会自动初始化 root 用户,密码为 `1234`(与环境变量中的`DEFAULT_ROOT_PSW`一致),日志可能会提示一次`MongoServerError: Unable to read from a snapshot due to pending collection catalog changes;`可忽略。
|
首次运行,会自动初始化 root 用户,密码为 `1234`(与环境变量中的`DEFAULT_ROOT_PSW`一致),日志可能会提示一次`MongoServerError: Unable to read from a snapshot due to pending collection catalog changes;`可忽略。
|
||||||
|
|
||||||
### 5. 配置模型
|
### 6. 配置模型
|
||||||
|
|
||||||
- 首次登录FastGPT后,系统会提示未配置`语言模型`和`索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。
|
- 首次登录FastGPT后,系统会提示未配置`语言模型`和`索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。
|
||||||
- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/development/modelconfig/ai-proxy)
|
- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/development/modelconfig/ai-proxy)
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?
|
|||||||
| datasetId | 知识库ID | ✅ |
|
| datasetId | 知识库ID | ✅ |
|
||||||
| parentId: | 父级ID,不填则默认为根目录 | |
|
| parentId: | 父级ID,不填则默认为根目录 | |
|
||||||
| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ |
|
| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ |
|
||||||
|
| customPdfParse | PDF增强解析。true: 开启PDF增强解析;不填则默认为false | |
|
||||||
| autoIndexes | 是否自动生成索引(仅商业版支持) | |
|
| autoIndexes | 是否自动生成索引(仅商业版支持) | |
|
||||||
| imageIndex | 是否自动生成图片索引(仅商业版支持) | |
|
| imageIndex | 是否自动生成图片索引(仅商业版支持) | |
|
||||||
| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | |
|
| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | |
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: 'V4.9.6(进行中)'
|
title: 'V4.9.6'
|
||||||
description: 'FastGPT V4.9.6 更新说明'
|
description: 'FastGPT V4.9.6 更新说明'
|
||||||
icon: 'upgrade'
|
icon: 'upgrade'
|
||||||
draft: false
|
draft: false
|
||||||
@@ -7,11 +7,6 @@ toc: true
|
|||||||
weight: 794
|
weight: 794
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 🚀 新增内容
|
## 🚀 新增内容
|
||||||
|
|
||||||
1. 以 MCP 方式对外提供应用调用。
|
1. 以 MCP 方式对外提供应用调用。
|
||||||
@@ -35,4 +30,56 @@ weight: 794
|
|||||||
|
|
||||||
1. 修复子工作流包含交互节点时,未成功恢复子工作流所有数据。
|
1. 修复子工作流包含交互节点时,未成功恢复子工作流所有数据。
|
||||||
2. completion v1 接口,未接受 interactive 参数,导致 API 调用失败。
|
2. completion v1 接口,未接受 interactive 参数,导致 API 调用失败。
|
||||||
3. 连续工具调用,上下文截断异常
|
3. 连续工具调用,上下文截断异常
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
### 1. 做好数据备份
|
||||||
|
|
||||||
|
### 2. 部署 MCP server 服务
|
||||||
|
|
||||||
|
#### Docker 部署
|
||||||
|
|
||||||
|
在`docker-compose.yml`文件中,加入`fastgpt-mcp-server`服务:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
fastgpt-mcp-server:
|
||||||
|
container_name: fastgpt-mcp-server
|
||||||
|
image: ghcr.io/labring/fastgpt-mcp_server:v4.9.6
|
||||||
|
ports:
|
||||||
|
- 3005:3000
|
||||||
|
networks:
|
||||||
|
- fastgpt
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- FASTGPT_ENDPOINT=http://fastgpt:3000
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sealos 部署
|
||||||
|
|
||||||
|
直接在`应用管理`中,增加一个`fastgpt-mcp-server`应用,镜像为`ghcr.io/labring/fastgpt-mcp_server:v4.9.6`,并设置环境变量`FASTGPT_ENDPOINT=fastgpt 的访问地址`。
|
||||||
|
|
||||||
|
### 3. 修改 FastGPT 容器环境变量
|
||||||
|
|
||||||
|
#### 开源版
|
||||||
|
|
||||||
|
修改`config.json`配置文件,增加: `"feconfigs.mcpServerProxyEndpoint": "fastgpt-mcp-server 的访问地址"`, 末尾不要携带/,例如:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"feConfigs": {
|
||||||
|
"lafEnv": "https://laf.dev",
|
||||||
|
"mcpServerProxyEndpoint": "https://mcp.fastgpt.cn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 商业版
|
||||||
|
|
||||||
|
在 Admin 后台,`系统配置-基础配置-系统参数`中的`MCP 转发服务地址`中,设置`fastgpt-mcp-server`的公网访问地址。
|
||||||
|
|
||||||
|
### 4. 更新镜像 tag
|
||||||
|
|
||||||
|
- 更新 FastGPT 镜像 tag: v4.9.6
|
||||||
|
- 更新 FastGPT 商业版镜像 tag: v4.9.6
|
||||||
|
- 更新 Sandbox 镜像 tag: v4.9.6
|
||||||
|
- 增加 FastGPT mcp server 镜像 tag: v4.9.6
|
||||||
|
- AIProxy 无需更新
|
||||||
|
|||||||
59
docSite/content/zh-cn/docs/development/upgrading/497.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.9.7'
|
||||||
|
description: 'FastGPT V4.9.7 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 793
|
||||||
|
---
|
||||||
|
|
||||||
|
## 升级指南
|
||||||
|
|
||||||
|
### 1. 做好数据备份
|
||||||
|
|
||||||
|
### 2. 更新镜像 tag
|
||||||
|
|
||||||
|
- 更新 FastGPT 镜像 tag: v4.9.7-fix2
|
||||||
|
- 更新 FastGPT 商业版镜像 tag: v4.9.7
|
||||||
|
- mcp_server 无需更新
|
||||||
|
- Sandbox 无需更新
|
||||||
|
- 更新 AIProxy 镜像 tag: v0.1.8
|
||||||
|
|
||||||
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
1. 知识库回答时,回答段落末尾增加引用。
|
||||||
|
2. MCP 工具支持 HTTP Streamable 协议。
|
||||||
|
3. MCP server 支持编辑工具名,适配部分客户端不支持中文名问题。
|
||||||
|
4. 工作流右键可自动对齐节点。
|
||||||
|
5. 支持生产环境自定义`config.json`路径。
|
||||||
|
6. API 调用,支持传递一个特殊 chatId(`NO_RECORD_HISTORIES`),使得系统不会进行历史记录存储。
|
||||||
|
7. 支持 Rerank 模型按量计费。
|
||||||
|
8. 套餐兑换码功能。
|
||||||
|
9. 支付宝支付。
|
||||||
|
10. 短链数据埋点。
|
||||||
|
11. 新增 Jina AI 模型系统配置。
|
||||||
|
|
||||||
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. Doc2x 文档解析,增加报错信息捕获,增加超时时长。
|
||||||
|
2. 调整 PG vector 查询语句,强制使用向量索引。
|
||||||
|
3. 对话时间统计,准确返回工作流整体运行时间。
|
||||||
|
4. 从 ai_proxy 获取音频解析时长。
|
||||||
|
5. AI 模型 Token 值均优先采用 API usage,确保 tokens 值准确,若为空,则再采用 GPT3.5 的估算方式。
|
||||||
|
6. 优化对话日志 list 接口,适配单个对话框,大量对话的场景。
|
||||||
|
|
||||||
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 文件上传分块大小限制,避免超出 MongoDB 限制。
|
||||||
|
2. 使用记录仪表盘,无法获取指定成员的使用统计。
|
||||||
|
3. 仪表盘接口,因未考虑时区问题,统计异常。
|
||||||
|
4. LLM 模型测试接口,无法测试未启用的 LLM。同时修复,模型测试接口会把模型自定义请求地址去除问题。
|
||||||
|
5. Copy app 权限问题。
|
||||||
|
6. 导出对话记录,限制单条对话记录消息上限 1000 组,避免导出失败。
|
||||||
|
7. 工作流变量下一段文本仍是工作流变量,不触发渲染。
|
||||||
|
8. 调试知识库检索模块,提示无权操作知识库。
|
||||||
|
9. 文本内容提取节点,默认值赋值逻辑。
|
||||||
|
10. 分享链接中,会强制返回嵌套应用中的引用内容。
|
||||||
|
11. 知识库集合元数据过滤时,不同知识库的同名标签使用 $and 筛选无法获取结果。
|
||||||
|
12. 修复应用列表,权限配置可能出现 index 刷新问题。
|
||||||
|
|
||||||
27
docSite/content/zh-cn/docs/development/upgrading/498.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
title: 'V4.9.8(进行中)'
|
||||||
|
description: 'FastGPT V4.9.8 更新说明'
|
||||||
|
icon: 'upgrade'
|
||||||
|
draft: false
|
||||||
|
toc: true
|
||||||
|
weight: 792
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## 🚀 新增内容
|
||||||
|
|
||||||
|
1. 支持 Toolcalls 并行执行。
|
||||||
|
2. 将所有内置任务,从非 stream 模式调整成 stream 模式,避免部分模型不支持非 stream 模式。如需覆盖,则可以在模型`额外 Body`参数中,强制指定`stream=false`。
|
||||||
|
3. qwen3 模型预设
|
||||||
|
4. 语雀知识库支持设置根目录。
|
||||||
|
|
||||||
|
## ⚙️ 优化
|
||||||
|
|
||||||
|
1. Chat log list 优化,避免大数据时超出内存限制。
|
||||||
|
2. 预加载 token 计算 worker,避免主任务中并发创建导致线程阻塞。
|
||||||
|
|
||||||
|
## 🐛 修复
|
||||||
|
|
||||||
|
1. 应用列表/知识库列表,删除行权限展示问题。
|
||||||
|
2. 打开知识库搜索参数后,重排选项自动被打开。
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ env:
|
|||||||
{{< table "table-hover table-striped-columns" >}}
|
{{< table "table-hover table-striped-columns" >}}
|
||||||
| <div style="text-align:center">企业微信</div> | <div style="text-align:center">钉钉</div> | <div style="text-align:center">飞书</div> |
|
| <div style="text-align:center">企业微信</div> | <div style="text-align:center">钉钉</div> | <div style="text-align:center">飞书</div> |
|
||||||
|-----------|-----------------|--------------|
|
|-----------|-----------------|--------------|
|
||||||
|  |  |  |
|
|  |  |  |
|
||||||
{{< /table >}}
|
{{< /table >}}
|
||||||
|
|
||||||
#### 3. 开启成员同步(可选)
|
#### 3. 开启成员同步(可选)
|
||||||
@@ -210,7 +210,7 @@ fastgpt-sso:
|
|||||||
1. 企业的 CorpID
|
1. 企业的 CorpID
|
||||||
|
|
||||||
a. 使用管理员账号登陆企业微信管理后台 `https://work.weixin.qq.com/wework_admin/loginpage_wx`
|
a. 使用管理员账号登陆企业微信管理后台 `https://work.weixin.qq.com/wework_admin/loginpage_wx`
|
||||||
|
|
||||||
b. 点击 【我的企业】 页面,查看企业的 **企业ID**
|
b. 点击 【我的企业】 页面,查看企业的 **企业ID**
|
||||||
|
|
||||||

|

|
||||||
@@ -296,52 +296,81 @@ fastgpt-sso:
|
|||||||
|
|
||||||
### 标准 OAuth2.0
|
### 标准 OAuth2.0
|
||||||
|
|
||||||
|
我们提供一套 RFC 6749 中鉴权码模式的 OAuth2.0 接入支持。
|
||||||
|
参考:
|
||||||
|
- [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749) 文档。
|
||||||
|
- [阮一峰的网络日志](https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html)
|
||||||
|
|
||||||
#### 参数需求
|
#### 参数需求
|
||||||
|
|
||||||
|
##### 三个地址
|
||||||
我们提供一套标准的 OAuth2.0 接入流程。需要三个地址:
|
我们提供一套标准的 OAuth2.0 接入流程。需要三个地址:
|
||||||
|
|
||||||
1. 登陆鉴权地址(登陆后将 code 传入 redirect_uri)
|
1. 登陆鉴权地址(用户点击 SSO 按钮后将携带参数直接跳转到该地址), 例如:`http://example.com/oauth/authorize`
|
||||||
- 需要将地址完整写好,除了 redirect_uri 以外(会自动补全)
|
```bash
|
||||||
2. 获取 access_token 的地址,请求为 GET 方法,参数 code
|
curl -X GET\
|
||||||
|
"http://example.com/oauth/authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz&redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider"
|
||||||
|
```
|
||||||
|
用户输入账号密码后,会跳转到 redirect_uri 中,并携带 code 参数:
|
||||||
|
`https://fastgpt.cn/login/provider?code=4/P7qD2qAz4&state=xyz`
|
||||||
|
2. 获取 access_token 的地址,获取到 code 后,通过*服务器请求*该地址获取 access_token 例如:`http://example.com/oauth/access_token`
|
||||||
|
```bash
|
||||||
|
curl -X POST\
|
||||||
|
-H "Content-Type: application/x-www-form-urlencoded"\
|
||||||
|
"http://example.com/oauth/access_token?grant_type=authorization_code&client_id=s6BhdRkqt3&client_secret=xxx&code=4/P7qD2qAz4&redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider"
|
||||||
|
```
|
||||||
|
注意:Content-Type 必须是 application/x-www-form-urlencoded, 而不是 application/json
|
||||||
|
3. 获取用户信息的地址,需要传入 access_token 例如:`http://example.com/oauth/user_info`
|
||||||
|
```bash
|
||||||
|
curl -X GET\
|
||||||
|
-H "Authorization: Bearer 4/P7qD2qAz4"\
|
||||||
|
"http://example.com/oauth/user_info"
|
||||||
|
```
|
||||||
|
注意: access_token 作为 Authorization 头部传入, 格式为 Bearer xxxx
|
||||||
|
|
||||||
```bash
|
##### 参数配置
|
||||||
http://example.com/oauth/access_token?code=xxxx
|
- CLIENT_ID: 必须
|
||||||
```
|
- CLIENT_SECRET: 非必须,如果没有可以不配置
|
||||||
|
- SCOPE: 非必须,如果没有可以不配置
|
||||||
|
|
||||||
3. 获取用户信息的地址
|
> redirect_uri 参数会根据运行环境自动补全
|
||||||
|
>
|
||||||
```bash
|
> 其他固定参数如 grant_type, response_type 等会自动补全
|
||||||
http://example.com/oauth/user_info
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 配置示例
|
#### 配置示例
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fastgpt-sso:
|
fastgpt-sso:
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
|
||||||
container_name: fastgpt-sso
|
container_name: fastgpt-sso
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- fastgpt
|
- fastgpt
|
||||||
environment:
|
environment:
|
||||||
# OAuth2.0
|
# OAuth2.0
|
||||||
- AUTH_TOKEN=xxxxx
|
# === 请求地址 ===
|
||||||
- SSO_PROVIDER=oauth2
|
# 1. OAuth2 登陆鉴权地址 (必填)
|
||||||
# OAuth2 重定向地址
|
- OAUTH2_AUTHORIZE_URL=
|
||||||
- OAUTH2_AUTHORIZE_URL=
|
# 2. OAuth2 获取 AccessToken 地址 (必填)
|
||||||
# OAuth2 获取 AccessToken 地址
|
- OAUTH2_TOKEN_URL=
|
||||||
- OAUTH2_TOKEN_URL=
|
# 3. OAuth2 获取用户信息地址 (必填)
|
||||||
# OAuth2 获取用户信息地址
|
- OAUTH2_USER_INFO_URL=
|
||||||
- OAUTH2_USER_INFO_URL=
|
# === 参数 ===
|
||||||
# OAuth2 用户名字段映射(必填)
|
# 1. client_id (必填)
|
||||||
- OAUTH2_USERNAME_MAP=
|
- OAUTH2_CLIENT_ID=
|
||||||
# OAuth2 头像字段映射(选填)
|
# 2. client_secret (选填,如果没有则不传)
|
||||||
- OAUTH2_AVATAR_MAP=
|
- OAUTH2_CLIENT_SECRET=
|
||||||
# OAuth2 成员名字段映射(选填)
|
# 3. scope (选填)
|
||||||
- OAUTH2_MEMBER_NAME_MAP=
|
- OAUTH2_SCOPE=
|
||||||
# OAuth2 联系方式字段映射(选填)
|
# === 字段映射 ===
|
||||||
- OAUTH2_CONTACT_MAP=
|
# OAuth2 用户名字段映射(必填)
|
||||||
|
- OAUTH2_USERNAME_MAP=
|
||||||
|
# OAuth2 头像字段映射(选填)
|
||||||
|
- OAUTH2_AVATAR_MAP=
|
||||||
|
# OAuth2 成员名字段映射(选填)
|
||||||
|
- OAUTH2_MEMBER_NAME_MAP=
|
||||||
|
# OAuth2 联系方式字段映射(选填)
|
||||||
|
- OAUTH2_CONTACT_MAP=
|
||||||
```
|
```
|
||||||
|
|
||||||
## 标准接口文档
|
## 标准接口文档
|
||||||
@@ -473,7 +502,7 @@ curl -X GET "https://example.com/org/list" \
|
|||||||
type OrgListResponseType = {
|
type OrgListResponseType = {
|
||||||
message?: string; // 报错信息
|
message?: string; // 报错信息
|
||||||
success: boolean;
|
success: boolean;
|
||||||
orgList: {
|
orgList: {
|
||||||
id: string; // 部门的唯一 id
|
id: string; // 部门的唯一 id
|
||||||
name: string; // 名字
|
name: string; // 名字
|
||||||
parentId: string; // parentId,如果为根部门,传空字符串。
|
parentId: string; // parentId,如果为根部门,传空字符串。
|
||||||
@@ -531,7 +560,7 @@ type UserListResponseListType = {
|
|||||||
message?: string; // 报错信息
|
message?: string; // 报错信息
|
||||||
success: boolean;
|
success: boolean;
|
||||||
userList: {
|
userList: {
|
||||||
username: string; // 唯一 id username 必须与 SSO 接口返回的用户 username 相同。并且必须携带一个前缀,例如: sync-aaaaa,和 sso 接口返回的前缀一致
|
username: string; // 唯一 id username 必须与 SSO 接口返回的用户 username 相同。并且必须携带一个前缀,例如: sync-aaaaa,和 sso 接口返回的前缀一致
|
||||||
memberName?: string; // 名字,作为 tmbname
|
memberName?: string; // 名字,作为 tmbname
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
contact?: string; // email or phone number
|
contact?: string; // email or phone number
|
||||||
@@ -574,8 +603,8 @@ curl示例
|
|||||||
|
|
||||||
## 如何对接非标准系统
|
## 如何对接非标准系统
|
||||||
|
|
||||||
1. 客户自己开发:按 fastgpt 提供的标准接口进行开发,并将部署后的服务地址填入 fastgpt-pro
|
1. 客户自己开发:按 fastgpt 提供的标准接口进行开发,并将部署后的服务地址填入 fastgpt-pro
|
||||||
可以参考该模版库:[fastgpt-sso-template](https://github.com/labring/fastgpt-sso-template) 进行开发
|
可以参考该模版库:[fastgpt-sso-template](https://github.com/labring/fastgpt-sso-template) 进行开发
|
||||||
2. 由 fastgpt 团队定制开发:
|
2. 由 fastgpt 团队定制开发:
|
||||||
a. 提供系统的 SSO 文档、获取成员和组织的文档、以及外网测试地址。
|
a. 提供系统的 SSO 文档、获取成员和组织的文档、以及外网测试地址。
|
||||||
b. 在 fastgpt-sso-service 中,增加对应的 provider 和环境变量,并编写代码来对接。
|
b. 在 fastgpt-sso-service 中,增加对应的 provider 和环境变量,并编写代码来对接。
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ FastGPT MCP Server 功能允许你选择`多个`在 FastGPT 上构建好的应
|
|||||||
|
|
||||||
## 私有化部署 MCP server 问题
|
## 私有化部署 MCP server 问题
|
||||||
|
|
||||||
私有化部署版本的 FastGPT,需要升级到`v4.9.6-alpha`及以上版本才可使用 MCP server 功能。
|
私有化部署版本的 FastGPT,需要升级到`v4.9.6`及以上版本才可使用 MCP server 功能。
|
||||||
|
|
||||||
### 修改 docker-compose.yml 文件
|
### 修改 docker-compose.yml 文件
|
||||||
|
|
||||||
@@ -100,4 +100,4 @@ fastgpt-mcp-server:
|
|||||||
```bash
|
```bash
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -25,24 +25,26 @@ curl https://doc.tryfastgpt.ai/docs/intro/
|
|||||||
|
|
||||||
### 1. 新建知识库,选择 Web 站点同步
|
### 1. 新建知识库,选择 Web 站点同步
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 2. 点击配置站点信息
|
### 2. 点击配置站点信息
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 3. 填写网址和选择器
|
### 3. 填写网址和选择器
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
好了, 现在点击开始同步,静等系统自动抓取网站信息即可。
|
好了, 现在点击开始同步,静等系统自动抓取网站信息即可。
|
||||||
|
|
||||||
|
|
||||||
## 创建应用,绑定知识库
|
## 创建应用,绑定知识库
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 选择器如何使用
|
## 选择器如何使用
|
||||||
|
|
||||||
@@ -77,4 +79,4 @@ curl https://doc.tryfastgpt.ai/docs/intro/
|
|||||||
|
|
||||||
另一组是`.docs-content div[data-prismjs-copy]`,含义是`docs-content` 类下包含`data-prismjs-copy`属性的`div`元素。
|
另一组是`.docs-content div[data-prismjs-copy]`,含义是`docs-content` 类下包含`data-prismjs-copy`属性的`div`元素。
|
||||||
|
|
||||||
把两组选择器用逗号隔开即可:`.docs-content .mb-0.d-flex, .docs-content div[data-prismjs-copy]`
|
把两组选择器用逗号隔开即可:`.docs-content .mb-0.d-flex, .docs-content div[data-prismjs-copy]`
|
||||||
|
|||||||
@@ -563,7 +563,7 @@ HTTP模块中,需要设置 3 个工具参数:
|
|||||||
"hidden"
|
"hidden"
|
||||||
],
|
],
|
||||||
"label": "",
|
"label": "",
|
||||||
"value": 1500,
|
"value": 5000,
|
||||||
"valueType": "number"
|
"valueType": "number"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,3 +55,10 @@ weight: 505
|
|||||||
应用发布后,即可在钉钉企业中使用机器人功能,可对机器人私聊。或者在群组添加机器人后`@机器人`,触发对话。
|
应用发布后,即可在钉钉企业中使用机器人功能,可对机器人私聊。或者在群组添加机器人后`@机器人`,触发对话。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### 如何新开一个聊天记录
|
||||||
|
|
||||||
|
如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。
|
||||||
@@ -94,4 +94,13 @@ Verification Token 默认生成的这个 Token 用于校验来源。但我们使
|
|||||||
1. 检查飞书机器人回调地址、权限等是否正确。
|
1. 检查飞书机器人回调地址、权限等是否正确。
|
||||||
2. 查看 FastGPT 对话日志,是否有对应的提问记录
|
2. 查看 FastGPT 对话日志,是否有对应的提问记录
|
||||||
3. 如果有记录,飞书没回应,则是没给机器人开权限。
|
3. 如果有记录,飞书没回应,则是没给机器人开权限。
|
||||||
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。(飞书机器人无法输入全局变量、文件、图片内容)
|
4. 如果没记录,则可能是应用运行报错了,可以先试试最简单的机器人。(飞书机器人无法输入全局变量、文件、图片内容)
|
||||||
|
|
||||||
|
### 如何新开一个聊天记录
|
||||||
|
|
||||||
|
飞书机器人的聊天记录 chatId 包含几种来源:
|
||||||
|
1. 私聊聊天框
|
||||||
|
2. 飞书话题群中单个话题
|
||||||
|
3. 群组聊天中,由群 id+个人id 组成。
|
||||||
|
|
||||||
|
如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。
|
||||||
@@ -122,3 +122,9 @@ weight: 506
|
|||||||
## 7. 开始使用
|
## 7. 开始使用
|
||||||
|
|
||||||
现在用户向公众号发消息,消息则会被转发到 FastGPT,通过公众号返回对话结果。
|
现在用户向公众号发消息,消息则会被转发到 FastGPT,通过公众号返回对话结果。
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
### 如何新开一个聊天记录
|
||||||
|
|
||||||
|
如果你想重置你的聊天记录,可以给机器人发送 `Reset` 消息(注意大小写),机器人会新开一个聊天记录。
|
||||||
51
docSite/nginx.conf
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#charset koi8-r;
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
# 设置UTF-8编码
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~\.txt$ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
charset utf-8;
|
||||||
|
}
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# proxy_pass http://127.0.0.1;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# root html;
|
||||||
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
|
# fastcgi_index index.php;
|
||||||
|
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||||
|
# include fastcgi_params;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# deny access to .htaccess files, if Apache's document root
|
||||||
|
# concurs with nginx's one
|
||||||
|
#
|
||||||
|
#location ~ /\.ht {
|
||||||
|
# deny all;
|
||||||
|
#}
|
||||||
|
}
|
||||||
23
env.d.ts
vendored
@@ -23,16 +23,19 @@ declare global {
|
|||||||
FE_DOMAIN: string;
|
FE_DOMAIN: string;
|
||||||
FILE_DOMAIN: string;
|
FILE_DOMAIN: string;
|
||||||
NEXT_PUBLIC_BASE_URL: string;
|
NEXT_PUBLIC_BASE_URL: string;
|
||||||
LOG_LEVEL: string;
|
LOG_LEVEL?: string;
|
||||||
STORE_LOG_LEVEL: string;
|
STORE_LOG_LEVEL?: string;
|
||||||
USE_IP_LIMIT: string;
|
USE_IP_LIMIT?: string;
|
||||||
WORKFLOW_MAX_RUN_TIMES: string;
|
WORKFLOW_MAX_RUN_TIMES?: string;
|
||||||
WORKFLOW_MAX_LOOP_TIMES: string;
|
WORKFLOW_MAX_LOOP_TIMES?: string;
|
||||||
CHECK_INTERNAL_IP: string;
|
CHECK_INTERNAL_IP?: string;
|
||||||
CHAT_LOG_URL: string;
|
CHAT_LOG_URL?: string;
|
||||||
CHAT_LOG_INTERVAL: string;
|
CHAT_LOG_INTERVAL?: string;
|
||||||
CHAT_LOG_SOURCE_ID_PREFIX: string;
|
CHAT_LOG_SOURCE_ID_PREFIX?: string;
|
||||||
ALLOWED_ORIGINS: string;
|
ALLOWED_ORIGINS?: string;
|
||||||
|
SHOW_COUPON?: string;
|
||||||
|
CONFIG_JSON_PATH?: string;
|
||||||
|
PASSWORD_LOGIN_LOCK_SECONDS?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
package.json
@@ -13,12 +13,18 @@
|
|||||||
"previewIcon": "node ./scripts/icon/index.js",
|
"previewIcon": "node ./scripts/icon/index.js",
|
||||||
"api:gen": "tsc ./scripts/openapi/index.ts && node ./scripts/openapi/index.js && npx @redocly/cli build-docs ./scripts/openapi/openapi.json -o ./projects/app/public/openapi/index.html",
|
"api:gen": "tsc ./scripts/openapi/index.ts && node ./scripts/openapi/index.js && npx @redocly/cli build-docs ./scripts/openapi/openapi.json -o ./projects/app/public/openapi/index.html",
|
||||||
"create:i18n": "node ./scripts/i18n/index.js",
|
"create:i18n": "node ./scripts/i18n/index.js",
|
||||||
|
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path .eslintignore",
|
||||||
|
"lint:fix": "eslint \"**/*.{ts,tsx}\" --fix --ignore-path .eslintignore",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:workflow": "vitest run workflow"
|
"test:workflow": "vitest run workflow"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@chakra-ui/cli": "^2.4.1",
|
"@chakra-ui/cli": "^2.4.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
|
"@typescript-eslint/parser": "^6.21.0",
|
||||||
"@vitest/coverage-v8": "^3.0.9",
|
"@vitest/coverage-v8": "^3.0.9",
|
||||||
|
"eslint": "^8.57.0",
|
||||||
|
"eslint-config-next": "^14.1.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"i18next": "23.16.8",
|
"i18next": "23.16.8",
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^13.3.0",
|
||||||
@@ -31,7 +37,10 @@
|
|||||||
"zhlint": "^0.7.4"
|
"zhlint": "^0.7.4"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"./**/**/*.{ts,tsx,scss}": "npm run format-code",
|
"./**/**/*.{ts,tsx,scss}": [
|
||||||
|
"npm run format-code",
|
||||||
|
"npm run lint:fix"
|
||||||
|
],
|
||||||
"./docSite/**/**/*.md": "npm run format-doc && npm run gen:llms"
|
"./docSite/**/**/*.md": "npm run format-doc && npm run gen:llms"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 502000 */
|
/* dataset: 502000 */
|
||||||
export enum AppErrEnum {
|
export enum AppErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 504000 */
|
/* dataset: 504000 */
|
||||||
export enum ChatErrEnum {
|
export enum ChatErrEnum {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
|
|
||||||
/* dataset: 507000 */
|
/* dataset: 507000 */
|
||||||
const startCode = 507000;
|
const startCode = 507000;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
|
|
||||||
/* dataset: 501000 */
|
/* dataset: 501000 */
|
||||||
export enum DatasetErrEnum {
|
export enum DatasetErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 506000 */
|
/* dataset: 506000 */
|
||||||
export enum OpenApiErrEnum {
|
export enum OpenApiErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 505000 */
|
/* dataset: 505000 */
|
||||||
export enum OutLinkErrEnum {
|
export enum OutLinkErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 508000 */
|
/* dataset: 508000 */
|
||||||
export enum PluginErrEnum {
|
export enum PluginErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* dataset: 509000 */
|
/* dataset: 509000 */
|
||||||
export enum SystemErrEnum {
|
export enum SystemErrEnum {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ErrType } from '../errorCode';
|
import { type ErrType } from '../errorCode';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
/* team: 503000 */
|
/* team: 503000 */
|
||||||
export enum UserErrEnum {
|
export enum UserErrEnum {
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ export const getErrText = (err: any, def = ''): any => {
|
|||||||
const msg: string =
|
const msg: string =
|
||||||
typeof err === 'string'
|
typeof err === 'string'
|
||||||
? err
|
? err
|
||||||
: err?.response?.data?.message || err?.response?.message || err?.message || def;
|
: err?.response?.data?.message ||
|
||||||
|
err?.response?.message ||
|
||||||
|
err?.message ||
|
||||||
|
err?.response?.data?.msg ||
|
||||||
|
err?.response?.msg ||
|
||||||
|
err?.msg ||
|
||||||
|
def;
|
||||||
// msg && console.log('error =>', msg);
|
// msg && console.log('error =>', msg);
|
||||||
return replaceSensitiveText(msg);
|
return replaceSensitiveText(msg);
|
||||||
};
|
};
|
||||||
|
|||||||
2
packages/global/common/file/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { OutLinkChatAuthProps } from '../../support/permission/chat.d';
|
import type { OutLinkChatAuthProps } from '../../support/permission/chat.d';
|
||||||
|
|
||||||
export type preUploadImgProps = OutLinkChatAuthProps & {
|
export type preUploadImgProps = OutLinkChatAuthProps & {
|
||||||
// expiredTime?: Date;
|
// expiredTime?: Date;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { detect } from 'jschardet';
|
import { detect } from 'jschardet';
|
||||||
import { documentFileType } from './constants';
|
import { documentFileType } from './constants';
|
||||||
import { ChatFileTypeEnum } from '../../core/chat/constants';
|
import { ChatFileTypeEnum } from '../../core/chat/constants';
|
||||||
import { UserChatItemValueItemType } from '../../core/chat/type';
|
import { type UserChatItemValueItemType } from '../../core/chat/type';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export const formatFileSize = (bytes: number): string => {
|
export const formatFileSize = (bytes: number): string => {
|
||||||
|
|||||||
2
packages/global/common/file/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { BucketNameEnum } from './constants';
|
import type { BucketNameEnum } from './constants';
|
||||||
|
|
||||||
export type FileTokenQuery = {
|
export type FileTokenQuery = {
|
||||||
bucketName: `${BucketNameEnum}`;
|
bucketName: `${BucketNameEnum}`;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { TrackEnum } from './constants';
|
import type { TrackEnum } from './constants';
|
||||||
import { OAuthEnum } from '../../../support/user/constant';
|
import { OAuthEnum } from '../../../support/user/constant';
|
||||||
import { AppTypeEnum } from '../../../core/app/constants';
|
import { AppTypeEnum } from '../../../core/app/constants';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ParentIdType } from './type';
|
import { type ParentIdType } from './type';
|
||||||
|
|
||||||
export const parseParentIdInMongo = (parentId: ParentIdType) => {
|
export const parseParentIdInMongo = (parentId: ParentIdType) => {
|
||||||
if (parentId === undefined) return {};
|
if (parentId === undefined) return {};
|
||||||
|
|||||||
18
packages/global/common/string/password.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
export const checkPasswordRule = (password: string) => {
|
||||||
|
const patterns = [
|
||||||
|
/\d/, // Contains digits
|
||||||
|
/[a-z]/, // Contains lowercase letters
|
||||||
|
/[A-Z]/, // Contains uppercase letters
|
||||||
|
/[!@#$%^&*()_+=-]/ // Contains special characters
|
||||||
|
];
|
||||||
|
const validChars = /^[\dA-Za-z!@#$%^&*()_+=-]{6,100}$/;
|
||||||
|
|
||||||
|
// Check length and valid characters
|
||||||
|
if (!validChars.test(password)) return false;
|
||||||
|
|
||||||
|
// Count how many patterns are satisfied
|
||||||
|
const matchCount = patterns.filter((pattern) => pattern.test(password)).length;
|
||||||
|
|
||||||
|
// Must satisfy at least 2 patterns
|
||||||
|
return matchCount >= 2;
|
||||||
|
};
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { SystemConfigsTypeEnum } from "./constants";
|
import type { SystemConfigsTypeEnum } from './constants';
|
||||||
|
|
||||||
export type SystemConfigsType = {
|
export type SystemConfigsType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
type: `${SystemConfigsTypeEnum}`;
|
type: `${SystemConfigsTypeEnum}`;
|
||||||
value: Record<string, any>;
|
value: Record<string, any>;
|
||||||
createTime: Date;
|
createTime: Date;
|
||||||
};
|
};
|
||||||
|
|||||||
10
packages/global/common/system/types/index.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
import { StandSubPlanLevelMapType, SubPlanType } from '../../../support/wallet/sub/type';
|
import type { SubPlanType } from '../../../support/wallet/sub/type';
|
||||||
|
import { StandSubPlanLevelMapType } from '../../../support/wallet/sub/type';
|
||||||
import type {
|
import type {
|
||||||
ChatModelItemType,
|
ChatModelItemType,
|
||||||
FunctionModelItemType,
|
FunctionModelItemType,
|
||||||
@@ -60,6 +61,7 @@ export type FastGPTFeConfigsType = {
|
|||||||
show_team_chat?: boolean;
|
show_team_chat?: boolean;
|
||||||
show_compliance_copywriting?: boolean;
|
show_compliance_copywriting?: boolean;
|
||||||
show_aiproxy?: boolean;
|
show_aiproxy?: boolean;
|
||||||
|
show_coupon?: boolean;
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
|
|
||||||
concatMd?: string;
|
concatMd?: string;
|
||||||
@@ -106,6 +108,12 @@ export type FastGPTFeConfigsType = {
|
|||||||
lafEnv?: string;
|
lafEnv?: string;
|
||||||
navbarItems?: NavbarItemType[];
|
navbarItems?: NavbarItemType[];
|
||||||
externalProviderWorkflowVariables?: ExternalProviderWorkflowVarType[];
|
externalProviderWorkflowVariables?: ExternalProviderWorkflowVarType[];
|
||||||
|
|
||||||
|
payConfig?: {
|
||||||
|
wx?: boolean;
|
||||||
|
alipay?: boolean;
|
||||||
|
bank?: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SystemEnvType = {
|
export type SystemEnvType = {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const getTimezoneOffset = (timeZone: string): number => {
|
|||||||
*
|
*
|
||||||
* Generated by Trelent
|
* Generated by Trelent
|
||||||
*/
|
*/
|
||||||
export const timezoneList = () => {
|
export const getTimeZoneList = () => {
|
||||||
const result = timezones
|
const result = timezones
|
||||||
.map((timezone) => {
|
.map((timezone) => {
|
||||||
try {
|
try {
|
||||||
@@ -71,6 +71,23 @@ export const timezoneList = () => {
|
|||||||
time: number;
|
time: number;
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
export const timeZoneList = getTimeZoneList();
|
||||||
|
|
||||||
|
export const getMongoTimezoneCode = (timeString: string) => {
|
||||||
|
if (!timeString.includes(':')) {
|
||||||
|
return '+00:00';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeString.includes('+')) {
|
||||||
|
const timezoneMatch = timeString.split('+');
|
||||||
|
return `+${timezoneMatch[1]}`;
|
||||||
|
} else if (timeString.includes('-')) {
|
||||||
|
const timezoneMatch = timeString.split('-');
|
||||||
|
return `-${timezoneMatch[1]}`;
|
||||||
|
} else {
|
||||||
|
return '+00:00';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const getSystemTime = (timeZone: string) => {
|
export const getSystemTime = (timeZone: string) => {
|
||||||
const timezoneDiff = getTimezoneOffset(timeZone);
|
const timezoneDiff = getTimezoneOffset(timeZone);
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
import { i18nT } from '../../../web/i18n/utils';
|
import { i18nT } from '../../../web/i18n/utils';
|
||||||
|
import type { CompletionUsage } from './type';
|
||||||
|
|
||||||
|
export const getLLMDefaultUsage = (): CompletionUsage => {
|
||||||
|
return {
|
||||||
|
prompt_tokens: 0,
|
||||||
|
completion_tokens: 0,
|
||||||
|
total_tokens: 0
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export enum ChatCompletionRequestMessageRoleEnum {
|
export enum ChatCompletionRequestMessageRoleEnum {
|
||||||
'System' = 'system',
|
'System' = 'system',
|
||||||
|
|||||||
2
packages/global/core/ai/model.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { ModelTypeEnum } from './model';
|
import type { ModelTypeEnum } from './model';
|
||||||
import type { ModelProviderIdType } from './provider';
|
import type { ModelProviderIdType } from './provider';
|
||||||
|
|
||||||
type PriceType = {
|
type PriceType = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { i18nT } from '../../../web/i18n/utils';
|
import { i18nT } from '../../../web/i18n/utils';
|
||||||
import type { LLMModelItemType, STTModelType, EmbeddingModelItemType } from './model.d';
|
import type { LLMModelItemType, STTModelType, EmbeddingModelItemType } from './model.d';
|
||||||
import { getModelProvider, ModelProviderIdType } from './provider';
|
import { getModelProvider, type ModelProviderIdType } from './provider';
|
||||||
|
|
||||||
export enum ModelTypeEnum {
|
export enum ModelTypeEnum {
|
||||||
llm = 'llm',
|
llm = 'llm',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PromptTemplateItem } from '../type.d';
|
import { type PromptTemplateItem } from '../type.d';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { getPromptByVersion } from './utils';
|
import { getPromptByVersion } from './utils';
|
||||||
|
|
||||||
@@ -7,6 +7,12 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_template'),
|
title: i18nT('app:template.standard_template'),
|
||||||
desc: i18nT('app:template.standard_template_des'),
|
desc: i18nT('app:template.standard_template_des'),
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `{
|
||||||
|
"id": "{{id}}",
|
||||||
|
"sourceName": "{{source}}",
|
||||||
|
"content": "{{q}}\n{{a}}"
|
||||||
|
}
|
||||||
|
`,
|
||||||
['4.9.2']: `{
|
['4.9.2']: `{
|
||||||
"sourceName": "{{source}}",
|
"sourceName": "{{source}}",
|
||||||
"updateTime": "{{updateTime}}",
|
"updateTime": "{{updateTime}}",
|
||||||
@@ -31,6 +37,12 @@ export const Prompt_QuoteTemplateList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_strict'),
|
title: i18nT('app:template.standard_strict'),
|
||||||
desc: i18nT('app:template.standard_strict_des'),
|
desc: i18nT('app:template.standard_strict_des'),
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `{
|
||||||
|
"id": "{{id}}",
|
||||||
|
"sourceName": "{{source}}",
|
||||||
|
"content": "{{q}}\n{{a}}"
|
||||||
|
}
|
||||||
|
`,
|
||||||
['4.9.2']: `{
|
['4.9.2']: `{
|
||||||
"sourceName": "{{source}}",
|
"sourceName": "{{source}}",
|
||||||
"updateTime": "{{updateTime}}",
|
"updateTime": "{{updateTime}}",
|
||||||
@@ -64,6 +76,21 @@ export const Prompt_userQuotePromptList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_template'),
|
title: i18nT('app:template.standard_template'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
|
<Reference>
|
||||||
|
{{quote}}
|
||||||
|
</Reference>
|
||||||
|
|
||||||
|
回答要求:
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||||
|
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
- 使用 [id](CITE) 格式来引用<Reference></Reference>中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](CITE)。"
|
||||||
|
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`,
|
||||||
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
<Reference>
|
<Reference>
|
||||||
@@ -103,6 +130,27 @@ export const Prompt_userQuotePromptList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_strict'),
|
title: i18nT('app:template.standard_strict'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
|
<Reference>
|
||||||
|
{{quote}}
|
||||||
|
</Reference>
|
||||||
|
|
||||||
|
思考流程:
|
||||||
|
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
||||||
|
2. 如果有关,你按下面的要求回答。
|
||||||
|
3. 如果无关,你直接拒绝回答本次问题。
|
||||||
|
|
||||||
|
回答要求:
|
||||||
|
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||||
|
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
- 使用 [id](CITE) 格式来引用<Reference></Reference>中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](CITE)。"
|
||||||
|
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。
|
||||||
|
|
||||||
|
问题:"""{{question}}"""`,
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
<Reference>
|
<Reference>
|
||||||
@@ -157,6 +205,21 @@ export const Prompt_systemQuotePromptList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_template'),
|
title: i18nT('app:template.standard_template'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
|
<Reference>
|
||||||
|
{{quote}}
|
||||||
|
</Reference>
|
||||||
|
|
||||||
|
回答要求:
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||||
|
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
- 使用 [id](CITE) 格式来引用<Reference></Reference>中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](CITE)。"
|
||||||
|
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`,
|
||||||
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
['4.9.2']: `使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
<Reference>
|
<Reference>
|
||||||
@@ -192,6 +255,27 @@ export const Prompt_systemQuotePromptList: PromptTemplateItem[] = [
|
|||||||
title: i18nT('app:template.standard_strict'),
|
title: i18nT('app:template.standard_strict'),
|
||||||
desc: '',
|
desc: '',
|
||||||
value: {
|
value: {
|
||||||
|
['4.9.7']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
|
<Reference>
|
||||||
|
{{quote}}
|
||||||
|
</Reference>
|
||||||
|
|
||||||
|
思考流程:
|
||||||
|
1. 判断问题是否与 <Reference></Reference> 标记中的内容有关。
|
||||||
|
2. 如果有关,你按下面的要求回答。
|
||||||
|
3. 如果无关,你直接拒绝回答本次问题。
|
||||||
|
|
||||||
|
回答要求:
|
||||||
|
- 避免提及你是从 <Reference></Reference> 获取的知识。
|
||||||
|
- 保持答案与 <Reference></Reference> 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
- 使用 [id](CITE) 格式来引用<Reference></Reference>中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在每段结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](CITE)。"
|
||||||
|
- 每段至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。
|
||||||
|
|
||||||
|
问题:"""{{question}}"""`,
|
||||||
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
['4.9.2']: `忘记你已有的知识,仅使用 <Reference></Reference> 标记中的内容作为本次对话的参考:
|
||||||
|
|
||||||
<Reference>
|
<Reference>
|
||||||
@@ -250,10 +334,10 @@ export const getQuotePrompt = (version?: string, role: 'user' | 'system' = 'user
|
|||||||
export const getDocumentQuotePrompt = (version: string) => {
|
export const getDocumentQuotePrompt = (version: string) => {
|
||||||
const promptMap = {
|
const promptMap = {
|
||||||
['4.9.2']: `将 <FilesContent></FilesContent> 中的内容作为本次对话的参考:
|
['4.9.2']: `将 <FilesContent></FilesContent> 中的内容作为本次对话的参考:
|
||||||
<FilesContent>
|
<FilesContent>
|
||||||
{{quote}}
|
{{quote}}
|
||||||
</FilesContent>
|
</FilesContent>
|
||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
return getPromptByVersion(version, promptMap);
|
return getPromptByVersion(version, promptMap);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const getExtractJsonToolPrompt = (version?: string) => {
|
|||||||
"""
|
"""
|
||||||
- {{description}}
|
- {{description}}
|
||||||
- 不是每个参数都是必须生成的,如果没有合适的参数值,不要生成该参数,或返回空字符串。
|
- 不是每个参数都是必须生成的,如果没有合适的参数值,不要生成该参数,或返回空字符串。
|
||||||
- 需要结合前面的对话内容,一起生成合适的参数。
|
- 需要结合历史记录,一起生成合适的参数。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
本次输入内容: """{{content}}"""
|
本次输入内容: """{{content}}"""
|
||||||
|
|||||||
14
packages/global/core/ai/prompt/dataset.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
export const getDatasetSearchToolResponsePrompt = () => {
|
||||||
|
return `## Role
|
||||||
|
你是一个知识库回答助手,可以 "quotes" 中的内容作为本次对话的参考。为了使回答结果更加可信并且可追溯,你需要在每段话结尾添加引用标记。
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
- 如果你不清楚答案,你需要澄清。
|
||||||
|
- 避免提及你是从 "quotes" 获取的知识。
|
||||||
|
- 保持答案与 "quotes" 中描述的一致。
|
||||||
|
- 使用 Markdown 语法优化回答格式。尤其是图片、表格、序列号等内容,需严格完整输出。
|
||||||
|
- 使用与问题相同的语言回答。
|
||||||
|
- 使用 [id](CITE) 格式来引用 "quotes" 中的知识,其中 CITE 是固定常量, id 为引文中的 id。
|
||||||
|
- 在每段话结尾自然地整合引用。例如: "FastGPT 是一个基于大语言模型(LLM)的知识库问答系统[67e517e74767063e882d6861](CITE)。"
|
||||||
|
- 每段话至少包含一个引用,也可根据内容需要加入多个引用,按顺序排列。`;
|
||||||
|
};
|
||||||
@@ -8,6 +8,7 @@ export type ModelProviderIdType =
|
|||||||
| 'MistralAI'
|
| 'MistralAI'
|
||||||
| 'Groq'
|
| 'Groq'
|
||||||
| 'Grok'
|
| 'Grok'
|
||||||
|
| 'Jina'
|
||||||
| 'AliCloud'
|
| 'AliCloud'
|
||||||
| 'Qwen'
|
| 'Qwen'
|
||||||
| 'Doubao'
|
| 'Doubao'
|
||||||
@@ -72,6 +73,11 @@ export const ModelProviderList: ModelProviderType[] = [
|
|||||||
name: 'Groq',
|
name: 'Groq',
|
||||||
avatar: 'model/groq'
|
avatar: 'model/groq'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'Jina',
|
||||||
|
name: 'Jina',
|
||||||
|
avatar: 'model/jina'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'Qwen',
|
id: 'Qwen',
|
||||||
name: i18nT('common:model_qwen'),
|
name: i18nT('common:model_qwen'),
|
||||||
|
|||||||
5
packages/global/core/ai/type.d.ts
vendored
@@ -9,7 +9,8 @@ import type {
|
|||||||
ChatCompletionAssistantMessageParam as SdkChatCompletionAssistantMessageParam
|
ChatCompletionAssistantMessageParam as SdkChatCompletionAssistantMessageParam
|
||||||
} from 'openai/resources';
|
} from 'openai/resources';
|
||||||
import { ChatMessageTypeEnum } from './constants';
|
import { ChatMessageTypeEnum } from './constants';
|
||||||
import { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
import type { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
||||||
|
import type { Stream } from 'openai/streaming';
|
||||||
export * from 'openai/resources';
|
export * from 'openai/resources';
|
||||||
|
|
||||||
// Extension of ChatCompletionMessageParam, Add file url type
|
// Extension of ChatCompletionMessageParam, Add file url type
|
||||||
@@ -59,6 +60,7 @@ export type ChatCompletionAssistantToolParam = {
|
|||||||
tool_calls: ChatCompletionMessageToolCall[];
|
tool_calls: ChatCompletionMessageToolCall[];
|
||||||
};
|
};
|
||||||
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
|
export type ChatCompletionMessageToolCall = ChatCompletionMessageToolCall & {
|
||||||
|
index?: number;
|
||||||
toolName?: string;
|
toolName?: string;
|
||||||
toolAvatar?: string;
|
toolAvatar?: string;
|
||||||
};
|
};
|
||||||
@@ -84,6 +86,7 @@ export type CompletionFinishReason =
|
|||||||
|
|
||||||
export default openai;
|
export default openai;
|
||||||
export * from 'openai';
|
export * from 'openai';
|
||||||
|
export type { Stream };
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
export type PromptTemplateItem = {
|
export type PromptTemplateItem = {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
AppTTSConfigType,
|
type AppTTSConfigType,
|
||||||
AppFileSelectConfigType,
|
type AppFileSelectConfigType,
|
||||||
AppWhisperConfigType,
|
type AppWhisperConfigType,
|
||||||
AppAutoExecuteConfigType,
|
type AppAutoExecuteConfigType,
|
||||||
AppQGConfigType
|
type AppQGConfigType
|
||||||
} from './type';
|
} from './type';
|
||||||
|
|
||||||
export enum AppTypeEnum {
|
export enum AppTypeEnum {
|
||||||
|
|||||||
6
packages/global/core/app/controller.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { ParentIdType } from 'common/parentFolder/type';
|
import type { ParentIdType } from 'common/parentFolder/type';
|
||||||
import { AppSchema } from './type';
|
import type { AppSchema } from './type';
|
||||||
import { AppTypeEnum } from './constants';
|
import type { AppTypeEnum } from './constants';
|
||||||
|
|
||||||
export type CreateAppProps = {
|
export type CreateAppProps = {
|
||||||
parentId?: ParentIdType;
|
parentId?: ParentIdType;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { getNanoid } from '../../../common/string/tools';
|
import { getNanoid } from '../../../common/string/tools';
|
||||||
import { OpenApiJsonSchema } from './type';
|
import { type OpenApiJsonSchema } from './type';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { OpenAPIV3 } from 'openapi-types';
|
import type { OpenAPIV3 } from 'openapi-types';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
|
import { type FlowNodeInputItemType, type FlowNodeOutputItemType } from '../../workflow/type/io';
|
||||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
||||||
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||||
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
||||||
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
||||||
import { HttpNode468 } from '../../workflow/template/system/http468';
|
import { HttpNode468 } from '../../workflow/template/system/http468';
|
||||||
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
import { type HttpParamAndHeaderItemType } from '../../workflow/api';
|
||||||
import { StoreNodeItemType } from '../../workflow/type/node';
|
import { type StoreNodeItemType } from '../../workflow/type/node';
|
||||||
import { HttpImgUrl } from '../../../common/file/image/constants';
|
import { HttpImgUrl } from '../../../common/file/image/constants';
|
||||||
import SwaggerParser from '@apidevtools/swagger-parser';
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
||||||
import { getHandleId } from '../../workflow/utils';
|
import { getHandleId } from '../../workflow/utils';
|
||||||
import { CreateHttpPluginChildrenPros } from '../controller';
|
import { type CreateHttpPluginChildrenPros } from '../controller';
|
||||||
import { AppTypeEnum } from '../constants';
|
import { AppTypeEnum } from '../constants';
|
||||||
import type { StoreEdgeItemType } from '../../workflow/type/edge';
|
import type { StoreEdgeItemType } from '../../workflow/type/edge';
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../workflow/node/constant';
|
} from '../../workflow/node/constant';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { ToolType } from '../type';
|
import { type ToolType } from '../type';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
import { RuntimeNodeItemType } from '../../workflow/runtime/type';
|
import { type RuntimeNodeItemType } from '../../workflow/runtime/type';
|
||||||
|
|
||||||
export const getMCPToolSetRuntimeNode = ({
|
export const getMCPToolSetRuntimeNode = ({
|
||||||
url,
|
url,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { StoreNodeItemType } from '../../workflow/type/node';
|
import { type StoreNodeItemType } from '../../workflow/type/node';
|
||||||
import { FlowNodeInputItemType } from '../../workflow/type/io';
|
import { type FlowNodeInputItemType } from '../../workflow/type/io';
|
||||||
import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
||||||
|
|
||||||
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
||||||
|
|||||||
18
packages/global/core/app/type.d.ts
vendored
@@ -1,20 +1,20 @@
|
|||||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { AppTypeEnum } from './constants';
|
import type { AppTypeEnum } from './constants';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import {
|
import type {
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
VariableInputEnum,
|
VariableInputEnum,
|
||||||
WorkflowIOValueTypeEnum
|
WorkflowIOValueTypeEnum
|
||||||
} from '../workflow/constants';
|
} from '../workflow/constants';
|
||||||
import { SelectedDatasetType } from '../workflow/api';
|
import type { SelectedDatasetType } from '../workflow/api';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import type { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import type { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { AppPermission } from '../../support/permission/app/controller';
|
import type { AppPermission } from '../../support/permission/app/controller';
|
||||||
import { ParentIdType } from '../../common/parentFolder/type';
|
import type { ParentIdType } from '../../common/parentFolder/type';
|
||||||
import { FlowNodeInputTypeEnum } from '../../core/workflow/node/constant';
|
import { FlowNodeInputTypeEnum } from '../../core/workflow/node/constant';
|
||||||
import { WorkflowTemplateBasicType } from '@fastgpt/global/core/workflow/type';
|
import type { WorkflowTemplateBasicType } from '@fastgpt/global/core/workflow/type';
|
||||||
import { SourceMemberType } from '../../support/user/type';
|
import type { SourceMemberType } from '../../support/user/type';
|
||||||
|
|
||||||
export type ToolType = {
|
export type ToolType = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
|||||||
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
||||||
import { getAppChatConfig } from '../workflow/utils';
|
import { getAppChatConfig } from '../workflow/utils';
|
||||||
import { StoreNodeItemType } from '../workflow/type/node';
|
import { type StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { WorkflowTemplateBasicType } from '../workflow/type';
|
import { type WorkflowTemplateBasicType } from '../workflow/type';
|
||||||
import { AppTypeEnum } from './constants';
|
import { AppTypeEnum } from './constants';
|
||||||
import { AppErrEnum } from '../../common/error/code/app';
|
import { AppErrEnum } from '../../common/error/code/app';
|
||||||
import { PluginErrEnum } from '../../common/error/code/plugin';
|
import { PluginErrEnum } from '../../common/error/code/plugin';
|
||||||
@@ -26,7 +26,7 @@ export const getDefaultAppForm = (): AppSimpleEditFormType => {
|
|||||||
similarity: 0.4,
|
similarity: 0.4,
|
||||||
limit: 3000,
|
limit: 3000,
|
||||||
searchMode: DatasetSearchModeEnum.embedding,
|
searchMode: DatasetSearchModeEnum.embedding,
|
||||||
usingReRank: false,
|
usingReRank: true,
|
||||||
rerankModel: '',
|
rerankModel: '',
|
||||||
rerankWeight: 0.5,
|
rerankWeight: 0.5,
|
||||||
datasetSearchUsingExtensionQuery: true,
|
datasetSearchUsingExtensionQuery: true,
|
||||||
|
|||||||
5
packages/global/core/app/version.d.ts
vendored
@@ -1,7 +1,8 @@
|
|||||||
import { TeamMemberStatusEnum } from 'support/user/team/constant';
|
import { TeamMemberStatusEnum } from 'support/user/team/constant';
|
||||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||||
import { AppChatConfigType, AppSchema } from './type';
|
import type { AppSchema } from './type';
|
||||||
import { SourceMemberType } from 'support/user/type';
|
import { AppChatConfigType } from './type';
|
||||||
|
import type { SourceMemberType } from 'support/user/type';
|
||||||
|
|
||||||
export type AppVersionSchemaType = {
|
export type AppVersionSchemaType = {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
2
packages/global/core/chat/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { OutLinkChatAuthProps } from '../../support/permission/chat';
|
import type { OutLinkChatAuthProps } from '../../support/permission/chat';
|
||||||
|
|
||||||
export type UpdateChatFeedbackProps = OutLinkChatAuthProps & {
|
export type UpdateChatFeedbackProps = OutLinkChatAuthProps & {
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|||||||
24
packages/global/core/chat/type.d.ts
vendored
@@ -1,22 +1,23 @@
|
|||||||
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
||||||
import { SearchDataResponseItemType } from '../dataset/type';
|
import type { SearchDataResponseItemType } from '../dataset/type';
|
||||||
import {
|
import type {
|
||||||
ChatFileTypeEnum,
|
ChatFileTypeEnum,
|
||||||
ChatItemValueTypeEnum,
|
ChatItemValueTypeEnum,
|
||||||
ChatRoleEnum,
|
ChatRoleEnum,
|
||||||
ChatSourceEnum,
|
ChatSourceEnum,
|
||||||
ChatStatusEnum
|
ChatStatusEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
import type { FlowNodeTypeEnum } from '../workflow/node/constant';
|
||||||
import { NodeOutputKeyEnum } from '../workflow/constants';
|
import type { NodeOutputKeyEnum } from '../workflow/constants';
|
||||||
import { DispatchNodeResponseKeyEnum } from '../workflow/runtime/constants';
|
import type { DispatchNodeResponseKeyEnum } from '../workflow/runtime/constants';
|
||||||
import { AppChatConfigType, AppSchema, VariableItemType } from '../app/type';
|
import type { AppSchema, VariableItemType } from '../app/type';
|
||||||
|
import { AppChatConfigType } from '../app/type';
|
||||||
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
import type { AppSchema as AppType } from '@fastgpt/global/core/app/type.d';
|
||||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||||
import { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
import type { DispatchNodeResponseType } from '../workflow/runtime/type.d';
|
||||||
import { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
import type { ChatBoxInputType } from '../../../../projects/app/src/components/core/chat/ChatContainer/ChatBox/type';
|
||||||
import { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
import type { WorkflowInteractiveResponseType } from '../workflow/template/system/interactive/type';
|
||||||
import { FlowNodeInputItemType } from '../workflow/type/io';
|
import type { FlowNodeInputItemType } from '../workflow/type/io';
|
||||||
|
|
||||||
export type ChatSchema = {
|
export type ChatSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
@@ -110,6 +111,7 @@ export type ChatItemSchema = (UserChatItemType | SystemChatItemType | AIChatItem
|
|||||||
tmbId: string;
|
tmbId: string;
|
||||||
appId: string;
|
appId: string;
|
||||||
time: Date;
|
time: Date;
|
||||||
|
durationSeconds?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AdminFbkType = {
|
export type AdminFbkType = {
|
||||||
@@ -122,7 +124,6 @@ export type AdminFbkType = {
|
|||||||
|
|
||||||
/* --------- chat item ---------- */
|
/* --------- chat item ---------- */
|
||||||
export type ResponseTagItemType = {
|
export type ResponseTagItemType = {
|
||||||
totalRunningTime?: number;
|
|
||||||
totalQuoteList?: SearchDataResponseItemType[];
|
totalQuoteList?: SearchDataResponseItemType[];
|
||||||
llmModuleAccount?: number;
|
llmModuleAccount?: number;
|
||||||
historyPreviewLength?: number;
|
historyPreviewLength?: number;
|
||||||
@@ -141,6 +142,7 @@ export type ChatSiteItemType = (UserChatItemType | SystemChatItemType | AIChatIt
|
|||||||
ttsBuffer?: Uint8Array;
|
ttsBuffer?: Uint8Array;
|
||||||
responseData?: ChatHistoryItemResType[];
|
responseData?: ChatHistoryItemResType[];
|
||||||
time?: Date;
|
time?: Date;
|
||||||
|
durationSeconds?: number;
|
||||||
} & ChatBoxInputType &
|
} & ChatBoxInputType &
|
||||||
ResponseTagItemType;
|
ResponseTagItemType;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { DispatchNodeResponseType } from '../workflow/runtime/type';
|
import { type DispatchNodeResponseType } from '../workflow/runtime/type';
|
||||||
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
||||||
import { ChatItemValueTypeEnum, ChatRoleEnum, ChatSourceEnum } from './constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum, ChatSourceEnum } from './constants';
|
||||||
import { ChatHistoryItemResType, ChatItemType, UserChatItemValueItemType } from './type.d';
|
import {
|
||||||
|
type AIChatItemValueItemType,
|
||||||
|
type ChatHistoryItemResType,
|
||||||
|
type ChatItemType,
|
||||||
|
type UserChatItemValueItemType
|
||||||
|
} from './type.d';
|
||||||
import { sliceStrStartEnd } from '../../common/string/tools';
|
import { sliceStrStartEnd } from '../../common/string/tools';
|
||||||
import { PublishChannelEnum } from '../../support/outLink/constant';
|
import { PublishChannelEnum } from '../../support/outLink/constant';
|
||||||
|
import { removeDatasetCiteText } from '../../../service/core/ai/utils';
|
||||||
|
|
||||||
// Concat 2 -> 1, and sort by role
|
// Concat 2 -> 1, and sort by role
|
||||||
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
|
export const concatHistories = (histories1: ChatItemType[], histories2: ChatItemType[]) => {
|
||||||
@@ -77,13 +83,7 @@ export const getHistoryPreview = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const filterModuleTypeList: any[] = [
|
// Filter workflow public response
|
||||||
FlowNodeTypeEnum.pluginModule,
|
|
||||||
FlowNodeTypeEnum.datasetSearchNode,
|
|
||||||
FlowNodeTypeEnum.tools,
|
|
||||||
FlowNodeTypeEnum.pluginOutput
|
|
||||||
];
|
|
||||||
|
|
||||||
export const filterPublicNodeResponseData = ({
|
export const filterPublicNodeResponseData = ({
|
||||||
flowResponses = [],
|
flowResponses = [],
|
||||||
responseDetail = false
|
responseDetail = false
|
||||||
@@ -91,12 +91,19 @@ export const filterPublicNodeResponseData = ({
|
|||||||
flowResponses?: ChatHistoryItemResType[];
|
flowResponses?: ChatHistoryItemResType[];
|
||||||
responseDetail?: boolean;
|
responseDetail?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
|
const publicNodeMap: Record<string, any> = {
|
||||||
|
[FlowNodeTypeEnum.pluginModule]: true,
|
||||||
|
[FlowNodeTypeEnum.datasetSearchNode]: true,
|
||||||
|
[FlowNodeTypeEnum.tools]: true,
|
||||||
|
[FlowNodeTypeEnum.pluginOutput]: true
|
||||||
|
};
|
||||||
|
|
||||||
const filedList = responseDetail
|
const filedList = responseDetail
|
||||||
? ['quoteList', 'moduleType', 'pluginOutput', 'runningTime']
|
? ['quoteList', 'moduleType', 'pluginOutput', 'runningTime']
|
||||||
: ['moduleType', 'pluginOutput', 'runningTime'];
|
: ['moduleType', 'pluginOutput', 'runningTime'];
|
||||||
|
|
||||||
return flowResponses
|
return flowResponses
|
||||||
.filter((item) => filterModuleTypeList.includes(item.moduleType))
|
.filter((item) => publicNodeMap[item.moduleType])
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
const obj: DispatchNodeResponseType = {};
|
const obj: DispatchNodeResponseType = {};
|
||||||
for (let key in item) {
|
for (let key in item) {
|
||||||
@@ -112,6 +119,40 @@ export const filterPublicNodeResponseData = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Remove dataset cite in ai response
|
||||||
|
export const removeAIResponseCite = <T extends AIChatItemValueItemType[] | string>(
|
||||||
|
value: T,
|
||||||
|
retainCite: boolean
|
||||||
|
): T => {
|
||||||
|
if (retainCite) return value;
|
||||||
|
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return removeDatasetCiteText(value, false) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value.map<AIChatItemValueItemType>((item) => {
|
||||||
|
if (item.text?.content) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
text: {
|
||||||
|
...item.text,
|
||||||
|
content: removeDatasetCiteText(item.text.content, false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item.reasoning?.content) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
reasoning: {
|
||||||
|
...item.reasoning,
|
||||||
|
content: removeDatasetCiteText(item.reasoning.content, false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}) as T;
|
||||||
|
};
|
||||||
|
|
||||||
export const removeEmptyUserInput = (input?: UserChatItemValueItemType[]) => {
|
export const removeEmptyUserInput = (input?: UserChatItemValueItemType[]) => {
|
||||||
return (
|
return (
|
||||||
input?.filter((item) => {
|
input?.filter((item) => {
|
||||||
@@ -185,7 +226,6 @@ export const mergeChatResponseData = (
|
|||||||
runningTime: +((lastResponse.runningTime || 0) + (curr.runningTime || 0)).toFixed(2),
|
runningTime: +((lastResponse.runningTime || 0) + (curr.runningTime || 0)).toFixed(2),
|
||||||
totalPoints: (lastResponse.totalPoints || 0) + (curr.totalPoints || 0),
|
totalPoints: (lastResponse.totalPoints || 0) + (curr.totalPoints || 0),
|
||||||
childTotalPoints: (lastResponse.childTotalPoints || 0) + (curr.childTotalPoints || 0),
|
childTotalPoints: (lastResponse.childTotalPoints || 0) + (curr.childTotalPoints || 0),
|
||||||
toolCallTokens: (lastResponse.toolCallTokens || 0) + (curr.toolCallTokens || 0),
|
|
||||||
toolDetail: [...(lastResponse.toolDetail || []), ...(curr.toolDetail || [])],
|
toolDetail: [...(lastResponse.toolDetail || []), ...(curr.toolDetail || [])],
|
||||||
loopDetail: [...(lastResponse.loopDetail || []), ...(curr.loopDetail || [])],
|
loopDetail: [...(lastResponse.loopDetail || []), ...(curr.loopDetail || [])],
|
||||||
pluginDetail: [...(lastResponse.pluginDetail || []), ...(curr.pluginDetail || [])]
|
pluginDetail: [...(lastResponse.pluginDetail || []), ...(curr.pluginDetail || [])]
|
||||||
|
|||||||
6
packages/global/core/dataset/api.d.ts
vendored
@@ -1,12 +1,12 @@
|
|||||||
import { DatasetDataIndexItemType, DatasetSchemaType } from './type';
|
import type { DatasetDataIndexItemType, DatasetSchemaType } from './type';
|
||||||
import {
|
import type {
|
||||||
DatasetCollectionTypeEnum,
|
DatasetCollectionTypeEnum,
|
||||||
DatasetCollectionDataProcessModeEnum,
|
DatasetCollectionDataProcessModeEnum,
|
||||||
ChunkSettingModeEnum,
|
ChunkSettingModeEnum,
|
||||||
DataChunkSplitModeEnum
|
DataChunkSplitModeEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import type { LLMModelItemType } from '../ai/model.d';
|
import type { LLMModelItemType } from '../ai/model.d';
|
||||||
import { ParentIdType } from 'common/parentFolder/type';
|
import type { ParentIdType } from 'common/parentFolder/type';
|
||||||
|
|
||||||
/* ================= dataset ===================== */
|
/* ================= dataset ===================== */
|
||||||
export type DatasetUpdateBody = {
|
export type DatasetUpdateBody = {
|
||||||
|
|||||||
32
packages/global/core/dataset/apiDataset.d.ts
vendored
@@ -1,8 +1,9 @@
|
|||||||
import { RequireOnlyOne } from '../../common/type/utils';
|
import { RequireOnlyOne } from '../../common/type/utils';
|
||||||
|
import type { ParentIdType } from '../../common/parentFolder/type.d';
|
||||||
|
|
||||||
export type APIFileItem = {
|
export type APIFileItem = {
|
||||||
id: string;
|
id: string;
|
||||||
parentId: string | null;
|
parentId: ParentIdType;
|
||||||
name: string;
|
name: string;
|
||||||
type: 'file' | 'folder';
|
type: 'file' | 'folder';
|
||||||
updateTime: Date;
|
updateTime: Date;
|
||||||
@@ -10,10 +11,24 @@ export type APIFileItem = {
|
|||||||
hasChild?: boolean;
|
hasChild?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Api dataset config
|
||||||
export type APIFileServer = {
|
export type APIFileServer = {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
authorization: string;
|
authorization?: string;
|
||||||
|
basePath?: string;
|
||||||
};
|
};
|
||||||
|
export type FeishuServer = {
|
||||||
|
appId: string;
|
||||||
|
appSecret?: string;
|
||||||
|
folderToken: string;
|
||||||
|
};
|
||||||
|
export type YuqueServer = {
|
||||||
|
userId: string;
|
||||||
|
token?: string;
|
||||||
|
basePath?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Api dataset api
|
||||||
|
|
||||||
export type APIFileListResponse = APIFileItem[];
|
export type APIFileListResponse = APIFileItem[];
|
||||||
|
|
||||||
@@ -26,13 +41,8 @@ export type APIFileReadResponse = {
|
|||||||
url: string;
|
url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FeishuServer = {
|
export type ApiDatasetDetailResponse = {
|
||||||
appId: string;
|
id: string;
|
||||||
appSecret: string;
|
name: string;
|
||||||
folderToken: string;
|
parentId: ParentIdType;
|
||||||
};
|
|
||||||
|
|
||||||
export type YuqueServer = {
|
|
||||||
userId: string;
|
|
||||||
token: string;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { UpdateClbPermissionProps } from '../../support/permission/collaborator';
|
import type { UpdateClbPermissionProps } from '../../support/permission/collaborator';
|
||||||
import { PermissionValueType } from '../../support/permission/type';
|
import { PermissionValueType } from '../../support/permission/type';
|
||||||
import { RequireOnlyOne } from '../../common/type/utils';
|
import type { RequireOnlyOne } from '../../common/type/utils';
|
||||||
|
|
||||||
export type UpdateDatasetCollaboratorBody = UpdateClbPermissionProps & {
|
export type UpdateDatasetCollaboratorBody = UpdateClbPermissionProps & {
|
||||||
datasetId: string;
|
datasetId: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DatasetCollectionTypeEnum } from '../constants';
|
import { DatasetCollectionTypeEnum } from '../constants';
|
||||||
import { DatasetCollectionSchemaType } from '../type';
|
import { type DatasetCollectionSchemaType } from '../type';
|
||||||
|
|
||||||
export const getCollectionSourceData = (collection?: DatasetCollectionSchemaType) => {
|
export const getCollectionSourceData = (collection?: DatasetCollectionSchemaType) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -19,32 +19,32 @@ export const DatasetTypeMap = {
|
|||||||
[DatasetTypeEnum.dataset]: {
|
[DatasetTypeEnum.dataset]: {
|
||||||
icon: 'core/dataset/commonDatasetOutline',
|
icon: 'core/dataset/commonDatasetOutline',
|
||||||
label: i18nT('dataset:common_dataset'),
|
label: i18nT('dataset:common_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.websiteDataset]: {
|
[DatasetTypeEnum.websiteDataset]: {
|
||||||
icon: 'core/dataset/websiteDatasetOutline',
|
icon: 'core/dataset/websiteDatasetOutline',
|
||||||
label: i18nT('dataset:website_dataset'),
|
label: i18nT('dataset:website_dataset'),
|
||||||
collectionLabel: i18nT('common:common.Website')
|
collectionLabel: i18nT('common:Website')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.externalFile]: {
|
[DatasetTypeEnum.externalFile]: {
|
||||||
icon: 'core/dataset/externalDatasetOutline',
|
icon: 'core/dataset/externalDatasetOutline',
|
||||||
label: i18nT('dataset:external_file'),
|
label: i18nT('dataset:external_file'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.apiDataset]: {
|
[DatasetTypeEnum.apiDataset]: {
|
||||||
icon: 'core/dataset/externalDatasetOutline',
|
icon: 'core/dataset/externalDatasetOutline',
|
||||||
label: i18nT('dataset:api_file'),
|
label: i18nT('dataset:api_file'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.feishu]: {
|
[DatasetTypeEnum.feishu]: {
|
||||||
icon: 'core/dataset/feishuDatasetOutline',
|
icon: 'core/dataset/feishuDatasetOutline',
|
||||||
label: i18nT('dataset:feishu_dataset'),
|
label: i18nT('dataset:feishu_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
},
|
},
|
||||||
[DatasetTypeEnum.yuque]: {
|
[DatasetTypeEnum.yuque]: {
|
||||||
icon: 'core/dataset/yuqueDatasetOutline',
|
icon: 'core/dataset/yuqueDatasetOutline',
|
||||||
label: i18nT('dataset:yuque_dataset'),
|
label: i18nT('dataset:yuque_dataset'),
|
||||||
collectionLabel: i18nT('common:common.File')
|
collectionLabel: i18nT('common:File')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { SearchScoreTypeEnum } from '../constants';
|
import { SearchScoreTypeEnum } from '../constants';
|
||||||
import { SearchDataResponseItemType } from '../type';
|
import { type SearchDataResponseItemType } from '../type';
|
||||||
|
|
||||||
/* dataset search result concat */
|
/* dataset search result concat */
|
||||||
export const datasetSearchResultConcat = (
|
export const datasetSearchResultConcat = (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { PushDatasetDataChunkProps } from '../api';
|
import type { PushDatasetDataChunkProps } from '../api';
|
||||||
import { TrainingModeEnum } from '../constants';
|
import type { TrainingModeEnum } from '../constants';
|
||||||
|
|
||||||
export type PushDataToTrainingQueueProps = {
|
export type PushDataToTrainingQueueProps = {
|
||||||
teamId: string;
|
teamId: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { EmbeddingModelItemType, LLMModelItemType } from '../../../core/ai/model.d';
|
import { type EmbeddingModelItemType, type LLMModelItemType } from '../../../core/ai/model.d';
|
||||||
import {
|
import {
|
||||||
ChunkSettingModeEnum,
|
ChunkSettingModeEnum,
|
||||||
DataChunkSplitModeEnum,
|
DataChunkSplitModeEnum,
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
export const minChunkSize = 64; // min index and chunk size
|
export const minChunkSize = 64; // min index and chunk size
|
||||||
|
|
||||||
// Chunk size
|
// Chunk size
|
||||||
export const chunkAutoChunkSize = 1500;
|
export const chunkAutoChunkSize = 1000;
|
||||||
export const getMaxChunkSize = (model: LLMModelItemType) => {
|
export const getMaxChunkSize = (model: LLMModelItemType) => {
|
||||||
return Math.max(model.maxContext - model.maxResponse, 2000);
|
return Math.max(model.maxContext - model.maxResponse, 2000);
|
||||||
};
|
};
|
||||||
|
|||||||
12
packages/global/core/dataset/type.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
import type { LLMModelItemType, EmbeddingModelItemType } from '../../core/ai/model.d';
|
import type { LLMModelItemType, EmbeddingModelItemType } from '../../core/ai/model.d';
|
||||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||||
import { PushDatasetDataChunkProps } from './api';
|
import { PushDatasetDataChunkProps } from './api';
|
||||||
import {
|
import type {
|
||||||
DataChunkSplitModeEnum,
|
DataChunkSplitModeEnum,
|
||||||
DatasetCollectionDataProcessModeEnum,
|
DatasetCollectionDataProcessModeEnum,
|
||||||
DatasetCollectionTypeEnum,
|
DatasetCollectionTypeEnum,
|
||||||
@@ -10,12 +10,12 @@ import {
|
|||||||
SearchScoreTypeEnum,
|
SearchScoreTypeEnum,
|
||||||
TrainingModeEnum
|
TrainingModeEnum
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { DatasetPermission } from '../../support/permission/dataset/controller';
|
import type { DatasetPermission } from '../../support/permission/dataset/controller';
|
||||||
import { Permission } from '../../support/permission/controller';
|
import { Permission } from '../../support/permission/controller';
|
||||||
import { APIFileServer, FeishuServer, YuqueServer } from './apiDataset';
|
import type { APIFileServer, FeishuServer, YuqueServer } from './apiDataset';
|
||||||
import { SourceMemberType } from 'support/user/type';
|
import type { SourceMemberType } from 'support/user/type';
|
||||||
import { DatasetDataIndexTypeEnum } from './data/constants';
|
import type { DatasetDataIndexTypeEnum } from './data/constants';
|
||||||
import { ChunkSettingModeEnum } from './constants';
|
import type { ChunkSettingModeEnum } from './constants';
|
||||||
|
|
||||||
export type ChunkSettingsType = {
|
export type ChunkSettingsType = {
|
||||||
trainingType: DatasetCollectionDataProcessModeEnum;
|
trainingType: DatasetCollectionDataProcessModeEnum;
|
||||||
|
|||||||
4
packages/global/core/plugin/controller.d.ts
vendored
@@ -1,6 +1,6 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginTypeEnum } from './constants';
|
import type { PluginTypeEnum } from './constants';
|
||||||
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
||||||
|
|
||||||
export type CreateOnePluginParams = {
|
export type CreateOnePluginParams = {
|
||||||
|
|||||||
6
packages/global/core/plugin/type.d.ts
vendored
@@ -1,9 +1,9 @@
|
|||||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||||
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
||||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||||
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
import type { PluginSourceEnum, PluginTypeEnum } from './constants';
|
||||||
import { MethodType } from './controller';
|
import { MethodType } from './controller';
|
||||||
import { FlowNodeTemplateType } from '../workflow/type/node';
|
import type { FlowNodeTemplateType } from '../workflow/type/node';
|
||||||
|
|
||||||
export type PluginItemSchema = {
|
export type PluginItemSchema = {
|
||||||
_id: string;
|
_id: string;
|
||||||
|
|||||||
2
packages/global/core/workflow/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import { EmbeddingModelItemType } from '../ai/model.d';
|
import type { EmbeddingModelItemType } from '../ai/model.d';
|
||||||
import { NodeInputKeyEnum } from './constants';
|
import { NodeInputKeyEnum } from './constants';
|
||||||
|
|
||||||
export type SelectedDatasetType = {
|
export type SelectedDatasetType = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FlowNodeInputItemType } from '../../type/io';
|
import { type FlowNodeInputItemType } from '../../type/io';
|
||||||
|
|
||||||
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { FlowNodeInputTypeEnum } from '../node/constant';
|
|||||||
|
|
||||||
export enum SseResponseEventEnum {
|
export enum SseResponseEventEnum {
|
||||||
error = 'error',
|
error = 'error',
|
||||||
|
workflowDuration = 'workflowDuration', // workflow duration
|
||||||
answer = 'answer', // animation stream
|
answer = 'answer', // animation stream
|
||||||
fastAnswer = 'fastAnswer', // direct answer text, not animation
|
fastAnswer = 'fastAnswer', // direct answer text, not animation
|
||||||
flowNodeStatus = 'flowNodeStatus', // update node status
|
flowNodeStatus = 'flowNodeStatus', // update node status
|
||||||
|
|||||||
48
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -1,29 +1,32 @@
|
|||||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
import type { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||||
import {
|
import type {
|
||||||
ChatItemType,
|
ChatItemType,
|
||||||
UserChatItemValueItemType,
|
UserChatItemValueItemType,
|
||||||
ToolRunResponseItemType,
|
ToolRunResponseItemType,
|
||||||
NodeOutputItemType,
|
|
||||||
AIChatItemValueItemType
|
AIChatItemValueItemType
|
||||||
} from '../../chat/type';
|
} from '../../chat/type';
|
||||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
import { NodeOutputItemType } from '../../chat/type';
|
||||||
import { StoreNodeItemType } from '../type/node';
|
import type { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
||||||
import { DispatchNodeResponseKeyEnum } from './constants';
|
import type { StoreNodeItemType } from '../type/node';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import type { DispatchNodeResponseKeyEnum } from './constants';
|
||||||
import { NodeInputKeyEnum } from '../constants';
|
import type { StoreEdgeItemType } from '../type/edge';
|
||||||
import { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
import type { NodeInputKeyEnum } from '../constants';
|
||||||
import { NextApiResponse } from 'next';
|
import type { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
||||||
|
import type { NextApiResponse } from 'next';
|
||||||
import { UserModelSchema } from '../../../support/user/type';
|
import { UserModelSchema } from '../../../support/user/type';
|
||||||
import { AppDetailType, AppSchema } from '../../app/type';
|
import type { AppSchema } from '../../app/type';
|
||||||
import { RuntimeNodeItemType } from '../runtime/type';
|
import { AppDetailType } from '../../app/type';
|
||||||
import { RuntimeEdgeItemType } from './edge';
|
import type { RuntimeNodeItemType } from '../runtime/type';
|
||||||
import { ReadFileNodeResponse } from '../template/system/readFiles/type';
|
import type { RuntimeEdgeItemType } from './edge';
|
||||||
|
import type { ReadFileNodeResponse } from '../template/system/readFiles/type';
|
||||||
import { UserSelectOptionType } from '../template/system/userSelect/type';
|
import { UserSelectOptionType } from '../template/system/userSelect/type';
|
||||||
import { WorkflowResponseType } from '../../../../service/core/workflow/dispatch/type';
|
import type { WorkflowResponseType } from '../../../../service/core/workflow/dispatch/type';
|
||||||
import { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
import type { AiChatQuoteRoleType } from '../template/system/aiChat/type';
|
||||||
import { LafAccountType, OpenaiAccountType } from '../../../support/user/team/type';
|
import type { OpenaiAccountType } from '../../../support/user/team/type';
|
||||||
import { CompletionFinishReason } from '../../ai/type';
|
import { LafAccountType } from '../../../support/user/team/type';
|
||||||
import { WorkflowInteractiveResponseType } from '../template/system/interactive/type';
|
import type { CompletionFinishReason } from '../../ai/type';
|
||||||
|
import type { WorkflowInteractiveResponseType } from '../template/system/interactive/type';
|
||||||
|
import type { SearchDataResponseItemType } from '../../dataset/type';
|
||||||
export type ExternalProviderType = {
|
export type ExternalProviderType = {
|
||||||
openaiAccount?: OpenaiAccountType;
|
openaiAccount?: OpenaiAccountType;
|
||||||
externalWorkflowVariables?: Record<string, string>;
|
externalWorkflowVariables?: Record<string, string>;
|
||||||
@@ -57,11 +60,14 @@ export type ChatDispatchProps = {
|
|||||||
chatConfig: AppSchema['chatConfig'];
|
chatConfig: AppSchema['chatConfig'];
|
||||||
lastInteractive?: WorkflowInteractiveResponseType; // last interactive response
|
lastInteractive?: WorkflowInteractiveResponseType; // last interactive response
|
||||||
stream: boolean;
|
stream: boolean;
|
||||||
|
retainDatasetCite?: boolean;
|
||||||
maxRunTimes: number;
|
maxRunTimes: number;
|
||||||
isToolCall?: boolean;
|
isToolCall?: boolean;
|
||||||
workflowStreamResponse?: WorkflowResponseType;
|
workflowStreamResponse?: WorkflowResponseType;
|
||||||
workflowDispatchDeep?: number;
|
workflowDispatchDeep?: number;
|
||||||
version?: 'v1' | 'v2';
|
version?: 'v1' | 'v2';
|
||||||
|
|
||||||
|
responseAllData?: boolean;
|
||||||
responseDetail?: boolean;
|
responseDetail?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,12 +142,15 @@ export type DispatchNodeResponseType = {
|
|||||||
finishReason?: CompletionFinishReason;
|
finishReason?: CompletionFinishReason;
|
||||||
|
|
||||||
// dataset search
|
// dataset search
|
||||||
|
embeddingModel?: string;
|
||||||
|
embeddingTokens?: number;
|
||||||
similarity?: number;
|
similarity?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
searchMode?: `${DatasetSearchModeEnum}`;
|
searchMode?: `${DatasetSearchModeEnum}`;
|
||||||
embeddingWeight?: number;
|
embeddingWeight?: number;
|
||||||
rerankModel?: string;
|
rerankModel?: string;
|
||||||
rerankWeight?: number;
|
rerankWeight?: number;
|
||||||
|
reRankInputTokens?: number;
|
||||||
searchUsingReRank?: boolean;
|
searchUsingReRank?: boolean;
|
||||||
queryExtensionResult?: {
|
queryExtensionResult?: {
|
||||||
model: string;
|
model: string;
|
||||||
@@ -180,7 +189,6 @@ export type DispatchNodeResponseType = {
|
|||||||
ifElseResult?: string;
|
ifElseResult?: string;
|
||||||
|
|
||||||
// tool
|
// tool
|
||||||
toolCallTokens?: number;
|
|
||||||
toolCallInputTokens?: number;
|
toolCallInputTokens?: number;
|
||||||
toolCallOutputTokens?: number;
|
toolCallOutputTokens?: number;
|
||||||
toolDetail?: ChatHistoryItemResType[];
|
toolDetail?: ChatHistoryItemResType[];
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
||||||
import { NodeInputKeyEnum, NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../constants';
|
import { NodeInputKeyEnum, NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../constants';
|
||||||
import { FlowNodeTypeEnum } from '../node/constant';
|
import { FlowNodeTypeEnum } from '../node/constant';
|
||||||
import { StoreNodeItemType } from '../type/node';
|
import { type StoreNodeItemType } from '../type/node';
|
||||||
import { StoreEdgeItemType } from '../type/edge';
|
import { type StoreEdgeItemType } from '../type/edge';
|
||||||
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
import { type RuntimeEdgeItemType, type RuntimeNodeItemType } from './type';
|
||||||
import { VARIABLE_NODE_ID } from '../constants';
|
import { VARIABLE_NODE_ID } from '../constants';
|
||||||
import { isValidReferenceValueFormat } from '../utils';
|
import { isValidReferenceValueFormat } from '../utils';
|
||||||
import { FlowNodeOutputItemType, ReferenceValueType } from '../type/io';
|
import { type FlowNodeOutputItemType, type ReferenceValueType } from '../type/io';
|
||||||
import { ChatItemType, NodeOutputItemType } from '../../../core/chat/type';
|
import { type ChatItemType, type NodeOutputItemType } from '../../../core/chat/type';
|
||||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
|
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
|
||||||
import { replaceVariable, valToStr } from '../../../common/string/tools';
|
import { replaceVariable, valToStr } from '../../../common/string/tools';
|
||||||
import json5 from 'json5';
|
import json5 from 'json5';
|
||||||
import {
|
import {
|
||||||
InteractiveNodeResponseType,
|
type InteractiveNodeResponseType,
|
||||||
WorkflowInteractiveResponseType
|
type WorkflowInteractiveResponseType
|
||||||
} from '../template/system/interactive/type';
|
} from '../template/system/interactive/type';
|
||||||
|
|
||||||
export const extractDeepestInteractive = (
|
export const extractDeepestInteractive = (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { NodeInputKeyEnum } from '../constants';
|
|||||||
import { FlowNodeInputTypeEnum } from '../node/constant';
|
import { FlowNodeInputTypeEnum } from '../node/constant';
|
||||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||||
import { chatNodeSystemPromptTip, systemPromptTip } from './tip';
|
import { chatNodeSystemPromptTip, systemPromptTip } from './tip';
|
||||||
import { FlowNodeInputItemType } from '../type/io';
|
import { type FlowNodeInputItemType } from '../type/io';
|
||||||
import { i18nT } from '../../../../web/i18n/utils';
|
import { i18nT } from '../../../../web/i18n/utils';
|
||||||
|
|
||||||
export const Input_Template_History: FlowNodeInputItemType = {
|
export const Input_Template_History: FlowNodeInputItemType = {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../../node/constant';
|
} from '../../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -55,7 +55,7 @@ export const AiChatModule: FlowNodeTemplateType = {
|
|||||||
showStatus: true,
|
showStatus: true,
|
||||||
isTool: true,
|
isTool: true,
|
||||||
courseUrl: '/docs/guide/workbench/workflow/ai_chat/',
|
courseUrl: '/docs/guide/workbench/workflow/ai_chat/',
|
||||||
version: '4.9.0',
|
version: '4.9.7',
|
||||||
inputs: [
|
inputs: [
|
||||||
Input_Template_SettingAiModel,
|
Input_Template_SettingAiModel,
|
||||||
// --- settings modal
|
// --- settings modal
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../../node/constant';
|
} from '../../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../../type/node';
|
import { type FlowNodeTemplateType } from '../../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { WorkflowIOValueTypeEnum } from '../../../constants';
|
import type { WorkflowIOValueTypeEnum } from '../../../constants';
|
||||||
|
|
||||||
export type ContextExtractAgentItemType = {
|
export type ContextExtractAgentItemType = {
|
||||||
valueType:
|
valueType:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
import { type FlowNodeTemplateType } from '../../type/node.d';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
FlowNodeTemplateTypeEnum,
|
FlowNodeTemplateTypeEnum,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
} from '../../constants';
|
} from '../../constants';
|
||||||
import { getNanoid } from '../../../../common/string/tools';
|
import { getNanoid } from '../../../../common/string/tools';
|
||||||
import { getHandleConfig } from '../utils';
|
import { getHandleConfig } from '../utils';
|
||||||
import { FlowNodeInputItemType } from '../../type/io.d';
|
import { type FlowNodeInputItemType } from '../../type/io.d';
|
||||||
import { i18nT } from '../../../../../web/i18n/utils';
|
import { i18nT } from '../../../../../web/i18n/utils';
|
||||||
|
|
||||||
export const getOneQuoteInputTemplate = ({
|
export const getOneQuoteInputTemplate = ({
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
FlowNodeOutputTypeEnum,
|
FlowNodeOutputTypeEnum,
|
||||||
FlowNodeTypeEnum
|
FlowNodeTypeEnum
|
||||||
} from '../../node/constant';
|
} from '../../node/constant';
|
||||||
import { FlowNodeTemplateType } from '../../type/node';
|
import { type FlowNodeTemplateType } from '../../type/node';
|
||||||
import {
|
import {
|
||||||
WorkflowIOValueTypeEnum,
|
WorkflowIOValueTypeEnum,
|
||||||
NodeInputKeyEnum,
|
NodeInputKeyEnum,
|
||||||
@@ -54,7 +54,7 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
|||||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||||
label: '',
|
label: '',
|
||||||
value: 1500,
|
value: 5000,
|
||||||
valueType: WorkflowIOValueTypeEnum.number
|
valueType: WorkflowIOValueTypeEnum.number
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||