refactor: share llm decision types

This commit is contained in:
Remi
2025-09-20 09:27:45 +02:00
parent 103fdd6bbc
commit 341a39e7d8
2 changed files with 18 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
// server/utils/openai.ts
import OpenAI from 'openai'
import { spellIcaoDigits, toIcaoPhonetic } from '../../shared/utils/radioSpeech'
import type { LLMDecision, LLMDecisionInput } from '../../shared/types/llm'
import { getServerRuntimeConfig } from './runtimeConfig'
let openaiClient: OpenAI | null = null
@@ -47,24 +48,6 @@ export async function decide(system: string, user: string): Promise<string> {
return r.choices?.[0]?.message?.content?.trim() || ''
}
export interface LLMDecisionInput {
state_id: string
state: any
candidates: Array<{ id: string; state: any }>
variables: Record<string, any>
flags: Record<string, any>
pilot_utterance: string
}
export interface LLMDecision {
next_state: string
updates?: Record<string, any>
flags?: Record<string, any>
controller_say_tpl?: string
off_schema?: boolean
radio_check?: boolean
}
export interface LLMDecisionTraceCall {
stage: 'readback-check' | 'decision'
request: Record<string, any>

17
shared/types/llm.ts Normal file
View File

@@ -0,0 +1,17 @@
export interface LLMDecisionInput {
state_id: string
state: any
candidates: Array<{ id: string; state: any }>
variables: Record<string, any>
flags: Record<string, any>
pilot_utterance: string
}
export interface LLMDecision {
next_state: string
updates?: Record<string, any>
flags?: Record<string, any>
controller_say_tpl?: string
off_schema?: boolean
radio_check?: boolean
}