Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16629e32a7 | ||
|
|
d67474170a | ||
|
|
e02a7ab350 | ||
|
|
d491105752 | ||
|
|
fe59eadcee | ||
|
|
946bd20dbf | ||
|
|
3c97757e4d | ||
|
|
9f33729ca9 | ||
|
|
a8d456f448 | ||
|
|
59177d307e | ||
|
|
bfb598d686 | ||
|
|
b780fbd6a7 | ||
|
|
7861229325 | ||
|
|
5b0516c28b | ||
|
|
740e8eb30c | ||
|
|
05a357dffe | ||
|
|
781fd45e39 |
83
.github/workflows/fastgpt-image.yml
vendored
@@ -173,3 +173,86 @@ jobs:
|
||||
-t ${Docker_Hub_Tag} \
|
||||
-t ${Docker_Hub_Latest} \
|
||||
.
|
||||
build-fastgpt-images-sub-route-gchat:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
# install env
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt update && sudo apt install -y nodejs npm
|
||||
- name: Set up QEMU (optional)
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
driver-opts: network=host
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
# login docker
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GH_PAT }}
|
||||
- name: Login to Ali Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: registry.cn-hangzhou.aliyuncs.com
|
||||
username: ${{ secrets.ALI_HUB_USERNAME }}
|
||||
password: ${{ secrets.ALI_HUB_PASSWORD }}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_NAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||
|
||||
# Set tag
|
||||
- name: Set image name and tag
|
||||
run: |
|
||||
if [[ "${{ github.ref_name }}" == "main" ]]; then
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Git_Tag=ghcr.io/${{ github.repository_owner }}/fastgpt-sub-route-gchat:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Git_Latest=ghcr.io/${{ github.repository_owner }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Ali_Tag=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sub-route-gchat:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Ali_Latest=${{ secrets.ALI_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Tag=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sub-route-gchat:${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
echo "Docker_Hub_Latest=${{ secrets.DOCKER_IMAGE_NAME }}/fastgpt-sub-route-gchat:latest" >> $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 \
|
||||
-f projects/app/Dockerfile \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--build-arg base_url=/gchat \
|
||||
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
|
||||
--label "org.opencontainers.image.description=fastgpt-sub-route-gchat image" \
|
||||
--push \
|
||||
--cache-from=type=local,src=/tmp/.buildx-cache \
|
||||
--cache-to=type=local,dest=/tmp/.buildx-cache \
|
||||
-t ${Git_Tag} \
|
||||
-t ${Git_Latest} \
|
||||
-t ${Ali_Tag} \
|
||||
-t ${Ali_Latest} \
|
||||
-t ${Docker_Hub_Tag} \
|
||||
-t ${Docker_Hub_Latest} \
|
||||
.
|
||||
|
||||
BIN
docSite/assets/imgs/dataset3.png
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
docSite/assets/imgs/dataset4.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
docSite/assets/imgs/faq1.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
docSite/assets/imgs/faq2.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
docSite/assets/imgs/faq3.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
docSite/assets/imgs/image-83.png
Normal file
|
After Width: | Height: | Size: 144 KiB |
BIN
docSite/assets/imgs/image-84.png
Normal file
|
After Width: | Height: | Size: 243 KiB |
BIN
docSite/assets/imgs/image-85.png
Normal file
|
After Width: | Height: | Size: 237 KiB |
BIN
docSite/assets/imgs/image-86.png
Normal file
|
After Width: | Height: | Size: 550 KiB |
BIN
docSite/assets/imgs/image-87.png
Normal file
|
After Width: | Height: | Size: 390 KiB |
BIN
docSite/assets/imgs/other1.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
docSite/assets/imgs/other2.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
docSite/assets/imgs/other3.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
docSite/assets/imgs/quizApp1.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
docSite/assets/imgs/quizApp2.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
@@ -221,6 +221,8 @@ weight: 707
|
||||
- Ollama
|
||||
- BAAI - 智源研究院
|
||||
- FishAudio
|
||||
- Intern - 书生
|
||||
- Moka - Moka-AI
|
||||
- Other - 其他
|
||||
|
||||
|
||||
|
||||
@@ -23,19 +23,19 @@ weight: 707
|
||||
|
||||
### PgVector版本
|
||||
|
||||
体验测试首选
|
||||
非常轻量,适合数据量在 5000 万以下。
|
||||
|
||||
{{< table "table-hover table-striped-columns" >}}
|
||||
| 环境 | 最低配置(单节点) | 推荐配置 |
|
||||
| ---- | ---- | ---- |
|
||||
| 测试 | 2c2g | 2c4g |
|
||||
| 测试(可以把计算进程设置少一些) | 2c4g | 2c8g |
|
||||
| 100w 组向量 | 4c8g 50GB | 4c16g 50GB |
|
||||
| 500w 组向量 | 8c32g 200GB | 16c64g 200GB |
|
||||
{{< /table >}}
|
||||
|
||||
### Milvus版本
|
||||
|
||||
生产部署首选,对于千万级以上向量性能更优秀。
|
||||
对于亿级以上向量性能更优秀。
|
||||
|
||||
[点击查看 Milvus 官方推荐配置](https://milvus.io/docs/prerequisite-docker.md)
|
||||
|
||||
|
||||
@@ -19,6 +19,24 @@ images: []
|
||||
|
||||
## 二、通用问题
|
||||
|
||||
### 通过sealos部署的话,是否没有本地部署的一些限制?
|
||||

|
||||
这是索引模型的长度限制,通过任何方式部署都一样的,但不同索引模型的配置不一样,可以在后台修改参数。
|
||||
|
||||
### sealos怎么挂载 小程序配置文件
|
||||
|
||||
新增配置文件:/app/projects/app/public/xxxx.txt
|
||||
|
||||
如图:
|
||||
|
||||

|
||||
|
||||
### 数据库3306端口被占用了,启动服务失败
|
||||
|
||||

|
||||
|
||||
把端口映射改成 3307 之类的,例如 3307:3306。
|
||||
|
||||
### 本地部署的限制
|
||||
|
||||
具体内容参考https://fael3z0zfze.feishu.cn/wiki/OFpAw8XzAi36Guk8dfucrCKUnjg。
|
||||
|
||||
@@ -55,4 +55,28 @@ curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions'
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
```
|
||||
|
||||
## 自定义用户 ID
|
||||
|
||||
`v4.8.13`后支持传入自定义的用户 ID, 并且存入历史记录中。
|
||||
|
||||
```sh
|
||||
curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' \
|
||||
--header 'Authorization: Bearer fastgpt-xxxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"chatId": "111",
|
||||
"stream": false,
|
||||
"detail": false,
|
||||
"messages": [
|
||||
{
|
||||
"content": "导演是谁",
|
||||
"role": "user"
|
||||
}
|
||||
],
|
||||
"customUid": "xxxxxx"
|
||||
}'
|
||||
```
|
||||
|
||||
在历史记录中,该条记录的使用者会显示为 `xxxxxx`。
|
||||
|
||||
@@ -686,7 +686,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories
|
||||
- appId - 应用 Id
|
||||
- offset - 偏移量,即从第几条数据开始取
|
||||
- pageSize - 记录数量
|
||||
- source - 对话源
|
||||
- source - 对话源。source=api,表示获取通过 API 创建的对话(不会获取到页面上的对话记录)
|
||||
{{% /alert %}}
|
||||
|
||||
{{< /markdownify >}}
|
||||
|
||||
@@ -733,6 +733,21 @@ data 为集合的 ID。
|
||||
{{< tab tabName="请求示例" >}}
|
||||
{{< markdownify >}}
|
||||
|
||||
**4.8.19+**
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/listv2' \
|
||||
--header 'Authorization: Bearer {{authorization}}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"offset":0,
|
||||
"pageSize": 10,
|
||||
"datasetId":"6593e137231a2be9c5603ba7",
|
||||
"parentId": null,
|
||||
"searchText":""
|
||||
}'
|
||||
```
|
||||
|
||||
**4.8.19-(不再维护)**
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/list' \
|
||||
--header 'Authorization: Bearer {{authorization}}' \
|
||||
@@ -753,7 +768,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio
|
||||
{{< markdownify >}}
|
||||
|
||||
{{% alert icon=" " context="success" %}}
|
||||
- pageNum: 页码(选填)
|
||||
- offset: 偏移量
|
||||
- pageSize: 每页数量,最大30(选填)
|
||||
- datasetId: 知识库的ID(必填)
|
||||
- parentId: 父级Id(选填)
|
||||
@@ -773,9 +788,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio
|
||||
"statusText": "",
|
||||
"message": "",
|
||||
"data": {
|
||||
"pageNum": 1,
|
||||
"pageSize": 10,
|
||||
"data": [
|
||||
"list": [
|
||||
{
|
||||
"_id": "6593e137231a2be9c5603ba9",
|
||||
"parentId": null,
|
||||
@@ -1175,7 +1188,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/data/v2/l
|
||||
}'
|
||||
```
|
||||
|
||||
**4.6.7+**
|
||||
**4.6.7-(即将弃用)**
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'http://localhost:3000/api/core/dataset/data/list' \
|
||||
@@ -1197,8 +1210,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/data/list
|
||||
|
||||
{{% alert icon=" " context="success" %}}
|
||||
|
||||
- pageNum: 偏移量(选填)
|
||||
- pageNum: 页码(选填)
|
||||
- offset: 偏移量(选填)
|
||||
- pageSize: 每页数量,最大30(选填)
|
||||
- collectionId: 集合的ID(必填)
|
||||
- searchText: 模糊搜索词(选填)
|
||||
@@ -1218,9 +1230,7 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/data/list
|
||||
"statusText": "",
|
||||
"message": "",
|
||||
"data": {
|
||||
"pageNum": 1,
|
||||
"pageSize": 10,
|
||||
"data": [
|
||||
"list": [
|
||||
{
|
||||
"_id": "65abd4b29d1448617cba61db",
|
||||
"datasetId": "65abc9bd9d1448617cba5e6c",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: 'V4.8.18(进行中)'
|
||||
title: 'V4.8.18'
|
||||
description: 'FastGPT V4.8.18 更新说明'
|
||||
icon: 'upgrade'
|
||||
draft: false
|
||||
@@ -9,6 +9,12 @@ weight: 806
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 fastgpt 镜像 tag: v4.8.18-fix
|
||||
- 更新 fastgpt-pro 商业版镜像 tag: v4.8.18-fix
|
||||
- Sandbox 镜像无需更新
|
||||
|
||||
### 2. 运行升级脚本
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**。
|
||||
|
||||
46
docSite/content/zh-cn/docs/development/upgrading/4819.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: 'V4.8.19(进行中)'
|
||||
description: 'FastGPT V4.8.19 更新说明'
|
||||
icon: 'upgrade'
|
||||
draft: false
|
||||
toc: true
|
||||
weight: 805
|
||||
---
|
||||
|
||||
## 更新指南
|
||||
|
||||
### 1. 更新镜像:
|
||||
|
||||
- 更新 fastgpt 镜像 tag: v4.8.19-beta
|
||||
- 更新 fastgpt-pro 商业版镜像 tag: v4.8.19-beta
|
||||
- Sandbox 镜像无需更新
|
||||
|
||||
### 2. 运行升级脚本
|
||||
|
||||
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**。
|
||||
|
||||
```bash
|
||||
curl --location --request POST 'https://{{host}}/api/admin/initv4819' \
|
||||
--header 'rootkey: {{rootkey}}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
|
||||
迁移用户表的头像到成员表中。
|
||||
|
||||
## 完整更新内容
|
||||
|
||||
1. 新增 - 工作流知识库检索支持按知识库权限进行过滤。
|
||||
2. 新增 - 飞书/语雀知识库查看原文。
|
||||
3. 新增 - 流程等待插件,可以等待 n 毫秒后继续执行流程。
|
||||
4. 新增 - 飞书机器人接入,支持配置私有化飞书地址。
|
||||
5. 优化 - 成员列表分页加载。
|
||||
6. 优化 - 统一分页加载代码。
|
||||
7. 优化 - 对话页面加载时,可配置是否为独立页面。
|
||||
8. 优化 - 成员头像迁移,移动到成员表。
|
||||
9. 修复 - 语雀文件库导入时,嵌套文件内容无法展开的问题。
|
||||
10. 修复 - 工作流编排中,LLM 参数无法关闭问题。
|
||||
11. 修复 - 工作流编排中,代码运行节点还原模板问题。
|
||||
12. 修复 - HTTP 接口适配对象字符串解析。
|
||||
13. 修复 - 通过 API 上传文件(localFile)接口,图片过期标记未清除。
|
||||
14. 修复 - 工作流导入编排时,number input 类型无法覆盖。
|
||||
15. 修复 - 部分模型提供商 logo 无法正常显示。
|
||||
@@ -7,7 +7,7 @@ toc: true
|
||||
weight: 908
|
||||
---
|
||||
|
||||
## 工作流中多轮对话场景中如何使连续问题被问题分类节点正确的归类
|
||||
## 多轮对话中如何使连续问题被问题分类节点正确的归类
|
||||
|
||||
问题分类节点具有获取上下文信息的能力,当处理两个关联性较大的问题时,模型的判断准确性往往依赖于这两个问题之间的联系和模型的能力。例如,当用户先问“我该如何使用这个功能?”接着又询问“这个功能有什么限制?”时,模型借助上下文信息,就能够更精准地理解并响应。
|
||||
|
||||
@@ -15,10 +15,68 @@ weight: 908
|
||||
|
||||
建议:构建批量运行脚本进行测试,评估问题分类的准确性。
|
||||
|
||||
## 系统编排配置中的定时执行,如果用户打开分享的连接,停留在那个页面,定时执行触发问题
|
||||
## 定时执行的时机问题
|
||||
|
||||
发布后,后台生效。
|
||||
系统编排配置中的定时执行,如果用户打开分享的连接,停留在那个页面,定时执行触发问题:
|
||||
|
||||
定时执行会在应用发布后生效,会在后台生效。
|
||||
|
||||
## V4.8.18-FIX2中提到“ 1. 修复 HTTP 节点, {{}} 格式引用变量兼容问题。建议尽快替换 / 模式取变量, {{}} 语法已弃用。”替换{{}}引用格式是仅仅只有在http节点,还是所有节点的都会有影响?
|
||||
|
||||
只有 http 节点用到这个语法。
|
||||
|
||||
## 工作流类型的应用在运行预览可以正常提问返回,但是发布免登录窗口之后有问题。
|
||||
|
||||
一般是没正确发布,在工作流右上角点击【保存并发布】。
|
||||
|
||||
## 如何解决猜你想问使用中文回答显示
|
||||
|
||||
注意需要更新到V4.8.17及以上,把猜你想问的提示词改成中文。
|
||||

|
||||
|
||||
## AI对话回答要求中的Markdown语法取消
|
||||
|
||||
在针对知识库的回答要求里有, 要给它配置提示词,不然他就是默认的,默认的里面就有该语法。
|
||||
修改知识库默认提示词, 默认用的是标准模板提示词,会要求按 Markdown 输出,可以去除该要求:
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|
||||
## 应用在不同来源效果不一致
|
||||
|
||||
Q: 应用在调试和正式发布后,效果不一致;在 API 调用时,效果不一致。
|
||||
|
||||
A: 通常是由于上下文不一致导致,可以在对话日志中,找到对应的记录,并查看运行详情来进行比对。
|
||||
|
||||
| | | |
|
||||
| --- | --- | --- |
|
||||
|  |  |  |
|
||||
在针对知识库的回答要求里有, 要给它配置提示词,不然他就是默认的,默认的里面就有该语法。
|
||||
|
||||
## 工作流操作:一个工作流,以一个问题分类节点开始,根据不同的分类导入到不同的分支,访问相应的知识库和AI对话,AI对话返回内容后,怎么样不进入问题分类节点,而是将问题到知识库搜索,然后把历史记录一起作为背景再次AI查询。
|
||||
|
||||
做个判断器,如果是初次开始对话也就是历史记录为0,就走问题分类;不为零直接走知识库和ai。
|
||||
|
||||
## 实时对话,设置 fastgpt 定时,比如每隔 3000MS 去拿一次 webhook发送过来的消息到AI页面
|
||||
|
||||
定时执行没有这么高频率的去拿信息的,想要实现在企微里面的实时对话的机器人,
|
||||
目前通过低代码的工作流构建应该是不行的,只能自己写代码,然后去调用 FastGPT 的 APIKey 回复。企业微信似乎没有提供「自动监听」群聊消息的接口(或是通过 at 机器人这种触发消息推送)。应该只能发消息给应用,接收这个 https://developer.work.weixin.qq.com/document/path/90238 文档中的消息推送实现实时对话。或者是定时去拿群聊消息,通过这个文档所示的接口https://developer.work.weixin.qq.com/document/path/98914,然后用这个接口 https://developer.work.weixin.qq.com/document/path/90248 去推送消息。
|
||||
|
||||
## 工作流连接数据库
|
||||
|
||||
工作流提供该连接数据库功能,用这个数据库连接的 plugin 可以实现 text2SQL,但是相对危险,不建议做写入等操作。
|
||||
|
||||

|
||||
|
||||
## 关于循环体,协助理解循环体的循环条件和终止条件、循环的方式,循环体内参数调用后、在循环体内属于是局部作用域的参数还是全局作用域的参数
|
||||
|
||||
可理解为 for 函数,传一个数组,每个数据都执行一次。
|
||||
|
||||
## 公式无法正常显示
|
||||
|
||||
添加相关提示词,引导模型按 Markdown 输出公式
|
||||
|
||||
```bash
|
||||
Latex inline: \(x^2\)
|
||||
Latex block: $$e=mc^2$$
|
||||
```
|
||||
|
||||
@@ -16,6 +16,25 @@ weight: 910
|
||||
* **文件处理模型**:用于数据处理的【增强处理】和【问答拆分】。在【增强处理】中,生成相关问题和摘要,在【问答拆分】中执行问答对生成。
|
||||
* **索引模型**:用于向量化,即通过对文本数据进行处理和组织,构建出一个能够快速查询的数据结构。
|
||||
|
||||
## 知识库支持Excel类文件的导入
|
||||
|
||||
xlsx等都可以上传的,不止支持CSV。
|
||||
|
||||
## 知识库tokens的计算方式
|
||||
|
||||
统一按gpt3.5标准。
|
||||
|
||||
## 误删除重排模型后,重排模型怎么加入到fastgpt
|
||||
|
||||

|
||||
|
||||
config.json文件里面配置后就可以勾选重排模型
|
||||
|
||||
## 线上平台上创建了应用和知识库,到期之后如果短期内不续费,数据是否会被清理。
|
||||
|
||||
免费版是三十天不登录后清空知识库,应用不会动。其他付费套餐到期后自动切免费版。
|
||||

|
||||
|
||||
## 基于知识库的查询,但是问题相关的答案过多。ai回答到一半就不继续回答。
|
||||
|
||||
FastGPT回复长度计算公式:
|
||||
@@ -37,7 +56,7 @@ FastGPT回复长度计算公式:
|
||||
|
||||

|
||||
|
||||
1. 私有化部署的时候,后台配模型参数,可以在配置最大上文时候,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出
|
||||
另外私有化部署的时候,后台配模型参数,可以在配置最大上文时,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出
|
||||
|
||||
|
||||
## 受到模型上下文的限制,有时候达不到聊天记录的轮次,连续对话字数过多就会报上下文不够的错误。
|
||||
@@ -61,4 +80,4 @@ FastGPT回复长度计算公式:
|
||||
|
||||

|
||||
|
||||
1. 私有化部署的时候,后台配模型参数,可以在配置最大上文时候,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出
|
||||
另外,私有化部署的时候,后台配模型参数,可以在配置最大上文时,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出。
|
||||
@@ -8,4 +8,8 @@ weight: 918
|
||||
|
||||
## oneapi 官网是哪个
|
||||
|
||||
只有开源的 README,没官网,GitHub: https://github.com/songquanpeng/one-api
|
||||
只有开源的 README,没官网,GitHub: https://github.com/songquanpeng/one-api
|
||||
|
||||
## 想做多用户
|
||||
|
||||
开源版未支持多用户,仅商业版支持。
|
||||
@@ -22,10 +22,11 @@ FastGPT v4.8.16 版本开始,商业版用户支持飞书知识库导入,用
|
||||
|
||||
## 2. 配置应用权限
|
||||
|
||||
创建应用后,进入应用可以配置相关权限,这里需要增加两个权限:
|
||||
创建应用后,进入应用可以配置相关权限,这里需要增加**3个权限**:
|
||||
|
||||
1. 获取云空间文件夹下的云文档清单
|
||||
2. 查看新版文档
|
||||
3. 查看、评论、编辑和管理云空间中所有文件
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "循环执行"
|
||||
description: "FastGPT 循环运行节点介绍和使用"
|
||||
title: "批量运行"
|
||||
description: "FastGPT 批量运行节点介绍和使用"
|
||||
icon: "input"
|
||||
draft: false
|
||||
toc: true
|
||||
@@ -9,15 +9,15 @@ weight: 260
|
||||
|
||||
## 节点概述
|
||||
|
||||
【**循环运行**】节点是 FastGPT V4.8.11 版本新增的一个重要功能模块。它允许工作流对数组类型的输入数据进行迭代处理,每次处理数组中的一个元素,并自动执行后续节点,直到完成整个数组的处理。
|
||||
【**批量运行**】节点是 FastGPT V4.8.11 版本新增的一个重要功能模块。它允许工作流对数组类型的输入数据进行迭代处理,每次处理数组中的一个元素,并自动执行后续节点,直到完成整个数组的处理。
|
||||
|
||||
这个节点的设计灵感来自编程语言中的循环结构,但以可视化的方式呈现。
|
||||
|
||||

|
||||

|
||||
|
||||
> 在程序中,节点可以理解为一个个 Function 或者接口。可以理解为它就是一个**步骤**。将多个节点一个个拼接起来,即可一步步的去实现最终的 AI 输出。
|
||||
|
||||
【**循环运行**】节点本质上也是一个 Function,它的主要职责是自动化地重复执行特定的工作流程。
|
||||
【**批量运行**】节点本质上也是一个 Function,它的主要职责是自动化地重复执行特定的工作流程。
|
||||
|
||||
## 核心特性
|
||||
|
||||
@@ -41,9 +41,9 @@ weight: 260
|
||||
|
||||
## 应用场景
|
||||
|
||||
【**循环运行**】节点的主要作用是通过自动化的方式扩展工作流的处理能力,使 FastGPT 能够更好地处理批量任务和复杂的数据处理流程。特别是在处理大规模数据或需要多轮迭代的场景下,循环运行节点能显著提升工作流的效率和自动化程度。
|
||||
【**批量运行**】节点的主要作用是通过自动化的方式扩展工作流的处理能力,使 FastGPT 能够更好地处理批量任务和复杂的数据处理流程。特别是在处理大规模数据或需要多轮迭代的场景下,批量运行节点能显著提升工作流的效率和自动化程度。
|
||||
|
||||
【**循环运行**】节点特别适合以下场景:
|
||||
【**批量运行**】节点特别适合以下场景:
|
||||
|
||||
1. **批量数据处理**
|
||||
- 批量翻译文本
|
||||
@@ -64,7 +64,7 @@ weight: 260
|
||||
|
||||
### 输入参数设置
|
||||
|
||||
【**循环运行**】节点需要配置两个核心输入参数:
|
||||
【**批量运行**】节点需要配置两个核心输入参数:
|
||||
|
||||
1. **数组 (必填)**:接收一个数组类型的输入,可以是:
|
||||
- 字符串数组 (`Array<string>`)
|
||||
@@ -95,7 +95,7 @@ weight: 260
|
||||
|
||||
### 批量处理数组
|
||||
|
||||
假设我们有一个包含多个文本的数组,需要对每个文本进行 AI 处理。这是循环运行节点最基础也最常见的应用场景。
|
||||
假设我们有一个包含多个文本的数组,需要对每个文本进行 AI 处理。这是批量运行节点最基础也最常见的应用场景。
|
||||
|
||||
#### 实现步骤
|
||||
|
||||
@@ -114,9 +114,9 @@ weight: 260
|
||||
return { textArray: texts };
|
||||
```
|
||||
|
||||
2. 配置循环运行节点
|
||||
2. 配置批量运行节点
|
||||
|
||||

|
||||

|
||||
|
||||
- 数组输入:选择上一步代码运行节点的输出变量 `textArray`。
|
||||
- 循环体内添加一个【AI 对话】节点,用于处理每个文本。这里我们输入的 prompt 为:`请将这段文本翻译成英文`。
|
||||
@@ -128,7 +128,7 @@ weight: 260
|
||||

|
||||
|
||||
1. 【代码运行】节点执行,生成测试数组
|
||||
2. 【循环运行】节点接收数组,开始遍历
|
||||
2. 【批量运行】节点接收数组,开始遍历
|
||||
3. 对每个数组元素:
|
||||
- 【AI 对话】节点处理当前元素
|
||||
- 【指定回复】节点输出翻译后的文本
|
||||
@@ -144,7 +144,7 @@ weight: 260
|
||||
- 需要维护上下文的连贯性
|
||||
- 翻译质量需要多轮优化
|
||||
|
||||
【**循环运行**】节点可以很好地解决这些问题。
|
||||
【**批量运行**】节点可以很好地解决这些问题。
|
||||
|
||||
#### 实现步骤
|
||||
|
||||
@@ -281,9 +281,9 @@ weight: 260
|
||||
|
||||
这里我们用到了 [Jina AI 开源的一个强大的正则表达式](https://x.com/JinaAI_/status/1823756993108304135),它能利用所有可能的边界线索和启发式方法来精确切分文本。
|
||||
|
||||
2. 配置循环运行节点
|
||||
2. 配置批量运行节点
|
||||
|
||||

|
||||

|
||||
|
||||
- 数组输入:选择上一步代码运行节点的输出变量 `chunks`。
|
||||
- 循环体内添加一个【代码运行】节点,对源文本进行格式化。
|
||||
|
||||
@@ -212,7 +212,7 @@ export default async function (ctx: FunctionContext): Promise<IResponse>{
|
||||
|
||||

|
||||
|
||||
## 循环执行
|
||||
## 批量运行
|
||||
|
||||
长文反思翻译比较关键的一个部分,就是对多个文本块进行循环反思翻译
|
||||
|
||||
|
||||
@@ -91,9 +91,9 @@ weight: 604
|
||||
|
||||
这个过程不仅提高了效率,还最大限度地减少了人为错误的可能性。
|
||||
|
||||
## 循环执行
|
||||
## 批量运行
|
||||
|
||||
为了处理整个长字幕文件,我们需要一个循环执行机制。这是通过一个简单但有效的判断模块实现的:
|
||||
为了处理整个长字幕文件,我们需要一个批量运行机制。这是通过一个简单但有效的判断模块实现的:
|
||||
|
||||
1. 检查当前翻译的文本块是否为最后一个。
|
||||
2. 如果不是,则将工作流重定向到格式化原文本块节点。
|
||||
|
||||
@@ -40,7 +40,7 @@ export type FastGPTConfigFileType = {
|
||||
|
||||
export type FastGPTFeConfigsType = {
|
||||
show_emptyChat?: boolean;
|
||||
register_method?: ['email' | 'phone'];
|
||||
register_method?: ['email' | 'phone' | 'sync'];
|
||||
login_method?: ['email' | 'phone']; // Attention: login method is diffrent with oauth
|
||||
find_password_method?: ['email' | 'phone'];
|
||||
bind_notification_method?: ['email' | 'phone'];
|
||||
@@ -76,7 +76,6 @@ export type FastGPTFeConfigsType = {
|
||||
wecom?: {
|
||||
corpid?: string;
|
||||
agentid?: string;
|
||||
secret?: string;
|
||||
};
|
||||
microsoft?: {
|
||||
clientId?: string;
|
||||
|
||||
@@ -23,6 +23,8 @@ export type ModelProviderIdType =
|
||||
| 'Ollama'
|
||||
| 'BAAI'
|
||||
| 'FishAudio'
|
||||
| 'Intern'
|
||||
| 'Moka'
|
||||
| 'Other';
|
||||
|
||||
export type ModelProviderType = {
|
||||
@@ -143,6 +145,16 @@ export const ModelProviderList: ModelProviderType[] = [
|
||||
name: 'FishAudio',
|
||||
avatar: 'model/fishaudio'
|
||||
},
|
||||
{
|
||||
id: 'Intern',
|
||||
name: i18nT('common:model_intern'),
|
||||
avatar: 'model/intern'
|
||||
},
|
||||
{
|
||||
id: 'Moka',
|
||||
name: i18nT('common:model_moka'),
|
||||
avatar: 'model/moka'
|
||||
},
|
||||
{
|
||||
id: 'Other',
|
||||
name: i18nT('common:model_other'),
|
||||
|
||||
@@ -33,7 +33,7 @@ export const defaultWhisperConfig: AppWhisperConfigType = {
|
||||
export const defaultQGConfig: AppQGConfigType = {
|
||||
open: false,
|
||||
model: 'gpt-4o-mini',
|
||||
customPrompt: PROMPT_QUESTION_GUIDE
|
||||
customPrompt: ''
|
||||
};
|
||||
|
||||
export const defaultChatInputGuideConfig = {
|
||||
|
||||
4
packages/global/core/app/type.d.ts
vendored
@@ -12,8 +12,9 @@ import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/use
|
||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||
import { AppPermission } from '../../support/permission/app/controller';
|
||||
import { ParentIdType } from '../../common/parentFolder/type';
|
||||
import { FlowNodeInputTypeEnum } from 'core/workflow/node/constant';
|
||||
import { FlowNodeInputTypeEnum } from '../../core/workflow/node/constant';
|
||||
import { WorkflowTemplateBasicType } from '@fastgpt/global/core/workflow/type';
|
||||
import { SourceMemberType } from '../../support/user/type';
|
||||
|
||||
export type AppSchema = {
|
||||
_id: string;
|
||||
@@ -63,6 +64,7 @@ export type AppListItemType = {
|
||||
permission: AppPermission;
|
||||
inheritPermission?: boolean;
|
||||
private?: boolean;
|
||||
sourceMember: SourceMemberType;
|
||||
};
|
||||
|
||||
export type AppDetailType = AppSchema & {
|
||||
|
||||
3
packages/global/core/app/version.d.ts
vendored
@@ -1,5 +1,7 @@
|
||||
import { TeamMemberStatusEnum } from 'support/user/team/constant';
|
||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||
import { AppChatConfigType, AppSchema } from './type';
|
||||
import { SourceMemberType } from 'support/user/type';
|
||||
|
||||
export type AppVersionSchemaType = {
|
||||
_id: string;
|
||||
@@ -20,4 +22,5 @@ export type VersionListItemType = {
|
||||
time: Date;
|
||||
isPublish: boolean | undefined;
|
||||
tmbId: string;
|
||||
sourceMember: SourceMemberType;
|
||||
};
|
||||
|
||||
1
packages/global/core/dataset/apiDataset.d.ts
vendored
@@ -5,6 +5,7 @@ export type APIFileItem = {
|
||||
type: 'file' | 'folder';
|
||||
updateTime: Date;
|
||||
createTime: Date;
|
||||
hasChild?: boolean;
|
||||
};
|
||||
|
||||
export type APIFileServer = {
|
||||
|
||||
2
packages/global/core/dataset/type.d.ts
vendored
@@ -11,6 +11,7 @@ import {
|
||||
import { DatasetPermission } from '../../support/permission/dataset/controller';
|
||||
import { Permission } from '../../support/permission/controller';
|
||||
import { APIFileServer, FeishuServer, YuqueServer } from './apiDataset';
|
||||
import { SourceMemberType } from 'support/user/type';
|
||||
|
||||
export type DatasetSchemaType = {
|
||||
_id: string;
|
||||
@@ -165,6 +166,7 @@ export type DatasetListItemType = {
|
||||
vectorModel: VectorModelItemType;
|
||||
inheritPermission: boolean;
|
||||
private?: boolean;
|
||||
sourceMember?: SourceMemberType;
|
||||
};
|
||||
|
||||
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
|
||||
|
||||
@@ -34,7 +34,7 @@ export function getSourceNameIcon({
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
return 'file/fill/manual';
|
||||
return 'file/fill/file';
|
||||
}
|
||||
|
||||
/* get dataset data default index */
|
||||
|
||||
@@ -152,6 +152,7 @@ export enum NodeInputKeyEnum {
|
||||
datasetSearchExtensionModel = 'datasetSearchExtensionModel',
|
||||
datasetSearchExtensionBg = 'datasetSearchExtensionBg',
|
||||
collectionFilterMatch = 'collectionFilterMatch',
|
||||
authTmbId = 'authTmbId',
|
||||
|
||||
// concat dataset
|
||||
datasetQuoteList = 'system_datasetQuoteList',
|
||||
|
||||
@@ -41,6 +41,10 @@ export type ChatDispatchProps = {
|
||||
teamId: string;
|
||||
tmbId: string; // App tmbId
|
||||
};
|
||||
runningUserInfo: {
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
};
|
||||
uid: string; // Who run this workflow
|
||||
|
||||
chatId?: string;
|
||||
|
||||
@@ -89,6 +89,13 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.authTmbId,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
label: '',
|
||||
valueType: WorkflowIOValueTypeEnum.boolean,
|
||||
value: false
|
||||
},
|
||||
{
|
||||
...Input_Template_UserChatInput,
|
||||
toolDescription: i18nT('workflow:content_to_search')
|
||||
|
||||
1
packages/global/core/workflow/type/node.d.ts
vendored
@@ -89,6 +89,7 @@ export type NodeTemplateListItemType = {
|
||||
hasTokenFee?: boolean; // 是否配置积分
|
||||
instructions?: string; // 使用说明
|
||||
courseUrl?: string; // 教程链接
|
||||
sourceMember?: SourceMember;
|
||||
};
|
||||
|
||||
export type NodeTemplateListType = {
|
||||
|
||||
@@ -12,6 +12,7 @@ export type CreateTeamProps = {
|
||||
avatar?: string;
|
||||
defaultTeam?: boolean;
|
||||
memberName?: string;
|
||||
memberAvatar?: string;
|
||||
};
|
||||
export type UpdateTeamProps = Omit<ThirdPartyAccountType, 'externalWorkflowVariable'> & {
|
||||
name?: string;
|
||||
|
||||
@@ -5,8 +5,6 @@ export const OrgMemberCollectionName = 'team_org_members';
|
||||
|
||||
export const getOrgChildrenPath = (org: OrgSchemaType) => `${org.path}/${org.pathId}`;
|
||||
|
||||
// export enum OrgMemberRole {
|
||||
// owner = 'owner',
|
||||
// admin = 'admin',
|
||||
// member = 'member'
|
||||
// }
|
||||
export enum SyncOrgSourceEnum {
|
||||
wecom = 'wecom'
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ type OrgSchemaType = {
|
||||
};
|
||||
|
||||
type OrgMemberSchemaType = {
|
||||
_id: string;
|
||||
teamId: string;
|
||||
orgId: string;
|
||||
tmbId: string;
|
||||
@@ -20,6 +21,6 @@ type OrgMemberSchemaType = {
|
||||
|
||||
type OrgType = Omit<OrgSchemaType, 'avatar'> & {
|
||||
avatar: string;
|
||||
members: OrgMemberSchemaType[];
|
||||
permission: TeamPermission;
|
||||
members: OrgMemberSchemaType[];
|
||||
};
|
||||
|
||||
1
packages/global/support/user/team/type.d.ts
vendored
@@ -44,6 +44,7 @@ export type TeamMemberSchema = {
|
||||
name: string;
|
||||
role: `${TeamMemberRoleEnum}`;
|
||||
status: `${TeamMemberStatusEnum}`;
|
||||
avatar: string;
|
||||
defaultTeam: boolean;
|
||||
};
|
||||
|
||||
|
||||
10
packages/global/support/user/type.d.ts
vendored
@@ -1,12 +1,12 @@
|
||||
import { TeamPermission } from '../permission/user/controller';
|
||||
import { UserStatusEnum } from './constant';
|
||||
import { TeamMemberStatusEnum } from './team/constant';
|
||||
import { TeamTmbItemType } from './team/type';
|
||||
|
||||
export type UserModelSchema = {
|
||||
_id: string;
|
||||
username: string;
|
||||
password: string;
|
||||
avatar: string;
|
||||
promotionRate: number;
|
||||
inviterId?: string;
|
||||
openaiKey: string;
|
||||
@@ -22,7 +22,7 @@ export type UserModelSchema = {
|
||||
export type UserType = {
|
||||
_id: string;
|
||||
username: string;
|
||||
avatar: string;
|
||||
avatar: string; // it should be team member's avatar after 4.8.18
|
||||
timezone: string;
|
||||
promotionRate: UserModelSchema['promotionRate'];
|
||||
team: TeamTmbItemType;
|
||||
@@ -30,3 +30,9 @@ export type UserType = {
|
||||
notificationAccount?: string;
|
||||
permission: TeamPermission;
|
||||
};
|
||||
|
||||
export type SourceMemberType = {
|
||||
name: string;
|
||||
avatar: string;
|
||||
status: `${TeamMemberStatusEnum}`;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,8 @@ const staticPluginList = [
|
||||
'DingTalkWebhook',
|
||||
'WeWorkWebhook',
|
||||
'google',
|
||||
'bing'
|
||||
'bing',
|
||||
'delay'
|
||||
];
|
||||
// Run in worker thread (Have npm packages)
|
||||
const packagePluginList = [
|
||||
|
||||
18
packages/plugins/src/delay/index.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { delay } from '@fastgpt/global/common/system/utils';
|
||||
|
||||
type Props = {
|
||||
ms: number;
|
||||
};
|
||||
type Response = Promise<Number>;
|
||||
|
||||
const main = async ({ ms }: Props): Response => {
|
||||
if (typeof ms !== 'number' || ms <= 0 || ms > 300000) {
|
||||
return ms;
|
||||
}
|
||||
|
||||
await delay(ms);
|
||||
|
||||
return ms;
|
||||
};
|
||||
|
||||
export default main;
|
||||
318
packages/plugins/src/delay/template.json
Normal file
@@ -0,0 +1,318 @@
|
||||
{
|
||||
"author": "collin",
|
||||
"version": "4817",
|
||||
"name": "流程等待",
|
||||
"avatar": "core/workflow/template/sleep",
|
||||
"intro": "让工作流等待指定时间后运行",
|
||||
"showStatus": true,
|
||||
"weight": 1,
|
||||
|
||||
"isTool": true,
|
||||
"templateType": "tools",
|
||||
|
||||
"workflow": {
|
||||
"nodes": [
|
||||
{
|
||||
"nodeId": "pluginInput",
|
||||
"name": "workflow:template.plugin_start",
|
||||
"intro": "workflow:intro_plugin_input",
|
||||
"avatar": "core/workflow/template/workflowStart",
|
||||
"flowNodeType": "pluginInput",
|
||||
"showStatus": false,
|
||||
"position": {
|
||||
"x": 627.6352390819724,
|
||||
"y": -165.05298493910118
|
||||
},
|
||||
"version": "481",
|
||||
"inputs": [
|
||||
{
|
||||
"renderTypeList": ["numberInput", "reference"],
|
||||
"selectedTypeIndex": 0,
|
||||
"valueType": "number",
|
||||
"canEdit": true,
|
||||
"key": "延迟时长",
|
||||
"label": "延迟时长",
|
||||
"description": "需要暂停的时间,单位毫秒",
|
||||
"defaultValue": 1000,
|
||||
"list": [
|
||||
{
|
||||
"label": "",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"maxFiles": 5,
|
||||
"canSelectFile": true,
|
||||
"canSelectImg": true,
|
||||
"required": true,
|
||||
"toolDescription": "需要暂停的时间,单位毫秒",
|
||||
"max": 300000,
|
||||
"min": 1
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"id": "ms",
|
||||
"valueType": "number",
|
||||
"key": "延迟时长",
|
||||
"label": "延迟时长",
|
||||
"type": "hidden"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"nodeId": "pluginOutput",
|
||||
"name": "common:core.module.template.self_output",
|
||||
"intro": "workflow:intro_custom_plugin_output",
|
||||
"avatar": "core/workflow/template/pluginOutput",
|
||||
"flowNodeType": "pluginOutput",
|
||||
"showStatus": false,
|
||||
"position": {
|
||||
"x": 1921.839722563351,
|
||||
"y": -160.05298493910115
|
||||
},
|
||||
"version": "481",
|
||||
"inputs": [
|
||||
{
|
||||
"renderTypeList": ["reference"],
|
||||
"valueType": "any",
|
||||
"canEdit": true,
|
||||
"key": "result",
|
||||
"label": "result",
|
||||
"isToolOutput": true,
|
||||
"description": "",
|
||||
"required": true,
|
||||
"value": ["zCJC6zw7c14i", "httpRawResponse"]
|
||||
}
|
||||
],
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"nodeId": "pluginConfig",
|
||||
"name": "common:core.module.template.system_config",
|
||||
"intro": "",
|
||||
"avatar": "core/workflow/template/systemConfig",
|
||||
"flowNodeType": "pluginConfig",
|
||||
"position": {
|
||||
"x": 184.66337662472682,
|
||||
"y": -216.05298493910115
|
||||
},
|
||||
"version": "4811",
|
||||
"inputs": [],
|
||||
"outputs": []
|
||||
},
|
||||
{
|
||||
"nodeId": "zCJC6zw7c14i",
|
||||
"name": "HTTP 请求",
|
||||
"intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
|
||||
"avatar": "core/workflow/template/httpRequest",
|
||||
"flowNodeType": "httpRequest468",
|
||||
"showStatus": true,
|
||||
"position": {
|
||||
"x": 1154.4041630064592,
|
||||
"y": -455.0529849391012
|
||||
},
|
||||
"version": "481",
|
||||
"inputs": [
|
||||
{
|
||||
"key": "system_addInputParam",
|
||||
"renderTypeList": ["addInputParam"],
|
||||
"valueType": "dynamic",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"description": "common:core.module.input.description.HTTP Dynamic Input",
|
||||
"customInputConfig": {
|
||||
"selectValueTypeList": [
|
||||
"string",
|
||||
"number",
|
||||
"boolean",
|
||||
"object",
|
||||
"arrayString",
|
||||
"arrayNumber",
|
||||
"arrayBoolean",
|
||||
"arrayObject",
|
||||
"arrayAny",
|
||||
"any",
|
||||
"chatHistory",
|
||||
"datasetQuote",
|
||||
"dynamic",
|
||||
"selectApp",
|
||||
"selectDataset"
|
||||
],
|
||||
"showDescription": false,
|
||||
"showDefaultValue": true
|
||||
},
|
||||
"valueDesc": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpMethod",
|
||||
"renderTypeList": ["custom"],
|
||||
"valueType": "string",
|
||||
"label": "",
|
||||
"value": "POST",
|
||||
"required": true,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpTimeout",
|
||||
"renderTypeList": ["custom"],
|
||||
"valueType": "number",
|
||||
"label": "",
|
||||
"value": 30,
|
||||
"min": 5,
|
||||
"max": 600,
|
||||
"required": true,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpReqUrl",
|
||||
"renderTypeList": ["hidden"],
|
||||
"valueType": "string",
|
||||
"label": "",
|
||||
"description": "common:core.module.input.description.Http Request Url",
|
||||
"placeholder": "https://api.ai.com/getInventory",
|
||||
"required": false,
|
||||
"value": "delay",
|
||||
"valueDesc": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpHeader",
|
||||
"renderTypeList": ["custom"],
|
||||
"valueType": "any",
|
||||
"value": [],
|
||||
"label": "",
|
||||
"description": "common:core.module.input.description.Http Request Header",
|
||||
"placeholder": "common:core.module.input.description.Http Request Header",
|
||||
"required": false,
|
||||
"valueDesc": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpParams",
|
||||
"renderTypeList": ["hidden"],
|
||||
"valueType": "any",
|
||||
"value": [],
|
||||
"label": "",
|
||||
"required": false,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpJsonBody",
|
||||
"renderTypeList": ["hidden"],
|
||||
"valueType": "any",
|
||||
"value": "{\n\"ms\": {{$pluginInput.ms$}}\n}",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpFormBody",
|
||||
"renderTypeList": ["hidden"],
|
||||
"valueType": "any",
|
||||
"value": [],
|
||||
"label": "",
|
||||
"required": false,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
},
|
||||
{
|
||||
"key": "system_httpContentType",
|
||||
"renderTypeList": ["hidden"],
|
||||
"valueType": "string",
|
||||
"value": "json",
|
||||
"label": "",
|
||||
"required": false,
|
||||
"valueDesc": "",
|
||||
"description": "",
|
||||
"debugLabel": "",
|
||||
"toolDescription": ""
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"id": "error",
|
||||
"key": "error",
|
||||
"label": "workflow:request_error",
|
||||
"description": "HTTP请求错误信息,成功时返回空",
|
||||
"valueType": "object",
|
||||
"type": "static"
|
||||
},
|
||||
{
|
||||
"id": "httpRawResponse",
|
||||
"key": "httpRawResponse",
|
||||
"required": true,
|
||||
"label": "workflow:raw_response",
|
||||
"description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
|
||||
"valueType": "any",
|
||||
"type": "static"
|
||||
},
|
||||
{
|
||||
"id": "system_addOutputParam",
|
||||
"key": "system_addOutputParam",
|
||||
"type": "dynamic",
|
||||
"valueType": "dynamic",
|
||||
"label": "输出字段提取",
|
||||
"customFieldConfig": {
|
||||
"selectValueTypeList": [
|
||||
"string",
|
||||
"number",
|
||||
"boolean",
|
||||
"object",
|
||||
"arrayString",
|
||||
"arrayNumber",
|
||||
"arrayBoolean",
|
||||
"arrayObject",
|
||||
"arrayAny",
|
||||
"any",
|
||||
"chatHistory",
|
||||
"datasetQuote",
|
||||
"dynamic",
|
||||
"selectApp",
|
||||
"selectDataset"
|
||||
],
|
||||
"showDescription": false,
|
||||
"showDefaultValue": false
|
||||
},
|
||||
"description": "可以通过 JSONPath 语法来提取响应值中的指定字段",
|
||||
"valueDesc": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"source": "pluginInput",
|
||||
"target": "zCJC6zw7c14i",
|
||||
"sourceHandle": "pluginInput-source-right",
|
||||
"targetHandle": "zCJC6zw7c14i-target-left"
|
||||
},
|
||||
{
|
||||
"source": "zCJC6zw7c14i",
|
||||
"target": "pluginOutput",
|
||||
"sourceHandle": "zCJC6zw7c14i-source-right",
|
||||
"targetHandle": "pluginOutput-target-left"
|
||||
}
|
||||
],
|
||||
"chatConfig": {
|
||||
"welcomeText": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
21
packages/service/common/api/pagination.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
||||
import { ApiRequestProps } from '../../type/next';
|
||||
|
||||
export function parsePaginationRequest(req: ApiRequestProps) {
|
||||
const {
|
||||
pageSize = 10,
|
||||
pageNum = 1,
|
||||
offset = 0
|
||||
} = Object.keys(req.body).includes('pageSize')
|
||||
? req.body
|
||||
: Object.keys(req.query).includes('pageSize')
|
||||
? req.query
|
||||
: {};
|
||||
if (!pageSize || (pageNum === undefined && offset === undefined)) {
|
||||
throw new Error(CommonErrEnum.missingParams);
|
||||
}
|
||||
return {
|
||||
pageSize: Number(pageSize),
|
||||
offset: offset ? Number(offset) : (Number(pageNum) - 1) * Number(pageSize)
|
||||
};
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import type { NextApiResponse, NextApiRequest } from 'next';
|
||||
import NextCors from 'nextjs-cors';
|
||||
|
||||
export async function withNextCors(req: NextApiRequest, res: NextApiResponse) {
|
||||
const methods = ['GET', 'eHEAD', 'PUT', 'PATCH', 'POST', 'DELETE'];
|
||||
const methods = ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'];
|
||||
|
||||
const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(',');
|
||||
const origin = req.headers.origin;
|
||||
|
||||
@@ -99,7 +99,13 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
|
||||
if (files.some((file) => !file.id || !file.name || typeof file.type === 'undefined')) {
|
||||
return Promise.reject('Invalid file data format');
|
||||
}
|
||||
return files;
|
||||
|
||||
const formattedFiles = files.map((file) => ({
|
||||
...file,
|
||||
hasChild: file.type === 'folder'
|
||||
}));
|
||||
|
||||
return formattedFiles;
|
||||
};
|
||||
|
||||
const getFileContent = async ({ teamId, apiFileId }: { teamId: string; apiFileId: string }) => {
|
||||
|
||||
@@ -284,7 +284,7 @@ export async function searchDatasetData(props: SearchDatasetDataProps) {
|
||||
{
|
||||
_id: { $in: collectionIdList }
|
||||
},
|
||||
'_id name fileId rawLink externalFileId externalFileUrl',
|
||||
'_id name fileId rawLink apiFileId externalFileId externalFileUrl',
|
||||
{ ...readFromSecondary }
|
||||
).lean()
|
||||
]);
|
||||
@@ -525,7 +525,7 @@ export async function searchDatasetData(props: SearchDatasetDataProps) {
|
||||
{
|
||||
_id: { $in: searchResults.map((item) => item.collectionId) }
|
||||
},
|
||||
'_id name fileId rawLink externalFileId externalFileUrl',
|
||||
'_id name fileId rawLink apiFileId externalFileId externalFileUrl',
|
||||
{ ...readFromSecondary }
|
||||
).lean()
|
||||
]);
|
||||
|
||||
39
packages/service/core/dataset/utils.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { getTmbInfoByTmbId } from '../../support/user/team/controller';
|
||||
import { getResourcePermission } from '../../support/permission/controller';
|
||||
import { PerResourceTypeEnum } from '@fastgpt/global/support/permission/constant';
|
||||
import { DatasetPermission } from '@fastgpt/global/support/permission/dataset/controller';
|
||||
|
||||
// TODO: 需要优化成批量获取权限
|
||||
export const filterDatasetsByTmbId = async ({
|
||||
datasetIds,
|
||||
tmbId
|
||||
}: {
|
||||
datasetIds: string[];
|
||||
tmbId: string;
|
||||
}) => {
|
||||
const { teamId, permission: tmbPer } = await getTmbInfoByTmbId({ tmbId });
|
||||
|
||||
// First get all permissions
|
||||
const permissions = await Promise.all(
|
||||
datasetIds.map(async (datasetId) => {
|
||||
const per = await getResourcePermission({
|
||||
teamId,
|
||||
tmbId,
|
||||
resourceId: datasetId,
|
||||
resourceType: PerResourceTypeEnum.dataset
|
||||
});
|
||||
|
||||
if (per === undefined) return false;
|
||||
|
||||
const datasetPer = new DatasetPermission({
|
||||
per,
|
||||
isOwner: tmbPer.isOwner
|
||||
});
|
||||
|
||||
return datasetPer.hasReadPer;
|
||||
})
|
||||
);
|
||||
|
||||
// Then filter datasetIds based on permissions
|
||||
return datasetIds.filter((_, index) => permissions[index]);
|
||||
};
|
||||
@@ -17,6 +17,7 @@ import { ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import { checkTeamReRankPermission } from '../../../../support/permission/teamLimit';
|
||||
import { MongoDataset } from '../../../dataset/schema';
|
||||
import { i18nT } from '../../../../../web/i18n/utils';
|
||||
import { filterDatasetsByTmbId } from '../../../dataset/utils';
|
||||
|
||||
type DatasetSearchProps = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.datasetSelectList]: SelectedDatasetType;
|
||||
@@ -29,6 +30,7 @@ type DatasetSearchProps = ModuleDispatchProps<{
|
||||
[NodeInputKeyEnum.datasetSearchExtensionModel]: string;
|
||||
[NodeInputKeyEnum.datasetSearchExtensionBg]: string;
|
||||
[NodeInputKeyEnum.collectionFilterMatch]: string;
|
||||
[NodeInputKeyEnum.authTmbId]: boolean;
|
||||
}>;
|
||||
export type DatasetSearchResponse = DispatchNodeResultType<{
|
||||
[NodeOutputKeyEnum.datasetQuoteQA]: SearchDataResponseItemType[];
|
||||
@@ -39,6 +41,7 @@ export async function dispatchDatasetSearch(
|
||||
): Promise<DatasetSearchResponse> {
|
||||
const {
|
||||
runningAppInfo: { teamId },
|
||||
runningUserInfo: { tmbId },
|
||||
histories,
|
||||
node,
|
||||
params: {
|
||||
@@ -52,7 +55,8 @@ export async function dispatchDatasetSearch(
|
||||
datasetSearchUsingExtensionQuery,
|
||||
datasetSearchExtensionModel,
|
||||
datasetSearchExtensionBg,
|
||||
collectionFilterMatch
|
||||
collectionFilterMatch,
|
||||
authTmbId = false
|
||||
}
|
||||
} = props as DatasetSearchProps;
|
||||
|
||||
@@ -64,18 +68,20 @@ export async function dispatchDatasetSearch(
|
||||
return Promise.reject(i18nT('common:core.chat.error.Select dataset empty'));
|
||||
}
|
||||
|
||||
const emptyResult = {
|
||||
quoteQA: [],
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: 0,
|
||||
query: '',
|
||||
limit,
|
||||
searchMode
|
||||
},
|
||||
nodeDispatchUsages: [],
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: []
|
||||
};
|
||||
|
||||
if (!userChatInput) {
|
||||
return {
|
||||
quoteQA: [],
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: 0,
|
||||
query: '',
|
||||
limit,
|
||||
searchMode
|
||||
},
|
||||
nodeDispatchUsages: [],
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: []
|
||||
};
|
||||
return emptyResult;
|
||||
}
|
||||
|
||||
// query extension
|
||||
@@ -83,13 +89,24 @@ export async function dispatchDatasetSearch(
|
||||
? getLLMModel(datasetSearchExtensionModel)
|
||||
: undefined;
|
||||
|
||||
const { concatQueries, rewriteQuery, aiExtensionResult } = await datasetSearchQueryExtension({
|
||||
query: userChatInput,
|
||||
extensionModel,
|
||||
extensionBg: datasetSearchExtensionBg,
|
||||
histories: getHistories(6, histories)
|
||||
});
|
||||
const [{ concatQueries, rewriteQuery, aiExtensionResult }, datasetIds] = await Promise.all([
|
||||
datasetSearchQueryExtension({
|
||||
query: userChatInput,
|
||||
extensionModel,
|
||||
extensionBg: datasetSearchExtensionBg,
|
||||
histories: getHistories(6, histories)
|
||||
}),
|
||||
authTmbId
|
||||
? filterDatasetsByTmbId({
|
||||
datasetIds: datasets.map((item) => item.datasetId),
|
||||
tmbId
|
||||
})
|
||||
: Promise.resolve(datasets.map((item) => item.datasetId))
|
||||
]);
|
||||
|
||||
if (datasetIds.length === 0) {
|
||||
return emptyResult;
|
||||
}
|
||||
// console.log(concatQueries, rewriteQuery, aiExtensionResult);
|
||||
|
||||
// get vector
|
||||
@@ -110,7 +127,7 @@ export async function dispatchDatasetSearch(
|
||||
model: vectorModel.model,
|
||||
similarity,
|
||||
limit,
|
||||
datasetIds: datasets.map((item) => item.datasetId),
|
||||
datasetIds,
|
||||
searchMode,
|
||||
usingReRank: usingReRank && (await checkTeamReRankPermission(teamId)),
|
||||
collectionFilterMatch
|
||||
|
||||
@@ -72,6 +72,7 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
|
||||
showStatus: false
|
||||
};
|
||||
});
|
||||
|
||||
const runtimeVariables = {
|
||||
...filterSystemVariables(props.variables),
|
||||
appId: String(plugin.id)
|
||||
|
||||
@@ -100,10 +100,9 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
||||
const concatVariables = {
|
||||
...variables,
|
||||
...body,
|
||||
// ...dynamicInput,
|
||||
...systemVariables
|
||||
};
|
||||
const allVariables = {
|
||||
const allVariables: Record<string, any> = {
|
||||
[NodeInputKeyEnum.addInputParam]: concatVariables,
|
||||
...concatVariables
|
||||
};
|
||||
@@ -128,26 +127,25 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
||||
if (typeof val === 'object') return JSON.stringify(val);
|
||||
|
||||
if (typeof val === 'string') {
|
||||
const str = JSON.stringify(val);
|
||||
return str.startsWith('"') && str.endsWith('"') ? str.slice(1, -1) : str;
|
||||
try {
|
||||
const parsed = JSON.parse(val);
|
||||
if (typeof parsed === 'object') {
|
||||
return JSON.stringify(parsed);
|
||||
}
|
||||
return val;
|
||||
} catch (error) {
|
||||
const str = JSON.stringify(val);
|
||||
return str.startsWith('"') && str.endsWith('"') ? str.slice(1, -1) : str;
|
||||
}
|
||||
}
|
||||
|
||||
return String(val);
|
||||
};
|
||||
|
||||
// 1. Replace {{key}} variables
|
||||
const regex1 = /{{([^}]+)}}/g;
|
||||
const matches1 = text.match(regex1) || [];
|
||||
const uniqueKeys1 = [...new Set(matches1.map((match) => match.slice(2, -2)))];
|
||||
for (const key of uniqueKeys1) {
|
||||
text = text.replace(new RegExp(`{{(${key})}}`, 'g'), () => valToStr(variables[key]));
|
||||
}
|
||||
|
||||
// 2. Replace {{key.key}} variables
|
||||
const regex2 = /\{\{\$([^.]+)\.([^$]+)\$\}\}/g;
|
||||
const matches2 = [...text.matchAll(regex2)];
|
||||
if (matches2.length === 0) return text;
|
||||
matches2.forEach((match) => {
|
||||
// 1. Replace {{key.key}} variables
|
||||
const regex1 = /\{\{\$([^.]+)\.([^$]+)\$\}\}/g;
|
||||
const matches1 = [...text.matchAll(regex1)];
|
||||
matches1.forEach((match) => {
|
||||
const nodeId = match[1];
|
||||
const id = match[2];
|
||||
|
||||
@@ -173,6 +171,14 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
||||
text = text.replace(regex, () => formatVal);
|
||||
});
|
||||
|
||||
// 2. Replace {{key}} variables
|
||||
const regex2 = /{{([^}]+)}}/g;
|
||||
const matches2 = text.match(regex2) || [];
|
||||
const uniqueKeys2 = [...new Set(matches2.map((match) => match.slice(2, -2)))];
|
||||
for (const key of uniqueKeys2) {
|
||||
text = text.replace(new RegExp(`{{(${key})}}`, 'g'), () => valToStr(allVariables[key]));
|
||||
}
|
||||
|
||||
return text.replace(/(".*?")\s*:\s*undefined\b/g, '$1: null');
|
||||
};
|
||||
|
||||
@@ -237,7 +243,9 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
|
||||
}
|
||||
if (!httpJsonBody) return {};
|
||||
if (httpContentType === ContentTypes.json) {
|
||||
return json5.parse(replaceJsonBodyString(httpJsonBody));
|
||||
httpJsonBody = replaceJsonBodyString(httpJsonBody);
|
||||
console.log(httpJsonBody);
|
||||
return json5.parse(httpJsonBody);
|
||||
}
|
||||
|
||||
// Raw text, xml
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
||||
import { MemberGroupSchemaType } from '@fastgpt/global/support/permission/memberGroup/type';
|
||||
import { TeamMemberSchema } from '@fastgpt/global/support/user/team/type';
|
||||
import { UserModelSchema } from '@fastgpt/global/support/user/type';
|
||||
import { OrgSchemaType } from '@fastgpt/global/support/user/team/org/type';
|
||||
import { getOrgIdSetWithParentByTmbId } from './org/controllers';
|
||||
|
||||
@@ -151,13 +150,9 @@ export const getClbsAndGroupsWithInfo = async ({
|
||||
$exists: true
|
||||
}
|
||||
})
|
||||
.populate<{ tmb: TeamMemberSchema & { user: UserModelSchema } }>({
|
||||
.populate<{ tmb: TeamMemberSchema }>({
|
||||
path: 'tmb',
|
||||
select: 'name userId role',
|
||||
populate: {
|
||||
path: 'user',
|
||||
select: 'avatar'
|
||||
}
|
||||
select: 'name userId avatar'
|
||||
})
|
||||
.lean(),
|
||||
MongoResourcePermission.find({
|
||||
|
||||
@@ -47,14 +47,11 @@ export const OrgSchema = new Schema(
|
||||
OrgSchema.virtual('members', {
|
||||
ref: OrgMemberCollectionName,
|
||||
localField: '_id',
|
||||
foreignField: 'orgId'
|
||||
foreignField: 'orgId',
|
||||
match: function (this: OrgSchemaType) {
|
||||
return { teamId: this.teamId };
|
||||
}
|
||||
});
|
||||
// OrgSchema.virtual('permission', {
|
||||
// ref: ResourcePermissionCollectionName,
|
||||
// localField: '_id',
|
||||
// foreignField: 'orgId',
|
||||
// justOne: true
|
||||
// });
|
||||
|
||||
try {
|
||||
OrgSchema.index({
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function getUserDetail({
|
||||
return {
|
||||
_id: user._id,
|
||||
username: user.username,
|
||||
avatar: user.avatar,
|
||||
avatar: tmb.avatar,
|
||||
timezone: user.timezone,
|
||||
promotionRate: user.promotionRate,
|
||||
team: tmb,
|
||||
|
||||
@@ -3,7 +3,6 @@ const { Schema } = connectionMongo;
|
||||
import { hashStr } from '@fastgpt/global/common/string/tools';
|
||||
import type { UserModelSchema } from '@fastgpt/global/support/user/type';
|
||||
import { UserStatusEnum, userStatusMap } from '@fastgpt/global/support/user/constant';
|
||||
import { getRandomUserAvatar } from '@fastgpt/global/support/user/utils';
|
||||
|
||||
export const userCollectionName = 'users';
|
||||
|
||||
@@ -33,11 +32,6 @@ const UserSchema = new Schema({
|
||||
type: Date,
|
||||
default: () => new Date()
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
default: () => getRandomUserAvatar()
|
||||
},
|
||||
|
||||
promotionRate: {
|
||||
type: Number,
|
||||
default: 15
|
||||
@@ -62,7 +56,10 @@ const UserSchema = new Schema({
|
||||
ref: userCollectionName
|
||||
},
|
||||
fastgpt_sem: Object,
|
||||
sourceDomain: String
|
||||
sourceDomain: String,
|
||||
|
||||
/** @deprecated */
|
||||
avatar: String
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -37,7 +37,7 @@ async function getTeamMember(match: Record<string, any>): Promise<TeamTmbItemTyp
|
||||
teamAvatar: tmb.team.avatar,
|
||||
teamName: tmb.team.name,
|
||||
memberName: tmb.name,
|
||||
avatar: tmb.team.avatar,
|
||||
avatar: tmb.avatar,
|
||||
balance: tmb.team.balance,
|
||||
tmbId: String(tmb._id),
|
||||
teamDomain: tmb.team?.teamDomain,
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
TeamMemberCollectionName,
|
||||
TeamCollectionName
|
||||
} from '@fastgpt/global/support/user/team/constant';
|
||||
import { getRandomUserAvatar } from '@fastgpt/global/support/user/utils';
|
||||
|
||||
const TeamMemberSchema = new Schema({
|
||||
teamId: {
|
||||
@@ -19,6 +20,10 @@ const TeamMemberSchema = new Schema({
|
||||
ref: userCollectionName,
|
||||
required: true
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
default: () => getRandomUserAvatar()
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: 'Member'
|
||||
@@ -39,7 +44,6 @@ const TeamMemberSchema = new Schema({
|
||||
// Abandoned
|
||||
role: {
|
||||
type: String
|
||||
// enum: Object.keys(TeamMemberRoleMap) // disable enum validation for old data
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { SourceMemberType } from '@fastgpt/global/support/user/type';
|
||||
import { MongoTeam } from './team/teamSchema';
|
||||
import { MongoTeamMember } from './team/teamMemberSchema';
|
||||
import { ClientSession } from '../../common/mongo';
|
||||
|
||||
/* export dataset limit */
|
||||
export const updateExportDatasetLimit = async (teamId: string) => {
|
||||
@@ -67,3 +70,41 @@ export const checkWebSyncLimit = async ({
|
||||
return Promise.reject(`每个团队,每 ${limitMinutes} 分钟仅使用一次同步功能。`);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This function will add a property named sourceMember to the list passed in.
|
||||
* @param list The list to add the sourceMember property to. [TmbId] property is required.
|
||||
* @error If member is not found, this item will be skipped.
|
||||
* @returns The list with the sourceMember property added.
|
||||
*/
|
||||
export async function addSourceMember<T extends { tmbId: string }>({
|
||||
list,
|
||||
session
|
||||
}: {
|
||||
list: T[];
|
||||
session?: ClientSession;
|
||||
}): Promise<Array<T & { sourceMember: SourceMemberType }>> {
|
||||
if (!Array.isArray(list)) return [];
|
||||
|
||||
const tmbList = await MongoTeamMember.find(
|
||||
{
|
||||
_id: { $in: list.map((item) => String(item.tmbId)) }
|
||||
},
|
||||
'tmbId name avatar status',
|
||||
{
|
||||
session
|
||||
}
|
||||
).lean();
|
||||
|
||||
return list
|
||||
.map((item) => {
|
||||
const tmb = tmbList.find((tmb) => String(tmb._id) === String(item.tmbId));
|
||||
if (!tmb) return;
|
||||
|
||||
return {
|
||||
...item,
|
||||
sourceMember: { name: tmb.name, avatar: tmb.avatar, status: tmb.status }
|
||||
};
|
||||
})
|
||||
.filter(Boolean) as Array<T & { sourceMember: SourceMemberType }>;
|
||||
}
|
||||
|
||||
15
packages/web/common/fetch/type.d.ts
vendored
@@ -1,8 +1,13 @@
|
||||
export type PaginationProps<T = {}> = T & {
|
||||
offset: number;
|
||||
pageSize: number;
|
||||
};
|
||||
export type PaginationResponse<T = any> = {
|
||||
import { RequireOnlyOne } from '@fastgpt/global/common/type/utils';
|
||||
|
||||
type PaginationProps<T = {}> = T & {
|
||||
pageSize: number | string;
|
||||
} & RequireOnlyOne<{
|
||||
offset: number | string;
|
||||
pageNum: number | string;
|
||||
}>;
|
||||
|
||||
type PaginationResponse<T = {}> = {
|
||||
total: number;
|
||||
list: T[];
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ function AvatarGroup({
|
||||
<Flex position="relative">
|
||||
{avatars.slice(0, max).map((avatar, index) => (
|
||||
<Avatar
|
||||
key={avatar + groupId}
|
||||
key={index}
|
||||
src={avatar}
|
||||
position={index > 0 ? 'absolute' : 'relative'}
|
||||
left={index > 0 ? `${index * 15}px` : 0}
|
||||
|
||||
@@ -270,6 +270,7 @@ export const iconPaths = {
|
||||
import('./icons/core/workflow/template/datasource.svg'),
|
||||
'core/workflow/template/duckduckgo': () =>
|
||||
import('./icons/core/workflow/template/duckduckgo.svg'),
|
||||
'core/workflow/template/sleep': () => import('./icons/core/workflow/template/sleep.svg'),
|
||||
'core/workflow/template/extractJson': () =>
|
||||
import('./icons/core/workflow/template/extractJson.svg'),
|
||||
'core/workflow/template/fetchUrl': () => import('./icons/core/workflow/template/fetchUrl.svg'),
|
||||
@@ -386,6 +387,8 @@ export const iconPaths = {
|
||||
'model/sparkDesk': () => import('./icons/model/sparkDesk.svg'),
|
||||
'model/stepfun': () => import('./icons/model/stepfun.svg'),
|
||||
'model/yi': () => import('./icons/model/yi.svg'),
|
||||
'model/intern': () => import('./icons/model/intern.svg'),
|
||||
'model/moka': () => import('./icons/model/moka.svg'),
|
||||
more: () => import('./icons/more.svg'),
|
||||
moreLine: () => import('./icons/moreLine.svg'),
|
||||
out: () => import('./icons/out.svg'),
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
width="200" height="200">
|
||||
<path d="M-70.54222222-70.54222222m582.54222222 0l0 0q582.54222222 0 582.54222222 582.54222222l0 0q0 582.54222222-582.54222222 582.54222222l0 0q-582.54222222 0-582.54222222-582.54222222l0 0q0-582.54222222 582.54222222-582.54222222Z"
|
||||
fill="#1296db"/>
|
||||
<path d="M422.64477924 243.86730561H243.86730561v536.26538878h178.77747363V243.86730561zM780.13269439 243.86730561h-178.77747363v536.26538878H780.13269439V243.86730561z"
|
||||
fill="#ffffff"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 543 B |
20
packages/web/components/common/Icon/icons/model/intern.svg
Normal file
@@ -0,0 +1,20 @@
|
||||
<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.6719 37.9311C13.6719 37.9311 17.7467 37.4782 17.9732 37.4027C18.1997 37.3272 22.4255 37.5537 22.4255 37.5537L25.1414 38.2332L27.6308 39.1392L28.3102 39.3656L32.0076 38.0066L36.4599 37.3271L39.4777 37.4027L41.816 37.7047L42.7976 38.0066L42.722 42.0813L40.6836 41.5529L36.7598 41.2509L34.0439 41.4773L31.7056 42.0061L29.5937 42.6853L28.0837 43.2893L24.9149 42.0813L21.0666 41.3265H16.6142L13.6719 41.8549V37.9311Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M28.0723 43.9999C21.2124 40.2227 13.9268 42.4879 13.8534 42.5111L13.0312 42.7731V37.572L13.4674 37.4315C13.7841 37.3287 21.3298 34.9694 28.6783 39.0149L28.0723 40.1179C22.175 36.8716 15.9652 38.09 14.2896 38.5095V41.0891C16.479 40.5691 22.6447 39.5727 28.6783 42.8947L28.0723 43.9979V43.9999Z" fill="#1B3882"/>
|
||||
<path d="M27.9869 44.0003L27.3809 42.8976C33.4145 39.5754 39.5802 40.5715 41.7696 41.0915V38.5122C40.096 38.0906 33.8842 36.8743 27.9869 40.1208L27.3809 39.0176C34.7294 34.9721 42.2752 37.3314 42.5916 37.4342L43.028 37.5747V42.7779L42.206 42.5115C42.1344 42.4883 34.8489 40.2235 27.9869 44.0003Z" fill="#1B3882"/>
|
||||
<path d="M35.8849 32.1384C35.887 31.6833 35.7276 31.2932 35.4047 30.9535C35.0859 30.6305 34.7 30.4774 34.2554 30.49C33.8003 30.5215 33.4123 30.7039 33.0852 31.0227C32.7664 31.4085 32.6112 31.8112 32.6133 32.2684C32.6112 32.7067 32.7664 33.0968 33.0789 33.4177C33.3977 33.7574 33.7877 33.9126 34.2491 33.8811C34.6979 33.8832 35.0838 33.7008 35.4005 33.3485C35.7234 32.9961 35.8828 32.5914 35.887 32.1363L35.8849 32.1384Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M23.1787 33.3504C23.5016 32.9981 23.661 32.6122 23.6589 32.155C23.661 31.6999 23.5016 31.2763 23.1829 30.9198C22.841 30.6304 22.4593 30.4941 22.0315 30.5067C21.5617 30.5549 21.1737 30.7205 20.8613 31.0058C20.5425 31.3581 20.3831 31.7775 20.3789 32.2515C20.3789 32.7066 20.5404 33.0967 20.8591 33.4196C21.1675 33.7594 21.5554 33.9125 22.0147 33.8831C22.4887 33.8684 22.8725 33.7028 23.1765 33.3504H23.1787Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M27.9635 37.9078C26.7031 37.9078 25.4658 37.8029 24.5179 37.5596C21.9677 36.9053 19.9376 35.7246 18.3123 33.9483C16.6241 32.1007 16.5171 30.3202 16.4039 28.4348C16.3891 28.1936 16.3745 27.9482 16.3556 27.6987C16.2046 25.612 15.2189 22.3509 15.2085 22.3194L15.1309 22.0636L15.2881 21.8476C16.7394 19.872 18.5283 18.4606 20.7618 17.5294C22.8128 16.6738 25.2539 16.2271 28.2257 16.1621C33.1729 15.8727 38.5669 17.93 41.054 21.0569L41.2116 21.254L40.0852 26.5075C40.0728 26.7906 39.9888 28.2691 39.5819 31.2912C39.1037 34.8312 34.7311 36.8571 32.485 37.4317C31.3442 37.7253 29.6308 37.9078 27.9614 37.9078H27.9635ZM16.3095 22.267C16.5527 23.1038 17.2867 25.7441 17.4231 27.619C17.4419 27.8728 17.4566 28.1244 17.4713 28.3698C17.5804 30.2069 17.6684 31.6582 19.1008 33.2269C20.5814 34.8459 22.4395 35.9259 24.7821 36.5257C26.7681 37.0354 30.348 36.878 32.2208 36.3957C33.8335 35.9826 38.1097 34.2314 38.5249 31.1444C38.9633 27.8958 39.0199 26.4299 39.022 26.4152V26.3691L40.062 21.5246C38.4263 18.383 37.4554 17.7392 35.3749 16.9548C33.1813 16.1264 30.5074 17.0911 28.2781 17.2232H28.2592C22.5759 17.347 18.4087 15.5245 16.3074 22.2649L16.3095 22.267Z" fill="#1B3882"/>
|
||||
<path d="M39.1368 21.9314C39.5416 22.9736 39.7136 23.4958 40.0932 24.4501C40.0932 24.4501 41.0976 22.8374 41.4144 21.6839C41.7332 20.5178 41.538 19.033 41.2884 17.6447C40.6616 15.3148 40.1748 15.1344 38.2938 13.7544C37.4591 13.1819 36.5153 12.6744 35.4479 12.2277C33.1389 11.3574 30.8194 10.875 28.4852 10.7743C26.172 10.7345 23.8379 11.0805 21.4995 11.8082C20.4132 12.1857 19.4443 12.6387 18.5865 13.163C16.632 14.4276 15.2709 16.2081 14.5138 18.4941C14.3104 19.3539 13.9874 20.1802 14.0671 20.9772C14.432 24.6325 16.8165 26.2369 16.6529 25.356C16.4411 24.2194 16.5774 23.5483 16.8689 22.4619C17.4226 20.4067 18.7333 18.8883 20.8032 17.9215H20.8095C21.2122 17.8083 23.2528 16.6486 25.9623 18.0348C26.6816 18.3431 27.94 19.1778 28.5691 19.1589C29.2004 19.14 30.1084 18.5318 30.769 18.1187C32.0106 17.3406 33.1871 17.0743 34.7411 17.5671C36.9998 18.278 38.386 19.8845 39.1368 21.9334V21.9314Z" fill="#1B3882"/>
|
||||
<path d="M5.81212 20.1084L7.5108 20.6075L9.45912 20.5068L10.8579 19.5568L12.3574 18.2083L13.4563 16.7088L14.8552 15.2597L16.2036 14.4103L18.0512 14.0098L16.8014 16.2076L15.7528 17.2562L13.5549 20.3034L12.5566 21.8029L11.4074 22.6019L9.759 23.7008C9.759 23.7008 8.30984 24.0008 8.16096 24.0511C8.01204 24.1014 6.81248 24.3006 6.81248 24.3006L5.76388 24.2503L4.96484 24.0008L5.71352 22.5013L5.8142 21.4023V20.1042L5.81212 20.1084Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M10.1579 11.4685L10.0069 12.6157L9.60842 13.4168L9.10929 14.1655L7.85938 14.9142L9.35886 15.6629L11.0072 16.313L12.7059 16.6632L13.4547 16.7136L15.254 15.4637L17.152 13.7649L16.5019 13.5657L14.1551 13.3161L12.4061 12.666L11.1561 12.018L10.1579 11.4685Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M6.36581 24.7249C5.83729 24.7249 5.28153 24.6934 4.69853 24.6326L3.59961 24.5067L4.14069 24.1586L4.43009 23.8461C4.46993 23.7853 4.58529 23.584 4.77613 23.1604V23.1562C5.08441 22.4935 5.19137 21.3841 5.09701 19.8594L5.03197 18.8339L5.82261 19.4882C6.64893 20.1719 7.68493 20.3355 8.98729 19.9831C10.1512 19.6518 11.4179 18.5654 12.7475 16.7577C13.9702 14.9981 15.7297 13.8048 17.9821 13.2092L18.1939 13.1526L19.6179 14.262L18.3386 14.1697C18.2191 14.2851 18.0995 14.4088 17.9905 14.5451L17.9653 14.5766L17.9318 14.6059C17.1977 15.9104 16.147 17.1981 15.0964 18.6074L15.0817 18.6325C14.9202 18.9157 14.7545 19.2093 14.5742 19.5008V19.5155L14.5154 19.6098C13.4396 21.3589 12.2568 22.6696 10.9985 23.5085C9.84293 24.318 8.28893 24.7269 6.36581 24.7269V24.7249ZM5.45561 23.8063C7.62621 23.9468 9.31861 23.6029 10.493 22.7766L10.5014 22.7703C11.6402 22.0132 12.7244 20.8115 13.7248 19.2009C13.7437 19.1463 13.7709 19.1002 13.8003 19.0646C13.9786 18.7773 14.1463 18.4815 14.3099 18.1942V18.19C15.0208 16.8269 15.8388 15.6147 16.751 14.5766C15.39 15.1764 14.312 16.0677 13.4773 17.2694L13.471 17.2799C12.0009 19.2827 10.6126 20.4466 9.22845 20.8409C8.00581 21.1701 6.93205 21.1114 6.02185 20.6668C6.04073 21.9209 5.89813 22.8626 5.58985 23.5274C5.54369 23.6322 5.49965 23.7245 5.45981 23.8063H5.45561Z" fill="#1B3882"/>
|
||||
<path d="M6.46611 24.7247C5.93763 24.7247 5.38187 24.6932 4.79883 24.6324L4.89111 23.7495C7.38255 24.0116 9.29939 23.6845 10.5913 22.7764L10.6017 22.7701C11.7405 22.013 12.8247 20.8113 13.8251 19.2007C13.8607 19.1021 13.9174 19.035 13.9677 18.991L14.5486 19.6621C14.6367 19.5845 14.6745 19.4796 14.6807 19.4062L14.6724 19.5132L14.6157 19.6076C13.5399 21.3566 12.3571 22.6674 11.0988 23.5062C9.94323 24.3157 8.38923 24.7247 6.46611 24.7247Z" fill="#1B3882"/>
|
||||
<path d="M14.0572 16.2124C13.8685 16.225 13.6797 16.2355 13.4909 16.2418C11.9957 16.2942 10.3997 15.8769 8.73667 15.0024C10.1774 14.0712 10.578 13.01 10.5213 12.0537C10.8653 12.3263 11.2239 12.5654 11.5972 12.7689C14.0425 14.1467 16.6263 14.3648 21.0429 13.1296L20.743 12.2928C16.5465 13.4505 14.2732 13.2596 12.0271 11.9929C11.3896 11.6469 10.7982 11.1813 10.2697 10.6129L10.2089 10.5479L9.29871 9.56226L9.47067 10.829C9.49583 10.9338 10.018 13.4064 7.63355 14.6123L6.91211 14.9772L7.60839 15.3903C9.55875 16.5501 11.4504 17.1373 13.233 17.1373L14.0572 16.2145V16.2124Z" fill="#1B3882"/>
|
||||
<path d="M25.2919 29.8378C25.0151 29.8378 24.7551 29.6658 24.6271 29.3764C24.0336 28.0216 23.5681 27.4574 22.8655 26.6039C22.1545 25.742 20.6404 24.2823 20.3908 24.0705C20.0574 23.7874 19.963 23.4015 20.1622 23.1352C20.2629 23.003 20.5607 22.7367 21.1731 23.1435C22.4146 23.9656 25.1703 26.4382 25.9148 28.4242C26.1874 29.1457 25.9148 29.6364 25.5499 29.7853C25.4639 29.821 25.3779 29.8356 25.2898 29.8356L25.2919 29.8378Z" fill="#1B3882"/>
|
||||
<path d="M30.6502 29.8713C30.5621 29.8713 30.4719 29.8545 30.3839 29.8168C30.019 29.6637 29.7547 29.1688 30.0357 28.4515C30.8054 26.476 33.5925 24.039 34.8446 23.2316C35.4633 22.8332 35.7569 23.1016 35.8554 23.2358C36.0525 23.5042 35.954 23.888 35.6163 24.167C35.3647 24.3767 33.8317 25.8132 33.1102 26.6689C32.3972 27.5141 31.9253 28.0719 31.3129 29.4204C31.1829 29.7056 30.9249 29.8734 30.6523 29.8734L30.6502 29.8713Z" fill="#1B3882"/>
|
||||
<path d="M33.3855 8.21144C33.4043 7.18172 32.9031 6.29461 31.8817 5.5522C30.8437 4.82448 29.6042 4.45748 28.1635 4.447C26.7227 4.43648 25.4875 4.79092 24.4703 5.51444C23.4469 6.24428 22.9247 7.12088 22.9121 8.14224C22.9163 8.461 22.9436 8.75253 22.9834 9.02513C26.8024 7.79621 30.2229 7.89685 33.2387 9.32925C33.3205 8.94753 33.3708 8.57632 33.3855 8.20932V8.21144Z" fill="#1B3882" fill-opacity="0.5"/>
|
||||
<path d="M17.4187 28.9379L17.3998 28.8939C17.3495 28.7786 17.3055 28.6611 17.2698 28.5458L17.1629 28.2018L16.4561 28.2249L16.4016 28.8184C16.4058 28.8414 16.4183 28.8981 16.4309 28.9988V29.0197C16.4372 29.0554 16.4393 29.0847 16.4456 29.1141C16.4561 29.4287 16.3617 29.6782 16.1478 29.8984C15.9444 30.1144 15.6781 30.2109 15.3278 30.1962C14.8937 30.1794 14.749 30.0054 14.6777 29.8754C14.4869 29.5314 14.4743 29.3469 14.4848 29.2651C14.512 29.0407 14.5581 28.8037 14.6232 28.5646C14.7238 28.1913 14.6483 27.7572 14.3946 27.277L14.1345 26.7841C14.0359 26.5975 13.95 26.3626 13.8787 26.0858C13.8241 25.853 13.8388 25.574 13.9206 25.2532C13.994 24.97 14.1513 24.7478 14.4009 24.5716C14.6504 24.4038 14.9482 24.343 15.3027 24.3891L15.3299 24.3933H15.3572C15.7053 24.3954 15.9905 24.429 16.2087 24.4877C16.1478 24.148 16.1289 23.7935 16.1604 23.4328C15.9318 23.3364 15.7011 23.2692 15.4683 23.2378H15.4558L15.2838 23.2231C14.7658 23.1748 14.2603 23.2902 13.7822 23.567C13.2873 23.8564 12.9538 24.2843 12.7923 24.84C12.6539 25.3245 12.6371 25.8236 12.7399 26.3206C12.7525 26.3961 12.7693 26.4842 12.7986 26.5681C12.8762 26.8135 13.0041 27.0861 13.1803 27.3797C13.4487 27.8222 13.5305 27.9669 13.5536 28.0152L13.562 28.0319C13.5955 28.0928 13.6019 28.185 13.5788 28.3067L13.5704 28.3465C13.5452 28.4828 13.5201 28.6108 13.5096 28.659C13.2999 29.2022 13.2789 29.7034 13.4445 30.1417C13.6123 30.6073 13.908 30.947 14.3275 31.1568C14.5707 31.2763 14.8518 31.3518 15.1643 31.3832C15.3341 31.4 15.5124 31.4021 15.699 31.3916C16.3051 31.3602 16.7979 31.0728 17.123 30.5674C17.4418 30.0872 17.5445 29.5545 17.4334 28.9862L17.425 28.9379H17.4187Z" fill="#1B3882"/>
|
||||
<path d="M43.4628 24.106C43.2992 23.5565 42.9592 23.1308 42.4516 22.8393H42.4496C41.9948 22.5792 41.508 22.4723 41.0004 22.5205C40.9816 22.5205 40.9628 22.5247 40.944 22.5268L40.776 22.5478H40.7616C40.4384 22.6002 40.1156 22.7219 39.801 22.9043C39.8031 22.9295 39.8073 22.9567 39.8115 22.9819C39.8408 23.3028 39.8262 23.6195 39.7716 23.9277L39.9541 23.8543C40.1868 23.76 40.5036 23.6824 40.9208 23.6195L40.944 23.6153C41.2628 23.5502 41.5376 23.609 41.806 23.804C42.0888 24.0095 42.28 24.2654 42.3888 24.5821C42.4792 24.8799 42.4916 25.1357 42.4288 25.3622C42.3512 25.6453 42.2632 25.897 42.1664 26.1088C42.0512 26.3521 41.9336 26.5891 41.8184 26.8051C41.6444 27.128 41.5816 27.4783 41.634 27.8432C41.678 28.1619 41.724 28.4262 41.7764 28.6527C41.8144 28.81 41.7912 29.0113 41.7092 29.2504L41.7052 29.2609C41.638 29.4748 41.2772 29.5901 41.0676 29.6405C40.5896 29.7537 40.3756 29.5797 40.2476 29.4223C40.0296 29.1413 39.9268 28.8373 39.9331 28.4954L39.9415 28.3968C39.952 28.2983 39.9625 28.2479 39.9667 28.2291L39.9519 27.6167L39.1676 27.6356L39.0838 27.9711C39.0544 28.0865 39.0166 28.1997 38.9684 28.3129L38.9474 28.3612L38.939 28.4136C38.8468 28.9715 38.9621 29.5021 39.2788 29.9928L39.2872 30.0033C39.6332 30.5024 40.128 30.7771 40.7176 30.7981C40.8748 30.8065 41.0276 30.8023 41.1724 30.7897C41.5208 30.7583 41.8312 30.666 42.0972 30.5171C42.4896 30.3011 42.7684 29.955 42.932 29.4874C43.0872 29.0281 43.0556 28.529 42.8396 28.0026L42.7872 27.6922L42.7832 27.6691C42.758 27.558 42.7684 27.4489 42.8104 27.3399C42.8924 27.1448 43.0032 26.9183 43.1396 26.6604C43.318 26.3458 43.4332 26.0795 43.496 25.8529C43.5276 25.7523 43.5488 25.6642 43.5548 25.5761C43.6368 25.0833 43.6052 24.5905 43.4584 24.1102L43.4628 24.106Z" fill="#1B3882"/>
|
||||
<path d="M33.7641 9.18672C33.8249 8.8512 33.8606 8.53452 33.8731 8.21784C33.8941 7.0392 33.3258 6.02 32.1807 5.1874C31.0755 4.41144 29.7396 4.013 28.2108 4.0004C26.6777 3.98572 25.3481 4.3758 24.2554 5.15176C23.1125 5.96756 22.5253 6.97212 22.5106 8.13812V8.14864C22.5127 8.3814 22.5274 8.6142 22.5568 8.85748C22.4498 8.9854 22.3911 9.12592 22.3848 9.27692V9.29368C22.3848 9.68796 22.4414 10.0822 22.5609 10.4639L22.563 10.4744C22.7266 10.9568 23.0076 11.416 23.3998 11.8397L23.5131 11.9613L24.5449 12.0766C25.4257 12.5884 26.6022 12.8631 28.0493 12.8882C28.1122 12.8882 28.1751 12.8882 28.2359 12.8882C29.3034 12.8882 30.2366 12.7582 31.0126 12.5024L31.0336 12.494C31.3251 12.3808 31.6082 12.2444 31.8787 12.0872C32.7008 12.1647 33.3174 11.76 33.6341 10.9358L33.7117 10.8519L33.7075 10.7344C33.8291 10.3612 34.043 9.62924 33.762 9.18672H33.7641ZM24.7693 5.87528C25.7046 5.21048 26.8581 4.87912 28.2024 4.8896C29.5466 4.90008 30.7127 5.24612 31.6627 5.91092C32.5666 6.56736 32.9986 7.31816 32.9839 8.19268C32.9776 8.35416 32.965 8.51984 32.942 8.6918C31.4152 8.05216 29.7857 7.7334 28.0598 7.7334C26.577 7.7334 25.0251 7.97036 23.4103 8.44224C23.404 8.34156 23.3998 8.24092 23.3977 8.14232C23.4103 7.26572 23.8591 6.52332 24.7693 5.87528ZM32.9756 10.0445L32.6756 10.6925C32.6756 10.6925 32.2835 11.2588 31.8556 11.1874L31.69 11.1602L31.5474 11.2483C31.2873 11.4098 31.0105 11.5482 30.7232 11.6593C29.9996 11.8963 29.1042 12.0096 28.064 11.9949C26.7763 11.9697 25.7445 11.739 24.9958 11.3049C24.9727 11.2902 24.9496 11.2755 24.9286 11.265L24.8406 11.2105L23.9472 11.112C23.7773 10.9127 23.5361 10.4933 23.5361 10.4933L23.2908 9.78232C23.2908 9.78232 23.2782 9.48032 23.2761 9.41112C26.8916 8.27236 30.1674 8.36672 33.0133 9.69216C33.0175 9.7446 32.9756 10.0445 32.9756 10.0445ZM33.2419 10.7051V10.6988L33.2482 10.7051H33.2419Z" fill="#1B3882"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -1,5 +1,5 @@
|
||||
<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_28116_23027)">
|
||||
<g >
|
||||
<path d="M13.7936 8H13.7456L13.6836 13.23H13.7276C17.1576 13.23 19.8196 15.944 25.6076 25.722L25.9576 26.316L25.9816 26.356L29.2216 21.48L29.1976 21.442C28.4896 20.2828 27.7574 19.1386 27.0016 18.01C26.2575 16.8963 25.4736 15.8096 24.6516 14.752C20.8256 9.864 17.6256 8 13.7936 8Z" fill="url(#paint0_linear_28116_23027)"/>
|
||||
<path d="M13.7455 8C9.89953 8.02 6.49353 10.516 4.03953 14.34C4.03284 14.3513 4.02617 14.3627 4.01953 14.374L8.52753 16.836L8.54953 16.802C9.98553 14.636 11.7695 13.254 13.6855 13.232H13.7275L13.7915 8H13.7455Z" fill="url(#paint1_linear_28116_23027)"/>
|
||||
<path d="M4.03906 14.3401L4.01706 14.3741C2.40106 16.8941 1.19706 19.9901 0.549062 23.3281L0.539062 23.3721L5.60706 24.5721L5.61506 24.5281C6.15506 21.5941 7.18706 18.8721 8.52706 16.8381L8.54906 16.8041L4.03906 14.3401Z" fill="url(#paint2_linear_28116_23027)"/>
|
||||
@@ -70,8 +70,5 @@
|
||||
<stop offset="0.2765" stop-color="#0867DF"/>
|
||||
<stop offset="1" stop-color="#0471E9"/>
|
||||
</linearGradient>
|
||||
<clipPath id="clip0_28116_23027">
|
||||
<rect width="48" height="48" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.2 KiB |
24
packages/web/components/common/Icon/icons/model/moka.svg
Normal file
@@ -0,0 +1,24 @@
|
||||
<svg viewBox="0 0 45 26" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<!-- Generator: Sketch 55 (78076) - https://sketchapp.com -->
|
||||
|
||||
<title>Group</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g fill-rule="evenodd" fill="none" id="组件">
|
||||
<g id="页脚">
|
||||
<g id="Group">
|
||||
<g id="Page-1">
|
||||
<path fill="#0C8CF6" id="Fill-1" d="m20.9587,24.53226l-4.85075,-7.2592l2.16824,-1.44214l4.128,6.1776l9.34013,-13.9776l2.16824,1.44214l-10.06287,15.0592c-0.68757,1.02916 -2.20343,1.02916 -2.89099,0"/>
|
||||
<polygon points="68.33575105667114,19.651321411132812 64.82147645950317,11.577018737792969 64.11480379104614,23.955184936523438 59.74661684036255,23.955184936523438 60.87459993362427,3.1465225219726562 65.50557374954224,3.1465225219726562 70.11526155471802,13.803489685058594 74.72494173049927,3.1465225219726562 79.35287141799927,3.1465225219726562 80.4812970161438,23.955184936523438 76.11614656448364,23.955184936523438 75.40946626663208,11.577018737792969 71.89519929885864,19.651321411132812 " fill="#FFFFFF" id="Fill-3"/>
|
||||
<path fill="#FFFFFF" id="Fill-5" d="m90.0524,20.24468c0.89258,0 1.59187,-0.29683 2.09745,-0.8905c0.50601,-0.59366 0.75879,-1.64233 0.75879,-3.14686c0,-1.50324 -0.25278,-2.5571 -0.75879,-3.16074c-0.50558,-0.60363 -1.20487,-0.90566 -2.09745,-0.90566c-0.87303,0 -1.57232,0.31156 -2.09788,0.9347c-0.52599,0.624 -0.78833,1.6679 -0.78833,3.1317c0,1.50453 0.25757,2.5532 0.77357,3.14686c0.51556,0.59367 1.22007,0.8905 2.11264,0.8905m0,-11.9626c1.03113,0 1.99364,0.14387 2.88621,0.4303c0.89258,0.28687 1.66093,0.74707 2.30593,1.38017c0.64414,0.63397 1.14971,1.4547 1.51717,2.46393c0.36702,1.00924 0.55074,2.22647 0.55074,3.65084c0,1.42523 -0.18372,2.64246 -0.55074,3.65126c-0.36746,1.00967 -0.87303,1.83084 -1.51717,2.46437c-0.645,0.63353 -1.41335,1.0933 -2.30593,1.38017c-0.89257,0.28643 -1.85508,0.4303 -2.88621,0.4303c-1.05198,0 -2.01839,-0.14387 -2.90098,-0.4303c-0.88302,-0.28687 -1.64659,-0.74664 -2.29116,-1.38017c-0.645,-0.63353 -1.15057,-1.4547 -1.5176,-2.46437c-0.36745,-1.0088 -0.55031,-2.22603 -0.55031,-3.65126c0,-1.40444 0.18286,-2.60694 0.55031,-3.6062c0.36703,-0.99927 0.8726,-1.82044 1.5176,-2.46394c0.64457,-0.64263 1.40814,-1.1128 2.29116,-1.41006c0.88259,-0.29684 1.849,-0.44504 2.90098,-0.44504"/>
|
||||
<polygon points="100.08356142044067,23.955101013183594 104.57641267776489,23.955101013183594 104.57641267776489,2.682769775390625 100.08356142044067,2.682769775390625 " fill="#FFFFFF" id="Fill-7"/>
|
||||
<polygon points="104.54623079299927,15.940773010253906 109.77919435501099,8.459709167480469 114.86709260940552,8.459709167480469 109.48557710647583,15.732772827148438 115.46258211135864,23.955272674560547 110.4037823677063,23.955272674560547 " fill="#FFFFFF" id="Fill-9"/>
|
||||
<path fill="#FFFFFF" id="Fill-10" d="m124.83454,17.15783c-0.1985,-0.03986 -0.40698,-0.06413 -0.62459,-0.0741c-0.21891,-0.00996 -0.40698,-0.01516 -0.56595,-0.01516c-0.83307,0 -1.50717,0.12913 -2.02273,0.3861c-0.51644,0.25696 -0.774,0.70243 -0.774,1.33553c0,0.39607 0.09425,0.70807 0.28319,0.93513c0.18763,0.2275 0.42088,0.39607 0.69886,0.5044c0.27754,0.1092 0.56985,0.17334 0.8778,0.19284c0.30752,0.01993 0.56986,0.0299 0.78877,0.0299c0.39612,0 0.84263,-0.0494 1.33865,-0.14864l0,-3.146zm-1.54713,-3.26516c0.15853,0 0.37179,0.00476 0.63978,0.0143c0.26756,0.0104 0.56943,0.02556 0.90735,0.04506c-0.01998,-0.7722 -0.21457,-1.3247 -0.82743,-1.63063c-0.51296,-0.25567 -1.19618,-0.36703 -2.02925,-0.36703c-0.45606,0 -0.98162,0.0546 -1.57667,0.16336c-0.59505,0.10877 -1.24005,0.27214 -1.93413,0.48967l-0.4756,-1.63237c-0.05994,-0.21796 -0.14464,-0.53473 -0.25323,-0.94986c-0.10945,-0.416 -0.18372,-0.7423 -0.22325,-0.97977c0.99161,-0.3367 1.92936,-0.57893 2.81194,-0.72757c0.88259,-0.1482 1.68091,-0.2223 2.39497,-0.2223c2.10222,0 3.72884,0.50007 4.87985,1.4989c1.15014,0.9997 1.72565,2.75427 1.72565,4.95084l0,8.69743c-0.77357,0.2184 -1.66614,0.43073 -2.67773,0.6383c-1.01202,0.208 -2.10309,0.312 -3.27278,0.312c-1.032,0 -1.96931,-0.08927 -2.81237,-0.26737c-0.84306,-0.1781 -1.56668,-0.47493 -2.17172,-0.8905c-0.60548,-0.41556 -1.07109,-0.9594 -1.39859,-1.6328c-0.32706,-0.67253 -0.4908,-1.4937 -0.4908,-2.4635c0,-0.96936 0.20283,-1.781 0.60981,-2.43403c0.40655,-0.65347 0.9321,-1.17303 1.57711,-1.5587c0.64456,-0.3861 1.36861,-0.6578 2.17215,-0.8164c0.8031,-0.15773 1.61141,-0.23703 2.42494,-0.23703l0,0z"/>
|
||||
<path fill="#0C8CF6" id="Fill-11" d="m11.28274,23.05203l-7.29219,0l13.20144,-19.75653l3.64631,5.45653l-9.55556,14.3zm32.60399,-0.0949l-14.82457,-22.18536c-0.688,-1.02917 -2.20343,-1.02917 -2.89143,0l-3.76662,5.6368l-3.76619,-5.6368c-0.688,-1.02917 -2.20343,-1.02917 -2.89143,0l-14.82457,22.18536c-0.76966,1.1518 0.05776,2.6949 1.44549,2.6949l9.38008,0c0.58115,0 1.12321,-0.28946 1.4455,-0.77176l14.42324,-21.58477l13.20187,19.75653l-7.29219,0l-4.34344,-6.5l-1.56624,2.34347l3.99943,5.98477c0.32185,0.4823 0.86435,0.77176 1.4455,0.77176l9.38008,0c1.38773,0 2.21515,-1.5431 1.44549,-2.6949l0,0z"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
@@ -1,14 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
|
||||
<g clip-path="url(#clip0_19_444)">
|
||||
<path d="M10 20C15.5229 20 20 15.5229 20 10C20 4.47712 15.5229 0 10 0C4.47712 0 0 4.47712 0 10C0 15.5229 4.47712 20 10 20Z" fill="#003425"/>
|
||||
<path d="M15.0705 12.0408C15.0705 11.8535 14.9961 11.6738 14.8636 11.5413C14.7311 11.4088 14.5515 11.3344 14.3641 11.3344C14.1768 11.3344 13.9971 11.4088 13.8646 11.5413C13.7321 11.6738 13.6577 11.8535 13.6577 12.0408V15.6829C13.6577 15.8702 13.7321 16.0499 13.8646 16.1824C13.9971 16.3149 14.1768 16.3893 14.3641 16.3893C14.5515 16.3893 14.7311 16.3149 14.8636 16.1824C14.9961 16.0499 15.0705 15.8702 15.0705 15.6829V12.0408Z" fill="white"/>
|
||||
<path d="M14.067 4.44512C13.9963 4.38501 13.9145 4.33941 13.8262 4.31092C13.7379 4.28243 13.6448 4.27162 13.5524 4.27909C13.4599 4.28656 13.3698 4.31218 13.2872 4.35448C13.2047 4.39677 13.1312 4.45492 13.0711 4.5256L9.12344 9.16752C9.02533 9.28249 8.96687 9.426 8.95672 9.5768C8.95112 9.61248 8.94824 9.6488 8.94824 9.68608V15.6202C8.94824 15.8075 9.02267 15.9872 9.15514 16.1197C9.28762 16.2521 9.46729 16.3266 9.65464 16.3266C9.84199 16.3266 10.0217 16.2521 10.1541 16.1197C10.2866 15.9872 10.361 15.8075 10.361 15.6202V9.8928L14.1474 5.44096C14.2076 5.37029 14.2532 5.28847 14.2816 5.20018C14.3101 5.11189 14.3209 5.01885 14.3135 4.92637C14.306 4.8339 14.2804 4.7438 14.2381 4.66123C14.1958 4.57865 14.1376 4.50522 14.067 4.44512Z" fill="white"/>
|
||||
<path d="M5.33941 4.12558C5.2806 4.05384 5.20823 3.99438 5.12644 3.9506C5.04465 3.90683 4.95504 3.87959 4.86272 3.87045C4.77041 3.8613 4.67719 3.87043 4.58841 3.89731C4.49962 3.92419 4.41699 3.96829 4.34525 4.0271C4.2735 4.08591 4.21405 4.15828 4.17027 4.24007C4.12649 4.32186 4.09926 4.41147 4.09011 4.50379C4.08097 4.5961 4.09009 4.68932 4.11697 4.7781C4.14385 4.86689 4.18796 4.94952 4.24677 5.02126L7.04389 8.43326C7.16266 8.57818 7.33414 8.66997 7.5206 8.68846C7.70705 8.70694 7.89321 8.6506 8.03813 8.53182C8.18304 8.41305 8.27484 8.24157 8.29332 8.05511C8.31181 7.86866 8.25546 7.6825 8.13669 7.53758L5.33925 4.12558H5.33941Z" fill="white"/>
|
||||
<path d="M15.3376 10.1726C15.5666 10.1726 15.7862 10.0817 15.9481 9.91972C16.11 9.7578 16.201 9.53818 16.201 9.30918C16.201 9.08018 16.11 8.86056 15.9481 8.69864C15.7862 8.53671 15.5666 8.44574 15.3376 8.44574C15.1086 8.44574 14.8889 8.53671 14.727 8.69864C14.5651 8.86056 14.4741 9.08018 14.4741 9.30918C14.4741 9.53818 14.5651 9.7578 14.727 9.91972C14.8889 10.0817 15.1086 10.1726 15.3376 10.1726Z" fill="#00FF25"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_19_444">
|
||||
<rect width="20" height="20" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<path d="M10 20C15.5229 20 20 15.5229 20 10C20 4.47712 15.5229 0 10 0C4.47712 0 0 4.47712 0 10C0 15.5229 4.47712 20 10 20Z" fill="#003425"/>
|
||||
<path d="M15.0705 12.0408C15.0705 11.8535 14.9961 11.6738 14.8636 11.5413C14.7311 11.4088 14.5515 11.3344 14.3641 11.3344C14.1768 11.3344 13.9971 11.4088 13.8646 11.5413C13.7321 11.6738 13.6577 11.8535 13.6577 12.0408V15.6829C13.6577 15.8702 13.7321 16.0499 13.8646 16.1824C13.9971 16.3149 14.1768 16.3893 14.3641 16.3893C14.5515 16.3893 14.7311 16.3149 14.8636 16.1824C14.9961 16.0499 15.0705 15.8702 15.0705 15.6829V12.0408Z" fill="white"/>
|
||||
<path d="M14.067 4.44512C13.9963 4.38501 13.9145 4.33941 13.8262 4.31092C13.7379 4.28243 13.6448 4.27162 13.5524 4.27909C13.4599 4.28656 13.3698 4.31218 13.2872 4.35448C13.2047 4.39677 13.1312 4.45492 13.0711 4.5256L9.12344 9.16752C9.02533 9.28249 8.96687 9.426 8.95672 9.5768C8.95112 9.61248 8.94824 9.6488 8.94824 9.68608V15.6202C8.94824 15.8075 9.02267 15.9872 9.15514 16.1197C9.28762 16.2521 9.46729 16.3266 9.65464 16.3266C9.84199 16.3266 10.0217 16.2521 10.1541 16.1197C10.2866 15.9872 10.361 15.8075 10.361 15.6202V9.8928L14.1474 5.44096C14.2076 5.37029 14.2532 5.28847 14.2816 5.20018C14.3101 5.11189 14.3209 5.01885 14.3135 4.92637C14.306 4.8339 14.2804 4.7438 14.2381 4.66123C14.1958 4.57865 14.1376 4.50522 14.067 4.44512Z" fill="white"/>
|
||||
<path d="M5.33941 4.12558C5.2806 4.05384 5.20823 3.99438 5.12644 3.9506C5.04465 3.90683 4.95504 3.87959 4.86272 3.87045C4.77041 3.8613 4.67719 3.87043 4.58841 3.89731C4.49962 3.92419 4.41699 3.96829 4.34525 4.0271C4.2735 4.08591 4.21405 4.15828 4.17027 4.24007C4.12649 4.32186 4.09926 4.41147 4.09011 4.50379C4.08097 4.5961 4.09009 4.68932 4.11697 4.7781C4.14385 4.86689 4.18796 4.94952 4.24677 5.02126L7.04389 8.43326C7.16266 8.57818 7.33414 8.66997 7.5206 8.68846C7.70705 8.70694 7.89321 8.6506 8.03813 8.53182C8.18304 8.41305 8.27484 8.24157 8.29332 8.05511C8.31181 7.86866 8.25546 7.6825 8.13669 7.53758L5.33925 4.12558H5.33941Z" fill="white"/>
|
||||
<path d="M15.3376 10.1726C15.5666 10.1726 15.7862 10.0817 15.9481 9.91972C16.11 9.7578 16.201 9.53818 16.201 9.30918C16.201 9.08018 16.11 8.86056 15.9481 8.69864C15.7862 8.53671 15.5666 8.44574 15.3376 8.44574C15.1086 8.44574 14.8889 8.53671 14.727 8.69864C14.5651 8.86056 14.4741 9.08018 14.4741 9.30918C14.4741 9.53818 14.5651 9.7578 14.727 9.91972C14.8889 10.0817 15.1086 10.1726 15.3376 10.1726Z" fill="#00FF25"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -4,13 +4,23 @@ import { Box, Icon } from '@chakra-ui/react';
|
||||
import { iconPaths } from './constants';
|
||||
import type { IconNameType } from './type.d';
|
||||
|
||||
const iconCache: Record<string, any> = {};
|
||||
|
||||
const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType } & IconProps) => {
|
||||
const [IconComponent, setIconComponent] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (iconCache[name]) {
|
||||
setIconComponent(iconCache[name]);
|
||||
return;
|
||||
}
|
||||
|
||||
iconPaths[name]?.()
|
||||
.then((icon) => {
|
||||
setIconComponent({ as: icon.default });
|
||||
const component = { as: icon.default };
|
||||
// Store in cache
|
||||
iconCache[name] = component;
|
||||
setIconComponent(component);
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
}, [name]);
|
||||
@@ -30,4 +40,4 @@ const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(MyIcon);
|
||||
export default MyIcon;
|
||||
|
||||
@@ -31,7 +31,7 @@ const HttpInput = ({
|
||||
|
||||
const onChangeInput = useCallback(
|
||||
(editorState: EditorState, editor: LexicalEditor) => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
const text = editorStateToText(editor);
|
||||
setCurrentValue(text);
|
||||
onChange?.(text);
|
||||
},
|
||||
@@ -39,7 +39,7 @@ const HttpInput = ({
|
||||
);
|
||||
const onBlurInput = useCallback(
|
||||
(editor: LexicalEditor) => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
const text = editorStateToText(editor);
|
||||
onBlur?.(text);
|
||||
},
|
||||
[onBlur]
|
||||
|
||||
@@ -21,7 +21,15 @@ import type { ButtonProps, MenuItemProps } from '@chakra-ui/react';
|
||||
import MyIcon from '../Icon';
|
||||
import { useRequest2 } from '../../../hooks/useRequest';
|
||||
import MyDivider from '../MyDivider';
|
||||
import { useScrollPagination } from '../../../hooks/useScrollPagination';
|
||||
|
||||
/** 选择组件 Props 类型
|
||||
* value: 选中的值
|
||||
* placeholder: 占位符
|
||||
* list: 列表数据
|
||||
* isLoading: 是否加载中
|
||||
* ScrollData: 分页滚动数据控制器 [useScrollPagination] 的返回值
|
||||
* */
|
||||
export type SelectProps<T = any> = ButtonProps & {
|
||||
value?: T;
|
||||
placeholder?: string;
|
||||
@@ -34,6 +42,7 @@ export type SelectProps<T = any> = ButtonProps & {
|
||||
}[];
|
||||
isLoading?: boolean;
|
||||
onchange?: (val: T) => any | Promise<any>;
|
||||
ScrollData?: ReturnType<typeof useScrollPagination>['ScrollData'];
|
||||
};
|
||||
|
||||
const MySelect = <T = any,>(
|
||||
@@ -44,6 +53,7 @@ const MySelect = <T = any,>(
|
||||
list = [],
|
||||
onchange,
|
||||
isLoading = false,
|
||||
ScrollData,
|
||||
...props
|
||||
}: SelectProps<T>,
|
||||
ref: ForwardedRef<{
|
||||
@@ -87,6 +97,46 @@ const MySelect = <T = any,>(
|
||||
|
||||
const isSelecting = loading || isLoading;
|
||||
|
||||
const ListRender = useMemo(() => {
|
||||
return (
|
||||
<>
|
||||
{list.map((item, i) => (
|
||||
<Box key={i}>
|
||||
<MenuItem
|
||||
{...menuItemStyles}
|
||||
{...(value === item.value
|
||||
? {
|
||||
ref: SelectedItemRef,
|
||||
color: 'primary.700',
|
||||
bg: 'myGray.100',
|
||||
fontWeight: '600'
|
||||
}
|
||||
: {
|
||||
color: 'myGray.900'
|
||||
})}
|
||||
onClick={() => {
|
||||
if (onChange && value !== item.value) {
|
||||
onChange(item.value);
|
||||
}
|
||||
}}
|
||||
whiteSpace={'pre-wrap'}
|
||||
fontSize={'sm'}
|
||||
display={'block'}
|
||||
>
|
||||
<Box>{item.label}</Box>
|
||||
{item.description && (
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{item.description}
|
||||
</Box>
|
||||
)}
|
||||
</MenuItem>
|
||||
{item.showBorder && <MyDivider my={2} />}
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}, [list, value]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
css={css({
|
||||
@@ -154,39 +204,7 @@ const MySelect = <T = any,>(
|
||||
maxH={'40vh'}
|
||||
overflowY={'auto'}
|
||||
>
|
||||
{list.map((item, i) => (
|
||||
<Box key={i}>
|
||||
<MenuItem
|
||||
{...menuItemStyles}
|
||||
{...(value === item.value
|
||||
? {
|
||||
ref: SelectedItemRef,
|
||||
color: 'primary.700',
|
||||
bg: 'myGray.100',
|
||||
fontWeight: '600'
|
||||
}
|
||||
: {
|
||||
color: 'myGray.900'
|
||||
})}
|
||||
onClick={() => {
|
||||
if (onChange && value !== item.value) {
|
||||
onChange(item.value);
|
||||
}
|
||||
}}
|
||||
whiteSpace={'pre-wrap'}
|
||||
fontSize={'sm'}
|
||||
display={'block'}
|
||||
>
|
||||
<Box>{item.label}</Box>
|
||||
{item.description && (
|
||||
<Box color={'myGray.500'} fontSize={'xs'}>
|
||||
{item.description}
|
||||
</Box>
|
||||
)}
|
||||
</MenuItem>
|
||||
{item.showBorder && <MyDivider my={2} />}
|
||||
</Box>
|
||||
))}
|
||||
{ScrollData ? <ScrollData>{ListRender}</ScrollData> : ListRender}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
</Box>
|
||||
|
||||
@@ -40,14 +40,14 @@ const PromptEditor = ({
|
||||
|
||||
const onChangeInput = useCallback(
|
||||
(editorState: EditorState, editor: LexicalEditor) => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
const text = editorStateToText(editor);
|
||||
onChange?.(text);
|
||||
},
|
||||
[onChange]
|
||||
);
|
||||
const onBlurInput = useCallback(
|
||||
(editor: LexicalEditor) => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
const text = editorStateToText(editor);
|
||||
onBlur?.(text);
|
||||
},
|
||||
[onBlur]
|
||||
|
||||
23
packages/web/components/common/UserBox/index.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Box, HStack, type StackProps } from '@chakra-ui/react';
|
||||
import { SourceMemberType } from '@fastgpt/global/support/user/type';
|
||||
import React from 'react';
|
||||
import Avatar from '../Avatar';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Tag from '../Tag';
|
||||
|
||||
export type UserBoxProps = {
|
||||
sourceMember: SourceMemberType;
|
||||
avatarSize?: string;
|
||||
} & StackProps;
|
||||
function UserBox({ sourceMember, avatarSize = '1.25rem', ...props }: UserBoxProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<HStack space="1" {...props}>
|
||||
<Avatar src={sourceMember.avatar} w={avatarSize} />
|
||||
<Box>{sourceMember.name}</Box>
|
||||
{sourceMember.status === 'leave' && <Tag color="gray">{t('common:user_leaved')}</Tag>}
|
||||
</HStack>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(UserBox);
|
||||
@@ -4,7 +4,6 @@ import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from './useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
|
||||
import {
|
||||
useBoolean,
|
||||
useLockFn,
|
||||
@@ -14,37 +13,33 @@ import {
|
||||
useThrottleEffect
|
||||
} from 'ahooks';
|
||||
|
||||
import { PaginationProps, PaginationResponse } from '../common/fetch/type';
|
||||
|
||||
const thresholdVal = 200;
|
||||
|
||||
type PagingData<T> = {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
data: T[];
|
||||
total?: number;
|
||||
};
|
||||
|
||||
export function usePagination<ResT = any>({
|
||||
api,
|
||||
pageSize = 10,
|
||||
params = {},
|
||||
defaultRequest = true,
|
||||
type = 'button',
|
||||
onChange,
|
||||
refreshDeps,
|
||||
scrollLoadType = 'bottom',
|
||||
EmptyTip
|
||||
}: {
|
||||
api: (data: any) => Promise<PagingData<ResT>>;
|
||||
pageSize?: number;
|
||||
params?: Record<string, any>;
|
||||
defaultRequest?: boolean;
|
||||
type?: 'button' | 'scroll';
|
||||
onChange?: (pageNum: number) => void;
|
||||
refreshDeps?: any[];
|
||||
throttleWait?: number;
|
||||
scrollLoadType?: 'top' | 'bottom';
|
||||
EmptyTip?: React.JSX.Element;
|
||||
}) {
|
||||
export function usePagination<DataT, ResT = {}>(
|
||||
api: (data: PaginationProps<DataT>) => Promise<PaginationResponse<ResT>>,
|
||||
{
|
||||
pageSize = 10,
|
||||
params,
|
||||
defaultRequest = true,
|
||||
type = 'button',
|
||||
onChange,
|
||||
refreshDeps,
|
||||
scrollLoadType = 'bottom',
|
||||
EmptyTip
|
||||
}: {
|
||||
pageSize?: number;
|
||||
params?: DataT;
|
||||
defaultRequest?: boolean;
|
||||
type?: 'button' | 'scroll';
|
||||
onChange?: (pageNum: number) => void;
|
||||
refreshDeps?: any[];
|
||||
throttleWait?: number;
|
||||
scrollLoadType?: 'top' | 'bottom';
|
||||
EmptyTip?: React.JSX.Element;
|
||||
}
|
||||
) {
|
||||
const { toast } = useToast();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -64,7 +59,7 @@ export function usePagination<ResT = any>({
|
||||
setTrue();
|
||||
|
||||
try {
|
||||
const res: PagingData<ResT> = await api({
|
||||
const res = await api({
|
||||
pageNum: num,
|
||||
pageSize,
|
||||
...params
|
||||
@@ -93,13 +88,13 @@ export function usePagination<ResT = any>({
|
||||
);
|
||||
}
|
||||
|
||||
setData((prevData) => (num === 1 ? res.data : [...res.data, ...prevData]));
|
||||
setData((prevData) => (num === 1 ? res.list : [...res.list, ...prevData]));
|
||||
adjustScrollPosition();
|
||||
} else {
|
||||
setData((prevData) => (num === 1 ? res.data : [...prevData, ...res.data]));
|
||||
setData((prevData) => (num === 1 ? res.list : [...prevData, ...res.list]));
|
||||
}
|
||||
} else {
|
||||
setData(res.data);
|
||||
setData(res.list);
|
||||
}
|
||||
|
||||
onChange?.(num);
|
||||
|
||||
@@ -16,7 +16,7 @@ import MyBox from '../components/common/MyBox';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
type ItemHeight<T> = (index: number, data: T) => number;
|
||||
const thresholdVal = 200;
|
||||
const thresholdVal = 100;
|
||||
|
||||
export type ScrollListType = ({
|
||||
children,
|
||||
@@ -269,8 +269,10 @@ export function useScrollPagination<
|
||||
({
|
||||
children,
|
||||
ScrollContainerRef,
|
||||
isLoading,
|
||||
...props
|
||||
}: {
|
||||
isLoading?: boolean;
|
||||
children: ReactNode;
|
||||
ScrollContainerRef?: RefObject<HTMLDivElement>;
|
||||
} & BoxProps) => {
|
||||
@@ -302,7 +304,7 @@ export function useScrollPagination<
|
||||
);
|
||||
|
||||
return (
|
||||
<Box {...props} ref={ref} overflow={'overlay'}>
|
||||
<MyBox {...props} ref={ref} overflow={'overlay'} isLoading={isLoading}>
|
||||
{scrollLoadType === 'top' && total > 0 && isLoading && (
|
||||
<Box mt={2} fontSize={'xs'} color={'blackAlpha.500'} textAlign={'center'}>
|
||||
{t('common:common.is_requesting')}
|
||||
@@ -325,7 +327,7 @@ export function useScrollPagination<
|
||||
</Box>
|
||||
)}
|
||||
{isEmpty && EmptyTip}
|
||||
</Box>
|
||||
</MyBox>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
"classification": "Classification",
|
||||
"click_to_resume": "Click to Resume",
|
||||
"code_editor": "Code Editor",
|
||||
"code_error.account_error": "Incorrect account name or password",
|
||||
"code_error.app_error.invalid_app_type": "Invalid Application Type",
|
||||
"code_error.app_error.invalid_owner": "Unauthorized Application Owner",
|
||||
"code_error.app_error.not_exist": "Application Does Not Exist",
|
||||
@@ -95,7 +96,6 @@
|
||||
"code_error.team_error.website_sync_not_enough": "Unauthorized to Use Website Sync",
|
||||
"code_error.token_error_code.403": "Invalid Login Status, Please Re-login",
|
||||
"code_error.user_error.balance_not_enough": "Insufficient Account Balance",
|
||||
"code_error.account_error": "Incorrect account name or password",
|
||||
"code_error.user_error.bin_visitor_guest": "You Are Currently a Guest, Unauthorized to Operate",
|
||||
"code_error.user_error.un_auth_user": "User Not Found",
|
||||
"common.Action": "Action",
|
||||
@@ -937,6 +937,8 @@
|
||||
"model_sparkdesk": "SprkDesk",
|
||||
"model_stepfun": "StepFun",
|
||||
"model_yi": "Yi",
|
||||
"model_intern": "Intern",
|
||||
"model_moka": "Moka-AI",
|
||||
"move.confirm": "Confirm move",
|
||||
"navbar.Account": "Account",
|
||||
"navbar.Chat": "Chat",
|
||||
@@ -1273,6 +1275,7 @@
|
||||
"user.team.role.Visitor": "visitor",
|
||||
"user.team.role.writer": "writable member",
|
||||
"user.type": "Type",
|
||||
"user_leaved": "Leaved",
|
||||
"verification": "Verification",
|
||||
"workflow.template.communication": "Communication",
|
||||
"xx_search_result": "{{key}} Search Results",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"append_application_reply_to_history_as_new_context": "Append the application's reply to the history as new context",
|
||||
"application_call": "Application Call",
|
||||
"assigned_reply": "Assigned Reply",
|
||||
"auth_tmb_id": "Auth member",
|
||||
"auth_tmb_id_tip": "After it is turned on, when the application is released to the outside world, the knowledge base will be filtered based on whether the user has permission to the knowledge base.\n\nIf it is not enabled, the configured knowledge base will be searched directly without permission filtering.",
|
||||
"can_not_loop": "This node can't loop.",
|
||||
"choose_another_application_to_call": "Select another application to call",
|
||||
"classification_result": "Classification Result",
|
||||
|
||||
@@ -35,5 +35,8 @@
|
||||
"user_team_invite_member": "邀请成员",
|
||||
"user_team_leave_team": "离开团队",
|
||||
"user_team_leave_team_failed": "离开团队失败",
|
||||
"waiting": "待接受"
|
||||
"waiting": "待接受",
|
||||
"sync_immediately": "立即同步",
|
||||
"sync_member_failed": "同步成员失败",
|
||||
"sync_member_success": "同步成员成功"
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
"classification": "分类",
|
||||
"click_to_resume": "点击恢复",
|
||||
"code_editor": "代码编辑",
|
||||
"code_error.account_error": "账号名或密码错误",
|
||||
"code_error.app_error.invalid_app_type": "错误的应用类型",
|
||||
"code_error.app_error.invalid_owner": "非法的应用所有者",
|
||||
"code_error.app_error.not_exist": "应用不存在",
|
||||
@@ -99,7 +100,6 @@
|
||||
"code_error.team_error.website_sync_not_enough": "无权使用Web站点同步~",
|
||||
"code_error.token_error_code.403": "登录状态无效,请重新登录",
|
||||
"code_error.user_error.balance_not_enough": "账号余额不足~",
|
||||
"code_error.account_error": "账号名或密码错误",
|
||||
"code_error.user_error.bin_visitor_guest": "您当前身份为游客,无权操作",
|
||||
"code_error.user_error.un_auth_user": "找不到该用户",
|
||||
"common.Action": "操作",
|
||||
@@ -940,6 +940,8 @@
|
||||
"model_sparkdesk": "讯飞星火",
|
||||
"model_stepfun": "阶跃星辰",
|
||||
"model_yi": "零一万物",
|
||||
"model_intern": "书生",
|
||||
"model_moka": "Moka-AI",
|
||||
"move.confirm": "确认移动",
|
||||
"navbar.Account": "账号",
|
||||
"navbar.Chat": "聊天",
|
||||
@@ -1268,6 +1270,7 @@
|
||||
"user.team.role.Visitor": "访客",
|
||||
"user.team.role.writer": "可写成员",
|
||||
"user.type": "类型",
|
||||
"user_leaved": "已离开",
|
||||
"verification": "验证",
|
||||
"workflow.template.communication": "通信",
|
||||
"xx_search_result": "{{key}} 的搜索结果",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"append_application_reply_to_history_as_new_context": "将该应用回复内容拼接到历史记录中,作为新的上下文返回",
|
||||
"application_call": "应用调用",
|
||||
"assigned_reply": "指定回复",
|
||||
"auth_tmb_id": "使用者鉴权",
|
||||
"auth_tmb_id_tip": "开启后,对外发布该应用时,还会根据用户是否有该知识库权限进行知识库过滤。\n若未开启,则直接按配置的知识库进行检索,不进行权限过滤。",
|
||||
"can_not_loop": "该节点不支持循环嵌套",
|
||||
"choose_another_application_to_call": "选择一个其他应用进行调用",
|
||||
"classification_result": "分类结果",
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
"classification": "分類",
|
||||
"click_to_resume": "點選繼續",
|
||||
"code_editor": "程式碼編輯器",
|
||||
"code_error.account_error": "帳號名稱或密碼錯誤",
|
||||
"code_error.app_error.invalid_app_type": "無效的應用程式類型",
|
||||
"code_error.app_error.invalid_owner": "非法的應用程式擁有者",
|
||||
"code_error.app_error.not_exist": "應用程式不存在",
|
||||
@@ -95,7 +96,6 @@
|
||||
"code_error.team_error.website_sync_not_enough": "無權使用網站同步",
|
||||
"code_error.token_error_code.403": "登入狀態無效,請重新登入",
|
||||
"code_error.user_error.balance_not_enough": "帳戶餘額不足",
|
||||
"code_error.account_error": "帳號名稱或密碼錯誤",
|
||||
"code_error.user_error.bin_visitor_guest": "您目前身份為訪客,無權操作",
|
||||
"code_error.user_error.un_auth_user": "找不到此使用者",
|
||||
"common.Action": "操作",
|
||||
@@ -937,6 +937,8 @@
|
||||
"model_sparkdesk": "訊飛星火",
|
||||
"model_stepfun": "階躍星辰",
|
||||
"model_yi": "零一萬物",
|
||||
"model_intern": "書生",
|
||||
"model_moka": "Moka-AI",
|
||||
"move.confirm": "確認移動",
|
||||
"navbar.Account": "帳戶",
|
||||
"navbar.Chat": "對話",
|
||||
@@ -1273,6 +1275,7 @@
|
||||
"user.team.role.Visitor": "訪客",
|
||||
"user.team.role.writer": "可寫入成員",
|
||||
"user.type": "類型",
|
||||
"user_leaved": "已離開",
|
||||
"verification": "驗證",
|
||||
"workflow.template.communication": "通訊",
|
||||
"xx_search_result": "{{key}} 的搜尋結果",
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
"append_application_reply_to_history_as_new_context": "將應用程式的回覆附加到歷史紀錄中,作為新的脈絡",
|
||||
"application_call": "應用程式呼叫",
|
||||
"assigned_reply": "指定回覆",
|
||||
"auth_tmb_id": "使用者鑑權",
|
||||
"auth_tmb_id_tip": "開啟後,對外發布應用程式時,也會根據使用者是否有該知識庫權限進行知識庫過濾。\n\n若未開啟,則直接按配置的知識庫進行檢索,不進行權限過濾。",
|
||||
"can_not_loop": "這個節點不能迴圈。",
|
||||
"choose_another_application_to_call": "選擇另一個應用程式來呼叫",
|
||||
"classification_result": "分類結果",
|
||||
|
||||
@@ -57,3 +57,5 @@ WORKFLOW_MAX_LOOP_TIMES=50
|
||||
# CHAT_LOG_INTERVAL=10000
|
||||
# # 日志来源ID前缀
|
||||
# CHAT_LOG_SOURCE_ID_PREFIX=fastgpt-
|
||||
# 自定义跨域,不配置时,默认都允许跨域(逗号分割)
|
||||
ALLOWED_ORIGINS=
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "4.8.18",
|
||||
"version": "4.8.19",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -25,7 +25,6 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import MyTag from '@fastgpt/web/components/common/Tag/index';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal'));
|
||||
@@ -237,15 +236,13 @@ const ModelTable = () => {
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{modelList.map((item) => (
|
||||
<Tr key={item.name} _hover={{ bg: 'myGray.50' }}>
|
||||
{modelList.map((item, index) => (
|
||||
<Tr key={index} _hover={{ bg: 'myGray.50' }}>
|
||||
<Td fontSize={'sm'}>
|
||||
<MyTooltip title={item.providerName}>
|
||||
<HStack>
|
||||
<Avatar src={item.avatar} w={'1.2rem'} />
|
||||
<Box color={'myGray.900'}>{item.name}</Box>
|
||||
</HStack>
|
||||
</MyTooltip>
|
||||
<HStack>
|
||||
<Avatar src={item.avatar} w={'1.2rem'} />
|
||||
<Box color={'myGray.900'}>{item.name}</Box>
|
||||
</HStack>
|
||||
</Td>
|
||||
<Td>
|
||||
<MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag>
|
||||
|
||||
@@ -54,7 +54,7 @@ const InputGuideConfig = ({
|
||||
onChange: (e: ChatInputGuideConfigType) => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { chatT, commonT } = useI18n();
|
||||
const { chatT } = useI18n();
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const {
|
||||
isOpen: isOpenLexiconConfig,
|
||||
@@ -220,7 +220,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
|
||||
});
|
||||
|
||||
const { run: createNewData, loading: isCreating } = useRequest2(
|
||||
(textList: string[]) => {
|
||||
async (textList: string[]) => {
|
||||
if (textList.filter(Boolean).length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ export type ChatProviderProps = {
|
||||
outLinkAuthData?: OutLinkChatAuthProps;
|
||||
|
||||
chatType: 'log' | 'chat' | 'share' | 'team';
|
||||
showRawSource: boolean;
|
||||
showNodeStatus: boolean;
|
||||
};
|
||||
|
||||
type useChatStoreType = ChatProviderProps & {
|
||||
@@ -132,8 +130,6 @@ const Provider = ({
|
||||
chatId,
|
||||
outLinkAuthData = {},
|
||||
chatType = 'chat',
|
||||
showRawSource,
|
||||
showNodeStatus,
|
||||
children,
|
||||
...props
|
||||
}: ChatProviderProps & {
|
||||
@@ -249,9 +245,7 @@ const Provider = ({
|
||||
chatId,
|
||||
outLinkAuthData,
|
||||
getHistoryResponseData,
|
||||
chatType,
|
||||
showRawSource,
|
||||
showNodeStatus
|
||||
chatType
|
||||
};
|
||||
|
||||
return <ChatBoxContext.Provider value={value}>{children}</ChatBoxContext.Provider>;
|
||||
|
||||
@@ -25,6 +25,7 @@ import { isEqual } from 'lodash';
|
||||
import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { formatTimeToChatItemTime } from '@fastgpt/global/common/string/time';
|
||||
import dayjs from 'dayjs';
|
||||
import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
|
||||
|
||||
const colorMap = {
|
||||
[ChatStatusEnum.loading]: {
|
||||
@@ -139,7 +140,7 @@ const ChatItem = (props: Props) => {
|
||||
|
||||
const isChatting = useContextSelector(ChatBoxContext, (v) => v.isChatting);
|
||||
const chatType = useContextSelector(ChatBoxContext, (v) => v.chatType);
|
||||
const showNodeStatus = useContextSelector(ChatBoxContext, (v) => v.showNodeStatus);
|
||||
const showNodeStatus = useContextSelector(ChatItemContext, (v) => v.showNodeStatus);
|
||||
const isChatLog = chatType === 'log';
|
||||
|
||||
const { copyData } = useCopyData();
|
||||
|
||||
@@ -9,19 +9,16 @@ import RawSourceBox from '@/components/core/dataset/RawSourceBox';
|
||||
import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
|
||||
import { useContextSelector } from 'use-context-selector';
|
||||
import { ChatBoxContext } from '../Provider';
|
||||
import { ChatItemContext } from '@/web/core/chat/context/chatItemContext';
|
||||
|
||||
const QuoteModal = ({
|
||||
rawSearch = [],
|
||||
onClose,
|
||||
canEditDataset,
|
||||
showRawSource,
|
||||
chatItemId,
|
||||
metadata
|
||||
}: {
|
||||
rawSearch: SearchDataResponseItemType[];
|
||||
onClose: () => void;
|
||||
canEditDataset: boolean;
|
||||
showRawSource: boolean;
|
||||
chatItemId: string;
|
||||
metadata?: {
|
||||
collectionId: string;
|
||||
@@ -47,6 +44,11 @@ const QuoteModal = ({
|
||||
chatItemId,
|
||||
...(v.outLinkAuthData || {})
|
||||
}));
|
||||
const showRawSource = useContextSelector(ChatItemContext, (v) => v.isShowReadRawSource);
|
||||
const showRouteToDatasetDetail = useContextSelector(
|
||||
ChatItemContext,
|
||||
(v) => v.showRouteToDatasetDetail
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -71,12 +73,7 @@ const QuoteModal = ({
|
||||
}
|
||||
>
|
||||
<ModalBody>
|
||||
<QuoteList
|
||||
rawSearch={filterResults}
|
||||
canEditDataset={canEditDataset}
|
||||
canViewSource={showRawSource}
|
||||
chatItemId={chatItemId}
|
||||
/>
|
||||
<QuoteList rawSearch={filterResults} chatItemId={chatItemId} />
|
||||
</ModalBody>
|
||||
</MyModal>
|
||||
</>
|
||||
@@ -87,14 +84,10 @@ export default QuoteModal;
|
||||
|
||||
export const QuoteList = React.memo(function QuoteList({
|
||||
chatItemId,
|
||||
rawSearch = [],
|
||||
canEditDataset,
|
||||
canViewSource
|
||||
rawSearch = []
|
||||
}: {
|
||||
chatItemId?: string;
|
||||
rawSearch: SearchDataResponseItemType[];
|
||||
canEditDataset: boolean;
|
||||
canViewSource: boolean;
|
||||
}) {
|
||||
const theme = useTheme();
|
||||
|
||||
@@ -104,6 +97,11 @@ export const QuoteList = React.memo(function QuoteList({
|
||||
chatId: v.chatId,
|
||||
...(v.outLinkAuthData || {})
|
||||
}));
|
||||
const showRawSource = useContextSelector(ChatItemContext, (v) => v.isShowReadRawSource);
|
||||
const showRouteToDatasetDetail = useContextSelector(
|
||||
ChatItemContext,
|
||||
(v) => v.showRouteToDatasetDetail
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -120,8 +118,8 @@ export const QuoteList = React.memo(function QuoteList({
|
||||
>
|
||||
<QuoteItem
|
||||
quoteItem={item}
|
||||
canViewSource={canViewSource}
|
||||
canEditDataset={canEditDataset}
|
||||
canViewSource={showRawSource}
|
||||
canEditDataset={showRouteToDatasetDetail}
|
||||
{...RawSourceBoxProps}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -49,7 +49,6 @@ const ResponseTags = ({
|
||||
const [quoteFolded, setQuoteFolded] = useState<boolean>(true);
|
||||
|
||||
const chatType = useContextSelector(ChatBoxContext, (v) => v.chatType);
|
||||
const showRawSource = useContextSelector(ChatBoxContext, (v) => v.showRawSource);
|
||||
const notSharePage = useMemo(() => chatType !== 'share', [chatType]);
|
||||
|
||||
const {
|
||||
@@ -251,8 +250,6 @@ const ResponseTags = ({
|
||||
<QuoteModal
|
||||
{...quoteModalData}
|
||||
chatItemId={historyItem.dataId}
|
||||
canEditDataset={notSharePage}
|
||||
showRawSource={showRawSource}
|
||||
onClose={() => setQuoteModalData(undefined)}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -18,7 +18,6 @@ import { Box, Checkbox } from '@chakra-ui/react';
|
||||
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
||||
import { chats2GPTMessages } from '@fastgpt/global/core/chat/adapt';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import {
|
||||
|
||||
@@ -249,14 +249,7 @@ export const WholeResponseContent = ({
|
||||
{activeModule.quoteList && activeModule.quoteList.length > 0 && (
|
||||
<Row
|
||||
label={t('common:core.chat.response.module quoteList')}
|
||||
rawDom={
|
||||
<QuoteList
|
||||
canEditDataset
|
||||
canViewSource
|
||||
chatItemId={dataId}
|
||||
rawSearch={activeModule.quoteList}
|
||||
/>
|
||||
}
|
||||
rawDom={<QuoteList chatItemId={dataId} rawSearch={activeModule.quoteList} />}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useTranslation } from 'next-i18next';
|
||||
import { getCollectionSourceAndOpen } from '@/web/core/dataset/hooks/readCollectionSource';
|
||||
import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
|
||||
import MyIcon from '@fastgpt/web/components/common/Icon';
|
||||
import { useI18n } from '@/web/context/I18n';
|
||||
import type { readCollectionSourceBody } from '@/pages/api/core/dataset/collection/read';
|
||||
|
||||
type Props = BoxProps &
|
||||
@@ -33,7 +32,6 @@ const RawSourceBox = ({
|
||||
...props
|
||||
}: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { fileT } = useI18n();
|
||||
|
||||
const canPreview = !!sourceId && canView;
|
||||
|
||||
@@ -51,7 +49,7 @@ const RawSourceBox = ({
|
||||
|
||||
return (
|
||||
<MyTooltip
|
||||
label={canPreview ? fileT('click_to_view_raw_source') : ''}
|
||||
label={canPreview ? t('file:click_to_view_raw_source') : ''}
|
||||
shouldWrapChildren={false}
|
||||
>
|
||||
<Box
|
||||
|
||||