From bd70a8b8123e5c04fb091bfea6153d9390d9d683 Mon Sep 17 00:00:00 2001 From: Ke Sun Date: Fri, 27 Mar 2026 16:25:46 +0800 Subject: [PATCH] fix(app): localize validation messages and enhance error context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace English validation messages with Chinese localized strings - Update "model config" to "模型配置" - Update "memory config" to "记忆配置" - Enhance error message with detailed context about missing configurations - Add BizCode.CONFIG_MISSING error code for better error handling - Include missing_params in error context for debugging and client-side handling- --- api/app/services/app_service.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/app/services/app_service.py b/api/app/services/app_service.py index 4dcabff8..736049e5 100644 --- a/api/app/services/app_service.py +++ b/api/app/services/app_service.py @@ -1753,12 +1753,16 @@ class AppService: miss_params = [] if agent_cfg.default_model_config_id is None: - miss_params.append("model config") + miss_params.append("模型配置") if agent_cfg.memory.get("enabled") and not agent_cfg.memory.get("memory_config_id"): - miss_params.append("memory config") + miss_params.append("记忆配置") if miss_params: - raise BusinessException(f"{', '.join(miss_params)} is required") + raise BusinessException( + f"应用发布失败:检测到以下必要配置尚未完成:{', '.join(miss_params)}。请返回应用编辑页面完成相关配置后再尝试发布。", + BizCode.CONFIG_MISSING, + context={"missing_params": miss_params}, + ) config = { "system_prompt": agent_cfg.system_prompt,