Commit Graph

36 Commits

Author SHA1 Message Date
itsrubberduck
b359670d47 feat(tts): map logical pool voices to distinct Piper speakers on Speaches
Until now the Speaches branch sent every request to the single env-configured
model (de_DE-thorsten — a German voice for English radio), so the voice pool
had no audible effect. A server-side registry now resolves the logical voice
ids to disjoint controller/pilot Piper speakers; unknown ids keep the env
fallback and the cache key follows the resolved pair.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 10:45:49 +02:00
leubeem
b80feb80d6 feat(stt): seed Whisper prompt with expected readback + per-field debug UI
Whisper prompt seeding (per request):
- ptt.post.ts builds the prompt as generic ICAO bias + this state's expected
  readback appended LAST (survives the 224-token truncation), in both raw token
  form and spoken ICAO form via new radioSpeech.speakToken().
- pm.vue passes the expected phrase + active variable values; classroom.vue
  passes the lesson's expected field values.

Per-field readback debug:
- sttMatch.matchTranscriptionToFields returns fields[] (matched/missing + which
  view matched) plus normalized/denormalized transcription views.
- useRadioBackend types readback_report on the transmit response.
- pm.vue renders a "Readback check" panel in the right log rail; classroom.vue
  renders per-field rows under the STT panel.

Radio-pronunciation fixes (radioSpeech.ts):
- callsign expander handles multi-letter suffixes (DLH6RK -> Lufthansa six Romeo
  Kilo).
