mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-04 08:06:26 +08:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user