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
98 changed files with 5591 additions and 5367 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

@@ -6,5 +6,4 @@ docSite/
*.md *.md
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

@@ -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:

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

@@ -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,5 +34,3 @@ curl --location --request POST 'https://{{host}}/api/admin/initv491' \
6. 模型渠道测试时,实际未指定渠道测试。 6. 模型渠道测试时,实际未指定渠道测试。
7. 新增自定义模型时,会把默认模型字段也保存,导致默认模型误判。 7. 新增自定义模型时,会把默认模型字段也保存,导致默认模型误判。
8. 修复 promp 模式工具调用,未判空思考链,导致 UI 错误展示。 8. 修复 promp 模式工具调用,未判空思考链,导致 UI 错误展示。
9. 编辑应用信息导致头像丢失。
10. 分享链接标题会被刷新掉。

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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -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';
@@ -57,7 +57,7 @@ function Error() {
<Box whiteSpace={'pre-wrap'}> <Box whiteSpace={'pre-wrap'}>
{`出现未捕获的异常。 {`出现未捕获的异常。
1. 私有部署用户90%是由于模型配置不正确/模型未启用导致。。 1. 私有部署用户90%是由于模型配置不正确/模型未启用导致。。
2. 部分系统不兼容相关API。大部分是苹果的safari 浏览器导致,可以尝试更换 chrome。 2. 部分系统不兼容相关API。大部分是苹果的safari 浏览器导致,可以尝试更换 chrome。
3. 请关闭浏览器翻译功能,部分翻译导致页面崩溃。 3. 请关闭浏览器翻译功能,部分翻译导致页面崩溃。
排除3后打开控制台的 console 查看具体报错信息。 排除3后打开控制台的 console 查看具体报错信息。

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

@@ -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

@@ -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

@@ -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';

View File

@@ -1,4 +1,4 @@
import { serviceSideProps } from '@/web/common/i18n/utils'; import { serviceSideProps } from '@fastgpt/web/common/system/nextjs';
import { getPluginGroups, getSystemPlugTemplates } from '@/web/core/app/api/plugin'; import { getPluginGroups, getSystemPlugTemplates } from '@/web/core/app/api/plugin';
import { Box, Flex, Grid, useDisclosure } from '@chakra-ui/react'; import { Box, Flex, Grid, useDisclosure } from '@chakra-ui/react';
import Avatar from '@fastgpt/web/components/common/Avatar'; import Avatar from '@fastgpt/web/components/common/Avatar';

View File

@@ -6,7 +6,7 @@ import {
} from '@fastgpt/global/core/dataset/controller'; } from '@fastgpt/global/core/dataset/controller';
import { insertDatasetDataVector } from '@fastgpt/service/common/vectorStore/controller'; import { insertDatasetDataVector } from '@fastgpt/service/common/vectorStore/controller';
import { getDefaultIndex } from '@fastgpt/global/core/dataset/utils'; import { getDefaultIndex } from '@fastgpt/global/core/dataset/utils';
import { jiebaSplit } from '@fastgpt/service/common/string/jieba/index'; import { jiebaSplit } from '@fastgpt/service/common/string/jieba';
import { deleteDatasetDataVector } from '@fastgpt/service/common/vectorStore/controller'; import { deleteDatasetDataVector } from '@fastgpt/service/common/vectorStore/controller';
import { DatasetDataIndexItemType, DatasetDataItemType } from '@fastgpt/global/core/dataset/type'; import { DatasetDataIndexItemType, DatasetDataItemType } from '@fastgpt/global/core/dataset/type';
import { getEmbeddingModel } from '@fastgpt/service/core/ai/model'; import { getEmbeddingModel } from '@fastgpt/service/core/ai/model';
@@ -138,7 +138,7 @@ export async function insertData2Dataset({
datasetId, datasetId,
collectionId, collectionId,
dataId: _id, dataId: _id,
fullTextToken: await jiebaSplit({ text: `${q}\n${a}`.trim() }) fullTextToken: jiebaSplit({ text: `${q}\n${a}`.trim() })
} }
], ],
{ session, ordered: true } { session, ordered: true }
@@ -272,7 +272,7 @@ export async function updateData2Dataset({
// update mongo data text // update mongo data text
await MongoDatasetDataText.updateOne( await MongoDatasetDataText.updateOne(
{ dataId: mongoData._id }, { dataId: mongoData._id },
{ fullTextToken: await jiebaSplit({ text: `${mongoData.q}\n${mongoData.a}`.trim() }) }, { fullTextToken: jiebaSplit({ text: `${mongoData.q}\n${mongoData.a}`.trim() }) },
{ session } { session }
); );

View File

@@ -4,8 +4,13 @@ import { TFunction } from 'i18next';
type I18nContextType = { type I18nContextType = {
commonT: TFunction<['common'], undefined>; commonT: TFunction<['common'], undefined>;
appT: TFunction<['app'], undefined>;
datasetT: TFunction<['dataset'], undefined>;
fileT: TFunction<['file'], undefined>; fileT: TFunction<['file'], undefined>;
publishT: TFunction<['publish'], undefined>;
workflowT: TFunction<['workflow'], undefined>; workflowT: TFunction<['workflow'], undefined>;
userT: TFunction<['user'], undefined>;
chatT: TFunction<['chat'], undefined>;
}; };
export const I18nContext = createContext<I18nContextType>({ export const I18nContext = createContext<I18nContextType>({
@@ -15,15 +20,25 @@ export const I18nContext = createContext<I18nContextType>({
const I18nContextProvider = ({ children }: { children: React.ReactNode }) => { const I18nContextProvider = ({ children }: { children: React.ReactNode }) => {
const { t: commonT } = useTranslation('common'); const { t: commonT } = useTranslation('common');
const { t: appT } = useTranslation('app');
const { t: datasetT } = useTranslation('dataset');
const { t: fileT } = useTranslation('file'); const { t: fileT } = useTranslation('file');
const { t: publishT } = useTranslation('publish');
const { t: workflowT } = useTranslation('workflow'); const { t: workflowT } = useTranslation('workflow');
const { t: userT } = useTranslation('user');
const { t: chatT } = useTranslation('chat');
return ( return (
<I18nContext.Provider <I18nContext.Provider
value={{ value={{
commonT, commonT,
appT,
datasetT,
fileT, fileT,
workflowT publishT,
workflowT,
userT,
chatT
}} }}
> >
{children} {children}

View File

@@ -1,11 +1,11 @@
import { GET, POST, DELETE, PUT } from '@/web/common/api/request'; import { GET, POST, DELETE, PUT } from '@/web/common/api/request';
import type { AppDetailType, AppListItemType } from '@fastgpt/global/core/app/type.d'; import type { AppDetailType, AppListItemType } from '@fastgpt/global/core/app/type.d';
import type { GetAppChatLogsParams } from '@/global/core/api/appReq.d'; import type { GetAppChatLogsParams } from '@/global/core/api/appReq.d';
import type { AppUpdateParams, AppChangeOwnerBody } from '@/global/core/app/api'; import { AppUpdateParams, AppChangeOwnerBody } from '@/global/core/app/api';
import type { CreateAppBody } from '@/pages/api/core/app/create'; import type { CreateAppBody } from '@/pages/api/core/app/create';
import type { ListAppBody } from '@/pages/api/core/app/list'; import type { ListAppBody } from '@/pages/api/core/app/list';
import type { AppLogsListItemType } from '@/types/app'; import { AppLogsListItemType } from '@/types/app';
import type { PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationResponse } from '@fastgpt/web/common/fetch/type';
/** /**
* 获取应用列表 * 获取应用列表

View File

@@ -1,7 +1,7 @@
import { DELETE, GET, POST } from '@/web/common/api/request'; import { DELETE, GET, POST } from '@/web/common/api/request';
import type { CreateAppFolderBody } from '@/pages/api/core/app/folder/create'; import type { CreateAppFolderBody } from '@/pages/api/core/app/folder/create';
import type { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type'; import { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
import type { ParentIdType } from '@fastgpt/global/common/parentFolder/type'; import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
import type { import type {
transitionWorkflowBody, transitionWorkflowBody,
transitionWorkflowResponse transitionWorkflowResponse

View File

@@ -1,9 +1,9 @@
import type { import {
UpdateAppCollaboratorBody, UpdateAppCollaboratorBody,
AppCollaboratorDeleteParams AppCollaboratorDeleteParams
} from '@fastgpt/global/core/app/collaborator'; } from '@fastgpt/global/core/app/collaborator';
import { DELETE, GET, POST } from '@/web/common/api/request'; import { DELETE, GET, POST } from '@/web/common/api/request';
import type { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator'; import { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
export const getCollaboratorList = (appId: string) => export const getCollaboratorList = (appId: string) =>
GET<CollaboratorItemType[]>('/proApi/core/app/collaborator/list', { appId }); GET<CollaboratorItemType[]>('/proApi/core/app/collaborator/list', { appId });

View File

@@ -11,12 +11,9 @@ import { defaultNodeVersion, FlowNodeTypeEnum } from '@fastgpt/global/core/workf
import { FlowNodeTemplateTypeEnum } from '@fastgpt/global/core/workflow/constants'; import { FlowNodeTemplateTypeEnum } from '@fastgpt/global/core/workflow/constants';
import type { GetPreviewNodeQuery } from '@/pages/api/core/app/plugin/getPreviewNode'; import type { GetPreviewNodeQuery } from '@/pages/api/core/app/plugin/getPreviewNode';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import type { import { ParentIdType, ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
ParentIdType, import { GetSystemPluginTemplatesBody } from '@/pages/api/core/app/plugin/getSystemPluginTemplates';
ParentTreePathItemType import { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type';
} from '@fastgpt/global/common/parentFolder/type';
import type { GetSystemPluginTemplatesBody } from '@/pages/api/core/app/plugin/getSystemPluginTemplates';
import type { PluginGroupSchemaType } from '@fastgpt/service/core/app/plugin/type';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { defaultGroup } from '@fastgpt/web/core/workflow/constants'; import { defaultGroup } from '@fastgpt/web/core/workflow/constants';

View File

@@ -1,7 +1,7 @@
import type { ListParams } from '@/pages/api/core/app/template/list'; import { ListParams } from '@/pages/api/core/app/template/list';
import { GET } from '@/web/common/api/request'; import { GET } from '@/web/common/api/request';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import type { AppTemplateSchemaType, TemplateTypeSchemaType } from '@fastgpt/global/core/app/type'; import { AppTemplateSchemaType, TemplateTypeSchemaType } from '@fastgpt/global/core/app/type';
import { defaultTemplateTypes } from '@fastgpt/web/core/workflow/constants'; import { defaultTemplateTypes } from '@fastgpt/web/core/workflow/constants';
export const getTemplateMarketItemList = (data: ListParams) => export const getTemplateMarketItemList = (data: ListParams) =>

View File

@@ -1,7 +1,7 @@
import type { PostPublishAppProps } from '@/global/core/app/api'; import { PostPublishAppProps } from '@/global/core/app/api';
import { GET, POST } from '@/web/common/api/request'; import { GET, POST } from '@/web/common/api/request';
import type { AppVersionSchemaType } from '@fastgpt/global/core/app/version'; import type { AppVersionSchemaType } from '@fastgpt/global/core/app/version';
import type { PaginationProps } from '@fastgpt/web/common/fetch/type'; import { PaginationProps } from '@fastgpt/web/common/fetch/type';
import type { import type {
getLatestVersionQuery, getLatestVersionQuery,
getLatestVersionResponse getLatestVersionResponse

View File

@@ -17,7 +17,7 @@ import type {
QueryChatInputGuideBody, QueryChatInputGuideBody,
QueryChatInputGuideResponse QueryChatInputGuideResponse
} from '@/pages/api/core/chat/inputGuide/query'; } from '@/pages/api/core/chat/inputGuide/query';
import type { deleteAllInputGuideBody } from '@/pages/api/core/chat/inputGuide/deleteAll'; import { deleteAllInputGuideBody } from '@/pages/api/core/chat/inputGuide/deleteAll';
export const getCountChatInputGuideTotal = (data: countChatInputGuideTotalQuery) => export const getCountChatInputGuideTotal = (data: countChatInputGuideTotalQuery) =>
GET<countChatInputGuideTotalResponse>(`/core/chat/inputGuide/countTotal`, data); GET<countChatInputGuideTotalResponse>(`/core/chat/inputGuide/countTotal`, data);

View File

@@ -64,8 +64,8 @@ import type {
listExistIdQuery, listExistIdQuery,
listExistIdResponse listExistIdResponse
} from '@/pages/api/core/dataset/apiDataset/listExistId'; } from '@/pages/api/core/dataset/apiDataset/listExistId';
import type { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData'; import { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData';
import type { GetQuotePermissionResponse } from '@/pages/api/core/dataset/data/getPermission'; import { GetQuotePermissionResponse } from '@/pages/api/core/dataset/data/getPermission';
/* ======================== dataset ======================= */ /* ======================== dataset ======================= */
export const getDatasets = (data: GetDatasetListBody) => export const getDatasets = (data: GetDatasetListBody) =>

View File

@@ -1,9 +1,9 @@
import type { import {
UpdateDatasetCollaboratorBody, UpdateDatasetCollaboratorBody,
DatasetCollaboratorDeleteParams DatasetCollaboratorDeleteParams
} from '@fastgpt/global/core/dataset/collaborator'; } from '@fastgpt/global/core/dataset/collaborator';
import { DELETE, GET, POST } from '@/web/common/api/request'; import { DELETE, GET, POST } from '@/web/common/api/request';
import type { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator'; import { CollaboratorItemType } from '@fastgpt/global/support/permission/collaborator';
export const getCollaboratorList = (datasetId: string) => export const getCollaboratorList = (datasetId: string) =>
GET<CollaboratorItemType[]>('/proApi/core/dataset/collaborator/list', { datasetId }); GET<CollaboratorItemType[]>('/proApi/core/dataset/collaborator/list', { datasetId });

View File

@@ -10,20 +10,20 @@ import {
FlowNodeTypeEnum FlowNodeTypeEnum
} from '@fastgpt/global/core/workflow/node/constant'; } from '@fastgpt/global/core/workflow/node/constant';
import { getHandleConfig } from '@fastgpt/global/core/workflow/template/utils'; import { getHandleConfig } from '@fastgpt/global/core/workflow/template/utils';
import type { FlowNodeItemType, StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node'; import { FlowNodeItemType, StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
import type { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node'; import type { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node';
import { VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants'; import { VARIABLE_NODE_ID } from '@fastgpt/global/core/workflow/constants';
import { getHandleId } from '@fastgpt/global/core/workflow/utils'; import { getHandleId } from '@fastgpt/global/core/workflow/utils';
import type { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge'; import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
import { LLMModelTypeEnum } from '@fastgpt/global/core/ai/constants'; import { LLMModelTypeEnum } from '@fastgpt/global/core/ai/constants';
import type { import {
FlowNodeInputItemType, FlowNodeInputItemType,
FlowNodeOutputItemType FlowNodeOutputItemType
} from '@fastgpt/global/core/workflow/type/io'; } from '@fastgpt/global/core/workflow/type/io';
import { PluginTypeEnum } from '@fastgpt/global/core/plugin/constants'; import { PluginTypeEnum } from '@fastgpt/global/core/plugin/constants';
import { getWorkflowGlobalVariables } from './utils'; import { getWorkflowGlobalVariables } from './utils';
import type { TFunction } from 'next-i18next'; import { TFunction } from 'next-i18next';
import type { AppChatConfigType } from '@fastgpt/global/core/app/type'; import { AppChatConfigType } from '@fastgpt/global/core/app/type';
export const getGlobalVariableNode = ({ export const getGlobalVariableNode = ({
nodes, nodes,

View File

@@ -1,5 +1,5 @@
import { GET, POST, PUT, DELETE } from '@/web/common/api/request'; import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
import type { PostWorkflowDebugProps, PostWorkflowDebugResponse } from '@/global/core/workflow/api'; import { PostWorkflowDebugProps, PostWorkflowDebugResponse } from '@/global/core/workflow/api';
export const postWorkflowDebug = (data: PostWorkflowDebugProps) => export const postWorkflowDebug = (data: PostWorkflowDebugProps) =>
POST<PostWorkflowDebugResponse>( POST<PostWorkflowDebugResponse>(

View File

@@ -1,6 +1,6 @@
import { GET, POST } from '@/web/common/api/request'; import { GET, POST } from '@/web/common/api/request';
import type { PromotionRecordType } from '@/global/support/api/userRes.d'; import type { PromotionRecordType } from '@/global/support/api/userRes.d';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
/* get promotion init data */ /* get promotion init data */
export const getPromotionInitData = () => export const getPromotionInitData = () =>

View File

@@ -2,15 +2,15 @@ import { GET, POST, PUT } from '@/web/common/api/request';
import { hashStr } from '@fastgpt/global/common/string/tools'; import { hashStr } from '@fastgpt/global/common/string/tools';
import type { ResLogin } from '@/global/support/api/userRes.d'; import type { ResLogin } from '@/global/support/api/userRes.d';
import { UserAuthTypeEnum } from '@fastgpt/global/support/user/auth/constants'; import { UserAuthTypeEnum } from '@fastgpt/global/support/user/auth/constants';
import type { UserUpdateParams } from '@/types/user'; import { UserUpdateParams } from '@/types/user';
import type { UserType } from '@fastgpt/global/support/user/type.d'; import { UserType } from '@fastgpt/global/support/user/type.d';
import type { import type {
FastLoginProps, FastLoginProps,
OauthLoginProps, OauthLoginProps,
PostLoginProps, PostLoginProps,
SearchResult SearchResult
} from '@fastgpt/global/support/user/api.d'; } from '@fastgpt/global/support/user/api.d';
import type { import {
AccountRegisterBody, AccountRegisterBody,
GetWXLoginQRResponse GetWXLoginQRResponse
} from '@fastgpt/global/support/user/login/api.d'; } from '@fastgpt/global/support/user/login/api.d';

View File

@@ -1,7 +1,7 @@
import { GET, POST } from '@/web/common/api/request'; import { GET, POST } from '@/web/common/api/request';
import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type'; import type { UserInformSchema } from '@fastgpt/global/support/user/inform/type';
import type { SystemMsgModalValueType } from '@fastgpt/service/support/user/inform/type'; import { SystemMsgModalValueType } from '@fastgpt/service/support/user/inform/type';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
export const getInforms = (data: PaginationProps) => export const getInforms = (data: PaginationProps) =>
POST<PaginationResponse<UserInformSchema>>(`/proApi/support/user/inform/list`, data); POST<PaginationResponse<UserInformSchema>>(`/proApi/support/user/inform/list`, data);

View File

@@ -1,24 +1,26 @@
import { GET, POST, PUT, DELETE } from '@/web/common/api/request'; import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
import type { import {
CollaboratorItemType, CollaboratorItemType,
DeletePermissionQuery, DeletePermissionQuery,
UpdateClbPermissionProps UpdateClbPermissionProps
} from '@fastgpt/global/support/permission/collaborator'; } from '@fastgpt/global/support/permission/collaborator';
import type { import {
CreateTeamProps, CreateTeamProps,
InviteMemberProps,
InviteMemberResponse,
UpdateInviteProps, UpdateInviteProps,
UpdateTeamProps UpdateTeamProps
} from '@fastgpt/global/support/user/team/controller.d'; } from '@fastgpt/global/support/user/team/controller.d';
import type { TeamTagItemType, TeamTagSchema } from '@fastgpt/global/support/user/team/type'; import type { TeamTagItemType, TeamTagSchema } from '@fastgpt/global/support/user/team/type';
import type { import {
TeamTmbItemType, TeamTmbItemType,
TeamMemberItemType, TeamMemberItemType,
TeamMemberSchema TeamMemberSchema
} from '@fastgpt/global/support/user/team/type.d'; } from '@fastgpt/global/support/user/team/type.d';
import type { FeTeamPlanStatusType, TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type'; import { FeTeamPlanStatusType, TeamSubSchema } from '@fastgpt/global/support/wallet/sub/type';
import type { TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/type'; import { TeamInvoiceHeaderType } from '@fastgpt/global/support/user/team/type';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
import type { import {
InvitationInfoType, InvitationInfoType,
InvitationLinkCreateType, InvitationLinkCreateType,
InvitationLinkUpdateType, InvitationLinkUpdateType,

View File

@@ -1,6 +1,6 @@
import { DELETE, GET, POST, PUT } from '@/web/common/api/request'; import { DELETE, GET, POST, PUT } from '@/web/common/api/request';
import type { MemberGroupListType } from '@fastgpt/global/support/permission/memberGroup/type'; import { MemberGroupListType } from '@fastgpt/global/support/permission/memberGroup/type';
import type { import {
postCreateGroupData, postCreateGroupData,
putUpdateGroupData putUpdateGroupData
} from '@fastgpt/global/support/user/team/group/api'; } from '@fastgpt/global/support/user/team/group/api';

View File

@@ -5,7 +5,7 @@ import type {
putUpdateOrgMembersData putUpdateOrgMembersData
} from '@fastgpt/global/support/user/team/org/api'; } from '@fastgpt/global/support/user/team/org/api';
import type { OrgType } from '@fastgpt/global/support/user/team/org/type'; import type { OrgType } from '@fastgpt/global/support/user/team/org/type';
import type { putMoveOrgType } from '@fastgpt/global/support/user/team/org/api'; import { putMoveOrgType } from '@fastgpt/global/support/user/team/org/api';
export const getOrgList = () => GET<OrgType[]>('/proApi/support/user/team/org/list'); export const getOrgList = () => GET<OrgType[]>('/proApi/support/user/team/org/list');

View File

@@ -1,8 +1,8 @@
import { GET, POST } from '@/web/common/api/request'; import { GET, POST } from '@/web/common/api/request';
import type { CreateBillProps, CreateBillResponse } from '@fastgpt/global/support/wallet/bill/api'; import { CreateBillProps, CreateBillResponse } from '@fastgpt/global/support/wallet/bill/api';
import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants'; import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
import type { BillSchemaType } from '@fastgpt/global/support/wallet/bill/type.d'; import type { BillSchemaType } from '@fastgpt/global/support/wallet/bill/type.d';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
export const getBills = ( export const getBills = (
data: PaginationProps<{ data: PaginationProps<{

View File

@@ -1,8 +1,8 @@
import { GET, POST } from '@/web/common/api/request'; import { GET, POST } from '@/web/common/api/request';
import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants'; import { BillTypeEnum } from '@fastgpt/global/support/wallet/bill/constants';
import type { InvoiceType } from '@fastgpt/global/support/wallet/bill/type'; import { InvoiceType } from '@fastgpt/global/support/wallet/bill/type';
import type { InvoiceSchemaType } from '@fastgpt/global/support/wallet/bill/type'; import { InvoiceSchemaType } from '@fastgpt/global/support/wallet/bill/type';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
export type invoiceBillDataType = { export type invoiceBillDataType = {
type: BillTypeEnum; type: BillTypeEnum;
price: number; price: number;

View File

@@ -1,12 +1,12 @@
import { POST } from '@/web/common/api/request'; import { POST } from '@/web/common/api/request';
import type { import {
CreateTrainingUsageProps, CreateTrainingUsageProps,
GetUsageDashboardProps, GetUsageDashboardProps,
GetUsageDashboardResponseItem, GetUsageDashboardResponseItem,
GetUsageProps GetUsageProps
} from '@fastgpt/global/support/wallet/usage/api.d'; } from '@fastgpt/global/support/wallet/usage/api.d';
import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type'; import type { UsageItemType } from '@fastgpt/global/support/wallet/usage/type';
import type { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type'; import { PaginationProps, PaginationResponse } from '@fastgpt/web/common/fetch/type';
export const getUserUsages = (data: PaginationProps<GetUsageProps>) => export const getUserUsages = (data: PaginationProps<GetUsageProps>) =>
POST<PaginationResponse<UsageItemType>>(`/proApi/support/wallet/usage/getUsage`, data); POST<PaginationResponse<UsageItemType>>(`/proApi/support/wallet/usage/getUsage`, data);