### 3.5.6 Smart Audio
#### (1)功能說明
模糊場景下抽取聊天關鍵詞,智能推薦兒童聽聽中相關的有聲資源。數據主要來自工程師爸爸、喜馬拉雅FM和蜻蜓FM,返回url包含mp3和m4a兩種格式。
#### (2) 接口說明
**請求方法**
* POST
**請求地址**
* [http://api.ruyi.ai/v1/message](http://api.ruyi.ai/v1/message)
**請求參數說明**
| 參數名 | 參數類型 | 是否必須 | 參數說明 |
| :--- | :--- | :---: | :--- |
| q | String | 是 | 自然語言表達,例如“寶寶要聽兒歌”等 |
| app\_key | String | 是 | 應用開發者秘鑰,注冊開發者后臺賬號,建立虛擬助理后獲得 |
| user\_id | String | 是 | 用戶唯一標識,便于支持個性化語義解析。建議開發者使用 UUID 字符,且不同用戶必須用不同的 user\_id,防止意圖串。 |
#### (3) 返回說明
**返回參數說明**
| 名稱 | 類型 | 說明 |
| :--- | :--- | :--- |
| code | Integer | 返回代碼 |
| msg | String | 返回代碼描述 |
| parameters | JSON Object | 解析到的實體以及服務說明 |
| action | String | 服務的接口名稱 |
| name | String | 匹配的意圖名稱 |
| result | JSON Object | 接口返回內容 |
| outputs | Array | 服務輸出結果,微信端使用 type 類型為 wechat 開頭的內容;硬件端收到所有內容,依據需求解析使用 |
**返回代碼說明**
| 返回代碼 | 錯誤類型 | 說明 |
| :--- | :--- | :--- |
| 0/200 | 成功 | 請求成功 |
| 400 | 無效請求 | 某些必需參數缺失或參數值錯誤,詳見msg字段 |
| 401 | 未授權 | 授權失敗,app\_key 缺失或錯誤 |
| 403 | 請求被禁止 | 有效請求,但服務拒絕響應,請聯系contact@ruyi.ai |
| 408 | 請求超時 | 請求響應超時,一般響應時間設置為2000ms以內 |
| 429 | 短時間內大量訪問 | 短時間內請求數過多 |
| 500 | 內部錯誤 | 服務處理異常 |
| 503 | 服務不可用 | 服務異常或正在維護 |
#### (4) 請求示例
**請求范例**
_寶寶要聽兒歌_
**請求示例**
(成功,返回符合結果的單曲,和該單曲所在專輯最多10個曲目的播放列表)
* http://api.ruyi.ai/ruyi-api/v1/message?app_key=APP_KEY&user_id=user0&q=寶寶要聽兒歌
返回結果
```
{
"code": 0,
"msg": "ok",
"result": {
"_text": "寶寶要聽兒歌",
"msg_id": "5a6f63d9-5945-41fe-9041-9f5e3e98c160",
"intents": [{
"parameters": {
"statedIn": "",
"tag": "兒歌",
"service": "smart_audio"
},
"action": "smart-audio",
"name": "smart audio",
"result": {
"code": 200,
"response": {
"code": 0,
"msg": "成功",
"result": {
"track_list": [{
"name": "嘟拉兒歌 024打電話",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "嘟拉兒歌",
"identifier": "4021184",
"image": "http://fdfs.xmcdn.com/group11/M00/35/FE/wKgDa1cN68HwdMK_AARP3SWiU0Q661_mobile_meduim.png",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "22167041",
"position": 2,
"durationInSeconds": 196,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group19/M01/34/13/wKgJJlfofFbjXj-sABfyX9-X3ng503.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group19/M01/33/D9/wKgJK1fofFiAw7BRABhA1fKMiCY986.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "英語兒歌-This Is The Way",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "精選英語兒歌",
"identifier": "4383321",
"image": "http://fdfs.xmcdn.com/group14/M01/7B/10/wKgDZFdF0rrwbrYdAAF88Pre0-Y561_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "16226785",
"position": 8,
"durationInSeconds": 61,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group14/M05/7B/1E/wKgDY1dF1H7j0W3JAAd0OedfpOo299.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group14/M05/7B/1E/wKgDY1dF1HyCsCEUAAePO3oZj-s716.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "你好,花木蘭",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "兔小貝兒歌-2",
"identifier": "246643",
"image": "http://fdfs.xmcdn.com/group5/M01/5D/18/wKgDtVOs1AORmriMAAFwDkni1vo926_mobile_meduim.png",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "23942470",
"position": 160,
"durationInSeconds": 249,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group25/M06/00/09/wKgJNlgQDlnzPZ9zAB6CXyVOcsc534.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group25/M06/00/0C/wKgJMVgQDlnTNMFPAB7j0QbIF3M384.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "【米粒媽分享】A-Hunting We Will Go",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "【最全】迪士尼最佳英文兒歌合集,寶貝磨耳朵必備!",
"identifier": "3934688",
"image": "http://fdfs.xmcdn.com/group28/M09/7E/3D/wKgJXFkpAQ6x0ytGAAEWn_yKL9Q801_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "16423524",
"position": 31,
"durationInSeconds": 74,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group13/M02/80/A7/wKgDXldLvRmA6vNTAAkggKfpwX8291.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group13/M02/80/BA/wKgDXVdLvRqxAKAwAAlCWmwaX_k513.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "Track 11",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "字母舞蹈",
"identifier": "3337772",
"image": "http://fdfs.xmcdn.com/group13/M06/C9/24/wKgDXVZq5MeTEYEhAAd-3wcoPkk402_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "10711341",
"position": 125,
"durationInSeconds": 46,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group8/M05/C8/E5/wKgDYVZq58CgFO1hAAWrvAtUjSI112.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group9/M09/C9/0A/wKgDYlZq6CGA4LPMAAXCcwnzoVg964.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "Christopher columbus小菲清唱",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "My very first mother goose鵝媽媽經典童謠",
"identifier": "292196",
"image": "http://fdfs.xmcdn.com/group4/M05/8F/25/wKgDtFROOPnB91Q4AAKR5JSs4V4538_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "4601517",
"position": 17,
"durationInSeconds": 22,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group5/M05/D5/69/wKgDtVSIcUigo85WAAK7ZOMQWsE524.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group16/M03/4F/89/wKgDbFWzXZWQetykAALHiOMimWU784.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "61 Roses Are Red",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "鵝媽媽童謠",
"identifier": "374575",
"image": "http://fdfs.xmcdn.com/group6/M02/FC/12/wKgDhFUjex_BYZlpAAIHxs7Ciy0600_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "6140840",
"position": 59,
"durationInSeconds": 19,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M0A/FC/1C/wKgDhFUjfiGAV6ElAAJUhCpSQ68311.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group16/M0B/3D/4E/wKgDbFWd8jHBZWkKAAJhQhdhMoo401.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "192 照相機",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "洪恩寶寶樂500首(1-200)",
"identifier": "342560",
"image": "http://fdfs.xmcdn.com/group6/M09/27/3A/wKgDhFTcOMeTS1VfAACyKRebLBQ387_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "5463588",
"position": 8,
"durationInSeconds": 15,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M03/27/F2/wKgDhFTcXgDCPF6xAAHnhcYY3Ag933.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group14/M03/34/58/wKgDY1WTj_Lg1C3CAAHyupceCd8146.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "1-Make A Circle",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "DrBing分級兒歌-1",
"identifier": "365808",
"image": "http://fdfs.xmcdn.com/group6/M02/C1/2B/wKgDhFUSfurydvNlAAB9piO_Oqo498_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "5990015",
"position": 20,
"durationInSeconds": 64,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group6/M04/C5/2F/wKgDg1USfabx3Uh-AAfoyST7aco674.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group11/M03/29/35/wKgDa1WFRhKwCHhhAAgFSLyhO8Y130.m4a",
"encodingFormat": "m4a"
}]
}]
}, {
"name": "03 Animal Song",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"mergedFrom": [{
"inAlbum": {
"name": "Wee Sing- Animals, Animals, Animals 動物大游行",
"identifier": "4091469",
"image": "http://fdfs.xmcdn.com/group14/M0B/48/9E/wKgDZFcRtd3gRkGhAAFm9FPtak4573_mobile_meduim.jpg",
"@type": ["MusicAlbum", "CreativeWork", "Thing"]
},
"identifier": "14479942",
"position": 1,
"durationInSeconds": 38,
"statedIn": "www.ximalaya.com",
"@type": ["MusicRecording", "CreativeWork", "Thing"],
"audio": [{
"contentUrl": "http://fdfs.xmcdn.com/group8/M03/47/26/wKgDYFcRtjzS3GIPAASx5GHNcso456.mp3",
"encodingFormat": "mp3"
}, {
"contentUrl": "http://audio.xmcdn.com/group8/M03/47/25/wKgDYVcRtj3ijp3dAATFnw0RAPQ472.m4a",
"encodingFormat": "m4a"
}]
}]
}],
"msg": "ok"
}
},
"text": "即將播放【嘟拉兒歌 024打電話】",
"type": "dialog"
},
"outputs": [{
"type": "wechat.text",
"property": {
"text": "即將播放【嘟拉兒歌 024打電話】"
}
}, {
"type": "dialog",
"property": {
"text": "即將播放【嘟拉兒歌 024打電話】",
"emotion": "calm"
}
}],
"score": "1.0",
"scoreColor": "c4",
"is_match": 1,
"skill_id": "afc2b4c4-77fc-4117-af0d-9ea6f3f150a6",
"id": "b9423786-9aa0-45a2-ba30-f7100b47688c"
}],
"meta_process_milliseconds": 307
}
}
```
**詳細參數說明**
| 名稱 | 類型 | 說明 |
| :--- | :--- | :--- |
| service | String | 服務名稱 |
|tag|String | 標簽名,包含兒歌、故事、國學、詩詞等,多個標簽用后綴1,2...數字區分 |
|trackName|String |識別到的音頻名稱|
|statedIn|String |數據來源網站|
|track_list|String |返回的音頻列表|
|name|String |音頻名稱|
|@type|String |實體類型|
|identifier|String|數據來源網站ID|
|durationInSeconds|String|音頻時長|
|position|String|音頻在專輯中的位置|
|inAlbum|String|音頻所在專輯|
|image|String | 專輯封面地址 |
- 1. 海知智能第三方技能插件開放平臺概述
- 2. 快速接入API
- 2.1 硬件接口調用
- 2.2 快速接入微信
- 2.3 API接入常見問題
- 3. 技能插件
- 3.1 基礎能力類
- 頂級過濾器
- 用戶知識圖譜
- 機器人檔案
- 通用閑聊
- 兒童閑聊
- Smart Reply
- 輕量閑聊
- 3.2 語音游戲類
- 成語接龍
- 詞匯樂園
- 詞語接龍
- 鸚鵡學舌
- 動腦猜猜
- 挑戰單詞
- 冒險世界
- 猜猜我是誰
- 阿拉丁學詩詞
- 貓貓托管所
- 漂流瓶
- 詩詞大會
- 國學大會
- 我愛猜歌名
- 我在看著你
- 燈謎猜猜
- 3.3 休閑娛樂類
- 星座運勢
- 悅耳聲音
- 幸運簽
- 調教機器人
- 娛樂推送
- 3.4 生活服務類
- 黃歷
- 計算器
- 古詩詞
- 時間詢問
- 翻譯類技能
- 天氣資訊
- 日程創建
- 日程創建指令
- 鬧鐘
- 食材知識
- 冥想音樂
- 格言
- 每日英語
- 漢語詞典
- 豆果菜譜
- 古文翻譯
- 3.5 音頻點播類
- 喜馬拉雅FM
- 新聞廣播
- 音樂點播
- Smart Music
- 兒童聽聽
- Smart Audio
- 兒童笑話
- 點播控制指令
- 3.6 視頻點播類
- 影視點播
- 3.7 百科知識類
- 人物百科
- 百科問答
- 實時百科
- 3.8 體育健康類
- 五分鐘健身
- 4. 開發者初級教程
- 4.1 開通服務
- 4.2 創建機器人
- 4.3 設置機器人
- 4.4 獲取技能插件
- 4.5 讓機器人學會聊天
- 4.6 導入知識庫
- 4.7 多種問答形式
- 4.8 數據統計
- 4.9 粉絲管理
- 5. 開發者中級教程
- 5.1 詞典運用
- 5.2 意圖處理
- 5.3 暗號使用
- 5.4 事件觸發
- 5.5 優先級
- 5.6 觸發器
- 5.7 快捷鍵
- 5.8 意圖報錯
- 6. 開發者高級教程
- 6.1 handlebars模版語言
- 6.2 JavaScript簡單介紹
- 6.3 JavaScript使用說明
- 6.4 JavaScript使用案例
- 6.5 JavaScript常見問題
- 7. 快速發布技能
- 8. 幫助中心
- 8.1 常見概念
- 8.2 幫助視頻
- 8.3 聯系我們