From cd09e8034fdc291c9fe69352c5577b0b096234c9 Mon Sep 17 00:00:00 2001 From: puke <1129090915@qq.com> Date: Mon, 22 Dec 2025 14:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96llm=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TEST_BATCH_VIDEO.md | 0 pixelle_video/config/manager.py | 6 ++++-- web/components/settings.py | 18 ++++++++++-------- web/i18n/locales/en_US.json | 6 ++++-- web/i18n/locales/zh_CN.json | 2 ++ 5 files changed, 20 insertions(+), 12 deletions(-) delete mode 100644 TEST_BATCH_VIDEO.md diff --git a/TEST_BATCH_VIDEO.md b/TEST_BATCH_VIDEO.md deleted file mode 100644 index e69de29..0000000 diff --git a/pixelle_video/config/manager.py b/pixelle_video/config/manager.py index 1634e7d..172fddc 100644 --- a/pixelle_video/config/manager.py +++ b/pixelle_video/config/manager.py @@ -153,8 +153,10 @@ class ConfigManager: updates = {} if comfyui_url is not None: updates["comfyui_url"] = comfyui_url - updates["comfyui_api_key"] = comfyui_api_key - updates["runninghub_api_key"] = runninghub_api_key + if comfyui_api_key is not None: + updates["comfyui_api_key"] = comfyui_api_key + if runninghub_api_key is not None: + updates["runninghub_api_key"] = runninghub_api_key if updates: self.update({"comfyui": updates}) diff --git a/web/components/settings.py b/web/components/settings.py index b4df0f7..2d470e0 100644 --- a/web/components/settings.py +++ b/web/components/settings.py @@ -189,22 +189,24 @@ def render_advanced_settings(): with col1: if st.button(tr("btn.save_config"), use_container_width=True, key="save_config_btn"): try: - # Save LLM configuration - if llm_api_key and llm_base_url and llm_model: + # Validate and save LLM configuration + if not (llm_api_key and llm_base_url and llm_model): + st.error(tr("status.llm_config_incomplete")) + else: config_manager.set_llm_config(llm_api_key, llm_base_url, llm_model) - # Save ComfyUI configuration + # Save ComfyUI configuration (optional fields, always save what's provided) config_manager.set_comfyui_config( comfyui_url=comfyui_url if comfyui_url else None, comfyui_api_key=comfyui_api_key if comfyui_api_key else None, runninghub_api_key=runninghub_api_key if runninghub_api_key else None ) - # Save to file - config_manager.save() - - st.success(tr("status.config_saved")) - safe_rerun() + # Only save to file if LLM config is valid + if llm_api_key and llm_base_url and llm_model: + config_manager.save() + st.success(tr("status.config_saved")) + safe_rerun() except Exception as e: st.error(f"{tr('status.save_failed')}: {str(e)}") diff --git a/web/i18n/locales/en_US.json b/web/i18n/locales/en_US.json index 5427925..f0a0d10 100644 --- a/web/i18n/locales/en_US.json +++ b/web/i18n/locales/en_US.json @@ -139,8 +139,10 @@ "status.video_generated": "✅ Video generated: {path}", "status.video_not_found": "Video file not found: {path}", "status.config_saved": "✅ Configuration saved", - "status.config_reset": "✅ Configuration reset to default", - "status.connection_success": "✅ Connected", + "status.config_reset": "✅ Configuration reset to defaults", + "status.llm_config_incomplete": "⚠️ LLM configuration incomplete, please fill in API Key, Base URL and Model", + "status.save_failed": "Save failed", + "status.connection_success": "✅ Connection successful", "status.connection_failed": "❌ Connection failed", "progress.generating_title": "Generating title...", "progress.generating_narrations": "Generating narrations...", diff --git a/web/i18n/locales/zh_CN.json b/web/i18n/locales/zh_CN.json index 1ac2b86..001e0a0 100644 --- a/web/i18n/locales/zh_CN.json +++ b/web/i18n/locales/zh_CN.json @@ -140,6 +140,8 @@ "status.video_not_found": "视频文件未找到:{path}", "status.config_saved": "✅ 配置已保存", "status.config_reset": "✅ 配置已重置为默认值", + "status.llm_config_incomplete": "⚠️ LLM 配置不完整,请填写 API Key、Base URL 和 Model", + "status.save_failed": "保存失败", "status.connection_success": "✅ 连接成功", "status.connection_failed": "❌ 连接失败", "progress.generating_title": "生成标题...",