@decartai/sdk 0.0.51 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98,6 +98,14 @@ var WebRTCConnection = class {
|
|
|
98
98
|
durationMs: performance.now() - promptStart,
|
|
99
99
|
success: true
|
|
100
100
|
});
|
|
101
|
+
} else if (localStream) {
|
|
102
|
+
const nullStart = performance.now();
|
|
103
|
+
await Promise.race([this.setImageBase64(null, { prompt: null }), connectAbort]);
|
|
104
|
+
this.emitDiagnostic("phaseTiming", {
|
|
105
|
+
phase: "initial-prompt",
|
|
106
|
+
durationMs: performance.now() - nullStart,
|
|
107
|
+
success: true
|
|
108
|
+
});
|
|
101
109
|
}
|
|
102
110
|
const handshakeStart = performance.now();
|
|
103
111
|
await this.setupNewPeerConnection();
|
|
@@ -218,11 +226,6 @@ var WebRTCConnection = class {
|
|
|
218
226
|
});
|
|
219
227
|
}
|
|
220
228
|
break;
|
|
221
|
-
case "ice-restart": {
|
|
222
|
-
const turnConfig = msg.turn_config;
|
|
223
|
-
if (turnConfig) await this.setupNewPeerConnection(turnConfig);
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
229
|
}
|
|
227
230
|
} catch (error) {
|
|
228
231
|
this.logger.error("Signaling handler error", { error: String(error) });
|
|
@@ -299,20 +302,14 @@ var WebRTCConnection = class {
|
|
|
299
302
|
this.callbacks.onStateChange?.(state);
|
|
300
303
|
}
|
|
301
304
|
}
|
|
302
|
-
async setupNewPeerConnection(
|
|
305
|
+
async setupNewPeerConnection() {
|
|
303
306
|
if (this.pc) {
|
|
304
307
|
this.pc.getSenders().forEach((sender) => {
|
|
305
308
|
if (sender.track && this.pc) this.pc.removeTrack(sender);
|
|
306
309
|
});
|
|
307
310
|
this.pc.close();
|
|
308
311
|
}
|
|
309
|
-
|
|
310
|
-
if (turnConfig) iceServers.push({
|
|
311
|
-
urls: turnConfig.server_url,
|
|
312
|
-
credential: turnConfig.credential,
|
|
313
|
-
username: turnConfig.username
|
|
314
|
-
});
|
|
315
|
-
this.pc = new RTCPeerConnection({ iceServers });
|
|
312
|
+
this.pc = new RTCPeerConnection({ iceServers: ICE_SERVERS });
|
|
316
313
|
this.setState("connecting");
|
|
317
314
|
if (this.localStream) {
|
|
318
315
|
if (this.callbacks.modelName === "live_avatar") this.pc.addTransceiver("video", { direction: "recvonly" });
|