@rapidaai/react 1.1.47 → 1.1.48

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/index.mjs CHANGED
@@ -111,7 +111,7 @@ import {
111
111
  toTextContent,
112
112
  useObservableState,
113
113
  useSelectInputDeviceAgent
114
- } from "./chunk-5UBYT2TF.mjs";
114
+ } from "./chunk-K6VHOUSP.mjs";
115
115
  import {
116
116
  MultibandAudioVisualizerComponent
117
117
  } from "./chunk-CVATR327.mjs";
@@ -32398,12 +32398,12 @@ function useInputModeToggleAgent(agent) {
32398
32398
  () => ({
32399
32399
  handleTextToggle: async () => {
32400
32400
  if (!agent) throw new Error("VoiceAgent instance not available");
32401
- if (agent.inputChannel === "text" /* Text */) return;
32401
+ if (agent.agentConfiguration.inputOptions.channel === "text" /* Text */) return;
32402
32402
  await agent.setInputChannel("text" /* Text */);
32403
32403
  },
32404
32404
  handleVoiceToggle: async () => {
32405
32405
  if (!agent) throw new Error("VoiceAgent instance not available");
32406
- if (agent.inputChannel === "audio" /* Audio */) {
32406
+ if (agent.agentConfiguration.inputOptions.channel === "audio" /* Audio */) {
32407
32407
  console.warn("Already in voice mode, ignoring toggle...");
32408
32408
  return;
32409
32409
  }
@@ -32417,7 +32417,7 @@ function useInputModeToggleAgent(agent) {
32417
32417
  [agent]
32418
32418
  );
32419
32419
  const { channel } = useObservableState(observable, {
32420
- channel: agent?.inputChannel ?? "text" /* Text */
32420
+ channel: agent.agentConfiguration.inputOptions.channel ?? "text" /* Text */
32421
32421
  });
32422
32422
  React4.useEffect(() => {
32423
32423
  if (observable && agent) {
@@ -32557,6 +32557,21 @@ var InputOptions = class {
32557
32557
  get defaultChannel() {
32558
32558
  return this.channel;
32559
32559
  }
32560
+ /**
32561
+ * stream config
32562
+ * define audio codacs and sample rate. these will be directly translated to stt
32563
+ */
32564
+ get defaultInputStreamOption() {
32565
+ const inputStreamConfig = new import_common_pb.StreamConfig();
32566
+ if (this.channel == "audio" /* Audio */) {
32567
+ const inputAudioConfig = new import_common_pb.AudioConfig();
32568
+ inputAudioConfig.setChannels(1);
32569
+ inputAudioConfig.setAudioformat(import_common_pb.AudioConfig.AudioFormat.LINEAR16);
32570
+ inputAudioConfig.setSamplerate(this.recorderOptions.sampleRate);
32571
+ inputStreamConfig.setAudio(inputAudioConfig);
32572
+ }
32573
+ return inputStreamConfig;
32574
+ }
32560
32575
  /**
32561
32576
  *
32562
32577
  * @param channels
@@ -32568,13 +32583,6 @@ var InputOptions = class {
32568
32583
  if (channel) this.channel = channel;
32569
32584
  if (deviceId) this.recorderOptions.device = deviceId;
32570
32585
  }
32571
- /**
32572
- *
32573
- * @param device
32574
- */
32575
- changeDevice(device) {
32576
- this.recorderOption.device = device;
32577
- }
32578
32586
  };
32579
32587
  var OutputOptions = class {
32580
32588
  /**
@@ -32595,9 +32603,6 @@ var OutputOptions = class {
32595
32603
  * channel for providing output
32596
32604
  */
32597
32605
  channel = "audio" /* Audio */;
32598
- get defaultChannel() {
32599
- return this.channel;
32600
- }
32601
32606
  /**
32602
32607
  *
32603
32608
  * @param channels
@@ -32610,18 +32615,19 @@ var OutputOptions = class {
32610
32615
  if (deviceId) this.playerOption.device = deviceId;
32611
32616
  }
32612
32617
  /**
32613
- *
32614
- * @param channel
32618
+ * stream config
32619
+ * define audio codacs and sample rate. these will be directly translated to tts
32615
32620
  */
32616
- changeChannel(channel) {
32617
- this.channel = channel;
32618
- }
32619
- /**
32620
- *
32621
- * @param device
32622
- */
32623
- changeDevice(device) {
32624
- this.playerOption.device = device;
32621
+ get defaultOutputStreamOption() {
32622
+ const inputStreamConfig = new import_common_pb.StreamConfig();
32623
+ if (this.channel == "audio" /* Audio */) {
32624
+ const inputAudioConfig = new import_common_pb.AudioConfig();
32625
+ inputAudioConfig.setChannels(1);
32626
+ inputAudioConfig.setAudioformat(import_common_pb.AudioConfig.AudioFormat.LINEAR16);
32627
+ inputAudioConfig.setSamplerate(this.playerOption.sampleRate);
32628
+ inputStreamConfig.setAudio(inputAudioConfig);
32629
+ }
32630
+ return inputStreamConfig;
32625
32631
  }
32626
32632
  };
32627
32633
  var AgentConfig = class {
@@ -32663,10 +32669,7 @@ var AgentConfig = class {
32663
32669
  constructor(id, inputOptions = new InputOptions([
32664
32670
  "audio" /* Audio */,
32665
32671
  "text" /* Text */
32666
- ]), outputOptions = new OutputOptions([
32667
- "audio" /* Audio */,
32668
- "text" /* Text */
32669
- ]), version, argument, options, metadata) {
32672
+ ], "text" /* Text */), outputOptions = new OutputOptions(["audio" /* Audio */, "text" /* Text */], "text" /* Text */), version, argument, options, metadata) {
32670
32673
  this.id = id;
32671
32674
  this.version = version;
32672
32675
  this.arguments = argument;