reactbridge-sdk 0.1.18 → 0.1.19

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.js CHANGED
@@ -343,7 +343,7 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
343
343
  previousContextRef.current = currentContext;
344
344
  }
345
345
  }, [currentContext]);
346
- const sendChatQuery = React.useCallback((queryOrOptions) => __awaiter(this, void 0, void 0, function* () {
346
+ const sendChatQuery = React.useCallback((queryOrOptions_1, ...args_1) => __awaiter(this, [queryOrOptions_1, ...args_1], void 0, function* (queryOrOptions, fromVoiceInput = false) {
347
347
  const isMultimodal = typeof queryOrOptions === 'object';
348
348
  const query = isMultimodal ? (queryOrOptions.query || '') : queryOrOptions;
349
349
  const image = isMultimodal ? queryOrOptions.image : undefined;
@@ -401,8 +401,10 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
401
401
  toolCall: response.toolCall,
402
402
  };
403
403
  setMessages(prev => [...prev, assistantMessage]);
404
- // Trigger TTS and callback
405
- ttsProvider.speak(response.message);
404
+ // Trigger TTS and callback only if input came from voice
405
+ if (fromVoiceInput) {
406
+ ttsProvider.speak(response.message);
407
+ }
406
408
  if (onAgentResponse) {
407
409
  onAgentResponse(response.message);
408
410
  }
@@ -421,8 +423,10 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
421
423
  timestamp: new Date(),
422
424
  };
423
425
  setMessages(prev => [...prev, finalMessage]);
424
- // Trigger TTS for final response
425
- ttsProvider.speak(resultResponse.message);
426
+ // Trigger TTS for final response only if input came from voice
427
+ if (fromVoiceInput) {
428
+ ttsProvider.speak(resultResponse.message);
429
+ }
426
430
  if (onAgentResponse) {
427
431
  onAgentResponse(resultResponse.message);
428
432
  }
@@ -477,7 +481,7 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
477
481
  if (onTranscript) {
478
482
  onTranscript(text);
479
483
  }
480
- sendChatQuery(text);
484
+ sendChatQuery(text, true); // Pass true to indicate voice input
481
485
  setIsListening(false);
482
486
  if (onSpeechEnd) {
483
487
  onSpeechEnd();
@@ -779,6 +783,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
779
783
  } }),
780
784
  React.createElement("button", { type: "button", onClick: () => setIsUploadMenuOpen(!isUploadMenuOpen), disabled: isLoading, title: "Attach file", style: {
781
785
  padding: theme.spacing.sm,
786
+ paddingRight: 0,
782
787
  backgroundColor: theme.colors.secondary,
783
788
  color: "#ffffff",
784
789
  border: "none",
@@ -833,6 +838,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
833
838
  "Upload Document"))),
834
839
  React.createElement("button", { type: "button", onClick: isListening ? stopVoiceInput : startVoiceInput, disabled: isLoading, title: isListening ? "Stop recording" : "Start voice input", style: {
835
840
  padding: theme.spacing.sm,
841
+ paddingLeft: 0,
836
842
  backgroundColor: isListening
837
843
  ? theme.colors.error
838
844
  : theme.colors.secondary,