Add waitlist admin view and log OpenAI decision traces

This commit is contained in:
Remi
2025-09-18 23:28:47 +02:00
committed by itsrubberduck
parent f4fc9f2707
commit db4e30292c
5 changed files with 562 additions and 66 deletions

View File

@@ -1,5 +1,6 @@
// server/api/llm/decide.post.ts
import { readBody, createError } from 'h3'
import { routeDecision, type LLMDecisionInput } from '../../utils/openai'
export default defineEventHandler(async (event) => {
const body = await readBody<LLMDecisionInput | undefined>(event)
@@ -11,7 +12,7 @@ export default defineEventHandler(async (event) => {
}
try {
const decision = await routeDecision(body)
const { decision, trace } = await routeDecision(body)
// Log für Debugging bei off-schema oder radio check
if (decision.off_schema) {
@@ -21,6 +22,10 @@ export default defineEventHandler(async (event) => {
console.log(`[ATC] Radio check processed: "${body.pilot_utterance}"`)
}
if (trace?.calls?.length) {
console.log('[ATC] Decision trace captured with', trace.calls.length, 'call(s)')
}
return decision
} catch (err: any) {
console.error('Router failed:', err)