@stack-spot/ai-chat-widget 0.10.0 → 1.0.0-dev.1768314799914
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/AbortedError.d.ts +5 -0
- package/dist/AbortedError.d.ts.map +1 -0
- package/dist/AbortedError.js +7 -0
- package/dist/AbortedError.js.map +1 -0
- package/dist/StackspotAIWidget.d.ts +48 -7
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +22 -15
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +171 -0
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +22 -0
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -0
- package/dist/chat-interceptors/CustomInputs.js +71 -0
- package/dist/chat-interceptors/CustomInputs.js.map +1 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts +14 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -0
- package/dist/chat-interceptors/quick-command-questions.js +28 -0
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -0
- package/dist/chat-interceptors/quick-commands.d.ts +14 -1
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +442 -8
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +27 -2
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +230 -29
- 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 +189 -15
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +29 -18
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +129 -15
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +87 -11
- 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 +15 -1
- 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 +15 -12
- 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 +20 -6
- 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 +1 -0
- package/dist/utils/programming-languages.d.ts.map +1 -1
- package/dist/utils/programming-languages.js +11 -0
- package/dist/utils/programming-languages.js.map +1 -1
- package/dist/utils/string.d.ts +7 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +11 -0
- package/dist/utils/string.js.map +1 -0
- 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 +57 -4
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +167 -20
- 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 +183 -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 +26 -20
- 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 +116 -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 +20 -13
- package/package.stg.json +4 -0
- package/scripts/package-override.js +105 -0
- package/src/AbortedError.ts +7 -0
- package/src/StackspotAIWidget.tsx +96 -27
- package/src/app-metadata.json +171 -0
- package/src/assets/placeholder.png +0 -0
- package/src/chat-interceptors/CustomInputs.ts +83 -0
- package/src/chat-interceptors/quick-command-questions.ts +25 -0
- package/src/chat-interceptors/quick-commands.ts +503 -7
- package/src/chat-interceptors/send-message.ts +256 -28
- 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 +194 -27
- package/src/state/ChatState.ts +172 -17
- package/src/state/ChatTabsController.ts +78 -8
- package/src/state/ObservableState.ts +15 -1
- 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 +17 -15
- 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 +22 -8
- package/src/utils/planning-tool.ts +41 -0
- package/src/utils/programming-languages.ts +12 -0
- package/src/utils/string.ts +10 -0
- 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 +472 -56
- package/src/views/Chat/ChatMessages.tsx +18 -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 +189 -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 +31 -22
- 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 +158 -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/Editor.d.ts +0 -9
- package/dist/components/Editor.d.ts.map +0 -1
- package/dist/components/Editor.js +0 -2
- package/dist/components/Editor.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/Editor.tsx +0 -12
- 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,69 @@
|
|
|
1
|
+
import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons'
|
|
2
|
+
import { AsyncContent, Button, Column, FieldGroup, Icon, Input, Row } from '@stack-spot/citric-react'
|
|
3
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
4
|
+
import { agentToolsClient, genAiInferenceClient } from '@stack-spot/portal-network'
|
|
5
|
+
import { useMemo, useState } from 'react'
|
|
6
|
+
import { CSSProperties } from 'styled-components'
|
|
7
|
+
import { useCurrentChat, useCurrentChatState } from '../../../context/hooks'
|
|
8
|
+
import { useMessageInputDictionary } from '../dictionary'
|
|
9
|
+
import { RowWrapperStyled, stylesModelSwitcher } from '../styled'
|
|
10
|
+
import { getListModelsData, handleFilterTypeModel, providerIcon } from './utils'
|
|
11
|
+
|
|
12
|
+
export const ModelSwitcher = () => {
|
|
13
|
+
const t = useMessageInputDictionary()
|
|
14
|
+
const agentCurrentChat = useCurrentChatState('agent')
|
|
15
|
+
const chat = useCurrentChat()
|
|
16
|
+
const [filter, setFilter] = useState('')
|
|
17
|
+
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
18
|
+
const [agentData, isLoadingAgentData] = agentToolsClient.agent.useStatefulQuery({ agentId: agentCurrentChat?.id || '' },
|
|
19
|
+
{ enabled: !!agentCurrentChat?.id })
|
|
20
|
+
const [models, isLoadingModels] =
|
|
21
|
+
genAiInferenceClient.listModels.useStatefulQuery({ pageSize: 999, active: true })
|
|
22
|
+
|
|
23
|
+
const { modelName, modelProviderType, listItemsData } =
|
|
24
|
+
getListModelsData(chat, setVisibleMenu, agentData, models)
|
|
25
|
+
|
|
26
|
+
const data = useMemo(() => {
|
|
27
|
+
const items = listItemsData ?? []
|
|
28
|
+
return handleFilterTypeModel(items, t, filter)
|
|
29
|
+
}, [agentCurrentChat?.id, listItemsData, filter])
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<RowWrapperStyled>
|
|
33
|
+
<AsyncContent loading={isLoadingAgentData && isLoadingModels}>
|
|
34
|
+
<Button
|
|
35
|
+
className="button-select-model"
|
|
36
|
+
colorScheme="light"
|
|
37
|
+
size="sm"
|
|
38
|
+
aria-label={t.agent}
|
|
39
|
+
title={t.agent}
|
|
40
|
+
onClick={() => setVisibleMenu(state => !state)}
|
|
41
|
+
>
|
|
42
|
+
<Icon
|
|
43
|
+
icon={providerIcon[modelProviderType as CitricIconOutline | CitricIconSocial]}
|
|
44
|
+
group={modelProviderType === 'stackspot' ? 'outline' : 'social'}
|
|
45
|
+
/>
|
|
46
|
+
{modelName}
|
|
47
|
+
<Icon icon="ChevronDown" group="fill" size="sm" />
|
|
48
|
+
</Button>
|
|
49
|
+
</AsyncContent>
|
|
50
|
+
<SelectionList
|
|
51
|
+
id="menuModelSwitcher"
|
|
52
|
+
items={data || []}
|
|
53
|
+
visible={visibleMenu}
|
|
54
|
+
onHide={() => setVisibleMenu(false)}
|
|
55
|
+
showListAsCard
|
|
56
|
+
style={stylesModelSwitcher.selection as CSSProperties}
|
|
57
|
+
before={
|
|
58
|
+
<Column>
|
|
59
|
+
<FieldGroup fullWidth style={{ marginTop: '8px' }}>
|
|
60
|
+
<Icon icon="Search" />
|
|
61
|
+
<Input type="search" value={filter} onChange={(value) => (setFilter(value))} />
|
|
62
|
+
</FieldGroup>
|
|
63
|
+
{!data.length ? <Row m="16px 8px">{t.nothingFound}</Row> : undefined}
|
|
64
|
+
</Column>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
</RowWrapperStyled>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconBox } from '@stack-spot/citric-react'
|
|
3
|
+
import { AgentModel } from '@stack-spot/portal-network/api/agent-tools'
|
|
4
|
+
import { LlmModelsResponse, PaginatedResponseLlmModelsResponse } from '@stack-spot/portal-network/api/genAiInference'
|
|
5
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
6
|
+
import { Dispatch, ReactElement } from 'react'
|
|
7
|
+
import { ChatState } from '../../../state/ChatState'
|
|
8
|
+
|
|
9
|
+
export interface ItemProps {
|
|
10
|
+
active?: boolean,
|
|
11
|
+
label?: string,
|
|
12
|
+
icon?: ReactElement,
|
|
13
|
+
self_hosted?: boolean,
|
|
14
|
+
onClick?: VoidFunction,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const providerIcon: Record<string, CitricIconSocial | CitricIconOutline> = {
|
|
18
|
+
openai: 'OpenAI',
|
|
19
|
+
bedrock: 'AWSBedrock',
|
|
20
|
+
azure: 'Azure',
|
|
21
|
+
stackspot: 'StackSpot',
|
|
22
|
+
gemini: 'Gemini',
|
|
23
|
+
deepseek: 'DeepSeek',
|
|
24
|
+
anthropic: 'Anthropic',
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getListModelsData(
|
|
28
|
+
chat: ChatState,
|
|
29
|
+
setVisibleMenu: Dispatch<React.SetStateAction<boolean>>,
|
|
30
|
+
agent?: AgentModel,
|
|
31
|
+
models?: PaginatedResponseLlmModelsResponse) {
|
|
32
|
+
|
|
33
|
+
const chatSelectedModelId = chat.get('selected_model_id')
|
|
34
|
+
|
|
35
|
+
const listModelsToShow = agent?.visibility_level !== 'built_in' && !!agent?.model_id ?
|
|
36
|
+
models?.items.filter((model) => agent?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
|
|
37
|
+
models?.items
|
|
38
|
+
|
|
39
|
+
const modelAvailableDefault = agent?.available_llm_models?.find((model) => (model.is_default || model.model_id === agent.model_id))
|
|
40
|
+
const modelListData = parseModelList(chat, setVisibleMenu, listModelsToShow, modelAvailableDefault?.model_id)
|
|
41
|
+
|
|
42
|
+
if (agent?.visibility_level === 'built_in' || !agent?.model_id) {
|
|
43
|
+
|
|
44
|
+
const modelDefaultProviderType = models?.items.find((modelAccount) =>
|
|
45
|
+
chatSelectedModelId ? modelAccount.id === chatSelectedModelId :
|
|
46
|
+
modelAccount.resources.find((resource) => resource.is_default))?.model_configuration.provider.provider_type
|
|
47
|
+
|
|
48
|
+
const modelDefaultActive = modelListData.find((model) => model?.active)
|
|
49
|
+
|
|
50
|
+
return { modelName: modelDefaultActive?.label, modelProviderType: modelDefaultProviderType, listItemsData: modelListData }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const modelAccount = models?.items.find((modelAccount) => modelAccount.id === (chatSelectedModelId || agent.model_id))
|
|
54
|
+
const modelProviderType = modelAccount?.model_configuration.provider.provider_type
|
|
55
|
+
const modelSelectedName = modelAccount?.display_name || modelAvailableDefault?.model_name || agent?.model_name
|
|
56
|
+
|
|
57
|
+
const listItemsData =
|
|
58
|
+
modelListData && modelListData?.length > 0 ? modelListData :
|
|
59
|
+
[{
|
|
60
|
+
active: true,
|
|
61
|
+
label: modelSelectedName || '',
|
|
62
|
+
icon: <IconBox icon={providerIcon[modelProviderType || 'stackspot']}
|
|
63
|
+
appearance="square"
|
|
64
|
+
group={modelProviderType === 'stackspot' ? 'outline' : 'social'} />,
|
|
65
|
+
self_hosted: modelAccount?.self_hosted || false,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
chat.set('selected_model_id', modelAvailableDefault?.model_id)
|
|
68
|
+
setVisibleMenu(false)
|
|
69
|
+
},
|
|
70
|
+
}]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
return { modelName: modelSelectedName, modelProviderType, listItemsData }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function parseModelList(
|
|
77
|
+
chat: ChatState,
|
|
78
|
+
setVisibleMenu: Dispatch<React.SetStateAction<boolean>>,
|
|
79
|
+
listModel?: LlmModelsResponse[],
|
|
80
|
+
modelAvailableDefaultId?: string,
|
|
81
|
+
) {
|
|
82
|
+
|
|
83
|
+
const data = Array<ItemProps>()
|
|
84
|
+
const chatModelId = chat.get('selected_model_id')
|
|
85
|
+
|
|
86
|
+
listModel?.forEach((model) => {
|
|
87
|
+
data.push({
|
|
88
|
+
active: chatModelId ? chatModelId === model.id : modelAvailableDefaultId === model.id ||
|
|
89
|
+
model.resources?.some((resource) => resource.is_default && resource.name === 'agents'),
|
|
90
|
+
label: model?.display_name || 'LLM',
|
|
91
|
+
icon: <IconBox
|
|
92
|
+
style={{ backgroundColor: theme.color.light[300] }}
|
|
93
|
+
appearance="square"
|
|
94
|
+
icon={providerIcon[model.model_configuration.provider.provider_type]}
|
|
95
|
+
group={model.model_configuration.provider.provider_type === 'stackspot' ? 'outline' : 'social'}
|
|
96
|
+
/>,
|
|
97
|
+
self_hosted: model.self_hosted,
|
|
98
|
+
onClick: () => {
|
|
99
|
+
chat.set('selected_model_id', model.id)
|
|
100
|
+
setVisibleMenu(false)
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
return data
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function handleFilterTypeModel(items: ItemProps[], t: Record<string, string>, filter?: string) {
|
|
108
|
+
const filterLower = filter?.toLocaleLowerCase()
|
|
109
|
+
const filteredItens = items.filter((item) => filterLower ? item?.label?.toLocaleLowerCase().includes(filterLower) : item)
|
|
110
|
+
|
|
111
|
+
const { selfHosted, hosted } = filteredItens.reduce(
|
|
112
|
+
(acc, model) => {
|
|
113
|
+
if (model?.self_hosted) {
|
|
114
|
+
acc.selfHosted.push(model)
|
|
115
|
+
} else {
|
|
116
|
+
acc.hosted.push(model)
|
|
117
|
+
}
|
|
118
|
+
return acc
|
|
119
|
+
},
|
|
120
|
+
{ selfHosted: [], hosted: [] } as { selfHosted: typeof items, hosted: typeof items },
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
const sections = [
|
|
124
|
+
{
|
|
125
|
+
label: t.hosted,
|
|
126
|
+
children: hosted,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: t.selfHosted,
|
|
130
|
+
children: selfHosted,
|
|
131
|
+
},
|
|
132
|
+
]
|
|
133
|
+
|
|
134
|
+
const filteredByHavingItens = sections
|
|
135
|
+
.filter(section => section.children.length > 0)
|
|
136
|
+
.map(section => ({
|
|
137
|
+
type: 'section',
|
|
138
|
+
label: section.label,
|
|
139
|
+
children: section.children,
|
|
140
|
+
}))
|
|
141
|
+
|
|
142
|
+
return filteredByHavingItens
|
|
143
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { AgentVisibilityLevel, aiClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
3
|
+
import { QuickCommandResponse, VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
4
|
+
import { useCallback } from 'react'
|
|
5
|
+
import { Selector } from '../../components/Selector'
|
|
6
|
+
import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks'
|
|
7
|
+
import { quickCommandRegex } from '../../regex'
|
|
8
|
+
|
|
9
|
+
type QuickCommandResponseWithSpaceName = QuickCommandResponse & { spaceName?: string }
|
|
10
|
+
|
|
11
|
+
export const QuickCommandSelector = ({ inputRef, isTrial }:
|
|
12
|
+
{ isTrial: boolean, inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement> }) => {
|
|
13
|
+
const chat = useCurrentChat()
|
|
14
|
+
const isQuickCommandEnabled = useCurrentChatState('features').quickCommands
|
|
15
|
+
const spotId = useWidgetState('features')?.workspaceId
|
|
16
|
+
|
|
17
|
+
const [addFavorite, pendingAddFav] = aiClient.addFavoriteQuickCommand.useMutation()
|
|
18
|
+
const [removeFavorite, pendingRemoveFav] = aiClient.removeFavoriteQuickCommand.useMutation()
|
|
19
|
+
|
|
20
|
+
const addFavoriteQc = async (idOrSlug?: string) => {
|
|
21
|
+
try {
|
|
22
|
+
await addFavorite({ slug: idOrSlug || '' })
|
|
23
|
+
await aiClient.allQuickCommands.invalidate()
|
|
24
|
+
} catch (error) {
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.error(error)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
31
|
+
const onAddFavorite = (idOrSlug?: string) => new Promise<boolean>(async (resolve, reject) => {
|
|
32
|
+
try {
|
|
33
|
+
await addFavoriteQc(idOrSlug)
|
|
34
|
+
if (!pendingAddFav) {
|
|
35
|
+
resolve(true)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.error(error)
|
|
41
|
+
reject(error)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const removeFavoriteQc = async (idOrSlug?: string) => {
|
|
46
|
+
try {
|
|
47
|
+
await removeFavorite({ slug: idOrSlug || '' })
|
|
48
|
+
await aiClient.allQuickCommands.invalidate()
|
|
49
|
+
} catch (error) {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.error(error)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
56
|
+
const onRemoveFavorite = (idOrSlug?: string) => new Promise<boolean>(async (resolve, reject) => {
|
|
57
|
+
try {
|
|
58
|
+
await removeFavoriteQc(idOrSlug)
|
|
59
|
+
if (!pendingRemoveFav) {
|
|
60
|
+
resolve(true)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.error(error)
|
|
66
|
+
reject(error)
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const onSelectItem = useCallback((qc: QuickCommandResponseWithSpaceName) => {
|
|
71
|
+
const newValue = `/${qc.slug}`
|
|
72
|
+
chat.set('nextMessage', newValue)
|
|
73
|
+
|
|
74
|
+
if (!inputRef.current) return
|
|
75
|
+
inputRef.current.value = newValue
|
|
76
|
+
inputRef.current.focus()
|
|
77
|
+
}, [chat, inputRef])
|
|
78
|
+
|
|
79
|
+
const getQuickCommands = ({ filter, visibility }: { filter?: string, visibility?: AgentVisibilityLevel[] | VisibilityLevelEnum[] }) => {
|
|
80
|
+
|
|
81
|
+
if (spotId) {
|
|
82
|
+
return { data: workspaceAiClient.getQCFromWorkspaceAi.useQuery({ workspaceId: spotId, name: filter }) }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const [quickCommands, { fetchNextPage, hasNextPage }] = aiClient.allQuickCommandsV3.useInfiniteQuery({
|
|
86
|
+
order: 'a-to-z',
|
|
87
|
+
visibilityList: visibility as VisibilityLevelEnum[],
|
|
88
|
+
name: filter,
|
|
89
|
+
page: 1, size: 20,
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const quickCommandsFiltered = quickCommands.filter(
|
|
93
|
+
(qc) => qc.visibility_level.toLowerCase() !== 'workspace',
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
const workspaceQuickCommands = workspaceAiClient.workspacesContentsByType.useQuery({
|
|
97
|
+
contentType: 'quick_command',
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const workspaceQuickCommandsWithWorkspaceName: QuickCommandResponseWithSpaceName[] =
|
|
101
|
+
workspaceQuickCommands.flatMap(({ qcs, space_name }) =>
|
|
102
|
+
qcs?.map((qc) => ({ ...qc, spaceName: space_name })),
|
|
103
|
+
) as QuickCommandResponseWithSpaceName[]
|
|
104
|
+
|
|
105
|
+
const filteredWorkspaceQuickCommand = filter ? workspaceQuickCommandsWithWorkspaceName?.filter((qc) =>
|
|
106
|
+
qc.name?.toLowerCase().includes(filter!)) : workspaceQuickCommandsWithWorkspaceName
|
|
107
|
+
|
|
108
|
+
const data = !visibility ? [...quickCommandsFiltered, ...filteredWorkspaceQuickCommand] : (
|
|
109
|
+
visibility.includes('workspace') ? filteredWorkspaceQuickCommand : quickCommandsFiltered
|
|
110
|
+
)
|
|
111
|
+
return { data, fetchNextPage: fetchNextPage, hasNextPage }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const QuickCommandItem = ({ slug, description, spaceName }: QuickCommandResponseWithSpaceName) => <>
|
|
115
|
+
<p className="selector-description">{spaceName}</p>
|
|
116
|
+
<p className="selector-title">/{slug?.toUpperCase()}</p>
|
|
117
|
+
<p className="selector-description">{description}</p>
|
|
118
|
+
</>
|
|
119
|
+
|
|
120
|
+
return <Selector
|
|
121
|
+
inputRef={inputRef}
|
|
122
|
+
favorite={{ onAddFavorite, onRemoveFavorite, favoriteIsSlug: true }}
|
|
123
|
+
selectorConfig={{
|
|
124
|
+
resourceName: 'Quick Command',
|
|
125
|
+
shortcut: '/',
|
|
126
|
+
icon: <Icon icon="QuickCommand" />,
|
|
127
|
+
searchProp: 'slug',
|
|
128
|
+
urlBuilder: (qc) => `/quick-command/${qc?.slug}`,
|
|
129
|
+
regex: quickCommandRegex,
|
|
130
|
+
sections: isTrial ? ['favorite', 'personal'] : ['favorite', 'personal', 'workspace', 'account', 'shared'],
|
|
131
|
+
isEnabled: isQuickCommandEnabled,
|
|
132
|
+
onSelect: onSelectItem,
|
|
133
|
+
renderComponentItem: QuickCommandItem,
|
|
134
|
+
useData: getQuickCommands,
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconButton, ImageButton, MenuAction, MenuOverlay, MenuSection } from '@stack-spot/citric-react'
|
|
3
|
+
import { useMemo } from 'react'
|
|
4
|
+
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
5
|
+
import { useUploadManager } from '../../utils/upload/context'
|
|
6
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
7
|
+
|
|
8
|
+
export const SelectContent = () => {
|
|
9
|
+
const widget = useWidget()
|
|
10
|
+
const features = useCurrentChatState('features')
|
|
11
|
+
const t = useMessageInputDictionary()
|
|
12
|
+
const uploadManager = useUploadManager()
|
|
13
|
+
const hasFeatureButtons = features.workspace || features.knowledgeSource || features.stack || features.upload
|
|
14
|
+
const chat = useCurrentChat()
|
|
15
|
+
|
|
16
|
+
const itemConfigs = useMemo<(MenuAction & { key: keyof typeof features, section: 0 | 1 })[]>(() => ([
|
|
17
|
+
{
|
|
18
|
+
role: 'button',
|
|
19
|
+
key: 'agent',
|
|
20
|
+
section: 0,
|
|
21
|
+
label: t.chatAgent,
|
|
22
|
+
icon: <Icon icon="Agent" />,
|
|
23
|
+
onClick: (event?: React.MouseEvent) => {
|
|
24
|
+
event?.stopPropagation()
|
|
25
|
+
chat.set('nextMessage', '@')
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
role: 'button',
|
|
30
|
+
key: 'quickCommands',
|
|
31
|
+
section: 0,
|
|
32
|
+
label: 'Quick Commands',
|
|
33
|
+
icon: <Icon icon="QuickCommand" />,
|
|
34
|
+
onClick: (event?: React.MouseEvent) => {
|
|
35
|
+
event?.stopPropagation()
|
|
36
|
+
chat.set('nextMessage', '/')
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
role: 'button',
|
|
41
|
+
key: 'knowledgeSource',
|
|
42
|
+
section: 0,
|
|
43
|
+
label: 'Knowledge Sources',
|
|
44
|
+
icon: <Icon icon="KnowledgeSource" />,
|
|
45
|
+
onClick: () => widget.set('panel', 'ks'),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
role: 'button',
|
|
49
|
+
key: 'stack',
|
|
50
|
+
section: 0,
|
|
51
|
+
label: 'Stacks AI',
|
|
52
|
+
icon: <Icon icon="Stack" />,
|
|
53
|
+
onClick: () => widget.set('panel', 'stack'),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
role: 'button',
|
|
57
|
+
key: 'workspace',
|
|
58
|
+
section: 0,
|
|
59
|
+
label: 'Spots',
|
|
60
|
+
icon: <Icon icon="Spaces" />,
|
|
61
|
+
onClick: () => widget.set('panel', 'workspace'),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
role: 'button',
|
|
65
|
+
key: 'upload',
|
|
66
|
+
section: 1,
|
|
67
|
+
label: t.upload,
|
|
68
|
+
onClick: () => uploadManager.open(),
|
|
69
|
+
className: 'upload-item',
|
|
70
|
+
icon: <Icon icon="DocumentUpload" />,
|
|
71
|
+
},
|
|
72
|
+
] as const).filter(({ key }) => features[key]), [features, widget])
|
|
73
|
+
|
|
74
|
+
const listItems = useMemo(() => {
|
|
75
|
+
const sections: [MenuSection, MenuSection] = [
|
|
76
|
+
{ type: 'section', children: [] },
|
|
77
|
+
{ type: 'section', children: [] },
|
|
78
|
+
]
|
|
79
|
+
itemConfigs.forEach(item => sections[item.section].children.push(item))
|
|
80
|
+
return sections.filter(s => !!s.children.length)
|
|
81
|
+
}, [itemConfigs])
|
|
82
|
+
|
|
83
|
+
if (!hasFeatureButtons) return null
|
|
84
|
+
|
|
85
|
+
return itemConfigs.length > 1 ? (
|
|
86
|
+
<MenuOverlay items={listItems} position="right" bgLevel={500} roundedItems menuClass="menu-citric-hr" alignment="end">
|
|
87
|
+
<IconButton icon="Plus" />
|
|
88
|
+
</MenuOverlay>
|
|
89
|
+
) : (
|
|
90
|
+
<ImageButton
|
|
91
|
+
appearance="square"
|
|
92
|
+
title={`${itemConfigs[0].label}`}
|
|
93
|
+
aria-label={`${itemConfigs[0].label}`}
|
|
94
|
+
onClick={itemConfigs[0].onClick}
|
|
95
|
+
>
|
|
96
|
+
{itemConfigs[0].icon}
|
|
97
|
+
</ImageButton>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
|
+
import { interpolate } from '@stack-spot/portal-translate'
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
4
|
+
import { FadingOverflow } from '../../components/FadingOverflow'
|
|
5
|
+
import { FileDescription } from '../../components/FileDescription'
|
|
6
|
+
import { useCurrentChat } from '../../context/hooks'
|
|
7
|
+
import { ChatEntry } from '../../state/ChatEntry'
|
|
8
|
+
import { useUploadErrorEffect, useUploadManager, useUploads, useUploadStatus } from '../../utils/upload/context'
|
|
9
|
+
import { FileIsTooLarge, MaxFilesReached } from '../../utils/upload/errors'
|
|
10
|
+
import { FileUpload } from '../../utils/upload/FileUpload'
|
|
11
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
12
|
+
|
|
13
|
+
interface UploadedFileProps {
|
|
14
|
+
upload: FileUpload,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function createImageFromFile(file: File) {
|
|
18
|
+
return <img src={URL.createObjectURL(file)} alt={file.name} />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const UploadItem = ({ upload }: UploadedFileProps) => {
|
|
22
|
+
const uploadManager = useUploadManager()
|
|
23
|
+
const icon = upload.file.type.toLowerCase().startsWith('image/') ? createImageFromFile(upload.file) : undefined
|
|
24
|
+
const status = useUploadStatus(upload)
|
|
25
|
+
|
|
26
|
+
return <FileDescription
|
|
27
|
+
fileName={upload.file.name}
|
|
28
|
+
icon={icon}
|
|
29
|
+
onRemove={() => uploadManager.remove(upload)}
|
|
30
|
+
onRetry={() => upload.retry()}
|
|
31
|
+
status={status}
|
|
32
|
+
/>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const UploadBar = () => {
|
|
36
|
+
const uploads = useUploads()
|
|
37
|
+
const listItems = useMemo(() => uploads.map((up) => <li key={up.id}><UploadItem upload={up} /></li>), [uploads])
|
|
38
|
+
const t = useMessageInputDictionary()
|
|
39
|
+
const chat = useCurrentChat()
|
|
40
|
+
const visible = !!uploads.length
|
|
41
|
+
const [ariaMessage, setAriaMessage] = useState('')
|
|
42
|
+
const prevUploadsRef = useRef<FileUpload[]>([])
|
|
43
|
+
const announcedUploadsRef = useRef(new Set())
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const prevUploads = prevUploadsRef.current
|
|
47
|
+
const newUploads = uploads.filter(
|
|
48
|
+
up => !prevUploads.some(prev => prev.id === up.id),
|
|
49
|
+
)
|
|
50
|
+
newUploads.forEach((up) => {
|
|
51
|
+
if (!announcedUploadsRef.current.has(up.id)) {
|
|
52
|
+
setAriaMessage('')
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
setAriaMessage(`${t.uploadSuccessStatus}: ${up.file.name}`)
|
|
55
|
+
setTimeout(() => setAriaMessage(''), 2500)
|
|
56
|
+
}, 100)
|
|
57
|
+
announcedUploadsRef.current.add(up.id)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
if (uploads.some(up => up.status === 'error')) {
|
|
61
|
+
setTimeout(() => setAriaMessage(''), 2000)
|
|
62
|
+
}
|
|
63
|
+
}, [uploads])
|
|
64
|
+
|
|
65
|
+
useUploadErrorEffect((errors) => {
|
|
66
|
+
const sizeErrors = errors.filter(e => e instanceof FileIsTooLarge)
|
|
67
|
+
const maxItemsErrors = errors.filter(e => e instanceof MaxFilesReached)
|
|
68
|
+
const maxSize = sizeErrors[0]?.maxSize
|
|
69
|
+
const maxItems = maxItemsErrors[0]?.maxFiles
|
|
70
|
+
const sizeErrorsNames = sizeErrors.map(e => e.fileName)
|
|
71
|
+
const maxItemsErrorsNames = maxItemsErrors.map(e => e.fileName)
|
|
72
|
+
const lines: string[] = []
|
|
73
|
+
if (sizeErrors.length) {
|
|
74
|
+
lines.push(`${interpolate(t.uploadSizeError, `${maxSize.value} ${maxSize.unit}`)}\n- ${sizeErrorsNames.join('\n- ')}`)
|
|
75
|
+
}
|
|
76
|
+
if (maxItemsErrors.length) {
|
|
77
|
+
lines.push(`${interpolate(t.uploadItemLimitError, maxItems)}\n- ${maxItemsErrorsNames.join('\n- ')}`)
|
|
78
|
+
}
|
|
79
|
+
if (!lines.length) return
|
|
80
|
+
setAriaMessage(lines.join(' '))
|
|
81
|
+
setTimeout(() => setAriaMessage(''), 2000)
|
|
82
|
+
chat.pushMessage(new ChatEntry({ agentType: 'system', type: 'md', content: lines.join('\n\n') }))
|
|
83
|
+
|
|
84
|
+
if (lines.length) {
|
|
85
|
+
setAriaMessage(lines.join(' '))
|
|
86
|
+
setTimeout(() => setAriaMessage(''), 2000)
|
|
87
|
+
chat.pushMessage(new ChatEntry({ agentType: 'system', type: 'md', content: lines.join('\n\n') }))
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div className={listToClass(['info-bar', 'upload-bar', visible && 'visible'])}>
|
|
93
|
+
<div className="aria-live"
|
|
94
|
+
aria-live="polite"
|
|
95
|
+
aria-atomic="true"
|
|
96
|
+
>
|
|
97
|
+
{ariaMessage}
|
|
98
|
+
</div>
|
|
99
|
+
<div className="space"></div>
|
|
100
|
+
<div className="content">
|
|
101
|
+
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
102
|
+
<ul>{listItems}</ul>
|
|
103
|
+
</FadingOverflow>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { DragEvent, useCallback, useEffect, useState } from 'react'
|
|
3
|
+
import { useCurrentChat } from '../../context/hooks'
|
|
4
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
5
|
+
|
|
6
|
+
export function useUploadDragDrop(containerSelector: string = '.chat-container') {
|
|
7
|
+
const [isDragging, setIsDragging] = useState(false)
|
|
8
|
+
const chat = useCurrentChat()
|
|
9
|
+
|
|
10
|
+
const handleDrop = useCallback((e: DragEvent) => {
|
|
11
|
+
e.preventDefault()
|
|
12
|
+
e.stopPropagation()
|
|
13
|
+
setIsDragging(false)
|
|
14
|
+
if (e.dataTransfer?.files?.length) {
|
|
15
|
+
chat.uploadManager.add(Array.from(e.dataTransfer.files))
|
|
16
|
+
}
|
|
17
|
+
}, [chat])
|
|
18
|
+
|
|
19
|
+
const handleDragLeave = useCallback((e: DragEvent) => {
|
|
20
|
+
e.preventDefault()
|
|
21
|
+
if (e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {
|
|
22
|
+
setIsDragging(false)
|
|
23
|
+
}
|
|
24
|
+
}, [])
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const container = document.querySelector(containerSelector) as HTMLDivElement | null
|
|
28
|
+
if (!container) return
|
|
29
|
+
|
|
30
|
+
const nativeHandleDragEnter = (e: Event) => {
|
|
31
|
+
e.preventDefault()
|
|
32
|
+
setIsDragging(true)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
container.addEventListener('dragenter', nativeHandleDragEnter)
|
|
36
|
+
return () => {
|
|
37
|
+
container.removeEventListener('dragenter', nativeHandleDragEnter)
|
|
38
|
+
}
|
|
39
|
+
}, [containerSelector])
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
isDragging,
|
|
43
|
+
handleDrop,
|
|
44
|
+
handleDragLeave,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface UploadDragNDropProps {
|
|
49
|
+
isDragging?: boolean,
|
|
50
|
+
onDrop?: (e: DragEvent) => void,
|
|
51
|
+
onDragLeave?: (e: DragEvent) => void,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const UploadDragNDrop = ({ isDragging, onDrop, onDragLeave }: UploadDragNDropProps) => {
|
|
55
|
+
const t = useMessageInputDictionary()
|
|
56
|
+
|
|
57
|
+
if (!isDragging) return null
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<div
|
|
61
|
+
className="upload-drag-drop"
|
|
62
|
+
role="dialog"
|
|
63
|
+
aria-modal="true"
|
|
64
|
+
aria-labelledby="upload-drag-drop-title"
|
|
65
|
+
aria-describedby="upload-drag-drop-description"
|
|
66
|
+
tabIndex={-1}
|
|
67
|
+
onDrop={onDrop}
|
|
68
|
+
onDragLeave={onDragLeave}
|
|
69
|
+
onDragOver={e => {
|
|
70
|
+
e.preventDefault()
|
|
71
|
+
e.stopPropagation()
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<Icon icon="Document" size="lg" aria-hidden={true} />
|
|
75
|
+
<h2 id="upload-drag-drop-title">{t.uploadDragDropTitle}</h2>
|
|
76
|
+
<p id="upload-drag-drop-description">{t.uploadDragDropDescription}</p>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|