From 7d7afa37e1f6fef1f4eac33fadc78791eccd40d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=96=87=E9=9D=99?= <1319697849@qq.com> Date: Wed, 25 Jun 2025 18:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8D=A2=E4=B8=80=E9=A6=96?= =?UTF-8?q?=E6=AD=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c2c.http | 4 ++-- service/speechNlu/domain.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/c2c.http b/c2c.http index 10de800..1ec3652 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 13defc1..4624698 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{ -- GitLab