@@ -65,19 +65,6 @@ public async Task HandleTranscriptionCallbackAsync(HandleTranscriptionCallbackCo
65
65
var audioContent = await _smartTalkHttpClientFactory . GetAsync < byte [ ] > ( record . Url , cancellationToken ) . ConfigureAwait ( false ) ;
66
66
67
67
await _phoneOrderService . ExtractPhoneOrderRecordAiMenuAsync ( speakInfos , record , audioContent , cancellationToken ) . ConfigureAwait ( false ) ;
68
-
69
- await SendWorkWeChatRobotNotifyAsync ( audioContent , new PhoneOrderRecordInformationDto
70
- {
71
- OrderDate = record . CreatedDate ,
72
- Restaurant = record . Restaurant ,
73
- WorkWeChatRobotKey = record . Restaurant switch
74
- {
75
- PhoneOrderRestaurant . JiangNanChun => _phoneOrderSetting . GetSetting ( "江南春" ) ,
76
- PhoneOrderRestaurant . XiangTanRenJia => _phoneOrderSetting . GetSetting ( "湘潭人家" ) ,
77
- PhoneOrderRestaurant . MoonHouse => _phoneOrderSetting . GetSetting ( "福满楼" ) ,
78
- _ => throw new Exception ( "Restaurant not exist" )
79
- }
80
- } , record . TranscriptionText , cancellationToken ) . ConfigureAwait ( false ) ;
81
68
}
82
69
catch ( Exception e )
83
70
{
@@ -89,60 +76,6 @@ public async Task HandleTranscriptionCallbackAsync(HandleTranscriptionCallbackCo
89
76
}
90
77
}
91
78
92
- public async Task SendWorkWeChatRobotNotifyAsync ( byte [ ] recordContent , PhoneOrderRecordInformationDto recordInfo , string transcription , CancellationToken cancellationToken )
93
- {
94
- await _weChatClient . SendWorkWechatRobotMessagesAsync ( recordInfo . WorkWeChatRobotUrl ,
95
- new SendWorkWechatGroupRobotMessageDto
96
- {
97
- MsgType = "text" ,
98
- Text = new SendWorkWechatGroupRobotTextDto
99
- {
100
- Content = $ "----------{ recordInfo . Restaurant . GetDescription ( ) } -PST { recordInfo . OrderDate . ToString ( "yyyy/MM/dd HH:mm:ss" ) } ----------"
101
- }
102
- } , cancellationToken ) ;
103
-
104
- var splitAudios = await ConvertAndSplitAudioAsync ( recordContent , secondsPerAudio : 60 , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
105
-
106
- await SendMultiAudioMessagesAsync ( splitAudios , recordInfo , cancellationToken ) . ConfigureAwait ( false ) ;
107
-
108
- await _weChatClient . SendWorkWechatRobotMessagesAsync (
109
- recordInfo . WorkWeChatRobotUrl , new SendWorkWechatGroupRobotMessageDto
110
- {
111
- MsgType = "text" , Text = new SendWorkWechatGroupRobotTextDto { Content = transcription }
112
- } , CancellationToken . None ) ;
113
-
114
- await _weChatClient . SendWorkWechatRobotMessagesAsync (
115
- recordInfo . WorkWeChatRobotUrl , new SendWorkWechatGroupRobotMessageDto
116
- {
117
- MsgType = "text" , Text = new SendWorkWechatGroupRobotTextDto { Content = "-------------------------End-------------------------" }
118
- } , CancellationToken . None ) ;
119
- }
120
-
121
- public async Task < List < byte [ ] > > ConvertAndSplitAudioAsync ( byte [ ] record , int secondsPerAudio , CancellationToken cancellationToken )
122
- {
123
- var amrAudio = await _ffmpegService . ConvertWavToAmrAsync ( record , "" , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
124
-
125
- return await _ffmpegService . SplitAudioAsync ( amrAudio , secondsPerAudio , "amr" , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
126
- }
127
-
128
- public async Task SendMultiAudioMessagesAsync ( List < byte [ ] > audios , PhoneOrderRecordInformationDto recordInfo , CancellationToken cancellationToken )
129
- {
130
- foreach ( var audio in audios )
131
- {
132
- var uploadResponse = await _weChatClient . UploadWorkWechatTemporaryFileAsync (
133
- recordInfo . WorkWeChatRobotUploadVoiceUrl , Guid . NewGuid ( ) + ".amr" , UploadWorkWechatTemporaryFileType . Voice , audio , cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
134
-
135
- if ( string . IsNullOrEmpty ( uploadResponse ? . MediaId ) ) continue ;
136
-
137
- await _weChatClient . SendWorkWechatRobotMessagesAsync ( recordInfo . WorkWeChatRobotUrl ,
138
- new SendWorkWechatGroupRobotMessageDto
139
- {
140
- MsgType = "voice" ,
141
- Voice = new SendWorkWechatGroupRobotFileDto { MediaId = uploadResponse . MediaId }
142
- } , cancellationToken ) ;
143
- }
144
- }
145
-
146
79
private List < SpeechMaticsSpeakInfoDto > StructureDiarizationResults ( List < SpeechMaticsResultDto > results )
147
80
{
148
81
string currentSpeaker = null ;
0 commit comments