feat: some more logs

This commit is contained in:
max_richter 2025-05-09 19:51:25 +02:00
parent a414a80766
commit 9dc01a59be
Signed by: max
GPG Key ID: 51973802EF3F77C5

View File

@ -39,6 +39,8 @@ bot.command("end", async (ctx) => {
const task = activeTasks[ctx.chat.id.toString()];
if (!task) return ctx.reply("No active note found.");
console.log("Ending note", task.noteName);
let finalNote = `# ${task.noteName}\n\n`;
const photoTasks: { content: Uint8Array; path: string }[] = [];
@ -49,19 +51,20 @@ bot.command("end", async (ctx) => {
finalNote += entry.content + "\n\n";
} else if (entry.type === "voice") {
try {
console.log("Converting OGG to MP3");
const mp3Data = await convertOggToMp3(entry.content as Uint8Array);
console.log("Finished converting OGG to MP3, transcribing...");
const transcript = await transcribe(mp3Data);
finalNote += `**Voice Transcript:**\n${transcript}\n\n`;
console.log("Finished transcribing");
} catch (error) {
console.log(error);
finalNote += "**[Voice message could not be transcribed]**\n\n";
}
} else if (entry.type === "photo") {
photoIndex++;
const photoUrl = `${
task.noteName.replace(/\.md$/, "")
}/photo-${photoIndex}.jpg`;
}/photo-${photoIndex++}.jpg`;
finalNote += `**Photo**:\n ${photoUrl}\n\n`;
photoTasks.push({