diff --git a/model/speech.go b/model/speech.go index f7909a1e5290bc758e4cce984bdba4a4ae558e03..b211d483da0f809dae5918cf40f161fd6f4ec498 100644 --- a/model/speech.go +++ b/model/speech.go @@ -77,6 +77,8 @@ type SpeechWsResp struct { Param *struct { Volume string `json:"volume"` Mode string `json:"mode"` + Object string `json:"object"` + Extra string `json:"extra"` } `json:"param"` Api string `json:"api"` } `json:"command"` diff --git a/pkg/proto/alarm_remind_skill.pb.go b/pkg/proto/alarm_remind_skill.pb.go index 7da21a8d41951ea75e67c77595d0a37e5b4d334e..88cd7c7b6a3a2ddd569750e1118fb623e1d316ca 100644 --- a/pkg/proto/alarm_remind_skill.pb.go +++ b/pkg/proto/alarm_remind_skill.pb.go @@ -25,11 +25,10 @@ type AlarmRemindSkillRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AppInfo *AlarmRemindSkillRequest_AppInfo `protobuf:"bytes,1,opt,name=appInfo,proto3" json:"appInfo,omitempty"` - DevInfo *AlarmRemindSkillRequest_DevInfo `protobuf:"bytes,2,opt,name=devInfo,proto3" json:"devInfo,omitempty"` - UserInfo *AlarmRemindSkillRequest_UserInfo `protobuf:"bytes,3,opt,name=userInfo,proto3" json:"userInfo,omitempty"` - Command *AlarmRemindSkillRequest_Command `protobuf:"bytes,4,opt,name=command,proto3" json:"command,omitempty"` - AsrRecognize string `protobuf:"bytes,5,opt,name=asr_recognize,json=asrRecognize,proto3" json:"asr_recognize,omitempty"` + AppInfo *AlarmRemindSkillRequest_AppInfo `protobuf:"bytes,1,opt,name=appInfo,proto3" json:"appInfo,omitempty"` + DevInfo *AlarmRemindSkillRequest_DevInfo `protobuf:"bytes,2,opt,name=devInfo,proto3" json:"devInfo,omitempty"` + Command *AlarmRemindSkillRequest_Command `protobuf:"bytes,3,opt,name=command,proto3" json:"command,omitempty"` + AsrRecognize string `protobuf:"bytes,4,opt,name=asr_recognize,json=asrRecognize,proto3" json:"asr_recognize,omitempty"` } func (x *AlarmRemindSkillRequest) Reset() { @@ -78,13 +77,6 @@ func (x *AlarmRemindSkillRequest) GetDevInfo() *AlarmRemindSkillRequest_DevInfo return nil } -func (x *AlarmRemindSkillRequest) GetUserInfo() *AlarmRemindSkillRequest_UserInfo { - if x != nil { - return x.UserInfo - } - return nil -} - func (x *AlarmRemindSkillRequest) GetCommand() *AlarmRemindSkillRequest_Command { if x != nil { return x.Command @@ -201,17 +193,21 @@ func (x *AlarmRemindSkillRequest_AppInfo) GetRequestId() string { return "" } -type AlarmRemindSkillRequest_UserInfo struct { +type AlarmRemindSkillRequest_DevInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` - Hid string `protobuf:"bytes,2,opt,name=hid,proto3" json:"hid,omitempty"` + Mac string `protobuf:"bytes,1,opt,name=mac,proto3" json:"mac,omitempty"` + Mid string `protobuf:"bytes,2,opt,name=mid,proto3" json:"mid,omitempty"` + Vender string `protobuf:"bytes,3,opt,name=vender,proto3" json:"vender,omitempty"` + Hid string `protobuf:"bytes,4,opt,name=hid,proto3" json:"hid,omitempty"` // 模组id + HomeId string `protobuf:"bytes,5,opt,name=homeId,proto3" json:"homeId,omitempty"` //家庭id + Uid string `protobuf:"bytes,6,opt,name=uid,proto3" json:"uid,omitempty"` // 用户id(可以空,语音入口一般无法识别用户) } -func (x *AlarmRemindSkillRequest_UserInfo) Reset() { - *x = AlarmRemindSkillRequest_UserInfo{} +func (x *AlarmRemindSkillRequest_DevInfo) Reset() { + *x = AlarmRemindSkillRequest_DevInfo{} if protoimpl.UnsafeEnabled { mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -219,13 +215,13 @@ func (x *AlarmRemindSkillRequest_UserInfo) Reset() { } } -func (x *AlarmRemindSkillRequest_UserInfo) String() string { +func (x *AlarmRemindSkillRequest_DevInfo) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AlarmRemindSkillRequest_UserInfo) ProtoMessage() {} +func (*AlarmRemindSkillRequest_DevInfo) ProtoMessage() {} -func (x *AlarmRemindSkillRequest_UserInfo) ProtoReflect() protoreflect.Message { +func (x *AlarmRemindSkillRequest_DevInfo) ProtoReflect() protoreflect.Message { mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -237,76 +233,49 @@ func (x *AlarmRemindSkillRequest_UserInfo) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AlarmRemindSkillRequest_UserInfo.ProtoReflect.Descriptor instead. -func (*AlarmRemindSkillRequest_UserInfo) Descriptor() ([]byte, []int) { +// Deprecated: Use AlarmRemindSkillRequest_DevInfo.ProtoReflect.Descriptor instead. +func (*AlarmRemindSkillRequest_DevInfo) Descriptor() ([]byte, []int) { return file_pkg_proto_alarm_remind_skill_proto_rawDescGZIP(), []int{0, 1} } -func (x *AlarmRemindSkillRequest_UserInfo) GetUid() string { +func (x *AlarmRemindSkillRequest_DevInfo) GetMac() string { if x != nil { - return x.Uid + return x.Mac } return "" } -func (x *AlarmRemindSkillRequest_UserInfo) GetHid() string { +func (x *AlarmRemindSkillRequest_DevInfo) GetMid() string { if x != nil { - return x.Hid + return x.Mid } return "" } -type AlarmRemindSkillRequest_DevInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Mac string `protobuf:"bytes,1,opt,name=mac,proto3" json:"mac,omitempty"` - TarMac string `protobuf:"bytes,2,opt,name=tarMac,proto3" json:"tarMac,omitempty"` -} - -func (x *AlarmRemindSkillRequest_DevInfo) Reset() { - *x = AlarmRemindSkillRequest_DevInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (x *AlarmRemindSkillRequest_DevInfo) GetVender() string { + if x != nil { + return x.Vender } + return "" } -func (x *AlarmRemindSkillRequest_DevInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AlarmRemindSkillRequest_DevInfo) ProtoMessage() {} - -func (x *AlarmRemindSkillRequest_DevInfo) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *AlarmRemindSkillRequest_DevInfo) GetHid() string { + if x != nil { + return x.Hid } - return mi.MessageOf(x) -} - -// Deprecated: Use AlarmRemindSkillRequest_DevInfo.ProtoReflect.Descriptor instead. -func (*AlarmRemindSkillRequest_DevInfo) Descriptor() ([]byte, []int) { - return file_pkg_proto_alarm_remind_skill_proto_rawDescGZIP(), []int{0, 2} + return "" } -func (x *AlarmRemindSkillRequest_DevInfo) GetMac() string { +func (x *AlarmRemindSkillRequest_DevInfo) GetHomeId() string { if x != nil { - return x.Mac + return x.HomeId } return "" } -func (x *AlarmRemindSkillRequest_DevInfo) GetTarMac() string { +func (x *AlarmRemindSkillRequest_DevInfo) GetUid() string { if x != nil { - return x.TarMac + return x.Uid } return "" } @@ -316,20 +285,15 @@ type AlarmRemindSkillRequest_Command struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` - Repeat string `protobuf:"bytes,2,opt,name=repeat,proto3" json:"repeat,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Date string `protobuf:"bytes,4,opt,name=date,proto3" json:"date,omitempty"` - Time string `protobuf:"bytes,5,opt,name=time,proto3" json:"time,omitempty"` - Event string `protobuf:"bytes,6,opt,name=event,proto3" json:"event,omitempty"` - Period string `protobuf:"bytes,7,opt,name=period,proto3" json:"period,omitempty"` - Object string `protobuf:"bytes,8,opt,name=object,proto3" json:"object,omitempty"` // 区分品类,闹钟/日程(提醒) + Api string `protobuf:"bytes,1,opt,name=api,proto3" json:"api,omitempty"` // 意图 + Extra string `protobuf:"bytes,2,opt,name=extra,proto3" json:"extra,omitempty"` // speech解析原字段 : 内部有content字段提取闹钟列表 + Object string `protobuf:"bytes,3,opt,name=object,proto3" json:"object,omitempty"` // speech解析原字段:闹钟/提醒(日程) } func (x *AlarmRemindSkillRequest_Command) Reset() { *x = AlarmRemindSkillRequest_Command{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[5] + mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -342,7 +306,7 @@ func (x *AlarmRemindSkillRequest_Command) String() string { func (*AlarmRemindSkillRequest_Command) ProtoMessage() {} func (x *AlarmRemindSkillRequest_Command) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[5] + mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -355,7 +319,7 @@ func (x *AlarmRemindSkillRequest_Command) ProtoReflect() protoreflect.Message { // Deprecated: Use AlarmRemindSkillRequest_Command.ProtoReflect.Descriptor instead. func (*AlarmRemindSkillRequest_Command) Descriptor() ([]byte, []int) { - return file_pkg_proto_alarm_remind_skill_proto_rawDescGZIP(), []int{0, 3} + return file_pkg_proto_alarm_remind_skill_proto_rawDescGZIP(), []int{0, 2} } func (x *AlarmRemindSkillRequest_Command) GetApi() string { @@ -365,44 +329,9 @@ func (x *AlarmRemindSkillRequest_Command) GetApi() string { return "" } -func (x *AlarmRemindSkillRequest_Command) GetRepeat() string { - if x != nil { - return x.Repeat - } - return "" -} - -func (x *AlarmRemindSkillRequest_Command) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *AlarmRemindSkillRequest_Command) GetDate() string { - if x != nil { - return x.Date - } - return "" -} - -func (x *AlarmRemindSkillRequest_Command) GetTime() string { - if x != nil { - return x.Time - } - return "" -} - -func (x *AlarmRemindSkillRequest_Command) GetEvent() string { - if x != nil { - return x.Event - } - return "" -} - -func (x *AlarmRemindSkillRequest_Command) GetPeriod() string { +func (x *AlarmRemindSkillRequest_Command) GetExtra() string { if x != nil { - return x.Period + return x.Extra } return "" } @@ -426,7 +355,7 @@ type AlarmRemindSkillResponse_Status struct { func (x *AlarmRemindSkillResponse_Status) Reset() { *x = AlarmRemindSkillResponse_Status{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[6] + mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -439,7 +368,7 @@ func (x *AlarmRemindSkillResponse_Status) String() string { func (*AlarmRemindSkillResponse_Status) ProtoMessage() {} func (x *AlarmRemindSkillResponse_Status) ProtoReflect() protoreflect.Message { - mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[6] + mi := &file_pkg_proto_alarm_remind_skill_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -474,7 +403,7 @@ var File_pkg_proto_alarm_remind_skill_proto protoreflect.FileDescriptor var file_pkg_proto_alarm_remind_skill_proto_rawDesc = []byte{ 0x0a, 0x22, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x6c, 0x61, 0x72, 0x6d, 0x5f, 0x72, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x5f, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x05, 0x0a, 0x17, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x04, 0x0a, 0x17, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, @@ -484,58 +413,48 @@ var file_pkg_proto_alarm_remind_skill_proto_rawDesc = []byte{ 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x76, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x07, 0x64, 0x65, 0x76, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x43, 0x0a, 0x08, 0x75, - 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x66, 0x6f, 0x52, 0x07, 0x64, 0x65, 0x76, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, 0x0a, 0x07, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, + 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x23, 0x0a, + 0x0d, 0x61, 0x73, 0x72, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x67, 0x6e, 0x69, + 0x7a, 0x65, 0x1a, 0x3d, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, + 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, + 0x70, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x1a, 0x81, 0x01, 0x0a, 0x07, 0x44, 0x65, 0x76, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, + 0x03, 0x6d, 0x61, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x61, 0x63, 0x12, + 0x10, 0x0a, 0x03, 0x6d, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x69, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, + 0x6f, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6d, + 0x65, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x1a, 0x49, 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, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x22, 0x8a, 0x01, 0x0a, 0x18, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, + 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, - 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x12, 0x40, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, - 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x73, 0x72, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x67, 0x6e, - 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x72, 0x52, 0x65, - 0x63, 0x6f, 0x67, 0x6e, 0x69, 0x7a, 0x65, 0x1a, 0x3d, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x1a, 0x2e, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x68, 0x69, 0x64, 0x1a, 0x33, 0x0a, 0x07, 0x44, 0x65, 0x76, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6d, 0x61, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x4d, 0x61, 0x63, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x4d, 0x61, 0x63, 0x1a, 0xbf, 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, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x70, - 0x65, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x70, 0x65, 0x61, - 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, - 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x8a, 0x01, - 0x0a, 0x18, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, - 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, - 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x32, 0x6a, 0x0a, 0x10, 0x41, 0x6c, - 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x56, - 0x0a, 0x13, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x53, 0x70, 0x65, 0x65, 0x63, 0x68, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, - 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, - 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 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, + 0x64, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 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, 0x32, 0x6a, 0x0a, + 0x10, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, + 0x6c, 0x12, 0x56, 0x0a, 0x13, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x53, 0x70, 0x65, 0x65, 0x63, + 0x68, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x52, 0x65, 0x6d, 0x69, 0x6e, 0x64, 0x53, 0x6b, 0x69, 0x6c, + 0x6c, 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 ( @@ -550,29 +469,27 @@ func file_pkg_proto_alarm_remind_skill_proto_rawDescGZIP() []byte { return file_pkg_proto_alarm_remind_skill_proto_rawDescData } -var file_pkg_proto_alarm_remind_skill_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_pkg_proto_alarm_remind_skill_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_pkg_proto_alarm_remind_skill_proto_goTypes = []interface{}{ - (*AlarmRemindSkillRequest)(nil), // 0: proto.AlarmRemindSkillRequest - (*AlarmRemindSkillResponse)(nil), // 1: proto.AlarmRemindSkillResponse - (*AlarmRemindSkillRequest_AppInfo)(nil), // 2: proto.AlarmRemindSkillRequest.AppInfo - (*AlarmRemindSkillRequest_UserInfo)(nil), // 3: proto.AlarmRemindSkillRequest.UserInfo - (*AlarmRemindSkillRequest_DevInfo)(nil), // 4: proto.AlarmRemindSkillRequest.DevInfo - (*AlarmRemindSkillRequest_Command)(nil), // 5: proto.AlarmRemindSkillRequest.Command - (*AlarmRemindSkillResponse_Status)(nil), // 6: proto.AlarmRemindSkillResponse.Status + (*AlarmRemindSkillRequest)(nil), // 0: proto.AlarmRemindSkillRequest + (*AlarmRemindSkillResponse)(nil), // 1: proto.AlarmRemindSkillResponse + (*AlarmRemindSkillRequest_AppInfo)(nil), // 2: proto.AlarmRemindSkillRequest.AppInfo + (*AlarmRemindSkillRequest_DevInfo)(nil), // 3: proto.AlarmRemindSkillRequest.DevInfo + (*AlarmRemindSkillRequest_Command)(nil), // 4: proto.AlarmRemindSkillRequest.Command + (*AlarmRemindSkillResponse_Status)(nil), // 5: proto.AlarmRemindSkillResponse.Status } var file_pkg_proto_alarm_remind_skill_proto_depIdxs = []int32{ 2, // 0: proto.AlarmRemindSkillRequest.appInfo:type_name -> proto.AlarmRemindSkillRequest.AppInfo - 4, // 1: proto.AlarmRemindSkillRequest.devInfo:type_name -> proto.AlarmRemindSkillRequest.DevInfo - 3, // 2: proto.AlarmRemindSkillRequest.userInfo:type_name -> proto.AlarmRemindSkillRequest.UserInfo - 5, // 3: proto.AlarmRemindSkillRequest.command:type_name -> proto.AlarmRemindSkillRequest.Command - 6, // 4: proto.AlarmRemindSkillResponse.status:type_name -> proto.AlarmRemindSkillResponse.Status - 0, // 5: proto.AlarmRemindSkill.HandleSpeechCommand:input_type -> proto.AlarmRemindSkillRequest - 1, // 6: proto.AlarmRemindSkill.HandleSpeechCommand:output_type -> proto.AlarmRemindSkillResponse - 6, // [6:7] is the sub-list for method output_type - 5, // [5:6] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 3, // 1: proto.AlarmRemindSkillRequest.devInfo:type_name -> proto.AlarmRemindSkillRequest.DevInfo + 4, // 2: proto.AlarmRemindSkillRequest.command:type_name -> proto.AlarmRemindSkillRequest.Command + 5, // 3: proto.AlarmRemindSkillResponse.status:type_name -> proto.AlarmRemindSkillResponse.Status + 0, // 4: proto.AlarmRemindSkill.HandleSpeechCommand:input_type -> proto.AlarmRemindSkillRequest + 1, // 5: proto.AlarmRemindSkill.HandleSpeechCommand:output_type -> proto.AlarmRemindSkillResponse + 5, // [5:6] is the sub-list for method output_type + 4, // [4:5] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_pkg_proto_alarm_remind_skill_proto_init() } @@ -618,18 +535,6 @@ func file_pkg_proto_alarm_remind_skill_proto_init() { } } file_pkg_proto_alarm_remind_skill_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AlarmRemindSkillRequest_UserInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pkg_proto_alarm_remind_skill_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AlarmRemindSkillRequest_DevInfo); i { case 0: return &v.state @@ -641,7 +546,7 @@ func file_pkg_proto_alarm_remind_skill_proto_init() { return nil } } - file_pkg_proto_alarm_remind_skill_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_pkg_proto_alarm_remind_skill_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AlarmRemindSkillRequest_Command); i { case 0: return &v.state @@ -653,7 +558,7 @@ func file_pkg_proto_alarm_remind_skill_proto_init() { return nil } } - file_pkg_proto_alarm_remind_skill_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_pkg_proto_alarm_remind_skill_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AlarmRemindSkillResponse_Status); i { case 0: return &v.state @@ -672,7 +577,7 @@ func file_pkg_proto_alarm_remind_skill_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_proto_alarm_remind_skill_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/proto/alarm_remind_skill.proto b/pkg/proto/alarm_remind_skill.proto index ab5500505e002d5c80a5e1163ffcae1f95399bf3..237e8f985d07af10031e9f9555e1869660f9abb4 100644 --- a/pkg/proto/alarm_remind_skill.proto +++ b/pkg/proto/alarm_remind_skill.proto @@ -10,29 +10,23 @@ message AlarmRemindSkillRequest{ string appId = 1; string requestId = 2; } - message UserInfo { - string uid = 1; - string hid = 2; - } message DevInfo { string mac = 1; - string tarMac = 2; + string mid = 2; + string vender = 3; + string hid = 4;// 模组id + string homeId = 5; //家庭id + string uid = 6; // 用户id(可以空,语音入口一般无法识别用户) } AppInfo appInfo = 1; DevInfo devInfo = 2; - UserInfo userInfo = 3; message Command { - string api = 1; - string repeat = 2; - int64 timestamp = 3; - string date = 4; - string time = 5; - string event = 6; - string period = 7; - string object = 8; // 区分品类,闹钟/日程(提醒) + string api = 1; // 意图 + string extra = 2; // speech解析原字段 : 内部有content字段提取闹钟列表 + string object = 3; // speech解析原字段:闹钟/提醒(日程) } - Command command = 4; - string asr_recognize = 5; + Command command = 3; + string asr_recognize = 4; } message AlarmRemindSkillResponse{ diff --git a/service/connect/alarm.go b/service/connect/alarm.go new file mode 100644 index 0000000000000000000000000000000000000000..de56f71cfdeafb0988c799bd04c3d50979ec5c95 --- /dev/null +++ b/service/connect/alarm.go @@ -0,0 +1,65 @@ +package connect + +import ( + "context" + "speech-nlu-parse/global" + "speech-nlu-parse/model" + "speech-nlu-parse/pkg/logger" + "speech-nlu-parse/pkg/proto" + "time" +) + +const ( + Alarm = "alarm_remind" +) + +func AlarmGrpc(params *model.SpeechDomainParams, api, extra, object string) (*proto.AlarmRemindSkillResponse, error) { + conn, err := GrpcConn(Alarm) + if err != nil { + global.Logger.Errorf("faild to connect: %v", err) + return nil, err + } + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*2) + defer cancel() + + c := proto.NewAlarmRemindSkillClient(conn) + + req := &proto.AlarmRemindSkillRequest{ + AppInfo: &proto.AlarmRemindSkillRequest_AppInfo{ + AppId: "speech-nlu-parse", + RequestId: params.RequestId, + }, + DevInfo: &proto.AlarmRemindSkillRequest_DevInfo{ + Mac: params.Mac, + Mid: params.Mid, + Vender: params.MidType, + Hid: "", + HomeId: "", + Uid: "", + }, + Command: &proto.AlarmRemindSkillRequest_Command{ + Api: api, + Extra: extra, + Object: object, + }, + AsrRecognize: params.Query, + } + + resp, err := c.HandleSpeechCommand(ctx, req) + if err != nil { + global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, + "AlarmGrpc serverName": Alarm, + "AlarmGrpc request": req, + }).Errorf("alarm grpc error: %v", err) + return nil, err + } + global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, + "AlarmGrpc serverName": Alarm, + "AlarmGrpc request": req, + "AlarmGrpc response": resp, + }).Info("AlarmGrpc") + return resp, nil +} diff --git a/service/connect/music.go b/service/connect/music.go index ba6399a23dd77093b6cdd7cb0d79e8e4dd652199..9d5314d9435b0342e658cab3268926c3df593441 100644 --- a/service/connect/music.go +++ b/service/connect/music.go @@ -45,10 +45,15 @@ func MusicGrpc(params *model.SpeechDomainParams) (*proto.MusicSpotResponse, erro resp, err := c.GetMusicList(ctx, req) if err != nil { - global.Logger.Errorf("MusicGrpc error: %v", err) + global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, + "MusicGrpc serverName": MusicSpot, + "MusicGrpc request": req, + }).Errorf("MusicGrpc error: %v", err) return nil, err } global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, "MusicGrpc serverName": MusicSpot, "MusicGrpc request": req, "MusicGrpc response": resp, diff --git a/service/speechNlu/domain.go b/service/speechNlu/domain.go index eaf4448c45fda8b7e18d23d56db4b67703671b8e..788efa57ac409e1c1fb0e579cb9eee4f18073948 100644 --- a/service/speechNlu/domain.go +++ b/service/speechNlu/domain.go @@ -359,33 +359,74 @@ func translateDomain(params *model.SpeechDomainParams) []byte { return Marshal(params, res) } -func alarmDevFilter(params *model.SpeechDomainParams) bool { - if params.Mid == "10f05" && params.MidType == "87654321" { - return true - } else if params.Mid == "10f05" && params.MidType == "7e000024" && params.AppKey == "a8814080829e11eda5c8e38bb1008e50" { - return true +func alarmDomain(params *model.SpeechDomainParams) []byte { + if !params.CheckDm() || !params.CheckCommandParam() { + return replyWithChat(error_reply, "doudi") } - return false -} + var result model.ResponseBody + api := params.SpeechWsResp.Dm.Command.Api + extra := params.SpeechWsResp.Dm.Command.Param.Extra + object := params.SpeechWsResp.Dm.Command.Param.Object -type AlarmItem struct { - Content string `json:"content"` - Id string `json:"id"` - Note string `json:"note"` - RepeatType int `json:"repeatType"` - SpeechType int `json:"speechType"` - Start string `json:"start"` - Type int `json:"type"` - Url string `json:"url"` -} + if object == "闹钟" { + result.Header.Semantic.Domain = "alarm" + } else { + result.Header.Semantic.Domain = "reminder_v2" + } + result.Header.Semantic.Code = 0 + result.Header.Semantic.Msg = speech_nlu_parse + result.AsrRecongize = params.SpeechWsResp.Dm.Input + result.Header.Semantic.SessionComplete = params.SpeechWsResp.Dm.ShouldEndSession //params.SpeechWsResp.Dm.ShouldEndSession + result.ResponseText = params.SpeechWsResp.Dm.Nlg + + if api == "ai.dui.dskdm.reminder.query" { + result.Header.Semantic.Intent = "check" + result.Header.Semantic.SkillId = result.Header.Semantic.Domain + "." + result.Header.Semantic.Intent + } else if api == "ai.dui.dskdm.reminder.insert" { + result.Header.Semantic.Intent = "new" + result.Header.Semantic.SkillId = result.Header.Semantic.Domain + "." + result.Header.Semantic.Intent + resAlarm, err := connect.AlarmGrpc(params, api, extra, object) + if err != nil { + global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, + "mac": params.Mac, + "mid": params.Mid, + "vender": params.MidType, + }).Errorf("connect.AlarmGrpc error:%v", err) + return replyWithChat(error_reply, "doudi") + } + if resAlarm.GetStatus().GetCode() == 0 { + return Marshal(params, &result) + } else { + resultTextStr := "网络不稳定,请稍后再试" + return replyWithChat(resultTextStr, "chat.chat") + } + + } else if api == "ai.dui.dskdm.reminder.remove" { + result.Header.Semantic.Intent = "delete" + result.Header.Semantic.SkillId = result.Header.Semantic.Domain + "." + result.Header.Semantic.Intent + if !params.SpeechWsResp.Dm.ShouldEndSession { + return Marshal(params, &result) + } + + resAlarm, err := connect.AlarmGrpc(params, api, extra, object) + if err != nil { + global.Logger.WithFields(logger.Fields{ + "requestId": params.RequestId, + "mac": params.Mac, + "mid": params.Mid, + "vender": params.MidType, + }).Errorf("connect.AlarmGrpc error:%v", err) + return replyWithChat(error_reply, "doudi") + } + if resAlarm.GetStatus().GetCode() == 0 { + return Marshal(params, &result) + } else { + resultTextStr := "网络不稳定,请稍后再试" + return replyWithChat(resultTextStr, "chat.chat") + } + } -// 闹钟待写 -func alarmDomain(params *model.SpeechDomainParams) []byte { - //mac := params.Mac - // - //if !params.CheckDm() || !params.CheckDmParam() { - // return replyWithChat(error_reply, "doudi") - //} // //var result model.ResponseBody //result.Header.Semantic.Code = 0 @@ -480,8 +521,8 @@ func alarmDomain(params *model.SpeechDomainParams) []byte { //} // //return Marshal(params, &result) - resultTextStr := "暂不支持闹钟设定" - return replyWithChat(resultTextStr, "chat.chat") + + return Marshal(params, &result) } func scienceDomain(params *model.SpeechDomainParams) []byte {