mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 16:43:55 +08:00
fix:hass_set_state字符判断错误
This commit is contained in:
@@ -10,7 +10,7 @@ HASS_CACHE = {}
|
|||||||
def append_devices_to_prompt(conn):
|
def append_devices_to_prompt(conn):
|
||||||
if conn.use_function_call_mode:
|
if conn.use_function_call_mode:
|
||||||
funcs = conn.config["Intent"]["function_call"].get("functions", [])
|
funcs = conn.config["Intent"]["function_call"].get("functions", [])
|
||||||
if "hass_get_state" in funcs or "hass_get_state" in funcs:
|
if "hass_get_state" in funcs or "hass_set_state" in funcs:
|
||||||
prompt = "下面是我家智能设备,可以通过homeassistant控制\n"
|
prompt = "下面是我家智能设备,可以通过homeassistant控制\n"
|
||||||
devices = conn.config["plugins"]["home_assistant"].get("devices", [])
|
devices = conn.config["plugins"]["home_assistant"].get("devices", [])
|
||||||
if len(devices) == 0:
|
if len(devices) == 0:
|
||||||
@@ -27,9 +27,13 @@ def initialize_hass_handler(conn):
|
|||||||
if HASS_CACHE == {}:
|
if HASS_CACHE == {}:
|
||||||
if conn.use_function_call_mode:
|
if conn.use_function_call_mode:
|
||||||
funcs = conn.config["Intent"]["function_call"].get("functions", [])
|
funcs = conn.config["Intent"]["function_call"].get("functions", [])
|
||||||
if "hass_get_state" in funcs or "hass_get_state" in funcs:
|
if "hass_get_state" in funcs or "hass_set_state" in funcs:
|
||||||
HASS_CACHE['base_url'] = conn.config["plugins"]["home_assistant"].get("base_url")
|
HASS_CACHE["base_url"] = conn.config["plugins"]["home_assistant"].get(
|
||||||
HASS_CACHE['api_key'] = conn.config["plugins"]["home_assistant"].get("api_key")
|
"base_url"
|
||||||
|
)
|
||||||
|
HASS_CACHE["api_key"] = conn.config["plugins"]["home_assistant"].get(
|
||||||
|
"api_key"
|
||||||
|
)
|
||||||
|
|
||||||
check_model_key("home_assistant", HASS_CACHE['api_key'])
|
check_model_key("home_assistant", HASS_CACHE["api_key"])
|
||||||
return HASS_CACHE
|
return HASS_CACHE
|
||||||
|
|||||||
Reference in New Issue
Block a user