@@ -15,7 +15,7 @@ const getString = readStringField;
1515
1616function getNumber ( obj : Record < string , unknown > | undefined , key : string ) : number | undefined {
1717 const value = obj ?. [ key ] ;
18- return typeof value === "number" ? value : undefined ;
18+ return typeof value === "number" && Number . isFinite ( value ) ? value : undefined ;
1919}
2020
2121function mergeProviderConfig (
@@ -204,15 +204,19 @@ export function migrateVoiceCallLegacyConfigInput(params: {
204204 `Moved ${ configPathPrefix } .streaming.sttModel → ${ configPathPrefix } .streaming.providers.openai.model.` ,
205205 ) ;
206206 }
207- if ( typeof streaming ?. silenceDurationMs === "number" ) {
207+ if ( getNumber ( streaming , " silenceDurationMs" ) !== undefined ) {
208208 changes . push (
209209 `Moved ${ configPathPrefix } .streaming.silenceDurationMs → ${ configPathPrefix } .streaming.providers.openai.silenceDurationMs.` ,
210210 ) ;
211+ } else if ( typeof streaming ?. silenceDurationMs === "number" ) {
212+ changes . push ( `Removed invalid ${ configPathPrefix } .streaming.silenceDurationMs.` ) ;
211213 }
212- if ( typeof streaming ?. vadThreshold === "number" ) {
214+ if ( getNumber ( streaming , " vadThreshold" ) !== undefined ) {
213215 changes . push (
214216 `Moved ${ configPathPrefix } .streaming.vadThreshold → ${ configPathPrefix } .streaming.providers.openai.vadThreshold.` ,
215217 ) ;
218+ } else if ( typeof streaming ?. vadThreshold === "number" ) {
219+ changes . push ( `Removed invalid ${ configPathPrefix } .streaming.vadThreshold.` ) ;
216220 }
217221
218222 return { config, changes, issues } ;
0 commit comments