diff --git a/rtvi-client-js/src/core.ts b/rtvi-client-js/src/core.ts index 7bbb77c..b8ac9bd 100644 --- a/rtvi-client-js/src/core.ts +++ b/rtvi-client-js/src/core.ts @@ -510,16 +510,18 @@ export abstract class Client extends (EventEmitter as new () => TypedEmitter - Promise that resolves with the updated configuration */ public async updateConfig( - config: VoiceClientConfigOption[] + config: VoiceClientConfigOption[], + interrupt: boolean = false ): Promise { // Only send the partial config if the bot is ready to prevent // potential racing conditions whilst pipeline is instantiating if (this._transport.state === "ready") { return this._messageDispatcher.dispatch( - VoiceMessage.updateConfig(config), + VoiceMessage.updateConfig(config, interrupt), true ); } else { diff --git a/rtvi-client-js/src/messages.ts b/rtvi-client-js/src/messages.ts index 7b15612..0fdc9e6 100644 --- a/rtvi-client-js/src/messages.ts +++ b/rtvi-client-js/src/messages.ts @@ -93,8 +93,14 @@ export class VoiceMessage { return new VoiceMessage(VoiceMessageType.CLIENT_READY, {}); } - static updateConfig(config: VoiceClientConfigOption[]): VoiceMessage { - return new VoiceMessage(VoiceMessageType.UPDATE_CONFIG, { config }); + static updateConfig( + config: VoiceClientConfigOption[], + interrupt: boolean = false + ): VoiceMessage { + return new VoiceMessage(VoiceMessageType.UPDATE_CONFIG, { + config, + interrupt, + }); } static describeConfig(): VoiceMessage { diff --git a/rtvi-client-js/tests/config.spec.ts b/rtvi-client-js/tests/config.spec.ts index 4ddc480..2835937 100644 --- a/rtvi-client-js/tests/config.spec.ts +++ b/rtvi-client-js/tests/config.spec.ts @@ -155,8 +155,8 @@ describe("Voice Client Config Setter Helper Methods", () => { test("setServiceOptionInConfig should set or update multiple items", () => { const newConfig = voiceClient.setServiceOptionInConfig("llm", [ { - name: "test", - value: "testabc", + name: "model", + value: "newModel", } as ConfigOption, { name: "test2", @@ -168,7 +168,7 @@ describe("Voice Client Config Setter Helper Methods", () => { expect.objectContaining({ service: "llm", options: expect.arrayContaining([ - { name: "test", value: "testabc" }, + { name: "model", value: "newModel" }, { name: "test2", value: "test2" }, ]), }),