The system now intelligently handles edge cases while maintaining the core decision tree structure. The LLM will follow the schema when possible but can respond naturally when the pilot says something unexpected, making it much more realistic and flexible for training scenarios

This commit is contained in:
itsrubberduck
2025-09-16 12:38:15 +02:00
parent 4b8da310b4
commit 059dc656b3
4 changed files with 1153 additions and 382 deletions

View File

@@ -9,10 +9,21 @@ export default defineEventHandler(async (event) => {
if (!body.state_id || !Array.isArray(body.candidates)) {
throw createError({ statusCode: 400, statusMessage: 'Invalid shape' })
}
try {
const decision = await routeDecision(body)
return decision // direkt das JSON des Routers zurückgeben
// Log für Debugging bei off-schema oder radio check
if (decision.off_schema) {
console.log(`[ATC] Off-schema response for: "${body.pilot_utterance}"`)
}
if (decision.radio_check) {
console.log(`[ATC] Radio check processed: "${body.pilot_utterance}"`)
}
return decision
} catch (err: any) {
console.error('Router failed:', err)
throw createError({ statusCode: 500, statusMessage: err?.message || 'Router failed' })
}
})