From ee5e998631473979efd203c8842d316cf9e9fcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=96=87=E9=9D=99?= <1319697849@qq.com> Date: Thu, 26 Jun 2025 08:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8D=A2=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=95=85=E4=BA=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + c2c.http | 4 ++-- service/speechNlu/domain.go | 18 ++++++++++++++++++ service/speechNlu/speech.go | 3 +++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 592f397..a753fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 故事返回增加专辑字段 - http入口新增需要AppKey校验 - 增加换一首歌 +- 增加换个故事 ## [0.0.1-beta.3] - 2025.6.19 ### Changed diff --git a/c2c.http b/c2c.http index 1ec3652..2c4bba1 100644 --- a/c2c.http +++ b/c2c.http @@ -25,7 +25,7 @@ X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db "ip": "14.215.222.17", "mac": "ece154a865eb", "mid": "11011", - "query":"换一首歌", + "query":"换个故事", "requestId": "123456111" } @@ -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 4624698..8f579b3 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -642,6 +642,24 @@ func fmDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } + query := params.SpeechWsResp.Dm.Input + if params.CheckDmCommand() { + 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) + } + } + } + res.Header.Semantic.Domain = "fm" res.Header.Semantic.Intent = "play_radio" res.Header.Semantic.SkillId = res.Header.Semantic.Domain + "." + res.Header.Semantic.Intent diff --git a/service/speechNlu/speech.go b/service/speechNlu/speech.go index 6641ae9..799a9b0 100644 --- a/service/speechNlu/speech.go +++ b/service/speechNlu/speech.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "github.com/gorilla/websocket" + "log" "speech-nlu-parse/dao" "speech-nlu-parse/global" "speech-nlu-parse/model" @@ -164,6 +165,8 @@ func receiveMessage(conn *websocket.Conn, done chan struct{}, dataChan chan<- [] "time": fmt.Sprintf("%.3fs", time.Since(start).Seconds()), }).Info("speech origin data") + log.Println(string(message)) + //思必驰nlu回复 var resp model.SpeechWsResp if err := json.Unmarshal(message, &resp); err != nil { -- GitLab