@charivo/realtime 0.8.1 → 0.8.2
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.
- package/dist/{chunk-VSKMCGWD.mjs → chunk-FZ2LAUCO.mjs} +9 -9
- package/dist/chunk-FZ2LAUCO.mjs.map +1 -0
- package/dist/openai-agents/index.d.mts +2 -2
- package/dist/openai-agents/index.d.ts +2 -2
- package/dist/openai-agents/index.js +7 -7
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/openai-agents/index.mjs +1 -1
- package/dist/remote/index.js +7 -7
- package/dist/remote/index.js.map +1 -1
- package/dist/remote/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-VSKMCGWD.mjs.map +0 -1
package/dist/remote/index.js
CHANGED
|
@@ -400,7 +400,7 @@ var OpenAIRealtimeAgentsClient = class {
|
|
|
400
400
|
isCleaningUp = false;
|
|
401
401
|
assistant = { text: "", started: false };
|
|
402
402
|
assistantCompletionMetadata = {};
|
|
403
|
-
|
|
403
|
+
latestAssistantText = "";
|
|
404
404
|
currentSessionConfig;
|
|
405
405
|
teardownTransportLifecycle;
|
|
406
406
|
iceDisconnectDebouncer = createIceDisconnectDebouncer(() => {
|
|
@@ -557,7 +557,7 @@ var OpenAIRealtimeAgentsClient = class {
|
|
|
557
557
|
this.emitEvent({ type: "audio.output.ended" });
|
|
558
558
|
});
|
|
559
559
|
session.on("history_updated", (history) => {
|
|
560
|
-
this.
|
|
560
|
+
this.latestAssistantText = this.extractLatestAssistantText(history);
|
|
561
561
|
});
|
|
562
562
|
session.on("error", ({ error }) => {
|
|
563
563
|
this.emitEvent({
|
|
@@ -622,7 +622,7 @@ var OpenAIRealtimeAgentsClient = class {
|
|
|
622
622
|
if (!this.assistant.text && !output.trim()) {
|
|
623
623
|
return;
|
|
624
624
|
}
|
|
625
|
-
const finalText = this.
|
|
625
|
+
const finalText = this.latestAssistantText || output || this.assistant.text;
|
|
626
626
|
this.ensureAssistantStarted();
|
|
627
627
|
if (finalText && finalText.startsWith(this.assistant.text) && finalText !== this.assistant.text) {
|
|
628
628
|
const delta = finalText.slice(this.assistant.text.length);
|
|
@@ -640,9 +640,9 @@ var OpenAIRealtimeAgentsClient = class {
|
|
|
640
640
|
});
|
|
641
641
|
this.resetAssistantTracking();
|
|
642
642
|
}
|
|
643
|
-
|
|
644
|
-
for (let index =
|
|
645
|
-
const item =
|
|
643
|
+
extractLatestAssistantText(history) {
|
|
644
|
+
for (let index = history.length - 1; index >= 0; index -= 1) {
|
|
645
|
+
const item = history[index];
|
|
646
646
|
if (item.type === "message" && item.role === "assistant" && Array.isArray(item.content)) {
|
|
647
647
|
const text = item.content.map((content) => {
|
|
648
648
|
if (content.type === "output_audio") {
|
|
@@ -844,7 +844,7 @@ var OpenAIRealtimeAgentsClient = class {
|
|
|
844
844
|
}
|
|
845
845
|
this.peerConnection = null;
|
|
846
846
|
this.audioSender = null;
|
|
847
|
-
this.
|
|
847
|
+
this.latestAssistantText = "";
|
|
848
848
|
this.connectionLossNotified = false;
|
|
849
849
|
this.isCleaningUp = false;
|
|
850
850
|
this.resetAssistantTracking();
|