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
b7023845
Commit
b7023845
authored
Jun 16, 2025
by
赵文静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加删除sessionId
parent
4773dba7
Pipeline
#5430
passed with stage
in 0 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
+35
-5
CHANGELOG.md
CHANGELOG.md
+1
-0
c2c.http
c2c.http
+5
-5
pkg/database/redis.go
pkg/database/redis.go
+15
-0
service/speechNlu/domain.go
service/speechNlu/domain.go
+14
-0
No files found.
CHANGELOG.md
View file @
b7023845
...
...
@@ -10,6 +10,7 @@
-
修改播控
-
增加一个http的入口
-
增加国学
-
增加删除SessionId
## [0.0.1-beta.2] - 2025.5.29
### Changed
...
...
c2c.http
View file @
b7023845
...
...
@@ -5,7 +5,7 @@ Content-Type: application/json
"ip": "14.215.222.17",
"mac": "ece154a865eb",
"mid": "11011",
"query":"
播放弟子规
",
"query":"
哈哈
",
"requestId": "123456111"
}
...
...
@@ -17,7 +17,7 @@ Content-Type: application/json
"ip": "14.215.222.17",
"mac": "ece154a865eb",
"mid": "11011",
"query":"
播放弟子规
",
"query":"
天使的翅膀
",
"requestId": "123456111"
}
...
...
@@ -38,7 +38,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": {}
}
...
...
@@ -57,7 +57,7 @@ Content-Type: application/json
},
"nluRet": {
"asr_recongize": "",
"text": "
珠海在哪里
"
"text": "
播放歌曲大菠萝
"
}
},
"version": "v0"
...
...
@@ -79,7 +79,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": {}
}
...
...
pkg/database/redis.go
View file @
b7023845
...
...
@@ -66,6 +66,21 @@ func GetSession(mac string) (string, error) {
return
sessionId
,
nil
}
// 删除 Session记录
func
DeleteSession
(
mac
string
)
error
{
ctx
:=
context
.
Background
()
key
:=
getSessionKey
(
mac
)
// 删除Redis中的key
_
,
err
:=
redisClient
.
Del
(
ctx
,
key
)
.
Result
()
if
err
!=
nil
{
global
.
Logger
.
Errorf
(
"删除会话失败 (MAC: %s): %v"
,
mac
,
err
)
return
fmt
.
Errorf
(
"failed to delete session: %w"
,
err
)
}
return
nil
}
// 获取会话并自动续期
func
GetAndRefreshSession
(
mac
string
,
expiration
time
.
Duration
)
(
string
,
bool
)
{
ctx
:=
context
.
Background
()
...
...
service/speechNlu/domain.go
View file @
b7023845
...
...
@@ -56,6 +56,8 @@ func baseParse(params *model.SpeechDomainParams) (*model.ResponseBody, error) {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
//UpdateSession(params.Mac, params.SpeechWsResp.SessionId)
...
...
@@ -479,6 +481,8 @@ func alarmDomain(params *model.SpeechDomainParams) []byte {
//UpdateSession(params.Mac, params.SpeechWsResp.SessionId)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
return
Marshal
(
params
,
&
result
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
if
!
params
.
CheckDm
()
||
!
params
.
CheckCommandParam
()
{
...
...
@@ -796,6 +800,8 @@ func musicDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
list
,
err
:=
connect
.
MusicGrpc
(
params
)
...
...
@@ -899,6 +905,8 @@ func financeDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
var
result
model
.
ResponseBody
...
...
@@ -922,6 +930,8 @@ func convertDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
var
result
model
.
ResponseBody
...
...
@@ -945,6 +955,8 @@ func holidayDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
var
result
model
.
ResponseBody
...
...
@@ -968,6 +980,8 @@ func speechOtherDomain(params *model.SpeechDomainParams) []byte {
if
!
params
.
SpeechWsResp
.
Dm
.
ShouldEndSession
{
fmt
.
Println
(
"保存:"
,
params
.
SpeechWsResp
.
SessionId
)
database
.
UpdateSession
(
params
.
Mac
,
params
.
SpeechWsResp
.
SessionId
)
}
else
{
database
.
DeleteSession
(
params
.
Mac
)
}
var
result
model
.
ResponseBody
...
...
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