chore: backport selected main commits to v4.14.x (#6840)

* chore: bump pro submodule for hydration stability (#6808)

* sandbox-sync-agent

* refactor: host pro as submodule

* chore: checkpoint host pro restructure

* refactor workspace test layout and startup init

* chore: update next turbopack setup

* chore: snapshot current work before actions fix

* chore: update pro submodule

* chore: point pro submodule url to upstream https

* fix: Dockerfile

* chore: update pro submodule

* ci: support private pro submodule token and skip fork jobs

* fix(ci): build sdk workspace deps before code-sandbox bundle

* fix(app): exclude vitest configs from production typecheck

* fix(app-image): build sdk packages before next build

* fix(ci): align dockerfiles with workspace sdk build flow

* chore(docker): upgrade node20 docker images to node24

* fix(ci): read admin coverage output path in pro test workflow

* fix(app-image): include next-i18next config and locale assets

* chore: update pro submodule

* chore: do not specify branch for submodule

* chore: remove most ts-nocheck sign

* chore: update pro submodule

* chore: remove sandbox-agent-sync package

* chore: do not modify "pushData" file logic

* fix: health check

* chore: restore dev axios proxy state

* fix: test-fastgpt report workflow

* fix: use valid vitest coverage action inputs

* update shell (#6830)

* .codex (#6832)

* fix: home chat file uploads (#6838)

* chore: update actions workflow yamls

* chore: update turbo.json

* fix: split admin preview image workflows

* fix: allow home chat file uploads

* chore: add skip file type check env (#6839)

* chore: update actions workflow yamls (#6835)

* chore: update actions workflow yamls

* fix: allow pro workflows on fork pull requests

* chore: update turbo.json

* fix: split admin preview image workflows

* chore: bump pro submodule for admin typecheck

* chore: update pro submodule

* chore: bump pro submodule for turbo ignore

* chore: update pro submodule for file download api

---------

Co-authored-by: Archer <545436317@qq.com>
This commit is contained in:
Ryo
2026-04-28 18:00:31 +08:00
committed by GitHub
parent cbf2903d67
commit 5ccdcc1cd4
414 changed files with 26589 additions and 16431 deletions
+35 -95
View File
@@ -1,118 +1,58 @@
## Premise
# FastGPT 开发文档
Since FastGPT is managed in the same way as monorepo, it is recommended to install make first during development.
FastGPT 采用 monorepo 方式管理。
monorepo Project Name:
## 📁 仓库结构
- app: main project
-......
- `projects/app`: 开源主应用
- `projects/code-sandbox`: 代码沙盒
- `pro/admin`: 商业版后台
## Dev
## 启用开发
```sh
# Give automatic script code execution permission (on non-Linux systems, you can manually execute the postinstall.sh file content)
# 赋予脚本自动执行权限(非 Linux 系统可以手动执行 postinstall.sh 文件中的内容)
chmod -R +x ./scripts/
# Executing under the code root directory installs all dependencies within the root package, projects, and packages
# 在代码根目录下执行,会安装根 packageprojects packages 中的所有依赖
pnpm i
# 如果没有自动触发构建依赖,可以手动执行
pnpm build:sdks
# Not make cmd
# 不使用 make 命令启动
cd projects/app
pnpm dev
# Make cmd
# 使用 make 命令
make dev name=app
make dev name=admin
```
Note: If the Node version is >= 20, you need to pass the `--no-node-snapshot` parameter to Node when running `pnpm i`
## 插件安装
### 安装 i18n-ally 插件
安装 `i18n Ally` 插件,用于自动生成国际化文件。
## 构建
```sh
NODE_OPTIONS=--no-node-snapshot pnpm i
```
### Jest
https://fael3z0zfze.feishu.cn/docx/ZOI1dABpxoGhS7xzhkXcKPxZnDL
## I18N
### Install i18n-ally Plugin
1. Open the Extensions Marketplace in VSCode, search for and install the `i18n Ally` plugin.
### Code Optimization Examples
#### Fetch Specific Namespace Translations in `getServerSideProps`
```typescript
// pages/yourPage.tsx
export async function getServerSideProps(context: any) {
return {
props: {
currentTab: context?.query?.currentTab || TabEnum.info,
...(await serverSideTranslations(context.locale, ['publish', 'user']))
}
};
}
```
#### Use useTranslation Hook in Page
```typescript
// pages/yourPage.tsx
import { useTranslation } from 'next-i18next';
const YourComponent = () => {
const { t } = useTranslation();
return (
<Button
variant="outline"
size="sm"
mr={2}
onClick={() => setShowSelected(false)}
>
{t('common:close')}
</Button>
);
};
export default YourComponent;
```
#### Handle Static File Translations
```typescript
// utils/i18n.ts
import { i18nT } from '@fastgpt/web/i18n/utils';
const staticContent = {
id: 'simpleChat',
avatar: 'core/workflow/template/aiChat',
name: i18nT('app:template.simple_robot'),
};
export default staticContent;
```
### Standardize Translation Format
- Use the t(namespace:key) format to ensure consistent naming.
- Translation keys should use lowercase letters and underscores, e.g., common.close.
## audit
Please fill the AuditEventEnum and audit function is added to the ts, and on the corresponding position to fill i18n, at the same time to add the location of the log using addOpearationLog function add function
## Build
```sh
# Docker cmd: Build image, not proxy
# Docker 命令:构建镜像,不使用代理
docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 . --build-arg name=app
# Make cmd: Build image, not proxy
# Docker 命令:构建商业版 admin 镜像,不使用代理
docker build -f ./pro/admin/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:v4.8.1 . --build-arg name=admin
# Docker 命令:构建商业版 sso 镜像,不使用代理
docker build -f ./pro/sso/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.8.1 . --build-arg name=sso
# Make 命令:构建镜像,不使用代理
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1
make build name=admin image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:v4.8.1
make build name=sso image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.8.1
# Docker cmd: Build image with proxy
# Docker 命令:使用代理构建镜像
docker build -f ./projects/app/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 . --build-arg name=app --build-arg proxy=taobao
# Make cmd: Build image with proxy
# Docker 命令:使用代理构建商业版 admin 镜像
docker build -f ./pro/admin/Dockerfile -t registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:v4.8.1 . --build-arg name=admin --build-arg proxy=taobao
# Make 命令:使用代理构建镜像
make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8.1 proxy=taobao
make build name=admin image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-admin:v4.8.1 proxy=taobao
```