@stack-spot/ai-chat-widget 1.0.0-dev.1768329683444 → 1.0.0-dev.1768423745486
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/package.dev.json +4 -1
- package/package.json +3 -2
- package/package.stg.json +4 -1
- package/src/app-metadata.json +2 -2
- package/src/views/Chat/ChatMessage.tsx +8 -6
- package/src/views/ChatHistory/utils.ts +17 -9
- package/src/views/Home/CustomAgent.tsx +4 -4
- package/src/views/MessageInput/ModelSwitcher/index.tsx +3 -2
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +9 -8
- package/src/views/Resources.tsx +10 -6
- package/src/views/Tools.tsx +5 -4
- package/dist/AbortedError.d.ts +0 -5
- package/dist/AbortedError.d.ts.map +0 -1
- package/dist/AbortedError.js +0 -7
- package/dist/AbortedError.js.map +0 -1
- package/dist/StackspotAIWidget.d.ts +0 -54
- package/dist/StackspotAIWidget.d.ts.map +0 -1
- package/dist/StackspotAIWidget.js +0 -43
- package/dist/StackspotAIWidget.js.map +0 -1
- package/dist/app-metadata.json +0 -175
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +0 -22
- package/dist/chat-interceptors/CustomInputs.d.ts.map +0 -1
- package/dist/chat-interceptors/CustomInputs.js +0 -71
- package/dist/chat-interceptors/CustomInputs.js.map +0 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +0 -14
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +0 -1
- package/dist/chat-interceptors/quick-command-questions.js +0 -28
- package/dist/chat-interceptors/quick-command-questions.js.map +0 -1
- package/dist/chat-interceptors/quick-commands.d.ts +0 -17
- package/dist/chat-interceptors/quick-commands.d.ts.map +0 -1
- package/dist/chat-interceptors/quick-commands.js +0 -445
- package/dist/chat-interceptors/quick-commands.js.map +0 -1
- package/dist/chat-interceptors/send-message.d.ts +0 -29
- package/dist/chat-interceptors/send-message.d.ts.map +0 -1
- package/dist/chat-interceptors/send-message.js +0 -252
- package/dist/chat-interceptors/send-message.js.map +0 -1
- package/dist/components/AdaptiveTextArea.d.ts +0 -22
- package/dist/components/AdaptiveTextArea.d.ts.map +0 -1
- package/dist/components/AdaptiveTextArea.js +0 -40
- package/dist/components/AdaptiveTextArea.js.map +0 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts +0 -4
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +0 -1
- package/dist/components/AgentCard/AgentCardCreate.js +0 -33
- package/dist/components/AgentCard/AgentCardCreate.js.map +0 -1
- package/dist/components/AgentCard/dictionary.d.ts +0 -23
- package/dist/components/AgentCard/dictionary.d.ts.map +0 -1
- package/dist/components/AgentCard/dictionary.js +0 -23
- package/dist/components/AgentCard/dictionary.js.map +0 -1
- package/dist/components/AgentCard/index.d.ts +0 -5
- package/dist/components/AgentCard/index.d.ts.map +0 -1
- package/dist/components/AgentCard/index.js +0 -55
- package/dist/components/AgentCard/index.js.map +0 -1
- package/dist/components/AnimatedOpacity.d.ts +0 -8
- package/dist/components/AnimatedOpacity.d.ts.map +0 -1
- package/dist/components/AnimatedOpacity.js +0 -46
- package/dist/components/AnimatedOpacity.js.map +0 -1
- package/dist/components/AutoFocus.d.ts +0 -23
- package/dist/components/AutoFocus.d.ts.map +0 -1
- package/dist/components/AutoFocus.js +0 -23
- package/dist/components/AutoFocus.js.map +0 -1
- package/dist/components/ButtonFavorite.d.ts +0 -40
- package/dist/components/ButtonFavorite.d.ts.map +0 -1
- package/dist/components/ButtonFavorite.js +0 -25
- package/dist/components/ButtonFavorite.js.map +0 -1
- package/dist/components/Code.d.ts +0 -20
- package/dist/components/Code.d.ts.map +0 -1
- package/dist/components/Code.js +0 -146
- package/dist/components/Code.js.map +0 -1
- package/dist/components/ComponentNavigator.d.ts +0 -38
- package/dist/components/ComponentNavigator.d.ts.map +0 -1
- package/dist/components/ComponentNavigator.js +0 -31
- package/dist/components/ComponentNavigator.js.map +0 -1
- package/dist/components/Fading.d.ts +0 -32
- package/dist/components/Fading.d.ts.map +0 -1
- package/dist/components/Fading.js +0 -33
- package/dist/components/Fading.js.map +0 -1
- package/dist/components/FadingOverflow.d.ts +0 -37
- package/dist/components/FadingOverflow.d.ts.map +0 -1
- package/dist/components/FadingOverflow.js +0 -224
- package/dist/components/FadingOverflow.js.map +0 -1
- package/dist/components/FileDescription.d.ts +0 -10
- package/dist/components/FileDescription.d.ts.map +0 -1
- package/dist/components/FileDescription.js +0 -84
- package/dist/components/FileDescription.js.map +0 -1
- package/dist/components/HistoryList.d.ts +0 -25
- package/dist/components/HistoryList.d.ts.map +0 -1
- package/dist/components/HistoryList.js +0 -76
- package/dist/components/HistoryList.js.map +0 -1
- package/dist/components/ListResource.d.ts +0 -29
- package/dist/components/ListResource.d.ts.map +0 -1
- package/dist/components/ListResource.js +0 -17
- package/dist/components/ListResource.js.map +0 -1
- package/dist/components/Markdown.d.ts +0 -9
- package/dist/components/Markdown.d.ts.map +0 -1
- package/dist/components/Markdown.js +0 -17
- package/dist/components/Markdown.js.map +0 -1
- package/dist/components/Modal.d.ts +0 -9
- package/dist/components/Modal.d.ts.map +0 -1
- package/dist/components/Modal.js +0 -56
- package/dist/components/Modal.js.map +0 -1
- package/dist/components/QuickStartButton.d.ts +0 -6
- package/dist/components/QuickStartButton.d.ts.map +0 -1
- package/dist/components/QuickStartButton.js +0 -8
- package/dist/components/QuickStartButton.js.map +0 -1
- package/dist/components/RightPanelContentList.d.ts +0 -10
- package/dist/components/RightPanelContentList.d.ts.map +0 -1
- package/dist/components/RightPanelContentList.js +0 -7
- package/dist/components/RightPanelContentList.js.map +0 -1
- package/dist/components/RightPanelForm.d.ts +0 -8
- package/dist/components/RightPanelForm.d.ts.map +0 -1
- package/dist/components/RightPanelForm.js +0 -85
- package/dist/components/RightPanelForm.js.map +0 -1
- package/dist/components/RightPanelTabs.d.ts +0 -10
- package/dist/components/RightPanelTabs.d.ts.map +0 -1
- package/dist/components/RightPanelTabs.js +0 -12
- package/dist/components/RightPanelTabs.js.map +0 -1
- package/dist/components/Selector/SelectVersion.d.ts +0 -12
- package/dist/components/Selector/SelectVersion.d.ts.map +0 -1
- package/dist/components/Selector/SelectVersion.js +0 -33
- package/dist/components/Selector/SelectVersion.js.map +0 -1
- package/dist/components/Selector/index.d.ts +0 -56
- package/dist/components/Selector/index.d.ts.map +0 -1
- package/dist/components/Selector/index.js +0 -146
- package/dist/components/Selector/index.js.map +0 -1
- package/dist/components/Selector/styled.d.ts +0 -6
- package/dist/components/Selector/styled.d.ts.map +0 -1
- package/dist/components/Selector/styled.js +0 -202
- package/dist/components/Selector/styled.js.map +0 -1
- package/dist/components/StackedBadge.d.ts +0 -14
- package/dist/components/StackedBadge.d.ts.map +0 -1
- package/dist/components/StackedBadge.js +0 -56
- package/dist/components/StackedBadge.js.map +0 -1
- package/dist/components/TabManager.d.ts +0 -40
- package/dist/components/TabManager.d.ts.map +0 -1
- package/dist/components/TabManager.js +0 -146
- package/dist/components/TabManager.js.map +0 -1
- package/dist/components/ToolBadge.d.ts +0 -9
- package/dist/components/ToolBadge.d.ts.map +0 -1
- package/dist/components/ToolBadge.js +0 -34
- package/dist/components/ToolBadge.js.map +0 -1
- package/dist/components/WorkspaceTabNavigator.d.ts +0 -17
- package/dist/components/WorkspaceTabNavigator.d.ts.map +0 -1
- package/dist/components/WorkspaceTabNavigator.js +0 -93
- package/dist/components/WorkspaceTabNavigator.js.map +0 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +0 -31
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +0 -1
- package/dist/components/form/DescribedCheckboxGroup.js +0 -77
- package/dist/components/form/DescribedCheckboxGroup.js.map +0 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +0 -32
- package/dist/components/form/DescribedRadioGroup.d.ts.map +0 -1
- package/dist/components/form/DescribedRadioGroup.js +0 -67
- package/dist/components/form/DescribedRadioGroup.js.map +0 -1
- package/dist/components/form/dictionary.d.ts +0 -19
- package/dist/components/form/dictionary.d.ts.map +0 -1
- package/dist/components/form/dictionary.js +0 -19
- package/dist/components/form/dictionary.js.map +0 -1
- package/dist/components/form/styled.d.ts +0 -2
- package/dist/components/form/styled.d.ts.map +0 -1
- package/dist/components/form/styled.js +0 -41
- package/dist/components/form/styled.js.map +0 -1
- package/dist/components/form/types.d.ts +0 -61
- package/dist/components/form/types.d.ts.map +0 -1
- package/dist/components/form/types.js +0 -2
- package/dist/components/form/types.js.map +0 -1
- package/dist/context/AIWidgetProvider.d.ts +0 -23
- package/dist/context/AIWidgetProvider.d.ts.map +0 -1
- package/dist/context/AIWidgetProvider.js +0 -23
- package/dist/context/AIWidgetProvider.js.map +0 -1
- package/dist/context/hooks.d.ts +0 -75
- package/dist/context/hooks.d.ts.map +0 -1
- package/dist/context/hooks.js +0 -148
- package/dist/context/hooks.js.map +0 -1
- package/dist/features.d.ts +0 -75
- package/dist/features.d.ts.map +0 -1
- package/dist/features.js +0 -24
- package/dist/features.js.map +0 -1
- package/dist/hooks/enabled-feature-flags.d.ts +0 -5
- package/dist/hooks/enabled-feature-flags.d.ts.map +0 -1
- package/dist/hooks/enabled-feature-flags.js +0 -28
- package/dist/hooks/enabled-feature-flags.js.map +0 -1
- package/dist/hooks/midnight-update-view.d.ts +0 -5
- package/dist/hooks/midnight-update-view.d.ts.map +0 -1
- package/dist/hooks/midnight-update-view.js +0 -30
- package/dist/hooks/midnight-update-view.js.map +0 -1
- package/dist/index.d.ts +0 -21
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/layout.css +0 -192
- package/dist/regex.d.ts +0 -3
- package/dist/regex.d.ts.map +0 -1
- package/dist/regex.js +0 -3
- package/dist/regex.js.map +0 -1
- package/dist/right-panel/DefaultPanel.d.ts +0 -12
- package/dist/right-panel/DefaultPanel.d.ts.map +0 -1
- package/dist/right-panel/DefaultPanel.js +0 -48
- package/dist/right-panel/DefaultPanel.js.map +0 -1
- package/dist/right-panel/RightPanel.d.ts +0 -5
- package/dist/right-panel/RightPanel.d.ts.map +0 -1
- package/dist/right-panel/RightPanel.js +0 -9
- package/dist/right-panel/RightPanel.js.map +0 -1
- package/dist/right-panel/RightPanelProvider.d.ts +0 -28
- package/dist/right-panel/RightPanelProvider.d.ts.map +0 -1
- package/dist/right-panel/RightPanelProvider.js +0 -10
- package/dist/right-panel/RightPanelProvider.js.map +0 -1
- package/dist/right-panel/constants.d.ts +0 -2
- package/dist/right-panel/constants.d.ts.map +0 -1
- package/dist/right-panel/constants.js +0 -2
- package/dist/right-panel/constants.js.map +0 -1
- package/dist/right-panel/hooks.d.ts +0 -19
- package/dist/right-panel/hooks.d.ts.map +0 -1
- package/dist/right-panel/hooks.js +0 -46
- package/dist/right-panel/hooks.js.map +0 -1
- package/dist/state/ChatEntry.d.ts +0 -230
- package/dist/state/ChatEntry.d.ts.map +0 -1
- package/dist/state/ChatEntry.js +0 -63
- package/dist/state/ChatEntry.js.map +0 -1
- package/dist/state/ChatState.d.ts +0 -171
- package/dist/state/ChatState.d.ts.map +0 -1
- package/dist/state/ChatState.js +0 -129
- package/dist/state/ChatState.js.map +0 -1
- package/dist/state/ChatTabsController.d.ts +0 -66
- package/dist/state/ChatTabsController.d.ts.map +0 -1
- package/dist/state/ChatTabsController.js +0 -116
- package/dist/state/ChatTabsController.js.map +0 -1
- package/dist/state/ObservableState.d.ts +0 -24
- package/dist/state/ObservableState.d.ts.map +0 -1
- package/dist/state/ObservableState.js +0 -39
- package/dist/state/ObservableState.js.map +0 -1
- package/dist/state/WidgetState.d.ts +0 -86
- package/dist/state/WidgetState.d.ts.map +0 -1
- package/dist/state/WidgetState.js +0 -57
- package/dist/state/WidgetState.js.map +0 -1
- package/dist/state/constants.d.ts +0 -5
- package/dist/state/constants.d.ts.map +0 -1
- package/dist/state/constants.js +0 -10
- package/dist/state/constants.js.map +0 -1
- package/dist/state/types.d.ts +0 -18
- package/dist/state/types.d.ts.map +0 -1
- package/dist/state/types.js +0 -2
- package/dist/state/types.js.map +0 -1
- package/dist/types.d.ts +0 -33
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/chat.d.ts +0 -13
- package/dist/utils/chat.d.ts.map +0 -1
- package/dist/utils/chat.js +0 -28
- package/dist/utils/chat.js.map +0 -1
- package/dist/utils/check-is-trial.d.ts +0 -2
- package/dist/utils/check-is-trial.d.ts.map +0 -1
- package/dist/utils/check-is-trial.js +0 -6
- package/dist/utils/check-is-trial.js.map +0 -1
- package/dist/utils/copy-to-clipboard.d.ts +0 -6
- package/dist/utils/copy-to-clipboard.d.ts.map +0 -1
- package/dist/utils/copy-to-clipboard.js +0 -30
- package/dist/utils/copy-to-clipboard.js.map +0 -1
- package/dist/utils/date.d.ts +0 -31
- package/dist/utils/date.d.ts.map +0 -1
- package/dist/utils/date.js +0 -66
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/download.d.ts +0 -7
- package/dist/utils/download.d.ts.map +0 -1
- package/dist/utils/download.js +0 -15
- package/dist/utils/download.js.map +0 -1
- package/dist/utils/error.d.ts +0 -2
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -54
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/knowledge-source.d.ts +0 -19
- package/dist/utils/knowledge-source.d.ts.map +0 -1
- package/dist/utils/knowledge-source.js +0 -60
- package/dist/utils/knowledge-source.js.map +0 -1
- package/dist/utils/planning-tool.d.ts +0 -17
- package/dist/utils/planning-tool.d.ts.map +0 -1
- package/dist/utils/planning-tool.js +0 -32
- package/dist/utils/planning-tool.js.map +0 -1
- package/dist/utils/programming-languages.d.ts +0 -7
- package/dist/utils/programming-languages.d.ts.map +0 -1
- package/dist/utils/programming-languages.js +0 -474
- package/dist/utils/programming-languages.js.map +0 -1
- package/dist/utils/string.d.ts +0 -7
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/string.js +0 -11
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/tools.d.ts +0 -23
- package/dist/utils/tools.d.ts.map +0 -1
- package/dist/utils/tools.js +0 -23
- package/dist/utils/tools.js.map +0 -1
- package/dist/utils/update-tool-step.d.ts +0 -3
- package/dist/utils/update-tool-step.d.ts.map +0 -1
- package/dist/utils/update-tool-step.js +0 -23
- package/dist/utils/update-tool-step.js.map +0 -1
- package/dist/utils/upload/FileUpload.d.ts +0 -21
- package/dist/utils/upload/FileUpload.d.ts.map +0 -1
- package/dist/utils/upload/FileUpload.js +0 -54
- package/dist/utils/upload/FileUpload.js.map +0 -1
- package/dist/utils/upload/UploadManager.d.ts +0 -42
- package/dist/utils/upload/UploadManager.d.ts.map +0 -1
- package/dist/utils/upload/UploadManager.js +0 -138
- package/dist/utils/upload/UploadManager.js.map +0 -1
- package/dist/utils/upload/context.d.ts +0 -15
- package/dist/utils/upload/context.d.ts.map +0 -1
- package/dist/utils/upload/context.js +0 -37
- package/dist/utils/upload/context.js.map +0 -1
- package/dist/utils/upload/errors.d.ts +0 -17
- package/dist/utils/upload/errors.d.ts.map +0 -1
- package/dist/utils/upload/errors.js +0 -27
- package/dist/utils/upload/errors.js.map +0 -1
- package/dist/utils/upload/types.d.ts +0 -7
- package/dist/utils/upload/types.d.ts.map +0 -1
- package/dist/utils/upload/types.js +0 -2
- package/dist/utils/upload/types.js.map +0 -1
- package/dist/utils/upload/use-paste-upload.d.ts +0 -8
- package/dist/utils/upload/use-paste-upload.d.ts.map +0 -1
- package/dist/utils/upload/use-paste-upload.js +0 -19
- package/dist/utils/upload/use-paste-upload.js.map +0 -1
- package/dist/utils/upload/utils.d.ts +0 -4
- package/dist/utils/upload/utils.d.ts.map +0 -1
- package/dist/utils/upload/utils.js +0 -10
- package/dist/utils/upload/utils.js.map +0 -1
- package/dist/utils/url.d.ts +0 -2
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/url.js +0 -8
- package/dist/utils/url.js.map +0 -1
- package/dist/views/Agents/AgentDescription.d.ts +0 -8
- package/dist/views/Agents/AgentDescription.d.ts.map +0 -1
- package/dist/views/Agents/AgentDescription.js +0 -53
- package/dist/views/Agents/AgentDescription.js.map +0 -1
- package/dist/views/Agents/AgentsPanel.d.ts +0 -5
- package/dist/views/Agents/AgentsPanel.d.ts.map +0 -1
- package/dist/views/Agents/AgentsPanel.js +0 -45
- package/dist/views/Agents/AgentsPanel.js.map +0 -1
- package/dist/views/Agents/AgentsTab.d.ts +0 -11
- package/dist/views/Agents/AgentsTab.d.ts.map +0 -1
- package/dist/views/Agents/AgentsTab.js +0 -99
- package/dist/views/Agents/AgentsTab.js.map +0 -1
- package/dist/views/Agents/dictionary.d.ts +0 -2
- package/dist/views/Agents/dictionary.d.ts.map +0 -1
- package/dist/views/Agents/dictionary.js +0 -45
- package/dist/views/Agents/dictionary.js.map +0 -1
- package/dist/views/Agents/index.d.ts +0 -5
- package/dist/views/Agents/index.d.ts.map +0 -1
- package/dist/views/Agents/index.js +0 -21
- package/dist/views/Agents/index.js.map +0 -1
- package/dist/views/Agents/styled.d.ts +0 -3
- package/dist/views/Agents/styled.d.ts.map +0 -1
- package/dist/views/Agents/styled.js +0 -68
- package/dist/views/Agents/styled.js.map +0 -1
- package/dist/views/Agents/useAgentFavorites.d.ts +0 -8
- package/dist/views/Agents/useAgentFavorites.d.ts.map +0 -1
- package/dist/views/Agents/useAgentFavorites.js +0 -59
- package/dist/views/Agents/useAgentFavorites.js.map +0 -1
- package/dist/views/Chat/AgentInfo.d.ts +0 -11
- package/dist/views/Chat/AgentInfo.d.ts.map +0 -1
- package/dist/views/Chat/AgentInfo.js +0 -8
- package/dist/views/Chat/AgentInfo.js.map +0 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts +0 -5
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +0 -1
- package/dist/views/Chat/ButtonExecutionDetail.js +0 -34
- package/dist/views/Chat/ButtonExecutionDetail.js.map +0 -1
- package/dist/views/Chat/ChatMessage.d.ts +0 -59
- package/dist/views/Chat/ChatMessage.d.ts.map +0 -1
- package/dist/views/Chat/ChatMessage.js +0 -215
- package/dist/views/Chat/ChatMessage.js.map +0 -1
- package/dist/views/Chat/ChatMessages.d.ts +0 -11
- package/dist/views/Chat/ChatMessages.d.ts.map +0 -1
- package/dist/views/Chat/ChatMessages.js +0 -15
- package/dist/views/Chat/ChatMessages.js.map +0 -1
- package/dist/views/Chat/StepsList.d.ts +0 -14
- package/dist/views/Chat/StepsList.d.ts.map +0 -1
- package/dist/views/Chat/StepsList.js +0 -192
- package/dist/views/Chat/StepsList.js.map +0 -1
- package/dist/views/Chat/chat-scroll.d.ts +0 -7
- package/dist/views/Chat/chat-scroll.d.ts.map +0 -1
- package/dist/views/Chat/chat-scroll.js +0 -17
- package/dist/views/Chat/chat-scroll.js.map +0 -1
- package/dist/views/Chat/events.d.ts +0 -22
- package/dist/views/Chat/events.d.ts.map +0 -1
- package/dist/views/Chat/events.js +0 -67
- package/dist/views/Chat/events.js.map +0 -1
- package/dist/views/Chat/index.d.ts +0 -13
- package/dist/views/Chat/index.d.ts.map +0 -1
- package/dist/views/Chat/index.js +0 -11
- package/dist/views/Chat/index.js.map +0 -1
- package/dist/views/Chat/styled.d.ts +0 -4
- package/dist/views/Chat/styled.d.ts.map +0 -1
- package/dist/views/Chat/styled.js +0 -307
- package/dist/views/Chat/styled.js.map +0 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +0 -5
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +0 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +0 -14
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +0 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +0 -8
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +0 -1
- package/dist/views/ChatHistory/HistoryItem.js +0 -97
- package/dist/views/ChatHistory/HistoryItem.js.map +0 -1
- package/dist/views/ChatHistory/dictionary.d.ts +0 -2
- package/dist/views/ChatHistory/dictionary.d.ts.map +0 -1
- package/dist/views/ChatHistory/dictionary.js +0 -19
- package/dist/views/ChatHistory/dictionary.js.map +0 -1
- package/dist/views/ChatHistory/index.d.ts +0 -5
- package/dist/views/ChatHistory/index.d.ts.map +0 -1
- package/dist/views/ChatHistory/index.js +0 -26
- package/dist/views/ChatHistory/index.js.map +0 -1
- package/dist/views/ChatHistory/styled.d.ts +0 -2
- package/dist/views/ChatHistory/styled.d.ts.map +0 -1
- package/dist/views/ChatHistory/styled.js +0 -58
- package/dist/views/ChatHistory/styled.js.map +0 -1
- package/dist/views/ChatHistory/utils.d.ts +0 -21
- package/dist/views/ChatHistory/utils.d.ts.map +0 -1
- package/dist/views/ChatHistory/utils.js +0 -170
- package/dist/views/ChatHistory/utils.js.map +0 -1
- package/dist/views/ChatTabSelection.d.ts +0 -10
- package/dist/views/ChatTabSelection.d.ts.map +0 -1
- package/dist/views/ChatTabSelection.js +0 -70
- package/dist/views/ChatTabSelection.js.map +0 -1
- package/dist/views/Editor.d.ts +0 -5
- package/dist/views/Editor.d.ts.map +0 -1
- package/dist/views/Editor.js +0 -96
- package/dist/views/Editor.js.map +0 -1
- package/dist/views/Home/BuiltInAgent.d.ts +0 -6
- package/dist/views/Home/BuiltInAgent.d.ts.map +0 -1
- package/dist/views/Home/BuiltInAgent.js +0 -37
- package/dist/views/Home/BuiltInAgent.js.map +0 -1
- package/dist/views/Home/CustomAgent.d.ts +0 -5
- package/dist/views/Home/CustomAgent.d.ts.map +0 -1
- package/dist/views/Home/CustomAgent.js +0 -23
- package/dist/views/Home/CustomAgent.js.map +0 -1
- package/dist/views/Home/index.d.ts +0 -8
- package/dist/views/Home/index.d.ts.map +0 -1
- package/dist/views/Home/index.js +0 -34
- package/dist/views/Home/index.js.map +0 -1
- package/dist/views/Home/styled.d.ts +0 -2
- package/dist/views/Home/styled.d.ts.map +0 -1
- package/dist/views/Home/styled.js +0 -74
- package/dist/views/Home/styled.js.map +0 -1
- package/dist/views/Home/types.d.ts +0 -16
- package/dist/views/Home/types.d.ts.map +0 -1
- package/dist/views/Home/types.js +0 -2
- package/dist/views/Home/types.js.map +0 -1
- package/dist/views/KSDocument.d.ts +0 -5
- package/dist/views/KSDocument.d.ts.map +0 -1
- package/dist/views/KSDocument.js +0 -43
- package/dist/views/KSDocument.js.map +0 -1
- package/dist/views/KnowledgeSources.d.ts +0 -14
- package/dist/views/KnowledgeSources.d.ts.map +0 -1
- package/dist/views/KnowledgeSources.js +0 -183
- package/dist/views/KnowledgeSources.js.map +0 -1
- package/dist/views/MessageInput/AgentSelector.d.ts +0 -5
- package/dist/views/MessageInput/AgentSelector.d.ts.map +0 -1
- package/dist/views/MessageInput/AgentSelector.js +0 -76
- package/dist/views/MessageInput/AgentSelector.js.map +0 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts +0 -2
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonAgent.js +0 -35
- package/dist/views/MessageInput/ButtonAgent.js.map +0 -1
- package/dist/views/MessageInput/ButtonBar.d.ts +0 -13
- package/dist/views/MessageInput/ButtonBar.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonBar.js +0 -15
- package/dist/views/MessageInput/ButtonBar.js.map +0 -1
- package/dist/views/MessageInput/ContextBar.d.ts +0 -9
- package/dist/views/MessageInput/ContextBar.d.ts.map +0 -1
- package/dist/views/MessageInput/ContextBar.js +0 -51
- package/dist/views/MessageInput/ContextBar.js.map +0 -1
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts +0 -2
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +0 -1
- package/dist/views/MessageInput/ModelSwitcher/index.js +0 -25
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +0 -1
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +0 -30
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +0 -1
- package/dist/views/MessageInput/ModelSwitcher/utils.js +0 -91
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +0 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +0 -5
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +0 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +0 -104
- package/dist/views/MessageInput/QuickCommandSelector.js.map +0 -1
- package/dist/views/MessageInput/SelectContent.d.ts +0 -2
- package/dist/views/MessageInput/SelectContent.d.ts.map +0 -1
- package/dist/views/MessageInput/SelectContent.js +0 -84
- package/dist/views/MessageInput/SelectContent.js.map +0 -1
- package/dist/views/MessageInput/UploadBar.d.ts +0 -2
- package/dist/views/MessageInput/UploadBar.d.ts.map +0 -1
- package/dist/views/MessageInput/UploadBar.js +0 -74
- package/dist/views/MessageInput/UploadBar.js.map +0 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts +0 -14
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +0 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +0 -51
- package/dist/views/MessageInput/UploadDragNDrop.js.map +0 -1
- package/dist/views/MessageInput/chat-entry-history.d.ts +0 -11
- package/dist/views/MessageInput/chat-entry-history.d.ts.map +0 -1
- package/dist/views/MessageInput/chat-entry-history.js +0 -78
- package/dist/views/MessageInput/chat-entry-history.js.map +0 -1
- package/dist/views/MessageInput/dictionary.d.ts +0 -2
- package/dist/views/MessageInput/dictionary.d.ts.map +0 -1
- package/dist/views/MessageInput/dictionary.js +0 -81
- package/dist/views/MessageInput/dictionary.js.map +0 -1
- package/dist/views/MessageInput/index.d.ts +0 -10
- package/dist/views/MessageInput/index.d.ts.map +0 -1
- package/dist/views/MessageInput/index.js +0 -140
- package/dist/views/MessageInput/index.js.map +0 -1
- package/dist/views/MessageInput/styled.d.ts +0 -16
- package/dist/views/MessageInput/styled.d.ts.map +0 -1
- package/dist/views/MessageInput/styled.js +0 -341
- package/dist/views/MessageInput/styled.js.map +0 -1
- package/dist/views/MinimizedHeader.d.ts +0 -7
- package/dist/views/MinimizedHeader.d.ts.map +0 -1
- package/dist/views/MinimizedHeader.js +0 -78
- package/dist/views/MinimizedHeader.js.map +0 -1
- package/dist/views/Resources.d.ts +0 -2
- package/dist/views/Resources.d.ts.map +0 -1
- package/dist/views/Resources.js +0 -69
- package/dist/views/Resources.js.map +0 -1
- package/dist/views/Stacks.d.ts +0 -14
- package/dist/views/Stacks.d.ts.map +0 -1
- package/dist/views/Stacks.js +0 -172
- package/dist/views/Stacks.js.map +0 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts +0 -10
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/HandleGroup.js +0 -4
- package/dist/views/Steps/FlowChart/HandleGroup.js.map +0 -1
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts +0 -15
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/NodeDynamic.js +0 -41
- package/dist/views/Steps/FlowChart/NodeDynamic.js.map +0 -1
- package/dist/views/Steps/FlowChart/NodeStep.d.ts +0 -10
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/NodeStep.js +0 -13
- package/dist/views/Steps/FlowChart/NodeStep.js.map +0 -1
- package/dist/views/Steps/FlowChart/hooks.d.ts +0 -7
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/hooks.js +0 -31
- package/dist/views/Steps/FlowChart/hooks.js.map +0 -1
- package/dist/views/Steps/FlowChart/index.d.ts +0 -12
- package/dist/views/Steps/FlowChart/index.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/index.js +0 -78
- package/dist/views/Steps/FlowChart/index.js.map +0 -1
- package/dist/views/Steps/FlowChart/layout.d.ts +0 -8
- package/dist/views/Steps/FlowChart/layout.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/layout.js +0 -59
- package/dist/views/Steps/FlowChart/layout.js.map +0 -1
- package/dist/views/Steps/FlowChart/styled.d.ts +0 -14
- package/dist/views/Steps/FlowChart/styled.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/styled.js +0 -156
- package/dist/views/Steps/FlowChart/styled.js.map +0 -1
- package/dist/views/Steps/FlowChart/types.d.ts +0 -25
- package/dist/views/Steps/FlowChart/types.d.ts.map +0 -1
- package/dist/views/Steps/FlowChart/types.js +0 -2
- package/dist/views/Steps/FlowChart/types.js.map +0 -1
- package/dist/views/Steps/StepModal.d.ts +0 -10
- package/dist/views/Steps/StepModal.d.ts.map +0 -1
- package/dist/views/Steps/StepModal.js +0 -139
- package/dist/views/Steps/StepModal.js.map +0 -1
- package/dist/views/Steps/StepsPanel.d.ts +0 -6
- package/dist/views/Steps/StepsPanel.d.ts.map +0 -1
- package/dist/views/Steps/StepsPanel.js +0 -18
- package/dist/views/Steps/StepsPanel.js.map +0 -1
- package/dist/views/Steps/dictionary.d.ts +0 -43
- package/dist/views/Steps/dictionary.d.ts.map +0 -1
- package/dist/views/Steps/dictionary.js +0 -45
- package/dist/views/Steps/dictionary.js.map +0 -1
- package/dist/views/Steps/index.d.ts +0 -5
- package/dist/views/Steps/index.d.ts.map +0 -1
- package/dist/views/Steps/index.js +0 -30
- package/dist/views/Steps/index.js.map +0 -1
- package/dist/views/Steps/utils.d.ts +0 -7
- package/dist/views/Steps/utils.d.ts.map +0 -1
- package/dist/views/Steps/utils.js +0 -32
- package/dist/views/Steps/utils.js.map +0 -1
- package/dist/views/Tools.d.ts +0 -2
- package/dist/views/Tools.d.ts.map +0 -1
- package/dist/views/Tools.js +0 -53
- package/dist/views/Tools.js.map +0 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts +0 -20
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +0 -1
- package/dist/views/Workspaces/WorkspacesTab.js +0 -61
- package/dist/views/Workspaces/WorkspacesTab.js.map +0 -1
- package/dist/views/Workspaces/index.d.ts +0 -5
- package/dist/views/Workspaces/index.d.ts.map +0 -1
- package/dist/views/Workspaces/index.js +0 -69
- package/dist/views/Workspaces/index.js.map +0 -1
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { translate } from '@stack-spot/portal-translate';
|
|
2
|
-
import { ChatEntry } from '../state/ChatEntry.js';
|
|
3
|
-
const CUSTOM_INPUTS_KEY = 'customInputs';
|
|
4
|
-
export class CustomInputs {
|
|
5
|
-
value = {};
|
|
6
|
-
inputs;
|
|
7
|
-
index = 0;
|
|
8
|
-
resolve;
|
|
9
|
-
promise;
|
|
10
|
-
agent;
|
|
11
|
-
constructor(inputs, agent) {
|
|
12
|
-
this.inputs = inputs;
|
|
13
|
-
this.agent = agent;
|
|
14
|
-
this.promise = new Promise(resolve => {
|
|
15
|
-
this.resolve = resolve;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
static getCustomInputsFromChat(chat) {
|
|
19
|
-
return chat.interceptorMemory.get(CUSTOM_INPUTS_KEY);
|
|
20
|
-
}
|
|
21
|
-
static setCustomInputsForChat(inputs, chat) {
|
|
22
|
-
chat.interceptorMemory.set(CUSTOM_INPUTS_KEY, inputs);
|
|
23
|
-
}
|
|
24
|
-
static deleteCustomInputsFromChat(chat) {
|
|
25
|
-
chat.interceptorMemory.delete(CUSTOM_INPUTS_KEY);
|
|
26
|
-
}
|
|
27
|
-
ask() {
|
|
28
|
-
if (this.index >= this.inputs.length)
|
|
29
|
-
throw new Error('No more questions to ask.');
|
|
30
|
-
const t = translate(dictionary);
|
|
31
|
-
const input = this.inputs[this.index];
|
|
32
|
-
return new ChatEntry({
|
|
33
|
-
agentType: 'bot',
|
|
34
|
-
content: input.question,
|
|
35
|
-
type: 'text',
|
|
36
|
-
agent: this.agent,
|
|
37
|
-
badges: [{ label: input.mandatory ? t.required : t.optional }],
|
|
38
|
-
card: true,
|
|
39
|
-
actions: input.mandatory ? undefined : [{ type: 'command', appearance: 'primary', title: t.skip, exec: '/skip' }],
|
|
40
|
-
updated: new Date().toISOString(),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
answer(value) {
|
|
44
|
-
this.value[this.inputs[this.index].slug] = value;
|
|
45
|
-
this.skip();
|
|
46
|
-
}
|
|
47
|
-
skip() {
|
|
48
|
-
this.index++;
|
|
49
|
-
if (this.hasFinished())
|
|
50
|
-
this.resolve?.(this.value);
|
|
51
|
-
}
|
|
52
|
-
hasFinished() {
|
|
53
|
-
return this.index === this.inputs.length;
|
|
54
|
-
}
|
|
55
|
-
getValue() {
|
|
56
|
-
return this.promise;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const dictionary = {
|
|
60
|
-
en: {
|
|
61
|
-
required: 'Required information',
|
|
62
|
-
optional: 'Optional information',
|
|
63
|
-
skip: 'Skip',
|
|
64
|
-
},
|
|
65
|
-
pt: {
|
|
66
|
-
required: 'Informação obrigatória',
|
|
67
|
-
optional: 'Informação opcional',
|
|
68
|
-
skip: 'Pular',
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=CustomInputs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CustomInputs.js","sourceRoot":"","sources":["../../src/chat-interceptors/CustomInputs.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAI9C,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAExC,MAAM,OAAO,YAAY;IACf,KAAK,GAA2B,EAAE,CAAA;IAClC,MAAM,CAAuB;IAC7B,KAAK,GAAG,CAAC,CAAA;IACT,OAAO,CAA0C;IACjD,OAAO,CAAiC;IACxC,KAAK,CAAmB;IAEhC,YAAY,MAA6B,EAAE,KAAwB;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC,CAAC,CAAA;IACJ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CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;QAChD,IAAI,CAAC,IAAI,EAAE,CAAA;IACb,CAAC;IAED,IAAI;QACF,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpD,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC1C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,sBAAsB;QAChC,IAAI,EAAE,MAAM;KACb;IACD,EAAE,EAAE;QACF,QAAQ,EAAE,wBAAwB;QAClC,QAAQ,EAAE,qBAAqB;QAC/B,IAAI,EAAE,OAAO;KACd;CACmB,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ChatEntry } from '../state/ChatEntry.js';
|
|
2
|
-
import { ChatState } from '../state/ChatState.js';
|
|
3
|
-
/**
|
|
4
|
-
* This chat interceptor is responsible for interrupting the normal flow of the chat and asking questions about the variables (custom
|
|
5
|
-
* inputs) needed to run the quick command previously typed.
|
|
6
|
-
*
|
|
7
|
-
* The first question is actually asked by the `quickCommandInterceptor`, this registers all answers and asks the next questions (if any).
|
|
8
|
-
*
|
|
9
|
-
* @param entry the chat entry.
|
|
10
|
-
* @param chat the chat state.
|
|
11
|
-
* @returns false if, and only if, this entry is an answer to a quick command question (custom input). Undefined otherwise.
|
|
12
|
-
*/
|
|
13
|
-
export declare function quickCommandQuestionsInterceptor(entry: ChatEntry, chat: ChatState): false | undefined;
|
|
14
|
-
//# sourceMappingURL=quick-command-questions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-command-questions.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/quick-command-questions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,qBAUjF"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { CustomInputs } from './CustomInputs.js';
|
|
2
|
-
/**
|
|
3
|
-
* This chat interceptor is responsible for interrupting the normal flow of the chat and asking questions about the variables (custom
|
|
4
|
-
* inputs) needed to run the quick command previously typed.
|
|
5
|
-
*
|
|
6
|
-
* The first question is actually asked by the `quickCommandInterceptor`, this registers all answers and asks the next questions (if any).
|
|
7
|
-
*
|
|
8
|
-
* @param entry the chat entry.
|
|
9
|
-
* @param chat the chat state.
|
|
10
|
-
* @returns false if, and only if, this entry is an answer to a quick command question (custom input). Undefined otherwise.
|
|
11
|
-
*/
|
|
12
|
-
export function quickCommandQuestionsInterceptor(entry, chat) {
|
|
13
|
-
const { agentType, content } = entry.getValue();
|
|
14
|
-
if (agentType !== 'user')
|
|
15
|
-
return;
|
|
16
|
-
const customInputs = CustomInputs.getCustomInputsFromChat(chat);
|
|
17
|
-
if (!customInputs)
|
|
18
|
-
return;
|
|
19
|
-
if (content === '/skip')
|
|
20
|
-
customInputs.skip();
|
|
21
|
-
else
|
|
22
|
-
customInputs.answer(content);
|
|
23
|
-
if (!customInputs.hasFinished())
|
|
24
|
-
chat.pushMessage(customInputs.ask());
|
|
25
|
-
// prevents next interceptors from running
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=quick-command-questions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-command-questions.js","sourceRoot":"","sources":["../../src/chat-interceptors/quick-command-questions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C;;;;;;;;;GASG;AACH,MAAM,UAAU,gCAAgC,CAAC,KAAgB,EAAE,IAAe;IAChF,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;IAC/C,IAAI,SAAS,KAAK,MAAM;QAAE,OAAM;IAChC,MAAM,YAAY,GAAG,YAAY,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAA;IAC/D,IAAI,CAAC,YAAY;QAAE,OAAM;IACzB,IAAI,OAAO,KAAK,OAAO;QAAE,YAAY,CAAC,IAAI,EAAE,CAAA;;QACvC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;QAAE,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAA;IACrE,0CAA0C;IAC1C,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { editor } from 'monaco-editor';
|
|
2
|
-
import { ChatEntry } from '../state/ChatEntry.js';
|
|
3
|
-
import { ChatState } from '../state/ChatState.js';
|
|
4
|
-
import { WidgetState } from '../state/WidgetState.js';
|
|
5
|
-
/**
|
|
6
|
-
* This creates a chat interceptor for interpreting and running quick commands. We need a function to create the interceptor because, for
|
|
7
|
-
* quick commands, we need access to the full widget state and the editor, which are not provided to a chat interceptor.
|
|
8
|
-
*
|
|
9
|
-
* The quick command interceptor intercepts all user messages (trimmed) that matches the quick command regex. It fetches the quick command
|
|
10
|
-
* from the backend, runs all of its steps and outputs the final response (in the chat or in the editor).
|
|
11
|
-
*
|
|
12
|
-
* @param widget the full widget state.
|
|
13
|
-
* @param getEditor a function that returns the editor instance (monaco).
|
|
14
|
-
* @returns the quick commands chat interceptor.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createQuickCommandInterceptor(widget: WidgetState, getEditor: () => typeof editor | undefined): (entry: ChatEntry, chat: ChatState, signal: AbortSignal) => Promise<false | undefined>;
|
|
17
|
-
//# sourceMappingURL=quick-commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-commands.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/quick-commands.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAyBlD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,MAAM,GAAG,SAAS,WAiZ7D,SAAS,QAAQ,SAAS,UAAU,WAAW,gCA0C9F"}
|
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
import { aiClient, CancelledError, StackspotAPIError } from '@stack-spot/portal-network';
|
|
2
|
-
import { interpolate, translate } from '@stack-spot/portal-translate';
|
|
3
|
-
import { isNil } from 'lodash';
|
|
4
|
-
import { ulid } from 'ulid';
|
|
5
|
-
import { AbortedError } from '../AbortedError.js';
|
|
6
|
-
import { quickCommandRegex } from '../regex.js';
|
|
7
|
-
import { ChatEntry } from '../state/ChatEntry.js';
|
|
8
|
-
import { buildConversationContext } from '../utils/chat.js';
|
|
9
|
-
import { getSizeOfString } from '../utils/string.js';
|
|
10
|
-
import { CustomInputs } from './CustomInputs.js';
|
|
11
|
-
/**
|
|
12
|
-
* While the quick command is running, if it takes more than `progressMessageDelayMS` a progress message is shown.
|
|
13
|
-
* This progress message is shown immediately if one of the steps is of type "LLM".
|
|
14
|
-
*/
|
|
15
|
-
const progressMessageDelayMS = 1000;
|
|
16
|
-
/**
|
|
17
|
-
* This creates a chat interceptor for interpreting and running quick commands. We need a function to create the interceptor because, for
|
|
18
|
-
* quick commands, we need access to the full widget state and the editor, which are not provided to a chat interceptor.
|
|
19
|
-
*
|
|
20
|
-
* The quick command interceptor intercepts all user messages (trimmed) that matches the quick command regex. It fetches the quick command
|
|
21
|
-
* from the backend, runs all of its steps and outputs the final response (in the chat or in the editor).
|
|
22
|
-
*
|
|
23
|
-
* @param widget the full widget state.
|
|
24
|
-
* @param getEditor a function that returns the editor instance (monaco).
|
|
25
|
-
* @returns the quick commands chat interceptor.
|
|
26
|
-
*/
|
|
27
|
-
export function createQuickCommandInterceptor(widget, getEditor) {
|
|
28
|
-
/**
|
|
29
|
-
* This creates a CustomInputs instance in the current chat, which activates the `quickCommandQuestionsInterceptor`. In summary, this asks
|
|
30
|
-
* the first question, wait for all answers to be given and fills the result map in the context passed as parameter.
|
|
31
|
-
*/
|
|
32
|
-
async function computeCustomInputs(ctx) {
|
|
33
|
-
const { chat, qc: { custom_inputs: inputs, name, slug } } = ctx;
|
|
34
|
-
if (!inputs?.length)
|
|
35
|
-
return;
|
|
36
|
-
chat.set('isLoading', false);
|
|
37
|
-
const t = translate(dictionary);
|
|
38
|
-
const customInputs = new CustomInputs(inputs, chat.get('agent'));
|
|
39
|
-
CustomInputs.setCustomInputsForChat(customInputs, chat);
|
|
40
|
-
chat.pushMessage(new ChatEntry({
|
|
41
|
-
agentType: 'bot',
|
|
42
|
-
type: 'text',
|
|
43
|
-
content: interpolate(t.startQuestioning, name || slug),
|
|
44
|
-
}));
|
|
45
|
-
chat.pushMessage(customInputs.ask());
|
|
46
|
-
const inputsValues = await customInputs.getValue();
|
|
47
|
-
chat.set('isLoading', true);
|
|
48
|
-
CustomInputs.deleteCustomInputsFromChat(chat);
|
|
49
|
-
ctx.customInputs = { ...ctx.customInputs, ...inputsValues };
|
|
50
|
-
ctx.context.upload_ids = chat.getMessages()
|
|
51
|
-
.flatMap(message => (message.getValue().upload || []).map(upload => upload.id));
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Runs an Router step of a quick command.
|
|
55
|
-
*/
|
|
56
|
-
async function runRouterStep(ctx, stepIndex, iteration, progress) {
|
|
57
|
-
const { qc: { slug, steps }, code, resultMap, customInputs } = ctx;
|
|
58
|
-
const step = steps[stepIndex];
|
|
59
|
-
const inputData = Object.keys(customInputs).length > 0 && code ? { ...customInputs, [code]: code } : code ?? customInputs;
|
|
60
|
-
try {
|
|
61
|
-
if (step.slug in iteration) {
|
|
62
|
-
iteration[step.slug] = iteration[step.slug] + 1;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
iteration[step.slug] = 1;
|
|
66
|
-
}
|
|
67
|
-
const { next_step_slug } = await aiClient.calculateNextStep.mutate({
|
|
68
|
-
stepSlug: step.slug,
|
|
69
|
-
slug: slug,
|
|
70
|
-
quickCommandEvaluateStepRouterRequest: {
|
|
71
|
-
executions_count: iteration[step.slug],
|
|
72
|
-
input_data: inputData,
|
|
73
|
-
slugs_executions: resultMap,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
if (next_step_slug === step.slug) {
|
|
77
|
-
return runStepsRecursively(stepIndex, progress, ctx, iteration);
|
|
78
|
-
}
|
|
79
|
-
const nextStepIndex = steps?.findIndex((step) => step.slug === next_step_slug);
|
|
80
|
-
if (isNil(nextStepIndex) || nextStepIndex === -1)
|
|
81
|
-
return;
|
|
82
|
-
return runStepsRecursively(nextStepIndex, progress, ctx, iteration);
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
// eslint-disable-next-line no-console
|
|
86
|
-
console.error('Error executing QC step', error);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Runs a fetch step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
|
|
91
|
-
*/
|
|
92
|
-
async function runFetchStep(ctx, stepIndex) {
|
|
93
|
-
const { qc: { slug, steps }, code, context, resultMap, customInputs, executionId, signal } = ctx;
|
|
94
|
-
const step = steps[stepIndex];
|
|
95
|
-
if (step.is_remote) {
|
|
96
|
-
ctx.isRemote = true;
|
|
97
|
-
const { data } = await aiClient.fetchStepOfQuickCommandRemotely.mutate({
|
|
98
|
-
slug, stepSlug: step.slug,
|
|
99
|
-
quickCommandsExecutionRequest: {
|
|
100
|
-
code_selection: code, context, qc_execution_id: executionId,
|
|
101
|
-
slugs_executions: { ...resultMap, ...customInputs },
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
//data is the return of the request in the QC so we do not have full control over the response
|
|
105
|
-
//We handle the usual format with body, status_code and headers, but we might also handle other formats
|
|
106
|
-
const responseData = data;
|
|
107
|
-
resultMap[step.slug] = {
|
|
108
|
-
status: responseData.status_code || 200,
|
|
109
|
-
data: JSON.stringify(responseData.body) ?? JSON.stringify(responseData),
|
|
110
|
-
headers: responseData.headers ?? {},
|
|
111
|
-
};
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const { headers, data, method, url } = await aiClient.fetchStepOfQuickCommand.mutate({
|
|
115
|
-
slug,
|
|
116
|
-
stepSlug: step.slug,
|
|
117
|
-
quickCommandsExecutionRequest: {
|
|
118
|
-
input_data: code, context, qc_execution_id: executionId,
|
|
119
|
-
slugs_executions: { ...resultMap, ...customInputs },
|
|
120
|
-
},
|
|
121
|
-
}, signal);
|
|
122
|
-
const body = ['get', 'head'].includes(method.toLowerCase()) ? undefined : data;
|
|
123
|
-
const response = await fetch(url, { headers: headers || undefined, body, method, signal });
|
|
124
|
-
if (!response.ok)
|
|
125
|
-
throw new Error(`Failed to execute step "${step.slug}" of quick command "${slug}". Status ${response.status}.`);
|
|
126
|
-
resultMap[step.slug] = {
|
|
127
|
-
status: response.status,
|
|
128
|
-
data: await response.text(),
|
|
129
|
-
headers: Object.fromEntries(response.headers.entries()),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Runs an LLM step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
|
|
134
|
-
*/
|
|
135
|
-
async function runLLMStep({ qc: { slug, steps }, code, customInputs, context, executionId, resultMap, signal }, stepIndex) {
|
|
136
|
-
const step = steps[stepIndex];
|
|
137
|
-
let stepContext = context;
|
|
138
|
-
if (!step.use_uploaded_files) {
|
|
139
|
-
const { upload_ids: _upload_ids, ...contextDataProps } = context;
|
|
140
|
-
stepContext = { ...contextDataProps };
|
|
141
|
-
}
|
|
142
|
-
const stream = aiClient.streamLlmStepOfQuickCommand(slug, step.slug, {
|
|
143
|
-
input_data: code,
|
|
144
|
-
context: stepContext,
|
|
145
|
-
qc_execution_id: executionId,
|
|
146
|
-
slugs_executions: { ...resultMap, ...customInputs },
|
|
147
|
-
});
|
|
148
|
-
signal.addEventListener('abort', () => stream.cancel());
|
|
149
|
-
let finalValue;
|
|
150
|
-
try {
|
|
151
|
-
finalValue = await stream.getValue();
|
|
152
|
-
resultMap[step.slug] = finalValue;
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
// eslint-disable-next-line no-console
|
|
156
|
-
console.error('Error executing QC step', error);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function updateProgressMessageForStep(message, qc, stepIndex) {
|
|
160
|
-
const t = translate(dictionary);
|
|
161
|
-
message.setValue({
|
|
162
|
-
...message.getValue(),
|
|
163
|
-
content: interpolate(t.progress, qc.steps?.[stepIndex]?.slug, qc.name || qc.slug),
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
function createProgressMessage(agent) {
|
|
167
|
-
return new ChatEntry({
|
|
168
|
-
agentType: 'bot',
|
|
169
|
-
content: '',
|
|
170
|
-
type: 'text',
|
|
171
|
-
agent,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function showProgressMessage(ctx) {
|
|
175
|
-
const showImmediately = ctx.qc.steps?.some(s => s.type === 'LLM');
|
|
176
|
-
const message = createProgressMessage(ctx.chat.get('agent'));
|
|
177
|
-
const controller = {
|
|
178
|
-
update: (index) => updateProgressMessageForStep(message, ctx.qc, index),
|
|
179
|
-
remove: () => clearTimeout(timeout),
|
|
180
|
-
};
|
|
181
|
-
const timeout = window.setTimeout(() => {
|
|
182
|
-
const chat = ctx.chat;
|
|
183
|
-
chat.pushMessage(message);
|
|
184
|
-
controller.remove = () => chat.popMessage();
|
|
185
|
-
}, showImmediately ? 0 : progressMessageDelayMS);
|
|
186
|
-
return controller;
|
|
187
|
-
}
|
|
188
|
-
async function getScriptStepStatus(scriptExecutionId, interval = 5000, maxAttempts = 500, currentAttempt = 0) {
|
|
189
|
-
if (currentAttempt >= maxAttempts) {
|
|
190
|
-
throw new Error('Max attempts reached in verify script status');
|
|
191
|
-
}
|
|
192
|
-
await aiClient.getStatusScriptStep.invalidate({ scriptExecutionId });
|
|
193
|
-
const response = await aiClient.getStatusScriptStep.query({ scriptExecutionId });
|
|
194
|
-
if (response.status === 'success') {
|
|
195
|
-
return response;
|
|
196
|
-
}
|
|
197
|
-
if (response.status === 'failure') {
|
|
198
|
-
throw response;
|
|
199
|
-
}
|
|
200
|
-
await new Promise(resolve => { setTimeout(resolve, interval); });
|
|
201
|
-
return getScriptStepStatus(scriptExecutionId, interval, maxAttempts, currentAttempt + 1);
|
|
202
|
-
}
|
|
203
|
-
async function runScriptStep({ qc: { slug, steps }, code, context, resultMap, customInputs, signal }, stepIndex) {
|
|
204
|
-
const step = steps[stepIndex];
|
|
205
|
-
let stepContext = context;
|
|
206
|
-
if (!step.use_uploaded_files) {
|
|
207
|
-
const { upload_ids: _upload_ids, ...contextDataProps } = context;
|
|
208
|
-
stepContext = { ...contextDataProps };
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
const { script_execution_id } = await aiClient.startScriptStep.mutate({
|
|
212
|
-
stepSlug: step.slug,
|
|
213
|
-
slug: slug,
|
|
214
|
-
quickCommandStartScriptRequest: {
|
|
215
|
-
input_data: code,
|
|
216
|
-
custom_inputs: customInputs,
|
|
217
|
-
context: stepContext,
|
|
218
|
-
slugs_executions: resultMap,
|
|
219
|
-
},
|
|
220
|
-
}, signal);
|
|
221
|
-
const scriptResult = await getScriptStepStatus(script_execution_id);
|
|
222
|
-
resultMap[step.slug] = scriptResult;
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
throw new Error(`Failed to execute step "${step.slug}" of quick command "${slug}". Error ${error}.`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
async function runStepsRecursively(currentIndex, progress, ctx, iteration) {
|
|
229
|
-
const { qc } = ctx;
|
|
230
|
-
if (!qc.steps || currentIndex >= qc.steps?.length)
|
|
231
|
-
return;
|
|
232
|
-
progress.update(currentIndex);
|
|
233
|
-
if (qc.steps[currentIndex].type === 'ROUTER') {
|
|
234
|
-
await runRouterStep(ctx, currentIndex, iteration, progress);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
if (qc.steps[currentIndex].type === 'SCRIPT') {
|
|
238
|
-
await runScriptStep(ctx, currentIndex);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
await (qc.steps[currentIndex].type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex));
|
|
242
|
-
}
|
|
243
|
-
const currentStep = qc.steps?.[currentIndex];
|
|
244
|
-
let nextIndex = currentIndex + 1;
|
|
245
|
-
let nextStepSlug = currentStep.next_step_slug;
|
|
246
|
-
const stepResult = ctx.resultMap[currentStep.slug];
|
|
247
|
-
if (stepResult && typeof stepResult !== 'string' && 'answer_status' in stepResult && !!stepResult.answer_status?.next_step_slug) {
|
|
248
|
-
nextStepSlug = stepResult.answer_status.next_step_slug;
|
|
249
|
-
}
|
|
250
|
-
if (nextStepSlug) {
|
|
251
|
-
nextIndex = nextStepSlug === 'end' ?
|
|
252
|
-
qc.steps.length : qc.steps?.findIndex((step) => step.slug === nextStepSlug);
|
|
253
|
-
}
|
|
254
|
-
await runStepsRecursively(nextIndex, progress, ctx, iteration);
|
|
255
|
-
}
|
|
256
|
-
async function runSteps(ctx) {
|
|
257
|
-
const progress = showProgressMessage(ctx);
|
|
258
|
-
try {
|
|
259
|
-
await runStepsRecursively(0, progress, ctx, {});
|
|
260
|
-
}
|
|
261
|
-
finally {
|
|
262
|
-
progress.remove();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
async function formatResult({ qc, code, executionId, context, resultMap, customInputs, signal }) {
|
|
266
|
-
const formatted = await aiClient.formatResultOfQuickCommand.mutate({
|
|
267
|
-
slug: qc.slug,
|
|
268
|
-
quickCommandsExecutionRequest: {
|
|
269
|
-
input_data: code,
|
|
270
|
-
context,
|
|
271
|
-
qc_execution_id: executionId,
|
|
272
|
-
slugs_executions: { ...resultMap, ...customInputs },
|
|
273
|
-
},
|
|
274
|
-
}, signal);
|
|
275
|
-
return formatted.result;
|
|
276
|
-
}
|
|
277
|
-
// opens a new chat tab if the quick command doesn't preserve the conversation and the current conversation isn't clean.
|
|
278
|
-
function manageConversationContext(ctx) {
|
|
279
|
-
if (!ctx.qc.preserve_conversation && ctx.chat.getMessages().length > 1) {
|
|
280
|
-
if (ctx.qc.return_type === 'CHAT') {
|
|
281
|
-
ctx.chat.set('isLoading', false);
|
|
282
|
-
ctx.chat = ctx.chat.transferToNewChat(ctx.qc.name || ctx.qc.slug);
|
|
283
|
-
ctx.chat.set('isLoading', true);
|
|
284
|
-
widget.chatTabs.add(ctx.chat);
|
|
285
|
-
widget.chatTabs.select(ctx.chat.id);
|
|
286
|
-
ctx.context.conversation_id = ctx.chat.id;
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
// if we're running a command in the editor, we don't need to open a new tab, we just need to run it in a new conversation context.
|
|
290
|
-
ctx.context.conversation_id = ulid();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
async function runQuickCommand(ctx) {
|
|
295
|
-
const { qc: { slug }, code } = ctx;
|
|
296
|
-
const t = translate(dictionary);
|
|
297
|
-
ctx.signal.addEventListener('abort', () => aiClient.quickCommand.cancel({ slug }));
|
|
298
|
-
await aiClient.quickCommand.invalidate({ slug });
|
|
299
|
-
try {
|
|
300
|
-
ctx.qc = await aiClient.quickCommand.query({ slug });
|
|
301
|
-
}
|
|
302
|
-
catch (error) {
|
|
303
|
-
throw error instanceof StackspotAPIError && error.status === 404 ? new Error(t.notFound) : error;
|
|
304
|
-
}
|
|
305
|
-
if (ctx.qc.use_selected_code && (!code && ctx.context.upload_ids?.length === 0)) {
|
|
306
|
-
widget.set('panel', 'editor');
|
|
307
|
-
ctx.chat.pushMessage(new ChatEntry({
|
|
308
|
-
agentType: 'bot',
|
|
309
|
-
type: 'text',
|
|
310
|
-
agent: ctx.chat.get('agent'),
|
|
311
|
-
content: t.requiresSelection,
|
|
312
|
-
}));
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
manageConversationContext(ctx);
|
|
316
|
-
await computeCustomInputs(ctx);
|
|
317
|
-
await runSteps(ctx);
|
|
318
|
-
return formatResult(ctx);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* This registers a quick command event in the backend (analytics).
|
|
322
|
-
*/
|
|
323
|
-
async function registerAnalyticsEvent({ qc, isRemote, executionId, code = '', context }, status, start) {
|
|
324
|
-
const now = new Date().getTime();
|
|
325
|
-
try {
|
|
326
|
-
await aiClient.createEvent.mutate({
|
|
327
|
-
body: [{
|
|
328
|
-
type: 'custom_quick_command_execution',
|
|
329
|
-
quick_command_event: {
|
|
330
|
-
type: qc.type || '',
|
|
331
|
-
duration_execution: now - start,
|
|
332
|
-
status_execution: status,
|
|
333
|
-
slug: qc.slug,
|
|
334
|
-
qc_execution_id: executionId,
|
|
335
|
-
id: qc.id,
|
|
336
|
-
//@ts-ignore
|
|
337
|
-
is_remote: isRemote,
|
|
338
|
-
},
|
|
339
|
-
code,
|
|
340
|
-
context,
|
|
341
|
-
knowledge_sources: [],
|
|
342
|
-
size: getSizeOfString(code),
|
|
343
|
-
generated_at: now,
|
|
344
|
-
}],
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
catch (error) {
|
|
348
|
-
// eslint-disable-next-line no-console
|
|
349
|
-
console.warn('Failed to register event: quick command.');
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Writes the result in the chat or in the editor.
|
|
354
|
-
*/
|
|
355
|
-
function outputResult({ qc, chat, code }, result) {
|
|
356
|
-
if (qc.return_type === 'CHAT') {
|
|
357
|
-
chat.pushMessage(new ChatEntry({
|
|
358
|
-
agentType: 'bot',
|
|
359
|
-
content: result,
|
|
360
|
-
agent: chat.get('agent'),
|
|
361
|
-
type: 'md',
|
|
362
|
-
updated: new Date().toISOString(),
|
|
363
|
-
}));
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
const editor = getEditor()?.getEditors()[0];
|
|
367
|
-
let finalCode = result;
|
|
368
|
-
if (qc.return_type === 'BEFORE_CODE')
|
|
369
|
-
finalCode = `${result}\n${code}`;
|
|
370
|
-
else if (qc.return_type === 'AFTER_CODE')
|
|
371
|
-
finalCode = `${code}\n${result}`;
|
|
372
|
-
finalCode = finalCode.replace(/(\$[{a-z]|\})/g, '\\$1');
|
|
373
|
-
editor?.trigger('keyboard', 'type', { text: finalCode });
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* The chat interceptor itself.
|
|
378
|
-
* @param entry the chat entry.
|
|
379
|
-
* @param chat the chat state.
|
|
380
|
-
* @param signal a signal that can be canceled by the user.
|
|
381
|
-
* @returns false if, and only if, this entry (trimmed) matches the quick command regex. Undefined otherwise.
|
|
382
|
-
*/
|
|
383
|
-
async function quickCommandInterceptor(entry, chat, signal) {
|
|
384
|
-
const { agentType, content } = entry.getValue();
|
|
385
|
-
if (!chat.get('features')?.quickCommands || agentType !== 'user' || !quickCommandRegex.test(content.trim()))
|
|
386
|
-
return;
|
|
387
|
-
const t = translate(dictionary);
|
|
388
|
-
const slug = content.trim().substring(1);
|
|
389
|
-
const ctx = {
|
|
390
|
-
qc: { slug },
|
|
391
|
-
chat,
|
|
392
|
-
code: chat.get('codeSelection'),
|
|
393
|
-
context: buildConversationContext(chat, entry) ?? {},
|
|
394
|
-
executionId: ulid(),
|
|
395
|
-
resultMap: {},
|
|
396
|
-
customInputs: {},
|
|
397
|
-
signal,
|
|
398
|
-
};
|
|
399
|
-
chat.set('isLoading', true);
|
|
400
|
-
const start = new Date().getTime();
|
|
401
|
-
try {
|
|
402
|
-
const result = await runQuickCommand(ctx);
|
|
403
|
-
if (result) {
|
|
404
|
-
outputResult(ctx, result);
|
|
405
|
-
registerAnalyticsEvent(ctx, '200', start);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
catch (error) {
|
|
409
|
-
let message = error.message || `${error}`;
|
|
410
|
-
if (error instanceof AbortedError || error instanceof CancelledError)
|
|
411
|
-
message = t.aborted;
|
|
412
|
-
else if (error instanceof StackspotAPIError)
|
|
413
|
-
message = error.translate();
|
|
414
|
-
ctx.chat.pushMessage(new ChatEntry({
|
|
415
|
-
agentType: 'bot',
|
|
416
|
-
content: '',
|
|
417
|
-
error: message,
|
|
418
|
-
agent: chat.get('agent'),
|
|
419
|
-
type: 'text',
|
|
420
|
-
}));
|
|
421
|
-
registerAnalyticsEvent(ctx, message, start);
|
|
422
|
-
}
|
|
423
|
-
ctx.chat.set('isLoading', false);
|
|
424
|
-
// prevents the next interceptors from running
|
|
425
|
-
return false;
|
|
426
|
-
}
|
|
427
|
-
return quickCommandInterceptor;
|
|
428
|
-
}
|
|
429
|
-
const dictionary = {
|
|
430
|
-
en: {
|
|
431
|
-
requiresSelection: 'Select the code in the editor next to it for this quick command to interact with it.',
|
|
432
|
-
startQuestioning: 'To execute the Quick Command "$0", I\'ll need you to provide some information. Some may be mandatory, and others optional. Let\'s get started.',
|
|
433
|
-
progress: 'Running step "$0" from Quick Command "$1".',
|
|
434
|
-
aborted: 'The quick command execution aborted by the user.',
|
|
435
|
-
notFound: 'There\'s no quick command with the provided name. If you don\'t wish to run a command, prefix the first "/" with a "\\".',
|
|
436
|
-
},
|
|
437
|
-
pt: {
|
|
438
|
-
requiresSelection: 'Selecione o código no editor ao lado para que este quick command possa interagir com ele.',
|
|
439
|
-
startQuestioning: 'Para executar o Quick Command "$0", vou precisar que você providencie algumas explicações. Algumas são obrigatórias e outras opcionais. Vamos começar.',
|
|
440
|
-
progress: 'Executando step "$0" do Quick Command "$1".',
|
|
441
|
-
aborted: 'A execução do quick command foi abortada pelo usuário.',
|
|
442
|
-
notFound: 'Não existe quick command com o nome providenciado. Se você não quiser rodar um comando, prefixe o primeiro "/" com um "\\".',
|
|
443
|
-
},
|
|
444
|
-
};
|
|
445
|
-
//# sourceMappingURL=quick-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-commands.js","sourceRoot":"","sources":["../../src/chat-interceptors/quick-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE1G,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAI9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAgB7C;;;GAGG;AACH,MAAM,sBAAsB,GA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Y,cAAc;gBAAE,OAAO,GAAG,CAAC,CAAC,OAAO,CAAA;iBACpF,IAAI,KAAK,YAAY,iBAAiB;gBAAE,OAAO,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;YACxE,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,SAAS,CAAC;gBACjC,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;gBACxB,IAAI,EAAE,MAAM;aACb,CAAC,CAAC,CAAA;YACH,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;QAC7C,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;QAChC,8CAA8C;QAC9C,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,uBAAuB,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,iBAAiB,EAAE,sFAAsF;QACzG,gBAAgB,EAAE,gJAAgJ;QAClK,QAAQ,EAAE,4CAA4C;QACtD,OAAO,EAAE,kDAAkD;QAC3D,QAAQ,EAAE,0HAA0H;KACrI;IACD,EAAE,EAAE;QACF,iBAAiB,EAAE,2FAA2F;QAC9G,gBAAgB,EAAE,wJAAwJ;QAC1K,QAAQ,EAAE,6CAA6C;QACvD,OAAO,EAAE,wDAAwD;QACjE,QAAQ,EAAE,6HAA6H;KACxI;CACmB,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ChatResponseWithPMResources, ChatResponseWithSteps } from '@stack-spot/portal-network';
|
|
2
|
-
import { ChatEntry, KnowledgeSource, TextChatEntry } from '../state/ChatEntry.js';
|
|
3
|
-
import { ChatState } from '../state/ChatState.js';
|
|
4
|
-
import { LabeledWithImage } from '../state/types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Transforms a chat response from the backend into a chat entry that can be added to the chat.
|
|
7
|
-
* @param response the original response.
|
|
8
|
-
* @param knowledgeSources the knowledge sources already in format used by the chat.
|
|
9
|
-
* @param agent the current chat agent.
|
|
10
|
-
* @param tools the tools for the current chat agent.
|
|
11
|
-
* @param includeDate whether or not to include the date in the chat entry.
|
|
12
|
-
* @returns the TextChatEntry to build a ChatEntry.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createEntryValueFromChatResponse(response: Partial<ChatResponseWithSteps> & ChatResponseWithPMResources, knowledgeSources: KnowledgeSource[] | undefined, agent: LabeledWithImage | undefined, includeDate?: boolean): TextChatEntry;
|
|
15
|
-
export declare function helperSendMessage(messages: ChatEntry[], value: Partial<ChatResponseWithSteps> & {
|
|
16
|
-
opportunities?: any;
|
|
17
|
-
}, chat: ChatState, botEntry: ChatEntry, knowledgeSources: KnowledgeSource[] | undefined): void;
|
|
18
|
-
/**
|
|
19
|
-
* The chat interceptor that sends the message to the AI agent, interprets the response and adds it to the chat.
|
|
20
|
-
*
|
|
21
|
-
* The message added to the chat is streamed, i.e. it changes over time, until it's completed.
|
|
22
|
-
*
|
|
23
|
-
* @param entry the chat entry.
|
|
24
|
-
* @param chat the chat state.
|
|
25
|
-
* @param signal a signal that can be canceled by the user.
|
|
26
|
-
* @returns undefined
|
|
27
|
-
*/
|
|
28
|
-
export declare function sendMessageInterceptor(entry: ChatEntry, chat: ChatState, signal: AbortSignal): Promise<void>;
|
|
29
|
-
//# sourceMappingURL=send-message.d.ts.map
|