diff --git a/CHANGELOG.md b/CHANGELOG.md index cce3fe383ea98254a1ebcc9f640544a6cf55f05d..81f5575878ed242a3843905f584f5cc40989babf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # 更新日志 -## [0.0.1-beta.3] - 2025.6.6 +## [0.0.1-beta.3] - 2025.6.6-6.11 ### Changed - 更改为redis存储sessionId - 修复查询历史上的今天切片越界问题 - 修改闹钟兜底回复不播报的问题 +- 修改音乐技能 +- 修改新闻title ## [0.0.1-beta.2] - 2025.5.29 ### Changed diff --git a/c2c.http b/c2c.http index afe46d93463889d30fc63213605767fc33e934e3..717b84b7ad20ea1ca01acc27278339a1febd3738 100644 --- a/c2c.http +++ b/c2c.http @@ -14,7 +14,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": {} } @@ -33,7 +33,7 @@ Content-Type: application/json }, "nluRet": { "asr_recongize": "", - "text": "播放月亮还没来" + "text": "咏鹅" } }, "version": "v0" @@ -55,7 +55,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/model/speech.go b/model/speech.go index c0ed486133d2ef23d1365185650808ed5ebccd84..30d9abb4da6840092cdee04858a3496352546616 100644 --- a/model/speech.go +++ b/model/speech.go @@ -77,10 +77,26 @@ type SpeechWsResp struct { Api string `json:"api"` Command *struct { Param *struct { - Volume string `json:"volume"` - Mode string `json:"mode"` - Object string `json:"object"` - Extra string `json:"extra"` + Volume string `json:"volume"` + Mode string `json:"mode"` + Object string `json:"object"` + Extra string `json:"extra"` + Version string `json:"version"` + Song string `json:"song"` + Singer string `json:"singer"` + Emotion string `json:"emotion"` + Album string `json:"album"` + Language string `json:"language"` + Age string `json:"age"` + Instrument string `json:"instrument"` + Author string `json:"author"` + Composer string `json:"composer"` + People string `json:"people"` + Area string `json:"area"` + Theme string `json:"theme"` + Style string `json:"style"` + Toplist string `json:"toplist"` + AgeRange string `json:"ageRange"` } `json:"param"` Api string `json:"api"` } `json:"command"` diff --git a/pkg/proto/music-spot.pb.go b/pkg/proto/music-spot.pb.go index b58092661ce47bc3f424d4731a75d2814111868b..802f8b48141969446ae7f7be3963492e0e552e3a 100644 --- a/pkg/proto/music-spot.pb.go +++ b/pkg/proto/music-spot.pb.go @@ -285,8 +285,9 @@ type MusicSpotRequest_Data struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` - Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` // 目前不生效 + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` // 目前不生效 + Command *MusicSpotRequest_Data_Command `protobuf:"bytes,3,opt,name=command,proto3" json:"command,omitempty"` } func (x *MusicSpotRequest_Data) Reset() { @@ -335,6 +336,68 @@ func (x *MusicSpotRequest_Data) GetLimit() int64 { return 0 } +func (x *MusicSpotRequest_Data) GetCommand() *MusicSpotRequest_Data_Command { + if x != nil { + return x.Command + } + return nil +} + +type MusicSpotRequest_Data_Command struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` + Param map[string]string `protobuf:"bytes,2,rep,name=param,proto3" json:"param,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *MusicSpotRequest_Data_Command) Reset() { + *x = MusicSpotRequest_Data_Command{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_proto_music_spot_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MusicSpotRequest_Data_Command) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MusicSpotRequest_Data_Command) ProtoMessage() {} + +func (x *MusicSpotRequest_Data_Command) ProtoReflect() protoreflect.Message { + mi := &file_pkg_proto_music_spot_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MusicSpotRequest_Data_Command.ProtoReflect.Descriptor instead. +func (*MusicSpotRequest_Data_Command) Descriptor() ([]byte, []int) { + return file_pkg_proto_music_spot_proto_rawDescGZIP(), []int{0, 2, 0} +} + +func (x *MusicSpotRequest_Data_Command) GetApi() string { + if x != nil { + return x.Api + } + return "" +} + +func (x *MusicSpotRequest_Data_Command) GetParam() map[string]string { + if x != nil { + return x.Param + } + return nil +} + type MusicSpotResponse_Status struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -347,7 +410,7 @@ type MusicSpotResponse_Status struct { func (x *MusicSpotResponse_Status) Reset() { *x = MusicSpotResponse_Status{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_music_spot_proto_msgTypes[5] + mi := &file_pkg_proto_music_spot_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -360,7 +423,7 @@ func (x *MusicSpotResponse_Status) String() string { func (*MusicSpotResponse_Status) ProtoMessage() {} func (x *MusicSpotResponse_Status) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_music_spot_proto_msgTypes[5] + mi := &file_pkg_proto_music_spot_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -398,12 +461,13 @@ type MusicSpotResponse_SourceItem struct { MediaId string `protobuf:"bytes,1,opt,name=mediaId,proto3" json:"mediaId,omitempty"` Singer string `protobuf:"bytes,2,opt,name=singer,proto3" json:"singer,omitempty"` Song string `protobuf:"bytes,3,opt,name=song,proto3" json:"song,omitempty"` + Album string `protobuf:"bytes,4,opt,name=album,proto3" json:"album,omitempty"` // 专辑名 } func (x *MusicSpotResponse_SourceItem) Reset() { *x = MusicSpotResponse_SourceItem{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_music_spot_proto_msgTypes[6] + mi := &file_pkg_proto_music_spot_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -416,7 +480,7 @@ func (x *MusicSpotResponse_SourceItem) String() string { func (*MusicSpotResponse_SourceItem) ProtoMessage() {} func (x *MusicSpotResponse_SourceItem) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_music_spot_proto_msgTypes[6] + mi := &file_pkg_proto_music_spot_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -453,18 +517,26 @@ func (x *MusicSpotResponse_SourceItem) GetSong() string { return "" } +func (x *MusicSpotResponse_SourceItem) GetAlbum() string { + if x != nil { + return x.Album + } + return "" +} + type MusicSpotResponse_Data struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ListItems []*MusicSpotResponse_SourceItem `protobuf:"bytes,1,rep,name=listItems,proto3" json:"listItems,omitempty"` + ListItems []*MusicSpotResponse_SourceItem `protobuf:"bytes,1,rep,name=listItems,proto3" json:"listItems,omitempty"` + ResponseText string `protobuf:"bytes,2,opt,name=ResponseText,proto3" json:"ResponseText,omitempty"` } func (x *MusicSpotResponse_Data) Reset() { *x = MusicSpotResponse_Data{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_music_spot_proto_msgTypes[7] + mi := &file_pkg_proto_music_spot_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -477,7 +549,7 @@ func (x *MusicSpotResponse_Data) String() string { func (*MusicSpotResponse_Data) ProtoMessage() {} func (x *MusicSpotResponse_Data) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_music_spot_proto_msgTypes[7] + mi := &file_pkg_proto_music_spot_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -500,12 +572,19 @@ func (x *MusicSpotResponse_Data) GetListItems() []*MusicSpotResponse_SourceItem return nil } +func (x *MusicSpotResponse_Data) GetResponseText() string { + if x != nil { + return x.ResponseText + } + return "" +} + var File_pkg_proto_music_spot_proto protoreflect.FileDescriptor var file_pkg_proto_music_spot_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x75, 0x73, 0x69, 0x63, 0x2d, 0x73, 0x70, 0x6f, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xb9, 0x03, 0x0a, 0x10, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, + 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x05, 0x0a, 0x10, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, @@ -529,11 +608,25 @@ var file_pkg_proto_music_spot_proto_rawDesc = []byte{ 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x32, 0x0a, 0x04, 0x44, - 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, - 0xce, 0x02, 0x0a, 0x11, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x73, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x91, 0x02, 0x0a, 0x04, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x12, 0x3e, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, + 0x70, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x1a, 0x9c, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, + 0x61, 0x70, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x70, 0x69, 0x12, 0x45, + 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x38, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x88, 0x03, 0x0a, 0x11, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, @@ -544,23 +637,27 @@ var file_pkg_proto_music_spot_proto_rawDesc = []byte{ 0x61, 0x1a, 0x2e, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, - 0x67, 0x1a, 0x52, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, + 0x67, 0x1a, 0x68, 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6f, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x73, 0x6f, 0x6e, 0x67, 0x1a, 0x49, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, - 0x09, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, - 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, - 0x32, 0x4e, 0x0a, 0x09, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x12, 0x41, 0x0a, - 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, + 0x04, 0x73, 0x6f, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x62, 0x75, 0x6d, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x6c, 0x62, 0x75, 0x6d, 0x1a, 0x6d, 0x0a, 0x04, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x6c, 0x69, 0x73, + 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x54, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x65, 0x78, 0x74, 0x32, 0x4e, 0x0a, 0x09, 0x4d, 0x75, + 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x12, 0x41, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x75, + 0x73, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x73, 0x69, 0x63, 0x53, 0x70, + 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -575,31 +672,35 @@ func file_pkg_proto_music_spot_proto_rawDescGZIP() []byte { return file_pkg_proto_music_spot_proto_rawDescData } -var file_pkg_proto_music_spot_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_pkg_proto_music_spot_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_pkg_proto_music_spot_proto_goTypes = []interface{}{ - (*MusicSpotRequest)(nil), // 0: proto.MusicSpotRequest - (*MusicSpotResponse)(nil), // 1: proto.MusicSpotResponse - (*MusicSpotRequest_AppInfo)(nil), // 2: proto.MusicSpotRequest.AppInfo - (*MusicSpotRequest_DevInfo)(nil), // 3: proto.MusicSpotRequest.DevInfo - (*MusicSpotRequest_Data)(nil), // 4: proto.MusicSpotRequest.Data - (*MusicSpotResponse_Status)(nil), // 5: proto.MusicSpotResponse.Status - (*MusicSpotResponse_SourceItem)(nil), // 6: proto.MusicSpotResponse.SourceItem - (*MusicSpotResponse_Data)(nil), // 7: proto.MusicSpotResponse.Data + (*MusicSpotRequest)(nil), // 0: proto.MusicSpotRequest + (*MusicSpotResponse)(nil), // 1: proto.MusicSpotResponse + (*MusicSpotRequest_AppInfo)(nil), // 2: proto.MusicSpotRequest.AppInfo + (*MusicSpotRequest_DevInfo)(nil), // 3: proto.MusicSpotRequest.DevInfo + (*MusicSpotRequest_Data)(nil), // 4: proto.MusicSpotRequest.Data + (*MusicSpotRequest_Data_Command)(nil), // 5: proto.MusicSpotRequest.Data.Command + nil, // 6: proto.MusicSpotRequest.Data.Command.ParamEntry + (*MusicSpotResponse_Status)(nil), // 7: proto.MusicSpotResponse.Status + (*MusicSpotResponse_SourceItem)(nil), // 8: proto.MusicSpotResponse.SourceItem + (*MusicSpotResponse_Data)(nil), // 9: proto.MusicSpotResponse.Data } var file_pkg_proto_music_spot_proto_depIdxs = []int32{ 2, // 0: proto.MusicSpotRequest.appInfo:type_name -> proto.MusicSpotRequest.AppInfo 3, // 1: proto.MusicSpotRequest.devInfo:type_name -> proto.MusicSpotRequest.DevInfo 4, // 2: proto.MusicSpotRequest.data:type_name -> proto.MusicSpotRequest.Data - 5, // 3: proto.MusicSpotResponse.status:type_name -> proto.MusicSpotResponse.Status - 7, // 4: proto.MusicSpotResponse.data:type_name -> proto.MusicSpotResponse.Data - 6, // 5: proto.MusicSpotResponse.Data.listItems:type_name -> proto.MusicSpotResponse.SourceItem - 0, // 6: proto.MusicSpot.GetMusicList:input_type -> proto.MusicSpotRequest - 1, // 7: proto.MusicSpot.GetMusicList:output_type -> proto.MusicSpotResponse - 7, // [7:8] is the sub-list for method output_type - 6, // [6:7] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 7, // 3: proto.MusicSpotResponse.status:type_name -> proto.MusicSpotResponse.Status + 9, // 4: proto.MusicSpotResponse.data:type_name -> proto.MusicSpotResponse.Data + 5, // 5: proto.MusicSpotRequest.Data.command:type_name -> proto.MusicSpotRequest.Data.Command + 6, // 6: proto.MusicSpotRequest.Data.Command.param:type_name -> proto.MusicSpotRequest.Data.Command.ParamEntry + 8, // 7: proto.MusicSpotResponse.Data.listItems:type_name -> proto.MusicSpotResponse.SourceItem + 0, // 8: proto.MusicSpot.GetMusicList:input_type -> proto.MusicSpotRequest + 1, // 9: proto.MusicSpot.GetMusicList:output_type -> proto.MusicSpotResponse + 9, // [9:10] is the sub-list for method output_type + 8, // [8:9] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_pkg_proto_music_spot_proto_init() } @@ -669,6 +770,18 @@ func file_pkg_proto_music_spot_proto_init() { } } file_pkg_proto_music_spot_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MusicSpotRequest_Data_Command); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_proto_music_spot_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MusicSpotResponse_Status); i { case 0: return &v.state @@ -680,7 +793,7 @@ func file_pkg_proto_music_spot_proto_init() { return nil } } - file_pkg_proto_music_spot_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_pkg_proto_music_spot_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MusicSpotResponse_SourceItem); i { case 0: return &v.state @@ -692,7 +805,7 @@ func file_pkg_proto_music_spot_proto_init() { return nil } } - file_pkg_proto_music_spot_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_pkg_proto_music_spot_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MusicSpotResponse_Data); i { case 0: return &v.state @@ -711,7 +824,7 @@ func file_pkg_proto_music_spot_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_proto_music_spot_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/proto/music-spot.proto b/pkg/proto/music-spot.proto index 373266b60c363151187281f7067ed58557d7daf8..b9a33c76c0a4626ba2815574f61fcbdfa109d35e 100644 --- a/pkg/proto/music-spot.proto +++ b/pkg/proto/music-spot.proto @@ -24,6 +24,11 @@ message MusicSpotRequest { message Data { string query = 1; int64 limit = 2; // 目前不生效 + message Command{ + string api = 1; + map param = 2; + } + Command command = 3; } Data data = 3; } @@ -38,9 +43,11 @@ message MusicSpotResponse { string mediaId = 1; string singer = 2; string song = 3; + string album = 4; // 专辑名 } message Data{ repeated SourceItem listItems = 1; + string ResponseText = 2; } Status status = 1; Data data = 2; diff --git a/service/connect/music.go b/service/connect/music.go index da378af6be23970720f84e01565643ca76697300..cbe6e043fa85f8a75c2917b7bf04feb108bfdfcc 100644 --- a/service/connect/music.go +++ b/service/connect/music.go @@ -2,6 +2,7 @@ package connect import ( "context" + "encoding/json" "fmt" "google.golang.org/grpc" "speech-nlu-parse/global" @@ -55,9 +56,31 @@ func MusicGrpc(params *model.SpeechDomainParams) (*proto.MusicSpotResponse, erro }, Data: &proto.MusicSpotRequest_Data{ Query: params.Query, + Command: &proto.MusicSpotRequest_Data_Command{ + Api: params.SpeechWsResp.Dm.Command.Api, + //Param: params.SpeechWsResp.Dm.Command.Param, + }, }, } + fmt.Println("params.SpeechWsResp.Dm.Command.Param:", params.SpeechWsResp.Dm.Command.Param) + + jsonData, err := json.Marshal(params.SpeechWsResp.Dm.Command.Param) + if err != nil { + fmt.Println("JSON 编码失败:", err) + return nil, err + } + + // 再解码成 map + var paramMap map[string]string + if err := json.Unmarshal(jsonData, ¶mMap); err != nil { + fmt.Println("JSON 解码失败:", err) + return nil, err + } + + req.Data.Command.Param = paramMap + fmt.Println("req.Data.Command.Param:", req.Data.Command.Param) + resp, err := c.GetMusicList(ctx, req) if err != nil { global.Logger.WithFields(logger.Fields{ diff --git a/service/speechNlu/domain.go b/service/speechNlu/domain.go index 216cebe963c12fc0b98146a1b511eb51d5242f3d..6f06dda4aadd62e8709ea3a113c2cfe4125bb2e1 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -52,13 +52,12 @@ func baseParse(params *model.SpeechDomainParams) (*model.ResponseBody, error) { //result.Header.Semantic.SkillId = result.Header.Semantic.Domain + "." + result.Header.Semantic.Intent result.ResponseText = params.SpeechWsResp.Dm.Nlg result.AsrRecongize = params.SpeechWsResp.Dm.Input - //result.ListItems = make([]map[string]interface{}, 0) - //if !params.SpeechWsResp.Dm.ShouldEndSession { - // fmt.Println("保存:", params.SpeechWsResp.SessionId) - // UpdateSession(params.Mac, params.SpeechWsResp.SessionId) - //} + result.ListItems = make([]map[string]interface{}, 0) + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } //UpdateSession(params.Mac, params.SpeechWsResp.SessionId) - database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) return &result, nil } @@ -254,10 +253,10 @@ func newsDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } res.ListItems = append(res.ListItems, map[string]interface{}{ - "url": con.LinkUrl, - "title": con.Title, - "newsFrom": con.Extra.Source, - "mediaId": con.Extra.NewsId, + "url": con.LinkUrl, + "resultTitle": con.Title, + "newsFrom": con.Extra.Source, + "mediaId": con.Extra.NewsId, //"newsType": "", }) } @@ -791,6 +790,15 @@ func playCtrlDomain(params *model.SpeechDomainParams) []byte { } func musicDomain(params *model.SpeechDomainParams) []byte { + if !params.CheckCommandParam() { + return replyWithChat(error_reply, "doudi") + } + + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } + list, err := connect.MusicGrpc(params) if err != nil { global.Logger.WithFields(logger.Fields{ @@ -820,10 +828,12 @@ func musicDomain(params *model.SpeechDomainParams) []byte { "song": list.Data.ListItems[i].Song, }) } - result.ResponseText = "以下音乐由网易云提供:" //params.SpeechWsResp.Dm.Nlg - } else { - return replyWithChat("抱歉,因版本限制或非会员,暂时无法播放", "doudi") + //result.ResponseText = "以下音乐由网易云提供:" //params.SpeechWsResp.Dm.Nlg } + result.ResponseText = list.GetData().GetResponseText() + //else { + // return replyWithChat("抱歉,因版本限制或非会员,暂时无法播放", "doudi") + //} return Marshal(params, &result) } @@ -887,6 +897,11 @@ func financeDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } + var result model.ResponseBody result.Header.Semantic.Code = 0 result.Header.Semantic.Domain = "finance" @@ -905,6 +920,11 @@ func convertDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } + var result model.ResponseBody result.Header.Semantic.Code = 0 result.Header.Semantic.Domain = "science" @@ -923,6 +943,11 @@ func holidayDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } + var result model.ResponseBody result.Header.Semantic.Code = 0 result.Header.Semantic.Domain = "holiday" @@ -941,6 +966,11 @@ func speechOtherDomain(params *model.SpeechDomainParams) []byte { return replyWithChat(error_reply, "doudi") } + if !params.SpeechWsResp.Dm.ShouldEndSession { + fmt.Println("保存:", params.SpeechWsResp.SessionId) + database.UpdateSession(params.Mac, params.SpeechWsResp.SessionId) + } + var result model.ResponseBody result.Header.Semantic.Code = 0 result.Header.Semantic.Domain = "chat"