From 178df8269344c4ca2601adef0c737650b1ee3b83 Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Mon, 16 Jun 2025 14:48:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=84=8F=E5=9B=BE?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=9B=A0=E7=BC=BA=E5=B0=91=20home=5Fassistan?= =?UTF-8?q?t=20=E9=85=8D=E7=BD=AE=E5=AF=BC=E8=87=B4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=A4=B1=E6=95=88=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/providers/intent/intent_llm/intent_llm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py index 9f9f4c4f..f2c5c306 100644 --- a/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py +++ b/main/xiaozhi-server/core/providers/intent/intent_llm/intent_llm.py @@ -172,7 +172,11 @@ class IntentProvider(IntentProviderBase): music_file_names = music_config["music_file_names"] prompt_music = f"{self.promot}\n{music_file_names}\n" - devices = conn.config["plugins"]["home_assistant"].get("devices", []) + home_assistant_cfg = conn.config["plugins"].get("home_assistant") + if home_assistant_cfg: + devices = home_assistant_cfg.get("devices", []) + else: + devices = [] if len(devices) > 0: hass_prompt = "\n下面是我家智能设备列表(位置,设备名,entity_id),可以通过homeassistant控制\n" for device in devices: