diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e99ff862924b7e4c065aa112799742614c8a0bf..b7f51d2bfa27564202746c077deeebbe23e49dcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # 更新日志 +## [3.4.4-beta] - 2025.8.5 +### Changed +- 修改音量调节,增加判断仅只有符号的情况 + ## [3.4.3] - 2025.7.4 ### Changed - 上线正式服 diff --git a/c2c.http b/c2c.http index a6329fc53429e84b227cb02ba8d11ca1229f4e4e..63520eaa66e867933d68fc368a04cc91b2e447c3 100644 --- a/c2c.http +++ b/c2c.http @@ -26,7 +26,7 @@ X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db "ip": "14.215.222.17", "mac": "ece154a865eb", "mid": "11011", - "query":"播放三国演义" , + "query":"声音调得小一点" , "requestId": "123456111" } ### @@ -40,13 +40,13 @@ X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db "ip": "14.215.222.17", "mac": "ece154a865eb", "mid": "10f05", - "query":"我想听梁山伯与祝英台", + "query":"声音升高10", "requestId": "123456111" } ### -#POST https://nlu.gree.com/semantic/unisoundc2c/querys -POST https://testnlu.gree.com/semantic/unisoundc2c/querys +POST https://nlu.gree.com/semantic/unisoundc2c/querys +#POST https://testnlu.gree.com/semantic/unisoundc2c/querys #POST http://172.28.124.216:9999/semantic/unisoundc2c/querys #POST http://172.28.5.39:9999/semantic/unisoundc2c/querys Content-Type: application/json @@ -61,7 +61,7 @@ Content-Type: application/json "trafficParameter": "mode=childxxx;macWifi=28b77c218ed1;mid=10f05;vender=7e000025;macVoice=testyuntiancloud;ver=3.0;scenario=smarthome;filterName=nlu;req_nlu_length=1;returnType=json;fullDuplex=true;appendLength=1;additionalService=geli_nlu2;version=0.5;filterUrl=https://testnlu.gree.com:443/semantic/unisoundc2c/querys;" }, "nluRet": { - "text": "上一首" + "text": "珠海天气" }, "postProc": {} } diff --git a/service/speechNlu/domain.go b/service/speechNlu/domain.go index 5869db3c73fa737ab94e88ef988dd688f3178101..76de391732c8c3e328d7140e078f2503f68344c9 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "fmt" + "log" "regexp" "speech-nlu-parse/global" "speech-nlu-parse/model" @@ -734,12 +735,24 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte { if volume != "" && params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.SetVolume" { if strings.Contains(volume, "-") || strings.Contains(volume, "+") { + var sign, numStr, action string + // 检查纯符号 + if volume == "-" { + semanticParams := make(map[string]interface{}) + semanticParams["degree"] = model.ParamsStr{Origin: "一", Norm: "1", Code: 0} + return transformGreeProtocolReply(query, "UniversalControl", "control_reduceVol", &semanticParams) + } else if volume == "+" { + semanticParams := make(map[string]interface{}) + semanticParams["degree"] = model.ParamsStr{Origin: "一", Norm: "1", Code: 0} + return transformGreeProtocolReply(query, "UniversalControl", "control_riseVol", &semanticParams) + } + + // 检查符号+数字(如 "-5") pattern := `([+-]?)(\d+)` // 分组1:符号(+/-),分组2:数字 re := regexp.MustCompile(pattern) // 查找所有匹配项 matches := re.FindAllStringSubmatch(volume, -1) - var sign, numStr, action string for _, match := range matches { sign = match[1] // 符号部分(可能为空) @@ -754,6 +767,9 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte { semanticParams["degree"] = model.ParamsStr{Origin: "一", Norm: "1", Code: 0} } + log.Println("11111111111111111") + fmt.Println(sign) + if sign == "-" { action = "control_reduceVol" } else {