@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
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { pull } from 'lodash'
|
|
2
|
+
import { FileSize } from '../../state/types'
|
|
3
|
+
import { FileAlreadyExists, FileIsTooLarge, MaxFilesReached, UploadError } from './errors'
|
|
4
|
+
import { FileUpload } from './FileUpload'
|
|
5
|
+
import { getFileId, unitPower } from './utils'
|
|
6
|
+
|
|
7
|
+
export type UploadChangeListener = (files: FileUpload[]) => void
|
|
8
|
+
export type UploadStatusChangeListener = (status: UploadManagerStatus) => void
|
|
9
|
+
export type UploadErrorListener = (errors: UploadError[]) => void
|
|
10
|
+
export type UploadManagerStatus = 'idle' | 'uploading' | 'error'
|
|
11
|
+
|
|
12
|
+
export class UploadManager {
|
|
13
|
+
private changeListeners: UploadChangeListener[] = []
|
|
14
|
+
private statusListeners: UploadStatusChangeListener[] = []
|
|
15
|
+
private errorListeners: UploadErrorListener[] = []
|
|
16
|
+
private input: HTMLInputElement | null = null
|
|
17
|
+
private value: FileUpload[] = []
|
|
18
|
+
private maxSize?: FileSize
|
|
19
|
+
private maxItems: number
|
|
20
|
+
private accept: string[]
|
|
21
|
+
private onDestroy: () => void = () => {}
|
|
22
|
+
status: UploadManagerStatus = 'idle'
|
|
23
|
+
|
|
24
|
+
constructor(options?: { maxSize?: FileSize, accept?: string[], maxItems?: number }) {
|
|
25
|
+
this.maxSize = options?.maxSize
|
|
26
|
+
this.accept = options?.accept ?? []
|
|
27
|
+
this.maxItems = options?.maxItems ?? 0
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private runChangeListeners() {
|
|
31
|
+
this.changeListeners.forEach(l => l(this.value))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private runStatusListeners() {
|
|
35
|
+
const status = this.computeStatus()
|
|
36
|
+
if (status === this.status) return
|
|
37
|
+
this.status = status
|
|
38
|
+
this.statusListeners.forEach(l => l(status))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private hasEquivalentFile(file: File) {
|
|
42
|
+
const id = getFileId(file)
|
|
43
|
+
return this.value.some(f => id === f.id)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private processFiles(files: FileList | File[]) {
|
|
47
|
+
const newFiles: FileUpload[] = []
|
|
48
|
+
const errors: UploadError[] = []
|
|
49
|
+
for (const f of files ?? []) {
|
|
50
|
+
if (this.maxSize && f.size > this.maxSize.value * Math.pow(1024, unitPower[this.maxSize?.unit])) {
|
|
51
|
+
errors.push(new FileIsTooLarge(f.name, this.maxSize))
|
|
52
|
+
} else if (this.maxItems && this.value.length + newFiles.length === this.maxItems) {
|
|
53
|
+
errors.push(new MaxFilesReached(f.name, this.maxItems))
|
|
54
|
+
} else if (this.hasEquivalentFile(f)) {
|
|
55
|
+
errors.push(new FileAlreadyExists(f.name))
|
|
56
|
+
} else {
|
|
57
|
+
const upload = new FileUpload(f)
|
|
58
|
+
newFiles.push(upload)
|
|
59
|
+
upload.onChange(() => this.runStatusListeners())
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (newFiles.length) {
|
|
63
|
+
this.value = [...this.value, ...newFiles]
|
|
64
|
+
this.runChangeListeners()
|
|
65
|
+
this.runStatusListeners()
|
|
66
|
+
}
|
|
67
|
+
if (errors.length) {
|
|
68
|
+
this.errorListeners.forEach(l => l(errors))
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private attachEventListeners() {
|
|
73
|
+
const handleChange = () => {
|
|
74
|
+
this.processFiles(this.input?.files || [])
|
|
75
|
+
this.destroy()
|
|
76
|
+
}
|
|
77
|
+
this.onDestroy = () => this.input?.removeEventListener('change', handleChange)
|
|
78
|
+
this.input?.addEventListener('change', handleChange)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private createInput() {
|
|
82
|
+
this.input = document.createElement('input')
|
|
83
|
+
this.input.setAttribute('type', 'file')
|
|
84
|
+
this.input.setAttribute('multiple', '')
|
|
85
|
+
this.input.setAttribute('style', 'display: none')
|
|
86
|
+
this.input.setAttribute('accept', `.${this.accept.join(',.')}`)
|
|
87
|
+
document.body.append(this.input)
|
|
88
|
+
this.attachEventListeners()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private computeStatus(): UploadManagerStatus {
|
|
92
|
+
let uploading = false
|
|
93
|
+
for (const f of this.value) {
|
|
94
|
+
if (f.status === 'error') return 'error'
|
|
95
|
+
if (f.status === 'pending') uploading = true
|
|
96
|
+
}
|
|
97
|
+
return uploading ? 'uploading' : 'idle'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
open() {
|
|
101
|
+
this.createInput()
|
|
102
|
+
this.input?.click()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
get(): FileUpload[] {
|
|
106
|
+
return this.value
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
reset() {
|
|
110
|
+
this.value.forEach(f => f.destroy())
|
|
111
|
+
this.value = []
|
|
112
|
+
this.runChangeListeners()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
add(files: File | File[] = []) {
|
|
116
|
+
const fileList = Array.isArray(files) ? files : [files]
|
|
117
|
+
this.processFiles(fileList)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
remove(file: FileUpload) {
|
|
121
|
+
file.destroy()
|
|
122
|
+
this.value = this.value.filter(f => f !== file)
|
|
123
|
+
this.runChangeListeners()
|
|
124
|
+
this.runStatusListeners()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
onChange(listener: UploadChangeListener) {
|
|
128
|
+
this.changeListeners.push(listener)
|
|
129
|
+
return () => {
|
|
130
|
+
pull(this.changeListeners, listener)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
onChangeStatus(listener: UploadStatusChangeListener) {
|
|
135
|
+
this.statusListeners.push(listener)
|
|
136
|
+
return () => {
|
|
137
|
+
pull(this.statusListeners, listener)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
onError(listener: UploadErrorListener) {
|
|
142
|
+
this.errorListeners.push(listener)
|
|
143
|
+
return () => {
|
|
144
|
+
pull(this.errorListeners, listener)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
isFull() {
|
|
149
|
+
return !!this.maxItems && this.value.length === this.maxItems
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
destroy() {
|
|
153
|
+
this.onDestroy()
|
|
154
|
+
this.input?.remove()
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffectOnce } from '@stack-spot/portal-components'
|
|
2
|
+
import { createContext, ReactNode, useContext, useEffect, useState } from 'react'
|
|
3
|
+
import { UploadError } from './errors'
|
|
4
|
+
import { FileUpload } from './FileUpload'
|
|
5
|
+
import { FileUploadStatus } from './types'
|
|
6
|
+
import { UploadManager, UploadManagerStatus } from './UploadManager'
|
|
7
|
+
|
|
8
|
+
const context = createContext<UploadManager | undefined>(undefined)
|
|
9
|
+
|
|
10
|
+
export const UploadProvider = ({ value = new UploadManager(), children }: { value: UploadManager, children: ReactNode }) => {
|
|
11
|
+
useEffectOnce(() => () => value.destroy())
|
|
12
|
+
return <context.Provider value={value}>{children}</context.Provider>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function useUploadManager() {
|
|
16
|
+
const manager = useContext(context)
|
|
17
|
+
if (!manager) throw new Error('"useUploadManager()" must be used only within the context of an <UploadProvider>.')
|
|
18
|
+
return manager
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useUploads(): FileUpload[] {
|
|
22
|
+
const manager = useUploadManager()
|
|
23
|
+
const [files, setFiles] = useState<FileUpload[]>([])
|
|
24
|
+
useEffect(() => manager.onChange(setFiles))
|
|
25
|
+
return files
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useUploadErrorEffect(effect: (errors: UploadError[]) => void) {
|
|
29
|
+
const manager = useUploadManager()
|
|
30
|
+
useEffect(() => manager.onError(effect))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function useUploadManagerStatus() {
|
|
34
|
+
const manager = useUploadManager()
|
|
35
|
+
const [status, setStatus] = useState<UploadManagerStatus>(manager.status)
|
|
36
|
+
useEffect(() => manager.onChangeStatus(setStatus))
|
|
37
|
+
return status
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function useUploadStatus(file: FileUpload) {
|
|
41
|
+
const [status, setStatus] = useState<FileUploadStatus>(file.status)
|
|
42
|
+
useEffect(() => file.onChange(setStatus))
|
|
43
|
+
return status
|
|
44
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FileSize } from '../../state/types'
|
|
2
|
+
|
|
3
|
+
export class UploadError extends Error {
|
|
4
|
+
readonly fileName: string
|
|
5
|
+
|
|
6
|
+
constructor(fileName: string, message?: string) {
|
|
7
|
+
super(message || `There was an error while uploading ${fileName}`)
|
|
8
|
+
this.fileName = fileName
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class FileIsTooLarge extends UploadError {
|
|
13
|
+
readonly maxSize: FileSize
|
|
14
|
+
|
|
15
|
+
constructor(fileName: string, maxSize: FileSize) {
|
|
16
|
+
super(fileName, `Can't upload ${fileName} because it exceeds the maximum file size of ${maxSize.value} ${maxSize.unit}.`)
|
|
17
|
+
this.maxSize = maxSize
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class FileAlreadyExists extends UploadError {
|
|
22
|
+
constructor(fileName: string) {
|
|
23
|
+
super(fileName, `Can't upload ${fileName} because it is already on the list.`)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class MaxFilesReached extends UploadError {
|
|
28
|
+
readonly maxFiles: number
|
|
29
|
+
|
|
30
|
+
constructor(fileName: string, maxFiles: number) {
|
|
31
|
+
super(fileName, `Can't upload ${fileName} because the maximum number of files (${maxFiles}) has been reached.`)
|
|
32
|
+
this.maxFiles = maxFiles
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
|
|
3
|
+
interface UsePasteUploadProps {
|
|
4
|
+
textAreaRef: React.RefObject<HTMLTextAreaElement>,
|
|
5
|
+
onUploadFiles: (files: File[]) => void,
|
|
6
|
+
enabled?: boolean,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const usePasteUpload = ({
|
|
10
|
+
textAreaRef,
|
|
11
|
+
onUploadFiles,
|
|
12
|
+
enabled = true,
|
|
13
|
+
}: UsePasteUploadProps) => {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const textarea = textAreaRef.current
|
|
16
|
+
if (!textarea || !enabled) return
|
|
17
|
+
|
|
18
|
+
const handlePaste = (e: ClipboardEvent) => {
|
|
19
|
+
if (e.clipboardData?.files?.length) {
|
|
20
|
+
onUploadFiles(Array.from(e.clipboardData.files))
|
|
21
|
+
e.preventDefault()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
textarea.addEventListener('paste', handlePaste)
|
|
26
|
+
return () => {
|
|
27
|
+
textarea.removeEventListener('paste', handlePaste)
|
|
28
|
+
}
|
|
29
|
+
}, [onUploadFiles, textAreaRef, enabled])
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileSize } from '../../state/types'
|
|
2
|
+
|
|
3
|
+
export function getFileId(file: File) {
|
|
4
|
+
return `${file.name}|${file.lastModified}|${file.size}`
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const unitPower: Record<FileSize['unit'], number> = {
|
|
8
|
+
B: 0,
|
|
9
|
+
KB: 1,
|
|
10
|
+
MB: 2,
|
|
11
|
+
GB: 3,
|
|
12
|
+
}
|
package/src/utils/url.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const stkAIDomain = /^https:\/\/ai(\.\w+)?\.stackspot\.com$/
|
|
2
|
+
const localhostDomain = /^http:\/\/localhost:\d+$/
|
|
3
|
+
const aiPrd = 'https://ai.stackspot.com'
|
|
4
|
+
|
|
5
|
+
export function getUrlToStackSpotAI() {
|
|
6
|
+
const current = location.origin
|
|
7
|
+
return stkAIDomain.test(current) || localhostDomain.test(current) ? current : aiPrd
|
|
8
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { AsyncContent, Badge, Card, IconBox, ImageBox, ImageWithFallback, Text } from '@stack-spot/citric-react'
|
|
3
|
+
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
4
|
+
import { useMemo } from 'react'
|
|
5
|
+
import { useAgentsDictionary } from './dictionary'
|
|
6
|
+
import { AgentDescriptionBox } from './styled'
|
|
7
|
+
|
|
8
|
+
export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
9
|
+
const t = useAgentsDictionary()
|
|
10
|
+
const [agent,, error, { isLoading }] = agentToolsClient.agent.useStatefulQuery({ agentId: agentId! }, { enabled: !!agentId })
|
|
11
|
+
const numberOfKnowledgeSources = agent?.knowledge_sources_config?.knowledge_sources.length ?? 0
|
|
12
|
+
|
|
13
|
+
const knowledgeSources = useMemo(
|
|
14
|
+
() => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
|
|
15
|
+
<li key={index}>
|
|
16
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500} justifyContent="space-between">
|
|
17
|
+
<Text color="light.contrastText">{ks.name}</Text>
|
|
18
|
+
<Badge colorScheme="inverse" appearance="square">{ks.type}</Badge>
|
|
19
|
+
</Card>
|
|
20
|
+
</li>
|
|
21
|
+
)),
|
|
22
|
+
[agent],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const { tools, multiAgents } = useMemo(() => {
|
|
26
|
+
const tools: React.ReactElement[] = []
|
|
27
|
+
const multiAgents: React.ReactElement[] = []
|
|
28
|
+
const builtInTools = agent?.toolkits?.builtin_toolkits ?? []
|
|
29
|
+
const customToolkits = agent?.toolkits?.custom_toolkits ?? []
|
|
30
|
+
for (const toolkit of builtInTools) {
|
|
31
|
+
for (const tool of toolkit.tools ?? []) {
|
|
32
|
+
if (toolkit.id == 'UTILITIES'){
|
|
33
|
+
tools.push(
|
|
34
|
+
<li key={tool.id}>
|
|
35
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
36
|
+
<ImageBox><ImageWithFallback src={toolkit.image_url} fallback={<Icon icon="Cog" />} /></ImageBox>
|
|
37
|
+
<Text color="light.contrastText">{tool?.name || tool?.id || 'unknown'}</Text>
|
|
38
|
+
</Card>
|
|
39
|
+
</li>,
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
if (toolkit.id == 'MULTI_AGENTS'){
|
|
43
|
+
multiAgents.push(
|
|
44
|
+
<li key={tool.id}>
|
|
45
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
46
|
+
<IconBox icon="Agent" />
|
|
47
|
+
<Text color="light.contrastText">{tool.name}</Text>
|
|
48
|
+
</Card>
|
|
49
|
+
</li>,
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const toolkit of customToolkits) {
|
|
55
|
+
for (const tool of toolkit.tools) {
|
|
56
|
+
tools.push(
|
|
57
|
+
<li key={tool.id}>
|
|
58
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
59
|
+
<ImageBox><ImageWithFallback src={toolkit.avatar ?? undefined} fallback={<Icon icon="Cog" />} /></ImageBox>
|
|
60
|
+
<Text color="light.contrastText">{tool.name}</Text>
|
|
61
|
+
</Card>
|
|
62
|
+
</li>,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { tools, multiAgents }
|
|
67
|
+
}, [agent])
|
|
68
|
+
|
|
69
|
+
const mcpToolkits = useMemo(() => agent?.toolkits?.mcp_toolkits?.map(t => (
|
|
70
|
+
<li key={`mcp-${t.id}`}>
|
|
71
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
72
|
+
<ImageBox><ImageWithFallback src={t.avatar ?? undefined} fallback={<Icon icon="Cog" />} /></ImageBox>
|
|
73
|
+
<Text color="light.contrastText">{t.name}</Text>
|
|
74
|
+
</Card>
|
|
75
|
+
</li>
|
|
76
|
+
)), [agent?.toolkits?.mcp_toolkits])
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<AsyncContent loading={isLoading} error={error}>
|
|
80
|
+
<AgentDescriptionBox>
|
|
81
|
+
{agent?.description && <section>
|
|
82
|
+
<Text appearance="microtext1" className="title">{t.description}</Text>
|
|
83
|
+
<Text>{agent?.description}</Text>
|
|
84
|
+
</section>}
|
|
85
|
+
{(!!numberOfKnowledgeSources || !!knowledgeSources?.length) && <section>
|
|
86
|
+
<Text appearance="microtext1" className="title">Knowledge sources</Text>
|
|
87
|
+
<ul>{knowledgeSources}</ul>
|
|
88
|
+
</section>}
|
|
89
|
+
{!!tools?.length && <section>
|
|
90
|
+
<Text appearance="microtext1" className="title">{t.tools}</Text>
|
|
91
|
+
<ul>
|
|
92
|
+
{tools}
|
|
93
|
+
{mcpToolkits}
|
|
94
|
+
</ul>
|
|
95
|
+
</section>}
|
|
96
|
+
{!!multiAgents?.length && <section>
|
|
97
|
+
<Text appearance="microtext1" className="title">{t.multiAgent}</Text>
|
|
98
|
+
<ul>{multiAgents}</ul>
|
|
99
|
+
</section>}
|
|
100
|
+
{agent?.model_name && <section>
|
|
101
|
+
<Text appearance="microtext1" className="title">LLM</Text>
|
|
102
|
+
<Badge colorPalette="orange" appearance="square">{agent?.model_name}</Badge>
|
|
103
|
+
</section>}
|
|
104
|
+
</AgentDescriptionBox>
|
|
105
|
+
</AsyncContent>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Tab } from '@stack-spot/citric-react'
|
|
2
|
+
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
3
|
+
import { useEffect, useRef } from 'react'
|
|
4
|
+
import { RightPanelContentList } from '../../components/RightPanelContentList'
|
|
5
|
+
import { RightPanelTabs } from '../../components/RightPanelTabs'
|
|
6
|
+
import { useCurrentChat, useWidgetState } from '../../context/hooks'
|
|
7
|
+
import { Scope } from '../../features'
|
|
8
|
+
import { checkIsTrial } from '../../utils/check-is-trial'
|
|
9
|
+
import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
|
|
10
|
+
import { useAgentsDictionary } from './dictionary'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
|
|
14
|
+
*/
|
|
15
|
+
export const AgentsPanel = () => {
|
|
16
|
+
const t = useAgentsDictionary()
|
|
17
|
+
const chat = useCurrentChat()
|
|
18
|
+
const isTrial = checkIsTrial()
|
|
19
|
+
const agent = useRef(chat.get('agent'))
|
|
20
|
+
const features = useWidgetState('features')
|
|
21
|
+
const isGroupResourcesByScope = features?.groupResourcesByScope
|
|
22
|
+
const scopes = features?.scopes ?? []
|
|
23
|
+
const spotId = features?.workspaceId
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (agentToolsClient.agentDefaultSlug !== chat.get('agent')?.slug) {
|
|
27
|
+
agent.current = chat.get('agent')
|
|
28
|
+
}
|
|
29
|
+
}, [chat])
|
|
30
|
+
|
|
31
|
+
const allTabsMap: Record<Scope, Omit<Tab, 'key'>> = {
|
|
32
|
+
favorite: { label: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
|
|
33
|
+
builtin: { label: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
|
|
34
|
+
personal: { label: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
|
|
35
|
+
shared: { label: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
|
|
36
|
+
workspace: { label: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
|
|
37
|
+
account: { label: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const defaultScopes: Scope[] = ['favorite', 'builtin', 'personal', 'shared', 'workspace', 'account']
|
|
41
|
+
|
|
42
|
+
const rawScopes: Scope[] = scopes?.length ? scopes : defaultScopes
|
|
43
|
+
|
|
44
|
+
const scopesToRender: Scope[] = isTrial
|
|
45
|
+
? ['favorite', 'builtin', 'personal']
|
|
46
|
+
: rawScopes
|
|
47
|
+
|
|
48
|
+
const tabs = scopesToRender
|
|
49
|
+
.map(scope => scope in allTabsMap ? ({ key: scope, ...allTabsMap[scope] }) : undefined)
|
|
50
|
+
.filter(Boolean) as Tab[]
|
|
51
|
+
|
|
52
|
+
return (isGroupResourcesByScope ? (
|
|
53
|
+
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
54
|
+
) : (
|
|
55
|
+
<RightPanelContentList><AgentsTab workspaceId={spotId} agent={agent} /></RightPanelContentList>
|
|
56
|
+
))
|
|
57
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Button, ImageWithFallback } from '@stack-spot/citric-react'
|
|
3
|
+
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
|
+
import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
|
|
5
|
+
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
6
|
+
import { debounce } from 'lodash'
|
|
7
|
+
import { useCallback, useMemo, useState, useTransition } from 'react'
|
|
8
|
+
import { NavigationComponent } from '../../components/ComponentNavigator'
|
|
9
|
+
import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
|
|
10
|
+
import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
|
|
11
|
+
import { useCurrentChat } from '../../context/hooks'
|
|
12
|
+
import { useRightPanel } from '../../right-panel/hooks'
|
|
13
|
+
import { ChatProperties } from '../../state/ChatState'
|
|
14
|
+
import { AgentDescription } from './AgentDescription'
|
|
15
|
+
import { useAgentsDictionary } from './dictionary'
|
|
16
|
+
import { useAgentFavorites } from './useAgentFavorites'
|
|
17
|
+
|
|
18
|
+
export interface AgentTabProps {
|
|
19
|
+
visibility?: AgentVisibilityLevel,
|
|
20
|
+
workspaceId?: string,
|
|
21
|
+
agent: React.MutableRefObject<ChatProperties['agent']>,
|
|
22
|
+
showSubmitButton?: boolean,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = true }: AgentTabProps) => {
|
|
26
|
+
const t = useAgentsDictionary()
|
|
27
|
+
const { close } = useRightPanel()
|
|
28
|
+
const chat = useCurrentChat()
|
|
29
|
+
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
30
|
+
const [submitEnabled, setSubmitEnabled] = useState(false)
|
|
31
|
+
const listFavorites = useFavorites()
|
|
32
|
+
const agentDefault = agentToolsClient.agentDefault.useQuery()
|
|
33
|
+
|
|
34
|
+
const [filter, setFilter] = useState<string | undefined>()
|
|
35
|
+
const [apiFilter, setApiFilter] = useState<string | undefined>()
|
|
36
|
+
const [isPending, startTransition] = useTransition()
|
|
37
|
+
|
|
38
|
+
const runOnChange = useCallback(
|
|
39
|
+
debounce((value?: string) => {
|
|
40
|
+
startTransition(() => {
|
|
41
|
+
setApiFilter(value)
|
|
42
|
+
})
|
|
43
|
+
}, 500),
|
|
44
|
+
[startTransition],
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
const data = workspaceAiClient.getAgentFromWorkspaceAi.useStatefulQuery({ workspaceId: workspaceId! },
|
|
48
|
+
{ enabled: !!workspaceId })
|
|
49
|
+
const workspaceAgents = data?.[0] as AgentResponseWithBuiltIn[]
|
|
50
|
+
|
|
51
|
+
const [agentsData = [], { fetchNextPage, hasNextPage }] = agentToolsClient.agentsMultipleFilters.useInfiniteQuery({
|
|
52
|
+
filters: {
|
|
53
|
+
page: 1,
|
|
54
|
+
size: 20,
|
|
55
|
+
name: apiFilter,
|
|
56
|
+
...(visibility?.length ? { visibility_list: [visibility] } : {}),
|
|
57
|
+
},
|
|
58
|
+
}, { enabled: !workspaceId })
|
|
59
|
+
|
|
60
|
+
const agents = workspaceId ? workspaceAgents : agentsData
|
|
61
|
+
|
|
62
|
+
const initialValue = useMemo<AgentResponseWithBuiltIn | undefined>(
|
|
63
|
+
() => {
|
|
64
|
+
const initial = agent.current
|
|
65
|
+
? agents?.find(a => a.id === agent.current?.id)
|
|
66
|
+
: chat.get('agent') ? agents?.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn
|
|
67
|
+
if (initial && !submitEnabled) setSubmitEnabled(true)
|
|
68
|
+
return initial
|
|
69
|
+
},
|
|
70
|
+
[agents],
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
function submit() {
|
|
74
|
+
if (agent.current) chat.set('agent', agent.current)
|
|
75
|
+
close()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return <>
|
|
79
|
+
<div className="content">
|
|
80
|
+
<DescribedRadioGroup
|
|
81
|
+
fetchNextPage={fetchNextPage}
|
|
82
|
+
hasNextPage={hasNextPage && !workspaceId}
|
|
83
|
+
options={agents}
|
|
84
|
+
initialValue={initialValue}
|
|
85
|
+
filter={workspaceId ? undefined : filter}
|
|
86
|
+
setFilter={workspaceId ? undefined : (value?: string) => {
|
|
87
|
+
setFilter(value)
|
|
88
|
+
runOnChange(value)
|
|
89
|
+
}}
|
|
90
|
+
onChange={(ag) => {
|
|
91
|
+
agent.current = ag
|
|
92
|
+
? { ...ag, label: ag.name, image: ag.avatar!, slug: ag.slug, builtIn: ag.visibility_level === 'built_in' }
|
|
93
|
+
: undefined
|
|
94
|
+
setSubmitEnabled(true)
|
|
95
|
+
}}
|
|
96
|
+
isLoading={isPending}
|
|
97
|
+
data={ag => ({
|
|
98
|
+
idOrSlug: ag.id,
|
|
99
|
+
// below, "key" is important. I don't know why exactly, but sometimes the avatar doesn't update if we don't do this.
|
|
100
|
+
image: <ImageWithFallback key={ag.id} src={ag.avatar ?? undefined} fallback={<Icon icon="Agent" />} />,
|
|
101
|
+
description: <AgentDescription agentId={ag.id} />,
|
|
102
|
+
name: ag.name,
|
|
103
|
+
listFavorites,
|
|
104
|
+
onAddFavorite,
|
|
105
|
+
onRemoveFavorite,
|
|
106
|
+
})}
|
|
107
|
+
emptyResults={
|
|
108
|
+
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />
|
|
109
|
+
}
|
|
110
|
+
emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
{!!agents?.length && showSubmitButton && <Button onClick={submit} disabled={!submitEnabled}>{t.apply}</Button>}
|
|
114
|
+
</>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function AgentsTabWorkspace({ agent, visibility, showSubmitButton }: AgentTabProps) {
|
|
118
|
+
const workspaceTabComponents = useMemo(() => ({ agent: AgentsTab }), [agent])
|
|
119
|
+
|
|
120
|
+
const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
|
|
121
|
+
component: 'agent',
|
|
122
|
+
props: { visibility, workspaceId: workspace.id, agent, showSubmitButton },
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
return <WorkspaceTabNavigator components={workspaceTabComponents} getNavigateParam={buildNavigateParams} />
|
|
126
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
|
+
|
|
3
|
+
const dictionary = {
|
|
4
|
+
en: {
|
|
5
|
+
title: 'Agents',
|
|
6
|
+
subtitle: 'By selecting an Agent, it will be consulted to generate the answers.',
|
|
7
|
+
personal: 'Personal',
|
|
8
|
+
builtin: 'Built-in',
|
|
9
|
+
shared: 'Shared',
|
|
10
|
+
account: 'Account',
|
|
11
|
+
apply: 'Apply',
|
|
12
|
+
noSearchResults: "Your search didn't yield results.",
|
|
13
|
+
noSearchResultsDescription: 'Please, try another search term.',
|
|
14
|
+
noData: 'There are no agents in this category yet.',
|
|
15
|
+
noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new agents.',
|
|
16
|
+
defaultAgentDescription: 'The StackSpot CodeGen is an advanced artificial intelligence agent designed to optimize and accelerate software development. Integrated directly into your integrated development environment, StackSpot CodeGen offers real-time code suggestions, helping developers write high-quality code more efficiently. With robust features such as creating Stacks AI, customized knowledge sources, and quick commands, StackSpot CodeGen contextualizes your development needs to provide the best answers and code suggestions.',
|
|
17
|
+
description: 'Description',
|
|
18
|
+
favorites: 'Favorites',
|
|
19
|
+
tools: 'Tools',
|
|
20
|
+
spots: 'Spots',
|
|
21
|
+
multiAgent: 'Multi-agents',
|
|
22
|
+
},
|
|
23
|
+
pt: {
|
|
24
|
+
title: 'Agentes',
|
|
25
|
+
subtitle: 'Ao selecionar um Agente, ele será consultado para gerar as respostas.',
|
|
26
|
+
personal: 'Pessoal',
|
|
27
|
+
builtin: 'Embutido',
|
|
28
|
+
shared: 'Compartilhado',
|
|
29
|
+
account: 'Conta',
|
|
30
|
+
apply: 'Aplicar',
|
|
31
|
+
noSearchResults: 'Sua busca não produziu resultados.',
|
|
32
|
+
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
33
|
+
noData: 'Ainda não há agentes nesta categoria.',
|
|
34
|
+
noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novos agentes.',
|
|
35
|
+
defaultAgentDescription: 'O StackSpot CodeGen é um agente de inteligência artificial avançado projetado para otimizar e acelerar o desenvolvimento de software. Integrado diretamente ao seu ambiente de desenvolvimento, o StackSpot CodeGen oferece sugestões de código em tempo real, ajudando os desenvolvedores a escreverem código de alta qualidade de forma mais eficiente. Com recursos robustos, como a criação de Stacks AI, Knowledge Sources personalizadas e comandos rápidos, o StackSpot CodeGen contextualiza suas necessidades de desenvolvimento para fornecer as melhores respostas e sugestões de código.',
|
|
36
|
+
description: 'Descrição',
|
|
37
|
+
favorites: 'Favoritos',
|
|
38
|
+
tools: 'Ferramentas',
|
|
39
|
+
spots: 'Spots',
|
|
40
|
+
multiAgent: 'Multi-agents',
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
} satisfies Dictionary
|
|
44
|
+
|
|
45
|
+
export const useAgentsDictionary = () => useTranslate(dictionary)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect } from 'react'
|
|
2
|
+
import { useWidget, useWidgetState } from '../../context/hooks'
|
|
3
|
+
import { useRightPanel } from '../../right-panel/hooks'
|
|
4
|
+
import { AgentsPanel } from './AgentsPanel'
|
|
5
|
+
import { useAgentsDictionary } from './dictionary'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Renders the panel to select an agent of this panel is opened.
|
|
9
|
+
*/
|
|
10
|
+
export const Agents = () => {
|
|
11
|
+
const t = useAgentsDictionary()
|
|
12
|
+
const panel = useWidgetState('panel')
|
|
13
|
+
const { open } = useRightPanel()
|
|
14
|
+
const widget = useWidget()
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (panel === 'agent') open(
|
|
18
|
+
<AgentsPanel />,
|
|
19
|
+
{ title: t.title, description: t.subtitle, onClose: () => widget.set('panel', undefined) },
|
|
20
|
+
)
|
|
21
|
+
}, [panel, t])
|
|
22
|
+
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|