Skip to content

Commit ae394b9

Browse files
committed
fix: add deletion of saved voice messages file after use
1 parent dc29c0e commit ae394b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/handlers/openaiHandlers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { LEXICON_EN } from '../lexicon/lexicon_en.js';
33

44
import { openai } from '../openai.js';
55
import { converter } from '../converter.js';
6+
import { deleteFile } from '../utils/deleteFile.js';
67

78
import { menuKeyboard } from '../keyboards/keyboards.js';
89
import { createInitialSession } from '../utils/createSession.js';
@@ -84,14 +85,14 @@ class OpenAIHandlers {
8485
role: openai.roles.USER,
8586
content: text,
8687
});
87-
8888
openai
8989
.chat(sessions[sessionId].messages)
9090
.then(this.sendResponse(ctx, sessions, sessionId))
9191
.catch(ErrorHandler.responseError(ctx, 'transcription'));
9292
})
9393
.catch(ErrorHandler.responseError(ctx, 'voiceHandler'))
9494
.finally(async () => {
95+
await deleteFile(mp3Path);
9596
await ctx.deleteMessage(processing.message_id);
9697
});
9798
};

0 commit comments

Comments
 (0)