mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-08 18:45:33 +08:00
fix typescript errors and update dependencies
This commit is contained in:
@@ -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())
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user