- toRadioSpeech now expands airports (EDDC -> Echo Delta Delta Charlie).
- bare altitudes >=1000 in a clearance context are spoken ("climb initially
  5000" -> "climb initially five thousand feet"); speeds/headings untouched.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 14:12:54 +02:00
leubeem
f097141e8a feat(atc): bias Whisper STT toward aviation phraseology
Replace the generic one-line Whisper prompt with a vocabulary-rich bias prompt
(phonetic alphabet, aviation number words, common phraseology, and the airline
telephony names pulled live from DEFAULT_AIRLINE_TELEPHONY) and set
temperature: 0. Aviation R/T is a constrained domain, so seeding the expected
vocabulary improves transcription of callsigns, runways, and readbacks — the
upstream input to the decision engine. Stays within the ~224-token prompt cap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 14:47:22 +02:00
leubeem
7367f7cdb7 feat(server): per-user AI usage tracking, cost alerting, and endpoint hardening
Usage tracking:
- new UsageEvent collection records every STT/TTS/LLM call per user with
  provider, model, volume (audio seconds, characters, tokens) and an
  estimated USD cost; self-hosted providers (Speaches/Piper) and cache
  hits record at $0
- pricing table for whisper-1, tts-1, gpt-5-nano & co. in server/utils/usage.ts
- weekly KPI mail gains an "AI-Nutzung & Kosten" section: weekly and
  rolling 30-day cost, per-kind breakdown, top 5 users by cost
- quota alert mail when rolling 30-day cost exceeds USAGE_ALERT_USD
  (default $5), at most once per calendar month (UsageAlertDelivery)

Hardening:
- /api/atc/say now requires an authenticated session (middleware
  exemption removed); useFlightLabAudio sends the bearer token
- /api/service/tools/latency requires auth (was a public LLM endpoint)
- per-user rate limits: PTT 20/min, say 60/min, latency 5/min
- cron endpoints (waitlist-drip, weekly-kpi-report) require a shared
  secret via ?secret= or x-cron-secret (CRON_SECRET, falls back to
  KPI_CRON_SECRET); allowed with a warning while unset so existing
  deployments keep working
- PTT records the actual transcribed audio duration for billing accuracy

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 23:17:03 +02:00
leubeem
cab7b36d85 feat(atc): accept preNormalized flag on /api/atc/say
Clients that already ran the full radiotelephony normalizer (see
normalizeATCText) pass preNormalized: true so the server skips
normalizeATC — double-normalizing corrupts the text, e.g. expandAirports
spells the city name "MAIN" letter-by-letter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 23:12:53 +02:00
itsrubberduck
49dd5031bd feat(atis): clock-locked ATIS loop tied to tuned frequency
Real ATIS broadcasts run continuously; tuning in mid-broadcast should
drop the pilot into the current spoken position, then loop. The frontend
now generates the full announcement once via TTS, plays it as a looping
HTMLAudioElement, and seeks to ((Date.now() - lastUpdated) / duration)
on metadata-load so all clients tuned to the same ATIS hear it phase-
synced. The loop starts/stops automatically with frequency tuning and
restarts on info-letter change. say.post.ts now caches tag=atis like
tag=flightlab to avoid re-synthesizing identical announcements.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 14:43:48 +02:00
leubeem
ea4b1e0b24 Cleanup old unused code and add id sessionId to /api/atc/ptt 2026-05-20 14:13:26 +02:00
itsrubberduck
e818f6001e change default settings 2026-02-18 18:05:12 +01:00
itsrubberduck
de02dc4f9e typescript 2026-02-17 18:19:55 +01:00
itsrubberduck
346579676e fix(classroom): audio speed slider now actually changes playback speed with pitch correction
- Fix client: playbackRate was set to 1 for non-native-speed providers (Speaches/Piper),
  making the speed slider ineffective in the main Pizzicato audio path
- Fix server: pass speed parameter to Speaches TTS API
- Add pitch-preserving playback via MediaElementSourceNode when rate != 1,
  routing through the same Web Audio effects chain (radio filters, distortion, etc.)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:01:02 +01:00
itsrubberduck
af2eed2d6e dont log users id on transmission 2026-02-13 18:44:34 +01:00
Remi
7f2585c211 Improve flow activation handling and expose active nodes 2025-09-23 23:12:02 +02:00
Remi
fbec5c4830 Add session timeline logging and admin sessions view 2025-09-21 23:08:10 +02:00
Remi
6c9f467b94 Enable flow-aware decision routing 2025-09-21 21:16:33 +02:00
Remi
d6c87d3378 Enhance admin transmissions with detailed LLM and TTS context 2025-09-20 12:42:21 +02:00
Remi
440aef2f62 Fix remaining German comment 2025-09-20 09:46:34 +02:00
Remi
43f2f42238 Add waitlist admin view and log OpenAI decision traces 2025-09-18 23:30:56 +02:00
Remi
6dbfe07d2b Persist learn progress per user 2025-09-18 23:30:55 +02:00
Remi
7a44d67844 Harden runtime config and input validation 2025-09-18 14:03:25 +02:00
itsrubberduck
0ae44bf89a resolve merge conflict 2025-09-16 17:44:29 +02:00
Remi
19f253f53e Implement authentication, waitlist, and logging upgrades 2025-09-16 17:28:34 +02:00
itsrubberduck
4f1257863c feat(api): extend ATC TTS endpoint with flexible output formats & Speaches support
- say.post.ts:
  - added AudioFmt type, format helpers (mime/ext), Speaches TTS integration
  - routing: Speaches > Piper > OpenAI fallback
  - supports dynamic formats (, ===============================================================================
flac - Command-line FLAC encoder/decoder version 1.5.0
Copyright (C) 2000-2009  Josh Coalson
Copyright (C) 2011-2025  Xiph.Org Foundation

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
===============================================================================

This is the short help; for all options use 'flac --help'; for more explanation
and examples please consult the manual. This manual is often distributed
alongside the program as a man page or an HTML file. It can also be found
online at https://xiph.org/flac/documentation_tools_flac.html

To encode:
  flac [-#] [INPUTFILE [...]]

  -# is -0 (fastest compression) to -8 (highest compression); -5 is the default

To decode:
  flac -d [INPUTFILE [...]]

To test:
  flac -t [INPUTFILE [...]], , ) or smallest
  - uses VOICE_ID and SPEACHES_BASE_URL from ENV
  - response returns correct mime, extension & base64
  - meta extended with modelUsed and format
  - ports & defaults configurable via ENV
2025-09-16 16:42:01 +02:00
itsrubberduck
a7eebf0baf refactor: update OpenAI TTS integration and cleanup imports
- index.vue: comment out cockpit simulator image
- learn.vue: remove unused imports (useRadioTTS, learnModules)
- atc/say.post.ts & utils/normalize.ts: rename openaiOld → normalize, adjust TTS calls, skip ensureDir/writeFile
- communicationsEngine.ts: fix atcDecisionTree import path
2025-09-16 16:14:12 +02:00
Remi
8abd011514 Refine pilot monitoring communication flow 2025-09-16 15:48:00 +02:00
itsrubberduck
c8734db25f get rid of ptt and decide difference and unite into one endpoint 2025-09-16 13:39:46 +02:00
itsrubberduck
f72d5b22b8 new version of pm using decision tree 2025-09-16 12:23:32 +02:00
itsrubberduck
01c93fe4db remove writefile 2025-09-15 23:09:05 +02:00
itsrubberduck
d4ca549747 add atc styled response to readbacks 2025-09-15 23:08:08 +02:00
itsrubberduck
2a446f8a61 USE_PIPER 2025-09-15 22:43:07 +02:00
itsrubberduck
2db83e64a6 communcations verbessern 2025-09-15 19:34:42 +02:00
itsrubberduck
2ad2f8401f readback ptt geht 2025-09-15 12:45:24 +02:00
itsrubberduck
27e0507bbd tts tut jetz 2025-09-15 11:58:11 +02:00
itsrubberduck
d4ce409641 claude änderungen 2025-09-15 11:53:50 +02:00
itsrubberduck
ea29112fb4 Track folder with Git LFS 2025-09-15 11:53:39 +02:00
itsrubberduck
426a91e71f iwas was nich tut dazutun 2025-09-15 11:20:30 +02:00
itsrubberduck
8528b2518b kann ein bisschen normalized sprechen 2025-09-14 23:20:01 +02:00