Don't return error from recognizeSpeech for failed recognitions.

This commit is contained in:
levlam 2023-11-21 16:16:14 +03:00
parent 77d6df1437
commit 89b0fbc8ff
3 changed files with 6 additions and 6 deletions

View File

@ -3862,7 +3862,7 @@ speechRecognitionResultPending partial_text:string = SpeechRecognitionResult;
//@description The speech recognition successfully finished @text Recognized text
speechRecognitionResultText text:string = SpeechRecognitionResult;
//@description The speech recognition failed @error Recognition error
//@description The speech recognition failed @error Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media duration is too big to be recognized
speechRecognitionResultError error:error = SpeechRecognitionResult;
@ -7004,7 +7004,7 @@ translateText text:formattedText to_language_code:string = FormattedText;
//-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu"
translateMessageText chat_id:int53 message_id:int53 to_language_code:string = FormattedText;
//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized
//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled
//@chat_id Identifier of the chat to which the message belongs
//@message_id Identifier of the message
recognizeSpeech chat_id:int53 message_id:int53 = Ok;

View File

@ -233,9 +233,9 @@ void VideoNotesManager::on_transcribed_audio_update(
CHECK(video_note->transcription_info != nullptr);
if (r_update.is_error()) {
auto promises = video_note->transcription_info->on_failed_transcription(r_update.error().clone());
auto promises = video_note->transcription_info->on_failed_transcription(r_update.move_as_error());
on_video_note_transcription_updated(file_id);
fail_promises(promises, r_update.move_as_error());
set_promises(promises);
return;
}
auto update = r_update.move_as_ok();

View File

@ -197,9 +197,9 @@ void VoiceNotesManager::on_transcribed_audio_update(
CHECK(voice_note->transcription_info != nullptr);
if (r_update.is_error()) {
auto promises = voice_note->transcription_info->on_failed_transcription(r_update.error().clone());
auto promises = voice_note->transcription_info->on_failed_transcription(r_update.move_as_error());
on_voice_note_transcription_updated(file_id);
fail_promises(promises, r_update.move_as_error());
set_promises(promises);
return;
}
auto update = r_update.move_as_ok();