@stack-spot/ai-chat-widget 0.11.0 → 1.0.0-dev.1768324407795
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/CHANGELOG.md +972 -0
- package/README.md +1 -0
- package/dist/StackspotAIWidget.d.ts +48 -7
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +22 -23
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +175 -0
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +4 -1
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -1
- package/dist/chat-interceptors/CustomInputs.js +10 -1
- package/dist/chat-interceptors/CustomInputs.js.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +10 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.js +12 -2
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -1
- package/dist/chat-interceptors/quick-commands.d.ts +11 -0
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +241 -48
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +26 -1
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +227 -26
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +15 -3
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +22 -10
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts +4 -0
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -0
- package/dist/components/AgentCard/AgentCardCreate.js +33 -0
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -0
- package/dist/components/AgentCard/dictionary.d.ts +23 -0
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -0
- package/dist/components/AgentCard/dictionary.js +23 -0
- package/dist/components/AgentCard/dictionary.js.map +1 -0
- package/dist/components/AgentCard/index.d.ts +5 -0
- package/dist/components/AgentCard/index.d.ts.map +1 -0
- package/dist/components/AgentCard/index.js +55 -0
- package/dist/components/AgentCard/index.js.map +1 -0
- package/dist/components/AnimatedOpacity.d.ts +8 -0
- package/dist/components/AnimatedOpacity.d.ts.map +1 -0
- package/dist/components/AnimatedOpacity.js +46 -0
- package/dist/components/AnimatedOpacity.js.map +1 -0
- package/dist/components/AutoFocus.d.ts +23 -0
- package/dist/components/AutoFocus.d.ts.map +1 -0
- package/dist/components/AutoFocus.js +23 -0
- package/dist/components/AutoFocus.js.map +1 -0
- package/dist/components/ButtonFavorite.d.ts +40 -0
- package/dist/components/ButtonFavorite.d.ts.map +1 -0
- package/dist/components/ButtonFavorite.js +25 -0
- package/dist/components/ButtonFavorite.js.map +1 -0
- package/dist/components/Code.d.ts +2 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +52 -24
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts +38 -0
- package/dist/components/ComponentNavigator.d.ts.map +1 -0
- package/dist/components/ComponentNavigator.js +31 -0
- package/dist/components/ComponentNavigator.js.map +1 -0
- package/dist/components/Fading.d.ts +32 -0
- package/dist/components/Fading.d.ts.map +1 -0
- package/dist/components/Fading.js +33 -0
- package/dist/components/Fading.js.map +1 -0
- package/dist/components/FadingOverflow.d.ts +25 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +16 -8
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts +10 -0
- package/dist/components/FileDescription.d.ts.map +1 -0
- package/dist/components/FileDescription.js +84 -0
- package/dist/components/FileDescription.js.map +1 -0
- package/dist/components/HistoryList.d.ts +15 -0
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +6 -2
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/ListResource.d.ts +29 -0
- package/dist/components/ListResource.d.ts.map +1 -0
- package/dist/components/ListResource.js +17 -0
- package/dist/components/ListResource.js.map +1 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +2 -2
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Modal.d.ts +9 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +56 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/QuickStartButton.d.ts +2 -4
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +7 -39
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelContentList.d.ts +10 -0
- package/dist/components/RightPanelContentList.d.ts.map +1 -0
- package/dist/components/RightPanelContentList.js +7 -0
- package/dist/components/RightPanelContentList.js.map +1 -0
- package/dist/components/RightPanelForm.d.ts +3 -0
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +57 -17
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +4 -4
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +7 -16
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts +54 -0
- package/dist/components/Selector/index.d.ts.map +1 -0
- package/dist/components/Selector/index.js +143 -0
- package/dist/components/Selector/index.js.map +1 -0
- package/dist/components/Selector/styled.d.ts +4 -0
- package/dist/components/Selector/styled.d.ts.map +1 -0
- package/dist/components/Selector/styled.js +157 -0
- package/dist/components/Selector/styled.js.map +1 -0
- package/dist/components/StackedBadge.d.ts +14 -0
- package/dist/components/StackedBadge.d.ts.map +1 -0
- package/dist/components/StackedBadge.js +56 -0
- package/dist/components/StackedBadge.js.map +1 -0
- package/dist/components/TabManager.d.ts +6 -0
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +16 -28
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +9 -0
- package/dist/components/ToolBadge.d.ts.map +1 -0
- package/dist/components/ToolBadge.js +34 -0
- package/dist/components/ToolBadge.js.map +1 -0
- package/dist/components/WorkspaceTabNavigator.d.ts +17 -0
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -0
- package/dist/components/WorkspaceTabNavigator.js +93 -0
- package/dist/components/WorkspaceTabNavigator.js.map +1 -0
- package/dist/components/form/DescribedCheckboxGroup.d.ts +30 -2
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +75 -21
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +31 -2
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +65 -16
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/components/form/dictionary.d.ts +19 -0
- package/dist/components/form/dictionary.d.ts.map +1 -0
- package/dist/components/form/dictionary.js +19 -0
- package/dist/components/form/dictionary.js.map +1 -0
- package/dist/components/form/styled.d.ts.map +1 -1
- package/dist/components/form/styled.js +1 -2
- package/dist/components/form/styled.js.map +1 -1
- package/dist/components/form/types.d.ts +42 -0
- package/dist/components/form/types.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.d.ts +19 -0
- package/dist/context/AIWidgetProvider.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.js +19 -0
- package/dist/context/AIWidgetProvider.js.map +1 -1
- package/dist/context/hooks.d.ts +61 -4
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +83 -13
- package/dist/context/hooks.js.map +1 -1
- package/dist/features.d.ts +72 -10
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +23 -8
- package/dist/features.js.map +1 -1
- package/dist/hooks/midnight-update-view.d.ts +5 -0
- package/dist/hooks/midnight-update-view.d.ts.map +1 -0
- package/dist/hooks/midnight-update-view.js +30 -0
- package/dist/hooks/midnight-update-view.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.css +95 -28
- package/dist/regex.d.ts +3 -0
- package/dist/regex.d.ts.map +1 -0
- package/dist/regex.js +3 -0
- package/dist/regex.js.map +1 -0
- package/dist/right-panel/DefaultPanel.d.ts +3 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +5 -4
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/right-panel/RightPanel.d.ts +3 -0
- package/dist/right-panel/RightPanel.d.ts.map +1 -1
- package/dist/right-panel/RightPanel.js +3 -0
- package/dist/right-panel/RightPanel.js.map +1 -1
- package/dist/right-panel/RightPanelProvider.d.ts +15 -0
- package/dist/right-panel/RightPanelProvider.d.ts.map +1 -1
- package/dist/right-panel/RightPanelProvider.js.map +1 -1
- package/dist/right-panel/constants.d.ts +2 -0
- package/dist/right-panel/constants.d.ts.map +1 -0
- package/dist/right-panel/constants.js +2 -0
- package/dist/right-panel/constants.js.map +1 -0
- package/dist/right-panel/hooks.d.ts +6 -0
- package/dist/right-panel/hooks.d.ts.map +1 -1
- package/dist/right-panel/hooks.js +8 -1
- package/dist/right-panel/hooks.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +182 -8
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +26 -3
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +116 -14
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +49 -8
- package/dist/state/ChatState.js.map +1 -1
- package/dist/state/ChatTabsController.d.ts +50 -1
- package/dist/state/ChatTabsController.d.ts.map +1 -1
- package/dist/state/ChatTabsController.js +77 -8
- package/dist/state/ChatTabsController.js.map +1 -1
- package/dist/state/ObservableState.d.ts +14 -0
- package/dist/state/ObservableState.d.ts.map +1 -1
- package/dist/state/ObservableState.js +14 -0
- package/dist/state/ObservableState.js.map +1 -1
- package/dist/state/WidgetState.d.ts +62 -2
- package/dist/state/WidgetState.d.ts.map +1 -1
- package/dist/state/WidgetState.js +49 -2
- package/dist/state/WidgetState.js.map +1 -1
- package/dist/state/constants.d.ts +5 -0
- package/dist/state/constants.d.ts.map +1 -0
- package/dist/state/constants.js +10 -0
- package/dist/state/constants.js.map +1 -0
- package/dist/state/types.d.ts +10 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/types.d.ts +20 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/chat.d.ts +11 -4
- package/dist/utils/chat.d.ts.map +1 -1
- package/dist/utils/chat.js +13 -11
- package/dist/utils/chat.js.map +1 -1
- package/dist/utils/check-is-trial.d.ts +2 -0
- package/dist/utils/check-is-trial.d.ts.map +1 -0
- package/dist/utils/check-is-trial.js +6 -0
- package/dist/utils/check-is-trial.js.map +1 -0
- package/dist/utils/copy-to-clipboard.d.ts +6 -0
- package/dist/utils/copy-to-clipboard.d.ts.map +1 -0
- package/dist/utils/copy-to-clipboard.js +30 -0
- package/dist/utils/copy-to-clipboard.js.map +1 -0
- package/dist/utils/date.d.ts +26 -2
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +28 -3
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/download.d.ts +5 -0
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +5 -0
- package/dist/utils/download.js.map +1 -1
- package/dist/utils/error.d.ts +2 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +54 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/knowledge-source.d.ts +12 -2
- package/dist/utils/knowledge-source.d.ts.map +1 -1
- package/dist/utils/knowledge-source.js +16 -0
- package/dist/utils/knowledge-source.js.map +1 -1
- package/dist/utils/planning-tool.d.ts +17 -0
- package/dist/utils/planning-tool.d.ts.map +1 -0
- package/dist/utils/planning-tool.js +32 -0
- package/dist/utils/planning-tool.js.map +1 -0
- package/dist/utils/programming-languages.d.ts.map +1 -1
- package/dist/utils/programming-languages.js +10 -0
- package/dist/utils/programming-languages.js.map +1 -1
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +5 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/tools.d.ts +23 -0
- package/dist/utils/tools.d.ts.map +1 -0
- package/dist/utils/tools.js +23 -0
- package/dist/utils/tools.js.map +1 -0
- package/dist/utils/update-tool-step.d.ts +3 -0
- package/dist/utils/update-tool-step.d.ts.map +1 -0
- package/dist/utils/update-tool-step.js +23 -0
- package/dist/utils/update-tool-step.js.map +1 -0
- package/dist/utils/upload/FileUpload.d.ts +21 -0
- package/dist/utils/upload/FileUpload.d.ts.map +1 -0
- package/dist/utils/upload/FileUpload.js +54 -0
- package/dist/utils/upload/FileUpload.js.map +1 -0
- package/dist/utils/upload/UploadManager.d.ts +42 -0
- package/dist/utils/upload/UploadManager.d.ts.map +1 -0
- package/dist/utils/upload/UploadManager.js +138 -0
- package/dist/utils/upload/UploadManager.js.map +1 -0
- package/dist/utils/upload/context.d.ts +15 -0
- package/dist/utils/upload/context.d.ts.map +1 -0
- package/dist/utils/upload/context.js +37 -0
- package/dist/utils/upload/context.js.map +1 -0
- package/dist/utils/upload/errors.d.ts +17 -0
- package/dist/utils/upload/errors.d.ts.map +1 -0
- package/dist/utils/upload/errors.js +27 -0
- package/dist/utils/upload/errors.js.map +1 -0
- package/dist/utils/upload/types.d.ts +7 -0
- package/dist/utils/upload/types.d.ts.map +1 -0
- package/dist/{components/Tooltip → utils/upload}/types.js.map +1 -1
- package/dist/utils/upload/use-paste-upload.d.ts +8 -0
- package/dist/utils/upload/use-paste-upload.d.ts.map +1 -0
- package/dist/utils/upload/use-paste-upload.js +19 -0
- package/dist/utils/upload/use-paste-upload.js.map +1 -0
- package/dist/utils/upload/utils.d.ts +4 -0
- package/dist/utils/upload/utils.d.ts.map +1 -0
- package/dist/utils/upload/utils.js +10 -0
- package/dist/utils/upload/utils.js.map +1 -0
- package/dist/utils/url.d.ts +2 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +8 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/views/Agents/AgentDescription.d.ts +4 -0
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -0
- package/dist/views/Agents/AgentDescription.js +38 -0
- package/dist/views/Agents/AgentDescription.js.map +1 -0
- package/dist/views/Agents/AgentsPanel.d.ts +5 -0
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -0
- package/dist/views/Agents/AgentsPanel.js +45 -0
- package/dist/views/Agents/AgentsPanel.js.map +1 -0
- package/dist/views/Agents/AgentsTab.d.ts +11 -0
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -0
- package/dist/views/Agents/AgentsTab.js +82 -0
- package/dist/views/Agents/AgentsTab.js.map +1 -0
- package/dist/views/Agents/dictionary.d.ts +2 -0
- package/dist/views/Agents/dictionary.d.ts.map +1 -0
- package/dist/views/Agents/dictionary.js +43 -0
- package/dist/views/Agents/dictionary.js.map +1 -0
- package/dist/views/Agents/index.d.ts +5 -0
- package/dist/views/Agents/index.d.ts.map +1 -0
- package/dist/views/Agents/index.js +21 -0
- package/dist/views/Agents/index.js.map +1 -0
- package/dist/views/Agents/styled.d.ts +3 -0
- package/dist/views/Agents/styled.d.ts.map +1 -0
- package/dist/views/Agents/styled.js +68 -0
- package/dist/views/Agents/styled.js.map +1 -0
- package/dist/views/Agents/useAgentFavorites.d.ts +8 -0
- package/dist/views/Agents/useAgentFavorites.d.ts.map +1 -0
- package/dist/views/Agents/useAgentFavorites.js +59 -0
- package/dist/views/Agents/useAgentFavorites.js.map +1 -0
- package/dist/views/Chat/AgentInfo.d.ts +5 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +6 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts +5 -0
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +1 -0
- package/dist/views/Chat/ButtonExecutionDetail.js +34 -0
- package/dist/views/Chat/ButtonExecutionDetail.js.map +1 -0
- package/dist/views/Chat/ChatMessage.d.ts +56 -4
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +160 -24
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +6 -2
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +5 -2
- package/dist/views/Chat/ChatMessages.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +14 -0
- package/dist/views/Chat/StepsList.d.ts.map +1 -0
- package/dist/views/Chat/StepsList.js +192 -0
- package/dist/views/Chat/StepsList.js.map +1 -0
- package/dist/views/Chat/chat-scroll.d.ts +1 -1
- package/dist/views/Chat/chat-scroll.js +1 -1
- package/dist/views/Chat/events.d.ts +22 -0
- package/dist/views/Chat/events.d.ts.map +1 -0
- package/dist/views/Chat/events.js +67 -0
- package/dist/views/Chat/events.js.map +1 -0
- package/dist/views/Chat/index.d.ts +9 -2
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +5 -2
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/Chat/styled.d.ts +3 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +152 -31
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +4 -4
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +6 -2
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +4 -3
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +16 -37
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/dictionary.d.ts +1 -1
- package/dist/views/ChatHistory/index.d.ts +4 -4
- package/dist/views/ChatHistory/index.d.ts.map +1 -1
- package/dist/views/ChatHistory/index.js +6 -3
- package/dist/views/ChatHistory/index.js.map +1 -1
- package/dist/views/ChatHistory/styled.d.ts.map +1 -1
- package/dist/views/ChatHistory/styled.js +3 -5
- package/dist/views/ChatHistory/styled.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +17 -2
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +140 -9
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +6 -4
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +40 -15
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts +3 -0
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +23 -16
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts +6 -0
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -0
- package/dist/views/Home/BuiltInAgent.js +37 -0
- package/dist/views/Home/BuiltInAgent.js.map +1 -0
- package/dist/views/Home/CustomAgent.d.ts +5 -0
- package/dist/views/Home/CustomAgent.d.ts.map +1 -0
- package/dist/views/Home/CustomAgent.js +23 -0
- package/dist/views/Home/CustomAgent.js.map +1 -0
- package/dist/views/Home/index.d.ts +8 -0
- package/dist/views/Home/index.d.ts.map +1 -0
- package/dist/views/Home/index.js +34 -0
- package/dist/views/Home/index.js.map +1 -0
- package/dist/views/Home/styled.d.ts +2 -0
- package/dist/views/Home/styled.d.ts.map +1 -0
- package/dist/views/Home/styled.js +74 -0
- package/dist/views/Home/styled.js.map +1 -0
- package/dist/views/Home/types.d.ts +16 -0
- package/dist/views/Home/types.d.ts.map +1 -0
- package/dist/views/Home/types.js +2 -0
- package/dist/views/Home/types.js.map +1 -0
- package/dist/views/KSDocument.d.ts +3 -0
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +7 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +12 -0
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +123 -33
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts +5 -0
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/AgentSelector.js +66 -0
- package/dist/views/MessageInput/AgentSelector.js.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts +2 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.js +35 -0
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -0
- package/dist/views/MessageInput/ButtonBar.d.ts +13 -0
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonBar.js +15 -0
- package/dist/views/MessageInput/ButtonBar.js.map +1 -0
- package/dist/views/MessageInput/ContextBar.d.ts +9 -0
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ContextBar.js +51 -0
- package/dist/views/MessageInput/ContextBar.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts +2 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js +25 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +30 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js +91 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +5 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.js +104 -0
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -0
- package/dist/views/MessageInput/SelectContent.d.ts +2 -0
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -0
- package/dist/views/MessageInput/SelectContent.js +84 -0
- package/dist/views/MessageInput/SelectContent.js.map +1 -0
- package/dist/views/MessageInput/UploadBar.d.ts +2 -0
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadBar.js +74 -0
- package/dist/views/MessageInput/UploadBar.js.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts +14 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.js +51 -0
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts +11 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.js +78 -0
- package/dist/views/MessageInput/chat-entry-history.js.map +1 -0
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +52 -10
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +9 -6
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +112 -20
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +13 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +223 -85
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts +4 -0
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +9 -7
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Resources.d.ts +2 -0
- package/dist/views/Resources.d.ts.map +1 -0
- package/dist/views/Resources.js +69 -0
- package/dist/views/Resources.js.map +1 -0
- package/dist/views/Stacks.d.ts +12 -0
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +117 -21
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts +10 -0
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js +4 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts +15 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js +41 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts +10 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.js +13 -0
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts +7 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.js +31 -0
- package/dist/views/Steps/FlowChart/hooks.js.map +1 -0
- package/dist/views/Steps/FlowChart/index.d.ts +12 -0
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/index.js +78 -0
- package/dist/views/Steps/FlowChart/index.js.map +1 -0
- package/dist/views/Steps/FlowChart/layout.d.ts +8 -0
- package/dist/views/Steps/FlowChart/layout.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/layout.js +59 -0
- package/dist/views/Steps/FlowChart/layout.js.map +1 -0
- package/dist/views/Steps/FlowChart/styled.d.ts +14 -0
- package/dist/views/Steps/FlowChart/styled.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/styled.js +156 -0
- package/dist/views/Steps/FlowChart/styled.js.map +1 -0
- package/dist/views/Steps/FlowChart/types.d.ts +25 -0
- package/dist/views/Steps/FlowChart/types.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/types.js +2 -0
- package/dist/views/Steps/FlowChart/types.js.map +1 -0
- package/dist/views/Steps/StepModal.d.ts +10 -0
- package/dist/views/Steps/StepModal.d.ts.map +1 -0
- package/dist/views/Steps/StepModal.js +139 -0
- package/dist/views/Steps/StepModal.js.map +1 -0
- package/dist/views/Steps/StepsPanel.d.ts +6 -0
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -0
- package/dist/views/Steps/StepsPanel.js +18 -0
- package/dist/views/Steps/StepsPanel.js.map +1 -0
- package/dist/views/Steps/dictionary.d.ts +43 -0
- package/dist/views/Steps/dictionary.d.ts.map +1 -0
- package/dist/views/Steps/dictionary.js +45 -0
- package/dist/views/Steps/dictionary.js.map +1 -0
- package/dist/views/Steps/index.d.ts +5 -0
- package/dist/views/Steps/index.d.ts.map +1 -0
- package/dist/views/Steps/index.js +30 -0
- package/dist/views/Steps/index.js.map +1 -0
- package/dist/views/Steps/utils.d.ts +7 -0
- package/dist/views/Steps/utils.d.ts.map +1 -0
- package/dist/views/Steps/utils.js +32 -0
- package/dist/views/Steps/utils.js.map +1 -0
- package/dist/views/Tools.d.ts +2 -0
- package/dist/views/Tools.d.ts.map +1 -0
- package/dist/views/Tools.js +53 -0
- package/dist/views/Tools.js.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts +20 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.js +61 -0
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -0
- package/dist/views/Workspaces/index.d.ts +5 -0
- package/dist/views/Workspaces/index.d.ts.map +1 -0
- package/dist/views/Workspaces/index.js +69 -0
- package/dist/views/Workspaces/index.js.map +1 -0
- package/package.dev.json +3 -0
- package/package.json +21 -13
- package/package.stg.json +4 -0
- package/src/StackspotAIWidget.tsx +96 -37
- package/src/app-metadata.json +175 -0
- package/src/assets/placeholder.png +0 -0
- package/src/chat-interceptors/CustomInputs.ts +14 -1
- package/src/chat-interceptors/quick-command-questions.ts +12 -2
- package/src/chat-interceptors/quick-commands.ts +286 -52
- package/src/chat-interceptors/send-message.ts +253 -25
- package/src/components/AdaptiveTextArea.tsx +36 -11
- package/src/components/AgentCard/AgentCardCreate.tsx +42 -0
- package/src/components/AgentCard/dictionary.ts +25 -0
- package/src/components/AgentCard/index.tsx +82 -0
- package/src/components/AnimatedOpacity.tsx +55 -0
- package/src/components/AutoFocus.tsx +42 -0
- package/src/components/ButtonFavorite.tsx +78 -0
- package/src/components/Code.tsx +94 -59
- package/src/components/ComponentNavigator.tsx +99 -0
- package/src/components/Fading.tsx +66 -0
- package/src/components/FadingOverflow.tsx +39 -12
- package/src/components/FileDescription.tsx +118 -0
- package/src/components/HistoryList.tsx +19 -2
- package/src/components/ListResource.tsx +60 -0
- package/src/components/Markdown.tsx +2 -1
- package/src/components/Modal.tsx +85 -0
- package/src/components/QuickStartButton.tsx +15 -47
- package/src/components/RightPanelContentList.tsx +15 -0
- package/src/components/RightPanelForm.tsx +64 -22
- package/src/components/RightPanelTabs.tsx +7 -32
- package/src/components/Selector/index.tsx +312 -0
- package/src/components/Selector/styled.ts +158 -0
- package/src/components/StackedBadge.tsx +77 -0
- package/src/components/TabManager.tsx +36 -36
- package/src/components/ToolBadge.tsx +67 -0
- package/src/components/WorkspaceTabNavigator.tsx +172 -0
- package/src/components/form/DescribedCheckboxGroup.tsx +135 -33
- package/src/components/form/DescribedRadioGroup.tsx +136 -32
- package/src/components/form/dictionary.ts +18 -0
- package/src/components/form/styled.ts +1 -2
- package/src/components/form/types.ts +45 -1
- package/src/context/AIWidgetProvider.tsx +19 -0
- package/src/context/hooks.ts +86 -16
- package/src/features.ts +90 -16
- package/src/hooks/midnight-update-view.ts +36 -0
- package/src/images.d.ts +5 -0
- package/src/index.ts +16 -0
- package/src/layout.css +95 -28
- package/src/regex.ts +2 -0
- package/src/right-panel/DefaultPanel.tsx +7 -7
- package/src/right-panel/RightPanel.tsx +3 -0
- package/src/right-panel/RightPanelProvider.tsx +15 -0
- package/src/right-panel/constants.ts +1 -0
- package/src/right-panel/hooks.tsx +8 -1
- package/src/state/ChatEntry.ts +189 -9
- package/src/state/ChatState.ts +131 -14
- package/src/state/ChatTabsController.ts +78 -8
- package/src/state/ObservableState.ts +14 -0
- package/src/state/WidgetState.ts +86 -3
- package/src/state/constants.ts +13 -0
- package/src/state/types.ts +12 -1
- package/src/types.ts +21 -4
- package/src/utils/chat.ts +15 -14
- package/src/utils/check-is-trial.ts +6 -0
- package/src/utils/copy-to-clipboard.ts +29 -0
- package/src/utils/date.ts +28 -4
- package/src/utils/download.ts +5 -0
- package/src/utils/error.ts +56 -0
- package/src/utils/knowledge-source.ts +18 -2
- package/src/utils/planning-tool.ts +41 -0
- package/src/utils/programming-languages.ts +10 -0
- package/src/utils/string.ts +5 -1
- package/src/utils/tools.ts +32 -0
- package/src/utils/update-tool-step.tsx +27 -0
- package/src/utils/upload/FileUpload.ts +63 -0
- package/src/utils/upload/UploadManager.ts +156 -0
- package/src/utils/upload/context.tsx +44 -0
- package/src/utils/upload/errors.ts +34 -0
- package/src/utils/upload/types.ts +7 -0
- package/src/utils/upload/use-paste-upload.tsx +30 -0
- package/src/utils/upload/utils.ts +12 -0
- package/src/utils/url.ts +8 -0
- package/src/views/Agents/AgentDescription.tsx +107 -0
- package/src/views/Agents/AgentsPanel.tsx +57 -0
- package/src/views/Agents/AgentsTab.tsx +126 -0
- package/src/views/Agents/dictionary.ts +45 -0
- package/src/views/Agents/index.tsx +26 -0
- package/src/views/Agents/styled.ts +69 -0
- package/src/views/Agents/useAgentFavorites.ts +63 -0
- package/src/views/Chat/AgentInfo.tsx +13 -8
- package/src/views/Chat/ButtonExecutionDetail.tsx +46 -0
- package/src/views/Chat/ChatMessage.tsx +465 -79
- package/src/views/Chat/ChatMessages.tsx +15 -4
- package/src/views/Chat/StepsList.tsx +394 -0
- package/src/views/Chat/chat-scroll.ts +1 -1
- package/src/views/Chat/events.ts +71 -0
- package/src/views/Chat/index.tsx +17 -3
- package/src/views/Chat/styled.ts +158 -32
- package/src/views/ChatHistory/ChatHistoryPanel.tsx +8 -5
- package/src/views/ChatHistory/HistoryItem.tsx +23 -44
- package/src/views/ChatHistory/index.tsx +6 -4
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatHistory/utils.ts +144 -11
- package/src/views/ChatTabSelection.tsx +47 -20
- package/src/views/Editor.tsx +28 -18
- package/src/views/Home/BuiltInAgent.tsx +67 -0
- package/src/views/Home/CustomAgent.tsx +36 -0
- package/src/views/Home/index.tsx +48 -0
- package/src/views/Home/styled.ts +74 -0
- package/src/views/Home/types.ts +16 -0
- package/src/views/KSDocument.tsx +11 -8
- package/src/views/KnowledgeSources.tsx +169 -62
- package/src/views/MessageInput/AgentSelector.tsx +92 -0
- package/src/views/MessageInput/ButtonAgent.tsx +73 -0
- package/src/views/MessageInput/ButtonBar.tsx +57 -0
- package/src/views/MessageInput/ContextBar.tsx +117 -0
- package/src/views/MessageInput/ModelSwitcher/index.tsx +69 -0
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +143 -0
- package/src/views/MessageInput/QuickCommandSelector.tsx +137 -0
- package/src/views/MessageInput/SelectContent.tsx +99 -0
- package/src/views/MessageInput/UploadBar.tsx +107 -0
- package/src/views/MessageInput/UploadDragNDrop.tsx +79 -0
- package/src/views/MessageInput/chat-entry-history.ts +97 -0
- package/src/views/MessageInput/dictionary.ts +52 -10
- package/src/views/MessageInput/index.tsx +154 -51
- package/src/views/MessageInput/styled.ts +226 -85
- package/src/views/MinimizedHeader.tsx +11 -10
- package/src/views/Resources.tsx +108 -0
- package/src/views/Stacks.tsx +152 -39
- package/src/views/Steps/FlowChart/HandleGroup.tsx +14 -0
- package/src/views/Steps/FlowChart/NodeDynamic.tsx +97 -0
- package/src/views/Steps/FlowChart/NodeStep.tsx +49 -0
- package/src/views/Steps/FlowChart/hooks.ts +41 -0
- package/src/views/Steps/FlowChart/index.tsx +111 -0
- package/src/views/Steps/FlowChart/layout.ts +73 -0
- package/src/views/Steps/FlowChart/styled.ts +157 -0
- package/src/views/Steps/FlowChart/types.ts +28 -0
- package/src/views/Steps/StepModal.tsx +233 -0
- package/src/views/Steps/StepsPanel.tsx +31 -0
- package/src/views/Steps/dictionary.ts +48 -0
- package/src/views/Steps/index.tsx +36 -0
- package/src/views/Steps/utils.tsx +34 -0
- package/src/views/Tools.tsx +77 -0
- package/src/views/Workspaces/WorkspacesTab.tsx +116 -0
- package/src/views/Workspaces/index.tsx +78 -0
- package/tsconfig.json +8 -3
- package/dist/components/Accordion.d.ts +0 -10
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -46
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -30
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -38
- package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
- package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
- package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/Loading.js +0 -12
- package/dist/components/FallbackBoundary/Loading.js.map +0 -1
- package/dist/components/FallbackBoundary/index.d.ts +0 -6
- package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/index.js +0 -9
- package/dist/components/FallbackBoundary/index.js.map +0 -1
- package/dist/components/IconInput.d.ts +0 -7
- package/dist/components/IconInput.d.ts.map +0 -1
- package/dist/components/IconInput.js +0 -58
- package/dist/components/IconInput.js.map +0 -1
- package/dist/components/OverlayMenu.d.ts +0 -10
- package/dist/components/OverlayMenu.d.ts.map +0 -1
- package/dist/components/OverlayMenu.js +0 -58
- package/dist/components/OverlayMenu.js.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -11
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/ProgressBar.js +0 -126
- package/dist/components/ProgressBar.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -17
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +0 -13
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.js +0 -90
- package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
- package/dist/components/Tooltip/context.d.ts +0 -5
- package/dist/components/Tooltip/context.d.ts.map +0 -1
- package/dist/components/Tooltip/context.js +0 -18
- package/dist/components/Tooltip/context.js.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/Tooltip/index.js +0 -3
- package/dist/components/Tooltip/index.js.map +0 -1
- package/dist/components/Tooltip/style.d.ts +0 -4
- package/dist/components/Tooltip/style.d.ts.map +0 -1
- package/dist/components/Tooltip/style.js +0 -22
- package/dist/components/Tooltip/style.js.map +0 -1
- package/dist/components/Tooltip/types.d.ts +0 -14
- package/dist/components/Tooltip/types.d.ts.map +0 -1
- package/dist/views/Agents.d.ts +0 -2
- package/dist/views/Agents.d.ts.map +0 -1
- package/dist/views/Agents.js +0 -143
- package/dist/views/Agents.js.map +0 -1
- package/dist/views/Home.d.ts +0 -6
- package/dist/views/Home.d.ts.map +0 -1
- package/dist/views/Home.js +0 -68
- package/dist/views/Home.js.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.d.ts +0 -12
- package/dist/views/MessageInput/ButtonGroup.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.js +0 -24
- package/dist/views/MessageInput/ButtonGroup.js.map +0 -1
- package/dist/views/MessageInput/InfoBar.d.ts +0 -2
- package/dist/views/MessageInput/InfoBar.d.ts.map +0 -1
- package/dist/views/MessageInput/InfoBar.js +0 -35
- package/dist/views/MessageInput/InfoBar.js.map +0 -1
- package/dist/views/Workspaces.d.ts +0 -2
- package/dist/views/Workspaces.d.ts.map +0 -1
- package/dist/views/Workspaces.js +0 -62
- package/dist/views/Workspaces.js.map +0 -1
- package/src/components/Accordion.tsx +0 -64
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -48
- package/src/components/FallbackBoundary/Loading.tsx +0 -14
- package/src/components/FallbackBoundary/index.tsx +0 -15
- package/src/components/IconInput.tsx +0 -70
- package/src/components/OverlayMenu.tsx +0 -77
- package/src/components/ProgressBar.tsx +0 -153
- package/src/components/Tooltip/Tooltip.tsx +0 -36
- package/src/components/Tooltip/TooltipAPI.ts +0 -84
- package/src/components/Tooltip/context.tsx +0 -24
- package/src/components/Tooltip/index.ts +0 -2
- package/src/components/Tooltip/style.tsx +0 -24
- package/src/components/Tooltip/types.ts +0 -15
- package/src/views/Agents.tsx +0 -200
- package/src/views/Home.tsx +0 -109
- package/src/views/MessageInput/ButtonGroup.tsx +0 -91
- package/src/views/MessageInput/InfoBar.tsx +0 -82
- package/src/views/Workspaces.tsx +0 -92
- /package/dist/{components/Tooltip → utils/upload}/types.js +0 -0
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { Button } from '@citric
|
|
2
|
-
import { Search } from '@citric/icons'
|
|
1
|
+
import { Button, Tab } from '@stack-spot/citric-react'
|
|
3
2
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
|
-
import { aiClient } from '@stack-spot/portal-network'
|
|
5
|
-
import {
|
|
3
|
+
import { aiClient, dataIntegrationClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
4
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
5
|
+
import { KnowledgeSourceItemResponse } from '@stack-spot/portal-network/api/dataIntegration'
|
|
6
|
+
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
6
7
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
9
|
+
import { NavigationComponent } from '../components/ComponentNavigator'
|
|
9
10
|
import { DescribedCheckboxGroup } from '../components/form/DescribedCheckboxGroup'
|
|
10
|
-
import {
|
|
11
|
+
import { RightPanelContentList } from '../components/RightPanelContentList'
|
|
11
12
|
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
13
|
+
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator'
|
|
12
14
|
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks'
|
|
15
|
+
import { Scope } from '../features'
|
|
13
16
|
import { useRightPanel } from '../right-panel/hooks'
|
|
14
17
|
import { ChatProperties } from '../state/ChatState'
|
|
18
|
+
import { checkIsTrial } from '../utils/check-is-trial'
|
|
15
19
|
|
|
16
|
-
interface TabProps {
|
|
17
|
-
visibility
|
|
18
|
-
onSubmit: () => void,
|
|
20
|
+
export interface TabProps {
|
|
21
|
+
visibility?: VisibilityLevelEnum,
|
|
19
22
|
allKS: React.MutableRefObject<ChatProperties['knowledgeSources']>,
|
|
23
|
+
workspaceId?: string,
|
|
24
|
+
showSubmitButton?: boolean,
|
|
25
|
+
onSubmit?: () => void,
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
export const KnowledgeSources = () => {
|
|
@@ -35,11 +41,19 @@ export const KnowledgeSources = () => {
|
|
|
35
41
|
return null
|
|
36
42
|
}
|
|
37
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Renders the KS selection form in the Right Panel if this is the panel that is currently opened.
|
|
46
|
+
*/
|
|
38
47
|
const KnowledgeSourcesPanel = () => {
|
|
39
48
|
const t = useTranslate(dictionary)
|
|
40
49
|
const chat = useCurrentChat()
|
|
41
50
|
const allKS = useRef(chat.get('knowledgeSources') ?? [])
|
|
42
51
|
const { close } = useRightPanel()
|
|
52
|
+
const isTrial = checkIsTrial()
|
|
53
|
+
const features = useWidgetState('features')
|
|
54
|
+
const isGroupResourcesByScope = features?.groupResourcesByScope
|
|
55
|
+
const scopes = features?.scopes ?? []
|
|
56
|
+
const spotId = features?.workspaceId
|
|
43
57
|
|
|
44
58
|
const onSubmit = useCallback(() => {
|
|
45
59
|
chat.set('knowledgeSources', allKS.current)
|
|
@@ -49,70 +63,160 @@ const KnowledgeSourcesPanel = () => {
|
|
|
49
63
|
useEffect(() => {
|
|
50
64
|
allKS.current = chat.get('knowledgeSources') ?? []
|
|
51
65
|
}, [chat])
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
|
|
67
|
+
const allTabsMap: Partial<Record<Scope, Omit<Tab, 'key'>>> = {
|
|
68
|
+
favorite: {
|
|
69
|
+
label: t.favorites,
|
|
70
|
+
content: <KnowledgeSourcesTab key="favorite" visibility="favorite" allKS={allKS} onSubmit={onSubmit} />,
|
|
71
|
+
},
|
|
72
|
+
personal: {
|
|
73
|
+
label: t.personal,
|
|
74
|
+
content: <KnowledgeSourcesTab key="personal" visibility="personal" allKS={allKS} onSubmit={onSubmit} />,
|
|
75
|
+
},
|
|
76
|
+
shared: { label: t.shared, content: <KnowledgeSourcesTab key="shared" visibility="shared" allKS={allKS} onSubmit={onSubmit} /> },
|
|
77
|
+
workspace: {
|
|
78
|
+
label: t.spots,
|
|
79
|
+
content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} />,
|
|
80
|
+
},
|
|
81
|
+
account: { label: t.account, content: <KnowledgeSourcesTab key="account" visibility="account" allKS={allKS} onSubmit={onSubmit} /> },
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const defaultScopes: Scope[] = ['favorite', 'personal', 'shared', 'workspace', 'account']
|
|
85
|
+
|
|
86
|
+
const rawScopes: Scope[] = scopes?.length ? scopes : defaultScopes
|
|
87
|
+
|
|
88
|
+
const scopesToRender: Scope[] = isTrial
|
|
89
|
+
? ['favorite', 'personal']
|
|
90
|
+
: rawScopes
|
|
91
|
+
|
|
92
|
+
const tabs = scopesToRender
|
|
93
|
+
.map(scope => scope in allTabsMap ? { key: scope, ...allTabsMap[scope] } : undefined)
|
|
94
|
+
.filter(Boolean) as Tab[]
|
|
95
|
+
|
|
96
|
+
return (isGroupResourcesByScope ? (
|
|
97
|
+
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
98
|
+
) : (
|
|
99
|
+
<RightPanelContentList><KnowledgeSourcesTab allKS={allKS} onSubmit={onSubmit} workspaceId={spotId} /></RightPanelContentList>
|
|
100
|
+
))
|
|
58
101
|
}
|
|
59
102
|
|
|
60
|
-
const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit }: TabProps) => {
|
|
103
|
+
export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId, showSubmitButton = true }: TabProps) => {
|
|
61
104
|
const t = useTranslate(dictionary)
|
|
62
|
-
const [
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
:
|
|
72
|
-
|
|
105
|
+
const [data = []] = workspaceAiClient.getKSFromWorkspaceAi.useStatefulQuery(
|
|
106
|
+
{ workspaceId: workspaceId! }, { enabled: !!workspaceId })
|
|
107
|
+
const workspaceKs = data as KnowledgeSourceItemResponse[]
|
|
108
|
+
|
|
109
|
+
const [ksListPages = [], { fetchNextPage, hasNextPage }] = dataIntegrationClient.knowledgeSourcesV2.useInfiniteQuery(
|
|
110
|
+
{
|
|
111
|
+
order: 'a-to-z',
|
|
112
|
+
visibilityList: visibility ? [visibility] : [],
|
|
113
|
+
types: ['snippet', 'api', 'event', 'custom'],
|
|
114
|
+
size: 20,
|
|
115
|
+
page: 1,
|
|
116
|
+
},
|
|
117
|
+
{ enabled: !workspaceId },
|
|
73
118
|
)
|
|
119
|
+
const knowledgeSources = workspaceId ? workspaceKs : ksListPages
|
|
120
|
+
|
|
121
|
+
const initialValue = useMemo(() => {
|
|
122
|
+
const currentlySelected = allKS.current?.map(ks => ks.id)
|
|
123
|
+
return knowledgeSources?.filter((ks: KnowledgeSourceItemResponse) => currentlySelected?.includes(ks.slug))
|
|
124
|
+
}, [knowledgeSources])
|
|
125
|
+
|
|
126
|
+
const listFavorites = dataIntegrationClient.knowledgeSourcesV2.useQuery({ visibilityList: ['favorite'] })?.items
|
|
74
127
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
128
|
+
const [addFavorite, pendingAddFav] = dataIntegrationClient.addFavoriteKnowledgeSource.useMutation()
|
|
129
|
+
const [removeFavorite, pendingRemoveFav] = dataIntegrationClient.removeFavoriteKnowledgeSource.useMutation()
|
|
130
|
+
|
|
131
|
+
const removeFavoriteKs = async (idOrSlug: string) => {
|
|
132
|
+
try {
|
|
133
|
+
await removeFavorite({ slug: idOrSlug })
|
|
134
|
+
await aiClient.knowledgeSources.invalidate()
|
|
135
|
+
await dataIntegrationClient.knowledgeSourcesV2.invalidate()
|
|
136
|
+
} catch (error) {
|
|
137
|
+
// eslint-disable-next-line no-console
|
|
138
|
+
console.error(error)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
143
|
+
const onRemoveFavorite = (idOrSlug: string) => new Promise<boolean>(async (resolve, reject) => {
|
|
144
|
+
try {
|
|
145
|
+
await removeFavoriteKs(idOrSlug)
|
|
146
|
+
if (!pendingRemoveFav) {
|
|
147
|
+
resolve(true)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
} catch (error) {
|
|
151
|
+
// eslint-disable-next-line no-console
|
|
152
|
+
console.error(error)
|
|
153
|
+
reject(error)
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
const addFavoriteKs = async (idOrSlug: string) => {
|
|
158
|
+
try {
|
|
159
|
+
await addFavorite({ slug: idOrSlug })
|
|
160
|
+
await aiClient.knowledgeSources.invalidate()
|
|
161
|
+
await dataIntegrationClient.knowledgeSourcesV2.invalidate()
|
|
162
|
+
} catch (error) {
|
|
163
|
+
// eslint-disable-next-line no-console
|
|
164
|
+
console.error(error)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
169
|
+
const onAddFavorite = (idOrSlug: string) => new Promise<boolean>(async (resolve, reject) => {
|
|
170
|
+
try {
|
|
171
|
+
await addFavoriteKs(idOrSlug)
|
|
172
|
+
if (!pendingAddFav) {
|
|
173
|
+
resolve(true)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
} catch (error) {
|
|
177
|
+
// eslint-disable-next-line no-console
|
|
178
|
+
console.error(error)
|
|
179
|
+
reject(error)
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
return (<>
|
|
184
|
+
<div className="content">
|
|
185
|
+
<DescribedCheckboxGroup
|
|
186
|
+
options={knowledgeSources}
|
|
187
|
+
initialValue={initialValue}
|
|
188
|
+
globalSelection={allKS}
|
|
189
|
+
hasNextPage={hasNextPage && !workspaceId}
|
|
190
|
+
fetchNextPage={fetchNextPage}
|
|
191
|
+
data={(ks: KnowledgeSourceItemResponse) => ({
|
|
192
|
+
idOrSlug: ks.slug, description: ks.description, name: ks.name, listFavorites,
|
|
193
|
+
onAddFavorite, onRemoveFavorite,
|
|
194
|
+
})}
|
|
195
|
+
emptyResults={<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} />}
|
|
196
|
+
emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} className="no-data-placeholder" />}
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
{!!knowledgeSources?.length && showSubmitButton && <Button onClick={onSubmit}>{t.apply}</Button>}
|
|
200
|
+
</>
|
|
109
201
|
)
|
|
110
202
|
}
|
|
111
203
|
|
|
204
|
+
export function KnowledgeSourcesTabWorkspace({ allKS, onSubmit }: TabProps) {
|
|
205
|
+
const workspaceTabComponents = useMemo(() => ({ ks: KnowledgeSourcesTab }), [allKS, onSubmit])
|
|
206
|
+
|
|
207
|
+
const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
|
|
208
|
+
component: 'ks',
|
|
209
|
+
props: { visibility: 'workspace', workspaceId: workspace.id, allKS, onSubmit },
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
return <WorkspaceTabNavigator components={workspaceTabComponents} getNavigateParam={buildNavigateParams} />
|
|
213
|
+
}
|
|
214
|
+
|
|
112
215
|
const dictionary = {
|
|
113
216
|
en: {
|
|
114
217
|
title: 'Knowledge Sources',
|
|
115
218
|
description: 'By selecting one or more knowledge sources, they will be consulted to generate the responses.',
|
|
219
|
+
favorites: 'Favorites',
|
|
116
220
|
personal: 'Personal',
|
|
117
221
|
shared: 'Shared',
|
|
118
222
|
account: 'Account',
|
|
@@ -121,10 +225,12 @@ const dictionary = {
|
|
|
121
225
|
noSearchResultsDescription: 'Please, try another search term.',
|
|
122
226
|
noData: 'There are no knowledge sources in this category yet.',
|
|
123
227
|
noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new knowledge sources.',
|
|
228
|
+
spots: 'Spots',
|
|
124
229
|
},
|
|
125
230
|
pt: {
|
|
126
231
|
title: 'Knowledge Sources',
|
|
127
232
|
description: 'Ao selecionar um ou mais knowledge sources, eles serão consultados para gerar as respostas.',
|
|
233
|
+
favorites: 'Favoritos',
|
|
128
234
|
personal: 'Pessoal',
|
|
129
235
|
shared: 'Compartilhado',
|
|
130
236
|
account: 'Conta',
|
|
@@ -133,5 +239,6 @@ const dictionary = {
|
|
|
133
239
|
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
134
240
|
noData: 'Ainda não há knowledge sources nesta categoria.',
|
|
135
241
|
noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novos knowledge sources.',
|
|
242
|
+
spots: 'Spots',
|
|
136
243
|
},
|
|
137
244
|
} satisfies Dictionary
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconBox, Row, Text } from '@stack-spot/citric-react'
|
|
3
|
+
import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
|
|
4
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/agent-tools'
|
|
5
|
+
import { useCallback } from 'react'
|
|
6
|
+
import { Selector } from '../../components/Selector'
|
|
7
|
+
import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks'
|
|
8
|
+
import { agentRegex } from '../../regex'
|
|
9
|
+
import { useAgentFavorites } from '../Agents/useAgentFavorites'
|
|
10
|
+
|
|
11
|
+
type AgentWithSpaceName = AgentResponseWithBuiltIn
|
|
12
|
+
|
|
13
|
+
const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
|
|
14
|
+
const avatarComponent = avatar
|
|
15
|
+
? <img style={{ width: '32px', height: '32px', borderRadius: '50%' }} src={avatar} />
|
|
16
|
+
: <IconBox size="md" icon="Agent" style={{ backgroundColor: 'transparent' }} />
|
|
17
|
+
|
|
18
|
+
return <Row gap="8px" style={{ flexWrap: 'nowrap' }}>
|
|
19
|
+
{avatarComponent}
|
|
20
|
+
<div>
|
|
21
|
+
<Text className="selector-description">{spaceName}</Text>
|
|
22
|
+
<Text className="selector-title">{name}</Text>
|
|
23
|
+
</div>
|
|
24
|
+
</Row>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const AgentSelector = ({ inputRef, isTrial }: {
|
|
28
|
+
isTrial: boolean,
|
|
29
|
+
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
|
|
30
|
+
}) => {
|
|
31
|
+
const chat = useCurrentChat()
|
|
32
|
+
const isAgentEnabled = useCurrentChatState('features').agent
|
|
33
|
+
const spotId = useWidgetState('features')?.workspaceId
|
|
34
|
+
|
|
35
|
+
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
36
|
+
|
|
37
|
+
const onSelectItem = useCallback(async (agent: AgentResponseWithBuiltIn) => {
|
|
38
|
+
const newValue = `@${agent.slug}`
|
|
39
|
+
chat.set('nextMessage', undefined)
|
|
40
|
+
chat.set(
|
|
41
|
+
'agent',
|
|
42
|
+
{
|
|
43
|
+
id: agent.id,
|
|
44
|
+
label: agent.name,
|
|
45
|
+
image: agent.avatar,
|
|
46
|
+
slug: agent.slug,
|
|
47
|
+
builtIn: agent.builtIn,
|
|
48
|
+
visibility_level: agent.visibility_level,
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
if (!inputRef.current) return
|
|
53
|
+
inputRef.current.value = newValue
|
|
54
|
+
inputRef.current.focus()
|
|
55
|
+
}, [chat, inputRef])
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const getAgents = ({ filter, visibility }: {filter?: string, visibility?: AgentVisibilityLevel[] | VisibilityLevelEnum[]}) => {
|
|
59
|
+
if (spotId) {
|
|
60
|
+
return { data: workspaceAiClient.getAgentFromWorkspaceAi.useQuery({
|
|
61
|
+
workspaceId: spotId, name: filter }) as AgentResponseWithBuiltIn[] }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (isTrial) {
|
|
65
|
+
return { data: agentToolsClient.allAgents.useQuery({ visibilities: visibility as VisibilityLevelEnum[], filter }) }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return { data: agentToolsClient.allAgents.useQuery({
|
|
69
|
+
visibilities: visibility as VisibilityLevelEnum[], filter,
|
|
70
|
+
}) }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return <Selector
|
|
74
|
+
inputRef={inputRef}
|
|
75
|
+
favorite={{ useFavorites, onAddFavorite, onRemoveFavorite }}
|
|
76
|
+
selectorConfig={{
|
|
77
|
+
resourceName: 'Agent',
|
|
78
|
+
shortcut: '@',
|
|
79
|
+
icon: <Icon icon="Agent" />,
|
|
80
|
+
regex: agentRegex,
|
|
81
|
+
urlBuilder: (agent) => `/agents/${agent?.id}`,
|
|
82
|
+
searchProp: 'name',
|
|
83
|
+
sections: isTrial ?
|
|
84
|
+
['favorite', 'personal', 'built_in', 'recently_used'] :
|
|
85
|
+
['favorite', 'personal', 'workspace', 'account', 'shared', 'built_in', 'recently_used'],
|
|
86
|
+
renderComponentItem: AgentItem,
|
|
87
|
+
isEnabled: isAgentEnabled,
|
|
88
|
+
onSelect: onSelectItem,
|
|
89
|
+
useData: getAgents,
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Center, ImageButton, ImageWithFallback, Tooltip } from '@stack-spot/citric-react'
|
|
3
|
+
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
4
|
+
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
5
|
+
import { useEffect } from 'react'
|
|
6
|
+
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
7
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
8
|
+
|
|
9
|
+
export const ButtonAgent = () => {
|
|
10
|
+
const t = useMessageInputDictionary()
|
|
11
|
+
const agentDefault = agentToolsClient.agentDefault.useQuery()
|
|
12
|
+
const widget = useWidget()
|
|
13
|
+
const chat = useCurrentChat()
|
|
14
|
+
const agent = useCurrentChatState('agent')
|
|
15
|
+
const features = useCurrentChatState('features')
|
|
16
|
+
|
|
17
|
+
const setAgentDefault = () => {
|
|
18
|
+
agentDefault && chat.set(
|
|
19
|
+
'agent',
|
|
20
|
+
{
|
|
21
|
+
id: agentDefault.id,
|
|
22
|
+
slug: agentDefault.slug,
|
|
23
|
+
label: agentDefault.name,
|
|
24
|
+
image: agentDefault.avatar,
|
|
25
|
+
builtIn: true,
|
|
26
|
+
visibility_level: agentDefault.visibility_level,
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!agent && !!agentDefault) {
|
|
33
|
+
setAgentDefault()
|
|
34
|
+
}
|
|
35
|
+
}, [agentDefault, agent])
|
|
36
|
+
|
|
37
|
+
const isAgentDefault = () => agent?.id === agentDefault?.id
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className="button-group">
|
|
41
|
+
{features.agent && (
|
|
42
|
+
<div className="group-agent">
|
|
43
|
+
<ImageButton
|
|
44
|
+
aria-label={t.agent}
|
|
45
|
+
title={t.agent}
|
|
46
|
+
className="agent"
|
|
47
|
+
onClick={() => widget.set('panel', 'agent')}
|
|
48
|
+
>
|
|
49
|
+
{agentDefault?.avatar ? <img src={agentDefault.avatar} className="image" /> : <MiniLogo />}
|
|
50
|
+
</ImageButton>
|
|
51
|
+
{agent?.id && !isAgentDefault() &&
|
|
52
|
+
<Tooltip content={t.remove} >
|
|
53
|
+
<ImageButton
|
|
54
|
+
aria-label={t.remove}
|
|
55
|
+
className="agent agent-selected"
|
|
56
|
+
onClick={setAgentDefault}
|
|
57
|
+
>
|
|
58
|
+
<ImageWithFallback
|
|
59
|
+
src={agent.image ?? ''}
|
|
60
|
+
className="image"
|
|
61
|
+
fallback={<Icon className="image" size="xs" icon="Agent" />}
|
|
62
|
+
/>
|
|
63
|
+
<Center className="icon-remove">
|
|
64
|
+
<Icon icon="TimesMini" />
|
|
65
|
+
</Center>
|
|
66
|
+
</ImageButton>
|
|
67
|
+
</Tooltip>
|
|
68
|
+
}
|
|
69
|
+
</div>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { IconButton, Row } from '@stack-spot/citric-react'
|
|
2
|
+
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
3
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
4
|
+
import { ModelSwitcher } from './ModelSwitcher'
|
|
5
|
+
import { SelectContent } from './SelectContent'
|
|
6
|
+
import { SelectionBarWrapper } from './styled'
|
|
7
|
+
|
|
8
|
+
interface SelectionBarProps {
|
|
9
|
+
/**
|
|
10
|
+
* A function to run when the send button is clicked.
|
|
11
|
+
*/
|
|
12
|
+
onSend: () => void,
|
|
13
|
+
/**
|
|
14
|
+
* Whether or not the message is currently being sent. This is used to decide which button to show: send or cancel.
|
|
15
|
+
*/
|
|
16
|
+
isLoading?: boolean,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ButtonBar = ({ onSend, isLoading }: SelectionBarProps) => {
|
|
20
|
+
const t = useMessageInputDictionary()
|
|
21
|
+
const chat = useCurrentChat()
|
|
22
|
+
const widget = useWidget()
|
|
23
|
+
const features = useCurrentChatState('features')
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SelectionBarWrapper className="button-group">
|
|
27
|
+
<Row center={false} gap="4px">
|
|
28
|
+
<SelectContent />
|
|
29
|
+
{features.editor && (
|
|
30
|
+
<IconButton icon="Code" appearance="square" aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')} />
|
|
31
|
+
)}
|
|
32
|
+
</Row>
|
|
33
|
+
{features.showLLMSelect && <ModelSwitcher />}
|
|
34
|
+
{isLoading ? (
|
|
35
|
+
<IconButton
|
|
36
|
+
icon="Stop"
|
|
37
|
+
appearance="square"
|
|
38
|
+
colorScheme="inverse"
|
|
39
|
+
aria-label={t.cancel}
|
|
40
|
+
onClick={() => chat.abort()}
|
|
41
|
+
className="send"
|
|
42
|
+
title={t.cancel}
|
|
43
|
+
/>
|
|
44
|
+
) : (
|
|
45
|
+
<IconButton
|
|
46
|
+
icon="ArrowUp"
|
|
47
|
+
appearance="square"
|
|
48
|
+
colorScheme="inverse"
|
|
49
|
+
aria-label={t.send}
|
|
50
|
+
onClick={onSend}
|
|
51
|
+
className="send"
|
|
52
|
+
title={t.send}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</SelectionBarWrapper>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { loader } from '@monaco-editor/react'
|
|
2
|
+
import { Badge, IconButton, Text } from '@stack-spot/citric-react'
|
|
3
|
+
import { ColorPaletteName, listToClass } from '@stack-spot/portal-theme'
|
|
4
|
+
import { useCallback, useMemo } from 'react'
|
|
5
|
+
import { FadingOverflow } from '../../components/FadingOverflow'
|
|
6
|
+
import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
|
|
7
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
8
|
+
|
|
9
|
+
interface ContextBadgeProps {
|
|
10
|
+
label: string,
|
|
11
|
+
color: ColorPaletteName,
|
|
12
|
+
dismiss: string,
|
|
13
|
+
onDismiss?: () => void,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const ContextBadge = ({ label, color, dismiss, onDismiss }: ContextBadgeProps) => (
|
|
17
|
+
<Badge appearance="square" colorPalette={color} className="context-badge">
|
|
18
|
+
<Text nowrapEllipsis>{label}</Text>
|
|
19
|
+
{onDismiss && <IconButton
|
|
20
|
+
icon="TimesMini"
|
|
21
|
+
appearance="none"
|
|
22
|
+
onClick={onDismiss}
|
|
23
|
+
title={dismiss}
|
|
24
|
+
arial-label={dismiss}
|
|
25
|
+
style={{ padding: '2px 0 2px 2px', color: 'inherit' }}
|
|
26
|
+
/>}
|
|
27
|
+
</Badge>
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This renders the bar on top of the textarea to send the message. This tells:
|
|
32
|
+
* - if there's any code selected in the editor;
|
|
33
|
+
* - which workspace is being used;
|
|
34
|
+
* - which stack is being used;
|
|
35
|
+
* - which knowledge sources are being used.
|
|
36
|
+
*/
|
|
37
|
+
export const ContextBar = () => {
|
|
38
|
+
const t = useMessageInputDictionary()
|
|
39
|
+
const chat = useCurrentChat()
|
|
40
|
+
const currentStack = useCurrentChatState('stack')
|
|
41
|
+
const currentWorkspace = useCurrentChatState('workspace')
|
|
42
|
+
const currentKnowledgeSources = useCurrentChatState('knowledgeSources')
|
|
43
|
+
const currentSelection = useCurrentChatState('codeSelection')
|
|
44
|
+
const features = useCurrentChatState('features')
|
|
45
|
+
const visible = !!(currentStack || currentWorkspace || currentKnowledgeSources?.length || currentSelection)
|
|
46
|
+
const ksToRender = useMemo(() => currentKnowledgeSources?.map(ks => {
|
|
47
|
+
const onDismiss = features.knowledgeSource
|
|
48
|
+
? (() => chat.set('knowledgeSources', currentKnowledgeSources.filter(({ id }) => id !== ks.id)))
|
|
49
|
+
: undefined
|
|
50
|
+
return <li key={ks.id}><ContextBadge label={ks.label} dismiss={t.removeKS} color="teal" onDismiss={onDismiss} /></li>
|
|
51
|
+
}), [currentKnowledgeSources])
|
|
52
|
+
const shouldRenderRemoveAllButton = (
|
|
53
|
+
currentSelection
|
|
54
|
+
|| (features.stack && currentStack)
|
|
55
|
+
|| (features.workspace && currentWorkspace)
|
|
56
|
+
|| (features.knowledgeSource && !!ksToRender?.length)
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
const removeAll = useCallback(() => {
|
|
60
|
+
if (features.knowledgeSource) chat.set('knowledgeSources', [])
|
|
61
|
+
if (features.stack) chat.set('stack', undefined)
|
|
62
|
+
if (features.workspace) chat.set('workspace', undefined)
|
|
63
|
+
removeCodeSelection()
|
|
64
|
+
}, [])
|
|
65
|
+
|
|
66
|
+
const removeCodeSelection = useCallback(() => {
|
|
67
|
+
const editor = loader.__getMonacoInstance()?.editor
|
|
68
|
+
editor?.getEditors()[0].setSelection({ startLineNumber: 0, endLineNumber: 0, endColumn: 0, startColumn: 0 })
|
|
69
|
+
}, [])
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className={listToClass(['info-bar', 'context-bar', visible && 'visible'])}>
|
|
73
|
+
<div className="space"></div>
|
|
74
|
+
<div className="content">
|
|
75
|
+
{shouldRenderRemoveAllButton && (
|
|
76
|
+
<IconButton
|
|
77
|
+
icon="TimesMini"
|
|
78
|
+
aria-label={t.removeConfig}
|
|
79
|
+
title={t.removeConfig}
|
|
80
|
+
onClick={removeAll}
|
|
81
|
+
style={{ marginLeft: '8px' }}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
85
|
+
<ul>
|
|
86
|
+
{currentSelection && (
|
|
87
|
+
<li>
|
|
88
|
+
<ContextBadge label={t.selected} dismiss={t.removeSelection} color="blue" onDismiss={removeCodeSelection} />
|
|
89
|
+
</li>
|
|
90
|
+
)}
|
|
91
|
+
{currentStack && (
|
|
92
|
+
<li>
|
|
93
|
+
<ContextBadge
|
|
94
|
+
label={currentStack.label}
|
|
95
|
+
dismiss={t.removeStack}
|
|
96
|
+
color="cyan"
|
|
97
|
+
onDismiss={features.stack ? (() => chat.set('stack', undefined)) : undefined}
|
|
98
|
+
/>
|
|
99
|
+
</li>
|
|
100
|
+
)}
|
|
101
|
+
{currentWorkspace && (
|
|
102
|
+
<li>
|
|
103
|
+
<ContextBadge
|
|
104
|
+
label={currentWorkspace.label}
|
|
105
|
+
dismiss={t.removeWorkspace}
|
|
106
|
+
color="pink"
|
|
107
|
+
onDismiss={features.workspace ? (() => chat.set('workspace', undefined)) : undefined}
|
|
108
|
+
/>
|
|
109
|
+
</li>
|
|
110
|
+
)}
|
|
111
|
+
{ksToRender}
|
|
112
|
+
</ul>
|
|
113
|
+
</FadingOverflow>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|