add atc styled response to readbacks

This commit is contained in:
itsrubberduck
2025-09-15 23:08:08 +02:00
parent 954f7ed818
commit 453df5eb0c
9 changed files with 11 additions and 21 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0ed0f4170d058d7160aab0b3bb4ef21bb1f16dc48a64ddbf8d082db080a14154
size 598

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:765af0058f555524aa0be4e48c849b301d5f8c7cd7674f12bf9ffdd9d76afb68
size 92640

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b385a79c504d5ca4faf42a17510a2d19fbcfe3f398330143c5a83e43dca59ee6
size 533

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:111d77baef73c93f584ecfa6b7bf7c08d7d2c71de9a58d09b59cda155e38da6b
size 48960

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8bf7514d34d4d5f2ea7c1e1b50026b9d287296be384587cc0dff45685916bdb6
size 533

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:32c45f9ff6a054ffbdcdb6348f418c75d96abdeb3f671a44678bafd696405233
size 49920