From 912445b297241f18573a0cece3d32e9d5a3bf646 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, 23 May 2025 10:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=96=B0=E9=97=BBrabbitmq?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c2c.http | 62 +++++++++++++++++++++++++++++++++++ conf/config.yaml | 1 + main.go | 2 +- pkg/setting/section.go | 1 + service/speechNlu/rabbitmq.go | 2 +- 5 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 c2c.http diff --git a/c2c.http b/c2c.http new file mode 100644 index 0000000..fdc3c3b --- /dev/null +++ b/c2c.http @@ -0,0 +1,62 @@ +#POST https://nlu.gree.com/semantic/unisoundc2c/querys +POST https://testnlu.gree.com/semantic/unisoundc2c/querys +#POST http://172.28.124.216:9999/semantic/unisoundc2c/querys +#POST http://172.28.5.39:9999/semantic/unisoundc2c/querys +Content-Type: application/json + +{ + "reqParam": { + "common": { + "appKey": "ilcsnav5otwalqnkzliyfh5tbrbjkjomtjgiojih", + "imei": "hb-0242DFEC61F4", + "remoteIP": "47.103.18.223", + "requestId": "123456111", + "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": "明天的呢" + }, + "postProc": {} + } +} + +### +POST http://localhost:19992/semantic/unisoundc2c/child/querys/v2 +Content-Type: application/json + +{ + "reqParam": { + "common": { + "remoteIP": "14.215.222.17", + "requestId": "1234568222", + "trafficParameter": "ver=3.0;scenario=smarthome;filterName=nlu2;req_nlu_length=2;returnType=json;fullDuplex=true;appendLength=1;additionalService=geli_nlu;mid=11011;version=0.5;macWifi=28b77c23817b1234111111;macVoice=28b77c23817b1234111111" + }, + "nluRet": { + "asr_recongize": "", + "text": "明天呢" + } + }, + "version": "v0" +} + +### +# POST https://nlu.gree.com/semantic/unisoundc2c/querys +POST https://nlu.gree.com/semantic/unisoundc2c/querys +Content-Type: application/json + +# ;macWifi=f4911e968a48;macVoice=c46e7b7624fc +{ + "reqParam": { + "common": { + "appKey": "nq3qd4ur4pt6c6pjulf4tfpirl6jkzxakueuy4yr", + "imei": "hb-0242DFEC61F4", + "remoteIP": "182.84.16.132", + "requestId": "123456456456465456", + "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": "播放音乐" + }, + "postProc": {} + } +} \ No newline at end of file diff --git a/conf/config.yaml b/conf/config.yaml index a581103..8df12d8 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -12,6 +12,7 @@ RabbitMq: Url: amqp://iot:qwe!23@172.28.124.106:5672/voice ExchangeName: voice.media.ctrl ExchangeType: direct + RoutingKey: mqHandle Logger: LogFileName: tencent-nlu-parse diff --git a/main.go b/main.go index 2209a42..fb0cb64 100644 --- a/main.go +++ b/main.go @@ -152,7 +152,7 @@ func setupFlag() error { flag.StringVar(&serverTag, "tag", "", "注册到注册中心的标签") flag.StringVar(&ip, "ip", "", "IP") flag.IntVar(&port, "port", 0, "端口") - flag.StringVar(&consulUrl, "consul", "http://172.28.124.105:8500", "consul服务地址") + flag.StringVar(&consulUrl, "consul", "http://172.28.124.106:8500", "consul服务地址") flag.StringVar(&config, "config", "env/v2,speech_nlu_parse/conf", "指定要使用的配置文件路径") flag.BoolVar(&isVersion, "version", false, "编译信息") flag.StringVar(&consulToken, "token", "092288b5-824f-854c-39aa-a958afd9a633", "consul token") diff --git a/pkg/setting/section.go b/pkg/setting/section.go index 38c07b7..a3ff931 100644 --- a/pkg/setting/section.go +++ b/pkg/setting/section.go @@ -101,6 +101,7 @@ type RabbitMqSettings struct { Url string ExchangeName string ExchangeType string + RoutingKey string } func (s *Setting) ReadSection(k string, v interface{}) error { diff --git a/service/speechNlu/rabbitmq.go b/service/speechNlu/rabbitmq.go index 84d956f..495c948 100644 --- a/service/speechNlu/rabbitmq.go +++ b/service/speechNlu/rabbitmq.go @@ -103,7 +103,7 @@ func (c *Consumer) setup() error { } // 绑定队列 - routingKey := "mqhandle" + routingKey := global.RabbitMqSetting.RoutingKey if err := c.channel.QueueBind( queue, routingKey, -- GitLab