From c48f5fe40e95ec162b63a5eae8a4905a8434e735 Mon Sep 17 00:00:00 2001 From: leubeem Date: Wed, 10 Jun 2026 23:12:53 +0200 Subject: [PATCH] feat(atc): accept preNormalized flag on /api/atc/say MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- server/api/atc/say.post.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/api/atc/say.post.ts b/server/api/atc/say.post.ts index 256183c..003c105 100644 --- a/server/api/atc/say.post.ts +++ b/server/api/atc/say.post.ts @@ -169,6 +169,12 @@ export default defineEventHandler(async (event) => { tag?: string; format?: AudioFmt | "smallest"; sessionId?: string; + /** + * Client already ran the radiotelephony normalizer on the text. + * Skip server-side normalizeATC — double-normalizing corrupts it + * (e.g. expandAirports spells the city name "MAIN" letter-by-letter). + */ + preNormalized?: boolean; }>(event); // const user = await requireUserSession(event); @@ -185,7 +191,7 @@ export default defineEventHandler(async (event) => { const voice = (body?.voice || runtimeConfig.voiceId).trim(); const speed = Math.max(0.5, Math.min(2.0, body?.speed || 1.0)); - const normalized = normalizeATC(raw); + const normalized = body?.preNormalized ? raw : normalizeATC(raw); if (!normalized) throw createError({ statusCode: 400, statusMessage: "normalized text empty" }); // Routing