@@ -66,8 +66,8 @@ class OpenAIHandlers {
6666      const  sessionId  =  ctx . message . chat . id ; 
6767      sessions [ sessionId ]  ??=  createInitialSession ( ) ; 
6868
69-       const  processing  =  await  ctx . reply ( 
70-           code ( LEXICON_EN [ 'processingVoice ' ] ) , 
69+       const  processingTranscription  =  await  ctx . reply ( 
70+           code ( LEXICON_EN [ 'processingTranscription ' ] ) , 
7171          menuKeyboard ) ; 
7272
7373      ctx . sendChatAction ( 'typing' ) ; 
@@ -81,19 +81,27 @@ class OpenAIHandlers {
8181      openai 
8282          . transcription ( mp3Path ) 
8383          . then ( async  ( text )  =>  { 
84+             const  processingVoice  =  await  ctx . reply ( 
85+                 code ( LEXICON_EN [ 'processingVoice' ] ) , 
86+                 menuKeyboard ) ; 
87+ 
8488            sessions [ sessionId ] . messages . push ( { 
8589              role : openai . roles . USER , 
8690              content : text , 
8791            } ) ; 
92+ 
8893            openai 
8994                . chat ( sessions [ sessionId ] . messages ) 
9095                . then ( this . sendResponse ( ctx ,  sessions ,  sessionId ) ) 
91-                 . catch ( ErrorHandler . responseError ( ctx ,  'transcription' ) ) ; 
96+                 . catch ( ErrorHandler . responseError ( ctx ,  'transcription' ) ) 
97+                 . finally ( async  ( )  =>  { 
98+                   await  ctx . deleteMessage ( processingVoice . message_id ) ; 
99+                 } ) ; 
92100          } ) 
93101          . catch ( ErrorHandler . responseError ( ctx ,  'voiceHandler' ) ) 
94102          . finally ( async  ( )  =>  { 
95103            await  deleteFile ( mp3Path ) ; 
96-             await  ctx . deleteMessage ( processing . message_id ) ; 
104+             await  ctx . deleteMessage ( processingTranscription . message_id ) ; 
97105          } ) ; 
98106    } ; 
99107  } ; 
0 commit comments