From ac699a2d859ff162a4b1a6ba27daa25ccee7fa2c Mon Sep 17 00:00:00 2001 From: itsrubberduck Date: Mon, 15 Sep 2025 12:45:24 +0200 Subject: [PATCH] readback ptt geht --- server/api/atc/ptt.post.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/api/atc/ptt.post.ts b/server/api/atc/ptt.post.ts index 0c5be2c..b048397 100644 --- a/server/api/atc/ptt.post.ts +++ b/server/api/atc/ptt.post.ts @@ -7,6 +7,7 @@ import { tmpdir } from "node:os"; import { randomUUID } from "node:crypto"; import { execFile } from "node:child_process"; import { openai, LLM_MODEL, normalizeATC } from "../../utils/openai"; +import { createReadStream } from "node:fs"; // ← Diesen Import hinzufügen! interface PTTRequest { audio: string; // Base64 encoded audio @@ -232,7 +233,7 @@ export default defineEventHandler(async (event) => { // 3. OpenAI Whisper für Transkription const transcription = await openai.audio.transcriptions.create({ - file: await readFile(audioFileForWhisper), + file: createReadStream(audioFileForWhisper), // ReadStream model: "whisper-1", language: "en", // ATC ist standardmäßig auf Englisch prompt: "This is ATC radio communication with aviation phraseology including callsigns, runway numbers, and standard procedures.", @@ -273,7 +274,6 @@ export default defineEventHandler(async (event) => { } catch (error) { // Cleanup bei Fehler await rm(tmpAudioInput).catch(() => {}); - await rm(tmpAudioWav).catch(() => {}); if (error.statusCode) { throw error;