Przeglądaj źródła

为避免乱闪去掉完成灯效

Moki 2 tygodni temu
rodzic
commit
88561522b3
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      scripts/ble_relay.py

+ 4 - 3
scripts/ble_relay.py

@@ -34,8 +34,7 @@ STATUS_MAP = {
     "reasoning": "thinking",
     "using_tool": "ai",
     "running": "ai",
-    "completed": "success",
-    "session_completed": "success",
+    # "completed" 和 "session_completed" 跳动太快,不发送到灯
     "permission": "alarm",
     "error": "error"
 }
@@ -67,7 +66,9 @@ async def run_relay(device_name: str, service_uuid: str, char_uuid: str):
 
                 data = json.loads(line)
                 code = data.get("code", "idle")
-                mode = STATUS_MAP.get(code, "idle")
+                mode = STATUS_MAP.get(code)
+                if mode is None:
+                    continue
 
                 await client.write_gatt_char(char_uuid, mode.encode("utf-8"))
                 logger.info(f"Sent: {mode} (from code: {code})")