@uipath/apollo-react 4.13.1-pr581.30f7035 → 4.14.0
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/canvas/components/AddNodePanel/AddNodeManager.cjs +7 -26
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +7 -26
- package/dist/canvas/components/AddNodePanel/AddNodePanel.types.d.ts +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodePanel.types.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +41 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +3 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +7 -0
- package/dist/canvas/components/AddNodePanel/index.cjs +6 -2
- package/dist/canvas/components/AddNodePanel/index.d.ts +1 -0
- package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.js +2 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +0 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +3 -8
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +1 -2
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -5
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts +0 -2
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +34 -115
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +2 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +36 -117
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +1 -48
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +1 -36
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.cjs +2 -3
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -11
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +3 -4
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +15 -23
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +0 -2
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +16 -24
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +8 -11
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +8 -11
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +25 -34
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +1 -2
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +26 -35
- package/dist/canvas/components/index.cjs +20 -27
- package/dist/canvas/components/index.d.ts +0 -1
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +0 -1
- package/dist/canvas/constants.cjs +0 -8
- package/dist/canvas/constants.d.ts +0 -2
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -3
- package/dist/canvas/core/CategoryTreeAdapter.cjs +1 -1
- package/dist/canvas/core/CategoryTreeAdapter.js +1 -1
- package/dist/canvas/core/NodeTypeRegistry.cjs +24 -40
- package/dist/canvas/core/NodeTypeRegistry.d.ts +4 -8
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +24 -40
- package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -4
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +3 -4
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +3 -10
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +3 -10
- package/dist/canvas/hooks/usePreviewNode.cjs +2 -4
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +2 -4
- package/dist/canvas/schema/node-definition/handle.cjs +2 -10
- package/dist/canvas/schema/node-definition/handle.d.ts +0 -9
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +1 -6
- package/dist/canvas/schema/node-definition/index.cjs +1 -4
- package/dist/canvas/schema/node-definition/index.d.ts +3 -3
- package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/index.js +2 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +0 -4
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +0 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +0 -4
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/{createPreviewGraph.cjs → createPreviewNode.cjs} +41 -115
- package/dist/canvas/utils/createPreviewNode.d.ts +17 -0
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -0
- package/dist/canvas/utils/{createPreviewGraph.js → createPreviewNode.js} +36 -95
- package/dist/canvas/utils/index.cjs +10 -10
- package/dist/canvas/utils/index.d.ts +2 -2
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +2 -2
- package/dist/material/components/ap-chat/components/common/action-button.cjs +7 -33
- package/dist/material/components/ap-chat/components/common/action-button.d.ts +3 -9
- package/dist/material/components/ap-chat/components/common/action-button.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/common/action-button.js +7 -33
- package/dist/material/components/ap-chat/components/input/always-on-voice-button.cjs +183 -0
- package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts +10 -0
- package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts.map +1 -0
- package/dist/material/components/ap-chat/components/input/always-on-voice-button.js +136 -0
- package/dist/material/components/ap-chat/components/input/chat-input-actions.cjs +46 -4
- package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts +4 -1
- package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/chat-input-actions.js +46 -4
- package/dist/material/components/ap-chat/components/input/chat-input.cjs +19 -5
- package/dist/material/components/ap-chat/components/input/chat-input.d.ts.map +1 -1
- package/dist/material/components/ap-chat/components/input/chat-input.js +19 -5
- package/dist/material/components/ap-chat/locales/en.cjs +1 -1
- package/dist/material/components/ap-chat/locales/en.d.ts.map +1 -1
- package/dist/material/components/ap-chat/locales/en.js +1 -1
- package/dist/material/components/ap-chat/service/ChatModel.cjs +2 -0
- package/dist/material/components/ap-chat/service/ChatModel.d.ts +4 -1
- package/dist/material/components/ap-chat/service/ChatModel.d.ts.map +1 -1
- package/dist/material/components/ap-chat/service/ChatModel.js +2 -0
- package/dist/material/components/ap-chat/service/ChatService.cjs +14 -0
- package/dist/material/components/ap-chat/service/ChatService.d.ts +4 -0
- package/dist/material/components/ap-chat/service/ChatService.d.ts.map +1 -1
- package/dist/material/components/ap-chat/service/ChatService.js +14 -0
- package/package.json +3 -3
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -112
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +0 -6
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +0 -78
- package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -435
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -77
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -12
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -13
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +0 -5
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +0 -137
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -26
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -94
- package/dist/canvas/components/LoopNode/LoopNode.js +0 -401
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -11
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +0 -61
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +0 -9
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +0 -27
- package/dist/canvas/components/LoopNode/index.cjs +0 -72
- package/dist/canvas/components/LoopNode/index.d.ts +0 -4
- package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/index.js +0 -3
- package/dist/canvas/utils/createPreviewGraph.d.ts +0 -43
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
- package/dist/material/components/ap-chat/components/audio/chat-audio.cjs +0 -334
- package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts +0 -10
- package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts.map +0 -1
- package/dist/material/components/ap-chat/components/audio/chat-audio.js +0 -290
|
@@ -26,13 +26,9 @@ const StyledButtonContainer = styled('div')(()=>({
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}));
|
|
29
|
-
const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, title, tabIndex, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId
|
|
29
|
+
const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, ariaPressed, title, tabIndex, onClick, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId }, ref)=>{
|
|
30
30
|
const [iconColor, setIconColor] = react.useState('var(--color-icon-default)');
|
|
31
31
|
const { chatMode } = useChatState();
|
|
32
|
-
const [isPressed, setIsPressed] = react.useState(false);
|
|
33
|
-
const onClick = 'onClick' in props ? props.onClick : ()=>{};
|
|
34
|
-
const onPress = 'onPress' in props ? props.onPress : ()=>{};
|
|
35
|
-
const onRelease = 'onRelease' in props ? props.onRelease : ()=>{};
|
|
36
32
|
const showTooltip = tooltip && chatMode !== AutopilotChatMode.Closed && !disabled;
|
|
37
33
|
const button = text ? /*#__PURE__*/ jsx(StyledButtonContainer, {
|
|
38
34
|
children: /*#__PURE__*/ jsx(Button, {
|
|
@@ -43,10 +39,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
|
|
|
43
39
|
},
|
|
44
40
|
onMouseLeave: (event)=>{
|
|
45
41
|
onMouseLeave?.(event);
|
|
46
|
-
if (isPressed) {
|
|
47
|
-
setIsPressed(false);
|
|
48
|
-
onRelease(event);
|
|
49
|
-
}
|
|
50
42
|
if (!preventHover) setIconColor('var(--color-icon-default)');
|
|
51
43
|
},
|
|
52
44
|
startIcon: /*#__PURE__*/ jsx(ApIcon, {
|
|
@@ -57,6 +49,7 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
|
|
|
57
49
|
}),
|
|
58
50
|
"aria-label": ariaLabel,
|
|
59
51
|
"aria-describedby": ariaDescribedby,
|
|
52
|
+
"aria-pressed": ariaPressed,
|
|
60
53
|
title: showTooltip ? void 0 : title,
|
|
61
54
|
variant: "text",
|
|
62
55
|
size: "small",
|
|
@@ -64,16 +57,8 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
|
|
|
64
57
|
onClick: onClick,
|
|
65
58
|
onFocus: onFocus,
|
|
66
59
|
onBlur: onBlur,
|
|
67
|
-
onMouseDown:
|
|
68
|
-
|
|
69
|
-
setIsPressed(true);
|
|
70
|
-
onPress(event);
|
|
71
|
-
},
|
|
72
|
-
onMouseUp: (event)=>{
|
|
73
|
-
onMouseUp?.(event);
|
|
74
|
-
setIsPressed(false);
|
|
75
|
-
onRelease(event);
|
|
76
|
-
},
|
|
60
|
+
onMouseDown: onMouseDown,
|
|
61
|
+
onMouseUp: onMouseUp,
|
|
77
62
|
tabIndex: tabIndex,
|
|
78
63
|
onKeyDown: onKeyDown,
|
|
79
64
|
"data-testid": dataTestId,
|
|
@@ -86,20 +71,13 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
|
|
|
86
71
|
onClick: onClick,
|
|
87
72
|
onFocus: onFocus,
|
|
88
73
|
onBlur: onBlur,
|
|
89
|
-
onMouseDown:
|
|
90
|
-
|
|
91
|
-
setIsPressed(true);
|
|
92
|
-
onPress(event);
|
|
93
|
-
},
|
|
94
|
-
onMouseUp: (event)=>{
|
|
95
|
-
onMouseUp?.(event);
|
|
96
|
-
setIsPressed(false);
|
|
97
|
-
onRelease(event);
|
|
98
|
-
},
|
|
74
|
+
onMouseDown: onMouseDown,
|
|
75
|
+
onMouseUp: onMouseUp,
|
|
99
76
|
tabIndex: tabIndex,
|
|
100
77
|
onKeyDown: onKeyDown,
|
|
101
78
|
"aria-label": ariaLabel,
|
|
102
79
|
"aria-describedby": ariaDescribedby,
|
|
80
|
+
"aria-pressed": ariaPressed,
|
|
103
81
|
title: showTooltip ? void 0 : title,
|
|
104
82
|
onMouseEnter: (event)=>{
|
|
105
83
|
onMouseEnter?.(event);
|
|
@@ -107,10 +85,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
|
|
|
107
85
|
},
|
|
108
86
|
onMouseLeave: (event)=>{
|
|
109
87
|
onMouseLeave?.(event);
|
|
110
|
-
if (isPressed) {
|
|
111
|
-
setIsPressed(false);
|
|
112
|
-
onRelease(event);
|
|
113
|
-
}
|
|
114
88
|
if (!preventHover) setIconColor('var(--color-icon-default)');
|
|
115
89
|
},
|
|
116
90
|
"data-testid": dataTestId,
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
AlwaysOnVoiceButton: ()=>AlwaysOnVoiceButton,
|
|
37
|
+
VoiceButtonContainer: ()=>VoiceButtonContainer
|
|
38
|
+
});
|
|
39
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
|
+
const react_namespaceObject = require("@lingui/react");
|
|
41
|
+
const material_namespaceObject = require("@mui/material");
|
|
42
|
+
const apollo_core_namespaceObject = require("@uipath/apollo-core");
|
|
43
|
+
var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
|
|
44
|
+
const external_react_namespaceObject = require("react");
|
|
45
|
+
const chat_service_provider_cjs_namespaceObject = require("../../providers/chat-service.provider.cjs");
|
|
46
|
+
const index_cjs_namespaceObject = require("../../service/index.cjs");
|
|
47
|
+
const chat_audio_input_cjs_namespaceObject = require("../audio/chat-audio-input.cjs");
|
|
48
|
+
const chat_audio_output_cjs_namespaceObject = require("../audio/chat-audio-output.cjs");
|
|
49
|
+
const action_button_cjs_namespaceObject = require("../common/action-button.cjs");
|
|
50
|
+
const VoiceButtonContainer = (0, material_namespaceObject.styled)('div', {
|
|
51
|
+
shouldForwardProp: (prop)=>'active' !== prop
|
|
52
|
+
})(({ active })=>({
|
|
53
|
+
'& .MuiIconButton-root': {
|
|
54
|
+
borderRadius: apollo_core_default().Border.BorderRadiusM,
|
|
55
|
+
...active && {
|
|
56
|
+
backgroundColor: "var(--color-foreground) !important",
|
|
57
|
+
'&:hover, &:active, &:focus': {
|
|
58
|
+
backgroundColor: "var(--color-foreground-de-emp) !important"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
const AlwaysOnVoiceButton = ({ disabled = false, onActiveChange })=>{
|
|
64
|
+
const { _ } = (0, react_namespaceObject.useLingui)();
|
|
65
|
+
const [isActive, setIsActive] = (0, external_react_namespaceObject.useState)(false);
|
|
66
|
+
const chatService = (0, chat_service_provider_cjs_namespaceObject.useChatService)();
|
|
67
|
+
const isActiveRef = (0, external_react_namespaceObject.useRef)(false);
|
|
68
|
+
const onActiveChangeRef = (0, external_react_namespaceObject.useRef)(onActiveChange);
|
|
69
|
+
onActiveChangeRef.current = onActiveChange;
|
|
70
|
+
const { queueOutputAudio, clearOutputAudioQueue } = (0, chat_audio_output_cjs_namespaceObject.useAudioOutput)();
|
|
71
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
72
|
+
if (!chatService) return;
|
|
73
|
+
return chatService.on(index_cjs_namespaceObject.AutopilotChatEvent.OutputStream, (event)=>{
|
|
74
|
+
if (!isActiveRef.current) return;
|
|
75
|
+
if (event.mediaChunks) {
|
|
76
|
+
for (const chunk of event.mediaChunks)if (chunk.mimeType.startsWith('audio/pcm;')) queueOutputAudio(chunk.mimeType, chunk.data, chunk.sequenceNumber);
|
|
77
|
+
}
|
|
78
|
+
if (event.interrupted) clearOutputAudioQueue();
|
|
79
|
+
});
|
|
80
|
+
}, [
|
|
81
|
+
chatService,
|
|
82
|
+
queueOutputAudio,
|
|
83
|
+
clearOutputAudioQueue
|
|
84
|
+
]);
|
|
85
|
+
const handleAudioInputStart = (0, external_react_namespaceObject.useCallback)((automaticActivityDetectionEnabled)=>{
|
|
86
|
+
if (!chatService) return;
|
|
87
|
+
isActiveRef.current = true;
|
|
88
|
+
setIsActive(true);
|
|
89
|
+
onActiveChangeRef.current?.(true);
|
|
90
|
+
chatService.sendInputStreamEvent({
|
|
91
|
+
activityStart: {
|
|
92
|
+
automaticActivityDetectionEnabled
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}, [
|
|
96
|
+
chatService
|
|
97
|
+
]);
|
|
98
|
+
const handleAudioInputEnd = (0, external_react_namespaceObject.useCallback)((sequenceNumber)=>{
|
|
99
|
+
if (!chatService) return;
|
|
100
|
+
isActiveRef.current = false;
|
|
101
|
+
setIsActive(false);
|
|
102
|
+
onActiveChangeRef.current?.(false);
|
|
103
|
+
clearOutputAudioQueue();
|
|
104
|
+
chatService.sendInputStreamEvent({
|
|
105
|
+
activityEnd: {
|
|
106
|
+
sequenceNumber
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}, [
|
|
110
|
+
chatService,
|
|
111
|
+
clearOutputAudioQueue
|
|
112
|
+
]);
|
|
113
|
+
const handleAudioInputData = (0, external_react_namespaceObject.useCallback)((mimeType, data, sequenceNumber)=>{
|
|
114
|
+
if (!chatService) return;
|
|
115
|
+
chatService.sendInputStreamEvent({
|
|
116
|
+
mediaChunks: [
|
|
117
|
+
{
|
|
118
|
+
mimeType,
|
|
119
|
+
data,
|
|
120
|
+
sequenceNumber
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}, [
|
|
125
|
+
chatService
|
|
126
|
+
]);
|
|
127
|
+
const { startAudioInput, stopAudioInput } = (0, chat_audio_input_cjs_namespaceObject.useAudioInput)({
|
|
128
|
+
handleAudioInputData,
|
|
129
|
+
handleAudioInputStart,
|
|
130
|
+
handleAudioInputEnd
|
|
131
|
+
});
|
|
132
|
+
(0, external_react_namespaceObject.useEffect)(()=>()=>{
|
|
133
|
+
if (isActiveRef.current) {
|
|
134
|
+
isActiveRef.current = false;
|
|
135
|
+
stopAudioInput();
|
|
136
|
+
clearOutputAudioQueue();
|
|
137
|
+
onActiveChangeRef.current?.(false);
|
|
138
|
+
}
|
|
139
|
+
}, [
|
|
140
|
+
stopAudioInput,
|
|
141
|
+
clearOutputAudioQueue
|
|
142
|
+
]);
|
|
143
|
+
const handleClick = (0, external_react_namespaceObject.useCallback)(async ()=>{
|
|
144
|
+
if (disabled) return;
|
|
145
|
+
if (isActive) stopAudioInput();
|
|
146
|
+
else await startAudioInput(true);
|
|
147
|
+
}, [
|
|
148
|
+
disabled,
|
|
149
|
+
isActive,
|
|
150
|
+
startAudioInput,
|
|
151
|
+
stopAudioInput
|
|
152
|
+
]);
|
|
153
|
+
const iconColor = disabled ? 'var(--color-foreground-disable)' : isActive ? 'var(--color-background)' : void 0;
|
|
154
|
+
const stopLabel = _({
|
|
155
|
+
id: 'autopilot-chat.input.actions.stop'
|
|
156
|
+
});
|
|
157
|
+
const voiceLabel = _({
|
|
158
|
+
id: 'autopilot-chat.input.actions.voice-interaction'
|
|
159
|
+
});
|
|
160
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VoiceButtonContainer, {
|
|
161
|
+
active: isActive,
|
|
162
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
|
|
163
|
+
iconName: isActive ? 'stop' : 'graphic_eq',
|
|
164
|
+
tooltip: isActive ? stopLabel : voiceLabel,
|
|
165
|
+
overrideColor: iconColor,
|
|
166
|
+
preventHover: true,
|
|
167
|
+
disabled: disabled,
|
|
168
|
+
onClick: handleClick,
|
|
169
|
+
"data-testid": "autopilot-chat-always-on-voice-button",
|
|
170
|
+
ariaLabel: isActive ? stopLabel : voiceLabel,
|
|
171
|
+
ariaPressed: isActive
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
exports.AlwaysOnVoiceButton = __webpack_exports__.AlwaysOnVoiceButton;
|
|
176
|
+
exports.VoiceButtonContainer = __webpack_exports__.VoiceButtonContainer;
|
|
177
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
178
|
+
"AlwaysOnVoiceButton",
|
|
179
|
+
"VoiceButtonContainer"
|
|
180
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
181
|
+
Object.defineProperty(exports, '__esModule', {
|
|
182
|
+
value: true
|
|
183
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const VoiceButtonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
2
|
+
active?: boolean;
|
|
3
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
+
interface AlwaysOnVoiceButtonProps {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onActiveChange?: (isActive: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const AlwaysOnVoiceButton: ({ disabled, onActiveChange, }: AlwaysOnVoiceButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=always-on-voice-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"always-on-voice-button.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/input/always-on-voice-button.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB;aAEnB,OAAO;yGAUlB,CAAC;AAEJ,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAOD,eAAO,MAAM,mBAAmB,GAAI,+BAGjC,wBAAwB,4CA4I1B,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLingui } from "@lingui/react";
|
|
3
|
+
import { styled } from "@mui/material";
|
|
4
|
+
import apollo_core from "@uipath/apollo-core";
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useChatService } from "../../providers/chat-service.provider.js";
|
|
7
|
+
import { AutopilotChatEvent } from "../../service/index.js";
|
|
8
|
+
import { useAudioInput } from "../audio/chat-audio-input.js";
|
|
9
|
+
import { useAudioOutput } from "../audio/chat-audio-output.js";
|
|
10
|
+
import { AutopilotChatActionButton } from "../common/action-button.js";
|
|
11
|
+
const VoiceButtonContainer = styled('div', {
|
|
12
|
+
shouldForwardProp: (prop)=>'active' !== prop
|
|
13
|
+
})(({ active })=>({
|
|
14
|
+
'& .MuiIconButton-root': {
|
|
15
|
+
borderRadius: apollo_core.Border.BorderRadiusM,
|
|
16
|
+
...active && {
|
|
17
|
+
backgroundColor: "var(--color-foreground) !important",
|
|
18
|
+
'&:hover, &:active, &:focus': {
|
|
19
|
+
backgroundColor: "var(--color-foreground-de-emp) !important"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
const AlwaysOnVoiceButton = ({ disabled = false, onActiveChange })=>{
|
|
25
|
+
const { _ } = useLingui();
|
|
26
|
+
const [isActive, setIsActive] = useState(false);
|
|
27
|
+
const chatService = useChatService();
|
|
28
|
+
const isActiveRef = useRef(false);
|
|
29
|
+
const onActiveChangeRef = useRef(onActiveChange);
|
|
30
|
+
onActiveChangeRef.current = onActiveChange;
|
|
31
|
+
const { queueOutputAudio, clearOutputAudioQueue } = useAudioOutput();
|
|
32
|
+
useEffect(()=>{
|
|
33
|
+
if (!chatService) return;
|
|
34
|
+
return chatService.on(AutopilotChatEvent.OutputStream, (event)=>{
|
|
35
|
+
if (!isActiveRef.current) return;
|
|
36
|
+
if (event.mediaChunks) {
|
|
37
|
+
for (const chunk of event.mediaChunks)if (chunk.mimeType.startsWith('audio/pcm;')) queueOutputAudio(chunk.mimeType, chunk.data, chunk.sequenceNumber);
|
|
38
|
+
}
|
|
39
|
+
if (event.interrupted) clearOutputAudioQueue();
|
|
40
|
+
});
|
|
41
|
+
}, [
|
|
42
|
+
chatService,
|
|
43
|
+
queueOutputAudio,
|
|
44
|
+
clearOutputAudioQueue
|
|
45
|
+
]);
|
|
46
|
+
const handleAudioInputStart = useCallback((automaticActivityDetectionEnabled)=>{
|
|
47
|
+
if (!chatService) return;
|
|
48
|
+
isActiveRef.current = true;
|
|
49
|
+
setIsActive(true);
|
|
50
|
+
onActiveChangeRef.current?.(true);
|
|
51
|
+
chatService.sendInputStreamEvent({
|
|
52
|
+
activityStart: {
|
|
53
|
+
automaticActivityDetectionEnabled
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}, [
|
|
57
|
+
chatService
|
|
58
|
+
]);
|
|
59
|
+
const handleAudioInputEnd = useCallback((sequenceNumber)=>{
|
|
60
|
+
if (!chatService) return;
|
|
61
|
+
isActiveRef.current = false;
|
|
62
|
+
setIsActive(false);
|
|
63
|
+
onActiveChangeRef.current?.(false);
|
|
64
|
+
clearOutputAudioQueue();
|
|
65
|
+
chatService.sendInputStreamEvent({
|
|
66
|
+
activityEnd: {
|
|
67
|
+
sequenceNumber
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}, [
|
|
71
|
+
chatService,
|
|
72
|
+
clearOutputAudioQueue
|
|
73
|
+
]);
|
|
74
|
+
const handleAudioInputData = useCallback((mimeType, data, sequenceNumber)=>{
|
|
75
|
+
if (!chatService) return;
|
|
76
|
+
chatService.sendInputStreamEvent({
|
|
77
|
+
mediaChunks: [
|
|
78
|
+
{
|
|
79
|
+
mimeType,
|
|
80
|
+
data,
|
|
81
|
+
sequenceNumber
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}, [
|
|
86
|
+
chatService
|
|
87
|
+
]);
|
|
88
|
+
const { startAudioInput, stopAudioInput } = useAudioInput({
|
|
89
|
+
handleAudioInputData,
|
|
90
|
+
handleAudioInputStart,
|
|
91
|
+
handleAudioInputEnd
|
|
92
|
+
});
|
|
93
|
+
useEffect(()=>()=>{
|
|
94
|
+
if (isActiveRef.current) {
|
|
95
|
+
isActiveRef.current = false;
|
|
96
|
+
stopAudioInput();
|
|
97
|
+
clearOutputAudioQueue();
|
|
98
|
+
onActiveChangeRef.current?.(false);
|
|
99
|
+
}
|
|
100
|
+
}, [
|
|
101
|
+
stopAudioInput,
|
|
102
|
+
clearOutputAudioQueue
|
|
103
|
+
]);
|
|
104
|
+
const handleClick = useCallback(async ()=>{
|
|
105
|
+
if (disabled) return;
|
|
106
|
+
if (isActive) stopAudioInput();
|
|
107
|
+
else await startAudioInput(true);
|
|
108
|
+
}, [
|
|
109
|
+
disabled,
|
|
110
|
+
isActive,
|
|
111
|
+
startAudioInput,
|
|
112
|
+
stopAudioInput
|
|
113
|
+
]);
|
|
114
|
+
const iconColor = disabled ? 'var(--color-foreground-disable)' : isActive ? 'var(--color-background)' : void 0;
|
|
115
|
+
const stopLabel = _({
|
|
116
|
+
id: 'autopilot-chat.input.actions.stop'
|
|
117
|
+
});
|
|
118
|
+
const voiceLabel = _({
|
|
119
|
+
id: 'autopilot-chat.input.actions.voice-interaction'
|
|
120
|
+
});
|
|
121
|
+
return /*#__PURE__*/ jsx(VoiceButtonContainer, {
|
|
122
|
+
active: isActive,
|
|
123
|
+
children: /*#__PURE__*/ jsx(AutopilotChatActionButton, {
|
|
124
|
+
iconName: isActive ? 'stop' : 'graphic_eq',
|
|
125
|
+
tooltip: isActive ? stopLabel : voiceLabel,
|
|
126
|
+
overrideColor: iconColor,
|
|
127
|
+
preventHover: true,
|
|
128
|
+
disabled: disabled,
|
|
129
|
+
onClick: handleClick,
|
|
130
|
+
"data-testid": "autopilot-chat-always-on-voice-button",
|
|
131
|
+
ariaLabel: isActive ? stopLabel : voiceLabel,
|
|
132
|
+
ariaPressed: isActive
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
export { AlwaysOnVoiceButton, VoiceButtonContainer };
|
|
@@ -44,13 +44,15 @@ const external_react_namespaceObject = require("react");
|
|
|
44
44
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
45
45
|
const index_cjs_namespaceObject = require("../../../ap-typography/index.cjs");
|
|
46
46
|
const attachements_provider_cjs_namespaceObject = require("../../providers/attachements-provider.cjs");
|
|
47
|
+
const chat_service_provider_cjs_namespaceObject = require("../../providers/chat-service.provider.cjs");
|
|
47
48
|
const chat_state_provider_cjs_namespaceObject = require("../../providers/chat-state-provider.cjs");
|
|
48
49
|
const error_provider_cjs_namespaceObject = require("../../providers/error-provider.cjs");
|
|
49
50
|
const picker_provider_cjs_namespaceObject = require("../../providers/picker-provider.cjs");
|
|
51
|
+
const external_service_index_cjs_namespaceObject = require("../../service/index.cjs");
|
|
50
52
|
const file_reader_cjs_namespaceObject = require("../../utils/file-reader.cjs");
|
|
51
|
-
const chat_audio_cjs_namespaceObject = require("../audio/chat-audio.cjs");
|
|
52
53
|
const action_button_cjs_namespaceObject = require("../common/action-button.cjs");
|
|
53
54
|
const shared_controls_cjs_namespaceObject = require("../common/shared-controls.cjs");
|
|
55
|
+
const external_always_on_voice_button_cjs_namespaceObject = require("./always-on-voice-button.cjs");
|
|
54
56
|
const external_chat_input_agent_mode_selector_cjs_namespaceObject = require("./chat-input-agent-mode-selector.cjs");
|
|
55
57
|
const external_chat_input_model_picker_cjs_namespaceObject = require("./chat-input-model-picker.cjs");
|
|
56
58
|
const external_chat_input_resource_trigger_cjs_namespaceObject = require("./chat-input-resource-trigger.cjs");
|
|
@@ -75,12 +77,28 @@ const SubmitButtonContainer = (0, material_namespaceObject.styled)('div')(()=>({
|
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}));
|
|
78
|
-
function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waitingResponse, onResourceTriggerClick }) {
|
|
80
|
+
function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, isInputEmpty, waitingResponse, onResourceTriggerClick, onVoiceInteractionChange, isVoiceInteractionActive }) {
|
|
79
81
|
const { _ } = (0, react_namespaceObject.useLingui)();
|
|
82
|
+
const chatService = (0, chat_service_provider_cjs_namespaceObject.useChatService)();
|
|
80
83
|
const { addAttachments } = (0, attachements_provider_cjs_namespaceObject.useAttachments)();
|
|
81
84
|
const { setError } = (0, error_provider_cjs_namespaceObject.useError)();
|
|
82
85
|
const { disabledFeatures, allowedAttachments } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
|
|
83
86
|
const { models, agentModes } = (0, picker_provider_cjs_namespaceObject.usePicker)();
|
|
87
|
+
const [isSpeechToTextActive, setIsSpeechToTextActive] = external_react_default().useState(()=>chatService?.isSpeechToTextActive ?? false);
|
|
88
|
+
external_react_default().useEffect(()=>{
|
|
89
|
+
if (!chatService) return;
|
|
90
|
+
setIsSpeechToTextActive(chatService.isSpeechToTextActive);
|
|
91
|
+
return chatService.on(external_service_index_cjs_namespaceObject.AutopilotChatEvent.SetSpeechToTextState, (isActive)=>{
|
|
92
|
+
setIsSpeechToTextActive(isActive);
|
|
93
|
+
});
|
|
94
|
+
}, [
|
|
95
|
+
chatService
|
|
96
|
+
]);
|
|
97
|
+
const handleSpeechToTextClick = external_react_default().useCallback(()=>{
|
|
98
|
+
chatService?.publishSpeechToTextToggle();
|
|
99
|
+
}, [
|
|
100
|
+
chatService
|
|
101
|
+
]);
|
|
84
102
|
const fileInputRef = external_react_default().useRef(null);
|
|
85
103
|
const handleFileButtonClick = ()=>{
|
|
86
104
|
if (fileInputRef.current) {
|
|
@@ -150,6 +168,7 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
150
168
|
acceptedExtensions,
|
|
151
169
|
_
|
|
152
170
|
]);
|
|
171
|
+
const showVoice = false === disabledFeatures.audioStreaming && (isVoiceInteractionActive || !!isInputEmpty && !waitingResponse);
|
|
153
172
|
const hasMultipleFeatures = [
|
|
154
173
|
!disabledFeatures.attachments,
|
|
155
174
|
models.length > 0,
|
|
@@ -158,6 +177,9 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
158
177
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsContainer, {
|
|
159
178
|
children: [
|
|
160
179
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsGroup, {
|
|
180
|
+
style: isVoiceInteractionActive ? {
|
|
181
|
+
visibility: 'hidden'
|
|
182
|
+
} : void 0,
|
|
161
183
|
children: [
|
|
162
184
|
!disabledFeatures.attachments && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
163
185
|
children: [
|
|
@@ -250,8 +272,28 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
250
272
|
}),
|
|
251
273
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsGroup, {
|
|
252
274
|
children: [
|
|
253
|
-
!disabledFeatures.audio && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
254
|
-
|
|
275
|
+
!isVoiceInteractionActive && !disabledFeatures.audio && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_always_on_voice_button_cjs_namespaceObject.VoiceButtonContainer, {
|
|
276
|
+
active: isSpeechToTextActive,
|
|
277
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
|
|
278
|
+
iconName: "mic",
|
|
279
|
+
onClick: handleSpeechToTextClick,
|
|
280
|
+
tooltipPlacement: "top",
|
|
281
|
+
tooltip: _({
|
|
282
|
+
id: 'autopilot-chat.input.actions.dictate'
|
|
283
|
+
}),
|
|
284
|
+
overrideColor: isSpeechToTextActive ? 'var(--color-background)' : void 0,
|
|
285
|
+
"data-testid": "autopilot-chat-stt-button",
|
|
286
|
+
ariaLabel: _({
|
|
287
|
+
id: 'autopilot-chat.input.actions.dictate'
|
|
288
|
+
}),
|
|
289
|
+
ariaPressed: isSpeechToTextActive
|
|
290
|
+
})
|
|
291
|
+
}),
|
|
292
|
+
showVoice && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_always_on_voice_button_cjs_namespaceObject.AlwaysOnVoiceButton, {
|
|
293
|
+
disabled: isSpeechToTextActive,
|
|
294
|
+
onActiveChange: onVoiceInteractionChange
|
|
295
|
+
}),
|
|
296
|
+
!showVoice && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SubmitButtonContainer, {
|
|
255
297
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
|
|
256
298
|
iconName: waitingResponse ? 'stop' : 'arrow_upward',
|
|
257
299
|
tooltip: waitingResponse ? _({
|
|
@@ -2,10 +2,13 @@ import React from 'react';
|
|
|
2
2
|
interface AutopilotChatInputActionsProps {
|
|
3
3
|
handleSubmit: (event: React.MouseEvent) => void;
|
|
4
4
|
disableSubmit: boolean;
|
|
5
|
+
isInputEmpty?: boolean;
|
|
5
6
|
waitingResponse: boolean;
|
|
6
7
|
onResourceTriggerClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
onVoiceInteractionChange?: (isActive: boolean) => void;
|
|
9
|
+
isVoiceInteractionActive?: boolean;
|
|
7
10
|
}
|
|
8
|
-
declare function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waitingResponse, onResourceTriggerClick, }: AutopilotChatInputActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, isInputEmpty, waitingResponse, onResourceTriggerClick, onVoiceInteractionChange, isVoiceInteractionActive, }: AutopilotChatInputActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export declare const AutopilotChatInputActions: React.MemoExoticComponent<typeof AutopilotChatInputActionsComponent>;
|
|
10
13
|
export {};
|
|
11
14
|
//# sourceMappingURL=chat-input-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-input-actions.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/input/chat-input-actions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-input-actions.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/input/chat-input-actions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AA2C1B,UAAU,8BAA8B;IACtC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAChD,aAAa,EAAE,OAAO,CAAC;IAMvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9E,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,iBAAS,kCAAkC,CAAC,EAC1C,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,GACzB,EAAE,8BAA8B,2CA8RhC;AAED,eAAO,MAAM,yBAAyB,sEAAiD,CAAC"}
|
|
@@ -5,13 +5,15 @@ import apollo_core, { FontVariantToken } from "@uipath/apollo-core";
|
|
|
5
5
|
import react from "react";
|
|
6
6
|
import { ApTypography } from "../../../ap-typography/index.js";
|
|
7
7
|
import { useAttachments } from "../../providers/attachements-provider.js";
|
|
8
|
+
import { useChatService } from "../../providers/chat-service.provider.js";
|
|
8
9
|
import { useChatState } from "../../providers/chat-state-provider.js";
|
|
9
10
|
import { useError } from "../../providers/error-provider.js";
|
|
10
11
|
import { usePicker } from "../../providers/picker-provider.js";
|
|
12
|
+
import { AutopilotChatEvent } from "../../service/index.js";
|
|
11
13
|
import { parseFiles } from "../../utils/file-reader.js";
|
|
12
|
-
import { AutopilotChatAudio } from "../audio/chat-audio.js";
|
|
13
14
|
import { AutopilotChatActionButton } from "../common/action-button.js";
|
|
14
15
|
import { VisuallyHidden } from "../common/shared-controls.js";
|
|
16
|
+
import { AlwaysOnVoiceButton, VoiceButtonContainer } from "./always-on-voice-button.js";
|
|
15
17
|
import { AutopilotChatAgentModeSelector } from "./chat-input-agent-mode-selector.js";
|
|
16
18
|
import { AutopilotChatInputModelPicker } from "./chat-input-model-picker.js";
|
|
17
19
|
import { ResourceTriggerButton } from "./chat-input-resource-trigger.js";
|
|
@@ -36,12 +38,28 @@ const SubmitButtonContainer = styled('div')(()=>({
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
}));
|
|
39
|
-
function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waitingResponse, onResourceTriggerClick }) {
|
|
41
|
+
function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, isInputEmpty, waitingResponse, onResourceTriggerClick, onVoiceInteractionChange, isVoiceInteractionActive }) {
|
|
40
42
|
const { _ } = useLingui();
|
|
43
|
+
const chatService = useChatService();
|
|
41
44
|
const { addAttachments } = useAttachments();
|
|
42
45
|
const { setError } = useError();
|
|
43
46
|
const { disabledFeatures, allowedAttachments } = useChatState();
|
|
44
47
|
const { models, agentModes } = usePicker();
|
|
48
|
+
const [isSpeechToTextActive, setIsSpeechToTextActive] = react.useState(()=>chatService?.isSpeechToTextActive ?? false);
|
|
49
|
+
react.useEffect(()=>{
|
|
50
|
+
if (!chatService) return;
|
|
51
|
+
setIsSpeechToTextActive(chatService.isSpeechToTextActive);
|
|
52
|
+
return chatService.on(AutopilotChatEvent.SetSpeechToTextState, (isActive)=>{
|
|
53
|
+
setIsSpeechToTextActive(isActive);
|
|
54
|
+
});
|
|
55
|
+
}, [
|
|
56
|
+
chatService
|
|
57
|
+
]);
|
|
58
|
+
const handleSpeechToTextClick = react.useCallback(()=>{
|
|
59
|
+
chatService?.publishSpeechToTextToggle();
|
|
60
|
+
}, [
|
|
61
|
+
chatService
|
|
62
|
+
]);
|
|
45
63
|
const fileInputRef = react.useRef(null);
|
|
46
64
|
const handleFileButtonClick = ()=>{
|
|
47
65
|
if (fileInputRef.current) {
|
|
@@ -111,6 +129,7 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
111
129
|
acceptedExtensions,
|
|
112
130
|
_
|
|
113
131
|
]);
|
|
132
|
+
const showVoice = false === disabledFeatures.audioStreaming && (isVoiceInteractionActive || !!isInputEmpty && !waitingResponse);
|
|
114
133
|
const hasMultipleFeatures = [
|
|
115
134
|
!disabledFeatures.attachments,
|
|
116
135
|
models.length > 0,
|
|
@@ -119,6 +138,9 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
119
138
|
return /*#__PURE__*/ jsxs(InputActionsContainer, {
|
|
120
139
|
children: [
|
|
121
140
|
/*#__PURE__*/ jsxs(InputActionsGroup, {
|
|
141
|
+
style: isVoiceInteractionActive ? {
|
|
142
|
+
visibility: 'hidden'
|
|
143
|
+
} : void 0,
|
|
122
144
|
children: [
|
|
123
145
|
!disabledFeatures.attachments && /*#__PURE__*/ jsxs(Fragment, {
|
|
124
146
|
children: [
|
|
@@ -211,8 +233,28 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
|
|
|
211
233
|
}),
|
|
212
234
|
/*#__PURE__*/ jsxs(InputActionsGroup, {
|
|
213
235
|
children: [
|
|
214
|
-
!disabledFeatures.audio && /*#__PURE__*/ jsx(
|
|
215
|
-
|
|
236
|
+
!isVoiceInteractionActive && !disabledFeatures.audio && /*#__PURE__*/ jsx(VoiceButtonContainer, {
|
|
237
|
+
active: isSpeechToTextActive,
|
|
238
|
+
children: /*#__PURE__*/ jsx(AutopilotChatActionButton, {
|
|
239
|
+
iconName: "mic",
|
|
240
|
+
onClick: handleSpeechToTextClick,
|
|
241
|
+
tooltipPlacement: "top",
|
|
242
|
+
tooltip: _({
|
|
243
|
+
id: 'autopilot-chat.input.actions.dictate'
|
|
244
|
+
}),
|
|
245
|
+
overrideColor: isSpeechToTextActive ? 'var(--color-background)' : void 0,
|
|
246
|
+
"data-testid": "autopilot-chat-stt-button",
|
|
247
|
+
ariaLabel: _({
|
|
248
|
+
id: 'autopilot-chat.input.actions.dictate'
|
|
249
|
+
}),
|
|
250
|
+
ariaPressed: isSpeechToTextActive
|
|
251
|
+
})
|
|
252
|
+
}),
|
|
253
|
+
showVoice && /*#__PURE__*/ jsx(AlwaysOnVoiceButton, {
|
|
254
|
+
disabled: isSpeechToTextActive,
|
|
255
|
+
onActiveChange: onVoiceInteractionChange
|
|
256
|
+
}),
|
|
257
|
+
!showVoice && /*#__PURE__*/ jsx(SubmitButtonContainer, {
|
|
216
258
|
children: /*#__PURE__*/ jsx(AutopilotChatActionButton, {
|
|
217
259
|
iconName: waitingResponse ? 'stop' : 'arrow_upward',
|
|
218
260
|
tooltip: waitingResponse ? _({
|