mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-07 01:55:51 +08:00
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:
@@ -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' })
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user