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
c60c5dfb
Commit
c60c5dfb
authored
May 13, 2025
by
赵文静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充历史
parent
099c71af
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
3 deletions
+81
-3
model/speech.go
model/speech.go
+14
-3
model/speechNlpResp.go
model/speechNlpResp.go
+14
-0
service/speechNlu/domain.go
service/speechNlu/domain.go
+53
-0
No files found.
model/speech.go
View file @
c60c5dfb
...
...
@@ -35,9 +35,10 @@ type SpeechWsResp struct {
WidgetName
string
`json:"widgetName"`
SubTitle
string
`json:"subTitle"`
Name
string
`json:"name"`
Extra
struct
{
Extra
*
struct
{
ContentTranslation
string
`json:"content_translation"`
Title
string
`json:"title"`
Result
interface
{}
`json:"result"`
}
`json:"extra"`
Title
string
`json:"title"`
Buttons
[]
struct
{
...
...
@@ -108,3 +109,13 @@ type Content struct {
ResType
string
`json:"resType"`
}
`json:"extra"`
}
type
Result
struct
{
Day
int
`json:"day"`
Title
string
`json:"title"`
Month
int
`json:"month"`
SubTitle
string
`json:"subTitle"`
Date
string
`json:"date"`
Year
int
`json:"year"`
Event
string
`json:"event"`
}
model/speechNlpResp.go
View file @
c60c5dfb
...
...
@@ -55,3 +55,17 @@ func (d *SpeechDomainParams) CheckCommandParam() bool {
}
return
true
}
func
(
d
*
SpeechDomainParams
)
CheckWidExtra
()
bool
{
if
!
d
.
CheckWidget
()
||
d
.
SpeechWsResp
.
Dm
.
Widget
.
Extra
==
nil
{
return
false
}
return
true
}
func
(
d
*
SpeechDomainParams
)
CheckWidResult
()
bool
{
if
!
d
.
CheckWidExtra
()
||
d
.
SpeechWsResp
.
Dm
.
Widget
.
Extra
.
Result
==
nil
{
return
false
}
return
true
}
service/speechNlu/domain.go
View file @
c60c5dfb
...
...
@@ -95,6 +95,59 @@ func calendarDomain(params *model.SpeechDomainParams) []byte {
res
.
Header
.
Semantic
.
Intent
=
"search_dateDiff"
res
.
Header
.
Semantic
.
SkillId
=
res
.
Header
.
Semantic
.
Domain
+
"."
+
res
.
Header
.
Semantic
.
Intent
if
params
.
SpeechWsResp
.
Dm
.
IntentName
==
"查询历史事件"
{
res
.
Header
.
Semantic
.
Domain
=
"chat"
res
.
Header
.
Semantic
.
Intent
=
"chat"
res
.
Header
.
Semantic
.
SkillId
=
"history.search_today"
if
!
params
.
CheckWidResult
()
{
if
res
.
ResponseText
!=
""
{
return
replyWithChat
(
res
.
ResponseText
,
"doudi"
)
}
}
else
{
sliceData
,
isSlice
:=
params
.
SpeechWsResp
.
Dm
.
Widget
.
Extra
.
Result
.
([]
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.Extra.Result不是数组类型"
)
if
res
.
ResponseText
!=
""
{
return
replyWithChat
(
res
.
ResponseText
,
"doudi"
)
}
return
replyWithChat
(
error_reply
,
"doudi"
)
}
var
l
int
var
resStrb
string
if
len
(
sliceData
)
<
global
.
GetLimitedSetting
(
params
.
Mid
)
.
HistoryNum
{
l
=
len
(
sliceData
)
}
else
{
// 使用限制的条数
l
=
global
.
GetLimitedSetting
(
params
.
Mid
)
.
HistoryNum
}
if
len
(
sliceData
)
>
l
{
sliceData
=
sliceData
[
:
l
]
}
for
_
,
item
:=
range
sliceData
{
itemBytes
,
_
:=
json
.
Marshal
(
item
)
var
con
model
.
Result
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"
)
}
resStrb
+=
fmt
.
Sprintf
(
"%s"
,
con
.
Title
)
}
res
.
ResponseText
=
resStrb
}
}
return
Marshal
(
params
,
res
)
}
...
...
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