Commit 939282b7 by Finley Ge Committed by GitHub

V4.14.8 dev (#6517)

* doc

* wip(next): upgrade next16 with next-rspack to build (#6501)

* wip(next): upgrade next16 with next-rspack to build

* wip: fix tsconfig path alias, bump various deps

* fix: test action pnpm version, immer dep

* fix: only use Rspack for develop environment

* lock

* fix: dataset choice hint (#6514)

* fix: dataset choice hint

* fix: regex replaceVarible remove useless match group

* fix: type check (#6515)

* test: perfect test cases for replaceVarible function in  like case (#6516)

---------

Co-authored-by: archer <545436317@qq.com>
Co-authored-by: Ryo <whoeverimf5@gmail.com>
parent 14790b33
......@@ -20,7 +20,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: pnpm/action-setup@v4
with:
version: 10
version: 9
- name: 'Install Deps'
run: pnpm install
- name: 'Test'
......
......@@ -7,7 +7,7 @@ description: 'FastGPT V4.14.8 更新说明'
## 🚀 新增内容
1. Next.js 版本升级到 15。
2. 重构代码沙盒。
2. 重构代码沙盒,统一隔离方案,支持网络请求以及内置依赖包
## ⚙️ 优化
......
......@@ -23,16 +23,16 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitest/coverage-v8": "^3.0.9",
"eslint": "^8.57.0",
"eslint-config-next": "^15.5.12",
"eslint": "catalog:",
"eslint-config-next": "catalog:",
"husky": "^8.0.3",
"i18next": "23.16.8",
"js-yaml": "^4.1.1",
"i18next": "catalog:",
"js-yaml": "catalog:",
"lint-staged": "^13.3.0",
"mongodb-memory-server": "^10.1.4",
"next-i18next": "15.4.2",
"next-i18next": "catalog:",
"prettier": "3.2.4",
"react-i18next": "14.1.2",
"react-i18next": "catalog:",
"typescript": "^5.1.3",
"vitest": "^3.0.9",
"zhlint": "^0.7.4"
......@@ -51,23 +51,8 @@
"git add ."
]
},
"pnpm": {
"overrides": {
"react": "18.3.1",
"react-dom": "18.3.1",
"@types/react": "18.3.1"
}
},
"resolutions": {
"mdast-util-gfm-autolink-literal": "2.0.0"
},
"engines": {
"node": ">=20"
},
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": "9.15.9"
}
"node": "20.x",
"pnpm": "9.x"
}
}
......@@ -85,7 +85,7 @@ export function replaceVariable(
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
replacements.push({
pattern: `{{(${escapedKey})}}`,
pattern: `{{${escapedKey}}}`,
replacement: formatVal
});
......
......@@ -72,6 +72,7 @@ export const modelTypeList = [
export enum ChatCompletionRequestMessageRoleEnum {
'System' = 'system',
'Developer' = 'developer',
'User' = 'user',
'Assistant' = 'assistant',
'Function' = 'function',
......
......@@ -23,6 +23,7 @@ import { getNanoid } from '../../common/string/tools';
export const GPT2Chat = {
[ChatCompletionRequestMessageRoleEnum.System]: ChatRoleEnum.System,
[ChatCompletionRequestMessageRoleEnum.Developer]: ChatRoleEnum.System,
[ChatCompletionRequestMessageRoleEnum.User]: ChatRoleEnum.Human,
[ChatCompletionRequestMessageRoleEnum.Assistant]: ChatRoleEnum.AI,
[ChatCompletionRequestMessageRoleEnum.Function]: ChatRoleEnum.AI,
......
......@@ -247,9 +247,11 @@ export const datasetQuoteValueDesc = `{
q: string;
a: string
}[]`;
export const datasetSelectValueDesc = `{
datasetId: string;
}[]`;
export const datasetSelectValueDesc = `[
{
"datasetId": "6693a4a6b69b7a9b0e37d9b0"
}
]`;
export const AppNodeFlowNodeTypeMap: Record<any, boolean> = {
[FlowNodeTypeEnum.pluginModule]: true,
......
{
"name": "@fastgpt/global",
"version": "1.0.0",
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@fastgpt-sdk/plugin": "0.3.8",
"@apidevtools/swagger-parser": "^10.1.0",
"@bany/curl-to-json": "^1.2.8",
"axios": "^1.13.5",
"axios": "catalog:",
"cron-parser": "^4.9.0",
"dayjs": "^1.11.7",
"dayjs": "catalog:",
"encoding": "^0.1.13",
"js-yaml": "^4.1.1",
"js-yaml": "catalog:",
"jschardet": "3.1.1",
"json5": "^2.2.3",
"json5": "catalog:",
"nanoid": "^5.1.3",
"next": "15.5.12",
"openai": "4.61.0",
"next": "catalog:",
"openai": "4.104.0",
"openapi-types": "^12.1.3",
"timezones-list": "^3.0.2",
"lodash": "^4.17.23",
"zod": "^4.1.12",
"lodash": "catalog:",
"zod": "catalog:",
"zod-openapi": "^5.4.3"
},
"devDependencies": {
"@types/lodash": "^4.14.191",
"@types/lodash": "catalog:",
"@types/js-yaml": "^4.0.9",
"@types/node": "20.14.0"
}
......
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "."
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
......@@ -6,6 +6,7 @@ import {
Worker,
type WorkerOptions
} from 'bullmq';
import './type';
import { getLogger, LogCategories } from '../logger';
import { newQueueRedisConnection, newWorkerRedisConnection } from '../redis';
import { delay } from '@fastgpt/global/common/system/utils';
......
......@@ -5,3 +5,5 @@ declare global {
var queues: Map<QueueNames, Queue> | undefined;
var workers: Map<QueueNames, Worker> | undefined;
}
export {};
import { type preUploadImgProps } from '@fastgpt/global/common/file/api';
import { imageBaseUrl } from '@fastgpt/global/common/file/image/constants';
import { type MongoImageSchemaType } from '@fastgpt/global/common/file/image/type';
import { MongoImage } from './schema';
import { type ClientSession, Types } from '../../../common/mongo';
import { guessBase64ImageType } from './utils';
......@@ -48,7 +49,7 @@ export async function uploadMongoImg({
return Promise.reject(new UserError(`Invalid image file type: ${mime}`));
}
const { _id } = await retryFn(() =>
const { _id } = await retryFn<MongoImageSchemaType>(() =>
MongoImage.create({
teamId,
binary,
......
......@@ -93,7 +93,7 @@ export const parseLLMStreamResponse = () => {
};
finish_reason?: CompletionFinishReason;
}[];
usage?: CompletionUsage;
usage?: CompletionUsage | null;
};
parseThinkTag?: boolean;
retainDatasetCite?: boolean;
......
......@@ -2,13 +2,17 @@
"name": "@fastgpt/service",
"version": "1.0.0",
"type": "module",
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@fastgpt-sdk/storage": "^0.6.15",
"@fastgpt-sdk/storage": "catalog:",
"@fastgpt/global": "workspace:*",
"@logtape/logtape": "^2",
"@logtape/pretty": "^2",
"@maxmind/geoip2-node": "^6.3.4",
"@modelcontextprotocol/sdk": "^1.26.0",
"@modelcontextprotocol/sdk": "catalog:",
"@node-rs/jieba": "2.0.1",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/api-logs": "^0.203.0",
......@@ -19,16 +23,15 @@
"@opentelemetry/semantic-conventions": "^1.39.0",
"@opentelemetry/winston-transport": "^0.14.0",
"@t3-oss/env-core": "0.13.10",
"@vercel/otel": "^1.13.0",
"@xmldom/xmldom": "^0.8.10",
"@zilliz/milvus2-sdk-node": "2.4.10",
"axios": "^1.13.5",
"axios": "catalog:",
"bullmq": "^5.52.2",
"chalk": "^5.3.0",
"cheerio": "1.0.0-rc.12",
"cookie": "^0.7.1",
"date-fns": "2.30.0",
"dayjs": "^1.11.7",
"date-fns": "catalog:",
"dayjs": "catalog:",
"decompress": "^4.2.1",
"domino-ext": "^2.1.4",
"encoding": "^0.1.13",
......@@ -40,18 +43,18 @@
"ioredis": "^5.6.0",
"joplin-turndown-plugin-gfm": "^1.0.12",
"@apidevtools/json-schema-ref-parser": "^11.7.2",
"json5": "^2.2.3",
"json5": "catalog:",
"jsonpath-plus": "^10.3.0",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.23",
"lodash": "catalog:",
"mammoth": "^1.11.0",
"mime": "^4.1.0",
"minio": "^8.0.5",
"minio": "catalog:",
"mongoose": "^8.10.1",
"multer": "2.1.0",
"mysql2": "^3.11.3",
"next": "15.5.12",
"nextjs-cors": "^2.2.0",
"next": "catalog:",
"nextjs-cors": "2.2.1",
"node-cron": "^3.0.3",
"node-xlsx": "^0.24.0",
"p-limit": "^7.2.0",
......@@ -60,7 +63,7 @@
"pg": "^8.10.0",
"pino": "^9.7.0",
"pino-opentelemetry-transport": "^1.0.1",
"proxy-agent": "^6.5.0",
"proxy-agent": "catalog:",
"proxy-from-env": "^1.1.0",
"request-ip": "^3.3.0",
"tiktoken": "1.0.17",
......@@ -68,14 +71,14 @@
"turndown": "^7.1.2",
"undici": "^7.18.2",
"winston": "^3.17.0",
"zod": "^4.1.12"
"zod": "catalog:"
},
"devDependencies": {
"@types/async-retry": "^1.4.9",
"@types/cookie": "^0.5.2",
"@types/decompress": "^4.2.7",
"@types/jsonwebtoken": "^9.0.3",
"@types/lodash": "^4.14.191",
"@types/lodash": "catalog:",
"@types/multer": "^1.4.10",
"@types/node-cron": "^3.0.11",
"@types/papaparse": "5.3.7",
......
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"moduleResolution": "bundler"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
......
......@@ -4,7 +4,7 @@ import { Box, Card, Flex, useTheme, useOutsideClick, Button } from '@chakra-ui/r
import { addDays, format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css';
import zhCN from 'date-fns/locale/zh-CN';
import { zhCN } from 'date-fns/locale/zh-CN';
import { useTranslation } from 'next-i18next';
import MyIcon from '../Icon';
......
......@@ -5,7 +5,7 @@ import { format } from 'date-fns';
import type { Matcher } from 'react-day-picker';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css';
import zhCN from 'date-fns/locale/zh-CN';
import { zhCN } from 'date-fns/locale/zh-CN';
import MyIcon from '../Icon';
const DateTimePicker = ({
......
{
"name": "@fastgpt/web",
"version": "1.0.0",
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@chakra-ui/anatomy": "2.2.1",
"@chakra-ui/icons": "2.1.1",
"@chakra-ui/next-js": "2.4.2",
"@chakra-ui/react": "2.10.7",
"@chakra-ui/styled-system": "2.9.1",
"@chakra-ui/system": "2.6.1",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@chakra-ui/anatomy": "catalog:",
"@chakra-ui/icons": "catalog:",
"@chakra-ui/next-js": "catalog:",
"@chakra-ui/react": "catalog:",
"@chakra-ui/styled-system": "catalog:",
"@chakra-ui/system": "catalog:",
"@emotion/react": "catalog:",
"@emotion/styled": "catalog:",
"@fastgpt/global": "workspace:*",
"@fingerprintjs/fingerprintjs": "^4.3.0",
"@lexical/code": "0.12.6",
......@@ -23,22 +27,22 @@
"@monaco-editor/react": "^4.6.0",
"@tanstack/react-query": "^4.24.10",
"ahooks": "^3.9.5",
"axios": "^1.13.5",
"date-fns": "2.30.0",
"dayjs": "^1.11.7",
"i18next": "23.16.8",
"axios": "catalog:",
"date-fns": "catalog:",
"dayjs": "catalog:",
"i18next": "catalog:",
"js-cookie": "^3.0.5",
"lexical": "0.12.6",
"lodash": "^4.17.23",
"next": "15.5.12",
"next-i18next": "15.4.2",
"lodash": "catalog:",
"next": "catalog:",
"next-i18next": "catalog:",
"papaparse": "^5.4.1",
"react": "18.3.1",
"react": "catalog:",
"react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^8.7.1",
"react-dom": "18.3.1",
"react-dom": "catalog:",
"react-hook-form": "7.43.1",
"react-i18next": "14.1.2",
"react-i18next": "catalog:",
"react-markdown": "^9.0.1",
"react-photo-view": "^1.2.6",
"recharts": "^2.15.0",
......@@ -49,10 +53,10 @@
},
"devDependencies": {
"@types/js-cookie": "^3.0.5",
"@types/lodash": "^4.14.191",
"@types/lodash": "catalog:",
"@types/papaparse": "^5.3.7",
"@types/react": "18.3.1",
"@types/react": "catalog:",
"@types/react-beautiful-dnd": "^13.1.1",
"@types/react-dom": "18.3.0"
"@types/react-dom": "catalog:"
}
}
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "."
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,3 +5,43 @@ packages:
- projects/mcp_server
- scripts/icon
- sdk/*
overrides:
'@types/react': ^18
'@types/react-dom': ^18
react: ^18
react-dom: ^18
catalog:
'@chakra-ui/anatomy': ^2
'@chakra-ui/icons': ^2
'@chakra-ui/next-js': ^2
'@chakra-ui/react': ^2
'@chakra-ui/styled-system': ^2
'@chakra-ui/system': ^2
'@emotion/react': ^11
'@emotion/styled': ^11
'@modelcontextprotocol/sdk': ^1
'@fastgpt-sdk/storage': 0.6.15
'@types/lodash': ^4
'@types/react': ^18
'@types/react-dom': ^18
axios: 1.13.6
date-fns: ^3
dayjs: 1.11.19
eslint: ^8
eslint-config-next: 15.5.12
express: ^4
i18next: 23.16.8
js-yaml: ^4.1.1
json5: ^2.2.3
lodash: 4.17.23
minio: 8.0.7
next: 16.1.6
next-i18next: 15.4.2
next-rspack: 16.1.6
proxy-agent: ^6
react: ^18
react-dom: ^18
react-i18next: 14.1.2
zod: ^4
LOG_DEPTH=3
# 默认用户密码,用户名为 root,每次重启时会自动更新。
DEFAULT_ROOT_PSW=123456
# 数据库最大连接数
DB_MAX_LINK=5
# 自动同步索引,0 表示不同步
SYNC_INDEX=1
TOKEN_KEY=fastgpt
# 文件阅读时的密钥
FILE_TOKEN_KEY=filetokenkey
# 密钥加密key
AES256_SECRET_KEY=fastgptsecret
# root key, 最高权限
ROOT_KEY=fdafasd
# 强制将图片转成 base64 传递给模型
MULTIPLE_DATA_TO_BASE64=true
# 是否隐藏版权信息配置,只有值为 'true' 时隐藏
HIDE_CHAT_COPYRIGHT_SETTING=
# Service url
# 商业版地址
# PRO_URL=
# Plugin
PLUGIN_BASE_URL=http://localhost:3003
PLUGIN_TOKEN=token
# Code sandbox server
SANDBOX_URL=http://localhost:3002
SANDBOX_TOKEN=
# ai proxy api
AIPROXY_API_ENDPOINT=https://localhost:3010
AIPROXY_API_TOKEN=aiproxy
# 辅助生成模型(暂时只能指定一个,保证系统上激活了这个模型)
HELPER_BOT_MODEL=qwen-max
# OpenAI Base URL
# OPENAI_BASE_URL=https://api.openai.com/v1
# CHAT_API_KEY=sk-xxxx
# 日志
# 日志等级: trace | debug | info | warning | error | fatal
LOG_ENABLE_CONSOLE=true
LOG_CONSOLE_LEVEL=info
LOG_ENABLE_OTEL=false
LOG_OTEL_LEVEL=info
LOG_OTEL_SERVICE_NAME=fastgpt-client
LOG_OTEL_URL=http://localhost:4318/v1/logs
# 对象存储
STORAGE_VENDOR=minio # 如果是 Sealos 的对象存储填 aws-s3
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=
STORAGE_S3_ENDPOINT=http://localhost:9000
STORAGE_S3_FORCE_PATH_STYLE=true
STORAGE_S3_MAX_RETRIES=3
STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH=
# Redis URL
REDIS_URL=redis://default:mypassword@localhost:6379
# mongo 数据库连接参数,本地开发连接远程数据库时,可能需要增加 directConnection=true 参数,才能连接上。
MONGODB_URI="mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin&directConnection=true"
# 日志库
MONGODB_LOG_URI="mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin&directConnection=true"
# 向量库优先级: pg > oceanbase > milvus
# 向量量化等级: PG支持32/16, OceanBase支持32/8/1
VECTOR_VQ_LEVEL=32
# PG 向量库连接参数
PG_URL=postgresql://username:password@localhost:5432/postgres
# OceanBase 向量库连接参数
# OCEANBASE_URL=
# # milvus 向量库连接参数
# MILVUS_ADDRESS=
# MILVUS_TOKEN=
# 页面的地址,用于自动补全相对路径资源的 domain,注意后面不要跟 /
FE_DOMAIN=http://localhost:3000
# 文件域名,也是指向 FastGPT 服务,但是如果希望内容足够安全,可以独立分配一个域名,避免高危文件读取到主域名的内容。
FILE_DOMAIN=http://localhost:3000
# 二级路由,需要打包时候就确定
# NEXT_PUBLIC_BASE_URL=/fastai
# 插件市场
MARKETPLACE_URL=https://marketplace.fastgpt.cn
# 申请应用备案地址
APP_REGISTRATION_URL=
# 安全配置
# 启动 IP 限流(true),部分接口增加了 ip 限流策略,防止非正常请求操作。
USE_IP_LIMIT=false
# 工作流最大运行次数,避免极端的死循环情况
WORKFLOW_MAX_RUN_TIMES=500
# 循环最大运行次数,避免极端的死循环情况
WORKFLOW_MAX_LOOP_TIMES=50
# 服务器接收请求,最大大小,单位 MB
SERVICE_REQUEST_MAX_CONTENT_LENGTH=10
# 启用内网 IP 检查
CHECK_INTERNAL_IP=false
# 文件上传
# 最大上传文件大小,单位 MB
UPLOAD_FILE_MAX_SIZE=1000
# 最大上传文件数量
UPLOAD_FILE_MAX_AMOUNT=1000
# 密码错误锁时长:s
PASSWORD_LOGIN_LOCK_SECONDS=
# 密码过期月份,不设置则不会过期
PASSWORD_EXPIRED_MONTH=
# 最大登录客户端数量,默认为 10
MAX_LOGIN_SESSION=
# 工作流QPM(如果用户套餐里有限制,这里不生效)
CHAT_MAX_QPM=5000
# LLM 请求追踪保留小时
LLM_REQUEST_TRACKING_RETENTION_HOURS=6
# 特殊配置
# 自定义跨域,不配置时,默认都允许跨域(逗号分割)
ALLOWED_ORIGINS=
# 是否展示兑换码功能
SHOW_COUPON=false
# 是否展示优惠券功能
SHOW_DISCOUNT_COUPON=false
# 自定义 config.json 路径
CONFIG_JSON_PATH=
# HTML 转 Markdown 最大字符数(超过字符数不执行转化)
MAX_HTML_TRANSFORM_CHARS=
# 对话日志推送服务
# # 日志服务地址
# CHAT_LOG_URL=http://localhost:8080
# # 日志推送间隔
# CHAT_LOG_INTERVAL=10000
# # 日志来源ID前缀
# CHAT_LOG_SOURCE_ID_PREFIX=fastgpt-
# ==================== 基础配置 ====================
LOG_DEPTH=3
# 默认用户密码(用户名为 root),每次重启会自动更新。
DEFAULT_ROOT_PSW=123456
# 数据库最大连接数
DB_MAX_LINK=5
# 自动同步索引(0 表示不同步)
SYNC_INDEX=1
TOKEN_KEY=fastgpt
# 文件阅读时的密钥
FILE_TOKEN_KEY=filetokenkey
# 密钥加密 key
AES256_SECRET_KEY=fastgptsecret
# root key(最高权限)
ROOT_KEY=fdafasd
# 强制将图片转成 base64 传递给模型
MULTIPLE_DATA_TO_BASE64=true
# 是否隐藏版权信息配置,只有值为 true 时隐藏
HIDE_CHAT_COPYRIGHT_SETTING=
# ==================== 服务地址与集成 ====================
# 商业版地址
# PRO_URL=
# 插件服务
PLUGIN_BASE_URL=http://localhost:3003
PLUGIN_TOKEN=token
# 代码沙箱服务
SANDBOX_URL=http://localhost:3002
SANDBOX_TOKEN=
# AI Proxy API
AIPROXY_API_ENDPOINT=https://localhost:3010
AIPROXY_API_TOKEN=aiproxy
# 辅助生成模型(暂时只能指定一个,需保证系统中已激活该模型)
HELPER_BOT_MODEL=qwen-max
# OpenAI 配置(按需启用)
# OPENAI_BASE_URL=https://api.openai.com/v1
# CHAT_API_KEY=sk-xxxx
# ==================== 日志配置 ====================
# 日志等级: trace | debug | info | warning | error | fatal
LOG_ENABLE_CONSOLE=true
LOG_CONSOLE_LEVEL=info
LOG_ENABLE_OTEL=false
LOG_OTEL_LEVEL=info
LOG_OTEL_SERVICE_NAME=fastgpt-client
LOG_OTEL_URL=http://localhost:4318/v1/logs
# ==================== 对象存储 ====================
# 存储供应商;如果是 Sealos 的对象存储请填 aws-s3
STORAGE_VENDOR=minio
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY_ID=minioadmin
STORAGE_SECRET_ACCESS_KEY=minioadmin
STORAGE_PUBLIC_BUCKET=fastgpt-public
STORAGE_PRIVATE_BUCKET=fastgpt-private
STORAGE_EXTERNAL_ENDPOINT=
STORAGE_S3_ENDPOINT=http://localhost:9000
STORAGE_S3_FORCE_PATH_STYLE=true
STORAGE_S3_MAX_RETRIES=3
STORAGE_PUBLIC_ACCESS_EXTRA_SUB_PATH=
# ==================== 数据库与缓存 ====================
# Redis URL
REDIS_URL=redis://default:mypassword@localhost:6379
# MongoDB 连接参数;本地开发连接远程数据库时,可能需要添加 directConnection=true 才能连接
MONGODB_URI="mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin&directConnection=true"
# 日志库
MONGODB_LOG_URI="mongodb://myusername:mypassword@localhost:27017/fastgpt?authSource=admin&directConnection=true"
# 向量库优先级: pg > oceanbase > milvus
# 向量量化等级: PG 支持 32/16,OceanBase 支持 32/8/1
VECTOR_VQ_LEVEL=32
# PG 向量库连接参数
PG_URL=postgresql://username:password@localhost:5432/postgres
# OceanBase 向量库连接参数
# OCEANBASE_URL=
# Milvus 向量库连接参数
# MILVUS_ADDRESS=
# MILVUS_TOKEN=
# ==================== 域名与前端 ====================
# 页面地址,用于自动补全相对路径资源的 domain(注意结尾不要带 /)
FE_DOMAIN=http://localhost:3000
# 文件域名(也指向 FastGPT 服务);如需更高安全性可独立分配域名,避免高危文件读取到主域名内容
FILE_DOMAIN=http://localhost:3000
# 二级路由,需要在打包时确定
# NEXT_PUBLIC_BASE_URL=/fastai
# ==================== 产品相关链接 ====================
# 插件市场
MARKETPLACE_URL=https://marketplace.fastgpt.cn
# 申请应用备案地址
APP_REGISTRATION_URL=
# ==================== 安全与运行限制 ====================
# 启动 IP 限流(true);部分接口启用 IP 限流策略以防止异常请求
USE_IP_LIMIT=false
# 工作流最大运行次数,避免极端死循环
WORKFLOW_MAX_RUN_TIMES=500
# 循环最大运行次数,避免极端死循环
WORKFLOW_MAX_LOOP_TIMES=50
# 服务器接收请求的最大大小(MB)
SERVICE_REQUEST_MAX_CONTENT_LENGTH=10
# 启用内网 IP 检查
CHECK_INTERNAL_IP=false
# ==================== 上传与账号策略 ====================
# 最大上传文件大小(MB)
UPLOAD_FILE_MAX_SIZE=1000
# 最大上传文件数量
UPLOAD_FILE_MAX_AMOUNT=1000
# 密码错误锁定时长(秒)
PASSWORD_LOGIN_LOCK_SECONDS=
# 密码过期月份(不设置则不过期)
PASSWORD_EXPIRED_MONTH=
# 最大登录客户端数量(默认 10)
MAX_LOGIN_SESSION=
# 工作流 QPM(若用户套餐有限制,这里不生效)
CHAT_MAX_QPM=5000
# LLM 请求追踪保留时长(小时)
LLM_REQUEST_TRACKING_RETENTION_HOURS=6
# ==================== 功能开关与特殊配置 ====================
# 自定义跨域;不配置时默认允许所有跨域(逗号分割)
ALLOWED_ORIGINS=
# 是否展示兑换码功能
SHOW_COUPON=false
# 是否展示优惠券功能
SHOW_DISCOUNT_COUPON=false
# 自定义 config.json 路径
CONFIG_JSON_PATH=
# HTML 转 Markdown 最大字符数(超过后不执行转换)
MAX_HTML_TRANSFORM_CHARS=
# ==================== 对话日志推送(可选) ====================
# 日志服务地址
# CHAT_LOG_URL=http://localhost:8080
# 日志推送间隔
# CHAT_LOG_INTERVAL=10000
# 日志来源 ID 前缀
# CHAT_LOG_SOURCE_ID_PREFIX=fastgpt-
......@@ -10,6 +10,7 @@ RUN apk add --no-cache libc6-compat && npm install -g pnpm@9.4.0
# copy packages and one project
COPY pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY ./packages ./packages
COPY ./sdk ./sdk
COPY ./projects/app/package.json ./projects/app/package.json
RUN [ -f pnpm-lock.yaml ] || (echo "Lockfile not found." && exit 1)
......@@ -32,6 +33,7 @@ ARG base_url
COPY package.json pnpm-workspace.yaml .npmrc tsconfig.json .eslintrc.json ./
COPY --from=maindeps /app/node_modules ./node_modules
COPY --from=maindeps /app/packages ./packages
COPY --from=maindeps /app/sdk ./sdk
COPY ./projects/app ./projects/app
COPY --from=maindeps /app/projects/app/node_modules ./projects/app/node_modules
......
// @ts-nocheck
import type { NextConfig } from 'next';
import path from 'path';
import withBundleAnalyzerInit from '@next/bundle-analyzer';
import withRspack from 'next-rspack';
const withBundleAnalyzer = withBundleAnalyzerInit({
enabled: process.env.ANALYZE === 'true'
});
const withBundleAnalyzer = withBundleAnalyzerInit({ enabled: process.env.ANALYZE === 'true' });
const isDev = process.env.NODE_ENV === 'development';
......@@ -57,12 +58,21 @@ const nextConfig: NextConfig = {
{
module: /@scalar\/api-reference-react/,
message: /autoprefixer/
},
{
module: /any-promise[\\/]register\.js$/,
message: /Critical dependency: the request of a dependency is an expression/
},
{
module: /bullmq[\\/]dist[\\/](cjs|esm)[\\/]classes[\\/]child-processor\.js$/,
message: /Critical dependency: the request of a dependency is an expression/
}
];
Object.assign(config.resolve!.alias, {
'@mongodb-js/zstd': false,
'@aws-sdk/credential-providers': false,
'gcp-metadata': false,
snappy: false,
aws4: false,
'mongodb-client-encryption': false,
......@@ -148,4 +158,8 @@ const nextConfig: NextConfig = {
outputFileTracingRoot: path.join(__dirname, '../../')
};
export default withBundleAnalyzer(nextConfig);
const configWithPluginsExceptWithRspack = withBundleAnalyzer(nextConfig);
export default isDev
? withRspack(configWithPluginsExceptWithRspack)
: configWithPluginsExceptWithRspack;
......@@ -3,64 +3,66 @@
"version": "4.14.8",
"private": false,
"scripts": {
"dev": "NODE_OPTIONS='--max-old-space-size=8192' npm run build:workers && next dev",
"build": "npm run build:workers && npm run lint && npm run typecheck && next build --debug",
"dev": "npm run build:workers && next dev",
"build": "npm run build:workers && next build --debug --webpack",
"start": "next start",
"lint": "next lint",
"build:workers": "npx tsx scripts/build-workers.ts",
"typecheck": "tsc --noEmit --pretty",
"build:workers:watch": "npx tsx scripts/build-workers.ts --watch"
},
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@chakra-ui/anatomy": "2.2.1",
"@chakra-ui/icons": "2.1.1",
"@chakra-ui/next-js": "2.4.2",
"@chakra-ui/react": "2.10.7",
"@chakra-ui/styled-system": "2.9.1",
"@chakra-ui/system": "2.6.1",
"@chakra-ui/anatomy": "catalog:",
"@chakra-ui/icons": "catalog:",
"@chakra-ui/next-js": "catalog:",
"@chakra-ui/react": "catalog:",
"@chakra-ui/styled-system": "catalog:",
"@chakra-ui/system": "catalog:",
"@dagrejs/dagre": "^1.1.4",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@fastgpt-sdk/storage": "^0.6.15",
"@emotion/react": "catalog:",
"@emotion/styled": "catalog:",
"@fastgpt-sdk/storage": "catalog:",
"@fastgpt/global": "workspace:*",
"@fastgpt/service": "workspace:*",
"@fastgpt/web": "workspace:*",
"@fortaine/fetch-event-source": "^3.0.6",
"@modelcontextprotocol/sdk": "^1.26.0",
"@modelcontextprotocol/sdk": "catalog:",
"@node-rs/jieba": "2.0.1",
"@scalar/api-reference-react": "^0.8.1",
"@tanstack/react-query": "^4.24.10",
"ahooks": "^3.9.5",
"axios": "^1.13.5",
"date-fns": "2.30.0",
"dayjs": "^1.11.7",
"axios": "catalog:",
"date-fns": "catalog:",
"dayjs": "catalog:",
"echarts": "5.4.1",
"echarts-gl": "2.0.9",
"esbuild": "^0.25.11",
"framer-motion": "9.1.7",
"hyperdown": "^2.4.29",
"i18next": "23.16.8",
"i18next": "catalog:",
"immer": "^9.0.19",
"ip2region.js": "^3.1.6",
"js-yaml": "^4.1.1",
"json5": "^2.2.3",
"js-yaml": "catalog:",
"json5": "catalog:",
"jsondiffpatch": "^0.7.2",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.23",
"lodash": "catalog:",
"mermaid": "^10.9.4",
"minio": "^8.0.5",
"minio": "catalog:",
"nanoid": "^5.1.3",
"next": "15.5.12",
"next-i18next": "15.4.2",
"next": "catalog:",
"next-i18next": "catalog:",
"nprogress": "^0.2.0",
"p-limit": "^7.2.0",
"proxy-agent": "^6.5.0",
"qrcode": "^1.5.4",
"react": "18.3.1",
"react": "catalog:",
"react-day-picker": "^8.7.1",
"react-dom": "18.3.1",
"react-dom": "catalog:",
"react-hook-form": "7.43.1",
"react-i18next": "14.1.2",
"react-i18next": "catalog:",
"react-markdown": "^9.0.1",
"react-syntax-highlighter": "^15.5.0",
"react-textarea-autosize": "^8.5.4",
......@@ -75,25 +77,26 @@
"sass": "^1.58.3",
"undici": "^7.18.2",
"use-context-selector": "^1.4.4",
"zod": "^4.1.12"
"zod": "catalog:"
},
"devDependencies": {
"@next/bundle-analyzer": "^15.5.6",
"@next/bundle-analyzer": "16.1.6",
"@svgr/webpack": "^6.5.1",
"@types/js-yaml": "^4.0.9",
"@types/jsonwebtoken": "^9.0.3",
"@types/lodash": "^4.14.191",
"@types/lodash": "catalog:",
"@types/node": "^20.14.2",
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.5",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@types/react-syntax-highlighter": "^15.5.6",
"@types/request-ip": "^0.0.37",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "8.56.0",
"eslint-config-next": "15.5.12",
"eslint": "catalog:",
"eslint-config-next": "catalog:",
"next-rspack": "catalog:",
"tsx": "^4.20.6",
"typescript": "^5.1.3",
"vitest": "^3.0.9"
......
......@@ -28,7 +28,7 @@ import MyPopover from '@fastgpt/web/components/common/MyPopover';
import Tag from '@fastgpt/web/components/common/Tag';
import { useCopyData } from '@fastgpt/web/hooks/useCopyData';
import { useRequest } from '@fastgpt/web/hooks/useRequest';
import format from 'date-fns/format';
import { format } from 'date-fns/format';
import { useTranslation } from 'next-i18next';
import dynamic from 'next/dynamic';
import { useCallback } from 'react';
......
......@@ -35,7 +35,7 @@ import {
TeamMemberRoleEnum,
TeamMemberStatusEnum
} from '@fastgpt/global/support/user/team/constant';
import format from 'date-fns/format';
import { format } from 'date-fns/format';
import OrgTags from '@/components/support/user/team/OrgTags';
import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
import { useCallback, useState, useMemo } from 'react';
......
......@@ -6,7 +6,7 @@ import {
CallToolRequestSchema,
type CallToolResult,
ListToolsRequestSchema
} from '@modelcontextprotocol/sdk/types';
} from '@modelcontextprotocol/sdk/types.js';
import { callMcpServerTool, getMcpServerTools } from '@/service/support/mcp/utils';
import { type toolCallProps } from '@/service/support/mcp/type';
import { getErrText } from '@fastgpt/global/common/error/utils';
......
import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next';
import { NextAPI } from '@/service/middleware/entry';
import { type Tool } from '@modelcontextprotocol/sdk/types';
import { type Tool } from '@modelcontextprotocol/sdk/types.js';
import { getMcpServerTools } from '@/service/support/mcp/utils';
export type listToolsQuery = { key: string };
......
......@@ -4,7 +4,7 @@ import { MongoApp } from '@fastgpt/service/core/app/schema';
import { authAppByTmbId } from '@fastgpt/service/support/permission/app/auth';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { getAppLatestVersion } from '@fastgpt/service/core/app/version/controller';
import { type Tool } from '@modelcontextprotocol/sdk/types';
import { type Tool } from '@modelcontextprotocol/sdk/types.js';
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import { toolValueTypeList, valueTypeJsonSchemaMap } from '@fastgpt/global/core/workflow/constants';
import { type AppChatConfigType } from '@fastgpt/global/core/app/type';
......
......@@ -5,3 +5,5 @@ declare global {
}
}
}
export {};
......@@ -8,33 +8,37 @@
"start": "next start",
"lint": "next lint"
},
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@chakra-ui/anatomy": "2.2.1",
"@chakra-ui/icons": "2.1.1",
"@chakra-ui/next-js": "2.4.2",
"@chakra-ui/react": "2.10.7",
"@chakra-ui/styled-system": "2.9.1",
"@chakra-ui/system": "2.6.1",
"@chakra-ui/anatomy": "catalog:",
"@chakra-ui/icons": "catalog:",
"@chakra-ui/next-js": "catalog:",
"@chakra-ui/react": "catalog:",
"@chakra-ui/styled-system": "catalog:",
"@chakra-ui/system": "catalog:",
"@fastgpt/global": "workspace:*",
"@fastgpt/service": "workspace:*",
"@fastgpt/web": "workspace:*",
"axios": "^1.13.5",
"i18next": "23.16.8",
"axios": "catalog:",
"i18next": "catalog:",
"mongoose": "^8.10.1",
"next": "15.5.12",
"next-i18next": "15.4.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "14.1.2",
"zod": "^4.1.12"
"next": "catalog:",
"next-i18next": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"react-i18next": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"@svgr/webpack": "^6.5.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "15.5.12",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"eslint": "catalog:",
"eslint-config-next": "catalog:",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
......
......@@ -3,7 +3,8 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": ["./src/*"],
"@t3-oss/env-core": ["../../packages/service/node_modules/@t3-oss/env-core/dist/index.d.ts"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../../packages/**/*.ts"],
......
......@@ -13,14 +13,18 @@
"start": "bun src/index.ts",
"mcp_test": "npx @modelcontextprotocol/inspector"
},
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"@fastgpt/global": "workspace:*",
"@fastgpt/service": "workspace:*",
"@modelcontextprotocol/sdk": "^1.26.0",
"@modelcontextprotocol/sdk": "catalog:",
"chalk": "^5.3.0",
"dayjs": "^1.11.7",
"dayjs": "catalog:",
"dotenv": "^16.5.0",
"express": "^4.22.0"
"express": "catalog:"
},
"devDependencies": {
"@types/express": "^5.0.1"
......
......@@ -3,14 +3,13 @@
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "./dist",
"baseUrl": "./src",
"lib": ["ES2015", "DOM"]
"lib": ["ES2022", "DOM"]
}
}
......@@ -11,6 +11,10 @@
"test": "vitest run",
"test:watch": "vitest"
},
"engines": {
"node": "20.x",
"pnpm": "9.x"
},
"dependencies": {
"axios": "^1.7.9",
"crypto-js": "^4.2.0",
......
......@@ -10,6 +10,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.22.0"
"express": "catalog:"
}
}
......@@ -54,7 +54,7 @@
"ali-oss": "^6.23.0",
"cos-nodejs-sdk-v5": "^2.15.4",
"es-toolkit": "^1.43.0",
"minio": "^8.0.5",
"minio": "catalog:",
"vitest": "^4.0.16"
},
"devDependencies": {
......
......@@ -58,6 +58,23 @@ describe('string tools', () => {
expect(replaceVariable(123 as any, { name: 'Ada' })).toBe(123);
});
it('should treat $ special characters in replacement value as literals', () => {
// $1, $2 不应被解释为捕获组引用
expect(replaceVariable('value: {{val}}', { val: '$1' })).toBe('value: $1');
expect(replaceVariable('value: {{val}}', { val: '$2' })).toBe('value: $2');
// $$ 不应被解释为字面量 $
expect(replaceVariable('value: {{val}}', { val: '$$' })).toBe('value: $$');
// $& 不应被替换为整个匹配字符串
expect(replaceVariable('value: {{val}}', { val: '$&' })).toBe('value: $&');
// $` 和 $' 不应被替换为匹配前/后的内容
expect(replaceVariable('value: {{val}}', { val: "$'" })).toBe("value: $'");
expect(replaceVariable('value: {{val}}', { val: '$`' })).toBe('value: $`');
// 混合场景
expect(replaceVariable('result={{a}}&other={{b}}', { a: '$1', b: '$2' })).toBe(
'result=$1&other=$2'
);
});
it('should replace sensitive text', () => {
expect(replaceSensitiveText('Visit https://example.com/path?x=1')).toBe('Visit https://xxx');
expect(replaceSensitiveText('token ns-abc-123 and ns-xyz')).toBe('token xxx and xxx');
......
......@@ -9,16 +9,11 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@fastgpt/*": ["packages/*"],
"@test/*": ["test/*"]
}
"incremental": true
},
"exclude": ["node_modules", "**/node_modules", "**/node_modules/**"]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment