Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
speech_nlu_parse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵文静
speech_nlu_parse
Commits
f758d379
Commit
f758d379
authored
Jun 27, 2025
by
赵文静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改param,音乐传全部字段
parent
7a969c6a
Pipeline
#5487
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
c2c.http
c2c.http
+3
-3
service/speechNlu/domain.go
service/speechNlu/domain.go
+31
-14
No files found.
c2c.http
View file @
f758d379
...
...
@@ -39,7 +39,7 @@ X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db
"ip": "14.215.222.17",
"mac": "ece154a865eb",
"mid": "10f05",
"query":"
播放上一首古诗
",
"query":"
关闭静音模式
",
"requestId": "123456111"
}
...
...
@@ -60,7 +60,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": {}
}
...
...
@@ -101,7 +101,7 @@ Content-Type: application/json
"trafficParameter": "mode=childxx;macWifi=ece154a73d38;mid=11011;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": {}
}
...
...
service/speechNlu/domain.go
View file @
f758d379
...
...
@@ -507,8 +507,15 @@ func alarmDomain(params *model.SpeechDomainParams) []byte {
return
replyWithChat
(
error_reply
,
"doudi"
)
}
api
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
extra
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"extra"
]
.
(
string
)
object
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"object"
]
.
(
string
)
var
extra
,
object
string
if
v
,
ok
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"extra"
];
ok
{
extra
=
v
.
(
string
)
}
if
v1
,
ok
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"object"
];
ok
{
object
=
v1
.
(
string
)
}
//extra := params.SpeechWsResp.Dm.Command.Param["extra"].(string)
//object := params.SpeechWsResp.Dm.Command.Param["object"].(string)
var
extraParam
model
.
ExtraParams
if
err
:=
json
.
Unmarshal
([]
byte
(
extra
),
&
extraParam
);
err
!=
nil
{
...
...
@@ -717,13 +724,21 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
CheckCommandParam
()
{
return
replyWithChat
(
error_reply
,
"doudi"
)
}
else
{
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
!=
""
&&
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.MediaController.SetVolume"
{
if
strings
.
Contains
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
),
"-"
)
||
strings
.
Contains
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
),
"+"
)
{
var
volume
,
mode
string
if
v
,
ok
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
];
ok
{
volume
=
v
.
(
string
)
}
if
v1
,
ok
:=
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"mode"
];
ok
{
mode
=
v1
.
(
string
)
}
if
volume
!=
""
&&
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.MediaController.SetVolume"
{
if
strings
.
Contains
(
volume
,
"-"
)
||
strings
.
Contains
(
volume
,
"+"
)
{
pattern
:=
`([+-]?)(\d+)`
// 分组1:符号(+/-),分组2:数字
re
:=
regexp
.
MustCompile
(
pattern
)
// 查找所有匹配项
matches
:=
re
.
FindAllStringSubmatch
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
,
-
1
)
matches
:=
re
.
FindAllStringSubmatch
(
volume
,
-
1
)
var
sign
,
numStr
,
action
string
for
_
,
match
:=
range
matches
{
...
...
@@ -735,6 +750,8 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte {
if
numStr
!=
""
{
semanticParams
[
"degree"
]
=
model
.
ParamsStr
{
Origin
:
numStr
,
Norm
:
numStr
,
Code
:
0
}
}
else
{
semanticParams
[
"degree"
]
=
model
.
ParamsStr
{
Origin
:
"一"
,
Norm
:
"1"
,
Code
:
0
}
}
if
sign
==
"-"
{
...
...
@@ -744,22 +761,22 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte {
}
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
action
,
&
semanticParams
)
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
==
"max"
{
}
else
if
volume
==
"max"
{
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
"control_riseVolMax"
,
nil
)
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
==
"min"
{
}
else
if
volume
==
"min"
{
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
"control_reduceVolMin"
,
nil
)
}
else
{
semanticParams
:=
make
(
map
[
string
]
interface
{})
// 百分数
if
strings
.
Contains
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
,
"%"
)
{
parts
:=
strings
.
SplitN
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
,
"%"
,
2
)
if
strings
.
Contains
(
volume
,
"%"
)
{
parts
:=
strings
.
SplitN
(
volume
,
"%"
,
2
)
semanticParams
[
"degree"
]
=
model
.
ParamsStr
{
Origin
:
parts
[
0
],
Norm
:
parts
[
0
],
Code
:
0
}
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
"control_setVol"
,
&
semanticParams
)
}
// 分数
if
strings
.
Contains
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
,
"/"
)
{
num
,
err
:=
fractionToPercent
(
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
)
if
strings
.
Contains
(
volume
,
"/"
)
{
num
,
err
:=
fractionToPercent
(
volume
)
if
err
!=
nil
{
global
.
Logger
.
WithFields
(
logger
.
Fields
{
"requestId"
:
params
.
RequestId
,
...
...
@@ -774,12 +791,12 @@ func globalCtrlDomain(params *model.SpeechDomainParams) []byte {
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
"control_setVol"
,
&
semanticParams
)
}
semanticParams
[
"degree"
]
=
model
.
ParamsStr
{
Origin
:
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
),
Norm
:
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"volume"
]
.
(
string
)
,
Code
:
0
}
semanticParams
[
"degree"
]
=
model
.
ParamsStr
{
Origin
:
volume
,
Norm
:
volume
,
Code
:
0
}
return
transformGreeProtocolReply
(
query
,
"UniversalControl"
,
"control_setVol"
,
&
semanticParams
)
}
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.System.Sounds.OpenMode"
&&
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"mode"
]
.
(
string
)
==
"静音模式"
{
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.System.Sounds.OpenMode"
&&
mode
==
"静音模式"
{
return
transformGreeProtocolReply
(
query
,
"SystemControl"
,
"control_volumeOff"
,
nil
)
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.System.Sounds.CloseMode"
&&
params
.
SpeechWsResp
.
Dm
.
Command
.
Param
[
"mode"
]
.
(
string
)
==
"静音模式"
{
}
else
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.System.Sounds.CloseMode"
&&
mode
==
"静音模式"
{
return
transformGreeProtocolReply
(
query
,
"SystemControl"
,
"control_volumeOn"
,
nil
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment