本帖最后由 piajava 于 2024-12-25 09:18 编辑
12.25更新,经过不断试错,将<artist>删掉就能在开发者工具中正常识别了,但是后来又遇到语音助手无法处理中文意图的bug,拼尽全力无法战胜,只好等更新再测试——————————————————————————————————————————————————————————————————————
前两天入手了官方assistant voice硬件,搭配官方推荐的MusicAssistant,想着终于可以通过语音控制音箱放歌了。
奈何实际一通操作下来发现并不行,查阅了MusicAssistant文档https://music-assistant.io/integration/voice/,说需要添加扩展意图,然而MusicAssistant只有英文的意图,于是试着汉化一下添加了进去。(en和zh-cn的意图都添加了)
现在问题是,在开发者工具-assistant中,语句解析器能正确识别英文的意图,没添加过扩展意图的中文(台湾)能识别中文意图,但是切换到中文(中国)后解析语句直接无反应,后台也看不到日志,是我意图配置有问题还是ha意图本身的缺陷?
下面是尝试的扩展意图设置
language: "zh-cn"
intents:
MassPlayMediaAssist:
data:
# 定位区域
- sentences:
- "<play><artist>{artist}<in>{area}"
- "<play>[<artist>{artist}的]<album>{album}<in>{area}"
- "<play>[<artist>{artist}的]<track>{track}<in>{area}"
- "<play><playlist>{playlist}<in>{area}"
- "<play><radio_station>{radio}<in>{area}"
expansion_rules:
play: "(play|播放|收听)"
artist: "(artist|艺术家|歌手)"
track: "(track|歌曲|音乐)"
album: "(album|专辑|唱片|合集|单曲)"
playlist: "(playlist|播放列表)"
radio_station: "(radio_station|广播电台|电台|频道)"
in: "(in|在)"
# 定位名称
- sentences:
- "<play><artist>{artist}<on>[<player_devices>]{name}"
- "<play>[<artist>{artist}的]<album>{album}<on>[<player_devices>]{name}"
- "<play>[<artist>{artist}的]<track>{track}<on>[<player_devices>]{name}"
- "<play><playlist>{playlist}<on>[<player_devices>]{name}"
- "<play><radio_station>{radio}<on>[<player_devices>]{name}"
expansion_rules:
play: "(play|播放|收听)"
player_devices: "(player_devices|扬声器|播放器)"
on: "(on|通过|用)"
artist: "(artist|艺术家|歌手)"
track: "(track|歌曲|音乐)"
album: "(album|专辑|唱片|合集|单曲)"
playlist: "(playlist|播放列表)"
radio_station: "(radio_station|广播电台|电台|频道)"
requires_context:
domain: "media_player"
# 定位区域和名称
- sentences:
- "<play><artist>{artist}<in>{area}<on>[<player_devices>]{name}"
- "<play>[<artist>{artist}的]<album>{album}<in>{area}<on>[<player_devices>]{name}"
- "<play>[<artist>{artist}的]<track>{track}<in>{area}<on>[<player_devices>]{name}"
- "<play><playlist>{playlist}<in>{area}<on>[<player_devices>]{name}"
- "<play><radio_station>{radio}<in>{area}<on>[<player_devices>]{name}"
expansion_rules:
play: "(play|播放|收听)"
player_devices: "(player_devices|扬声器|播放器)"
on: "(on|通过|用|里的)"
artist: "(artist|艺术家|歌手)"
track: "(track|歌曲|音乐)"
album: "(album|专辑|唱片|合集|单曲)"
playlist: "(playlist|播放列表)"
radio_station: "(radio_station|广播电台|电台|频道)"
in: "(in|在|用)"
# 上下文感知
- sentences:
- "<play><artist>{artist}"
- "<play>[<artist>{artist}的]<album>{album}"
- "<play>[<artist>{artist}的]<track>{track}"
- "<play><playlist>{playlist}"
- "<play><radio_station>{radio}"
expansion_rules:
play: "(play|播放|收听)"
artist: "(artist|艺术家|歌手)"
track: "(track|歌曲|音乐)"
album: "(album|专辑|唱片|合集|单曲)"
playlist: "(playlist|播放列表)"
radio_station: "(radio_station|广播电台|电台|频道)"
requires_context:
area:
slot: true
lists:
artist:
wildcard: true
album:
wildcard: true
track:
wildcard: true
playlist:
wildcard: true
radio:
wildcard: true
radio_mode:
values:
- "radio mode"
|