From 453df5eb0ccc3d9e775e3d395f192195c27689ec Mon Sep 17 00:00:00 2001 From: itsrubberduck Date: Mon, 15 Sep 2025 23:08:08 +0200 Subject: [PATCH] add atc styled response to readbacks --- README.md | 5 ++++- server/api/atc/ptt.post.ts | 9 +++++++-- .../2025-09-15/2a3dd8f7-fdb4-4281-bdcc-0f27ac90ad6f.ogg | 0 .../2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.json | 3 --- .../2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.wav | 3 --- .../2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.json | 3 --- .../2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.wav | 3 --- .../2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.json | 3 --- .../2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.wav | 3 --- 9 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 storage/atc/2025-09-15/2a3dd8f7-fdb4-4281-bdcc-0f27ac90ad6f.ogg delete mode 100644 storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.json delete mode 100644 storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.wav delete mode 100644 storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.json delete mode 100644 storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.wav delete mode 100644 storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.json delete mode 100644 storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.wav diff --git a/README.md b/README.md index 4a3af17..cec524a 100644 --- a/README.md +++ b/README.md @@ -75,5 +75,8 @@ bun run preview Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. -# TTS Config +# Piper TTS local if you want to use local tts, install and run pip install "piper-tts[http]" on port 5001, then set USE_PIPER=true in .env + +# Whisper Tiny local +if you want to use local whisper tiny implement it #TODO diff --git a/server/api/atc/ptt.post.ts b/server/api/atc/ptt.post.ts index b048397..133a58e 100644 --- a/server/api/atc/ptt.post.ts +++ b/server/api/atc/ptt.post.ts @@ -27,6 +27,7 @@ interface PTTResponse { accuracy: number; // Text similarity keywordMatch: number; // Keyword matching recommendation: 'excellent' | 'good' | 'retry' | 'listen_again'; + atcResponse?: string; // Antwort des ATC (vom LLM generiert) feedback: string; mistakes?: string[]; }; @@ -129,11 +130,13 @@ Evaluate the readback and provide: 1. Brief feedback (max 2 sentences) 2. Specific mistakes if any 3. Overall assessment +4. A short ATC-style response to the pilot's readback (if appropriate) Be constructive and educational. Focus on aviation safety and standard phraseology. Response format: FEEDBACK: [your feedback] +ATC_RESPONSE: [your response via ATC phraseology to the pilot] MISTAKES: [list mistakes or "None"] ASSESSMENT: [excellent/good/needs_improvement/unacceptable]`; @@ -141,12 +144,13 @@ ASSESSMENT: [excellent/good/needs_improvement/unacceptable]`; const completion = await openai.chat.completions.create({ model: LLM_MODEL, messages: [{ role: "user", content: prompt }], - max_tokens: 300, - temperature: 0.3 }); const response = completion.choices[0]?.message?.content || ""; + console.log("LLM Evaluation Response:", response); + const feedback = response.match(/FEEDBACK: (.+?)(?=MISTAKES:|$)/)?.[1]?.trim() || "Good attempt."; + const atcResponse = response.match(/ATC_RESPONSE: (.+?)(?=MISTAKES:|$)/)?.[1]?.trim() || "Noted."; const mistakes = response.match(/MISTAKES: (.+?)(?=ASSESSMENT:|$)/)?.[1]?.trim(); const assessment = response.match(/ASSESSMENT: (.+)/)?.[1]?.trim() || "good"; @@ -170,6 +174,7 @@ ASSESSMENT: [excellent/good/needs_improvement/unacceptable]`; accuracy, keywordMatch, recommendation, + atcResponse, feedback, mistakes: mistakes && mistakes !== "None" ? [mistakes] : undefined, playAgain diff --git a/storage/atc/2025-09-15/2a3dd8f7-fdb4-4281-bdcc-0f27ac90ad6f.ogg b/storage/atc/2025-09-15/2a3dd8f7-fdb4-4281-bdcc-0f27ac90ad6f.ogg deleted file mode 100644 index e69de29..0000000 diff --git a/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.json b/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.json deleted file mode 100644 index 37c4e1e..0000000 --- a/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ed0f4170d058d7160aab0b3bb4ef21bb1f16dc48a64ddbf8d082db080a14154 -size 598 diff --git a/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.wav b/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.wav deleted file mode 100644 index fa8bc52..0000000 --- a/storage/atc/2025-09-15/2e9997a8-ba80-4903-9d0a-3f1ebca654bc.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:765af0058f555524aa0be4e48c849b301d5f8c7cd7674f12bf9ffdd9d76afb68 -size 92640 diff --git a/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.json b/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.json deleted file mode 100644 index ac0a46b..0000000 --- a/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b385a79c504d5ca4faf42a17510a2d19fbcfe3f398330143c5a83e43dca59ee6 -size 533 diff --git a/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.wav b/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.wav deleted file mode 100644 index 25ce389..0000000 --- a/storage/atc/2025-09-15/9bd9485c-8520-4d71-a2c4-c67275ae8380.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:111d77baef73c93f584ecfa6b7bf7c08d7d2c71de9a58d09b59cda155e38da6b -size 48960 diff --git a/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.json b/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.json deleted file mode 100644 index f76fdae..0000000 --- a/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8bf7514d34d4d5f2ea7c1e1b50026b9d287296be384587cc0dff45685916bdb6 -size 533 diff --git a/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.wav b/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.wav deleted file mode 100644 index f5b4638..0000000 --- a/storage/atc/2025-09-15/d2c9a845-9257-4655-a315-bbe6a615c239.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:32c45f9ff6a054ffbdcdb6348f418c75d96abdeb3f671a44678bafd696405233 -size 49920