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/hooks/useReactBridge.d.ts.map +1 -1
- package/dist/index.esm.js +16 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactBridge.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactBridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,qBAAqB,EACrB,oBAAoB,EAIrB,MAAM,UAAU,CAAC;AAElB,wBAAgB,cAAc,CAAC,EAC7B,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,aAAa,EACb,WAAW,EACX,YAAY,EACZ,eAAe,GAChB,EAAE,qBAAqB,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useReactBridge.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactBridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,qBAAqB,EACrB,oBAAoB,EAIrB,MAAM,UAAU,CAAC;AAElB,wBAAgB,cAAc,CAAC,EAC7B,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,aAAa,EACb,WAAW,EACX,YAAY,EACZ,eAAe,GAChB,EAAE,qBAAqB,GAAG,oBAAoB,CAkO9C"}
|
package/dist/index.esm.js
CHANGED
|
@@ -341,7 +341,7 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
|
|
|
341
341
|
previousContextRef.current = currentContext;
|
|
342
342
|
}
|
|
343
343
|
}, [currentContext]);
|
|
344
|
-
const sendChatQuery = useCallback((
|
|
344
|
+
const sendChatQuery = useCallback((queryOrOptions_1, ...args_1) => __awaiter(this, [queryOrOptions_1, ...args_1], void 0, function* (queryOrOptions, fromVoiceInput = false) {
|
|
345
345
|
const isMultimodal = typeof queryOrOptions === 'object';
|
|
346
346
|
const query = isMultimodal ? (queryOrOptions.query || '') : queryOrOptions;
|
|
347
347
|
const image = isMultimodal ? queryOrOptions.image : undefined;
|
|
@@ -399,8 +399,10 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
|
|
|
399
399
|
toolCall: response.toolCall,
|
|
400
400
|
};
|
|
401
401
|
setMessages(prev => [...prev, assistantMessage]);
|
|
402
|
-
// Trigger TTS and callback
|
|
403
|
-
|
|
402
|
+
// Trigger TTS and callback only if input came from voice
|
|
403
|
+
if (fromVoiceInput) {
|
|
404
|
+
ttsProvider.speak(response.message);
|
|
405
|
+
}
|
|
404
406
|
if (onAgentResponse) {
|
|
405
407
|
onAgentResponse(response.message);
|
|
406
408
|
}
|
|
@@ -419,8 +421,10 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
|
|
|
419
421
|
timestamp: new Date(),
|
|
420
422
|
};
|
|
421
423
|
setMessages(prev => [...prev, finalMessage]);
|
|
422
|
-
// Trigger TTS for final response
|
|
423
|
-
|
|
424
|
+
// Trigger TTS for final response only if input came from voice
|
|
425
|
+
if (fromVoiceInput) {
|
|
426
|
+
ttsProvider.speak(resultResponse.message);
|
|
427
|
+
}
|
|
424
428
|
if (onAgentResponse) {
|
|
425
429
|
onAgentResponse(resultResponse.message);
|
|
426
430
|
}
|
|
@@ -475,7 +479,7 @@ function useReactBridge({ onIntentDetected, currentContext, onError, onSpeechSta
|
|
|
475
479
|
if (onTranscript) {
|
|
476
480
|
onTranscript(text);
|
|
477
481
|
}
|
|
478
|
-
sendChatQuery(text);
|
|
482
|
+
sendChatQuery(text, true); // Pass true to indicate voice input
|
|
479
483
|
setIsListening(false);
|
|
480
484
|
if (onSpeechEnd) {
|
|
481
485
|
onSpeechEnd();
|
|
@@ -777,8 +781,8 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
|
|
|
777
781
|
} }),
|
|
778
782
|
React.createElement("button", { type: "button", onClick: () => setIsUploadMenuOpen(!isUploadMenuOpen), disabled: isLoading, title: "Attach file", style: {
|
|
779
783
|
padding: theme.spacing.sm,
|
|
780
|
-
|
|
781
|
-
color:
|
|
784
|
+
paddingRight: 0,
|
|
785
|
+
color: theme.colors.border,
|
|
782
786
|
border: "none",
|
|
783
787
|
borderRadius: theme.borderRadius,
|
|
784
788
|
cursor: isLoading ? "not-allowed" : "pointer",
|
|
@@ -831,10 +835,8 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
|
|
|
831
835
|
"Upload Document"))),
|
|
832
836
|
React.createElement("button", { type: "button", onClick: isListening ? stopVoiceInput : startVoiceInput, disabled: isLoading, title: isListening ? "Stop recording" : "Start voice input", style: {
|
|
833
837
|
padding: theme.spacing.sm,
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
: theme.colors.secondary,
|
|
837
|
-
color: "#ffffff",
|
|
838
|
+
paddingLeft: 0,
|
|
839
|
+
color: isListening ? theme.colors.primary : theme.colors.border,
|
|
838
840
|
border: "none",
|
|
839
841
|
borderRadius: theme.borderRadius,
|
|
840
842
|
cursor: isLoading ? "not-allowed" : "pointer",
|
|
@@ -977,6 +979,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
|
|
|
977
979
|
} }),
|
|
978
980
|
React.createElement("button", { type: "button", onClick: () => setIsUploadMenuOpen(!isUploadMenuOpen), disabled: isLoading, title: "Attach file", style: {
|
|
979
981
|
padding: theme.spacing.sm,
|
|
982
|
+
paddingRight: 0,
|
|
980
983
|
color: theme.colors.border,
|
|
981
984
|
border: "none",
|
|
982
985
|
borderRadius: theme.borderRadius,
|
|
@@ -1036,6 +1039,7 @@ toggleButtonClass = defaultToggleButtonClass, toggleButtonTitle = "Open chat ass
|
|
|
1036
1039
|
"Upload Document"))),
|
|
1037
1040
|
React.createElement("button", { type: "button", onClick: isListening ? stopVoiceInput : startVoiceInput, disabled: isLoading, title: isListening ? "Stop recording" : "Start voice input", style: {
|
|
1038
1041
|
padding: theme.spacing.sm,
|
|
1042
|
+
paddingLeft: 0,
|
|
1039
1043
|
color: isListening ? theme.colors.primary : theme.colors.border,
|
|
1040
1044
|
border: "none",
|
|
1041
1045
|
borderRadius: theme.borderRadius,
|