Compare commits

..

24 Commits

Author SHA1 Message Date
Archer
93f7747904 feat: mix search weight (#4170)
* feat: mix search weight

* feat: svg render
2025-03-14 18:31:37 +08:00
heheer
6aa5e2c200 fix loadInitData refresh (#4169)
* fix

* fix

* form input number default & api dataset max token
2025-03-14 18:07:47 +08:00
Archer
d8712d4092 feat: rerank modal select and weight (#4164) 2025-03-14 14:49:27 +08:00
heheer
561a496f80 fix modal close scroll (#4162)
* fix modal close scroll

* update refresh
2025-03-14 14:21:48 +08:00
Finley Ge
bd369d3b09 chore: move all tests into a single folder (#4160) 2025-03-14 11:39:44 +08:00
Archer
3e21030536 hiden dataset source (#4152)
* hiden dataset source

* perf: reader
2025-03-13 21:30:40 +08:00
Finley Ge
7ec4ba7067 fix(i18n): namespace (#4143) 2025-03-13 19:40:54 +08:00
Finley Ge
2d22af3cce pref: copy link (#4147) 2025-03-13 19:40:53 +08:00
Archer
4346c5703a fix: prompt toolcall ui (#4139)
* load log error adapt

* fix: prompt toolcall ui

* perf: commercial function tip

* update package
2025-03-13 19:40:53 +08:00
Archer
f71ab0caeb perf: model test;perf: sidebar trigger (#4127)
* fix: import dataset step error;perf: ai proxy avatar (#4074)

* perf: pg config params

* perf: ai proxy avatar

* fix: import dataset step error

* feat: data input ux

* perf: app dataset rewite

* perf: model test

* perf: sidebar trigger

* lock

* update nanoid version

* fix: select component ux

* fix: ts

* fix: vitest

* remove test
2025-03-13 19:40:52 +08:00
heheer
c131c2a7dc fix chat quote reader (#4125) 2025-03-13 19:40:52 +08:00
Archer
d052d0de53 fix: model test channel id;fix: quote reader (#4123)
* fix: model test channel id

* fix: quote reader
2025-03-13 19:40:51 +08:00
Archer
d1ce3e2936 perf: invite member code (#4118)
* perf: invite member code

* fix: ts
2025-03-13 19:40:51 +08:00
Finley Ge
c301dafca7 feat: invitation link (#3979)
* feat: invitation link schema and apis

* feat: add invitation link

* feat: member status: active, leave, forbidden

* fix: expires show hours and minutes

* feat: invalid invitation link hint

* fix: typo

* chore: fix typo & i18n

* fix

* pref: fe

* feat: add ttl index for 30-day-clean-up
2025-03-13 19:40:50 +08:00
Archer
1a3613cd2c feat: api dataset support pdf parse;fix: chunk reader auth (#4117)
* feat: api dataset support pdf parse

* fix: chunk reader auth
2025-03-13 19:40:50 +08:00
Archer
30f83f848d perf: chunk read (#4109)
* package

* perf: chunk read
2025-03-13 19:40:49 +08:00
heheer
ac7091f8d6 chat quote reader (#3912)
* init chat quote full text reader

* linked structure

* dataset data linked

* optimize code

* fix ts build

* test finish

* delete log

* fix

* fix ts

* fix ts

* remove nextId

* initial scroll

* fix

* fix
2025-03-13 19:40:49 +08:00
Archer
16832caaf6 perf: think tag parse (#4102) 2025-03-13 19:40:49 +08:00
Archer
a3df9ea531 update doc ;perf: model test (#4098)
* perf: extract array

* update doc

* perf: model test

* perf: model test
2025-03-13 19:40:48 +08:00
shilin
bcd0b010a6 fix: 文本提取不支持arrayString,arrayNumber等jsonSchema (#4079) 2025-03-13 19:40:48 +08:00
Archer
3f794baf2e fix: import dataset step error;perf: ai proxy avatar (#4074)
* perf: pg config params

* perf: ai proxy avatar

* fix: import dataset step error

* feat: data input ux

* perf: app dataset rewite
2025-03-13 19:40:48 +08:00
archer
92b2ecc381 update package 2025-03-13 19:40:47 +08:00
gggaaallleee
4dbe41db0e fix :Get application bound knowledge base information logical rewrite (#4057)
* fix :Get application bound knowledge base information logical rewrite

* fix :Get application bound knowledge base information logical rewrite

* fix :Get application bound knowledge base information logical rewrite

* fix :Get application bound knowledge base information logical rewrite
2025-03-13 19:40:47 +08:00
Finley Ge
f9dd170895 fix: remove DefaultTeam (#4037) 2025-03-13 19:40:44 +08:00
124 changed files with 5703 additions and 5699 deletions

View File

@@ -1,6 +1,9 @@
name: Preview FastGPT images name: Preview FastGPT images
on: on:
pull_request_target: pull_request_target:
paths:
- 'projects/app/**'
- 'packages/**'
workflow_dispatch: workflow_dispatch:
jobs: jobs:

View File

@@ -7,4 +7,3 @@ docSite/
pnpm-lock.yaml pnpm-lock.yaml
cl100l_base.ts cl100l_base.ts
dict.json

View File

@@ -17,8 +17,15 @@ usageMatchRegex:
# you can ignore it and use your own matching rules as well # you can ignore it and use your own matching rules as well
- "[^\\w\\d]t\\(['\"`]({key})['\"`]" - "[^\\w\\d]t\\(['\"`]({key})['\"`]"
- "[^\\w\\d]commonT\\(['\"`]({key})['\"`]" - "[^\\w\\d]commonT\\(['\"`]({key})['\"`]"
# 支持 appT("your.i18n.keys")
- "[^\\w\\d]appT\\(['\"`]({key})['\"`]"
# 支持 datasetT("your.i18n.keys")
- "[^\\w\\d]datasetT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]fileT\\(['\"`]({key})['\"`]" - "[^\\w\\d]fileT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]publishT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]" - "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]userT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]chatT\\(['\"`]({key})['\"`]"
- "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]" - "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]"
# A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys # A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys

View File

@@ -129,7 +129,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
</a> </a>
## 🌿 第三方生态 ## 🌿 第三方生态
- [PPIO 派欧云:一键调用高性价比的开源模型 API 和 GPU 容器](https://ppinfra.com/user/register?invited_by=VITYVU&utm_source=github_fastgpt)
- [AI Proxy国内模型聚合服务](https://sealos.run/aiproxy/?k=fastgpt-github/) - [AI Proxy国内模型聚合服务](https://sealos.run/aiproxy/?k=fastgpt-github/)
- [SiliconCloud (硅基流动) —— 开源模型在线体验平台](https://cloud.siliconflow.cn/i/TR9Ym0c4) - [SiliconCloud (硅基流动) —— 开源模型在线体验平台](https://cloud.siliconflow.cn/i/TR9Ym0c4)
- [COW 个人微信/企微机器人](https://doc.tryfastgpt.ai/docs/use-cases/external-integration/onwechat/) - [COW 个人微信/企微机器人](https://doc.tryfastgpt.ai/docs/use-cases/external-integration/onwechat/)

View File

@@ -114,15 +114,15 @@ services:
# fastgpt # fastgpt
sandbox: sandbox:
container_name: sandbox container_name: sandbox
image: ghcr.io/labring/fastgpt-sandbox:v4.9.1 # git image: ghcr.io/labring/fastgpt-sandbox:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.0 # 阿里云
networks: networks:
- fastgpt - fastgpt
restart: always restart: always
fastgpt: fastgpt:
container_name: fastgpt container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.9.1 # git image: ghcr.io/labring/fastgpt:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.0 # 阿里云
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
@@ -175,8 +175,7 @@ services:
# AI Proxy # AI Proxy
aiproxy: aiproxy:
image: ghcr.io/labring/aiproxy:v0.1.3 image: 'ghcr.io/labring/aiproxy:latest'
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
container_name: aiproxy container_name: aiproxy
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:

View File

@@ -72,15 +72,15 @@ services:
# fastgpt # fastgpt
sandbox: sandbox:
container_name: sandbox container_name: sandbox
image: ghcr.io/labring/fastgpt-sandbox:v4.9.1 # git image: ghcr.io/labring/fastgpt-sandbox:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.0 # 阿里云
networks: networks:
- fastgpt - fastgpt
restart: always restart: always
fastgpt: fastgpt:
container_name: fastgpt container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.9.1 # git image: ghcr.io/labring/fastgpt:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.0 # 阿里云
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
@@ -132,8 +132,7 @@ services:
# AI Proxy # AI Proxy
aiproxy: aiproxy:
image: ghcr.io/labring/aiproxy:v0.1.3 image: 'ghcr.io/labring/aiproxy:latest'
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
container_name: aiproxy container_name: aiproxy
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:

View File

@@ -53,15 +53,15 @@ services:
wait $$! wait $$!
sandbox: sandbox:
container_name: sandbox container_name: sandbox
image: ghcr.io/labring/fastgpt-sandbox:v4.9.1 # git image: ghcr.io/labring/fastgpt-sandbox:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.0 # 阿里云
networks: networks:
- fastgpt - fastgpt
restart: always restart: always
fastgpt: fastgpt:
container_name: fastgpt container_name: fastgpt
image: ghcr.io/labring/fastgpt:v4.9.1 # git image: ghcr.io/labring/fastgpt:v4.9.0 # git
# image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.1 # 阿里云 # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.0 # 阿里云
ports: ports:
- 3000:3000 - 3000:3000
networks: networks:
@@ -113,8 +113,7 @@ services:
# AI Proxy # AI Proxy
aiproxy: aiproxy:
image: ghcr.io/labring/aiproxy:v0.1.3 image: 'ghcr.io/labring/aiproxy:latest'
# image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3 # 阿里云
container_name: aiproxy container_name: aiproxy
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

View File

@@ -56,7 +56,7 @@ weight: 707
### zilliz cloud版本 ### zilliz cloud版本
Zilliz Cloud 由 Milvus 原厂打造,是全托管的 SaaS 向量数据库服务,性能优于 Milvus 并提供 SLA点击使用 [Zilliz Cloud](https://zilliz.com.cn/)。 Milvus 的全托管服务,性能优于 Milvus 并提供 SLA点击使用 [Zilliz Cloud](https://zilliz.com.cn/)。
由于向量库使用了 Cloud无需占用本地资源无需太关注。 由于向量库使用了 Cloud无需占用本地资源无需太关注。

View File

@@ -1,100 +0,0 @@
---
title: '通过 PPIO LLM API 接入模型'
description: '通过 PPIO LLM API 接入模型'
icon: 'api'
draft: false
toc: true
weight: 747
---
FastGPT 还可以通过 PPIO LLM API 接入模型。
{{% alert context="warning" %}}
以下内容搬运自 [FastGPT 接入 PPIO LLM API](https://ppinfra.com/docs/third-party/fastgpt-use),可能会有更新不及时的情况。
{{% /alert %}}
FastGPT 是一个将 AI 开发、部署和使用全流程简化为可视化操作的平台。它使开发者不需要深入研究算法,
用户也不需要掌握复杂技术,通过一站式服务将人工智能技术变成易于使用的工具。
PPIO 派欧云提供简单易用的 API 接口,让开发者能够轻松调用 DeepSeek 等模型。
- 对开发者无需重构架构3 个接口完成从文本生成到决策推理的全场景接入,像搭积木一样设计 AI 工作流;
- 对生态:自动适配从中小应用到企业级系统的资源需求,让智能随业务自然生长。
下方教程提供完整接入方案(含密钥配置),帮助您快速将 FastGPT 与 PPIO API 连接起来。
## 1. 配置前置条件
(1) 获取 API 接口地址
固定为: `https://api.ppinfra.com/v3/openai/chat/completions`
(2) 获取 【API 密钥】
登录派欧云控制台 [API 秘钥管理](https://www.ppinfra.com/settings/key-management) 页面,点击创建按钮。
注册账号填写邀请码【VOJL20】得 50 代金券
![1](https://static.ppinfra.com/docs/image/llm/BKWqbzI5PoYG6qxwAPxcinQDnob.png)
(3) 生成并保存 【API 密钥】
{{% alert context="warning" %}}
秘钥在服务端是加密存储,请在生成时保存好秘钥;若遗失可以在控制台上删除并创建一个新的秘钥。
{{% /alert %}}
![2](https://static.ppinfra.com/docs/image/llm/OkUwbbWrcoCY2SxwVMIcM2aZnrs.png)
![3](https://static.ppinfra.com/docs/image/llm/GExfbvcosoJhVKxpzKVczlsdn3d.png)
(4) 获取需要使用的模型 ID
deepseek 系列:
- DeepSeek R1deepseek/deepseek-r1/community
- DeepSeek V3deepseek/deepseek-v3/community
其他模型 ID、最大上下文及价格可参考[模型列表](https://ppinfra.com/model-api/pricing)
## 2. 部署最新版 FastGPT 到本地环境
{{% alert context="warning" %}}
请使用 v4.8.22 以上版本,部署参考: https://doc.tryfastgpt.ai/docs/development/intro/
{{% /alert %}}
## 3. 模型配置(下面两种方式二选其一)
1通过 OneAPI 接入模型 PPIO 模型: 参考 OneAPI 使用文档,修改 FastGPT 的环境变量 在 One API 生成令牌后FastGPT 可以通过修改 baseurl 和 key 去请求到 One API再由 One API 去请求不同的模型。修改下面两个环境变量: 务必写上 v1。如果在同一个网络内可改成内网地址。
OPENAI_BASE_URL= http://OneAPI-IP:OneAPI-PORT/v1
下面的 key 是由 One API 提供的令牌 CHAT_API_KEY=sk-UyVQcpQWMU7ChTVl74B562C28e3c46Fe8f16E6D8AeF8736e
- 修改后重启 FastGPT按下图在模型提供商中选择派欧云
![](https://static.ppinfra.com/docs/image/llm/Fvqzb3kTroys5Uxkjlzco7kwnsb.png)
- 测试连通性
以 deepseek 为例,在模型中选择使用 deepseek/deepseek-r1/community点击图中②的位置进行连通性测试出现图中绿色的的成功显示证明连通成功可以进行后续的配置对话了
![](https://static.ppinfra.com/docs/image/llm/FzKGbGsSPoX4Eexobj2cxcaTnib.png)
2不使用 OneAPI 接入 PPIO 模型
按照下图在模型提供商中选择派欧云
![](https://static.ppinfra.com/docs/image/llm/QbcdbPqRsoAmuyx2nlycQWFanrc.png)
- 配置模型 自定义请求地址中输入:`https://api.ppinfra.com/v3/openai/chat/completions`
![](https://static.ppinfra.com/docs/image/llm/ZVyAbDIaxo7ksAxLI3HcexYYnZf.png)
![](https://static.ppinfra.com/docs/image/llm/Ha9YbggkwoQsVdx1Z4Gc9zUSnle.png)
- 测试连通性
![](https://static.ppinfra.com/docs/image/llm/V1f0b89uloab9uxxj7IcKT0rn3e.png)
出现图中绿色的的成功显示证明连通成功,可以进行对话配置
## 4. 配置对话
1新建工作台
![](https://static.ppinfra.com/docs/image/llm/ZaGpbBH6QoVubIx2TsLcwYEInfe.png)
2开始聊天
![](https://static.ppinfra.com/docs/image/llm/HzcTb4gobokVRQxTlU7cD5OunMf.png)
## PPIO 全新福利重磅来袭 🔥
顺利完成教程配置步骤后您将解锁两大权益1. 畅享 PPIO 高速通道与 FastGPT 的效能组合2.立即激活 **「新用户邀请奖励」** ————通过专属邀请码邀好友注册,您与好友可各领 50 元代金券,硬核福利助力 AI 工具效率倍增!
🎁 新手专享立即使用邀请码【VOJL20】完成注册50 元代金券奖励即刻到账!

View File

@@ -7,31 +7,6 @@ toc: true
weight: 799 weight: 799
--- ---
## 更新指南
### 1. 做好数据库备份
### 2. 更新镜像
- 更新 FastGPT 镜像 tag: v4.9.1
- 更新 FastGPT 商业版镜像 tag: v4.9.1
- Sandbox 镜像,可以不更新
- AIProxy 镜像修改为: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.3
### 3. 执行升级脚本
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`{{host}} 替换成**FastGPT 域名**。
```bash
curl --location --request POST 'https://{{host}}/api/admin/initv491' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```
**脚本功能**
重新使用最新的 jieba 分词库进行分词处理。时间较长,可以从日志里查看进度。
## 🚀 新增内容 ## 🚀 新增内容
1. 商业版支持单团队模式,更好的管理内部成员。 1. 商业版支持单团队模式,更好的管理内部成员。
@@ -48,7 +23,6 @@ curl --location --request POST 'https://{{host}}/api/admin/initv491' \
3. 增加依赖包安全版本检测,并升级部分依赖包。 3. 增加依赖包安全版本检测,并升级部分依赖包。
4. 模型测试代码。 4. 模型测试代码。
5. 优化思考过程解析逻辑:只要配置了模型支持思考,均会解析 <think> 标签,不会因为对话时,关闭思考而不解析。 5. 优化思考过程解析逻辑:只要配置了模型支持思考,均会解析 <think> 标签,不会因为对话时,关闭思考而不解析。
6. 载入最新 jieba 分词库,增强全文检索分词效果。
## 🐛 修复 ## 🐛 修复
@@ -60,6 +34,3 @@ curl --location --request POST 'https://{{host}}/api/admin/initv491' \
6. 模型渠道测试时,实际未指定渠道测试。 6. 模型渠道测试时,实际未指定渠道测试。
7. 新增自定义模型时,会把默认模型字段也保存,导致默认模型误判。 7. 新增自定义模型时,会把默认模型字段也保存,导致默认模型误判。
8. 修复 promp 模式工具调用,未判空思考链,导致 UI 错误展示。 8. 修复 promp 模式工具调用,未判空思考链,导致 UI 错误展示。
9. 编辑应用信息导致头像丢失。
10. 分享链接标题会被刷新掉。
11. 计算 parentPath 时,存在鉴权失败清空。

View File

@@ -1,66 +0,0 @@
---
title: "邀请链接说明文档"
description: "如何使用邀请链接来邀请团队成员"
icon: "group"
draft: false
toc: true
weight: 451
---
v4.9.1 团队邀请成员将开始使用「邀请链接」的模式,弃用之前输入用户名进行添加的形式。
在版本升级后,原收到邀请还未加入团队的成员,将自动清除邀请。请使用邀请链接重新邀请成员。
## 如何使用
1. **在团队管理页面,管理员可点击「邀请成员」按钮打开邀请成员弹窗**
![](/imgs/guide/team_permissions/invitation_link/image1.png)
2. **在邀请成员弹窗中,点击「创建邀请链接」按钮,创建邀请链接。**
![](/imgs/guide/team_permissions/invitation_link/image2.png)
3. **输入对应内容**
![](/imgs/guide/team_permissions/invitation_link/image3.png)
链接描述:建议将链接描述为使用场景或用途。链接创建后不支持修改噢。
有效期30分钟7天1年
有效人数1人无限制
4. **点击复制链接,并将其发送给想要邀请的人。**
![](/imgs/guide/team_permissions/invitation_link/image4.png)
5. **用户访问链接后,如果未登录/未注册,则先跳转到登录页面进行登录。在登录后将进入团队页面,处理邀请。**
> 邀请链接形如fastgpt.cn/account/team?invitelinkid=xxxx
![](/imgs/guide/team_permissions/invitation_link/image5.png)
点击接受,则用户将加入团队
点击忽略,则关闭弹窗,用户下次访问该邀请链接则还可以选择加入。
## 链接失效和自动清理
### 链接失效原因
手动停用链接
邀请链接到达有效期,自动停用
有效人数为1人的链接已有1人通过邀请链接加入团队。
停用的链接无法访问,也无法再次启用。
### 链接上限
一个用户最多可以同时存在 10 个**有效的**邀请链接。
### 链接自动清理
失效的链接将在 30 天后自动清理。

View File

@@ -20,9 +20,9 @@
"@chakra-ui/cli": "^2.4.1", "@chakra-ui/cli": "^2.4.1",
"@vitest/coverage-v8": "^3.0.2", "@vitest/coverage-v8": "^3.0.2",
"husky": "^8.0.3", "husky": "^8.0.3",
"i18next": "23.16.8", "i18next": "23.11.5",
"lint-staged": "^13.3.0", "lint-staged": "^13.3.0",
"next-i18next": "15.4.2", "next-i18next": "15.3.0",
"prettier": "3.2.4", "prettier": "3.2.4",
"react-i18next": "14.1.2", "react-i18next": "14.1.2",
"vitest": "^3.0.2", "vitest": "^3.0.2",

View File

@@ -1,8 +1,3 @@
export type GetPathProps = {
sourceId?: ParentIdType;
type: 'current' | 'parent';
};
export type ParentTreePathItemType = { export type ParentTreePathItemType = {
parentId: string; parentId: string;
parentName: string; parentName: string;

View File

@@ -10,7 +10,7 @@
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"jschardet": "3.1.1", "jschardet": "3.1.1",
"nanoid": "^5.1.3", "nanoid": "^5.1.3",
"next": "14.2.24", "next": "14.2.21",
"openai": "4.61.0", "openai": "4.61.0",
"openapi-types": "^12.1.3", "openapi-types": "^12.1.3",
"json5": "^2.2.3", "json5": "^2.2.3",

View File

@@ -76,7 +76,7 @@ export const refreshSourceAvatar = async (
const newId = getIdFromPath(path); const newId = getIdFromPath(path);
const oldId = getIdFromPath(oldPath); const oldId = getIdFromPath(oldPath);
if (!newId || newId === oldId) return; if (!newId) return;
await MongoImage.updateOne({ _id: newId }, { $unset: { expiredTime: 1 } }, { session }); await MongoImage.updateOne({ _id: newId }, { $unset: { expiredTime: 1 } }, { session });

View File

@@ -1,13 +1,4 @@
import { Jieba } from '@node-rs/jieba'; import { cut } from '@node-rs/jieba';
let jieba: Jieba | undefined;
(async () => {
const dictData = await import('./dict.json');
// @ts-ignore
const dictBuffer = Buffer.from(dictData.dict?.replace(/\\n/g, '\n'), 'utf-8');
jieba = Jieba.withDict(dictBuffer);
})();
const stopWords = new Set([ const stopWords = new Set([
'--', '--',
@@ -1518,10 +1509,8 @@ const stopWords = new Set([
] ]
]); ]);
export async function jiebaSplit({ text }: { text: string }) { export function jiebaSplit({ text }: { text: string }) {
text = text.replace(/[#*`_~>[\](){}|]/g, '').replace(/\S*https?\S*/gi, ''); const tokens = cut(text, true);
const tokens = (await jieba!.cutAsync(text, true)) as string[];
return ( return (
tokens tokens

File diff suppressed because one or more lines are too long

View File

@@ -30,8 +30,6 @@ export const isInternalAddress = (url: string): boolean => {
return true; return true;
} }
if (process.env.CHECK_INTERNAL_IP !== 'true') return false;
// For IP addresses, check if they are internal // For IP addresses, check if they are internal
const ipv4Pattern = /^(\d{1,3}\.){3}\d{1,3}$/; const ipv4Pattern = /^(\d{1,3}\.){3}\d{1,3}$/;
if (!ipv4Pattern.test(hostname)) { if (!ipv4Pattern.test(hostname)) {

View File

@@ -41,7 +41,7 @@ try {
} }
); );
DatasetDataTextSchema.index({ teamId: 1, datasetId: 1, collectionId: 1 }); DatasetDataTextSchema.index({ teamId: 1, datasetId: 1, collectionId: 1 });
DatasetDataTextSchema.index({ dataId: 'hashed' }); DatasetDataTextSchema.index({ dataId: 1 }, { unique: true });
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@@ -86,8 +86,7 @@ const DatasetDataSchema = new Schema({
// Abandon // Abandon
fullTextToken: String, fullTextToken: String,
initFullText: Boolean, initFullText: Boolean
initJieba: Boolean
}); });
try { try {
@@ -104,9 +103,6 @@ try {
DatasetDataSchema.index({ updateTime: 1 }); DatasetDataSchema.index({ updateTime: 1 });
// rebuild data // rebuild data
DatasetDataSchema.index({ rebuilding: 1, teamId: 1, datasetId: 1 }); DatasetDataSchema.index({ rebuilding: 1, teamId: 1, datasetId: 1 });
// 为查询 initJieba 字段不存在的数据添加索引
DatasetDataSchema.index({ initJieba: 1, updateTime: 1 });
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@@ -16,7 +16,7 @@ import { reRankRecall } from '../../../core/ai/rerank';
import { countPromptTokens } from '../../../common/string/tiktoken/index'; import { countPromptTokens } from '../../../common/string/tiktoken/index';
import { datasetSearchResultConcat } from '@fastgpt/global/core/dataset/search/utils'; import { datasetSearchResultConcat } from '@fastgpt/global/core/dataset/search/utils';
import { hashStr } from '@fastgpt/global/common/string/tools'; import { hashStr } from '@fastgpt/global/common/string/tools';
import { jiebaSplit } from '../../../common/string/jieba/index'; import { jiebaSplit } from '../../../common/string/jieba';
import { getCollectionSourceData } from '@fastgpt/global/core/dataset/collection/utils'; import { getCollectionSourceData } from '@fastgpt/global/core/dataset/collection/utils';
import { Types } from '../../../common/mongo'; import { Types } from '../../../common/mongo';
import json5 from 'json5'; import json5 from 'json5';
@@ -537,7 +537,7 @@ export async function searchDatasetData(
$match: { $match: {
teamId: new Types.ObjectId(teamId), teamId: new Types.ObjectId(teamId),
datasetId: new Types.ObjectId(id), datasetId: new Types.ObjectId(id),
$text: { $search: await jiebaSplit({ text: query }) }, $text: { $search: jiebaSplit({ text: query }) },
...(filterCollectionIdList ...(filterCollectionIdList
? { ? {
collectionId: { collectionId: {

View File

@@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@fastgpt/global": "workspace:*", "@fastgpt/global": "workspace:*",
"@node-rs/jieba": "2.0.1", "@node-rs/jieba": "1.10.0",
"@xmldom/xmldom": "^0.8.10", "@xmldom/xmldom": "^0.8.10",
"@zilliz/milvus2-sdk-node": "2.4.2", "@zilliz/milvus2-sdk-node": "2.4.2",
"axios": "^1.8.2", "axios": "^1.8.2",
@@ -26,7 +26,7 @@
"mammoth": "^1.6.0", "mammoth": "^1.6.0",
"mongoose": "^8.10.1", "mongoose": "^8.10.1",
"multer": "1.4.5-lts.1", "multer": "1.4.5-lts.1",
"next": "14.2.24", "next": "14.2.21",
"nextjs-cors": "^2.2.0", "nextjs-cors": "^2.2.0",
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"node-xlsx": "^0.24.0", "node-xlsx": "^0.24.0",

View File

@@ -1,4 +1,4 @@
import { I18nNsType } from '@fastgpt/web/types/i18next'; import { I18nNsType } from '../../types/i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
export const serviceSideProps = async (content: any, ns: I18nNsType = []) => { export const serviceSideProps = async (content: any, ns: I18nNsType = []) => {
@@ -9,7 +9,7 @@ export const serviceSideProps = async (content: any, ns: I18nNsType = []) => {
const deviceSize = content.req?.cookies?.NEXT_DEVICE_SIZE || null; const deviceSize = content.req?.cookies?.NEXT_DEVICE_SIZE || null;
return { return {
...(await serverSideTranslations(lang, ['common', ...ns], undefined, extraLng)), ...(await serverSideTranslations(lang, ['common', ...ns], null, extraLng)),
deviceSize deviceSize
}; };
}; };

View File

@@ -44,7 +44,7 @@ export const useI18nLng = () => {
await i18n?.changeLanguage?.(lang); await i18n?.changeLanguage?.(lang);
if (!i18n?.hasResourceBundle?.(lang, 'common') && prevLang !== lang) { if (!i18n.hasResourceBundle(lang, 'common') && prevLang !== lang) {
window?.location?.reload?.(); window?.location?.reload?.();
} }
}; };

View File

@@ -82,7 +82,7 @@
"logs_chat_user": "user", "logs_chat_user": "user",
"logs_empty": "No logs yet~", "logs_empty": "No logs yet~",
"logs_export_confirm_tip": "There are a total of {{total}} dialogue records, confirm the export?", "logs_export_confirm_tip": "There are a total of {{total}} dialogue records, confirm the export?",
"logs_export_title": "Time, source, user, contact, title, total number of messages, user good feedback, user bad feedback, custom feedback, labeled answers, conversation details", "logs_export_title": "Time, source, user, title, total number of messages, user feedback, custom feedback, number of labeled answers, conversation details",
"logs_message_total": "Total Messages", "logs_message_total": "Total Messages",
"logs_source": "source", "logs_source": "source",
"logs_title": "Title", "logs_title": "Title",

View File

@@ -82,7 +82,7 @@
"logs_chat_user": "使用者", "logs_chat_user": "使用者",
"logs_empty": "还没有日志噢~", "logs_empty": "还没有日志噢~",
"logs_export_confirm_tip": "当前共 {{total}} 条对话记录,确认导出?", "logs_export_confirm_tip": "当前共 {{total}} 条对话记录,确认导出?",
"logs_export_title": "时间,来源,使用者,联系方式,标题,消息总数,用户赞同反馈,用户反对反馈,自定义反馈,标注答案,对话详情", "logs_export_title": "时间,来源,使用者,标题,消息总数,用户反馈,自定义反馈,标注答案数量,对话详情",
"logs_message_total": "消息总数", "logs_message_total": "消息总数",
"logs_source": "来源", "logs_source": "来源",
"logs_title": "标题", "logs_title": "标题",

View File

@@ -82,7 +82,7 @@
"logs_chat_user": "使用者", "logs_chat_user": "使用者",
"logs_empty": "還沒有紀錄喔~", "logs_empty": "還沒有紀錄喔~",
"logs_export_confirm_tip": "當前共 {{total}} 條對話記錄,確認導出?", "logs_export_confirm_tip": "當前共 {{total}} 條對話記錄,確認導出?",
"logs_export_title": "時間,來源,使用者,聯繫方式,標題,消息總數,用戶贊同反饋,用戶反對反饋,自定義反饋,標註答案,對話詳情", "logs_export_title": "時間,來源,使用者,標題,消息總數,用戶反饋,自定義反饋,標註答案數量,對話詳情",
"logs_message_total": "訊息總數", "logs_message_total": "訊息總數",
"logs_source": "来源", "logs_source": "来源",
"logs_title": "標題", "logs_title": "標題",

View File

@@ -4,8 +4,8 @@
"dependencies": { "dependencies": {
"@chakra-ui/anatomy": "2.2.1", "@chakra-ui/anatomy": "2.2.1",
"@chakra-ui/icons": "2.1.1", "@chakra-ui/icons": "2.1.1",
"@chakra-ui/next-js": "2.4.2", "@chakra-ui/next-js": "2.1.5",
"@chakra-ui/react": "2.10.7", "@chakra-ui/react": "2.8.1",
"@chakra-ui/styled-system": "2.9.1", "@chakra-ui/styled-system": "2.9.1",
"@chakra-ui/system": "2.6.1", "@chakra-ui/system": "2.6.1",
"@emotion/react": "11.11.1", "@emotion/react": "11.11.1",
@@ -21,11 +21,11 @@
"ahooks": "^3.7.11", "ahooks": "^3.7.11",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"i18next": "23.16.8", "i18next": "23.11.5",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"lexical": "0.12.6", "lexical": "0.12.6",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"next-i18next": "15.4.2", "next-i18next": "15.3.0",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"react": "18.3.1", "react": "18.3.1",
"react-beautiful-dnd": "^13.1.1", "react-beautiful-dnd": "^13.1.1",

10264
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -52,8 +52,6 @@ USE_IP_LIMIT=false
WORKFLOW_MAX_RUN_TIMES=500 WORKFLOW_MAX_RUN_TIMES=500
# 循环最大运行次数,避免极端的死循环情况 # 循环最大运行次数,避免极端的死循环情况
WORKFLOW_MAX_LOOP_TIMES=50 WORKFLOW_MAX_LOOP_TIMES=50
# 启用内网 IP 检查
CHECK_INTERNAL_IP=false
# 对话日志推送服务 # 对话日志推送服务
# # 日志服务地址 # # 日志服务地址

View File

@@ -1,6 +1,8 @@
//next-i18next.config.js
/** /**
* @type {import('next-i18next').UserConfig} * @type {import('next-i18next').UserConfig}
*/ */
module.exports = { module.exports = {
i18n: { i18n: {
defaultLocale: 'en', defaultLocale: 'en',

View File

@@ -1,4 +1,4 @@
const { i18n } = require('./next-i18next.config.js'); const { i18n } = require('./next-i18next.config');
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
@@ -30,6 +30,10 @@ const nextConfig = {
test: /\.svg$/i, test: /\.svg$/i,
issuer: /\.[jt]sx?$/, issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'] use: ['@svgr/webpack']
},
{
test: /\.node$/,
use: [{ loader: 'nextjs-node-loader' }]
} }
]), ]),
exprContextCritical: false, exprContextCritical: false,
@@ -41,7 +45,6 @@ const nextConfig = {
} }
if (isServer) { if (isServer) {
config.externals.push('@node-rs/jieba');
if (nextRuntime === 'nodejs') { if (nextRuntime === 'nodejs') {
const oldEntry = config.entry; const oldEntry = config.entry;
config = { config = {
@@ -76,15 +79,14 @@ const nextConfig = {
return config; return config;
}, },
// 需要转译的包 transpilePackages: ['@fastgpt/*', 'ahooks'],
transpilePackages: ['@fastgpt/global', '@fastgpt/web', 'ahooks'],
experimental: { experimental: {
// 优化 Server Components 的构建和运行,避免不必要的客户端打包。 // 优化 Server Components 的构建和运行,避免不必要的客户端打包。
serverComponentsExternalPackages: [ serverComponentsExternalPackages: [
'mongoose', 'mongoose',
'pg', 'pg',
'@zilliz/milvus2-sdk-node', '@node-rs/jieba',
"tiktoken", '@zilliz/milvus2-sdk-node'
], ],
outputFileTracingRoot: path.join(__dirname, '../../'), outputFileTracingRoot: path.join(__dirname, '../../'),
instrumentationHook: true instrumentationHook: true

View File

@@ -11,8 +11,8 @@
"dependencies": { "dependencies": {
"@chakra-ui/anatomy": "2.2.1", "@chakra-ui/anatomy": "2.2.1",
"@chakra-ui/icons": "2.1.1", "@chakra-ui/icons": "2.1.1",
"@chakra-ui/next-js": "2.4.2", "@chakra-ui/next-js": "2.1.5",
"@chakra-ui/react": "2.10.7", "@chakra-ui/react": "2.8.1",
"@chakra-ui/styled-system": "2.9.1", "@chakra-ui/styled-system": "2.9.1",
"@chakra-ui/system": "2.6.1", "@chakra-ui/system": "2.6.1",
"@emotion/react": "11.11.1", "@emotion/react": "11.11.1",
@@ -23,7 +23,9 @@
"@fastgpt/templates": "workspace:*", "@fastgpt/templates": "workspace:*",
"@fastgpt/web": "workspace:*", "@fastgpt/web": "workspace:*",
"@fortaine/fetch-event-source": "^3.0.6", "@fortaine/fetch-event-source": "^3.0.6",
"@node-rs/jieba": "1.10.0",
"@tanstack/react-query": "^4.24.10", "@tanstack/react-query": "^4.24.10",
"@types/nprogress": "^0.2.0",
"ahooks": "^3.7.11", "ahooks": "^3.7.11",
"axios": "^1.8.2", "axios": "^1.8.2",
"date-fns": "2.30.0", "date-fns": "2.30.0",
@@ -33,7 +35,7 @@
"formidable": "^2.1.1", "formidable": "^2.1.1",
"framer-motion": "9.1.7", "framer-motion": "9.1.7",
"hyperdown": "^2.4.29", "hyperdown": "^2.4.29",
"i18next": "23.16.8", "i18next": "23.11.5",
"immer": "^9.0.19", "immer": "^9.0.19",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"json5": "^2.2.3", "json5": "^2.2.3",
@@ -42,8 +44,9 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mermaid": "^10.2.3", "mermaid": "^10.2.3",
"nanoid": "^5.1.3", "nanoid": "^5.1.3",
"next": "14.2.24", "next": "14.2.21",
"next-i18next": "15.4.2", "next-i18next": "15.3.0",
"nextjs-node-loader": "^1.1.5",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"react": "18.3.1", "react": "18.3.1",
@@ -64,7 +67,6 @@
"request-ip": "^3.3.0", "request-ip": "^3.3.0",
"sass": "^1.58.3", "sass": "^1.58.3",
"use-context-selector": "^1.4.4", "use-context-selector": "^1.4.4",
"@node-rs/jieba": "2.0.1",
"zustand": "^4.3.5" "zustand": "^4.3.5"
}, },
"devDependencies": { "devDependencies": {
@@ -74,7 +76,6 @@
"@types/jsonwebtoken": "^9.0.3", "@types/jsonwebtoken": "^9.0.3",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/node": "^20.14.2", "@types/node": "^20.14.2",
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"@types/react": "18.3.1", "@types/react": "18.3.1",
"@types/react-dom": "18.3.0", "@types/react-dom": "18.3.0",
@@ -82,6 +83,7 @@
"@types/request-ip": "^0.0.37", "@types/request-ip": "^0.0.37",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-config-next": "14.2.24", "eslint-config-next": "14.2.24",
"nextjs-node-loader": "^1.1.5",
"typescript": "^5.1.3", "typescript": "^5.1.3",
"vitest": "^3.0.2" "vitest": "^3.0.2"
} }

View File

@@ -96,7 +96,7 @@ function Code(e: any) {
if (codeType === CodeClassNameEnum.guide) { if (codeType === CodeClassNameEnum.guide) {
return <ChatGuide text={strChildren} />; return <ChatGuide text={strChildren} />;
} }
if (codeType === CodeClassNameEnum.questionguide) { if (codeType === CodeClassNameEnum.questionGuide) {
return <QuestionGuide text={strChildren} />; return <QuestionGuide text={strChildren} />;
} }
if (codeType === CodeClassNameEnum.echarts) { if (codeType === CodeClassNameEnum.echarts) {

View File

@@ -1,6 +1,6 @@
export enum CodeClassNameEnum { export enum CodeClassNameEnum {
guide = 'guide', guide = 'guide',
questionguide = 'questionguide', questionGuide = 'questionGuide',
mermaid = 'mermaid', mermaid = 'mermaid',
echarts = 'echarts', echarts = 'echarts',
quote = 'quote', quote = 'quote',

View File

@@ -1,6 +1,6 @@
import { LOGO_ICON } from '@fastgpt/global/common/system/constants'; import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
import Head from 'next/head'; import Head from 'next/head';
import React, { useMemo } from 'react'; import React, { useEffect, useMemo } from 'react';
const NextHead = ({ title, icon, desc }: { title?: string; icon?: string; desc?: string }) => { const NextHead = ({ title, icon, desc }: { title?: string; icon?: string; desc?: string }) => {
const formatIcon = useMemo(() => { const formatIcon = useMemo(() => {
@@ -11,6 +11,13 @@ const NextHead = ({ title, icon, desc }: { title?: string; icon?: string; desc?:
return LOGO_ICON; return LOGO_ICON;
}, [icon]); }, [icon]);
useEffect(() => {
// Force update document title
if (title) {
document.title = title;
}
}, [title]);
return ( return (
<Head> <Head>
<title>{title}</title> <title>{title}</title>

View File

@@ -40,13 +40,18 @@ export const DatasetSelectModal = ({
const { paths, setParentId, datasets, isFetching } = useDatasetSelect(); const { paths, setParentId, datasets, isFetching } = useDatasetSelect();
const { Loading } = useLoading(); const { Loading } = useLoading();
const unSelectedDatasets = useMemo(() => { const filterDatasets = useMemo(() => {
return datasets.filter( const filtered = {
(item) => !selectedDatasets.some((dataset) => dataset.datasetId === item._id) selected: datasets.filter((item) =>
); selectedDatasets.find((dataset) => dataset.datasetId === item._id)
),
unSelected: datasets.filter(
(item) => !selectedDatasets.find((dataset) => dataset.datasetId === item._id)
)
};
return filtered;
}, [datasets, selectedDatasets]); }, [datasets, selectedDatasets]);
const activeVectorModel = defaultSelectedDatasets[0]?.vectorModel?.model;
const activeVectorModel = selectedDatasets[0]?.vectorModel?.model;
return ( return (
<DatasetSelectContainer <DatasetSelectContainer
@@ -66,11 +71,11 @@ export const DatasetSelectModal = ({
]} ]}
gridGap={3} gridGap={3}
> >
{selectedDatasets.map((item) => {filterDatasets.selected.map((item) =>
(() => { (() => {
return ( return (
<Card <Card
key={item.datasetId} key={item._id}
p={3} p={3}
border={theme.borders.base} border={theme.borders.base}
boxShadow={'sm'} boxShadow={'sm'}
@@ -88,7 +93,7 @@ export const DatasetSelectModal = ({
_hover={{ color: 'red.500' }} _hover={{ color: 'red.500' }}
onClick={() => { onClick={() => {
setSelectedDatasets((state) => setSelectedDatasets((state) =>
state.filter((dataset) => dataset.datasetId !== item.datasetId) state.filter((dataset) => dataset.datasetId !== item._id)
); );
}} }}
/> />
@@ -99,7 +104,7 @@ export const DatasetSelectModal = ({
)} )}
</Grid> </Grid>
{selectedDatasets.length > 0 && <Divider my={3} />} {filterDatasets.selected.length > 0 && <Divider my={3} />}
<Grid <Grid
gridTemplateColumns={[ gridTemplateColumns={[
@@ -109,7 +114,7 @@ export const DatasetSelectModal = ({
]} ]}
gridGap={3} gridGap={3}
> >
{unSelectedDatasets.map((item) => {filterDatasets.unSelected.map((item) =>
(() => { (() => {
return ( return (
<MyTooltip <MyTooltip
@@ -169,9 +174,7 @@ export const DatasetSelectModal = ({
alignItems={'center'} alignItems={'center'}
fontSize={'sm'} fontSize={'sm'}
color={ color={
activeVectorModel === item.vectorModel.model activeVectorModel === item.vectorModel.name ? 'primary.600' : 'myGray.500'
? 'primary.600'
: 'myGray.500'
} }
> >
{item.type === DatasetTypeEnum.folder ? ( {item.type === DatasetTypeEnum.folder ? (
@@ -189,14 +192,21 @@ export const DatasetSelectModal = ({
})() })()
)} )}
</Grid> </Grid>
{unSelectedDatasets.length === 0 && <EmptyTip text={t('common:common.folder.empty')} />} {filterDatasets.unSelected.length === 0 && (
<EmptyTip text={t('common:common.folder.empty')} />
)}
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button <Button
onClick={() => { onClick={() => {
// filter out the dataset that is not in the kList
const filterDatasets = selectedDatasets.filter((dataset) => {
return datasets.find((item) => item._id === dataset.datasetId);
});
onClose(); onClose();
onChange(selectedDatasets); onChange(filterDatasets);
}} }}
> >
{t('common:common.Done')} {t('common:common.Done')}

View File

@@ -54,6 +54,7 @@ const InputGuideConfig = ({
onChange: (e: ChatInputGuideConfigType) => void; onChange: (e: ChatInputGuideConfigType) => void;
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { chatT } = useI18n();
const { isOpen, onOpen, onClose } = useDisclosure(); const { isOpen, onOpen, onClose } = useDisclosure();
const { const {
isOpen: isOpenLexiconConfig, isOpen: isOpenLexiconConfig,
@@ -86,11 +87,11 @@ const InputGuideConfig = ({
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<MyIcon name={'core/app/inputGuides'} mr={2} w={'20px'} /> <MyIcon name={'core/app/inputGuides'} mr={2} w={'20px'} />
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<FormLabel color={'myGray.600'}>{t('chat:input_guide')}</FormLabel> <FormLabel color={'myGray.600'}>{chatT('input_guide')}</FormLabel>
<ChatFunctionTip type={'inputGuide'} /> <ChatFunctionTip type={'inputGuide'} />
</Flex> </Flex>
<Box flex={1} /> <Box flex={1} />
<MyTooltip label={t('chat:config_input_guide')}> <MyTooltip label={chatT('config_input_guide')}>
<Button <Button
variant={'transparentBase'} variant={'transparentBase'}
iconSpacing={1} iconSpacing={1}
@@ -103,7 +104,7 @@ const InputGuideConfig = ({
</Button> </Button>
</MyTooltip> </MyTooltip>
<MyModal <MyModal
title={t('chat:input_guide')} title={chatT('input_guide')}
iconSrc="core/app/inputGuides" iconSrc="core/app/inputGuides"
isOpen={isOpen} isOpen={isOpen}
onClose={onClose} onClose={onClose}
@@ -125,7 +126,7 @@ const InputGuideConfig = ({
{isOpenQuestionGuide && ( {isOpenQuestionGuide && (
<> <>
<Flex mt={8} alignItems={'center'}> <Flex mt={8} alignItems={'center'}>
<FormLabel>{t('chat:input_guide_lexicon')}</FormLabel> <FormLabel>{chatT('input_guide_lexicon')}</FormLabel>
<Box fontSize={'xs'} px={2} bg={'myGray.100'} ml={1} rounded={'full'}> <Box fontSize={'xs'} px={2} bg={'myGray.100'} ml={1} rounded={'full'}>
{total} {total}
</Box> </Box>
@@ -143,7 +144,7 @@ const InputGuideConfig = ({
</Flex> </Flex>
<> <>
<Flex mt={8} alignItems={'center'}> <Flex mt={8} alignItems={'center'}>
<FormLabel>{t('chat:custom_input_guide_url')}</FormLabel> <FormLabel>{chatT('custom_input_guide_url')}</FormLabel>
<Flex <Flex
onClick={() => window.open(getDocPath('/docs/guide/course/chat_input_guide/'))} onClick={() => window.open(getDocPath('/docs/guide/course/chat_input_guide/'))}
color={'primary.700'} color={'primary.700'}
@@ -180,7 +181,7 @@ const InputGuideConfig = ({
export default React.memo(InputGuideConfig); export default React.memo(InputGuideConfig);
const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () => void }) => { const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () => void }) => {
const { commonT } = useI18n(); const { chatT, commonT } = useI18n();
const { t } = useTranslation(); const { t } = useTranslation();
const { toast } = useToast(); const { toast } = useToast();
const { File, onOpen: onOpenSelectFile } = useSelectFile({ const { File, onOpen: onOpenSelectFile } = useSelectFile({
@@ -231,7 +232,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
if (res.insertLength < textList.length) { if (res.insertLength < textList.length) {
toast({ toast({
status: 'warning', status: 'warning',
title: t('chat:insert_input_guide,_some_data_already_exists', { len: res.insertLength }) title: chatT('insert_input_guide,_some_data_already_exists', { len: res.insertLength })
}); });
} else { } else {
toast({ toast({
@@ -300,7 +301,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
return ( return (
<MyModal <MyModal
title={t('chat:config_input_guide_lexicon_title')} title={chatT('config_input_guide_lexicon_title')}
iconSrc="core/app/inputGuides" iconSrc="core/app/inputGuides"
isOpen={true} isOpen={true}
onClose={onClose} onClose={onClose}
@@ -337,7 +338,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
}); });
}} }}
> >
<QuestionTip ml={-2} label={t('chat:csv_input_lexicon_tip')} /> <QuestionTip ml={-2} label={chatT('csv_input_lexicon_tip')} />
</Box> </Box>
</Flex> </Flex>
<Box px={8}> <Box px={8}>
@@ -393,7 +394,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
<MyInput <MyInput
autoFocus autoFocus
rightIcon={<MyIcon name={'save'} w={'14px'} cursor={'pointer'} />} rightIcon={<MyIcon name={'save'} w={'14px'} cursor={'pointer'} />}
placeholder={t('chat:new_input_guide_lexicon')} placeholder={chatT('new_input_guide_lexicon')}
onBlur={(e) => { onBlur={(e) => {
createNewData([e.target.value.trim()]); createNewData([e.target.value.trim()]);
}} }}
@@ -410,7 +411,7 @@ const LexiconConfigModal = ({ appId, onClose }: { appId: string; onClose: () =>
px={8} px={8}
flex={'1 0 0'} flex={'1 0 0'}
fontSize={'sm'} fontSize={'sm'}
EmptyChildren={<EmptyTip text={t('chat:chat_input_guide_lexicon_is_empty')} />} EmptyChildren={<EmptyTip text={chatT('chat_input_guide_lexicon_is_empty')} />}
> >
{scrollDataList.map((data, index) => { {scrollDataList.map((data, index) => {
const item = data.data; const item = data.data;

View File

@@ -22,6 +22,7 @@ export default function InputGuideBox({
onSend: (text: string) => void; onSend: (text: string) => void;
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
const { chatT } = useI18n();
const chatInputGuide = useContextSelector(ChatBoxContext, (v) => v.chatInputGuide); const chatInputGuide = useContextSelector(ChatBoxContext, (v) => v.chatInputGuide);
const outLinkAuthData = useContextSelector(ChatBoxContext, (v) => v.outLinkAuthData); const outLinkAuthData = useContextSelector(ChatBoxContext, (v) => v.outLinkAuthData);
@@ -64,9 +65,9 @@ export default function InputGuideBox({
> >
<Flex alignItems={'center'} fontSize={'sm'} color={'myGray.600'} gap={2} mb={2} px={2}> <Flex alignItems={'center'} fontSize={'sm'} color={'myGray.600'} gap={2} mb={2} px={2}>
<MyIcon name={'union'} /> <MyIcon name={'union'} />
<Box>{t('chat:input_guide')}</Box> <Box>{chatT('input_guide')}</Box>
</Flex> </Flex>
{data.map((item) => ( {data.map((item, index) => (
<Flex <Flex
alignItems={'center'} alignItems={'center'}
as={'li'} as={'li'}

View File

@@ -59,7 +59,7 @@ type Props = BasicProps & {
const RenderQuestionGuide = ({ questionGuides }: { questionGuides: string[] }) => { const RenderQuestionGuide = ({ questionGuides }: { questionGuides: string[] }) => {
return ( return (
<Markdown <Markdown
source={`\`\`\`${CodeClassNameEnum.questionguide} source={`\`\`\`${CodeClassNameEnum.questionGuide}
${JSON.stringify(questionGuides)}`} ${JSON.stringify(questionGuides)}`}
/> />
); );

View File

@@ -3,10 +3,11 @@ import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import React from 'react'; import React from 'react';
import { DatasetTypeMap } from '@fastgpt/global/core/dataset/constants'; import { DatasetTypeMap } from '@fastgpt/global/core/dataset/constants';
import { useTranslation } from 'next-i18next'; import { useI18n } from '@/web/context/I18n';
const DatasetTypeTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & FlexProps) => { const DatasetTypeTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & FlexProps) => {
const { t } = useTranslation(); const { datasetT } = useI18n();
const item = DatasetTypeMap[type] || DatasetTypeMap['dataset']; const item = DatasetTypeMap[type] || DatasetTypeMap['dataset'];
return ( return (
@@ -23,7 +24,8 @@ const DatasetTypeTag = ({ type, ...props }: { type: `${DatasetTypeEnum}` } & Fle
{...props} {...props}
> >
<MyIcon name={item.icon as any} w={'16px'} mr={2} color={'myGray.400'} /> <MyIcon name={item.icon as any} w={'16px'} mr={2} color={'myGray.400'} />
<Box>{t(item.label as any)}</Box> {/* @ts-ignore */}
<Box>{datasetT(item.label)}</Box>
</Flex> </Flex>
); );
}; };

View File

@@ -6,7 +6,6 @@ import { useTranslation } from 'next-i18next';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import ParentPaths from '@/components/common/ParentPaths'; import ParentPaths from '@/components/common/ParentPaths';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
type PathItemType = { type PathItemType = {
parentId: string; parentId: string;
@@ -71,16 +70,8 @@ const DatasetSelectContainer = ({
export function useDatasetSelect() { export function useDatasetSelect() {
const [parentId, setParentId] = useState<string>(''); const [parentId, setParentId] = useState<string>('');
const { data, loading: isFetching } = useRequest2( const { data, isFetching } = useQuery(['loadDatasetData', parentId], () =>
() => Promise.all([getDatasets({ parentId }), getDatasetPaths(parentId)])
Promise.all([
getDatasets({ parentId }),
getDatasetPaths({ sourceId: parentId, type: 'current' })
]),
{
manual: false,
refreshDeps: [parentId]
}
); );
const paths = useMemo(() => [...(data?.[1] || [])], [data]); const paths = useMemo(() => [...(data?.[1] || [])], [data]);

View File

@@ -1,12 +1,14 @@
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { Box, ButtonProps } from '@chakra-ui/react'; import { Box, ButtonProps, Flex } from '@chakra-ui/react';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import Avatar from '@fastgpt/web/components/common/Avatar';
import { getTeamList, putSwitchTeam } from '@/web/support/user/team/api'; import { getTeamList, putSwitchTeam } from '@/web/support/user/team/api';
import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant'; import { TeamMemberStatusEnum } from '@fastgpt/global/support/user/team/constant';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import MySelect from '@fastgpt/web/components/common/MySelect'; import MySelect from '@fastgpt/web/components/common/MySelect';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
const TeamSelector = ({ const TeamSelector = ({
@@ -19,7 +21,7 @@ const TeamSelector = ({
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const router = useRouter(); const router = useRouter();
const { userInfo } = useUserStore(); const { userInfo, initUserInfo } = useUserStore();
const { setLoading } = useSystemStore(); const { setLoading } = useSystemStore();
const { data: myTeams = [] } = useRequest2(() => getTeamList(TeamMemberStatusEnum.active), { const { data: myTeams = [] } = useRequest2(() => getTeamList(TeamMemberStatusEnum.active), {
@@ -31,11 +33,12 @@ const TeamSelector = ({
async (teamId: string) => { async (teamId: string) => {
setLoading(true); setLoading(true);
await putSwitchTeam(teamId); await putSwitchTeam(teamId);
return initUserInfo();
}, },
{ {
onFinally: () => { onFinally: () => {
router.reload();
setLoading(false); setLoading(false);
onChange?.();
}, },
errorToast: t('common:user.team.Switch Team Failed') errorToast: t('common:user.team.Switch Team Failed')
} }

View File

@@ -220,7 +220,13 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
{bill.metadata.payWay === 'balance' ? ( {bill.metadata.payWay === 'balance' ? (
t('user:bill.not_need_invoice') t('user:bill.not_need_invoice')
) : ( ) : (
<Box>{bill.hasInvoice ? t('account_bill:yes') : t('account_bill:no')}</Box> <Box>
{
(bill.metadata.payWay = bill.hasInvoice
? t('account_bill:yes')
: t('account_bill:no'))
}
</Box>
)} )}
</Flex> </Flex>
)} )}

View File

@@ -175,7 +175,22 @@ function MemberTable({ Tabs }: { Tabs: React.ReactNode }) {
borderRadius={'md'} borderRadius={'md'}
ml={3} ml={3}
leftIcon={<MyIcon name="common/inviteLight" w={'16px'} color={'white'} />} leftIcon={<MyIcon name="common/inviteLight" w={'16px'} color={'white'} />}
onClick={onOpenInvite} onClick={() => {
if (
teamPlanStatus?.standardConstants?.maxTeamMember &&
teamPlanStatus.standardConstants.maxTeamMember <= members.length
) {
toast({
status: 'warning',
title: t('common:user.team.Over Max Member Tip', {
max: teamPlanStatus.standardConstants.maxTeamMember
})
});
setNotSufficientModalType(TeamErrEnum.teamMemberOverSize);
} else {
onOpenInvite();
}
}}
> >
{t('account_team:user_team_invite_member')} {t('account_team:user_team_invite_member')}
</Button> </Button>

View File

@@ -1,10 +1,12 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import ApiKeyTable from '@/components/support/apikey/Table'; import ApiKeyTable from '@/components/support/apikey/Table';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { Box } from '@chakra-ui/react';
import { useI18n } from '@/web/context/I18n';
const API = ({ appId }: { appId: string }) => { const API = ({ appId }: { appId: string }) => {
const { t } = useTranslation(); const { publishT } = useI18n();
return <ApiKeyTable tips={t('publish:app_key_tips')} appId={appId} />; return <ApiKeyTable tips={publishT('app_key_tips')} appId={appId} />;
}; };
export default API; export default API;

View File

@@ -61,13 +61,10 @@ const Header = ({
const { lastAppListRouteType } = useSystemStore(); const { lastAppListRouteType } = useSystemStore();
const { data: paths = [] } = useRequest2( const { data: paths = [] } = useRequest2(() => getAppFolderPath(appId), {
() => getAppFolderPath({ sourceId: appId, type: 'parent' }), manual: false,
{ refreshDeps: [appId]
manual: false, });
refreshDeps: [appId]
}
);
const onClickRoute = useCallback( const onClickRoute = useCallback(
(parentId: string) => { (parentId: string) => {
router.push({ router.push({

View File

@@ -112,9 +112,8 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
const { data: paths = [] } = useRequest2( const { data: paths = [] } = useRequest2(
() => { () => {
if (templateType === TemplateTypeEnum.teamPlugin) if (templateType === TemplateTypeEnum.teamPlugin) return getAppFolderPath(parentId);
return getAppFolderPath({ sourceId: parentId, type: 'current' }); return getSystemPluginPaths(parentId);
return getSystemPluginPaths({ sourceId: parentId, type: 'current' });
}, },
{ {
manual: false, manual: false,
@@ -187,7 +186,7 @@ const ToolSelectModal = ({ onClose, ...props }: Props & { onClose: () => void })
{/* route components */} {/* route components */}
{!searchKey && parentId && ( {!searchKey && parentId && (
<Flex mt={2} px={[3, 6]}> <Flex mt={2} px={[3, 6]}>
<FolderPath paths={paths} FirstPathDom={null} onClick={onUpdateParentId} /> <FolderPath paths={paths} FirstPathDom={null} onClick={() => onUpdateParentId(null)} />
</Flex> </Flex>
)} )}
<MyBox isLoading={isLoading} mt={2} px={[3, 6]} pb={3} flex={'1 0 0'} overflowY={'auto'}> <MyBox isLoading={isLoading} mt={2} px={[3, 6]} pb={3} flex={'1 0 0'} overflowY={'auto'}>

View File

@@ -144,7 +144,7 @@ const ChatTest = ({ isOpen, nodes = [], edges = [], onClose }: Props) => {
</Flex> </Flex>
)} )}
<Flex flex={'1 0 0'} alignItems={'end'} h={'100%'}> <Flex flex={'1 0 0'} alignItems={'end'}>
<Box flex={'1 0 0'} h={'100%'} overflow={'auto'}> <Box flex={'1 0 0'} h={'100%'} overflow={'auto'}>
<ChatContainer /> <ChatContainer />
</Box> </Box>

View File

@@ -276,9 +276,8 @@ const RenderHeader = React.memo(function RenderHeader({
// Get paths // Get paths
const { data: paths = [] } = useRequest2( const { data: paths = [] } = useRequest2(
() => { () => {
if (templateType === TemplateTypeEnum.teamPlugin) if (templateType === TemplateTypeEnum.teamPlugin) return getAppFolderPath(parentId);
return getAppFolderPath({ sourceId: parentId, type: 'current' }); return getSystemPluginPaths(parentId);
return getSystemPluginPaths({ sourceId: parentId, type: 'current' });
}, },
{ {
manual: false, manual: false,

View File

@@ -126,7 +126,7 @@ export const useChatTest = ({
const CustomChatContainer = useMemoizedFn(() => const CustomChatContainer = useMemoizedFn(() =>
appDetail.type === AppTypeEnum.plugin ? ( appDetail.type === AppTypeEnum.plugin ? (
<Box p={5} pb={16}> <Box p={5}>
<PluginRunBox <PluginRunBox
appId={appId} appId={appId}
chatId={chatId} chatId={chatId}

View File

@@ -3,32 +3,31 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { useI18n } from '@/web/context/I18n'; import { useI18n } from '@/web/context/I18n';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { Box, Flex } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
const AppTypeTag = ({ type }: { type: AppTypeEnum }) => { const AppTypeTag = ({ type }: { type: AppTypeEnum }) => {
const { t } = useTranslation(); const { appT } = useI18n();
const map = useRef({ const map = useRef({
[AppTypeEnum.simple]: { [AppTypeEnum.simple]: {
label: t('app:type.Simple bot'), label: appT('type.Simple bot'),
icon: 'core/app/type/simple', icon: 'core/app/type/simple',
bg: '#DBF3FF', bg: '#DBF3FF',
color: '#0884DD' color: '#0884DD'
}, },
[AppTypeEnum.workflow]: { [AppTypeEnum.workflow]: {
label: t('app:type.Workflow bot'), label: appT('type.Workflow bot'),
icon: 'core/app/type/workflow', icon: 'core/app/type/workflow',
bg: '#E4E1FC', bg: '#E4E1FC',
color: '#6F5DD7' color: '#6F5DD7'
}, },
[AppTypeEnum.plugin]: { [AppTypeEnum.plugin]: {
label: t('app:type.Plugin'), label: appT('type.Plugin'),
icon: 'core/app/type/plugin', icon: 'core/app/type/plugin',
bg: '#D0F5EE', bg: '#D0F5EE',
color: '#007E7C' color: '#007E7C'
}, },
[AppTypeEnum.httpPlugin]: { [AppTypeEnum.httpPlugin]: {
label: t('app:type.Http plugin'), label: appT('type.Http plugin'),
icon: 'core/app/type/httpPlugin', icon: 'core/app/type/httpPlugin',
bg: '#FFE4EE', bg: '#FFE4EE',
color: '#E82F72' color: '#E82F72'

View File

@@ -90,7 +90,7 @@ const AppListContextProvider = ({ children }: { children: ReactNode }) => {
); );
const { data: paths = [], runAsync: refetchPaths } = useRequest2( const { data: paths = [], runAsync: refetchPaths } = useRequest2(
() => getAppFolderPath({ sourceId: parentId, type: 'current' }), () => getAppFolderPath(parentId),
{ {
manual: false, manual: false,
refreshDeps: [parentId] refreshDeps: [parentId]

View File

@@ -2,7 +2,7 @@ import Markdown from '@/components/Markdown';
import { Box, Flex } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { Dispatch, MutableRefObject, SetStateAction, useState } from 'react'; import { Dispatch, MutableRefObject, SetStateAction, useState } from 'react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useCopyData } from '@fastgpt/web/hooks/useCopyData'; import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
import InputDataModal from '@/pageComponents/dataset/detail/InputDataModal'; import InputDataModal from '@/pageComponents/dataset/detail/InputDataModal';

View File

@@ -3,7 +3,7 @@ import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils'; import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
import DownloadButton from './DownloadButton'; import DownloadButton from './DownloadButton';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { downloadFetch } from '@/web/common/system/utils'; import { downloadFetch } from '@/web/common/system/utils';
@@ -70,9 +70,8 @@ const CollectionReader = ({
appId: metadata.appId, appId: metadata.appId,
...metadata.outLinkAuthData ...metadata.outLinkAuthData
}), }),
[chatItemDataId, collectionId, metadata.appId, metadata.chatId, metadata.outLinkAuthData] [metadata]
); );
const { const {
dataList: datasetDataList, dataList: datasetDataList,
isLoading, isLoading,
@@ -109,22 +108,13 @@ const CollectionReader = ({
url: '/api/core/dataset/collection/export', url: '/api/core/dataset/collection/export',
filename: 'data.csv', filename: 'data.csv',
body: { body: {
appId: metadata.appId, collectionId: collectionId,
chatId: metadata.chatId, chatItemDataId
chatItemDataId,
collectionId,
...metadata.outLinkAuthData
} }
}); });
}); });
const handleRead = getCollectionSourceAndOpen({ const handleRead = getCollectionSourceAndOpen(metadata);
appId: metadata.appId,
chatId: metadata.chatId,
chatItemDataId,
collectionId,
...metadata.outLinkAuthData
});
return ( return (
<MyBox display={'flex'} flexDirection={'column'} h={'full'}> <MyBox display={'flex'} flexDirection={'column'} h={'full'}>

View File

@@ -1,5 +1,5 @@
import MyMenu from '@fastgpt/web/components/common/MyMenu'; import MyMenu from '@fastgpt/web/components/common/MyMenu';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
import MyIconButton from '@fastgpt/web/components/common/Icon/button'; import MyIconButton from '@fastgpt/web/components/common/Icon/button';
const DownloadButton = ({ const DownloadButton = ({

View File

@@ -4,7 +4,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
import ScoreTag from './ScoreTag'; import ScoreTag from './ScoreTag';
import Markdown from '@/components/Markdown'; import Markdown from '@/components/Markdown';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
import { useCopyData } from '@fastgpt/web/hooks/useCopyData'; import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
const QuoteItem = ({ const QuoteItem = ({

View File

@@ -2,7 +2,7 @@ import { Box, Flex } from '@chakra-ui/react';
import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type'; import { SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import QuoteItem from './QuoteItem'; import QuoteItem from './QuoteItem';
import { useMemo } from 'react'; import { useMemo } from 'react';

View File

@@ -2,7 +2,7 @@ import { ScoreItemType, scoreTheme } from '@/components/core/dataset/QuoteItem';
import { Box, Flex, Progress } from '@chakra-ui/react'; import { Box, Flex, Progress } from '@chakra-ui/react';
import { SearchScoreTypeMap } from '@fastgpt/global/core/dataset/constants'; import { SearchScoreTypeMap } from '@fastgpt/global/core/dataset/constants';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'react-i18next';
const ScoreTag = (score: { primaryScore?: ScoreItemType; secondaryScore: ScoreItemType[] }) => { const ScoreTag = (score: { primaryScore?: ScoreItemType; secondaryScore: ScoreItemType[] }) => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -36,19 +36,19 @@ import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { shadowLight } from '@fastgpt/web/styles/theme'; import { shadowLight } from '@fastgpt/web/styles/theme';
import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext'; import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext';
import { useToast } from '@fastgpt/web/hooks/useToast';
function DataProcess() { function DataProcess() {
const { t } = useTranslation(); const { t } = useTranslation();
const { feConfigs } = useSystemStore(); const { feConfigs } = useSystemStore();
const { toast } = useToast();
const { goToNext, processParamsForm, chunkSizeField, minChunkSize, maxChunkSize } = const { goToNext, processParamsForm, chunkSizeField, minChunkSize, maxChunkSize } =
useContextSelector(DatasetImportContext, (v) => v); useContextSelector(DatasetImportContext, (v) => v);
const datasetDetail = useContextSelector(DatasetPageContext, (v) => v.datasetDetail); const datasetDetail = useContextSelector(DatasetPageContext, (v) => v.datasetDetail);
const { setValue, register, watch } = processParamsForm; const { getValues, setValue, register, watch } = processParamsForm;
const trainingType = watch('trainingType'); const trainingType = watch('trainingType');
const chunkSettingMode = watch('chunkSettingMode'); const chunkSettingMode = watch('chunkSettingMode');
const qaPrompt = watch('qaPrompt');
const { const {
isOpen: isOpenCustomPrompt, isOpen: isOpenCustomPrompt,
@@ -65,7 +65,7 @@ function DataProcess() {
value: key as DatasetCollectionDataProcessModeEnum, value: key as DatasetCollectionDataProcessModeEnum,
tooltip: t(value.tooltip as any) tooltip: t(value.tooltip as any)
})); }));
}, [t]); }, []);
const Title = useCallback(({ title }: { title: string }) => { const Title = useCallback(({ title }: { title: string }) => {
return ( return (
@@ -284,7 +284,7 @@ function DataProcess() {
} }
}} }}
> >
{qaPrompt} {getValues('qaPrompt')}
<Box <Box
display={'none'} display={'none'}
@@ -333,6 +333,44 @@ function DataProcess() {
</AccordionPanel> </AccordionPanel>
</AccordionItem> </AccordionItem>
{/* <AccordionItem mt={4} border={'none'}>
<Title title={t('dataset:import_model_config')} />
<AccordionPanel p={2} fontSize={'sm'}>
<Box>
<Box>{t('common:core.ai.model.Dataset Agent Model')}</Box>
<Box mt={1}>
<AIModelSelector
w={'100%'}
value={llmModel}
list={datasetModelList.map((item) => ({
label: item.name,
value: item.model
}))}
onChange={(e) => {
setValue('llmModel', e);
}}
/>
</Box>
</Box>
<Box pt={5}>
<Box>{t('dataset:vllm_model')}</Box>
<Box mt={1}>
<AIModelSelector
w={'100%'}
value={vlmModel}
list={vllmModelList.map((item) => ({
label: item.name,
value: item.model
}))}
onChange={(e) => {
setValue('vlmModel', e);
}}
/>
</Box>
</Box>
</AccordionPanel>
</AccordionItem> */}
<Flex mt={5} gap={3} justifyContent={'flex-end'}> <Flex mt={5} gap={3} justifyContent={'flex-end'}>
<Button <Button
onClick={() => { onClick={() => {
@@ -347,7 +385,7 @@ function DataProcess() {
{isOpenCustomPrompt && ( {isOpenCustomPrompt && (
<PromptTextarea <PromptTextarea
defaultValue={qaPrompt} defaultValue={getValues('qaPrompt')}
onChange={(e) => { onChange={(e) => {
setValue('qaPrompt', e); setValue('qaPrompt', e);
}} }}

View File

@@ -17,6 +17,7 @@ import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils';
import { DatasetDataIndexItemType } from '@fastgpt/global/core/dataset/type'; import { DatasetDataIndexItemType } from '@fastgpt/global/core/dataset/type';
import DeleteIcon from '@fastgpt/web/components/common/Icon/delete'; import DeleteIcon from '@fastgpt/web/components/common/Icon/delete';
import { defaultCollectionDetail } from '@/web/core/dataset/constants'; import { defaultCollectionDetail } from '@/web/core/dataset/constants';
import { getDocPath } from '@/web/common/system/doc';
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
@@ -256,18 +257,16 @@ const InputDataModal = ({
/> />
</Box> </Box>
<Flex flex={'1 0 0'} h={['auto', '0']} gap={6} flexDir={['column', 'row']} px={[5, '0']}> <Flex
pt={4}
flex={'1 0 0'}
gap={6}
flexDir={['column', 'row']}
overflow={'auto'}
px={[5, '3.25rem']}
>
{/* Data */} {/* Data */}
<Flex <Flex flexDir={'column'} h={'100%'} gap={3} flex={'1 0 0'}>
pt={4}
pl={[0, '3.25rem']}
flexDir={'column'}
h={'100%'}
gap={3}
flex={'1 0 0'}
w={['100%', 0]}
overflow={['unset', 'auto']}
>
<Flex flexDir={'column'} h={'100%'}> <Flex flexDir={'column'} h={'100%'}>
<FormLabel required mb={1} h={'30px'}> <FormLabel required mb={1} h={'30px'}>
{currentTab === TabEnum.chunk {currentTab === TabEnum.chunk
@@ -316,13 +315,7 @@ const InputDataModal = ({
)} )}
</Flex> </Flex>
{/* Index */} {/* Index */}
<Box <Box flex={'1 0 0'}>
pt={4}
pr={[0, '3.25rem']}
flex={'1 0 0'}
w={['100%', 0]}
overflow={['unset', 'auto']}
>
<Flex alignItems={'flex-start'} justifyContent={'space-between'} h={'30px'}> <Flex alignItems={'flex-start'} justifyContent={'space-between'} h={'30px'}>
<FormLabel> <FormLabel>
{t('common:dataset.data.edit.Index', { {t('common:dataset.data.edit.Index', {

View File

@@ -6,6 +6,7 @@ import { useRouter } from 'next/router';
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext'; import { DatasetPageContext } from '@/web/core/dataset/context/datasetPageContext';
import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs'; import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs';
import { useI18n } from '@/web/context/I18n';
import { useSystem } from '@fastgpt/web/hooks/useSystem'; import { useSystem } from '@fastgpt/web/hooks/useSystem';
import MyPopover from '@fastgpt/web/components/common/MyPopover'; import MyPopover from '@fastgpt/web/components/common/MyPopover';
import ParentPaths from '@/components/common/ParentPaths'; import ParentPaths from '@/components/common/ParentPaths';
@@ -21,6 +22,7 @@ export enum TabEnum {
const NavBar = ({ currentTab }: { currentTab: TabEnum }) => { const NavBar = ({ currentTab }: { currentTab: TabEnum }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
const { datasetT } = useI18n();
const router = useRouter(); const router = useRouter();
const query = router.query; const query = router.query;
const { isPc } = useSystem(); const { isPc } = useSystem();
@@ -166,7 +168,7 @@ const NavBar = ({ currentTab }: { currentTab: TabEnum }) => {
{rebuildingCount > 0 && ( {rebuildingCount > 0 && (
<Box mb={3}> <Box mb={3}>
<Box fontSize={'sm'}> <Box fontSize={'sm'}>
{t('dataset:rebuilding_index_count', { count: rebuildingCount })} {datasetT('rebuilding_index_count', { count: rebuildingCount })}
</Box> </Box>
</Box> </Box>
)} )}

View File

@@ -15,7 +15,6 @@ import { ReactElement, useEffect } from 'react';
import { NextPage } from 'next'; import { NextPage } from 'next';
import { getWebReqUrl } from '@fastgpt/web/common/system/utils'; import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
import SystemStoreContextProvider from '@fastgpt/web/context/useSystem'; import SystemStoreContextProvider from '@fastgpt/web/context/useSystem';
import { useRouter } from 'next/router';
type NextPageWithLayout = NextPage & { type NextPageWithLayout = NextPage & {
setLayout?: (page: ReactElement) => JSX.Element; setLayout?: (page: ReactElement) => JSX.Element;
@@ -24,15 +23,6 @@ type AppPropsWithLayout = AppProps & {
Component: NextPageWithLayout; Component: NextPageWithLayout;
}; };
// 哪些路由有自定义 Head
const routesWithCustomHead = [
'/chat',
'/chat/share',
'chat/team',
'/app/detail/',
'/dataset/detail'
];
function App({ Component, pageProps }: AppPropsWithLayout) { function App({ Component, pageProps }: AppPropsWithLayout) {
const { feConfigs, scripts, title } = useInitApp(); const { feConfigs, scripts, title } = useInitApp();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -52,23 +42,17 @@ function App({ Component, pageProps }: AppPropsWithLayout) {
const setLayout = Component.setLayout || ((page) => <>{page}</>); const setLayout = Component.setLayout || ((page) => <>{page}</>);
const router = useRouter();
const showHead = !router?.pathname || !routesWithCustomHead.includes(router.pathname);
return ( return (
<> <>
{showHead && ( <NextHead
<NextHead title={title}
title={title} desc={
desc={ feConfigs?.systemDescription ||
feConfigs?.systemDescription || process.env.SYSTEM_DESCRIPTION ||
process.env.SYSTEM_DESCRIPTION || `${title}${t('app:intro')}`
`${title}${t('app:intro')}` }
} icon={getWebReqUrl(feConfigs?.favicon || process.env.SYSTEM_FAVICON)}
icon={getWebReqUrl(feConfigs?.favicon || process.env.SYSTEM_FAVICON)} />
/>
)}
{scripts?.map((item, i) => <Script key={i} strategy="lazyOnload" {...item}></Script>)} {scripts?.map((item, i) => <Script key={i} strategy="lazyOnload" {...item}></Script>)}
<QueryClientContext> <QueryClientContext>

View File

@@ -1,6 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import { TrackEventName } from '@/web/common/system/constants'; import { TrackEventName } from '@/web/common/system/constants';

View File

@@ -3,7 +3,7 @@ import ApiKeyTable from '@/components/support/apikey/Table';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import AccountContainer, { TabEnum } from '@/pageComponents/account/AccountContainer'; import AccountContainer, { TabEnum } from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
const ApiKey = () => { const ApiKey = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next';
import ApplyInvoiceModal from '@/pageComponents/account/bill/ApplyInvoiceModal'; import ApplyInvoiceModal from '@/pageComponents/account/bill/ApplyInvoiceModal';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
export enum InvoiceTabEnum { export enum InvoiceTabEnum {
bill = 'bill', bill = 'bill',

View File

@@ -39,7 +39,7 @@ import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { useSystem } from '@fastgpt/web/hooks/useSystem'; import { useSystem } from '@fastgpt/web/hooks/useSystem';
import { getWebReqUrl } from '@fastgpt/web/common/system/utils'; import { getWebReqUrl } from '@fastgpt/web/common/system/utils';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import TeamSelector from '@/pageComponents/account/TeamSelector'; import TeamSelector from '@/pageComponents/account/TeamSelector';
import { getWorkorderURL } from '@/web/common/workorder/api'; import { getWorkorderURL } from '@/web/common/workorder/api';
@@ -277,7 +277,7 @@ const MyInfo = ({ onOpenContact }: { onOpenContact: () => void }) => {
<Flex mt={6} alignItems={'center'}> <Flex mt={6} alignItems={'center'}>
<Box {...labelStyles}>{t('account_info:user_team_team_name')}:&nbsp;</Box> <Box {...labelStyles}>{t('account_info:user_team_team_name')}:&nbsp;</Box>
<Flex flex={'1 0 0'} w={0} align={'center'}> <Flex flex={'1 0 0'} w={0} align={'center'}>
<TeamSelector height={'28px'} w={'100%'} showManage /> <TeamSelector height={'28px'} w={'100%'} showManage onChange={initUserInfo} />
</Flex> </Flex>
</Flex> </Flex>
)} )}

View File

@@ -7,7 +7,7 @@ import { useLoading } from '@fastgpt/web/hooks/useLoading';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
const InformTable = () => { const InformTable = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { Box, Flex } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';

View File

@@ -26,7 +26,7 @@ import { useLoading } from '@fastgpt/web/hooks/useLoading';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
const Promotion = () => { const Promotion = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -10,7 +10,7 @@ import { UserUpdateParams } from '@/types/user';
import TimezoneSelect from '@fastgpt/web/components/common/MySelect/TimezoneSelect'; import TimezoneSelect from '@fastgpt/web/components/common/MySelect/TimezoneSelect';
import I18nLngSelector from '@/components/Select/I18nLngSelector'; import I18nLngSelector from '@/components/Select/I18nLngSelector';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
const Individuation = () => { const Individuation = () => {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { Box, Flex } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';
import Icon from '@fastgpt/web/components/common/Icon'; import Icon from '@fastgpt/web/components/common/Icon';
@@ -48,7 +48,10 @@ const Team = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { userInfo } = useUserStore(); const { userInfo } = useUserStore();
const { setEditTeamData, isLoading, teamSize } = useContextSelector(TeamContext, (v) => v); const { setEditTeamData, isLoading, teamSize, refetchMembers } = useContextSelector(
TeamContext,
(v) => v
);
const Tabs = useMemo( const Tabs = useMemo(
() => ( () => (

View File

@@ -9,7 +9,7 @@ import dynamic from 'next/dynamic';
import { useState, useMemo } from 'react'; import { useState, useMemo } from 'react';
import WorkflowVariableModal from '@/pageComponents/account/thirdParty/WorkflowVariableModal'; import WorkflowVariableModal from '@/pageComponents/account/thirdParty/WorkflowVariableModal';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { GET } from '@/web/common/api/request'; import { GET } from '@/web/common/api/request';
import type { checkUsageResponse } from '@/pages/api/support/user/team/thirtdParty/checkUsage'; import type { checkUsageResponse } from '@/pages/api/support/user/team/thirtdParty/checkUsage';

View File

@@ -9,7 +9,7 @@ import { useTranslation } from 'next-i18next';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import Avatar from '@fastgpt/web/components/common/Avatar'; import Avatar from '@fastgpt/web/components/common/Avatar';
import AccountContainer from '@/pageComponents/account/AccountContainer'; import AccountContainer from '@/pageComponents/account/AccountContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination'; import { useScrollPagination } from '@fastgpt/web/hooks/useScrollPagination';
import { getTeamMembers } from '@/web/support/user/team/api'; import { getTeamMembers } from '@/web/support/user/team/api';
import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs'; import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';

View File

@@ -1,7 +1,7 @@
import { NextAPI } from '@/service/middleware/entry'; import { NextAPI } from '@/service/middleware/entry';
import { delay } from '@fastgpt/global/common/system/utils'; import { delay } from '@fastgpt/global/common/system/utils';
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun'; import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
import { jiebaSplit } from '@fastgpt/service/common/string/jieba/index'; import { jiebaSplit } from '@fastgpt/service/common/string/jieba';
import { MongoDatasetDataText } from '@fastgpt/service/core/dataset/data/dataTextSchema'; import { MongoDatasetDataText } from '@fastgpt/service/core/dataset/data/dataTextSchema';
import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema'; import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema';
import { authCert } from '@fastgpt/service/support/permission/auth/common'; import { authCert } from '@fastgpt/service/support/permission/auth/common';
@@ -44,7 +44,7 @@ const restore = async () => {
const data = await MongoDatasetData.findOne({ fullTextToken: { $exists: false } }); const data = await MongoDatasetData.findOne({ fullTextToken: { $exists: false } });
if (!data) return; if (!data) return;
data.fullTextToken = await jiebaSplit({ text: `${data.q}\n${data.a}`.trim() }); data.fullTextToken = jiebaSplit({ text: `${data.q}\n${data.a}`.trim() });
await data.save(); await data.save();
success++; success++;

View File

@@ -1,82 +0,0 @@
import { NextAPI } from '@/service/middleware/entry';
import { authCert } from '@fastgpt/service/support/permission/auth/common';
import { NextApiRequest, NextApiResponse } from 'next';
import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema';
import { jiebaSplit } from '@fastgpt/service/common/string/jieba';
import { addLog } from '@fastgpt/service/common/system/log';
import { delay } from '@fastgpt/global/common/system/utils';
import { MongoDatasetDataText } from '@fastgpt/service/core/dataset/data/dataTextSchema';
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
import { DatasetDataTextSchemaType } from '@fastgpt/global/core/dataset/type';
import type { AnyBulkWriteOperation } from '@fastgpt/service/common/mongo';
const updateData = async () => {
let success = 0;
while (true) {
try {
const time = Date.now();
const data = await MongoDatasetData.find({
initJieba: { $exists: false },
updateTime: { $lte: time } // 只需要取旧的数据
})
.limit(1000)
.lean();
if (data.length === 0) {
console.log('更新分词完成');
break;
}
const dataTextOps: AnyBulkWriteOperation<DatasetDataTextSchemaType>[] = [];
const datasetDataIds: string[] = [];
// 先进行分词处理
for await (const item of data) {
const text = `${item.q} ${item.a}`.trim();
try {
const tokens = await jiebaSplit({ text });
dataTextOps.push({
updateOne: {
filter: { dataId: item._id },
update: { $set: { fullTextToken: tokens } }
}
});
datasetDataIds.push(item._id);
} catch (error) {
console.log(`分词处理错误: ${item._id}`, error);
}
}
await mongoSessionRun(async (session) => {
if (dataTextOps.length > 0) {
await MongoDatasetDataText.bulkWrite(dataTextOps, { session, ordered: true });
}
if (datasetDataIds.length > 0) {
await MongoDatasetData.updateMany(
{ _id: { $in: datasetDataIds } },
{ $set: { initJieba: true } },
{
session
}
);
}
});
success += dataTextOps.length;
console.log(`成功 ${success}`);
} catch (error) {
addLog.error('更新所有旧的 jieba 分词失败', error);
await delay(1000);
}
}
};
async function handler(req: NextApiRequest, _res: NextApiResponse) {
await authCert({ req, authRoot: true });
console.log('更新所有旧的 jieba 分词');
updateData();
return { success: true };
}
export default NextAPI(handler);

View File

@@ -18,10 +18,6 @@ import { MongoTeamMember } from '@fastgpt/service/support/user/team/teamMemberSc
import { ChatItemValueTypeEnum, ChatSourceEnum } from '@fastgpt/global/core/chat/constants'; import { ChatItemValueTypeEnum, ChatSourceEnum } from '@fastgpt/global/core/chat/constants';
import { AIChatItemValueItemType } from '@fastgpt/global/core/chat/type'; import { AIChatItemValueItemType } from '@fastgpt/global/core/chat/type';
const formatJsonString = (data: any) => {
return JSON.stringify(data).replace(/"/g, '""').replace(/\n/g, '\\n');
};
export type ExportChatLogsBody = GetAppChatLogsProps & { export type ExportChatLogsBody = GetAppChatLogsProps & {
title: string; title: string;
sourcesMap: Record<string, { label: string }>; sourcesMap: Record<string, { label: string }>;
@@ -44,30 +40,7 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
} }
const { teamId } = await authApp({ req, authToken: true, appId, per: WritePermissionVal }); const { teamId } = await authApp({ req, authToken: true, appId, per: WritePermissionVal });
const teamMembers = await MongoTeamMember.find({ teamId });
const teamMemberWithContact = await MongoTeamMember.aggregate([
{ $match: { teamId: new Types.ObjectId(teamId) } },
{
$lookup: {
from: 'users',
localField: 'userId',
foreignField: '_id',
as: 'user'
}
},
{
$project: {
memberId: '$_id',
teamId: 1,
userId: 1,
name: 1,
role: 1,
status: 1,
contact: { $ifNull: [{ $arrayElemAt: ['$user.contact', 0] }, '-'] }
}
}
]);
console.log(teamMemberWithContact);
const where = { const where = {
teamId: new Types.ObjectId(teamId), teamId: new Types.ObjectId(teamId),
@@ -131,32 +104,40 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
}, },
{ {
$addFields: { $addFields: {
userGoodFeedbackItems: { userGoodFeedbackCount: {
$filter: { $size: {
input: '$chatitems', $filter: {
as: 'item', input: '$chatitems',
cond: { $ifNull: ['$$item.userGoodFeedback', false] } as: 'item',
cond: { $ifNull: ['$$item.userGoodFeedback', false] }
}
} }
}, },
userBadFeedbackItems: { userBadFeedbackCount: {
$filter: { $size: {
input: '$chatitems', $filter: {
as: 'item', input: '$chatitems',
cond: { $ifNull: ['$$item.userBadFeedback', false] } as: 'item',
cond: { $ifNull: ['$$item.userBadFeedback', false] }
}
} }
}, },
customFeedbackItems: { customFeedbacksCount: {
$filter: { $size: {
input: '$chatitems', $filter: {
as: 'item', input: '$chatitems',
cond: { $gt: [{ $size: { $ifNull: ['$$item.customFeedbacks', []] } }, 0] } as: 'item',
cond: { $gt: [{ $size: { $ifNull: ['$$item.customFeedbacks', []] } }, 0] }
}
} }
}, },
markItems: { markCount: {
$filter: { $size: {
input: '$chatitems', $filter: {
as: 'item', input: '$chatitems',
cond: { $ifNull: ['$$item.adminFeedback', false] } as: 'item',
cond: { $ifNull: ['$$item.adminFeedback', false] }
}
} }
}, },
chatDetails: { chatDetails: {
@@ -180,10 +161,10 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
source: 1, source: 1,
time: '$updateTime', time: '$updateTime',
messageCount: { $size: '$chatitems' }, messageCount: { $size: '$chatitems' },
userGoodFeedbackItems: 1, userGoodFeedbackCount: 1,
userBadFeedbackItems: 1, userBadFeedbackCount: 1,
customFeedbackItems: 1, customFeedbacksCount: 1,
markItems: 1, markCount: 1,
outLinkUid: 1, outLinkUid: 1,
tmbId: 1, tmbId: 1,
chatDetails: 1 chatDetails: 1
@@ -206,18 +187,14 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
const time = dayjs(doc.time.toISOString()).format('YYYY-MM-DD HH:mm:ss'); const time = dayjs(doc.time.toISOString()).format('YYYY-MM-DD HH:mm:ss');
const source = sourcesMap[doc.source as ChatSourceEnum]?.label || doc.source; const source = sourcesMap[doc.source as ChatSourceEnum]?.label || doc.source;
const title = doc.customTitle || doc.title; const title = doc.customTitle || doc.title;
const tmbName = doc.outLinkUid const tmb = doc.outLinkUid
? doc.outLinkUid ? doc.outLinkUid
: teamMemberWithContact.find((member) => String(member.memberId) === String(doc.tmbId))?.name; : teamMembers.find((member) => String(member._id) === String(doc.tmbId))?.name;
const tmbContact = teamMemberWithContact.find(
(member) => String(member.memberId) === String(doc.tmbId)
)?.contact;
const messageCount = doc.messageCount; const messageCount = doc.messageCount;
const userGoodFeedbackItems = doc.userGoodFeedbackItems || []; const userFeedbackCount = doc.userGoodFeedbackCount || doc.userBadFeedbackCount || '-';
const userBadFeedbackItems = doc.userBadFeedbackItems || []; const customFeedbacksCount = doc.customFeedbacksCount || '-';
const customFeedbackItems = doc.customFeedbackItems || []; const markCount = doc.markCount;
const markItems = doc.markItems || [];
const chatDetails = doc.chatDetails.map( const chatDetails = doc.chatDetails.map(
(chat: { id: string; value: AIChatItemValueItemType[] }) => { (chat: { id: string; value: AIChatItemValueItemType[] }) => {
return chat.value.map((item) => { return chat.value.map((item) => {
@@ -251,14 +228,9 @@ async function handler(req: ApiRequestProps<ExportChatLogsBody, {}>, res: NextAp
}); });
} }
); );
let chatDetailsStr = JSON.stringify(chatDetails).replace(/"/g, '""').replace(/\n/g, '\\n');
const userGoodFeedbackItemsStr = formatJsonString(userGoodFeedbackItems); const res = `\n"${time}","${source}","${tmb}","${title}","${messageCount}","${userFeedbackCount}","${customFeedbacksCount}","${markCount}","${chatDetailsStr}"`;
const userBadFeedbackItemsStr = formatJsonString(userBadFeedbackItems);
const customFeedbackItemsStr = formatJsonString(customFeedbackItems);
const markItemsStr = formatJsonString(markItems);
const chatDetailsStr = formatJsonString(chatDetails);
const res = `\n"${time}","${source}","${tmbName}","${tmbContact}","${title}","${messageCount}","${userGoodFeedbackItemsStr}","${userBadFeedbackItemsStr}","${customFeedbackItemsStr}","${markItemsStr}","${chatDetailsStr}"`;
write(res); write(res);
}); });

View File

@@ -1,6 +1,5 @@
import type { NextApiRequest, NextApiResponse } from 'next'; import type { NextApiRequest, NextApiResponse } from 'next';
import type { import type {
GetPathProps,
ParentIdType, ParentIdType,
ParentTreePathItemType ParentTreePathItemType
} from '@fastgpt/global/common/parentFolder/type.d'; } from '@fastgpt/global/common/parentFolder/type.d';
@@ -13,15 +12,15 @@ async function handler(
req: NextApiRequest, req: NextApiRequest,
res: NextApiResponse<any> res: NextApiResponse<any>
): Promise<ParentTreePathItemType[]> { ): Promise<ParentTreePathItemType[]> {
const { sourceId: appId, type } = req.query as GetPathProps; const { parentId } = req.query as { parentId: string };
if (!appId) { if (!parentId) {
return []; return [];
} }
const { app } = await authApp({ req, authToken: true, appId, per: ReadPermissionVal }); await authApp({ req, authToken: true, appId: parentId, per: ReadPermissionVal });
return await getParents(type === 'current' ? appId : app.parentId); return await getParents(parentId);
} }
export default NextAPI(handler); export default NextAPI(handler);

View File

@@ -1,9 +1,11 @@
import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next'; import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';
import { NextAPI } from '@/service/middleware/entry'; import { NextAPI } from '@/service/middleware/entry';
import { GetPathProps, ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type'; import { ParentIdType, ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
import { getSystemPlugins } from '@/service/core/app/plugin'; import { getSystemPlugins } from '@/service/core/app/plugin';
export type pathQuery = GetPathProps; export type pathQuery = {
parentId: ParentIdType;
};
export type pathBody = {}; export type pathBody = {};
@@ -13,18 +15,18 @@ async function handler(
req: ApiRequestProps<pathBody, pathQuery>, req: ApiRequestProps<pathBody, pathQuery>,
res: ApiResponseType<any> res: ApiResponseType<any>
): Promise<pathResponse> { ): Promise<pathResponse> {
const { sourceId: pluginId, type } = req.query; const { parentId } = req.query;
if (!pluginId) return []; if (!parentId) return [];
const plugins = await getSystemPlugins(); const plugins = await getSystemPlugins();
const plugin = plugins.find((item) => item.id === pluginId); const plugin = plugins.find((item) => item.id === parentId);
if (!plugin) return []; if (!plugin) return [];
return [ return [
{ {
parentId: type === 'current' ? plugin.id : plugin.parentId, parentId: plugin.id,
parentName: plugin.name parentName: plugin.name
} }
]; ];

View File

@@ -8,7 +8,6 @@ import { FilterQuery, Types } from 'mongoose';
import { quoteDataFieldSelector, QuoteDataItemType } from '@/service/core/chat/constants'; import { quoteDataFieldSelector, QuoteDataItemType } from '@/service/core/chat/constants';
import { processChatTimeFilter } from '@/service/core/chat/utils'; import { processChatTimeFilter } from '@/service/core/chat/utils';
import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat'; import { ChatErrEnum } from '@fastgpt/global/common/error/code/chat';
import { getCollectionWithDataset } from '@fastgpt/service/core/dataset/controller';
export type GetCollectionQuoteProps = LinkedPaginationProps & { export type GetCollectionQuoteProps = LinkedPaginationProps & {
chatId: string; chatId: string;
@@ -51,8 +50,7 @@ async function handler(
const limitedPageSize = Math.min(pageSize, 30); const limitedPageSize = Math.min(pageSize, 30);
const [collection, { chat, showRawSource }, { chatItem }] = await Promise.all([ const [{ chat, showRawSource }, { chatItem }] = await Promise.all([
getCollectionWithDataset(collectionId),
authChatCrud({ authChatCrud({
req, req,
authToken: true, authToken: true,
@@ -71,8 +69,6 @@ async function handler(
if (!chat) return Promise.reject(ChatErrEnum.unAuthChat); if (!chat) return Promise.reject(ChatErrEnum.unAuthChat);
const baseMatch: BaseMatchType = { const baseMatch: BaseMatchType = {
teamId: collection.teamId,
datasetId: collection.datasetId,
collectionId, collectionId,
$or: [ $or: [
{ updateTime: { $lt: new Date(chatItem.time) } }, { updateTime: { $lt: new Date(chatItem.time) } },

View File

@@ -1,28 +1,20 @@
import type { NextApiRequest } from 'next'; import type { NextApiRequest } from 'next';
import { MongoDataset } from '@fastgpt/service/core/dataset/schema'; import { MongoDataset } from '@fastgpt/service/core/dataset/schema';
import type { import type { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type.d';
GetPathProps,
ParentTreePathItemType
} from '@fastgpt/global/common/parentFolder/type.d';
import { authDataset } from '@fastgpt/service/support/permission/dataset/auth'; import { authDataset } from '@fastgpt/service/support/permission/dataset/auth';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant'; import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { NextAPI } from '@/service/middleware/entry'; import { NextAPI } from '@/service/middleware/entry';
async function handler(req: NextApiRequest) { async function handler(req: NextApiRequest) {
const { sourceId: datasetId, type } = req.query as GetPathProps; const { parentId } = req.query as { parentId: string };
if (!datasetId) { if (!parentId) {
return []; return [];
} }
const { dataset } = await authDataset({ await authDataset({ req, authToken: true, datasetId: parentId, per: ReadPermissionVal });
req,
authToken: true,
datasetId,
per: ReadPermissionVal
});
return await getParents(type === 'current' ? dataset._id : dataset.parentId); return await getParents(parentId);
} }
async function getParents(parentId?: string): Promise<ParentTreePathItemType[]> { async function getParents(parentId?: string): Promise<ParentTreePathItemType[]> {

View File

@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import Loading from '@fastgpt/web/components/common/MyLoading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import NextHead from '@/components/common/NextHead'; import NextHead from '@/components/common/NextHead';
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import AppContextProvider, { AppContext } from '@/pageComponents/app/detail/context'; import AppContextProvider, { AppContext } from '@/pageComponents/app/detail/context';

View File

@@ -1,7 +1,7 @@
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { Box, Flex, Button, useDisclosure, Input, InputGroup } from '@chakra-ui/react'; import { Box, Flex, Button, useDisclosure, Input, InputGroup } from '@chakra-ui/react';
import { AddIcon } from '@chakra-ui/icons'; import { AddIcon } from '@chakra-ui/icons';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';

View File

@@ -15,7 +15,7 @@ import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import SliderApps from '@/pageComponents/chat/SliderApps'; import SliderApps from '@/pageComponents/chat/SliderApps';
import ChatHeader from '@/pageComponents/chat/ChatHeader'; import ChatHeader from '@/pageComponents/chat/ChatHeader';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils'; import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';
import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt'; import { GPTMessages2Chats } from '@fastgpt/global/core/chat/adapt';
import { getMyApps } from '@/web/core/app/api'; import { getMyApps } from '@/web/core/app/api';

View File

@@ -11,7 +11,7 @@ import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type
import PageContainer from '@/components/PageContainer'; import PageContainer from '@/components/PageContainer';
import ChatHeader from '@/pageComponents/chat/ChatHeader'; import ChatHeader from '@/pageComponents/chat/ChatHeader';
import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider'; import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { getInitOutLinkChatInfo } from '@/web/core/chat/api'; import { getInitOutLinkChatInfo } from '@/web/core/chat/api';
import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils'; import { getChatTitleFromChatMessage } from '@fastgpt/global/core/chat/utils';

View File

@@ -8,7 +8,7 @@ import PageContainer from '@/components/PageContainer';
import { getMyTokensApps } from '@/web/core/chat/api'; import { getMyTokensApps } from '@/web/core/chat/api';
import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider'; import ChatHistorySlider from '@/pageComponents/chat/ChatHistorySlider';
import ChatHeader from '@/pageComponents/chat/ChatHeader'; import ChatHeader from '@/pageComponents/chat/ChatHeader';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import ChatBox from '@/components/core/chat/ChatContainer/ChatBox'; import ChatBox from '@/components/core/chat/ChatContainer/ChatBox';
import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type'; import type { StartChatFnProps } from '@/components/core/chat/ChatContainer/type';

View File

@@ -5,7 +5,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import PageContainer from '@/components/PageContainer'; import PageContainer from '@/components/PageContainer';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import MetaDataCard from '@/pageComponents/dataset/detail/MetaDataCard'; import MetaDataCard from '@/pageComponents/dataset/detail/MetaDataCard';
import NavBar from '@/pageComponents/dataset/detail/NavBar'; import NavBar from '@/pageComponents/dataset/detail/NavBar';

View File

@@ -97,10 +97,10 @@ function DatasetContextProvider({ children }: { children: React.ReactNode }) {
); );
const { data: paths = [], runAsync: refetchPaths } = useRequest2( const { data: paths = [], runAsync: refetchPaths } = useRequest2(
async () => getDatasetPaths({ sourceId: parentId, type: 'current' }), () => getDatasetPaths(parentId),
{ {
manual: false, manual: false,
refreshDeps: [folderDetail] refreshDeps: [parentId]
} }
); );

View File

@@ -2,7 +2,7 @@ import React, { useCallback, useMemo, useState } from 'react';
import { Box, Flex, Button, InputGroup, InputLeftElement, Input } from '@chakra-ui/react'; import { Box, Flex, Button, InputGroup, InputLeftElement, Input } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import ParentPaths from '@/components/common/folder/Path'; import ParentPaths from '@/components/common/folder/Path';
import List from '@/pageComponents/dataset/list/List'; import List from '@/pageComponents/dataset/list/List';
import { DatasetsContext } from './context'; import { DatasetsContext } from './context';

View File

@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import Loading from '@fastgpt/web/components/common/MyLoading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';

View File

@@ -6,7 +6,7 @@ import { clearToken } from '@/web/support/user/auth';
import { postFastLogin } from '@/web/support/user/api'; import { postFastLogin } from '@/web/support/user/api';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import Loading from '@fastgpt/web/components/common/MyLoading'; import Loading from '@fastgpt/web/components/common/MyLoading';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { getErrText } from '@fastgpt/global/common/error/utils'; import { getErrText } from '@fastgpt/global/common/error/utils';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
const FastLogin = ({ const FastLogin = ({

View File

@@ -17,7 +17,7 @@ import { useRouter } from 'next/router';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { useChatStore } from '@/web/core/chat/context/useChatStore'; import { useChatStore } from '@/web/core/chat/context/useChatStore';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { clearToken } from '@/web/support/user/auth'; import { clearToken } from '@/web/support/user/auth';
import Script from 'next/script'; import Script from 'next/script';
import Loading from '@fastgpt/web/components/common/MyLoading'; import Loading from '@fastgpt/web/components/common/MyLoading';

View File

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

View File

@@ -4,7 +4,7 @@ import { ChevronRightIcon } from '@chakra-ui/icons';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { getDocPath } from '@/web/common/system/doc'; import { getDocPath } from '@/web/common/system/doc';

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { Box, Flex, HStack, VStack } from '@chakra-ui/react'; import { Box, Flex, HStack, VStack } from '@chakra-ui/react';
import { useUserStore } from '@/web/support/user/useUserStore'; import { useUserStore } from '@/web/support/user/useUserStore';
import { getTeamPlanStatus } from '@/web/support/user/team/api'; import { getTeamPlanStatus } from '@/web/support/user/team/api';

Some files were not shown because too many files have changed in this diff Show More