diff --git a/server/api/llm/decide.post.ts b/server/api/llm/decide.post.ts index 702d5eb..205ee98 100644 --- a/server/api/llm/decide.post.ts +++ b/server/api/llm/decide.post.ts @@ -1,6 +1,7 @@ // server/api/llm/decide.post.ts import { readBody, createError } from 'h3' -import { routeDecision, type LLMDecisionInput } from '../../utils/openai' +import type { LLMDecisionInput } from '~~/shared/types/llm' +import { routeDecision } from '../../utils/openai' export default defineEventHandler(async (event) => { const body = await readBody(event) diff --git a/server/utils/openai.ts b/server/utils/openai.ts index 23c5d2d..688d2c3 100644 --- a/server/utils/openai.ts +++ b/server/utils/openai.ts @@ -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 { return r.choices?.[0]?.message?.content?.trim() || '' } -export interface LLMDecisionInput { - state_id: string - state: any - candidates: Array<{ id: string; state: any }> - variables: Record - flags: Record - pilot_utterance: string -} - -export interface LLMDecision { - next_state: string - updates?: Record - flags?: Record - controller_say_tpl?: string - off_schema?: boolean - radio_check?: boolean -} - export interface LLMDecisionTraceCall { stage: 'readback-check' | 'decision' request: Record diff --git a/shared/types/llm.ts b/shared/types/llm.ts new file mode 100644 index 0000000..baad63a --- /dev/null +++ b/shared/types/llm.ts @@ -0,0 +1,17 @@ +export interface LLMDecisionInput { + state_id: string + state: any + candidates: Array<{ id: string; state: any }> + variables: Record + flags: Record + pilot_utterance: string +} + +export interface LLMDecision { + next_state: string + updates?: Record + flags?: Record + controller_say_tpl?: string + off_schema?: boolean + radio_check?: boolean +} diff --git a/shared/utils/openaiDecision.ts b/shared/utils/openaiDecision.ts index 525e847..2014c90 100644 --- a/shared/utils/openaiDecision.ts +++ b/shared/utils/openaiDecision.ts @@ -1,19 +1,5 @@ // utils/openaiDecision.ts -export interface LLMDecisionInput { - state_id: string - state: any - candidates: Array<{ id: string; state: any }> - variables: Record - flags: Record - pilot_utterance: string -} - -export interface LLMDecision { - next_state: string - updates?: Record - flags?: Record - controller_say_tpl?: string -} +import type { LLMDecision, LLMDecisionInput } from '../types/llm' /** Client-seitig: ruft den Backend-Endpunkt auf */ export async function decideNextStateLLM(input: LLMDecisionInput): Promise {