From b3a6f73db4dfca3d7f6cadc60572f6367f92ea0f Mon Sep 17 00:00:00 2001 From: qinglong Date: Sun, 14 Jun 2026 10:42:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=90=8E=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E7=89=88=E6=9C=AC=E5=8F=B7=E5=88=B0base=5Fconfig.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/update_service.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/update_service.py b/services/update_service.py index fcf6126..74b0f08 100644 --- a/services/update_service.py +++ b/services/update_service.py @@ -231,6 +231,25 @@ class UpdateService: self.status["progress"] = 80 + # 4.5 同步版本号到旧配置文件 + try: + old_cfg_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml") + new_tpl_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml.example") + if os.path.exists(old_cfg_path) and os.path.exists(new_tpl_path): + import yaml as _yaml + with open(new_tpl_path) as f: + new_tpl = _yaml.safe_load(f) + new_ver = new_tpl.get("framework", {}).get("version", "") + if new_ver: + with open(old_cfg_path) as f: + old_cfg = _yaml.safe_load(f) or {} + old_cfg.setdefault("framework", {})["version"] = new_ver + with open(old_cfg_path, "w") as f: + _yaml.dump(old_cfg, f, default_flow_style=False, allow_unicode=True) + logger.info(f"📝 版本号已同步: {new_ver}") + except Exception as e: + logger.warning(f"版本号同步失败: {e}") + # 5. 安装依赖 (子进程) req_file = str(_PROJECT_ROOT / "requirements.txt") if os.path.exists(req_file):