Compare commits

...

11 Commits

Author SHA1 Message Date
Archer
753b164ea2 修复4.6.9问题 (#976)
* Fixbranch (#43)

* move components to web package (#37)

* move components

* fix

* openapi config

* fix team share bug

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
Co-authored-by: archer <545436317@qq.com>

* fix: http variable and ai base url

* remove log

---------

Co-authored-by: yst <77910600+yu-and-liu@users.noreply.github.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-03-11 20:12:55 +08:00
Archer
64492b8b33 move components to web package (#37) (#970)
* move components

* fix

openapi config

doc

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-03-11 13:38:52 +08:00
Carson Yang
80bdbf6bce Docs: update workflow for building docs image (#968)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
2024-03-11 12:52:21 +08:00
Archer
9f0b1d6bad Update README.md 2024-03-10 23:18:01 +08:00
Archer
c44b944fa6 Update docker.md 2024-03-09 21:25:37 +08:00
Archer
61419a5676 Update docker-compose.yml 2024-03-09 21:24:45 +08:00
Archer
47227c1b84 Update docker.md 2024-03-08 21:54:00 +08:00
Archer
4d66e0f828 4.6.9-production (#952)
* move components to web package (#37)

* move components

* fix

* fix: cq connection

* fix pagination (#41)

* doc

* openapi config

* fix team share app lose (#42)

* fix: ts

* doc

* doc

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
Co-authored-by: yst <77910600+yu-and-liu@users.noreply.github.com>
2024-03-08 13:33:45 +08:00
sgdream
46d9a6461f fix: 知识库QA生成,答案中有“Q”会导致提前截断。 (#950) 2024-03-08 09:47:48 +08:00
John Chen
b74dd2341b reranker.md优化docker启动命令,并增加docker-compose.yml示例 (#936)
原docker启动命令启动后的容器只能使用CPU运行。本次修改增加了GPU参数,并提供docker-compose.yml示例
2024-03-06 18:13:55 +08:00
Archer
af581bc903 Global variables support external variable; Extract module support default value (#921) 2024-03-05 14:13:22 +08:00
88 changed files with 701 additions and 429 deletions

View File

@@ -8,82 +8,67 @@ on:
- 'main' - 'main'
tags: tags:
- 'v*.*.*' - 'v*.*.*'
jobs: jobs:
build-fastgpt-docs-images: build-fastgpt-docs-images:
runs-on: ubuntu-20.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Get current date and time
id: datetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with: with:
fetch-depth: 1 # list of Docker images to use as base name for tags
- name: Set up QEMU (optional) images: |
uses: docker/setup-qemu-action@v2 ${{ secrets.DOCKER_HUB_NAME }}/fastgpt-docs
ghcr.io/${{ github.repository_owner }}/fastgpt-docs
registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs
tags: |
${{ steps.datetime.outputs.datetime }}
flavor: latest=false
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with: with:
driver-opts: network=host username: ${{ secrets.DOCKER_HUB_NAME }}
- name: Cache Docker layers password: ${{ secrets.DOCKER_HUB_PASSWORD }}
uses: actions/cache@v2
with: - name: Login to ghcr.io
path: /tmp/.buildx-cache uses: docker/login-action@v3
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }} password: ${{ secrets.GH_PAT }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-docs:latest" >> $GITHUB_ENV
else
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Build and publish image for main branch or tag push event
env:
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
run: |
docker buildx build \
--build-arg name=app \
--platform linux/amd64,linux/arm64 \
--label "org.opencontainers.image.source= https://github.com/ ${{ github.repository_owner }}/FastGPT" \
--label "org.opencontainers.image.description=fastgpt image" \
--label "org.opencontainers.image.licenses=Apache" \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache \
-t ${DOCKER_REPO_TAGGED} \
-f docSite/Dockerfile \
.
push-to-docker-hub:
needs: build-fastgpt-docs-images
runs-on: ubuntu-20.04
if: github.repository == 'labring/FastGPT'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
else
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Pull image from GitHub Container Registry
run: docker pull ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{env.IMAGE_TAG}}
- name: Tag image with Docker Hub repository name and version tag
run: docker tag ghcr.io/${{ github.repository_owner }}/fastgpt-docs:${{env.IMAGE_TAG}} ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
- name: Push image to Docker Hub
run: docker push ${{ secrets.DOCKER_IMAGE_NAME }}:${{env.IMAGE_TAG}}
- name: Login to Aliyun
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALI_HUB_USERNAME }}
password: ${{ secrets.ALI_HUB_PASSWORD }}
- name: Build and push Docker images to ghcr.io and DockerHub
uses: docker/build-push-action@v5
with:
context: .
file: ./docSite/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs:
tags: ${{ steps.datetime.outputs.datetime }}
update-docs-image: update-docs-image:
needs: build-fastgpt-docs-images needs: build-fastgpt-docs-images
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@@ -95,4 +80,9 @@ jobs:
env: env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with: with:
args: rollout restart deployment fastgpt-docs args: set image deployment/fastgpt-docs fastgpt-docs=registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs:${{ needs.build-fastgpt-docs-images.outputs.tags }}
- uses: actions-hub/kubectl@master
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
with:
args: annotate deployment/fastgpt-docs originImageName="registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALI_HUB_USERNAME }}/fastgpt-docs:${{ needs.build-fastgpt-docs-images.outputs.tags }}" --overwrite

View File

@@ -36,8 +36,9 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
## 🛸 在线使用 ## 🛸 在线使用
- 🌐 国内临时可访问[fastgpt.in](https://fastgpt.in/) - 🌍 海外版[fastgpt.in](https://fastgpt.in/)
- 🌍 海外版:[fastgpt.run](https://fastgpt.run/)
fastgpt.run 域名会弃用。
| | | | | |
| ---------------------------------- | ---------------------------------- | | ---------------------------------- | ---------------------------------- |

View File

@@ -9,7 +9,7 @@ weight: 1221
最后更新时间2024年3月3日 最后更新时间2024年3月3日
我们非常重视您的隐私保护在您使用FastGPT云服务时我们将按照以下政策收集、使用、披露和保护您的个人信息。请您仔细阅读并充分理解本隐私政策。 我们非常重视您的隐私保护在您使用FastGPT云服务时(以下简称为“本服务”),我们将按照以下政策收集、使用、披露和保护您的个人信息。请您仔细阅读并充分理解本隐私政策。
**我们可能需要收集的信息** **我们可能需要收集的信息**
@@ -39,7 +39,7 @@ weight: 1221
2. 我们会定期对收集、存储和处理的个人信息进行安全评估,以确保个人信息安全。 2. 我们会定期对收集、存储和处理的个人信息进行安全评估,以确保个人信息安全。
3. 在发生个人信息泄露等安全事件时,我们会立即启动应急预案,并在法律法规规定的范围内向您及时告知。 3. 在发生个人信息泄露等安全事件时,我们会立即启动应急预案,并在法律法规规定的范围内向您及时告知。
4. 我们不会使用您的数据进行额外的备份存储或用于模型训练。 4. 我们不会使用您的数据进行额外的备份存储或用于模型训练。
5. 您在本服务进行的数据删除均为物理删除,不可恢复。如有非物理删除的操作,我们会在服务中特别指出。 5. 您在本服务进行的数据删除均为物理删除,不可恢复。如有非物理删除的操作,我们会在服务中特别指出。
**用户权利** **用户权利**

View File

@@ -54,11 +54,37 @@ ACCESS_TOKEN=mytoken
``` ```
**运行命令示例** **运行命令示例**
- 无需GPU环境使用CPU运行
```sh ```sh
docker run -d --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken luanshaotong/reranker:v0.1 docker run -d --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken luanshaotong/reranker:v0.1
``` ```
- 需要CUDA 11.7环境
```sh
docker run -d --gpus all --name reranker -p 6006:6006 -e ACCESS_TOKEN=mytoken luanshaotong/reranker:v0.1
```
**docker-compose.yml示例**
```
version: "3"
services:
reranker:
image: luanshaotong/reranker:v0.1
container_name: reranker
# GPU运行环境如果宿主机未安装将deploy配置隐藏即可
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
ports:
- 6006:6006
environment:
- ACCESS_TOKEN=mytoken
```
## 接入 FastGPT ## 接入 FastGPT
参考 [ReRank模型接入](/docs/development/configuration/#rerank-接入)host 变量为部署的域名。 参考 [ReRank模型接入](/docs/development/configuration/#rerank-接入)host 变量为部署的域名。

View File

@@ -108,11 +108,6 @@ curl -O https://raw.githubusercontent.com/labring/FastGPT/main/projects/app/data
```bash ```bash
# 进入项目目录 # 进入项目目录
cd 项目目录 cd 项目目录
# 创建 mongo 密钥
openssl rand -base64 756 > ./mongodb.key
# 600不行可以用chmod 999
chmod 600 ./mongodb.key
chown 999:root ./mongodb.key
# 启动容器 # 启动容器
docker-compose pull docker-compose pull
docker-compose up -d docker-compose up -d
@@ -128,8 +123,8 @@ docker ps
# 进入容器 # 进入容器
docker exec -it mongo bash docker exec -it mongo bash
# 连接数据库 # 连接数据库这里要填Mongo的用户名和密码
mongo -u myname -p mypassword --authenticationDatabase admin mongo -u myusername -p mypassword --authenticationDatabase admin
# 初始化副本集。如果需要外网访问mongo:27017 可以改成 ip:27017。但是需要同时修改 FastGPT 连接的参数MONGODB_URI=mongodb://myname:mypassword@mongo:27017/fastgpt?authSource=admin => MONGODB_URI=mongodb://myname:mypassword@ip:27017/fastgpt?authSource=admin # 初始化副本集。如果需要外网访问mongo:27017 可以改成 ip:27017。但是需要同时修改 FastGPT 连接的参数MONGODB_URI=mongodb://myname:mypassword@mongo:27017/fastgpt?authSource=admin => MONGODB_URI=mongodb://myname:mypassword@ip:27017/fastgpt?authSource=admin
rs.initiate({ rs.initiate({
@@ -142,8 +137,58 @@ rs.initiate({
rs.status() rs.status()
``` ```
**关于 host: "mongo:27017" 说明**
1. mongo:27017 代表指向同一个 docker 网络的 mongo 容器的 27017 服务。因此,如果使用该参数,外网是无法访问到数据库的。
2. ip:27017 ip替换成公网IP代表通过你的公网IP进行访问。如果用该方法同时需要修改 docker-compose 中 mongo 的连接参数,因为默认是用 `mongo:27017` 进行连接。
## 五、访问 FastGPT ## 五、访问 FastGPT
目前可以通过 `ip:3000` 直接访问(注意防火墙)。登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW` 目前可以通过 `ip:3000` 直接访问(注意防火墙)。登录用户名为 `root`,密码为`docker-compose.yml`环境变量里设置的 `DEFAULT_ROOT_PSW`
如果需要域名访问,请自行安装并配置 Nginx。 如果需要域名访问,请自行安装并配置 Nginx。
## FAQ
### Mongo 启动失败
docker-compose 示例优化 Mongo 副本集参数,不需要手动创建再挂载。如果无法启动,可以尝试更换下面的脚本:
1. 终端中执行:
```bash
openssl rand -base64 756 > ./mongodb.key
chmod 600 ./mongodb.key
chown 999:root ./mongodb.key
```
2. 修改 docker-compose.yml
```yml
mongo:
# image: mongo:5.0.18
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
container_name: mongo
ports:
- 27017:27017
networks:
- fastgpt
command: mongod --keyFile /data/mongodb.key --replSet rs0
environment:
# 默认的用户名和密码,只有首次允许有效
- MONGO_INITDB_ROOT_USERNAME=myusername
- MONGO_INITDB_ROOT_PASSWORD=mypassword
volumes:
- ./mongo/data:/data/db
- ./mongodb.key:/data/mongodb.key
```
3. 重启服务
```bash
docker-compose down
docker-compose up -d
```
4. 进入容器执行副本集合初始化(看上方)

View File

@@ -46,9 +46,14 @@ OneAPI 的 API Key 配置错误,需要修改`OPENAI_API_KEY`环境变量,并
### 页面崩溃 ### 页面崩溃
1. 关闭翻译 1. 关闭翻译
2. 检查配置文件是否正常加载如果没有正常加载会导致缺失系统信息在某些操作下会导致空指针。95% 2. 检查配置文件是否正常加载如果没有正常加载会导致缺失系统信息在某些操作下会导致空指针。95%情况可以F12打开控制台看具体的空指针情况
3. 某些api不兼容问题较少 3. 某些api不兼容问题较少
### 开启内容补全后,响应速度变慢
1. 问题补全需要经过一轮AI生成。
2. 会进行3~5轮的查询如果数据库性能不足会有明显影响。
## 私有部署问题 ## 私有部署问题
### 知识库索引没有进度 ### 知识库索引没有进度
@@ -80,7 +85,7 @@ OneAPI 的 API Key 配置错误,需要修改`OPENAI_API_KEY`环境变量,并
### 如何自定义配置文件? ### 如何自定义配置文件?
修改`config.json`文件,并执行`docker-compose up -d`重起容器。具体配置,参考[配置详解](/docs/development/configuration)。 修改`config.json`文件,并执行`docker-compose down`再执行`docker-compose up -d`重起容器。具体配置,参考[配置详解](/docs/development/configuration)。
### 如何检查自定义配置文件是否挂载 ### 如何检查自定义配置文件是否挂载
@@ -93,6 +98,12 @@ OneAPI 的 API Key 配置错误,需要修改`OPENAI_API_KEY`环境变量,并
2. 配置文件不正确,日志中会提示`invalid json`,配置文件需要是标准的 JSON 文件。 2. 配置文件不正确,日志中会提示`invalid json`,配置文件需要是标准的 JSON 文件。
3. 修改后,没有`docker-compose down`再`docker-compose up -d`restart是不会重新挂载文件的。 3. 修改后,没有`docker-compose down`再`docker-compose up -d`restart是不会重新挂载文件的。
### 如何检查环境变量是否正常加载
1. `docker exec -it fastgpt sh` 进入 FastGPT 容器。
2. 直接输入`env`命令查看所有环境变量。
### 为什么无法连接`本地模型`镜像。 ### 为什么无法连接`本地模型`镜像。
`docker-compose.yml`中使用了桥接的模式建立了`fastgpt`网络如想通过0.0.0.0或镜像名访问其它镜像,需将其它镜像也加入到网络中。 `docker-compose.yml`中使用了桥接的模式建立了`fastgpt`网络如想通过0.0.0.0或镜像名访问其它镜像,需将其它镜像也加入到网络中。

View File

@@ -169,6 +169,8 @@ curl --location --request POST '{{host}}/shareAuth/start' \
响应值与[chat 接口格式相同](/docs/development/openapi/chat/#响应),仅多了一个`token` 响应值与[chat 接口格式相同](/docs/development/openapi/chat/#响应),仅多了一个`token`
重点关注:`totalPoints`(总消耗AI积分)`token`(Token消耗总数)
```bash ```bash
curl --location --request POST '{{host}}/shareAuth/finish' \ curl --location --request POST '{{host}}/shareAuth/finish' \
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \

View File

@@ -1,5 +1,5 @@
--- ---
title: 'V4.6.9(进行中)' title: 'V4.6.9(需要初始化)'
description: 'FastGPT V4.6.9更新说明' description: 'FastGPT V4.6.9更新说明'
icon: 'upgrade' icon: 'upgrade'
draft: false draft: false
@@ -12,7 +12,7 @@ weight: 827
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成自己域名 从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成自己域名
```bash ```bash
curl --location --request POST 'https://{{host}}/api/init/v469' \ curl --location --request POST 'https://{{host}}/api/admin/initv469' \
--header 'rootkey: {{rootkey}}' \ --header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json' --header 'Content-Type: application/json'
``` ```
@@ -20,15 +20,21 @@ curl --location --request POST 'https://{{host}}/api/init/v469' \
1. 重置计量表。 1. 重置计量表。
2. 执行脏数据清理(清理无效的文件、清理无效的图片、清理无效的知识库集合、清理无效的向量) 2. 执行脏数据清理(清理无效的文件、清理无效的图片、清理无效的知识库集合、清理无效的向量)
## 外部接口更新
1. 由于计费系统变更,[分享链接对话上报接口](/docs/development/openapi/share/#5-编写对话结果上报接口可选)需要做一些调整price字段被totalPoints字段取代。inputToken和outputToken不再提供只提供`token`字段总token数量
## V4.6.9 更新说明 ## V4.6.9 更新说明
1. 商业版新增 - 知识库新增“增强处理”训练模式,可生成更多类型索引。 1. 商业版新增 - 知识库新增“增强处理”训练模式,可生成更多类型索引。
2. 新增 - 完善了HTTP模块的变量提示。 2. 新增 - 完善了HTTP模块的变量提示。
3. 新增 - HTTP模块支持OpenAI单接口导入。 3. 新增 - HTTP模块支持OpenAI单接口导入。
4. 优化 - 问题补全。增加英文类型。同时可以设置为单独模块,方便复用 4. 新增 - 全局变量支持增加外部变量。可通过分享链接的Query或 API 的 variables 参数传入
5. 优化 - 重写了计量模式 5. 新增 - 内容提取模块增加默认值。
6. 优化 - Token 过滤历史记录,保持偶数条,防止部分模型报错 6. 优化 - 问题补全。增加英文类型。同时可以设置为单独模块,方便复用
7. 优化 - 分享链接SEO可直接展示应用名和头像。 7. 优化 - 重写了计量模式
8. 修复 - 标注功能 8. 优化 - Token 过滤历史记录,保持偶数条,防止部分模型报错
9. 修复 - qa生成线程计数错误。 9. 优化 - 分享链接SEO可直接展示应用名和头像。
10. 修复 - 标注功能。
11. 修复 - qa生成线程计数错误。
12. 修复 - 问题分类连线类型错误

View File

@@ -19,21 +19,27 @@ services:
volumes: volumes:
- ./pg/data:/var/lib/postgresql/data - ./pg/data:/var/lib/postgresql/data
mongo: mongo:
image: mongo:5.0.18 image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云
container_name: mongo container_name: mongo
restart: always
ports: ports:
- 27017:27017 - 27017:27017
networks: networks:
- fastgpt - fastgpt
command: mongod --keyFile /data/mongodb.key --replSet rs0 command: mongod --keyFile /data/mongodb.key --replSet rs0
environment: environment:
# 默认的用户名和密码,只有首次允许有效 - MONGO_INITDB_ROOT_USERNAME=myusername
- MONGO_INITDB_ROOT_USERNAME=myname
- MONGO_INITDB_ROOT_PASSWORD=mypassword - MONGO_INITDB_ROOT_PASSWORD=mypassword
volumes: volumes:
- ./mongo/data:/data/db - ./mongo/data:/data/db
- ./mongodb.key:/data/mongodb.key entrypoint:
- bash
- -c
- |
openssl rand -base64 128 > /data/mongodb.key
chmod 400 /data/mongodb.key
chown 999:999 /data/mongodb.key
exec docker-entrypoint.sh $$@
fastgpt: fastgpt:
container_name: fastgpt container_name: fastgpt
image: ghcr.io/labring/fastgpt:latest # git image: ghcr.io/labring/fastgpt:latest # git
@@ -56,8 +62,8 @@ services:
- TOKEN_KEY=any - TOKEN_KEY=any
- ROOT_KEY=root_key - ROOT_KEY=root_key
- FILE_TOKEN_KEY=filetoken - FILE_TOKEN_KEY=filetoken
# mongo 配置,不需要改. 用户名myname,密码mypassword。 # mongo 配置,不需要改. 用户名myusername,密码mypassword。
- MONGODB_URI=mongodb://myname:mypassword@mongo:27017/fastgpt?authSource=admin - MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin
# pg配置. 不需要改 # pg配置. 不需要改
- PG_URL=postgresql://username:password@pg:5432/postgres - PG_URL=postgresql://username:password@pg:5432/postgres
volumes: volumes:

View File

@@ -63,6 +63,8 @@ export type SystemEnvType = {
vectorMaxProcess: number; vectorMaxProcess: number;
qaMaxProcess: number; qaMaxProcess: number;
pgHNSWEfSearch: number; pgHNSWEfSearch: number;
oneapiUrl?: string;
chatApiKey?: string;
}; };
// declare global { // declare global {

View File

@@ -116,17 +116,29 @@ export enum ModuleOutputKeyEnum {
export enum VariableInputEnum { export enum VariableInputEnum {
input = 'input', input = 'input',
textarea = 'textarea', textarea = 'textarea',
select = 'select' select = 'select',
external = 'external'
} }
export const variableMap = { export const variableMap = {
[VariableInputEnum.input]: { [VariableInputEnum.input]: {
icon: 'core/app/variable/input' icon: 'core/app/variable/input',
title: 'core.module.variable.input type',
desc: ''
}, },
[VariableInputEnum.textarea]: { [VariableInputEnum.textarea]: {
icon: 'core/app/variable/textarea' icon: 'core/app/variable/textarea',
title: 'core.module.variable.textarea type',
desc: '允许用户最多输入4000字的对话框。'
}, },
[VariableInputEnum.select]: { [VariableInputEnum.select]: {
icon: 'core/app/variable/select' icon: 'core/app/variable/select',
title: 'core.module.variable.select type',
desc: ''
},
[VariableInputEnum.external]: {
icon: 'core/app/variable/external',
title: 'core.module.variable.External type',
desc: '可以通过API接口或分享链接的Query传递变量。增加该类型变量的主要目的是用于变量提示。使用例子: 你可以通过分享链接Query中拼接Token来实现内部系统身份鉴权。'
} }
}; };

View File

@@ -57,7 +57,7 @@ export const ContextExtractModule: FlowModuleTemplateType = {
{ {
key: ModuleInputKeyEnum.extractKeys, key: ModuleInputKeyEnum.extractKeys,
type: FlowNodeInputTypeEnum.custom, type: FlowNodeInputTypeEnum.custom,
label: '目标字段', label: '',
valueType: ModuleIOValueTypeEnum.any, valueType: ModuleIOValueTypeEnum.any,
description: "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段", description: "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
value: [], // {desc: string; key: string; required: boolean; enum: string[]}[] value: [], // {desc: string; key: string; required: boolean; enum: string[]}[]
@@ -76,6 +76,7 @@ export const ContextExtractModule: FlowModuleTemplateType = {
{ {
key: ModuleOutputKeyEnum.failed, key: ModuleOutputKeyEnum.failed,
label: '提取字段缺失', label: '提取字段缺失',
description: '存在一个或多个字段未提取成功。尽管使用了默认值也算缺失。',
valueType: ModuleIOValueTypeEnum.boolean, valueType: ModuleIOValueTypeEnum.boolean,
type: FlowNodeOutputTypeEnum.source, type: FlowNodeOutputTypeEnum.source,
targets: [] targets: []

View File

@@ -80,6 +80,7 @@ export type ContextExtractAgentItemType = {
desc: string; desc: string;
key: string; key: string;
required: boolean; required: boolean;
defaultValue?: string;
enum?: string; enum?: string;
}; };

View File

@@ -19,6 +19,7 @@ export type BillSchemaType = {
datasetSize?: number; datasetSize?: number;
extraPoints?: number; extraPoints?: number;
}; };
username: string;
}; };
export type ChatModuleUsageType = { export type ChatModuleUsageType = {

View File

@@ -1,3 +1,5 @@
import { delay } from '@fastgpt/global/common/system/utils';
import { addLog } from '../../system/log';
import { Pool } from 'pg'; import { Pool } from 'pg';
import type { QueryResultRow } from 'pg'; import type { QueryResultRow } from 'pg';
@@ -15,10 +17,13 @@ export const connectPg = async (): Promise<Pool> => {
connectionTimeoutMillis: 20000 connectionTimeoutMillis: 20000
}); });
global.pgClient.on('error', (err) => { global.pgClient.on('error', async (err) => {
console.log(err); console.log(err);
global.pgClient?.end(); global.pgClient?.end();
global.pgClient = null; global.pgClient = null;
await delay(1000);
addLog.info(`Retry connect pg`);
connectPg(); connectPg();
}); });
@@ -27,7 +32,12 @@ export const connectPg = async (): Promise<Pool> => {
console.log('pg connected'); console.log('pg connected');
return global.pgClient; return global.pgClient;
} catch (error) { } catch (error) {
global.pgClient?.end();
global.pgClient = null; global.pgClient = null;
await delay(1000);
addLog.info(`Retry connect pg`);
return connectPg(); return connectPg();
} }
}; };

View File

@@ -2,9 +2,6 @@ import type { UserModelSchema } from '@fastgpt/global/support/user/type';
import OpenAI from '@fastgpt/global/core/ai'; import OpenAI from '@fastgpt/global/core/ai';
export const openaiBaseUrl = process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1'; export const openaiBaseUrl = process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1';
export const baseUrl = process.env.ONEAPI_URL || openaiBaseUrl;
export const systemAIChatKey = process.env.CHAT_API_KEY || '';
export const getAIApi = (props?: { export const getAIApi = (props?: {
userKey?: UserModelSchema['openaiAccount']; userKey?: UserModelSchema['openaiAccount'];
@@ -12,9 +9,13 @@ export const getAIApi = (props?: {
}) => { }) => {
const { userKey, timeout } = props || {}; const { userKey, timeout } = props || {};
const baseUrl =
userKey?.baseUrl || global?.systemEnv?.oneapiUrl || process.env.ONEAPI_URL || openaiBaseUrl;
const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || '';
return new OpenAI({ return new OpenAI({
apiKey: userKey?.key || systemAIChatKey, baseURL: baseUrl,
baseURL: userKey?.baseUrl || baseUrl, apiKey,
httpAgent: global.httpsAgent, httpAgent: global.httpsAgent,
timeout, timeout,
maxRetries: 2 maxRetries: 2

View File

@@ -2,10 +2,10 @@ import React, { useState, useMemo, useRef } from 'react';
import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/react'; import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/react';
import { addDays, format } from 'date-fns'; import { addDays, format } from 'date-fns';
import { type DateRange, DayPicker } from 'react-day-picker'; import { type DateRange, DayPicker } from 'react-day-picker';
import MyIcon from '@fastgpt/web/components/common/Icon';
import 'react-day-picker/dist/style.css'; import 'react-day-picker/dist/style.css';
import zhCN from 'date-fns/locale/zh-CN'; import zhCN from 'date-fns/locale/zh-CN';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MyIcon from '../Icon';
const DateRangePicker = ({ const DateRangePicker = ({
onChange, onChange,

View File

@@ -69,6 +69,7 @@ export const iconPaths = {
'core/app/simpleMode/tts': () => import('./icons/core/app/simpleMode/tts.svg'), 'core/app/simpleMode/tts': () => import('./icons/core/app/simpleMode/tts.svg'),
'core/app/simpleMode/variable': () => import('./icons/core/app/simpleMode/variable.svg'), 'core/app/simpleMode/variable': () => import('./icons/core/app/simpleMode/variable.svg'),
'core/app/ttsFill': () => import('./icons/core/app/ttsFill.svg'), 'core/app/ttsFill': () => import('./icons/core/app/ttsFill.svg'),
'core/app/variable/external': () => import('./icons/core/app/variable/external.svg'),
'core/app/variable/input': () => import('./icons/core/app/variable/input.svg'), 'core/app/variable/input': () => import('./icons/core/app/variable/input.svg'),
'core/app/variable/select': () => import('./icons/core/app/variable/select.svg'), 'core/app/variable/select': () => import('./icons/core/app/variable/select.svg'),
'core/app/variable/textarea': () => import('./icons/core/app/variable/textarea.svg'), 'core/app/variable/textarea': () => import('./icons/core/app/variable/textarea.svg'),

View File

@@ -0,0 +1,6 @@
<svg t="1709524607561" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5121"
width="128" height="128">
<path
d="M310.4 454.4v-118.4h435.2c44.8 0 86.4 25.6 105.6 64 16-22.4 22.4-48 22.4-73.6 0-73.6-57.6-131.2-131.2-131.2H310.4V76.8c0-16-19.2-28.8-35.2-19.2L9.6 246.4c-12.8 9.6-12.8 25.6 0 35.2l268.8 188.8c12.8 12.8 32 3.2 32-16zM1014.4 742.4l-268.8-188.8c-12.8-9.6-35.2 0-35.2 19.2v118.4H278.4c-44.8 0-86.4-25.6-105.6-64-16 22.4-22.4 48-22.4 73.6 0 73.6 57.6 131.2 131.2 131.2h432v118.4c0 16 19.2 28.8 35.2 19.2l268.8-188.8c9.6-12.8 9.6-32-3.2-38.4z"
p-id="5122"></path>
</svg>

After

Width:  |  Height:  |  Size: 645 B

View File

@@ -2,7 +2,7 @@ import { Button, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react'
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { editorStateToText } from './utils'; import { editorStateToText } from './utils';
import Editor from './Editor'; import Editor from './Editor';
import MyModal from '../../MyModal'; import MyModal from '../../CustomModal';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { $getRoot, EditorState, type LexicalEditor } from 'lexical'; import { $getRoot, EditorState, type LexicalEditor } from 'lexical';
import { EditorVariablePickerType } from './type.d'; import { EditorVariablePickerType } from './type.d';

View File

@@ -1,5 +1,5 @@
import { useState, useCallback } from 'react'; import { useState, useCallback } from 'react';
import LoadingComponent from '@/components/Loading'; import LoadingComponent from '../components/common/MyLoading';
export const useLoading = (props?: { defaultLoading: boolean }) => { export const useLoading = (props?: { defaultLoading: boolean }) => {
const [isLoading, setIsLoading] = useState(props?.defaultLoading || false); const [isLoading, setIsLoading] = useState(props?.defaultLoading || false);

View File

@@ -1,20 +1,28 @@
import { useRef, useState, useCallback, useMemo, useEffect } from 'react'; import { useRef, useState, useCallback, useMemo, useEffect } from 'react';
import type { PagingData } from '@/types/index.d';
import { IconButton, Flex, Box, Input } from '@chakra-ui/react'; import { IconButton, Flex, Box, Input } from '@chakra-ui/react';
import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons'; import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
import { useToast } from '@fastgpt/web/hooks/useToast';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import { useToast } from './useToast';
const thresholdVal = 100; const thresholdVal = 100;
type PagingData<T> = {
pageNum: number;
pageSize: number;
data: T[];
total?: number;
};
export function usePagination<T = any>({ export function usePagination<T = any>({
api, api,
pageSize = 10, pageSize = 10,
params = {}, params = {},
defaultRequest = true, defaultRequest = true,
type = 'button', type = 'button',
onChange onChange,
elementRef
}: { }: {
api: (data: any) => any; api: (data: any) => any;
pageSize?: number; pageSize?: number;
@@ -22,12 +30,18 @@ export function usePagination<T = any>({
defaultRequest?: boolean; defaultRequest?: boolean;
type?: 'button' | 'scroll'; type?: 'button' | 'scroll';
onChange?: (pageNum: number) => void; onChange?: (pageNum: number) => void;
elementRef?: React.RefObject<HTMLDivElement>;
}) { }) {
const elementRef = useRef<HTMLDivElement>(null);
const { toast } = useToast(); const { toast } = useToast();
const [pageNum, setPageNum] = useState(1); const [pageNum, setPageNum] = useState(1);
const pageNumRef = useRef(pageNum);
pageNumRef.current = pageNum;
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const totalRef = useRef(total);
totalRef.current = total;
const [data, setData] = useState<T[]>([]); const [data, setData] = useState<T[]>([]);
const dataLengthRef = useRef(data.length);
dataLengthRef.current = data.length;
const maxPage = useMemo(() => Math.ceil(total / pageSize) || 1, [pageSize, total]); const maxPage = useMemo(() => Math.ceil(total / pageSize) || 1, [pageSize, total]);
const { mutate, isLoading } = useMutation({ const { mutate, isLoading } = useMutation({
@@ -40,7 +54,11 @@ export function usePagination<T = any>({
}); });
setPageNum(num); setPageNum(num);
res.total !== undefined && setTotal(res.total); res.total !== undefined && setTotal(res.total);
setData(res.data); if (type === 'scroll') {
setData((prevData) => [...prevData, ...res.data]);
} else {
setData(res.data);
}
onChange && onChange(num); onChange && onChange(num);
} catch (error: any) { } catch (error: any) {
toast({ toast({
@@ -147,7 +165,7 @@ export function usePagination<T = any>({
); );
useEffect(() => { useEffect(() => {
if (!elementRef.current || type !== 'scroll') return; if (!elementRef?.current || type !== 'scroll') return;
const scrolling = throttle((e: Event) => { const scrolling = throttle((e: Event) => {
const element = e.target as HTMLDivElement; const element = e.target as HTMLDivElement;
@@ -159,16 +177,23 @@ export function usePagination<T = any>({
// 内容总高度 // 内容总高度
const scrollHeight = element.scrollHeight; const scrollHeight = element.scrollHeight;
// 判断是否滚动到底部 // 判断是否滚动到底部
if (scrollTop + clientHeight + thresholdVal >= scrollHeight) { if (
mutate(pageNum + 1); scrollTop + clientHeight + thresholdVal >= scrollHeight &&
dataLengthRef.current < totalRef.current
) {
mutate(pageNumRef.current + 1);
} }
}, 100); }, 100);
elementRef.current.addEventListener('scroll', scrolling);
return () => { const handleScroll = (e: Event) => {
// eslint-disable-next-line react-hooks/exhaustive-deps scrolling(e);
elementRef.current?.removeEventListener('scroll', scrolling);
}; };
}, [elementRef, mutate, pageNum, type]);
elementRef.current.addEventListener('scroll', handleScroll);
return () => {
elementRef.current?.removeEventListener('scroll', handleScroll);
};
}, [elementRef, mutate, pageNum, type, total, data.length]);
useEffect(() => { useEffect(() => {
defaultRequest && mutate(1); defaultRequest && mutate(1);
@@ -179,6 +204,7 @@ export function usePagination<T = any>({
pageSize, pageSize,
total, total,
data, data,
setData,
isLoading, isLoading,
Pagination, Pagination,
ScrollData, ScrollData,

View File

@@ -26,9 +26,15 @@
"@lexical/react": "0.12.6", "@lexical/react": "0.12.6",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"@lexical/utils": "0.12.6", "@lexical/utils": "0.12.6",
"@lexical/text": "0.12.6" "@lexical/text": "0.12.6",
"date-fns": "2.30.0",
"react-day-picker": "^8.7.1",
"lodash": "^4.17.21",
"@tanstack/react-query": "^4.24.10",
"dayjs": "^1.11.7"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.191",
"@types/react": "18.2.0", "@types/react": "18.2.0",
"@types/papaparse": "^5.3.7", "@types/papaparse": "^5.3.7",
"@types/react-dom": "18.2.0", "@types/react-dom": "18.2.0",

61
pnpm-lock.yaml generated
View File

@@ -184,6 +184,15 @@ importers:
'@monaco-editor/react': '@monaco-editor/react':
specifier: ^4.6.0 specifier: ^4.6.0
version: 4.6.0(monaco-editor@0.46.0)(react-dom@18.2.0)(react@18.2.0) version: 4.6.0(monaco-editor@0.46.0)(react-dom@18.2.0)(react@18.2.0)
'@tanstack/react-query':
specifier: ^4.24.10
version: 4.24.10(react-dom@18.2.0)(react@18.2.0)
date-fns:
specifier: 2.30.0
version: 2.30.0
dayjs:
specifier: ^1.11.7
version: 1.11.7
i18next: i18next:
specifier: 23.10.0 specifier: 23.10.0
version: 23.10.0 version: 23.10.0
@@ -193,6 +202,9 @@ importers:
lexical: lexical:
specifier: 0.12.6 specifier: 0.12.6
version: 0.12.6 version: 0.12.6
lodash:
specifier: ^4.17.21
version: 4.17.21
mammoth: mammoth:
specifier: ^1.6.0 specifier: ^1.6.0
version: 1.6.0 version: 1.6.0
@@ -208,6 +220,9 @@ importers:
react: react:
specifier: 18.2.0 specifier: 18.2.0
version: 18.2.0 version: 18.2.0
react-day-picker:
specifier: ^8.7.1
version: 8.7.1(date-fns@2.30.0)(react@18.2.0)
react-dom: react-dom:
specifier: 18.2.0 specifier: 18.2.0
version: 18.2.0(react@18.2.0) version: 18.2.0(react@18.2.0)
@@ -218,6 +233,9 @@ importers:
specifier: ^7.1.2 specifier: ^7.1.2
version: 7.1.2 version: 7.1.2
devDependencies: devDependencies:
'@types/lodash':
specifier: ^4.14.191
version: 4.14.191
'@types/papaparse': '@types/papaparse':
specifier: ^5.3.7 specifier: ^5.3.7
version: 5.3.7 version: 5.3.7
@@ -317,6 +335,9 @@ importers:
jschardet: jschardet:
specifier: ^3.0.0 specifier: ^3.0.0
version: 3.0.0 version: 3.0.0
json5:
specifier: ^2.2.3
version: 2.2.3
jsonwebtoken: jsonwebtoken:
specifier: ^9.0.2 specifier: ^9.0.2
version: 9.0.2 version: 9.0.2
@@ -2883,6 +2904,7 @@ packages:
/@emotion/memoize@0.7.4: /@emotion/memoize@0.7.4:
resolution: {integrity: sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==} resolution: {integrity: sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -3483,6 +3505,7 @@ packages:
/@mapbox/node-pre-gyp@1.0.11: /@mapbox/node-pre-gyp@1.0.11:
resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==}
hasBin: true hasBin: true
requiresBuild: true
dependencies: dependencies:
detect-libc: 2.0.2 detect-libc: 2.0.2
https-proxy-agent: 5.0.1 https-proxy-agent: 5.0.1
@@ -4628,6 +4651,7 @@ packages:
/abbrev@1.1.1: /abbrev@1.1.1:
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -4663,6 +4687,7 @@ packages:
/agent-base@6.0.2: /agent-base@6.0.2:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
engines: {node: '>= 6.0.0'} engines: {node: '>= 6.0.0'}
requiresBuild: true
dependencies: dependencies:
debug: 4.3.4 debug: 4.3.4
transitivePeerDependencies: transitivePeerDependencies:
@@ -4741,12 +4766,14 @@ packages:
/aproba@2.0.0: /aproba@2.0.0:
resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
/are-we-there-yet@2.0.0: /are-we-there-yet@2.0.0:
resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==}
engines: {node: '>=10'} engines: {node: '>=10'}
requiresBuild: true
dependencies: dependencies:
delegates: 1.0.0 delegates: 1.0.0
readable-stream: 3.6.2 readable-stream: 3.6.2
@@ -5128,7 +5155,7 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true hasBin: true
dependencies: dependencies:
caniuse-lite: 1.0.30001591 caniuse-lite: 1.0.30001593
electron-to-chromium: 1.4.690 electron-to-chromium: 1.4.690
node-releases: 2.0.14 node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.23.0) update-browserslist-db: 1.0.13(browserslist@4.23.0)
@@ -5196,8 +5223,8 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/caniuse-lite@1.0.30001591: /caniuse-lite@1.0.30001593:
resolution: {integrity: sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==} resolution: {integrity: sha512-UWM1zlo3cZfkpBysd7AS+z+v007q9G1+fLTUU42rQnY6t2axoogPW/xol6T7juU5EUoOhML4WgBIdG+9yYqAjQ==}
/canvas@2.11.2: /canvas@2.11.2:
resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==}
@@ -5323,6 +5350,7 @@ packages:
/chownr@2.0.0: /chownr@2.0.0:
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -5430,6 +5458,7 @@ packages:
/color-support@1.1.3: /color-support@1.1.3:
resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==}
hasBin: true hasBin: true
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -5498,6 +5527,7 @@ packages:
/console-control-strings@1.1.0: /console-control-strings@1.1.0:
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -6030,6 +6060,7 @@ packages:
/decompress-response@4.2.1: /decompress-response@4.2.1:
resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==} resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dependencies: dependencies:
mimic-response: 2.1.0 mimic-response: 2.1.0
dev: false dev: false
@@ -6081,6 +6112,7 @@ packages:
/delegates@1.0.0: /delegates@1.0.0:
resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -6108,6 +6140,7 @@ packages:
/detect-libc@2.0.2: /detect-libc@2.0.2:
resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -7239,6 +7272,7 @@ packages:
/fs-minipass@2.1.0: /fs-minipass@2.1.0:
resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
requiresBuild: true
dependencies: dependencies:
minipass: 3.3.6 minipass: 3.3.6
dev: false dev: false
@@ -7274,6 +7308,7 @@ packages:
/gauge@3.0.2: /gauge@3.0.2:
resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==}
engines: {node: '>=10'} engines: {node: '>=10'}
requiresBuild: true
dependencies: dependencies:
aproba: 2.0.0 aproba: 2.0.0
color-support: 1.1.3 color-support: 1.1.3
@@ -7444,6 +7479,7 @@ packages:
/has-unicode@2.0.1: /has-unicode@2.0.1:
resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -7593,6 +7629,7 @@ packages:
/https-proxy-agent@5.0.1: /https-proxy-agent@5.0.1:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
requiresBuild: true
dependencies: dependencies:
agent-base: 6.0.2 agent-base: 6.0.2
debug: 4.3.4 debug: 4.3.4
@@ -8359,6 +8396,7 @@ packages:
/make-dir@3.1.0: /make-dir@3.1.0:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dependencies: dependencies:
semver: 6.3.1 semver: 6.3.1
dev: false dev: false
@@ -8562,6 +8600,7 @@ packages:
/memory-pager@1.5.0: /memory-pager@1.5.0:
resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==} resolution: {integrity: sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -8913,6 +8952,7 @@ packages:
/mimic-response@2.1.0: /mimic-response@2.1.0:
resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==} resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -8935,6 +8975,7 @@ packages:
/minipass@3.3.6: /minipass@3.3.6:
resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dependencies: dependencies:
yallist: 4.0.0 yallist: 4.0.0
dev: false dev: false
@@ -8943,12 +8984,14 @@ packages:
/minipass@5.0.0: /minipass@5.0.0:
resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==} resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==}
engines: {node: '>=8'} engines: {node: '>=8'}
requiresBuild: true
dev: false dev: false
optional: true optional: true
/minizlib@2.1.2: /minizlib@2.1.2:
resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
requiresBuild: true
dependencies: dependencies:
minipass: 3.3.6 minipass: 3.3.6
yallist: 4.0.0 yallist: 4.0.0
@@ -8966,6 +9009,7 @@ packages:
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
engines: {node: '>=10'} engines: {node: '>=10'}
hasBin: true hasBin: true
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -9064,6 +9108,7 @@ packages:
/nan@2.18.0: /nan@2.18.0:
resolution: {integrity: sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==} resolution: {integrity: sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -9124,7 +9169,7 @@ packages:
'@next/env': 13.5.2 '@next/env': 13.5.2
'@swc/helpers': 0.5.2 '@swc/helpers': 0.5.2
busboy: 1.6.0 busboy: 1.6.0
caniuse-lite: 1.0.30001591 caniuse-lite: 1.0.30001593
postcss: 8.4.14 postcss: 8.4.14
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0(react@18.2.0) react-dom: 18.2.0(react@18.2.0)
@@ -9224,6 +9269,7 @@ packages:
resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==}
engines: {node: '>=6'} engines: {node: '>=6'}
hasBin: true hasBin: true
requiresBuild: true
dependencies: dependencies:
abbrev: 1.1.1 abbrev: 1.1.1
dev: false dev: false
@@ -9242,6 +9288,7 @@ packages:
/npmlog@5.0.1: /npmlog@5.0.1:
resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==}
requiresBuild: true
dependencies: dependencies:
are-we-there-yet: 2.0.0 are-we-there-yet: 2.0.0
console-control-strings: 1.1.0 console-control-strings: 1.1.0
@@ -10417,6 +10464,7 @@ packages:
/set-blocking@2.0.0: /set-blocking@2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
@@ -10486,11 +10534,13 @@ packages:
/simple-concat@1.0.1: /simple-concat@1.0.1:
resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==}
requiresBuild: true
dev: false dev: false
optional: true optional: true
/simple-get@3.1.1: /simple-get@3.1.1:
resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==} resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==}
requiresBuild: true
dependencies: dependencies:
decompress-response: 4.2.1 decompress-response: 4.2.1
once: 1.4.0 once: 1.4.0
@@ -10566,6 +10616,7 @@ packages:
/sparse-bitfield@3.0.3: /sparse-bitfield@3.0.3:
resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==} resolution: {integrity: sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==}
requiresBuild: true
dependencies: dependencies:
memory-pager: 1.5.0 memory-pager: 1.5.0
dev: false dev: false
@@ -10796,6 +10847,7 @@ packages:
/tar@6.2.0: /tar@6.2.0:
resolution: {integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==} resolution: {integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
requiresBuild: true
dependencies: dependencies:
chownr: 2.0.0 chownr: 2.0.0
fs-minipass: 2.1.0 fs-minipass: 2.1.0
@@ -11526,6 +11578,7 @@ packages:
/wide-align@1.1.5: /wide-align@1.1.5:
resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==}
requiresBuild: true
dependencies: dependencies:
string-width: 4.2.3 string-width: 4.2.3
dev: false dev: false

View File

@@ -37,6 +37,7 @@
"immer": "^9.0.19", "immer": "^9.0.19",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jschardet": "^3.0.0", "jschardet": "^3.0.0",
"json5": "^2.2.3",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mermaid": "^10.2.3", "mermaid": "^10.2.3",

View File

@@ -1,9 +1,11 @@
### Fast GPT V4.6.8 ### Fast GPT V4.6.9
1. 新增 - 知识库新增“增强处理”训练模式,可生成更多类型索引。 1. 新增 - 知识库新增“增强处理”训练模式,可生成更多类型索引。
2. 新增 - 完善了HTTP模块的变量提示。 2. 新增 - 完善了HTTP模块的变量提示。
3. 新增 - HTTP模块支持OpenAI单接口导入。 3. 新增 - HTTP模块支持OpenAI单接口导入。
4. 优化 - 问题补全。增加英文类型。同时可以设置为单独模块,方便复用 4. 新增 - 全局变量支持增加外部变量。可通过分享链接的Query或 API 的 variables 参数传入
5. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro) 5. 新增 - 内容提取模块增加默认值。
6. [使用文档](https://doc.fastgpt.in/docs/intro/) 6. 优化 - 问题补全。增加英文类型。同时可以设置为单独模块,方便复用。
7. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/) 7. [点击查看高级编排介绍文档](https://doc.fastgpt.in/docs/workflow/intro)
8. [使用文档](https://doc.fastgpt.in/docs/intro/)
9. [点击查看商业版](https://doc.fastgpt.in/docs/commercial/)

View File

@@ -774,6 +774,8 @@
"Input description": "", "Input description": "",
"label": "Dataset quote" "label": "Dataset quote"
}, },
"Default value": "Default ",
"Default value placeholder": "Null characters are returned by default",
"Field Description": "Description", "Field Description": "Description",
"Field Name": "Name", "Field Name": "Name",
"Field Type": "Type", "Field Type": "Type",
@@ -795,10 +797,14 @@
"Field Edit": "Field Edit" "Field Edit": "Field Edit"
}, },
"extract": { "extract": {
"Add field": "Add",
"Enum Description": "Lists the possible values for the field, one per row", "Enum Description": "Lists the possible values for the field, one per row",
"Enum Value": "Enum", "Enum Value": "Enum",
"Field Description Placeholder": "Name/age /sql statement......", "Field Description Placeholder": "Name/age /sql statement......",
"Field Setting Title": "Extract field configuration" "Field Setting Title": "Extract field configuration",
"Required": "Required",
"Required Description": "Even if the field cannot be extracted, it is returned with the default value",
"Target field": "Field"
}, },
"http": { "http": {
"Add props": "Add props", "Add props": "Add props",
@@ -939,6 +945,7 @@
"string": "String" "string": "String"
}, },
"variable": { "variable": {
"External type": "External",
"add option": "Add Option", "add option": "Add Option",
"input type": "Text", "input type": "Text",
"key": "Key", "key": "Key",

View File

@@ -776,6 +776,8 @@
"Input description": "可接收知识库搜索的结果。", "Input description": "可接收知识库搜索的结果。",
"label": "知识库引用" "label": "知识库引用"
}, },
"Default value": "默认值",
"Default value placeholder": "不填则默认返回空字符",
"Field Description": "字段描述", "Field Description": "字段描述",
"Field Name": "字段名", "Field Name": "字段名",
"Field Type": "字段类型", "Field Type": "字段类型",
@@ -797,10 +799,14 @@
"Field Edit": "字段编辑" "Field Edit": "字段编辑"
}, },
"extract": { "extract": {
"Add field": "新增字段",
"Enum Description": "列举出该字段可能的值,每行一个", "Enum Description": "列举出该字段可能的值,每行一个",
"Enum Value": "枚举值", "Enum Value": "枚举值",
"Field Description Placeholder": "姓名/年龄/sql语句……", "Field Description Placeholder": "姓名/年龄/sql语句……",
"Field Setting Title": "提取字段配置" "Field Setting Title": "提取字段配置",
"Required": "必须返回",
"Required Description": "即使无法提取该字段,也会使用默认值进行返回",
"Target field": "目标字段"
}, },
"http": { "http": {
"Add props": "添加参数", "Add props": "添加参数",
@@ -941,6 +947,7 @@
"string": "字符串" "string": "字符串"
}, },
"variable": { "variable": {
"External type": "外部传入",
"add option": "添加选项", "add option": "添加选项",
"input type": "文本", "input type": "文本",
"key": "变量 key", "key": "变量 key",

View File

@@ -53,7 +53,6 @@ import type { AdminMarkType } from './SelectMarkCollection';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import Markdown, { CodeClassName } from '@/components/Markdown'; import Markdown, { CodeClassName } from '@/components/Markdown';
import MySelect from '@/components/Select';
import MyTooltip from '../MyTooltip'; import MyTooltip from '../MyTooltip';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
const ResponseTags = dynamic(() => import('./ResponseTags')); const ResponseTags = dynamic(() => import('./ResponseTags'));
@@ -69,6 +68,7 @@ import MessageInput from './MessageInput';
import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants'; import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
import ChatBoxDivider from '../core/chat/Divider'; import ChatBoxDivider from '../core/chat/Divider';
import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat'; import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat';
import MySelect from '@fastgpt/web/components/common/MySelect';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24); const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24);
@@ -186,6 +186,10 @@ const ChatBox = (
() => splitGuideModule(userGuideModule), () => splitGuideModule(userGuideModule),
[userGuideModule] [userGuideModule]
); );
const filterVariableModules = useMemo(
() => variableModules.filter((item) => item.type !== VariableInputEnum.external),
[variableModules]
);
// compute variable input is finish. // compute variable input is finish.
const chatForm = useForm<{ const chatForm = useForm<{
@@ -200,17 +204,18 @@ const ChatBox = (
const [variableInputFinish, setVariableInputFinish] = useState(false); // clicked start chat button const [variableInputFinish, setVariableInputFinish] = useState(false); // clicked start chat button
const variableIsFinish = useMemo(() => { const variableIsFinish = useMemo(() => {
if (!variableModules || variableModules.length === 0 || chatHistory.length > 0) return true; if (!filterVariableModules || filterVariableModules.length === 0 || chatHistory.length > 0)
return true;
for (let i = 0; i < variableModules.length; i++) { for (let i = 0; i < filterVariableModules.length; i++) {
const item = variableModules[i]; const item = filterVariableModules[i];
if (item.required && !variables[item.key]) { if (item.required && !variables[item.key]) {
return false; return false;
} }
} }
return variableInputFinish; return variableInputFinish;
}, [chatHistory.length, variableInputFinish, variableModules, variables]); }, [chatHistory.length, variableInputFinish, filterVariableModules, variables]);
// 滚动到底部 // 滚动到底部
const scrollToBottom = (behavior: 'smooth' | 'auto' = 'smooth') => { const scrollToBottom = (behavior: 'smooth' | 'auto' = 'smooth') => {
@@ -495,7 +500,7 @@ const ChatBox = (
getChatHistories: () => chatHistory, getChatHistories: () => chatHistory,
resetVariables(e) { resetVariables(e) {
const defaultVal: Record<string, any> = {}; const defaultVal: Record<string, any> = {};
variableModules?.forEach((item) => { filterVariableModules?.forEach((item) => {
defaultVal[item.key] = ''; defaultVal[item.key] = '';
}); });
@@ -519,13 +524,13 @@ const ChatBox = (
feConfigs?.show_emptyChat && feConfigs?.show_emptyChat &&
showEmptyIntro && showEmptyIntro &&
chatHistory.length === 0 && chatHistory.length === 0 &&
!variableModules?.length && !filterVariableModules?.length &&
!welcomeText, !welcomeText,
[ [
chatHistory.length, chatHistory.length,
feConfigs?.show_emptyChat, feConfigs?.show_emptyChat,
showEmptyIntro, showEmptyIntro,
variableModules?.length, filterVariableModules?.length,
welcomeText welcomeText
] ]
); );
@@ -604,10 +609,10 @@ const ChatBox = (
{showEmpty && <Empty />} {showEmpty && <Empty />}
{!!welcomeText && <WelcomeText appAvatar={appAvatar} welcomeText={welcomeText} />} {!!welcomeText && <WelcomeText appAvatar={appAvatar} welcomeText={welcomeText} />}
{/* variable input */} {/* variable input */}
{!!variableModules?.length && ( {!!filterVariableModules?.length && (
<VariableInput <VariableInput
appAvatar={appAvatar} appAvatar={appAvatar}
variableModules={variableModules} variableModules={filterVariableModules}
variableIsFinish={variableIsFinish} variableIsFinish={variableIsFinish}
chatForm={chatForm} chatForm={chatForm}
onSubmitVariables={onSubmitVariables} onSubmitVariables={onSubmitVariables}

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useMemo } from 'react'; import React, { useEffect, useMemo } from 'react';
import { Box, useColorMode, Flex } from '@chakra-ui/react'; import { Box, useColorMode, Flex } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { throttle } from 'lodash'; import { throttle } from 'lodash';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { ModalContentProps } from '@chakra-ui/react'; import { ModalContentProps } from '@chakra-ui/react';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import CustomModal from '@fastgpt/web/components/common/MyModal'; import CustomModal from '@fastgpt/web/components/common/CustomModal';
export interface MyModalProps extends ModalContentProps { export interface MyModalProps extends ModalContentProps {
iconSrc?: string; iconSrc?: string;

View File

@@ -1,10 +1,10 @@
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import MySelect, { type SelectProps } from './index';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { AI_POINT_USAGE_CARD_ROUTE } from '@/web/support/wallet/sub/constants'; import { AI_POINT_USAGE_CARD_ROUTE } from '@/web/support/wallet/sub/constants';
import MySelect, { SelectProps } from '@fastgpt/web/components/common/MySelect';
const SelectAiModel = ({ list, ...props }: SelectProps) => { const SelectAiModel = ({ list, ...props }: SelectProps) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { Box, BoxProps } from '@chakra-ui/react'; import { Box, BoxProps } from '@chakra-ui/react';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
type Props = BoxProps & { type Props = BoxProps & {
isLoading?: boolean; isLoading?: boolean;

View File

@@ -26,9 +26,9 @@ import MyRadio from '@/components/common/MyRadio';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import Tabs from '@/components/Tabs'; import Tabs from '@/components/Tabs';
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor'; import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
import SelectAiModel from '@/components/Select/SelectAiModel';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import SelectAiModel from '@/components/Select/SelectAiModel';
export type DatasetParamsProps = { export type DatasetParamsProps = {
searchMode: `${DatasetSearchModeEnum}`; searchMode: `${DatasetSearchModeEnum}`;

View File

@@ -19,7 +19,7 @@ import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useDatasetStore } from '@/web/core/dataset/store/dataset'; import { useDatasetStore } from '@/web/core/dataset/store/dataset';
import DatasetSelectContainer, { useDatasetSelect } from '@/components/core/dataset/SelectModal'; import DatasetSelectContainer, { useDatasetSelect } from '@/components/core/dataset/SelectModal';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import EmptyTip from '@/components/EmptyTip'; import EmptyTip from '@/components/EmptyTip';
export const DatasetSelectModal = ({ export const DatasetSelectModal = ({

View File

@@ -177,8 +177,12 @@ export const FlowProvider = ({
({ connect }: { connect: Connection }) => { ({ connect }: { connect: Connection }) => {
const source = nodes.find((node) => node.id === connect.source)?.data; const source = nodes.find((node) => node.id === connect.source)?.data;
const sourceType = (() => { const sourceType = (() => {
if (source?.flowType === FlowNodeTypeEnum.classifyQuestion) { const type = source?.outputs.find(
return ModuleIOValueTypeEnum.string; (output) => output.key === connect.sourceHandle
)?.valueType;
console.log(type);
if (source?.flowType === FlowNodeTypeEnum.classifyQuestion && !type) {
return ModuleIOValueTypeEnum.boolean;
} }
if (source?.flowType === FlowNodeTypeEnum.pluginInput) { if (source?.flowType === FlowNodeTypeEnum.pluginInput) {
return source?.inputs.find((input) => input.key === connect.sourceHandle)?.valueType; return source?.inputs.find((input) => input.key === connect.sourceHandle)?.valueType;
@@ -189,7 +193,7 @@ export const FlowProvider = ({
const targetType = nodes const targetType = nodes
.find((node) => node.id === connect.target) .find((node) => node.id === connect.target)
?.data?.inputs.find((input) => input.key === connect.targetHandle)?.valueType; ?.data?.inputs.find((input) => input.key === connect.targetHandle)?.valueType;
console.log(source, targetType);
if (!sourceType || !targetType) { if (!sourceType || !targetType) {
return toast({ return toast({
status: 'warning', status: 'warning',

View File

@@ -5,7 +5,7 @@ import { useQuery } from '@tanstack/react-query';
import type { SelectAppItemType } from '@fastgpt/global/core/module/type'; import type { SelectAppItemType } from '@fastgpt/global/core/module/type';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useAppStore } from '@/web/core/app/store/useAppStore'; import { useAppStore } from '@/web/core/app/store/useAppStore';
const SelectAppModal = ({ const SelectAppModal = ({

View File

@@ -4,13 +4,13 @@ import { QuestionOutlineIcon } from '@chakra-ui/icons';
import { Box, Button, Flex, ModalBody, useDisclosure, Image } from '@chakra-ui/react'; import { Box, Button, Flex, ModalBody, useDisclosure, Image } from '@chakra-ui/react';
import React, { useCallback, useMemo } from 'react'; import React, { useCallback, useMemo } from 'react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MySelect from '@/components/Select';
import { TTSTypeEnum } from '@/constants/app'; import { TTSTypeEnum } from '@/constants/app';
import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d'; import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d';
import { useAudioPlay } from '@/web/common/utils/voice'; import { useAudioPlay } from '@/web/common/utils/voice';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import MySlider from '@/components/Slider'; import MySlider from '@/components/Slider';
import MySelect from '@fastgpt/web/components/common/MySelect';
const TTSSelect = ({ const TTSSelect = ({
value, value,

View File

@@ -25,7 +25,7 @@ import {
useDisclosure useDisclosure
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons'; import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons';
import { VariableInputEnum } from '@fastgpt/global/core/module/constants'; import { VariableInputEnum, variableMap } from '@fastgpt/global/core/module/constants';
import type { VariableItemType } from '@fastgpt/global/core/module/type.d'; import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
@@ -52,23 +52,12 @@ const VariableEdit = ({
const [refresh, setRefresh] = useState(false); const [refresh, setRefresh] = useState(false);
const VariableTypeList = useMemo( const VariableTypeList = useMemo(
() => [ () =>
{ Object.entries(variableMap).map(([key, value]) => ({
title: t('core.module.variable.input type'), title: t(value.title),
icon: 'core/app/variable/input', icon: value.icon,
value: VariableInputEnum.input value: key
}, })),
{
title: t('core.module.variable.textarea type'),
icon: 'core/app/variable/textarea',
value: VariableInputEnum.textarea
},
{
title: t('core.module.variable.select type'),
icon: 'core/app/variable/select',
value: VariableInputEnum.select
}
],
[t] [t]
); );
@@ -79,9 +68,12 @@ const VariableEdit = ({
getValues: getValuesEdit, getValues: getValuesEdit,
setValue: setValuesEdit, setValue: setValuesEdit,
control: editVariableController, control: editVariableController,
handleSubmit: handleSubmitEdit handleSubmit: handleSubmitEdit,
watch
} = useForm<{ variable: VariableItemType }>(); } = useForm<{ variable: VariableItemType }>();
const variableType = watch('variable.type');
const { const {
fields: selectEnums, fields: selectEnums,
append: appendEnums, append: appendEnums,
@@ -140,11 +132,11 @@ const VariableEdit = ({
<Table bg={'white'}> <Table bg={'white'}>
<Thead> <Thead>
<Tr> <Tr>
<Th w={'18px !important'} p={0} /> <Th w={'18px !important'} p={0} bg={'myGray.50'} />
<Th>{t('core.module.variable.variable name')}</Th> <Th bg={'myGray.50'}>{t('core.module.variable.variable name')}</Th>
<Th>{t('core.module.variable.key')}</Th> <Th bg={'myGray.50'}>{t('core.module.variable.key')}</Th>
<Th>{t('common.Require Input')}</Th> <Th bg={'myGray.50'}>{t('common.Require Input')}</Th>
<Th></Th> <Th bg={'myGray.50'}></Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
@@ -188,12 +180,15 @@ const VariableEdit = ({
title={t('core.module.Variable Setting')} title={t('core.module.Variable Setting')}
isOpen={isOpenEdit} isOpen={isOpenEdit}
onClose={onCloseEdit} onClose={onCloseEdit}
maxW={['90vw', '500px']}
> >
<ModalBody> <ModalBody>
<Flex alignItems={'center'}> {variableType !== VariableInputEnum.external && (
<Box w={'70px'}>{t('common.Require Input')}</Box> <Flex alignItems={'center'}>
<Switch {...registerEdit('variable.required')} /> <Box w={'70px'}>{t('common.Require Input')}</Box>
</Flex> <Switch {...registerEdit('variable.required')} />
</Flex>
)}
<Flex mt={5} alignItems={'center'}> <Flex mt={5} alignItems={'center'}>
<Box w={'80px'}>{t('core.module.variable.variable name')}</Box> <Box w={'80px'}>{t('core.module.variable.variable name')}</Box>
<Input <Input
@@ -216,8 +211,8 @@ const VariableEdit = ({
</Box> </Box>
<MyRadio <MyRadio
gridGap={4} gridGap={4}
gridTemplateColumns={'repeat(3,1fr)'} gridTemplateColumns={'repeat(2,1fr)'}
value={getValuesEdit('variable.type')} value={variableType}
list={VariableTypeList} list={VariableTypeList}
color={'myGray.600'} color={'myGray.600'}
hiddenCircle hiddenCircle
@@ -227,7 +222,14 @@ const VariableEdit = ({
}} }}
/> />
{getValuesEdit('variable.type') === VariableInputEnum.input && ( {/* desc */}
{variableMap[variableType]?.desc && (
<Box mt={2} fontSize={'sm'} color={'myGray.500'} whiteSpace={'pre-wrap'}>
{t(variableMap[variableType].desc)}
</Box>
)}
{variableType === VariableInputEnum.input && (
<> <>
<Box mt={5} mb={2}> <Box mt={5} mb={2}>
{t('core.module.variable.text max length')} {t('core.module.variable.text max length')}
@@ -251,7 +253,7 @@ const VariableEdit = ({
</> </>
)} )}
{getValuesEdit('variable.type') === VariableInputEnum.select && ( {variableType === VariableInputEnum.select && (
<> <>
<Box mt={5} mb={2}> <Box mt={5} mb={2}>
{t('core.module.variable.variable options')} {t('core.module.variable.variable options')}

View File

@@ -16,10 +16,11 @@ import { useTranslation } from 'next-i18next';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons'; import { QuestionOutlineIcon } from '@chakra-ui/icons';
export const defaultField = { export const defaultField: ContextExtractAgentItemType = {
required: false,
defaultValue: '',
desc: '', desc: '',
key: '', key: '',
required: true,
enum: '' enum: ''
}; };
@@ -33,9 +34,10 @@ const ExtractFieldModal = ({
onSubmit: (data: ContextExtractAgentItemType) => void; onSubmit: (data: ContextExtractAgentItemType) => void;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { register, handleSubmit } = useForm<ContextExtractAgentItemType>({ const { register, handleSubmit, watch } = useForm<ContextExtractAgentItemType>({
defaultValues: defaultField defaultValues: defaultField
}); });
const required = watch('required');
return ( return (
<MyModal <MyModal
@@ -43,19 +45,41 @@ const ExtractFieldModal = ({
iconSrc="/imgs/module/extract.png" iconSrc="/imgs/module/extract.png"
title={t('core.module.extract.Field Setting Title')} title={t('core.module.extract.Field Setting Title')}
onClose={onClose} onClose={onClose}
w={['90vw', '500px']}
> >
<ModalBody> <ModalBody>
<Flex alignItems={'center'}> <Flex mt={2} alignItems={'center'}>
<Box flex={'0 0 70px'}>{t('common.Require Input')}</Box> <Flex alignItems={'center'} flex={['0 0 80px', '0 0 100px']}>
{t('core.module.extract.Required')}
<MyTooltip label={t('core.module.extract.Required Description')} forceShow>
<QuestionOutlineIcon ml={1} />
</MyTooltip>
</Flex>
<Switch {...register('required')} /> <Switch {...register('required')} />
</Flex> </Flex>
{required && (
<Flex mt={5} alignItems={'center'}>
<Box flex={['0 0 80px', '0 0 100px']}>{t('core.module.Default value')}</Box>
<Input
bg={'myGray.50'}
placeholder={t('core.module.Default value placeholder')}
{...register('defaultValue')}
/>
</Flex>
)}
<Flex mt={5} alignItems={'center'}> <Flex mt={5} alignItems={'center'}>
<Box flex={'0 0 70px'}>{t('core.module.Field key')}</Box> <Box flex={['0 0 80px', '0 0 100px']}>{t('core.module.Field key')}</Box>
<Input placeholder="name/age/sql" {...register('key', { required: true })} /> <Input
bg={'myGray.50'}
placeholder="name/age/sql"
{...register('key', { required: true })}
/>
</Flex> </Flex>
<Flex mt={5} alignItems={'center'}> <Flex mt={5} alignItems={'center'}>
<Box flex={'0 0 70px'}>{t('core.module.Field Description')}</Box> <Box flex={['0 0 80px', '0 0 100px']}>{t('core.module.Field Description')}</Box>
<Input <Input
bg={'myGray.50'}
placeholder={t('core.module.extract.Field Description Placeholder')} placeholder={t('core.module.extract.Field Description Placeholder')}
{...register('desc', { required: true })} {...register('desc', { required: true })}
/> />
@@ -68,14 +92,16 @@ const ExtractFieldModal = ({
</MyTooltip> </MyTooltip>
</Flex> </Flex>
<Textarea rows={5} placeholder={'apple\npeach\nwatermelon'} {...register('enum')} /> <Textarea
rows={5}
bg={'myGray.50'}
placeholder={'apple\npeach\nwatermelon'}
{...register('enum')}
/>
</Box> </Box>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common.Close')}
</Button>
<Button onClick={handleSubmit(onSubmit)}>{t('common.Confirm')}</Button> <Button onClick={handleSubmit(onSubmit)}>{t('common.Confirm')}</Button>
</ModalFooter> </ModalFooter>
</MyModal> </MyModal>

View File

@@ -1,5 +1,16 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Box, Button, Table, Thead, Tbody, Tr, Th, Td, TableContainer } from '@chakra-ui/react'; import {
Box,
Button,
Table,
Thead,
Tbody,
Tr,
Th,
Td,
TableContainer,
Flex
} from '@chakra-ui/react';
import { NodeProps } from 'reactflow'; import { NodeProps } from 'reactflow';
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d'; import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
@@ -36,75 +47,87 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
}: { }: {
value?: ContextExtractAgentItemType[]; value?: ContextExtractAgentItemType[];
}) => ( }) => (
<Box pt={2}> <Box>
<Box position={'absolute'} top={0} right={0}> <Flex alignItems={'center'}>
<Box flex={'1 0 0'}>{t('core.module.extract.Target field')}</Box>
<Button <Button
size={'sm'}
variant={'whitePrimary'} variant={'whitePrimary'}
leftIcon={<AddIcon fontSize={'10px'} />} leftIcon={<AddIcon fontSize={'10px'} />}
onClick={() => setEditExtractField(defaultField)} onClick={() => setEditExtractField(defaultField)}
> >
{t('core.module.extract.Add field')}
</Button> </Button>
</Box> </Flex>
<TableContainer> <Box
<Table> mt={2}
<Thead> borderRadius={'md'}
<Tr> overflow={'hidden'}
<Th> key</Th> borderWidth={'1px'}
<Th></Th> borderBottom="none"
<Th></Th> >
<Th></Th> <TableContainer>
</Tr> <Table bg={'white'}>
</Thead> <Thead>
<Tbody> <Tr>
{extractKeys.map((item, index) => ( <Th bg={'myGray.50'}> key</Th>
<Tr <Th bg={'myGray.50'}></Th>
key={index} <Th bg={'myGray.50'}></Th>
position={'relative'} <Th bg={'myGray.50'}></Th>
whiteSpace={'pre-wrap'}
wordBreak={'break-all'}
>
<Td>{item.key}</Td>
<Td>{item.desc}</Td>
<Td>{item.required ? '✔' : ''}</Td>
<Td whiteSpace={'nowrap'}>
<MyIcon
mr={3}
name={'common/settingLight'}
w={'16px'}
cursor={'pointer'}
onClick={() => {
setEditExtractField(item);
}}
/>
<MyIcon
name={'delete'}
w={'16px'}
cursor={'pointer'}
onClick={() => {
onChangeNode({
moduleId,
type: 'updateInput',
key: ModuleInputKeyEnum.extractKeys,
value: {
...props,
value: extractKeys.filter((extract) => item.key !== extract.key)
}
});
onChangeNode({
moduleId,
type: 'delOutput',
key: item.key
});
}}
/>
</Td>
</Tr> </Tr>
))} </Thead>
</Tbody> <Tbody>
</Table> {extractKeys.map((item, index) => (
</TableContainer> <Tr
key={index}
position={'relative'}
whiteSpace={'pre-wrap'}
wordBreak={'break-all'}
>
<Td>{item.key}</Td>
<Td>{item.desc}</Td>
<Td>{item.required ? '✔' : ''}</Td>
<Td whiteSpace={'nowrap'}>
<MyIcon
mr={3}
name={'common/settingLight'}
w={'16px'}
cursor={'pointer'}
onClick={() => {
setEditExtractField(item);
}}
/>
<MyIcon
name={'delete'}
w={'16px'}
cursor={'pointer'}
onClick={() => {
onChangeNode({
moduleId,
type: 'updateInput',
key: ModuleInputKeyEnum.extractKeys,
value: {
...props,
value: extractKeys.filter(
(extract) => item.key !== extract.key
)
}
});
onChangeNode({
moduleId,
type: 'delOutput',
key: item.key
});
}}
/>
</Td>
</Tr>
))}
</Tbody>
</Table>
</TableContainer>
</Box>
</Box> </Box>
) )
}} }}
@@ -142,7 +165,6 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
const newOutput = { const newOutput = {
key: data.key, key: data.key,
label: `提取结果-${data.desc}`, label: `提取结果-${data.desc}`,
description: '无法提取时不会返回',
valueType: ModuleIOValueTypeEnum.string, valueType: ModuleIOValueTypeEnum.string,
type: FlowNodeOutputTypeEnum.source, type: FlowNodeOutputTypeEnum.source,
targets: [] targets: []

View File

@@ -19,7 +19,6 @@ import {
TableContainer, TableContainer,
Button Button
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import MySelect from '@/components/Select';
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants'; import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
import { onChangeNode, useFlowProviderStore } from '../../../FlowProvider'; import { onChangeNode, useFlowProviderStore } from '../../../FlowProvider';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
@@ -38,6 +37,7 @@ import {
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type'; import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
import HttpInput from '@fastgpt/web/components/common/Input/HttpInput'; import HttpInput from '@fastgpt/web/components/common/Input/HttpInput';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import MySelect from '@fastgpt/web/components/common/MySelect';
const OpenApiImportModal = dynamic(() => import('./OpenApiImportModal')); const OpenApiImportModal = dynamic(() => import('./OpenApiImportModal'));
enum TabEnum { enum TabEnum {

View File

@@ -13,7 +13,6 @@ import { useForm } from 'react-hook-form';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import { DYNAMIC_INPUT_KEY, ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants'; import { DYNAMIC_INPUT_KEY, ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MySelect from '@/components/Select';
import { FlowValueTypeMap } from '@/web/core/modules/constants/dataType'; import { FlowValueTypeMap } from '@/web/core/modules/constants/dataType';
import { import {
FlowNodeInputTypeEnum, FlowNodeInputTypeEnum,
@@ -21,6 +20,7 @@ import {
} from '@fastgpt/global/core/module/node/constant'; } from '@fastgpt/global/core/module/node/constant';
import { EditInputFieldMap, EditNodeFieldType } from '@fastgpt/global/core/module/node/type.d'; import { EditInputFieldMap, EditNodeFieldType } from '@fastgpt/global/core/module/node/type.d';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import MySelect from '@fastgpt/web/components/common/MySelect';
const FieldEditModal = ({ const FieldEditModal = ({
editField = { editField = {

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import type { RenderInputProps } from '../type'; import type { RenderInputProps } from '../type';
import { onChangeNode } from '../../../../FlowProvider'; import { onChangeNode } from '../../../../FlowProvider';
import MySelect from '@/components/Select'; import MySelect from '@fastgpt/web/components/common/MySelect';
const SelectRender = ({ item, moduleId }: RenderInputProps) => { const SelectRender = ({ item, moduleId }: RenderInputProps) => {
return ( return (

View File

@@ -1,8 +1,8 @@
import React, { useCallback, useEffect } from 'react'; import React, { useCallback, useEffect } from 'react';
import type { RenderInputProps } from '../type'; import type { RenderInputProps } from '../type';
import { onChangeNode } from '../../../../FlowProvider'; import { onChangeNode } from '../../../../FlowProvider';
import SelectAiModel from '@/components/Select/SelectAiModel';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import SelectAiModel from '@/components/Select/SelectAiModel';
const SelectAiModelRender = ({ item, inputs = [], moduleId }: RenderInputProps) => { const SelectAiModelRender = ({ item, inputs = [], moduleId }: RenderInputProps) => {
const { llmModelList } = useSystemStore(); const { llmModelList } = useSystemStore();

View File

@@ -28,7 +28,7 @@ import {
} from '@/web/support/openapi/api'; } from '@/web/support/openapi/api';
import type { EditApiKeyProps } from '@/global/support/openapi/api.d'; import type { EditApiKeyProps } from '@/global/support/openapi/api.d';
import { useQuery, useMutation } from '@tanstack/react-query'; import { useQuery, useMutation } from '@tanstack/react-query';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { AddIcon, QuestionOutlineIcon } from '@chakra-ui/icons'; import { AddIcon, QuestionOutlineIcon } from '@chakra-ui/icons';
import { useCopyData } from '@/web/common/hooks/useCopyData'; import { useCopyData } from '@/web/common/hooks/useCopyData';

View File

@@ -3,12 +3,12 @@ import MyModal from '@/components/MyModal';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { ModalCloseButton, ModalBody, Box, ModalFooter, Button } from '@chakra-ui/react'; import { ModalCloseButton, ModalBody, Box, ModalFooter, Button } from '@chakra-ui/react';
import TagTextarea from '@/components/common/Textarea/TagTextarea'; import TagTextarea from '@/components/common/Textarea/TagTextarea';
import MySelect from '@/components/Select';
import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant'; import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import { postInviteTeamMember } from '@/web/support/user/team/api'; import { postInviteTeamMember } from '@/web/support/user/team/api';
import { useConfirm } from '@/web/common/hooks/useConfirm'; import { useConfirm } from '@/web/common/hooks/useConfirm';
import type { InviteMemberResponse } from '@fastgpt/global/support/user/team/controller.d'; import type { InviteMemberResponse } from '@fastgpt/global/support/user/team/controller.d';
import MySelect from '@fastgpt/web/components/common/MySelect';
const InviteModal = ({ const InviteModal = ({
teamId, teamId,

View File

@@ -38,7 +38,7 @@ import {
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import { setToken } from '@/web/support/user/auth'; import { setToken } from '@/web/support/user/auth';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { FormDataType, defaultForm } from './EditModal'; import { FormDataType, defaultForm } from './EditModal';
import MyMenu from '@/components/MyMenu'; import MyMenu from '@/components/MyMenu';
import { useConfirm } from '@/web/common/hooks/useConfirm'; import { useConfirm } from '@/web/common/hooks/useConfirm';

View File

@@ -31,10 +31,9 @@ export const Prompt_ExtractJson = `你可以从 <对话记录></对话记录>
<字段说明> <字段说明>
1. 下面的 JSON 字符串均按照 JSON Schema 的规则描述。 1. 下面的 JSON 字符串均按照 JSON Schema 的规则描述。
2. key 代表字段名description 代表字段的描述;required 代表字段是否必须;enum 是可选值,代表可选的 value。 2. key 代表字段名description 代表字段的描述enum 是可选值,代表可选的 value。
3. 如果字段内容为空,你可以返回空字符串 3. 如果没有可提取的内容,忽略该字段
4. 本次需提取的JSON Schema{{json}}
{{json}}
</字段说明> </字段说明>
<对话记录> <对话记录>

View File

@@ -4,7 +4,7 @@ import Script from 'next/script';
import Head from 'next/head'; import Head from 'next/head';
import { ChakraProvider, ColorModeScript } from '@chakra-ui/react'; import { ChakraProvider, ColorModeScript } from '@chakra-ui/react';
import Layout from '@/components/Layout'; import Layout from '@/components/Layout';
import { theme } from '@/web/styles/theme'; import { theme } from '@fastgpt/web/styles/theme';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import NProgress from 'nprogress'; //nprogress module import NProgress from 'nprogress'; //nprogress module
import Router from 'next/router'; import Router from 'next/router';

View File

@@ -19,18 +19,19 @@ import { formatStorePrice2Read } from '@fastgpt/global/support/wallet/usage/tool
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MySelect from '@/components/Select';
import { import {
BillTypeEnum, BillTypeEnum,
billPayWayMap, billPayWayMap,
billStatusMap, billStatusMap,
billTypeMap billTypeMap
} from '@fastgpt/global/support/wallet/bill/constants'; } from '@fastgpt/global/support/wallet/bill/constants';
import { usePagination } from '@/web/common/hooks/usePagination'; // import { usePagination } from '@/web/common/hooks/usePagination';
import MyBox from '@/components/common/MyBox'; import MyBox from '@/components/common/MyBox';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import MyModal from '@/components/MyModal';
import { standardSubLevelMap, subModeMap } from '@fastgpt/global/support/wallet/sub/constants'; import { standardSubLevelMap, subModeMap } from '@fastgpt/global/support/wallet/sub/constants';
import MySelect from '@fastgpt/web/components/common/MySelect';
import MyModal from '@fastgpt/web/components/common/CustomModal';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
const BillTable = () => { const BillTable = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -9,8 +9,8 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { UserUpdateParams } from '@/types/user'; import { UserUpdateParams } from '@/types/user';
import { langMap, setLngStore } from '@/web/common/utils/i18n'; import { langMap, setLngStore } from '@/web/common/utils/i18n';
import MySelect from '@/components/Select';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import MySelect from '@fastgpt/web/components/common/MySelect';
const Individuation = () => { const Individuation = () => {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();

View File

@@ -1,12 +1,12 @@
import React from 'react'; import React from 'react';
import { Box, Flex, useTheme } from '@chakra-ui/react'; import { Box, Flex, useTheme } from '@chakra-ui/react';
import { getInforms, readInform } from '@/web/support/user/inform/api'; import { getInforms, readInform } from '@/web/support/user/inform/api';
import { usePagination } from '@/web/common/hooks/usePagination';
import { useLoading } from '@/web/common/hooks/useLoading';
import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type'; import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type';
import { formatTimeToChatTime } from '@/utils/tools'; import { formatTimeToChatTime } from '@/utils/tools';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
import { useLoading } from '@fastgpt/web/hooks/useLoading';
const BillTable = () => { const BillTable = () => {
const theme = useTheme(); const theme = useTheme();

View File

@@ -18,15 +18,15 @@ import { useTranslation } from 'next-i18next';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { getPromotionInitData, getPromotionRecords } from '@/web/support/activity/promotion/api'; import { getPromotionInitData, getPromotionRecords } from '@/web/support/activity/promotion/api';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { useLoading } from '@/web/common/hooks/useLoading';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import { QuestionOutlineIcon } from '@chakra-ui/icons'; import { QuestionOutlineIcon } from '@chakra-ui/icons';
import { useCopyData } from '@/web/common/hooks/useCopyData'; import { useCopyData } from '@/web/common/hooks/useCopyData';
import { usePagination } from '@/web/common/hooks/usePagination';
import type { PromotionRecordType } from '@/global/support/api/userRes.d'; import type { PromotionRecordType } from '@/global/support/api/userRes.d';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
import { useLoading } from '@fastgpt/web/hooks/useLoading';
const Promotion = () => { const Promotion = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -14,21 +14,23 @@ import {
import { UsageSourceEnum, UsageSourceMap } from '@fastgpt/global/support/wallet/usage/constants'; import { UsageSourceEnum, UsageSourceMap } from '@fastgpt/global/support/wallet/usage/constants';
import { getUserUsages } from '@/web/support/wallet/usage/api'; import { getUserUsages } from '@/web/support/wallet/usage/api';
import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type'; import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type';
import { usePagination } from '@/web/common/hooks/usePagination'; import { usePagination } from '@fastgpt/web/hooks/usePagination';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import DateRangePicker, { type DateRangeType } from '@/components/DateRangePicker'; import DateRangePicker, {
type DateRangeType
} from '@fastgpt/web/components/common/DateRangePicker';
import { addDays } from 'date-fns'; import { addDays } from 'date-fns';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MySelect from '@/components/Select';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { getTeamMembers } from '@/web/support/user/team/api'; import { getTeamMembers } from '@/web/support/user/team/api';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import { formatNumber } from '../../../../../../packages/global/common/math/tools'; import MySelect from '@fastgpt/web/components/common/MySelect';
import { formatNumber } from '@fastgpt/global/common/math/tools';
const UsageDetail = dynamic(() => import('./UsageDetail')); const UsageDetail = dynamic(() => import('./UsageDetail'));
const UsageTable = () => { const UsageTable = () => {

View File

@@ -14,7 +14,7 @@ import {
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { getTeamPlans } from '@/web/support/user/team/api'; import { getTeamPlans } from '@/web/support/user/team/api';
import { subTypeMap, standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constants'; import { subTypeMap, standardSubLevelMap } from '@fastgpt/global/support/wallet/sub/constants';

View File

@@ -15,7 +15,6 @@ import {
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { usePagination } from '@/web/common/hooks/usePagination';
import { getAppChatLogs } from '@/web/core/app/api'; import { getAppChatLogs } from '@/web/core/app/api';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { ChatSourceMap } from '@fastgpt/global/core/chat/constants'; import { ChatSourceMap } from '@fastgpt/global/core/chat/constants';
@@ -27,9 +26,10 @@ import { useQuery } from '@tanstack/react-query';
import { getInitChatInfo } from '@/web/core/chat/api'; import { getInitChatInfo } from '@/web/core/chat/api';
import Tag from '@/components/Tag'; import Tag from '@/components/Tag';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import DateRangePicker, { type DateRangeType } from '@/components/DateRangePicker';
import { addDays } from 'date-fns'; import { addDays } from 'date-fns';
import MyBox from '@/components/common/MyBox'; import MyBox from '@/components/common/MyBox';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
import DateRangePicker, { DateRangeType } from '@fastgpt/web/components/common/DateRangePicker';
const Logs = ({ appId }: { appId: string }) => { const Logs = ({ appId }: { appId: string }) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -18,7 +18,7 @@ import {
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { QuestionOutlineIcon } from '@chakra-ui/icons'; import { QuestionOutlineIcon } from '@chakra-ui/icons';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { import {
getShareChatList, getShareChatList,

View File

@@ -31,11 +31,10 @@ import Avatar from '@/components/Avatar';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import VariableEdit from '@/components/core/module/Flow/components/modules/VariableEdit'; import VariableEdit from '@/components/core/module/Flow/components/modules/VariableEdit';
import MyTextarea from '@/components/common/Textarea/MyTextarea/index'; import MyTextarea from '@/components/common/Textarea/MyTextarea/index';
import { DatasetSearchModeMap } from '@fastgpt/global/core/dataset/constants';
import SelectAiModel from '@/components/Select/SelectAiModel';
import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor'; import PromptEditor from '@fastgpt/web/components/common/Textarea/PromptEditor';
import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/module/utils'; import { formatEditorVariablePickerIcon } from '@fastgpt/global/core/module/utils';
import SearchParamsTip from '@/components/core/dataset/SearchParamsTip'; import SearchParamsTip from '@/components/core/dataset/SearchParamsTip';
import SelectAiModel from '@/components/Select/SelectAiModel';
const DatasetSelectModal = dynamic(() => import('@/components/core/module/DatasetSelectModal')); const DatasetSelectModal = dynamic(() => import('@/components/core/module/DatasetSelectModal'));
const DatasetParamsModal = dynamic(() => import('@/components/core/module/DatasetParamsModal')); const DatasetParamsModal = dynamic(() => import('@/components/core/module/DatasetParamsModal'));

View File

@@ -11,7 +11,7 @@ import SideTabs from '@/components/SideTabs';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import PageContainer from '@/components/PageContainer'; import PageContainer from '@/components/PageContainer';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import SimpleEdit from './components/SimpleEdit'; import SimpleEdit from './components/SimpleEdit';
import { serviceSideProps } from '@/web/common/utils/i18n'; import { serviceSideProps } from '@/web/common/utils/i18n';
import { useAppStore } from '@/web/core/app/store/useAppStore'; import { useAppStore } from '@/web/core/app/store/useAppStore';

View File

@@ -1,11 +1,11 @@
import React, { useState, useRef, useCallback } from 'react'; import React, { useState, useRef, useCallback } from 'react';
import { Box, Flex, Card, Grid, Input } from '@chakra-ui/react'; import { Box, Flex, Grid } from '@chakra-ui/react';
import { useLoading } from '@/web/common/hooks/useLoading';
import { getShareModelList, triggerModelCollection } from '@/web/core/app/api'; import { getShareModelList, triggerModelCollection } from '@/web/core/app/api';
import { usePagination } from '@/web/common/hooks/usePagination';
import type { ShareAppItem } from '@/types/app'; import type { ShareAppItem } from '@/types/app';
import ShareModelList from './components/list'; import ShareModelList from './components/list';
import { serviceSideProps } from '@/web/common/utils/i18n'; import { serviceSideProps } from '@/web/common/utils/i18n';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
import { useLoading } from '@fastgpt/web/hooks/useLoading';
const modelList = () => { const modelList = () => {
const { Loading } = useLoading(); const { Loading } = useLoading();

View File

@@ -20,8 +20,8 @@ import { useTranslation } from 'next-i18next';
import { useConfirm } from '@/web/common/hooks/useConfirm'; import { useConfirm } from '@/web/common/hooks/useConfirm';
import Tabs from '@/components/Tabs'; import Tabs from '@/components/Tabs';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { AppListItemType } from '@fastgpt/global/core/app/type';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useAppStore } from '@/web/core/app/store/useAppStore';
import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant'; import { TeamMemberRoleEnum } from '@fastgpt/global/support/user/team/constant';
type HistoryItemType = { type HistoryItemType = {
@@ -41,6 +41,8 @@ const ChatHistorySlider = ({
appName, appName,
appAvatar, appAvatar,
history, history,
apps = [],
confirmClearText,
activeChatId, activeChatId,
onChangeChat, onChangeChat,
onDelHistory, onDelHistory,
@@ -54,6 +56,8 @@ const ChatHistorySlider = ({
appAvatar: string; appAvatar: string;
history: HistoryItemType[]; history: HistoryItemType[];
activeChatId: string; activeChatId: string;
apps?: AppListItemType[];
confirmClearText: string;
onChangeChat: (chatId?: string) => void; onChangeChat: (chatId?: string) => void;
onDelHistory: (e: { chatId: string }) => void; onDelHistory: (e: { chatId: string }) => void;
onClearHistory: () => void; onClearHistory: () => void;
@@ -65,22 +69,18 @@ const ChatHistorySlider = ({
const router = useRouter(); const router = useRouter();
const { t } = useTranslation(); const { t } = useTranslation();
const { isPc } = useSystemStore(); const { isPc } = useSystemStore();
const { myApps, loadMyApps } = useAppStore();
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const [currentTab, setCurrentTab] = useState<`${TabEnum}`>(TabEnum.history); const [currentTab, setCurrentTab] = useState<`${TabEnum}`>(TabEnum.history);
const isShare = useMemo(() => !appId || !userInfo, [appId, userInfo]); const showApps = apps?.length > 0;
// custom title edit // custom title edit
const { onOpenModal, EditModal: EditTitleModal } = useEditTitle({ const { onOpenModal, EditModal: EditTitleModal } = useEditTitle({
title: t('core.chat.Custom History Title'), title: t('core.chat.Custom History Title'),
placeholder: t('core.chat.Custom History Title Description') placeholder: t('core.chat.Custom History Title Description')
}); });
const { openConfirm, ConfirmModal } = useConfirm({ const { openConfirm, ConfirmModal } = useConfirm({
content: isShare content: confirmClearText
? t('core.chat.Confirm to clear share chat history')
: t('core.chat.Confirm to clear history')
}); });
const concatHistory = useMemo<HistoryItemType[]>( const concatHistory = useMemo<HistoryItemType[]>(
@@ -92,11 +92,11 @@ const ChatHistorySlider = ({
); );
useQuery(['init'], () => { useQuery(['init'], () => {
if (isShare) { if (!showApps) {
setCurrentTab(TabEnum.history); setCurrentTab(TabEnum.history);
return null; return null;
} }
return loadMyApps(false); return;
}); });
const canRouteToDetail = useMemo( const canRouteToDetail = useMemo(
@@ -140,7 +140,7 @@ const ChatHistorySlider = ({
{/* menu */} {/* menu */}
<Flex w={'100%'} px={[2, 5]} h={'36px'} my={5} alignItems={'center'}> <Flex w={'100%'} px={[2, 5]} h={'36px'} my={5} alignItems={'center'}>
{!isPc && !isShare && ( {!isPc && appId && (
<Tabs <Tabs
w={'120px'} w={'120px'}
mr={2} mr={2}
@@ -165,7 +165,7 @@ const ChatHistorySlider = ({
{t('core.chat.New Chat')} {t('core.chat.New Chat')}
</Button> </Button>
{(isPc || isShare) && ( {(isPc || !showApps) && (
<IconButton <IconButton
ml={3} ml={3}
h={'100%'} h={'100%'}
@@ -286,36 +286,38 @@ const ChatHistorySlider = ({
)} )}
{currentTab === TabEnum.app && !isPc && ( {currentTab === TabEnum.app && !isPc && (
<> <>
{myApps.map((item) => ( {Array.isArray(apps) &&
<Flex apps.map((item) => (
key={item._id} <Flex
py={2} key={item._id}
px={3} py={2}
mb={3} px={3}
borderRadius={'md'} mb={3}
alignItems={'center'} borderRadius={'md'}
{...(item._id === appId alignItems={'center'}
? { {...(item._id === appId
backgroundColor: 'primary.50 !important', ? {
color: 'primary.600' backgroundColor: 'primary.50 !important',
} color: 'primary.600'
: {
onClick: () => {
router.replace({
query: {
appId: item._id
}
});
onClose();
} }
})} : {
> onClick: () => {
<Avatar src={item.avatar} w={'24px'} /> router.replace({
<Box ml={2} className={'textEllipsis'}> query: {
{item.name} ...router.query,
</Box> appId: item._id
</Flex> }
))} });
onClose();
}
})}
>
<Avatar src={item.avatar} w={'24px'} />
<Box ml={2} className={'textEllipsis'}>
{item.name}
</Box>
</Flex>
))}
</> </>
)} )}
</Box> </Box>

View File

@@ -15,7 +15,7 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { streamFetch } from '@/web/common/api/fetch'; import { streamFetch } from '@/web/common/api/fetch';
import { useChatStore } from '@/web/core/chat/storeChat'; import { useChatStore } from '@/web/core/chat/storeChat';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import { customAlphabet } from 'nanoid'; import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 12); const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 12);
@@ -277,6 +277,8 @@ const Chat = ({ appId, chatId }: { appId: string; chatId: string }) => {
); );
})( })(
<ChatHistorySlider <ChatHistorySlider
apps={myApps}
confirmClearText={t('core.chat.Confirm to clear history')}
appId={appId} appId={appId}
appName={chatData.app.name} appName={chatData.app.name}
appAvatar={chatData.app.avatar} appAvatar={chatData.app.avatar}

View File

@@ -30,24 +30,29 @@ import { MongoOutLink } from '@fastgpt/service/support/outLink/schema';
import { OutLinkWithAppType } from '@fastgpt/global/support/outLink/type'; import { OutLinkWithAppType } from '@fastgpt/global/support/outLink/type';
const OutLink = ({ const OutLink = ({
shareId,
chatId,
showHistory,
authToken,
appName, appName,
appIntro, appIntro,
appAvatar appAvatar
}: { }: {
shareId: string;
chatId: string;
showHistory: '0' | '1';
authToken?: string;
appName?: string; appName?: string;
appIntro?: string; appIntro?: string;
appAvatar?: string; appAvatar?: string;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const router = useRouter(); const router = useRouter();
const {
shareId = '',
chatId = '',
showHistory = '1',
authToken,
...customVariables
} = router.query as {
shareId: string;
chatId: string;
showHistory: '0' | '1';
authToken: string;
[key: string]: string;
};
const { toast } = useToast(); const { toast } = useToast();
const { isOpen: isOpenSlider, onClose: onCloseSlider, onOpen: onOpenSlider } = useDisclosure(); const { isOpen: isOpenSlider, onClose: onCloseSlider, onOpen: onOpenSlider } = useDisclosure();
const { isPc } = useSystemStore(); const { isPc } = useSystemStore();
@@ -56,11 +61,7 @@ const OutLink = ({
const initSign = useRef(false); const initSign = useRef(false);
const [isEmbed, setIdEmbed] = useState(true); const [isEmbed, setIdEmbed] = useState(true);
const { const { localUId } = useShareChatStore();
localUId,
shareChatHistory, // abandon
clearLocalHistory // abandon
} = useShareChatStore();
const { const {
histories, histories,
loadHistories, loadHistories,
@@ -83,7 +84,10 @@ const OutLink = ({
const { responseText, responseData } = await streamFetch({ const { responseText, responseData } = await streamFetch({
data: { data: {
messages: prompts, messages: prompts,
variables, variables: {
...customVariables,
...variables
},
shareId, shareId,
chatId: completionChatId, chatId: completionChatId,
outLinkUid outLinkUid
@@ -159,6 +163,7 @@ const OutLink = ({
}, },
[ [
chatId, chatId,
customVariables,
shareId, shareId,
outLinkUid, outLinkUid,
t, t,
@@ -293,6 +298,7 @@ const OutLink = ({
<ChatHistorySlider <ChatHistorySlider
appName={chatData.app.name} appName={chatData.app.name}
appAvatar={chatData.app.avatar} appAvatar={chatData.app.avatar}
confirmClearText={t('core.chat.Confirm to clear share chat history')}
activeChatId={chatId} activeChatId={chatId}
history={histories.map((item) => ({ history={histories.map((item) => ({
id: item.chatId, id: item.chatId,
@@ -391,9 +397,6 @@ const OutLink = ({
export async function getServerSideProps(context: any) { export async function getServerSideProps(context: any) {
const shareId = context?.query?.shareId || ''; const shareId = context?.query?.shareId || '';
const chatId = context?.query?.chatId || '';
const showHistory = context?.query?.showHistory || '1';
const authToken = context?.query?.authToken || '';
const app = await (async () => { const app = await (async () => {
try { try {
@@ -413,13 +416,9 @@ export async function getServerSideProps(context: any) {
return { return {
props: { props: {
shareId, appName: app?.appId?.name || '',
chatId, appAvatar: app?.appId?.avatar || '',
showHistory, appIntro: app?.appId?.intro || '',
authToken,
appName: app?.appId?.name,
appAvatar: app?.appId?.avatar,
appIntro: app?.appId?.intro,
...(await serviceSideProps(context)) ...(await serviceSideProps(context))
} }
}; };

View File

@@ -85,7 +85,6 @@ const OutLink = ({
onMessage: generatingMessage, onMessage: generatingMessage,
abortCtrl: controller abortCtrl: controller
}); });
console.log(responseData);
const newTitle = const newTitle =
chatContentReplaceBlock(prompts[0].content).slice(0, 20) || chatContentReplaceBlock(prompts[0].content).slice(0, 20) ||
prompts[1]?.value?.slice(0, 20) || prompts[1]?.value?.slice(0, 20) ||
@@ -291,9 +290,11 @@ const OutLink = ({
})( })(
<ChatHistorySlider <ChatHistorySlider
appId={appId} appId={appId}
apps={myApps}
appName={chatData.app.name} appName={chatData.app.name}
appAvatar={chatData.app.avatar} appAvatar={chatData.app.avatar}
activeChatId={chatId} activeChatId={chatId}
confirmClearText={t('core.chat.Confirm to clear history')}
onClose={onCloseSlider} onClose={onCloseSlider}
history={histories.map((item, i) => ({ history={histories.map((item, i) => ({
id: item.chatId, id: item.chatId,

View File

@@ -32,9 +32,8 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import MyInput from '@/components/MyInput'; import MyInput from '@/components/MyInput';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { usePagination } from '@/web/common/hooks/usePagination';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import MyMenu from '@/components/MyMenu'; import MyMenu from '@/components/MyMenu';
import { useEditTitle } from '@/web/common/hooks/useEditTitle'; import { useEditTitle } from '@/web/common/hooks/useEditTitle';
@@ -64,6 +63,7 @@ import { DatasetSchemaType } from '@fastgpt/global/core/dataset/type';
import { DatasetCollectionSyncResultEnum } from '@fastgpt/global/core/dataset/constants'; import { DatasetCollectionSyncResultEnum } from '@fastgpt/global/core/dataset/constants';
import MyBox from '@/components/common/MyBox'; import MyBox from '@/components/common/MyBox';
import { ImportDataSourceEnum } from './Import'; import { ImportDataSourceEnum } from './Import';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
const WebSiteConfigModal = dynamic(() => import('./Import/WebsiteConfig'), {}); const WebSiteConfigModal = dynamic(() => import('./Import/WebsiteConfig'), {});
const FileSourceSelector = dynamic(() => import('./Import/sourceSelector/FileSourceSelector'), {}); const FileSourceSelector = dynamic(() => import('./Import/sourceSelector/FileSourceSelector'), {});

View File

@@ -15,7 +15,6 @@ import {
DrawerContent, DrawerContent,
useDisclosure useDisclosure
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import { usePagination } from '@/web/common/hooks/usePagination';
import { import {
getDatasetDataList, getDatasetDataList,
delOneDatasetDataById, delOneDatasetDataById,
@@ -31,7 +30,7 @@ import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import MyInput from '@/components/MyInput'; import MyInput from '@/components/MyInput';
import { useLoading } from '@/web/common/hooks/useLoading'; import { useLoading } from '@fastgpt/web/hooks/useLoading';
import InputDataModal from '../components/InputDataModal'; import InputDataModal from '../components/InputDataModal';
import RawSourceBox from '@/components/core/dataset/RawSourceBox'; import RawSourceBox from '@/components/core/dataset/RawSourceBox';
import type { DatasetDataListItemType } from '@/global/core/dataset/type.d'; import type { DatasetDataListItemType } from '@/global/core/dataset/type.d';
@@ -48,6 +47,7 @@ import { formatTime2YMDHM } from '@fastgpt/global/common/string/time';
import { formatFileSize } from '@fastgpt/global/common/file/tools'; import { formatFileSize } from '@fastgpt/global/common/file/tools';
import { getFileAndOpen } from '@/web/core/dataset/utils'; import { getFileAndOpen } from '@/web/core/dataset/utils';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import { usePagination } from '@fastgpt/web/hooks/usePagination';
const DataCard = () => { const DataCard = () => {
const BoxRef = useRef<HTMLDivElement>(null); const BoxRef = useRef<HTMLDivElement>(null);

View File

@@ -7,7 +7,7 @@ import { useTranslation } from 'next-i18next';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { Box, Button, Flex, Input, Textarea } from '@chakra-ui/react'; import { Box, Button, Flex, Input, Textarea } from '@chakra-ui/react';
import { getNanoid } from '@fastgpt/global/common/string/tools'; import { getNanoid } from '@fastgpt/global/common/string/tools';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), { const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), {
loading: () => <Loading fixed={false} /> loading: () => <Loading fixed={false} />

View File

@@ -11,7 +11,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import { LinkCollectionIcon } from '@fastgpt/global/core/dataset/constants'; import { LinkCollectionIcon } from '@fastgpt/global/core/dataset/constants';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { getDocPath } from '@/web/common/system/doc'; import { getDocPath } from '@/web/common/system/doc';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), { const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), {
loading: () => <Loading fixed={false} /> loading: () => <Loading fixed={false} />

View File

@@ -18,7 +18,7 @@ import { useImportStore } from '../Provider';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), { const DataProcess = dynamic(() => import('../commonProgress/DataProcess'), {
loading: () => <Loading fixed={false} /> loading: () => <Loading fixed={false} />

View File

@@ -13,10 +13,10 @@ import Avatar from '@/components/Avatar';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import PermissionRadio from '@/components/support/permission/Radio'; import PermissionRadio from '@/components/support/permission/Radio';
import MySelect from '@/components/Select';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants'; import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants';
import MySelect from '@fastgpt/web/components/common/MySelect';
const Info = ({ datasetId }: { datasetId: string }) => { const Info = ({ datasetId }: { datasetId: string }) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -33,7 +33,7 @@ import {
} from '@fastgpt/global/core/dataset/constants'; } from '@fastgpt/global/core/dataset/constants';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import MySelect from '@/components/Select'; import MySelect from '@fastgpt/web/components/common/MySelect';
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile'; import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
import { fileDownload } from '@/web/common/file/utils'; import { fileDownload } from '@/web/common/file/utils';
import { readCsvContent } from '@fastgpt/web/common/file/read/csv'; import { readCsvContent } from '@fastgpt/web/common/file/read/csv';

View File

@@ -13,12 +13,12 @@ import MyTooltip from '@/components/MyTooltip';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import { postCreateDataset } from '@/web/core/dataset/api'; import { postCreateDataset } from '@/web/core/dataset/api';
import type { CreateDatasetParams } from '@/global/core/dataset/api.d'; import type { CreateDatasetParams } from '@/global/core/dataset/api.d';
import MySelect from '@/components/Select';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MyRadio from '@/components/common/MyRadio'; import MyRadio from '@/components/common/MyRadio';
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants'; import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants'; import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants';
import { QuestionOutlineIcon } from '@chakra-ui/icons'; import { QuestionOutlineIcon } from '@chakra-ui/icons';
import MySelect from '@fastgpt/web/components/common/MySelect';
const CreateModal = ({ onClose, parentId }: { onClose: () => void; parentId?: string }) => { const CreateModal = ({ onClose, parentId }: { onClose: () => void; parentId?: string }) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -1,6 +1,6 @@
import { serviceSideProps } from '@/web/common/utils/i18n'; import { serviceSideProps } from '@/web/common/utils/i18n';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
const index = () => { const index = () => {

View File

@@ -9,7 +9,7 @@ import { useRouter } from 'next/router';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import FormLayout from './components/FormLayout'; import FormLayout from './components/FormLayout';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
interface Props { interface Props {
loginSuccess: (e: ResLogin) => void; loginSuccess: (e: ResLogin) => void;

View File

@@ -85,7 +85,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
} }
setRequesting(false); setRequesting(false);
}, },
[loginSuccess, toast] [loginSuccess, t, toast]
); );
return ( return (

View File

@@ -7,7 +7,7 @@ import { useUserStore } from '@/web/support/user/useUserStore';
import { clearToken, setToken } from '@/web/support/user/auth'; import { clearToken, setToken } from '@/web/support/user/auth';
import { postFastLogin } from '@/web/support/user/api'; import { postFastLogin } from '@/web/support/user/api';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/utils/i18n'; import { serviceSideProps } from '@/web/common/utils/i18n';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';

View File

@@ -12,7 +12,7 @@ import { serviceSideProps } from '@/web/common/utils/i18n';
import { clearToken, setToken } from '@/web/support/user/auth'; import { clearToken, setToken } from '@/web/support/user/auth';
import CommunityModal from '@/components/CommunityModal'; import CommunityModal from '@/components/CommunityModal';
import Script from 'next/script'; import Script from 'next/script';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
const RegisterForm = dynamic(() => import('./components/RegisterForm')); const RegisterForm = dynamic(() => import('./components/RegisterForm'));
const ForgetPasswordForm = dynamic(() => import('./components/ForgetPasswordForm')); const ForgetPasswordForm = dynamic(() => import('./components/ForgetPasswordForm'));
@@ -57,11 +57,10 @@ const Login = () => {
/* default login type */ /* default login type */
useEffect(() => { useEffect(() => {
if (!feConfigs.oauth) return;
setPageType( setPageType(
feConfigs.oauth?.wechat ? LoginPageTypeEnum.wechat : LoginPageTypeEnum.passwordLogin feConfigs?.oauth?.wechat ? LoginPageTypeEnum.wechat : LoginPageTypeEnum.passwordLogin
); );
}, [feConfigs.oauth, feConfigs.oauth?.wechat]); }, [feConfigs.oauth]);
useEffect(() => { useEffect(() => {
clearToken(); clearToken();
router.prefetch('/app/list'); router.prefetch('/app/list');

View File

@@ -7,7 +7,7 @@ import { useUserStore } from '@/web/support/user/useUserStore';
import { clearToken, setToken } from '@/web/support/user/auth'; import { clearToken, setToken } from '@/web/support/user/auth';
import { oauthLogin } from '@/web/support/user/api'; import { oauthLogin } from '@/web/support/user/api';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/utils/i18n'; import { serviceSideProps } from '@/web/common/utils/i18n';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';

View File

@@ -10,7 +10,7 @@ import { serviceSideProps } from '@/web/common/utils/i18n';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { getOnePlugin } from '@/web/core/plugin/api'; import { getOnePlugin } from '@/web/core/plugin/api';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import Loading from '@/components/Loading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { usePluginStore } from '@/web/core/plugin/store/plugin'; import { usePluginStore } from '@/web/core/plugin/store/plugin';

View File

@@ -176,7 +176,7 @@ ${replaceVariable(Prompt_AgentQA.fixedText, { text })}`;
*/ */
function formatSplitText(text: string, rawText: string) { function formatSplitText(text: string, rawText: string) {
text = text.replace(/\\n/g, '\n'); // 将换行符替换为空格 text = text.replace(/\\n/g, '\n'); // 将换行符替换为空格
const regex = /Q\d+:(\s*)(.*)(\s*)A\d+:(\s*)([\s\S]*?)(?=Q|$)/g; // 匹配Q和A的正则表达式 const regex = /Q\d+:(\s*)(.*)(\s*)A\d+:(\s*)([\s\S]*?)(?=Q\d|$)/g; // 匹配Q和A的正则表达式
const matches = text.matchAll(regex); // 获取所有匹配到的结果 const matches = text.matchAll(regex); // 获取所有匹配到的结果
const result: PushDatasetDataChunkProps[] = []; // 存储最终的结果 const result: PushDatasetDataChunkProps[] = []; // 存储最终的结果

View File

@@ -16,6 +16,7 @@ import { LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
import { getHistories } from '../utils'; import { getHistories } from '../utils';
import { ModelTypeEnum, getLLMModel } from '@fastgpt/service/core/ai/model'; import { ModelTypeEnum, getLLMModel } from '@fastgpt/service/core/ai/model';
import { formatModelChars2Points } from '@fastgpt/service/support/wallet/usage/utils'; import { formatModelChars2Points } from '@fastgpt/service/support/wallet/usage/utils';
import json5 from 'json5';
type Props = ModuleDispatchProps<{ type Props = ModuleDispatchProps<{
[ModuleInputKeyEnum.history]?: ChatItemType[]; [ModuleInputKeyEnum.history]?: ChatItemType[];
@@ -64,7 +65,8 @@ export async function dispatchContentExtract(props: Props): Promise<Response> {
// remove invalid key // remove invalid key
for (let key in arg) { for (let key in arg) {
if (!extractKeys.find((item) => item.key === key)) { const item = extractKeys.find((item) => item.key === key);
if (!item) {
delete arg[key]; delete arg[key];
} }
if (arg[key] === '') { if (arg[key] === '') {
@@ -72,12 +74,20 @@ export async function dispatchContentExtract(props: Props): Promise<Response> {
} }
} }
// auto fill required fields
extractKeys.forEach((item) => {
if (item.required && !arg[item.key]) {
arg[item.key] = item.defaultValue || '';
}
});
// auth fields // auth fields
let success = !extractKeys.find((item) => !(item.key in arg)); let success = !extractKeys.find((item) => !(item.key in arg));
// auth empty value // auth empty value
if (success) { if (success) {
for (const key in arg) { for (const key in arg) {
if (arg[key] === '') { const item = extractKeys.find((item) => item.key === key);
if (!item) {
success = false; success = false;
break; break;
} }
@@ -125,14 +135,8 @@ async function toolChoice({
...histories, ...histories,
{ {
obj: ChatRoleEnum.Human, obj: ChatRoleEnum.Human,
value: `你的任务: value: `你的任务是根据上下文获取适当的 JSON 字符串。要求
""" """
${description || '根据用户要求获取适当的 JSON 字符串。'}
"""
要求:
"""
- 如果字段为空,你返回空字符串。
- 字符串不要换行。 - 字符串不要换行。
- 结合上下文和当前问题进行获取。 - 结合上下文和当前问题进行获取。
""" """
@@ -167,8 +171,7 @@ ${description || '根据用户要求获取适当的 JSON 字符串。'}
description, description,
parameters: { parameters: {
type: 'object', type: 'object',
properties, properties
required: extractKeys.filter((item) => item.required).map((item) => item.key)
} }
}; };
const tools: any = [ const tools: any = [
@@ -193,7 +196,7 @@ ${description || '根据用户要求获取适当的 JSON 字符串。'}
const arg: Record<string, any> = (() => { const arg: Record<string, any> = (() => {
try { try {
return JSON.parse( return json5.parse(
response?.choices?.[0]?.message?.tool_calls?.[0]?.function?.arguments || '{}' response?.choices?.[0]?.message?.tool_calls?.[0]?.function?.arguments || '{}'
); );
} catch (error) { } catch (error) {
@@ -225,7 +228,7 @@ async function completions({
json: extractKeys json: extractKeys
.map( .map(
(item) => (item) =>
`{"key":"${item.key}", "description":"${item.desc}", "required":${item.required}${ `{"key":"${item.key}", "description":"${item.desc}"${
item.enum ? `, "enum":"[${item.enum.split('\n')}]"` : '' item.enum ? `, "enum":"[${item.enum.split('\n')}]"` : ''
}}` }}`
) )
@@ -240,7 +243,6 @@ Human: ${content}`
userKey: user.openaiAccount, userKey: user.openaiAccount,
timeout: 480000 timeout: 480000
}); });
const data = await ai.chat.completions.create({ const data = await ai.chat.completions.create({
model: extractModel.model, model: extractModel.model,
temperature: 0.01, temperature: 0.01,
@@ -260,19 +262,14 @@ Human: ${content}`
arg: {} arg: {}
}; };
const jsonStr = answer
.substring(start, end + 1)
.replace(/(\\n|\\)/g, '')
.replace(/ /g, '');
try { try {
return { return {
rawResponse: answer, rawResponse: answer,
tokens: countMessagesTokens(messages), tokens: countMessagesTokens(messages),
arg: json5.parse(answer) as Record<string, any>
arg: JSON.parse(jsonStr) as Record<string, any>
}; };
} catch (error) { } catch (error) {
console.log(error);
return { return {
rawResponse: answer, rawResponse: answer,
tokens: countMessagesTokens(messages), tokens: countMessagesTokens(messages),

View File

@@ -61,7 +61,7 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
appId, appId,
chatId, chatId,
responseChatItemId, responseChatItemId,
variables, ...variables,
histories: histories.slice(0, 10), histories: histories.slice(0, 10),
...body ...body
}; };
@@ -71,22 +71,20 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
try { try {
if (!httpHeader || httpHeader.length === 0) return {}; if (!httpHeader || httpHeader.length === 0) return {};
// array // array
return httpHeader.reduce((acc, item) => { return httpHeader.reduce((acc: Record<string, string>, item) => {
item.key = replaceVariable(item.key, concatVariables); const key = replaceVariable(item.key, concatVariables);
item.value = replaceVariable(item.value, concatVariables); const value = replaceVariable(item.value, concatVariables);
// @ts-ignore acc[key] = valueTypeFormat(value, 'string');
acc[item.key] = valueTypeFormat(item.value, 'string');
return acc; return acc;
}, {}); }, {});
} catch (error) { } catch (error) {
return Promise.reject('Header 为非法 JSON 格式'); return Promise.reject('Header 为非法 JSON 格式');
} }
})(); })();
const params = httpParams.reduce((acc, item) => { const params = httpParams.reduce((acc: Record<string, string>, item) => {
item.key = replaceVariable(item.key, concatVariables); const key = replaceVariable(item.key, concatVariables);
item.value = replaceVariable(item.value, concatVariables); const value = replaceVariable(item.value, concatVariables);
// @ts-ignore acc[key] = valueTypeFormat(value, 'string');
acc[item.key] = valueTypeFormat(item.value, 'string');
return acc; return acc;
}, {}); }, {});
const requestBody = await (() => { const requestBody = await (() => {
@@ -101,7 +99,7 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
return Promise.reject(`Invalid JSON body: ${httpJsonBody}`); return Promise.reject(`Invalid JSON body: ${httpJsonBody}`);
} }
})(); })();
// console.log(params, requestBody, headers); // console.log(params, requestBody, headers, concatVariables);
try { try {
const { formatResponse, rawResponse } = await fetchData({ const { formatResponse, rawResponse } = await fetchData({

View File

@@ -1,26 +1,16 @@
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import ParentPaths from '@/components/common/ParentPaths'; import ParentPaths from '@/components/common/ParentPaths';
import { useLoading } from '@/web/common/hooks/useLoading';
import { useRequest } from '@/web/common/hooks/useRequest'; import { useRequest } from '@/web/common/hooks/useRequest';
import { getDatasetCollectionPathById, getDatasetCollections } from '@/web/core/dataset/api'; import { getDatasetCollectionPathById, getDatasetCollections } from '@/web/core/dataset/api';
import { useDatasetStore } from '@/web/core/dataset/store/dataset'; import { useDatasetStore } from '@/web/core/dataset/store/dataset';
import { import { Box, Flex, ModalFooter, Button, useTheme, Grid, Card, ModalBody } from '@chakra-ui/react';
Box,
Flex,
ModalFooter,
Button,
useTheme,
Grid,
Card,
Image,
ModalBody
} from '@chakra-ui/react';
import { DatasetCollectionTypeEnum } from '@fastgpt/global/core/dataset/constants'; import { DatasetCollectionTypeEnum } from '@fastgpt/global/core/dataset/constants';
import { getCollectionIcon } from '@fastgpt/global/core/dataset/utils'; import { getCollectionIcon } from '@fastgpt/global/core/dataset/utils';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useLoading } from '@fastgpt/web/hooks/useLoading';
const SelectCollections = ({ const SelectCollections = ({
datasetId, datasetId,