diff --git a/c2c.http b/c2c.http index 10de800752ee8de170cd3b1a49211fb1d46ceedc..1ec3652f55b1ca5612cf8edcf7d4c094aececbcc 100644 --- a/c2c.http +++ b/c2c.http @@ -10,7 +10,7 @@ Content-Type: application/json }, "nluRet": { "asr_recongize": "", - "text": "合肥今天几点下雨" + "text": "换一首歌" } }, "version": "v0" @@ -39,7 +39,7 @@ X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db "ip": "14.215.222.17", "mac": "ece154a865eb", "mid": "11011", - "query":"播放正版", + "query":"播放音乐", "requestId": "123456111" } diff --git a/service/speechNlu/domain.go b/service/speechNlu/domain.go index 13defc17ee0a1ea73db0585ac29f9871fcab7daf..4624698f8fd1e96b4042564edbd0f60ce362f70b 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -805,6 +805,26 @@ func musicDomain(params *model.SpeechDomainParams) []byte { database.DeleteSession(params.Mac) } + query := params.SpeechWsResp.Dm.Input + if !params.CheckDmCommand() { + return replyWithChat(error_reply, "doudi") + } else { + if params.SpeechWsResp.Dm.Command.Api != "" { + switch params.SpeechWsResp.Dm.Command.Api { + case "DUI.MediaController.Pause": + return transformGreeProtocolReply(query, "PlayControl", "control_pause", nil) + case "DUI.MediaController.Play": + return transformGreeProtocolReply(query, "PlayControl", "control_resume", nil) + case "DUI.MediaController.Stop": + return transformGreeProtocolReply(query, "PlayControl", "control_stop", nil) + case "DUI.MediaController.Next", "DUI.MediaController.Switch": + return transformGreeProtocolReply(query, "PlayControl", "control_next", nil) + case "DUI.MediaController.Prev": + return transformGreeProtocolReply(query, "PlayControl", "control_previous", nil) + } + } + } + list, err := connect.MusicGrpc(params) if err != nil { global.Logger.WithFields(logger.Fields{