reactbridge-sdk 0.1.18 → 0.1.20

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,8 +783,8 @@ 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,
782
- backgroundColor: theme.colors.secondary,
783
- color: "#ffffff",
786
+ paddingRight: 0,
787
+ color: theme.colors.border,
784
788
  border: "none",
785
789
  borderRadius: theme.borderRadius,
786
790
  cursor: isLoading ? "not-allowed" : "pointer",
@@ -833,10 +837,8 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
833
837
  "Upload Document"))),
834
838
  React.createElement("button", { type: "button", onClick: isListening ? stopVoiceInput : startVoiceInput, disabled: isLoading, title: isListening ? "Stop recording" : "Start voice input", style: {
835
839
  padding: theme.spacing.sm,
836
- backgroundColor: isListening
837
- ? theme.colors.error
838
- : theme.colors.secondary,
839
- color: "#ffffff",
840
+ paddingLeft: 0,
841
+ color: isListening ? theme.colors.primary : theme.colors.border,
840
842
  border: "none",
841
843
  borderRadius: theme.borderRadius,
842
844
  cursor: isLoading ? "not-allowed" : "pointer",
@@ -979,6 +981,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
979
981
  } }),
980
982
  React.createElement("button", { type: "button", onClick: () => setIsUploadMenuOpen(!isUploadMenuOpen), disabled: isLoading, title: "Attach file", style: {
981
983
  padding: theme.spacing.sm,
984
+ paddingRight: 0,
982
985
  color: theme.colors.border,
983
986
  border: "none",
984
987
  borderRadius: theme.borderRadius,
@@ -1038,6 +1041,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
1038
1041
  "Upload Document"))),
1039
1042
  React.createElement("button", { type: "button", onClick: isListening ? stopVoiceInput : startVoiceInput, disabled: isLoading, title: isListening ? "Stop recording" : "Start voice input", style: {
1040
1043
  padding: theme.spacing.sm,
1044
+ paddingLeft: 0,
1041
1045
  color: isListening ? theme.colors.primary : theme.colors.border,
1042
1046
  border: "none",
1043
1047
  borderRadius: theme.borderRadius,