This commit is contained in:
itsrubberduck
2025-09-14 21:09:47 +02:00
commit e91c3c6aa9
17 changed files with 9313 additions and 0 deletions

8
server/utils/openai.ts Normal file
View File

@@ -0,0 +1,8 @@
import OpenAI from "openai";
export const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY! });
export const LLM_MODEL = process.env.LLM_MODEL || "gpt-5-nano";
export const TTS_MODEL = process.env.TTS_MODEL || "tts-1";
export function atcReplyPrompt(userText: string) {
return `You are an ICAO-compliant ATC controller. Reply concisely.
Pilot said: "${userText}"`;
}

8
server/utils/radio.ts Normal file
View File

@@ -0,0 +1,8 @@
import { execFile } from "node:child_process";
export async function applyRadioEffect(input: string, output: string) {
const filter="[0:a]highpass=f=300,lowpass=f=3400,compand=attacks=0.02:decays=0.25:points=-80/-900|-70/-20|0/-10|20/-8:gain=6,volume=1.2[a];anoisesrc=color=white:amplitude=0.02[ns];[a][ns]amix=inputs=2:weights=1 0.25:duration=shortest,volume=1.0,aecho=0.6:0.7:8:0.08,acompressor=threshold=0.6:ratio=6:attack=20:release=200";
await new Promise((res,rej)=>
execFile("ffmpeg",["-y","-i",input,"-filter_complex",filter,"-ar","16000",output],
(err,_,stderr)=>err?rej(new Error(stderr)):res())
);
}