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
a4b760ec
Commit
a4b760ec
authored
Jun 25, 2025
by
赵文静
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加AppKey
parent
463d829d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
3 deletions
+55
-3
CHANGELOG.md
CHANGELOG.md
+1
-0
c2c.http
c2c.http
+23
-3
router/router.go
router/router.go
+31
-0
No files found.
CHANGELOG.md
View file @
a4b760ec
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
-
增加音乐专辑字段
-
增加音乐专辑字段
-
修改日志打印
-
修改日志打印
-
故事返回增加专辑字段
-
故事返回增加专辑字段
-
http入口新增需要AppKey校验
## [0.0.1-beta.3] - 2025.6.19
## [0.0.1-beta.3] - 2025.6.19
### Changed
### Changed
...
...
c2c.http
View file @
a4b760ec
POST https://testnlu.gree.com/semantic/unisoundc2c/child/querys
#POST http://localhost:19992/semantic/unisoundc2c/child/querys/v2
Content-Type: application/json
{
"reqParam": {
"common": {
"remoteIP": "14.215.222.17",
"trafficParameter": "ver=3.0;scenario=smarthome;filterName=nlu2;req_nlu_length=2;returnType=json;fullDuplex=true;appendLength=1;additionalService=geli_nlu;mid=10f04;version=0.5;macWifi=28b77c23817b;macVoice=28b77c23817b"
},
"nluRet": {
"asr_recongize": "",
"text": "暂停闹钟"
}
},
"version": "v0"
}
###
POST https://testnlu.gree.com/semantic/unisoundc2c/speech-nlu-parse
POST https://testnlu.gree.com/semantic/unisoundc2c/speech-nlu-parse
Content-Type: application/json
Content-Type: application/json
...
@@ -5,7 +24,7 @@ Content-Type: application/json
...
@@ -5,7 +24,7 @@ Content-Type: application/json
"ip": "14.215.222.17",
"ip": "14.215.222.17",
"mac": "ece154a865eb",
"mac": "ece154a865eb",
"mid": "11011",
"mid": "11011",
"query":"
我想听儿歌
",
"query":"
暂停闹钟
",
"requestId": "123456111"
"requestId": "123456111"
}
}
...
@@ -13,6 +32,7 @@ Content-Type: application/json
...
@@ -13,6 +32,7 @@ Content-Type: application/json
#POST http://172.28.54.27:13302/semantic/unisoundc2c/speech-nlu-parse
#POST http://172.28.54.27:13302/semantic/unisoundc2c/speech-nlu-parse
POST http://172.28.124.110:13302/semantic/unisoundc2c/speech-nlu-parse
POST http://172.28.124.110:13302/semantic/unisoundc2c/speech-nlu-parse
Content-Type: application/json
Content-Type: application/json
X-AppKey: 391b50b5ed634fc49a3db7cfd6bc40db
{
{
"ip": "14.215.222.17",
"ip": "14.215.222.17",
...
@@ -39,7 +59,7 @@ Content-Type: application/json
...
@@ -39,7 +59,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;"
"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": {
"nluRet": {
"text": "
播放音乐
"
"text": "
暂停闹钟
"
},
},
"postProc": {}
"postProc": {}
}
}
...
@@ -80,7 +100,7 @@ Content-Type: application/json
...
@@ -80,7 +100,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;"
"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": {
"nluRet": {
"text": "
播放故事
"
"text": "
暂停闹钟
"
},
},
"postProc": {}
"postProc": {}
}
}
...
...
router/router.go
View file @
a4b760ec
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/google/uuid"
"github.com/tidwall/gjson"
"github.com/tidwall/gjson"
"net/http"
"speech-nlu-parse/app"
"speech-nlu-parse/app"
"speech-nlu-parse/global"
"speech-nlu-parse/global"
"speech-nlu-parse/model"
"speech-nlu-parse/model"
...
@@ -20,6 +21,9 @@ func InitRouter() (engine *gin.Engine) {
...
@@ -20,6 +21,9 @@ func InitRouter() (engine *gin.Engine) {
engine
=
gin
.
New
()
engine
=
gin
.
New
()
engine
.
Use
(
gin
.
Recovery
())
engine
.
Use
(
gin
.
Recovery
())
// 校验AppKey
engine
.
Use
(
VerifyAppKeyMiddleware
())
// 超时限制测试
// 超时限制测试
//engine.Use(middleware.TimeLimitMiddleware(time.Second * 5))
//engine.Use(middleware.TimeLimitMiddleware(time.Second * 5))
engine
.
POST
(
global
.
ServerSetting
.
UriPath
,
Controller
)
engine
.
POST
(
global
.
ServerSetting
.
UriPath
,
Controller
)
...
@@ -84,3 +88,30 @@ func SpeechNluParseSemanticRequest(req SnpReq) *model.SemanticReq {
...
@@ -84,3 +88,30 @@ func SpeechNluParseSemanticRequest(req SnpReq) *model.SemanticReq {
return
semanticReq
return
semanticReq
}
}
// 校验AppKey
func
VerifyAppKeyMiddleware
()
gin
.
HandlerFunc
{
validAppKeys
:=
map
[
string
]
bool
{
"391b50b5ed634fc49a3db7cfd6bc40db"
:
true
,
}
return
func
(
c
*
gin
.
Context
)
{
appKey
:=
c
.
GetHeader
(
"X-AppKey"
)
if
appKey
==
""
{
c
.
AbortWithStatusJSON
(
http
.
StatusUnauthorized
,
gin
.
H
{
"error"
:
"App key is required"
,
})
return
}
if
!
validAppKeys
[
appKey
]
{
c
.
AbortWithStatusJSON
(
http
.
StatusUnauthorized
,
gin
.
H
{
"error"
:
"Invalid app key"
,
})
return
}
c
.
Next
()
}
}
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