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
2e1f8139
Commit
2e1f8139
authored
May 20, 2025
by
赵文静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉fm、声音博物馆,增加儿歌
parent
0c2b5255
Pipeline
#5250
passed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
29 deletions
+82
-29
service/speechNlu/constant.go
service/speechNlu/constant.go
+21
-21
service/speechNlu/domain.go
service/speechNlu/domain.go
+58
-5
service/speechNlu/register.go
service/speechNlu/register.go
+3
-3
No files found.
service/speechNlu/constant.go
View file @
2e1f8139
...
...
@@ -68,27 +68,27 @@ const (
CHAT
=
"闲聊全库"
CALENDAR
=
"日历"
NEWS
=
"新闻"
ANCIENTPOEM
=
"诗词"
SPORTS
=
"sports"
ASTRO
=
"星座"
STOCK
=
"stock"
TRANSLATE
=
"翻译大全"
ALARM
=
"提醒"
SCIENCE
=
"计算器"
CHENGYU
=
"成语"
BAIKE
=
"百科"
FM
=
"网络电台"
CHILDMUSIC
=
"儿歌"
GLOBALCTRL
=
"中控"
PlayCTRL
=
"播放控制"
MUSIC
=
"音乐"
HELP
=
"产品形象"
STORY
=
"故事"
FINANCE
=
"汇率"
CONVERT
=
"单位换算"
HOLIDAY
=
"节假日查询"
SLEEPMUSIC
=
"声音博物馆"
NEWS
=
"新闻"
ANCIENTPOEM
=
"诗词"
SPORTS
=
"sports"
ASTRO
=
"星座"
STOCK
=
"stock"
TRANSLATE
=
"翻译大全"
ALARM
=
"提醒"
SCIENCE
=
"计算器"
CHENGYU
=
"成语"
BAIKE
=
"百科"
FM
=
"网络电台"
CHILDMUSIC
=
"儿歌"
GLOBALCTRL
=
"中控"
PlayCTRL
=
"播放控制"
MUSIC
=
"音乐"
HELP
=
"产品形象"
STORY
=
"故事"
FINANCE
=
"汇率"
CONVERT
=
"单位换算"
HOLIDAY
=
"节假日查询"
//
SLEEPMUSIC = "声音博物馆"
RELATION
=
"亲戚关系计算"
WASTESORTING
=
"垃圾分类"
...
...
service/speechNlu/domain.go
View file @
2e1f8139
...
...
@@ -331,11 +331,11 @@ func jokeDomain(params *model.SpeechDomainParams) []byte {
return
replyWithChat
(
error_reply
,
"doudi"
)
}
if
params
.
SpeechWsResp
.
Dm
.
IntentName
==
"播放控制"
{
if
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.MediaController.Next"
||
params
.
SpeechWsResp
.
Dm
.
Command
.
Api
==
"DUI.MediaController.Switch"
{
return
transformGreeProtocolReply
(
params
.
SpeechWsResp
.
Dm
.
Input
,
"PlayControl"
,
"control_next"
,
nil
)
}
}
//
if params.SpeechWsResp.Dm.IntentName == "播放控制" {
//
if params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Next" || params.SpeechWsResp.Dm.Command.Api == "DUI.MediaController.Switch" {
//
return transformGreeProtocolReply(params.SpeechWsResp.Dm.Input, "PlayControl", "control_next", nil)
//
}
//
}
res
.
Header
.
Semantic
.
Domain
=
"joke"
res
.
Header
.
Semantic
.
Intent
=
"tell"
...
...
@@ -1007,6 +1007,59 @@ func helpDomain(params *model.SpeechDomainParams) []byte {
return
Marshal
(
params
,
&
result
)
}
func
childMusicDomain
(
params
*
model
.
SpeechDomainParams
)
[]
byte
{
res
,
err
:=
baseParse
(
params
)
if
err
!=
nil
{
global
.
Logger
.
WithFields
(
logger
.
Fields
{
"requestId"
:
params
.
RequestId
,
"mac"
:
params
.
Mac
,
"mid"
:
params
.
Mid
,
"vender"
:
params
.
MidType
,
})
.
Error
(
"childMusicDomain baseParse error."
)
return
replyWithChat
(
error_reply
,
"doudi"
)
}
res
.
Header
.
Semantic
.
Domain
=
"music"
res
.
Header
.
Semantic
.
Intent
=
"play"
res
.
Header
.
Semantic
.
SkillId
=
res
.
Header
.
Semantic
.
Domain
+
"."
+
res
.
Header
.
Semantic
.
Intent
res
.
ListItems
=
make
([]
map
[
string
]
interface
{},
0
)
sliceData
,
isSlice
:=
params
.
SpeechWsResp
.
Dm
.
Widget
.
Content
.
([]
interface
{})
if
!
isSlice
{
global
.
Logger
.
WithFields
(
logger
.
Fields
{
"requestId"
:
params
.
RequestId
,
"mac"
:
params
.
Mac
,
"mid"
:
params
.
Mid
,
"vender"
:
params
.
MidType
,
})
.
Error
(
"params.SpeechWsResp.Dm.Widget.Content不是数组类型"
)
if
res
.
ResponseText
!=
""
{
return
replyWithChat
(
res
.
ResponseText
,
"chat"
)
}
return
replyWithChat
(
error_reply
,
"doudi"
)
}
for
_
,
item
:=
range
sliceData
{
itemBytes
,
_
:=
json
.
Marshal
(
item
)
var
con
model
.
Content
if
err
:=
json
.
Unmarshal
(
itemBytes
,
&
con
);
err
!=
nil
{
global
.
Logger
.
WithFields
(
logger
.
Fields
{
"requestId"
:
params
.
RequestId
,
"mac"
:
params
.
Mac
,
"mid"
:
params
.
Mid
,
"vender"
:
params
.
MidType
,
})
.
Errorf
(
"json.Unmarshal元素解析失败: %v"
,
err
)
return
replyWithChat
(
error_reply
,
"doudi"
)
}
res
.
ListItems
=
append
(
res
.
ListItems
,
map
[
string
]
interface
{}{
"url"
:
con
.
LinkUrl
,
"song"
:
con
.
Title
,
//思必驰的没有回复话术
//"content": params.Dm.Widget.Content[i].TextContent,
})
}
return
Marshal
(
params
,
res
)
}
func
Marshal
(
params
*
model
.
SpeechDomainParams
,
res
*
model
.
ResponseBody
)
[]
byte
{
if
res
.
Header
.
Semantic
.
Domain
==
""
{
res
.
Header
.
Semantic
.
Domain
=
"chat"
...
...
service/speechNlu/register.go
View file @
2e1f8139
...
...
@@ -38,12 +38,12 @@ func register() {
DomainRegister
(
SCIENCE
,
scienceDomain
)
DomainRegister
(
CHENGYU
,
chengyuDomain
)
DomainRegister
(
BAIKE
,
baikeDomain
)
DomainRegister
(
FM
,
fmDomain
)
DomainRegister
(
CHILDMUSIC
,
m
usicDomain
)
//
DomainRegister(FM, fmDomain)
DomainRegister
(
CHILDMUSIC
,
childM
usicDomain
)
DomainRegister
(
GLOBALCTRL
,
globalCtrlDomain
)
DomainRegister
(
PlayCTRL
,
playCtrlDomain
)
DomainRegister
(
MUSIC
,
musicDomain
)
DomainRegister
(
SLEEPMUSIC
,
sleepMusicDomain
)
//
DomainRegister(SLEEPMUSIC, sleepMusicDomain)
DomainRegister
(
HELP
,
helpDomain
)
DomainRegister
(
STORY
,
fmDomain
)
DomainRegister
(
FINANCE
,
financeDomain
)
...
...
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