Skip to content

Commit

Permalink
fix: notify subscribers if speech or feedback status changes (#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Oct 11, 2024
1 parent 8c80f2a commit aaa4468
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/react/src/runtimes/core/BaseThreadRuntimeCore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {

const { message } = this.repository.getMessage(messageId);
adapter.submit({ message, type });

this._submittedFeedback[messageId] = { type };
this.notifySubscribers();
}

private _stopSpeaking: Unsubscribe | undefined;
Expand All @@ -132,6 +134,8 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
});

this.speech = { messageId, status: utterance.status };
this.notifySubscribers();

this._stopSpeaking = () => {
utterance.cancel();
unsub();
Expand All @@ -143,6 +147,7 @@ export abstract class BaseThreadRuntimeCore implements ThreadRuntimeCore {
public stopSpeaking() {
if (!this._stopSpeaking) throw new Error("No message is being spoken");
this._stopSpeaking();
this.notifySubscribers();
}

public export() {
Expand Down

0 comments on commit aaa4468

Please sign in to comment.