Commit 22207490 authored by 赵文静's avatar 赵文静

修改音量调节,增加判断仅只有符号的情况

parent 2645ae89
Pipeline #5668 passed with stage
in 0 seconds
# 更新日志
## [3.4.4-beta] - 2025.8.5
### Changed
- 修改音量调节,增加判断仅只有符号的情况
## [3.4.3] - 2025.7.4
### Changed
- 上线正式服
......
......@@ -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": {}
}
......
......@@ -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 {
......
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