From 7516dac45b2f7fcbd71fe212669d602d4f29f473 Mon Sep 17 00:00:00 2001 From: c1pher Date: Fri, 14 Mar 2025 00:27:05 +0800 Subject: [PATCH] Update functionCallConfig.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新音乐播放和开关设备的function --- .../config/functionCallConfig.py | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/main/xiaozhi-server/config/functionCallConfig.py b/main/xiaozhi-server/config/functionCallConfig.py index dd9b55fc4..b8b35771a 100644 --- a/main/xiaozhi-server/config/functionCallConfig.py +++ b/main/xiaozhi-server/config/functionCallConfig.py @@ -17,20 +17,47 @@ FunctionCallConfig = [ } }, { - "type": "function", - "function": { - "name": "play_music", - "description": "唱歌、听歌、播放音乐方法。比如用户说播放音乐,参数为:random,比如用户说播放两只老虎,参数为:两只老虎", + "type": "function", + "function": { + "name": "hass_toggle_device", + "description": "用homeassistant帮助用户打开或关闭设备", "parameters": { "type": "object", "properties": { - "song_name": { + "state": { "type": "string", - "description": "歌曲名称,如果没有指定具体歌名则为'random'" + "enum": ["on", "off"], + "description": "指定开还是关,开是on,关是off" + }, + "entity_id": { + "type": "string", + "description": "需要操作的设备id,homeassistant里的entity_id" } }, - "required": ["song_name"] + "required": ["state", "entity_id"] + } + } + }, + { + "type": "function", + "function": { + "name": "hass_play_music", + "description": "用户想听音乐、有声书的时候使用,在房间的媒体播放器(media_player)里播放对应音频", + "parameters": { + "type": "object", + "properties": { + "media_content_id": { + "type": "string", + "description": "可以是音乐或有声书的专辑名称、歌曲名、演唱者,如果未指定就填random" + }, + "entity_id": { + "type": "string", + "description": "需要操作的音箱的设备id,homeassistant里的entity_id,media_player开头" + } + }, + "required": ["media_content_id", "entity_id"] } } } - ] \ No newline at end of file + + ]