From fc4631218bd5c37204970b0608aaef3e436187ea Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Thu, 16 Jul 2026 15:58:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6):?= =?UTF-8?q?=20=E8=A7=A3=E5=86=B3=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/core/config/settings.py | 2 ++ backend/app/services/admin/guide_service.py | 8 ++++++-- frontend/nginx.conf | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/app/core/config/settings.py b/backend/app/core/config/settings.py index 65d966c9..f588f693 100644 --- a/backend/app/core/config/settings.py +++ b/backend/app/core/config/settings.py @@ -78,6 +78,8 @@ def _backend_path(env_key: str, *parts: str) -> str: class Config: SQLALCHEMY_TRACK_MODIFICATIONS = False SECRET_KEY = os.getenv('SECRET_KEY') + # 配置最大上传文件大小(200MB) + MAX_CONTENT_LENGTH = 200 * 1024 * 1024 KB_STORAGE_ROOT = _data_path('KB_STORAGE_ROOT', 'kb') KB_TASK_EXECUTION_MODE = os.getenv('KB_TASK_EXECUTION_MODE', 'worker').strip().lower() KB_WORKER_POLL_SECONDS = float(os.getenv('KB_WORKER_POLL_SECONDS', '2')) diff --git a/backend/app/services/admin/guide_service.py b/backend/app/services/admin/guide_service.py index 23d4af1d..13e5fbbd 100644 --- a/backend/app/services/admin/guide_service.py +++ b/backend/app/services/admin/guide_service.py @@ -83,8 +83,12 @@ def upload_guide_file(file_storage: FileStorage | None) -> dict: if not file_storage or file_storage.filename == '': raise ValidationError('No selected file' if file_storage else 'No file part') content_type = file_storage.content_type - file_size = len(file_storage.read()) - file_storage.seek(0) + + # 更高效地获取文件大小,不一次性读取全部内容到内存 + file_storage.seek(0, 2) # 移动到文件末尾 + file_size = file_storage.tell() # 获取当前位置(即文件大小) + file_storage.seek(0) # 重置到文件开头 + try: object_name = minio_service.upload_file(file_storage, file_storage.filename, content_type, file_size) return { diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 04e607cd..d5182a56 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -1,7 +1,9 @@ server { listen 80; server_name localhost; - client_max_body_size 100m; + client_max_body_size 200m; + client_body_timeout 300s; + send_timeout 300s; resolver 127.0.0.11 valid=30s ipv6=off; resolver_timeout 5s; @@ -28,5 +30,7 @@ server { proxy_buffering off; proxy_cache off; proxy_read_timeout 300s; + proxy_connect_timeout 75s; + proxy_send_timeout 300s; } } From 6a26a4dba8e07f3e7c85b90e3481f4266374ab46 Mon Sep 17 00:00:00 2001 From: sophie Date: Fri, 17 Jul 2026 13:19:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(admin):=20=E4=BC=98=E5=8C=96=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/auth/composables/useLoginAuth.ts | 12 ++++++++++ .../features/chat/components/ChatSidebar.vue | 24 +++++++++---------- frontend/src/locales/en/auth.json | 1 + frontend/src/locales/th/auth.json | 1 + frontend/src/locales/zh-CN/auth.json | 1 + frontend/src/locales/zh-TW/auth.json | 1 + 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/frontend/src/features/auth/composables/useLoginAuth.ts b/frontend/src/features/auth/composables/useLoginAuth.ts index 8e533de5..4dd3009a 100644 --- a/frontend/src/features/auth/composables/useLoginAuth.ts +++ b/frontend/src/features/auth/composables/useLoginAuth.ts @@ -239,8 +239,20 @@ export function useLoginAuth(deps: LoginDeps, options: LoginAuthOptions) { } }; + /** + * 发起企业微信登录(OAuth 跳转)。 + * 核心逻辑:功能未就绪时提示用户;就绪后按 Casdoor/直连企微获取授权 URL 并跳转。 + * @returns Promise + */ const handleWecomLogin = async () => { if (!config.auth?.wecom?.enabled) return; + // TODO: 企微登录开发完成后改为 true + const wecomLoginReady = false; + if (!wecomLoginReady) { + msg.info(t('login.wecomComingSoon')); + return; + } + const wecomCfg = config.auth.wecom as { loginViaCasdoor?: boolean; callbackPath?: string; authorizeApi?: string }; const viaCasdoor = Boolean(wecomCfg?.loginViaCasdoor); try { diff --git a/frontend/src/features/chat/components/ChatSidebar.vue b/frontend/src/features/chat/components/ChatSidebar.vue index 05f79650..ec1cbe7b 100644 --- a/frontend/src/features/chat/components/ChatSidebar.vue +++ b/frontend/src/features/chat/components/ChatSidebar.vue @@ -2,7 +2,8 @@ * features/chat/components/ChatSidebar.vue * 用途:桌面端聊天侧栏,承载 Agent 信息、会话历史、Agent 切换面板与底部用户菜单。 * 依赖:lucide-vue-next、LocaleToggleButton、AgentCategoryList、chat.types。 - * 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈等操作回传给页面。 + * 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈、进入管理控制台等操作回传给页面。 + * 管理员通过底部右侧工具图标进入管理控制台;用户下拉菜单仅保留退出登录。 */