From c3e7817630edacc5711854eaa59b86a843362677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=96=87=E9=9D=99?= <1319697849@qq.com> Date: Fri, 20 Jun 2025 17:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=84=E5=8E=86=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + c2c.http | 8 ++++---- service/speechNlu/constant.go | 4 ++-- service/speechNlu/domain.go | 19 +++++++++++++++++++ service/speechNlu/register.go | 1 + 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4558eaa..1ecd808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Changed - 增加音乐兜底 - 增加星座运势 +- 增加黄历查询 ## [0.0.1-beta.3] - 2025.6.6-6.14 ### Changed diff --git a/c2c.http b/c2c.http index 0d6aad6..6cf132c 100644 --- a/c2c.http +++ b/c2c.http @@ -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":"r", + "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": {} } @@ -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": {} } diff --git a/service/speechNlu/constant.go b/service/speechNlu/constant.go index 3df0526..fc1689a 100644 --- a/service/speechNlu/constant.go +++ b/service/speechNlu/constant.go @@ -93,9 +93,9 @@ const ( WASTESORTING = "垃圾分类" FOOD = "食物营养查询" ASTRO_FORTUNE = "星座运势" + ALMANAC = "黄历查询" - SOUND = "sound" - ALMANAC = "almanac" + SOUND = "sound" GENERALQA = "general_question_answering" COMMONQA = "common_qa" diff --git a/service/speechNlu/domain.go b/service/speechNlu/domain.go index 9f20462..670f1e3 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -1092,6 +1092,25 @@ func astroFortuneDomain(params *model.SpeechDomainParams) []byte { return Marshal(params, res) } +func almanacDomain(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("almanacDomain baseParse error.") + return replyWithChat(error_reply, "doudi") + } + + res.Header.Semantic.Domain = "almanac" + res.Header.Semantic.Intent = "search_almanactime" + res.Header.Semantic.SkillId = res.Header.Semantic.Domain + "." + res.Header.Semantic.Intent + + return Marshal(params, res) +} + func Marshal(params *model.SpeechDomainParams, res *model.ResponseBody) []byte { if res.Header.Semantic.Domain == "" { res.Header.Semantic.Domain = "chat" diff --git a/service/speechNlu/register.go b/service/speechNlu/register.go index 283bcda..4987435 100644 --- a/service/speechNlu/register.go +++ b/service/speechNlu/register.go @@ -53,6 +53,7 @@ func register() { DomainRegister(WASTESORTING, speechOtherDomain) DomainRegister(FOOD, speechOtherDomain) DomainRegister(ASTRO_FORTUNE, astroFortuneDomain) + DomainRegister(ALMANAC, almanacDomain) DomainRegister("", speechOtherDomain) // -- GitLab