Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(frontend): pass {size} param to fileSizeExceeded i18n on Nginx 413

jackson.jia10383c6ddd67
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index fe44bc163..baf0db9ec 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -12,7 +12,7 @@ declare global {
// 从运行时配置获取最大文件大小(MB),支持 Docker 环境动态配置
// 优先级:运行时配置 > 构建时环境变量 > 默认值 50MB
-const MAX_FILE_SIZE_MB = window.__RUNTIME_CONFIG__?.MAX_FILE_SIZE_MB
+export const MAX_FILE_SIZE_MB = window.__RUNTIME_CONFIG__?.MAX_FILE_SIZE_MB
|| Number(import.meta.env.VITE_MAX_FILE_SIZE_MB)
|| 50;
const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;
diff --git a/frontend/src/utils/request.ts b/frontend/src/utils/request.ts
index 7b2c51811..bbdd146c3 100644
--- a/frontend/src/utils/request.ts
+++ b/frontend/src/utils/request.ts
@@ -1,6 +1,6 @@
// src/utils/request.js
import axios from "axios";
-import { generateRandomString } from "./index";
+import { generateRandomString, MAX_FILE_SIZE_MB } from "./index";
import i18n from '@/i18n'
import { getApiBaseUrl } from './api-base';
@@ -185,7 +185,7 @@ instance.interceptors.response.use(
if (error.response.status === 413) {
return Promise.reject({
status: 413,
- message: t('error.fileSizeExceeded'),
+ message: i18n.global.t('error.fileSizeExceeded', { size: MAX_FILE_SIZE_MB }),
success: false
});
}