mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-04 08:06:26 +08:00
fix typescript errors and update dependencies
This commit is contained in:
Binary file not shown.
@@ -72,7 +72,7 @@ const scheduleHotjarInitialization = () => {
|
||||
hotjarInitialized.value = true;
|
||||
|
||||
window.setTimeout(() => {
|
||||
initialize(HOTJAR_ID, HOTJAR_SCRIPT_VERSION);
|
||||
initialize();
|
||||
}, HOTJAR_INIT_DELAY);
|
||||
};
|
||||
|
||||
|
||||
@@ -1045,7 +1045,7 @@
|
||||
:key="segment.type === 'field' ? `f-${segment.key}` : `t-${idx}`">
|
||||
<span v-if="segment.type === 'text'" class="cloze-chunk cloze-text">
|
||||
{{
|
||||
displayCallsign(typeof segment.text === 'function' && scenario ? segment.text(scenario) : segment.text)
|
||||
displayCallsign(typeof segment.text === 'function' ? (scenario ? segment.text(scenario) : '') : segment.text)
|
||||
}}
|
||||
</span>
|
||||
<label
|
||||
@@ -1704,6 +1704,7 @@ type ExperienceOption = {
|
||||
description: string
|
||||
icon: string
|
||||
to: string
|
||||
target?: '_self' | '_blank'
|
||||
matches: (path: string) => boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -1095,7 +1095,7 @@ const timelineSteps = computed(() => decisionTrace.value?.candidateTimeline?.ste
|
||||
const timelineUsedFallback = computed(() => Boolean(decisionTrace.value?.candidateTimeline?.fallbackUsed))
|
||||
const traceAutoSelection = computed(() => decisionTrace.value?.autoSelection ?? null)
|
||||
const traceFallback = computed(() => decisionTrace.value?.fallback ?? null)
|
||||
const sessionLabel = computed(() => engineSessionId.value || flags.session_id || '-')
|
||||
const sessionLabel = computed(() => engineSessionId.value || flags.value.session_id || '-')
|
||||
|
||||
const VALID_TRACE_STAGES: ReadonlySet<CandidateTraceStage> = new Set(
|
||||
[
|
||||
@@ -1130,7 +1130,22 @@ const ensureTraceCalls = (calls: unknown): LLMDecisionTrace['calls'] => {
|
||||
}
|
||||
return calls
|
||||
.filter((entry): entry is Record<string, any> => isPlainObject(entry))
|
||||
.map((entry) => cloneForTrace(entry))
|
||||
.map((entry) => {
|
||||
const normalized: LLMDecisionTrace['calls'][number] = {
|
||||
stage: entry.stage === 'readback-check' ? 'readback-check' : 'decision',
|
||||
request: isPlainObject(entry.request) ? cloneForTrace(entry.request) : {},
|
||||
}
|
||||
if ('response' in entry) {
|
||||
normalized.response = cloneForTrace(entry.response)
|
||||
}
|
||||
if (typeof entry.rawResponseText === 'string') {
|
||||
normalized.rawResponseText = entry.rawResponseText
|
||||
}
|
||||
if (typeof entry.error === 'string') {
|
||||
normalized.error = entry.error
|
||||
}
|
||||
return normalized
|
||||
})
|
||||
}
|
||||
|
||||
const normalizeTraceFallback = (raw: unknown): LLMDecisionTrace['fallback'] | undefined => {
|
||||
@@ -1799,7 +1814,7 @@ const speakPrepared = async (prepared: PreparedSpeech, options: SpeechOptions =
|
||||
moduleId: 'pilot-monitoring',
|
||||
lessonId: currentState.value?.id || 'general',
|
||||
tag: options.tag || 'controller-reply',
|
||||
sessionId: engineSessionId.value || flags.session_id || undefined,
|
||||
sessionId: engineSessionId.value || flags.value.session_id || undefined,
|
||||
})
|
||||
|
||||
if (response.success && response.audio) {
|
||||
@@ -1843,7 +1858,7 @@ const speakPlainText = (text: string, options: SpeechOptions = {}) => {
|
||||
moduleId: 'pilot-monitoring',
|
||||
lessonId,
|
||||
tag: options.tag || 'announcement',
|
||||
sessionId: engineSessionId.value || flags.session_id || undefined,
|
||||
sessionId: engineSessionId.value || flags.value.session_id || undefined,
|
||||
})
|
||||
|
||||
if (response.success && response.audio) {
|
||||
|
||||
@@ -3,6 +3,21 @@ export default defineNuxtConfig({
|
||||
compatibilityDate: '2025-07-15',
|
||||
devtools: {enabled: false},
|
||||
ssr: false,
|
||||
typescript: {
|
||||
strict: false,
|
||||
typeCheck: true,
|
||||
tsConfig: {
|
||||
compilerOptions: {
|
||||
noUncheckedIndexedAccess: false,
|
||||
noImplicitOverride: false,
|
||||
lib: ['ESNext', 'dom', 'dom.iterable', 'webworker'],
|
||||
types: ['vite/client'],
|
||||
},
|
||||
vueCompilerOptions: {
|
||||
strictTemplates: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
modules: [
|
||||
'vuetify-nuxt-module',
|
||||
'@nuxtjs/tailwindcss',
|
||||
@@ -77,6 +92,17 @@ export default defineNuxtConfig({
|
||||
experimental: {
|
||||
websocket: true,
|
||||
},
|
||||
typescript: {
|
||||
strict: false,
|
||||
tsConfig: {
|
||||
compilerOptions: {
|
||||
noUncheckedIndexedAccess: false,
|
||||
noImplicitOverride: false,
|
||||
lib: ['ESNext', 'dom', 'dom.iterable', 'webworker'],
|
||||
types: ['node', 'vite/client'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
image: {
|
||||
provider: process.env.NUXT_IMAGE_PROVIDER || 'ipx',
|
||||
|
||||
34
package.json
34
package.json
@@ -16,29 +16,31 @@
|
||||
"test": "tsx --tsconfig tsconfig.tests.json --test server/utils/openai.test.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/image": "1.11.0",
|
||||
"@nuxtjs/tailwindcss": "6.14.0",
|
||||
"@pinia/nuxt": "0.11.2",
|
||||
"dotenv": "^17.2.2",
|
||||
"@nuxt/image": "^2.0.0",
|
||||
"@nuxtjs/tailwindcss": "^6.14.0",
|
||||
"@pinia/nuxt": "^0.11.3",
|
||||
"dotenv": "^17.3.1",
|
||||
"fluent-ffmpeg": "^2.1.3",
|
||||
"nodemailer": "^6.9.13",
|
||||
"nuxt": "^4.1.1",
|
||||
"nuxt-aos": "1.2.5",
|
||||
"nodemailer": "^8.0.1",
|
||||
"nuxt": "^4.3.1",
|
||||
"nuxt-aos": "^1.2.6",
|
||||
"nuxt-module-hotjar": "^1.3.4",
|
||||
"nuxt-mongoose": "1.0.6",
|
||||
"openai": "^4.66.0",
|
||||
"pinia": "^3.0.3",
|
||||
"vue": "^3.5.21",
|
||||
"vue-router": "^4.5.1",
|
||||
"vuetify": "3.9.0-beta.1",
|
||||
"vuetify-nuxt-module": "0.18.7"
|
||||
"nuxt-mongoose": "^1.0.6",
|
||||
"openai": "^6.22.0",
|
||||
"pinia": "^3.0.4",
|
||||
"vue": "^3.5.28",
|
||||
"vue-router": "^5.0.2",
|
||||
"vuetify": "^3.11.8",
|
||||
"vuetify-nuxt-module": "^0.19.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.x"
|
||||
},
|
||||
"packageManager": "yarn@4.9.4",
|
||||
"devDependencies": {
|
||||
"@types/fluent-ffmpeg": "^2",
|
||||
"tsx": "^4.15.1"
|
||||
"@types/fluent-ffmpeg": "^2.1.28",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vue-tsc": "^3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineEventHandler } from 'h3'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
return await $fetch('https://data.vatsim.net/v3/vatsim-data.json')
|
||||
const fetcher = (globalThis as any).$fetch as (url: string, options?: Record<string, unknown>) => Promise<unknown>
|
||||
return await fetcher('https://data.vatsim.net/v3/vatsim-data.json')
|
||||
})
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import {defineEventHandler, getRouterParam} from 'h3'
|
||||
import { createError, defineEventHandler, getQuery } from 'h3'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const {cid} = getQuery(event)
|
||||
if (!cid) throw createError({statusCode: 400, statusMessage: 'cid required'})
|
||||
const query = getQuery(event)
|
||||
const rawCid = Array.isArray(query.cid) ? query.cid[0] : query.cid
|
||||
if (rawCid === undefined || rawCid === null) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'cid required' })
|
||||
}
|
||||
const cid = String(rawCid).trim()
|
||||
if (!cid) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'cid required' })
|
||||
}
|
||||
|
||||
const url = `https://api.vatsim.net/v2/members/${encodeURIComponent(cid)}/flightplans`
|
||||
return await $fetch(url, {method: 'GET'})
|
||||
const fetcher = (globalThis as any).$fetch as (target: string, options?: Record<string, unknown>) => Promise<unknown>
|
||||
return await fetcher(url, { method: 'GET' })
|
||||
})
|
||||
|
||||
@@ -17,15 +17,6 @@ import {getServerRuntimeConfig} from './runtimeConfig'
|
||||
let openaiClient: OpenAI | null = null
|
||||
let cachedModel: string | null = null
|
||||
|
||||
import https from 'node:https'
|
||||
|
||||
const httpsAgent = new https.Agent({
|
||||
keepAlive: true,
|
||||
maxSockets: 50, // bei Bedarf anpassen
|
||||
maxFreeSockets: 10,
|
||||
timeout: 0 // keine Socket-Idle-Timeouts durch Node
|
||||
})
|
||||
|
||||
function ensureOpenAI(): OpenAI {
|
||||
if (!openaiClient) {
|
||||
const {openaiKey, openaiProject, openaiBaseUrl, llmModel} = getServerRuntimeConfig()
|
||||
@@ -34,7 +25,6 @@ function ensureOpenAI(): OpenAI {
|
||||
}
|
||||
const clientOptions: ConstructorParameters<typeof OpenAI>[0] = {apiKey: openaiKey,
|
||||
defaultHeaders: { 'Connection': 'keep-alive' },
|
||||
defaultHttpAgent: httpsAgent
|
||||
}
|
||||
if (openaiProject) {
|
||||
clientOptions.project = openaiProject
|
||||
@@ -1055,7 +1045,7 @@ export async function routeDecision(input: LLMDecisionInput): Promise<LLMDecisio
|
||||
JSON.stringify(optimizedInput, null, 2),
|
||||
].join('\n')
|
||||
|
||||
const callEntry = {
|
||||
const callEntry: LLMDecisionTrace['calls'][number] = {
|
||||
stage: 'decision' as const,
|
||||
request: {
|
||||
systemPrompt,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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)=>
|
||||
await new Promise<void>((res,rej)=>
|
||||
execFile("ffmpeg",["-y","-i",input,"-filter_complex",filter,"-ar","16000",output],
|
||||
(err,_,stderr)=>err?rej(new Error(stderr)):res())
|
||||
);
|
||||
|
||||
@@ -46,6 +46,7 @@ export type CandidateTraceStage =
|
||||
export interface CandidateTraceEliminationContext {
|
||||
patterns?: Array<{ id?: string; pattern?: string; flags?: string }>
|
||||
transcript?: string
|
||||
operator?: string
|
||||
condition?: {
|
||||
id?: string
|
||||
type: DecisionNodeCondition['type']
|
||||
|
||||
@@ -190,6 +190,7 @@ export default function useCommunicationsEngine() {
|
||||
stack: [],
|
||||
off_schema_count: 0,
|
||||
radio_checks_done: 0,
|
||||
session_id: '',
|
||||
})
|
||||
const currentStateId = ref<string>('')
|
||||
const communicationLog = ref<EngineLog[]>([])
|
||||
@@ -421,7 +422,7 @@ export default function useCommunicationsEngine() {
|
||||
new Set(
|
||||
entries
|
||||
.map(entry => entry?.to)
|
||||
.filter((id): id is string => typeof id === 'string' && id.length)
|
||||
.filter((id): id is string => typeof id === 'string' && id.length > 0)
|
||||
)
|
||||
)
|
||||
})
|
||||
@@ -546,7 +547,7 @@ export default function useCommunicationsEngine() {
|
||||
const mainFlowSlug = computed(() => runtimeSystem.value?.main || '')
|
||||
|
||||
const availableFlows = computed(() => {
|
||||
if (!runtimeSystem.value) return [] as Array<{ slug: string; name: string; description?: string; start: string }>
|
||||
if (!runtimeSystem.value) return [] as Array<{ slug: string; name: string; description?: string; start: string; mode: string }>
|
||||
return flowOrder.value
|
||||
.filter((slug) => Boolean(runtimeSystem.value!.flows[slug]))
|
||||
.map((slug) => {
|
||||
@@ -567,7 +568,7 @@ export default function useCommunicationsEngine() {
|
||||
if (typeof fetcher !== 'function') {
|
||||
throw new Error('Universal fetch is not available in this context')
|
||||
}
|
||||
const data = await fetcher<RuntimeDecisionSystem>('/api/decision-flows/runtime')
|
||||
const data = (await fetcher('/api/decision-flows/runtime')) as RuntimeDecisionSystem
|
||||
const activeSlug = slug && data.flows[slug] ? slug : data.main
|
||||
resetEngineFromSystem(data, { activeSlug })
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ class TremoloEffect implements EffectNode {
|
||||
const frequency = Math.max(0.0001, this.oscillator.frequency.value)
|
||||
offset = Math.random() * (1 / frequency)
|
||||
}
|
||||
this.oscillator.start(0, offset)
|
||||
this.oscillator.start(this.context.currentTime + offset)
|
||||
this.started = true
|
||||
} catch {
|
||||
// oscillator already started
|
||||
|
||||
Reference in New Issue
Block a user