Commit 2e1f8139 authored by 赵文静's avatar 赵文静

去掉fm、声音博物馆,增加儿歌

parent 0c2b5255
Pipeline #5250 passed with stage
in 0 seconds
...@@ -68,27 +68,27 @@ const ( ...@@ -68,27 +68,27 @@ const (
CHAT = "闲聊全库" CHAT = "闲聊全库"
CALENDAR = "日历" CALENDAR = "日历"
NEWS = "新闻" NEWS = "新闻"
ANCIENTPOEM = "诗词" ANCIENTPOEM = "诗词"
SPORTS = "sports" SPORTS = "sports"
ASTRO = "星座" ASTRO = "星座"
STOCK = "stock" STOCK = "stock"
TRANSLATE = "翻译大全" TRANSLATE = "翻译大全"
ALARM = "提醒" ALARM = "提醒"
SCIENCE = "计算器" SCIENCE = "计算器"
CHENGYU = "成语" CHENGYU = "成语"
BAIKE = "百科" BAIKE = "百科"
FM = "网络电台" FM = "网络电台"
CHILDMUSIC = "儿歌" CHILDMUSIC = "儿歌"
GLOBALCTRL = "中控" GLOBALCTRL = "中控"
PlayCTRL = "播放控制" PlayCTRL = "播放控制"
MUSIC = "音乐" MUSIC = "音乐"
HELP = "产品形象" HELP = "产品形象"
STORY = "故事" STORY = "故事"
FINANCE = "汇率" FINANCE = "汇率"
CONVERT = "单位换算" CONVERT = "单位换算"
HOLIDAY = "节假日查询" HOLIDAY = "节假日查询"
SLEEPMUSIC = "声音博物馆" //SLEEPMUSIC = "声音博物馆"
RELATION = "亲戚关系计算" RELATION = "亲戚关系计算"
WASTESORTING = "垃圾分类" WASTESORTING = "垃圾分类"
......
...@@ -331,11 +331,11 @@ func jokeDomain(params *model.SpeechDomainParams) []byte { ...@@ -331,11 +331,11 @@ func jokeDomain(params *model.SpeechDomainParams) []byte {
return replyWithChat(error_reply, "doudi") return replyWithChat(error_reply, "doudi")
} }
if params.SpeechWsResp.Dm.IntentName == "播放控制" { //if params.SpeechWsResp.Dm.IntentName == "播放控制" {
if params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Next" || params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Switch" { // if params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Next" || params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Switch" {
return transformGreeProtocolReply(params.SpeechWsResp.Dm.Input, "PlayControl", "control_next", nil) // return transformGreeProtocolReply(params.SpeechWsResp.Dm.Input, "PlayControl", "control_next", nil)
} // }
} //}
res.Header.Semantic.Domain = "joke" res.Header.Semantic.Domain = "joke"
res.Header.Semantic.Intent = "tell" res.Header.Semantic.Intent = "tell"
...@@ -1007,6 +1007,59 @@ func helpDomain(params *model.SpeechDomainParams) []byte { ...@@ -1007,6 +1007,59 @@ func helpDomain(params *model.SpeechDomainParams) []byte {
return Marshal(params, &result) return Marshal(params, &result)
} }
func childMusicDomain(params *model.SpeechDomainParams) []byte {
res, err := baseParse(params)
if err != nil {
global.Logger.WithFields(logger.Fields{
"requestId": params.RequestId,
"mac": params.Mac,
"mid": params.Mid,
"vender": params.MidType,
}).Error("childMusicDomain baseParse error.")
return replyWithChat(error_reply, "doudi")
}
res.Header.Semantic.Domain = "music"
res.Header.Semantic.Intent = "play"
res.Header.Semantic.SkillId = res.Header.Semantic.Domain + "." + res.Header.Semantic.Intent
res.ListItems = make([]map[string]interface{}, 0)
sliceData, isSlice := params.SpeechWsResp.Dm.Widget.Content.([]interface{})
if !isSlice {
global.Logger.WithFields(logger.Fields{
"requestId": params.RequestId,
"mac": params.Mac,
"mid": params.Mid,
"vender": params.MidType,
}).Error("params.SpeechWsResp.Dm.Widget.Content不是数组类型")
if res.ResponseText != "" {
return replyWithChat(res.ResponseText, "chat")
}
return replyWithChat(error_reply, "doudi")
}
for _, item := range sliceData {
itemBytes, _ := json.Marshal(item)
var con model.Content
if err := json.Unmarshal(itemBytes, &con); err != nil {
global.Logger.WithFields(logger.Fields{
"requestId": params.RequestId,
"mac": params.Mac,
"mid": params.Mid,
"vender": params.MidType,
}).Errorf("json.Unmarshal元素解析失败: %v", err)
return replyWithChat(error_reply, "doudi")
}
res.ListItems = append(res.ListItems, map[string]interface{}{
"url": con.LinkUrl,
"song": con.Title,
//思必驰的没有回复话术
//"content": params.Dm.Widget.Content[i].TextContent,
})
}
return Marshal(params, res)
}
func Marshal(params *model.SpeechDomainParams, res *model.ResponseBody) []byte { func Marshal(params *model.SpeechDomainParams, res *model.ResponseBody) []byte {
if res.Header.Semantic.Domain == "" { if res.Header.Semantic.Domain == "" {
res.Header.Semantic.Domain = "chat" res.Header.Semantic.Domain = "chat"
......
...@@ -38,12 +38,12 @@ func register() { ...@@ -38,12 +38,12 @@ func register() {
DomainRegister(SCIENCE, scienceDomain) DomainRegister(SCIENCE, scienceDomain)
DomainRegister(CHENGYU, chengyuDomain) DomainRegister(CHENGYU, chengyuDomain)
DomainRegister(BAIKE, baikeDomain) DomainRegister(BAIKE, baikeDomain)
DomainRegister(FM, fmDomain) //DomainRegister(FM, fmDomain)
DomainRegister(CHILDMUSIC, musicDomain) DomainRegister(CHILDMUSIC, childMusicDomain)
DomainRegister(GLOBALCTRL, globalCtrlDomain) DomainRegister(GLOBALCTRL, globalCtrlDomain)
DomainRegister(PlayCTRL, playCtrlDomain) DomainRegister(PlayCTRL, playCtrlDomain)
DomainRegister(MUSIC, musicDomain) DomainRegister(MUSIC, musicDomain)
DomainRegister(SLEEPMUSIC, sleepMusicDomain) //DomainRegister(SLEEPMUSIC, sleepMusicDomain)
DomainRegister(HELP, helpDomain) DomainRegister(HELP, helpDomain)
DomainRegister(STORY, fmDomain) DomainRegister(STORY, fmDomain)
DomainRegister(FINANCE, financeDomain) DomainRegister(FINANCE, financeDomain)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment