@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
package/src/views/Chat/styled.ts
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import { theme } from '@stack-spot/portal-theme'
|
|
2
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
2
3
|
import { styled } from 'styled-components'
|
|
4
|
+
import { FastOmit, IStyledComponentBase } from 'styled-components/dist/types'
|
|
3
5
|
|
|
4
|
-
export const ChatList
|
|
6
|
+
export const ChatList: IStyledComponentBase<
|
|
7
|
+
'web',
|
|
8
|
+
FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>
|
|
9
|
+
> = styled.ul`
|
|
5
10
|
display: flex;
|
|
6
11
|
flex-direction: column;
|
|
7
12
|
justify-content: end;
|
|
8
13
|
gap: 20px;
|
|
9
|
-
margin: 0
|
|
14
|
+
margin: 0;
|
|
10
15
|
padding: 0;
|
|
11
16
|
flex: 1;
|
|
12
17
|
|
|
13
|
-
.error {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: row;
|
|
18
|
+
[data-citric="alert"].error {
|
|
16
19
|
gap: 8px;
|
|
17
20
|
padding: 8px 10px;
|
|
18
|
-
background-color: ${theme.color.danger[500]};
|
|
19
|
-
color: ${theme.color.danger.contrastText};
|
|
20
21
|
border-radius: 8px;
|
|
21
22
|
align-self: start;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
small {
|
|
28
|
-
margin-top: 1px;
|
|
23
|
+
font: ${theme.font.microtext1};
|
|
24
|
+
line-height: 1;
|
|
25
|
+
&:before {
|
|
26
|
+
font-size: 14px;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
@@ -33,6 +31,10 @@ export const ChatList = styled.ul`
|
|
|
33
31
|
display: flex;
|
|
34
32
|
flex-direction: row;
|
|
35
33
|
gap: 10px;
|
|
34
|
+
|
|
35
|
+
&.bot, &.system {
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
.chat-message {
|
|
@@ -52,17 +54,29 @@ export const ChatList = styled.ul`
|
|
|
52
54
|
.message-footer {
|
|
53
55
|
display: flex;
|
|
54
56
|
flex-direction: row;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
margin-top: 10px;
|
|
55
60
|
|
|
56
61
|
.message-actions {
|
|
57
62
|
display: flex;
|
|
58
63
|
flex-direction: row;
|
|
59
|
-
gap:
|
|
64
|
+
gap: 4px;
|
|
65
|
+
height: 26px;
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
.chat-date {
|
|
69
|
+
display: inline-block;
|
|
70
|
+
align-content: flex-end;
|
|
63
71
|
opacity: 0.6;
|
|
64
72
|
margin-left: auto;
|
|
65
73
|
}
|
|
74
|
+
|
|
75
|
+
// prevents the feedback from being cut by the overflow rules of the parent elements.
|
|
76
|
+
.copy-btn:after {
|
|
77
|
+
left: 0;
|
|
78
|
+
margin-top: -20px;
|
|
79
|
+
}
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
> li {
|
|
@@ -77,23 +91,19 @@ export const ChatList = styled.ul`
|
|
|
77
91
|
gap: 4px;
|
|
78
92
|
|
|
79
93
|
.default-image-wrapper {
|
|
80
|
-
width:
|
|
81
|
-
height:
|
|
82
|
-
border-radius:
|
|
94
|
+
width: 32px;
|
|
95
|
+
height: 32px;
|
|
96
|
+
border-radius: 50%;
|
|
83
97
|
background-color: ${theme.color.light[300]};
|
|
84
98
|
display: flex;
|
|
85
99
|
align-items: center;
|
|
86
100
|
justify-content: center;
|
|
87
|
-
|
|
88
|
-
.agent-image {
|
|
89
|
-
width: 18px;
|
|
90
|
-
height: 18px;
|
|
91
|
-
}
|
|
101
|
+
border: 1px solid ${theme.color.light[600]};
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
.custom-agent-image {
|
|
95
|
-
width:
|
|
96
|
-
height:
|
|
105
|
+
width: 32px;
|
|
106
|
+
height: 32px;
|
|
97
107
|
border-radius: 50%;
|
|
98
108
|
}
|
|
99
109
|
}
|
|
@@ -128,27 +138,51 @@ export const ChatList = styled.ul`
|
|
|
128
138
|
background: linear-gradient(180deg, ${theme.color.blue[500]} 0%, ${theme.color.indigo[500]} 100%);
|
|
129
139
|
}
|
|
130
140
|
}
|
|
141
|
+
.image-uploads, .document-uploads {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: row;
|
|
144
|
+
flex-wrap: wrap;
|
|
145
|
+
gap: 8px;
|
|
146
|
+
list-style: none;
|
|
147
|
+
margin: 0 0 4px 0;
|
|
148
|
+
padding: 0;
|
|
149
|
+
|
|
150
|
+
img {
|
|
151
|
+
max-width: 240px;
|
|
152
|
+
max-height: 240px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
131
155
|
}
|
|
132
156
|
|
|
133
157
|
&.user {
|
|
134
158
|
align-items: end;
|
|
159
|
+
margin-left: 40px;
|
|
160
|
+
|
|
161
|
+
.chat-message-container {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
max-width: 100%;
|
|
165
|
+
align-items: end;
|
|
166
|
+
}
|
|
135
167
|
|
|
136
168
|
.chat-message {
|
|
137
169
|
display: flex;
|
|
138
170
|
flex-direction: row;
|
|
139
|
-
|
|
140
|
-
|
|
171
|
+
line-break: anywhere;
|
|
172
|
+
max-width: 100%;
|
|
141
173
|
|
|
142
174
|
.message-content {
|
|
143
|
-
padding:
|
|
175
|
+
padding: 16px;
|
|
176
|
+
border-radius: 24px;
|
|
177
|
+
border-top-right-radius: 0;
|
|
144
178
|
background-color: ${theme.color.light[500]};
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
> p:first-child {
|
|
179
|
+
width: 100%;
|
|
180
|
+
box-sizing: border-box;
|
|
181
|
+
.markdown > p:first-child {
|
|
148
182
|
margin-top: 0;
|
|
149
183
|
}
|
|
150
184
|
|
|
151
|
-
> p:last-child {
|
|
185
|
+
.markdown > p:last-child {
|
|
152
186
|
margin-bottom: 0;
|
|
153
187
|
}
|
|
154
188
|
}
|
|
@@ -183,4 +217,96 @@ export const ChatList = styled.ul`
|
|
|
183
217
|
}
|
|
184
218
|
}
|
|
185
219
|
}
|
|
220
|
+
|
|
221
|
+
.tools-box {
|
|
222
|
+
|
|
223
|
+
> button {
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: row;
|
|
226
|
+
flex-wrap: wrap;
|
|
227
|
+
white-space: nowrap;
|
|
228
|
+
margin: 0;
|
|
229
|
+
margin-top: 8px;
|
|
230
|
+
padding: 0;
|
|
231
|
+
list-style: none;
|
|
232
|
+
gap: 0px;
|
|
233
|
+
|
|
234
|
+
&:hover{
|
|
235
|
+
transition: gap 0.3s ease-in;
|
|
236
|
+
gap: 6px;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.steps {
|
|
242
|
+
.steps-list {
|
|
243
|
+
list-style: none;
|
|
244
|
+
margin: 0;
|
|
245
|
+
padding: 0;
|
|
246
|
+
display: flex;
|
|
247
|
+
flex-direction: column;
|
|
248
|
+
gap: 6px;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.tools-list {
|
|
252
|
+
list-style: disc;
|
|
253
|
+
margin: 0;
|
|
254
|
+
padding-left: 24px;
|
|
255
|
+
display: block;
|
|
256
|
+
::marker {
|
|
257
|
+
color: ${theme.color.light.contrastText};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
ul {
|
|
262
|
+
li {
|
|
263
|
+
&[role="button"] {
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.loading {
|
|
268
|
+
width: 12px;
|
|
269
|
+
height: 12px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.step-status-icon {
|
|
273
|
+
width: 20px;
|
|
274
|
+
height: 20px;
|
|
275
|
+
display: flex;
|
|
276
|
+
justify-content: center;
|
|
277
|
+
align-items: center;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.step-title {
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
text-overflow: ellipsis;
|
|
283
|
+
display: -webkit-box;
|
|
284
|
+
-webkit-line-clamp: 1;
|
|
285
|
+
-webkit-box-orient: vertical;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.step-actions {
|
|
293
|
+
margin-top: 16px;
|
|
294
|
+
display: flex;
|
|
295
|
+
gap: 6px;
|
|
296
|
+
|
|
297
|
+
.icon-button {
|
|
298
|
+
display: flex;
|
|
299
|
+
gap: 6px;
|
|
300
|
+
align-items: center;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.markdown img {
|
|
305
|
+
max-width: 70%;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.tools-badge {
|
|
309
|
+
align-self: start;
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
}
|
|
186
312
|
`
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { aiClient } from '@stack-spot/portal-network'
|
|
2
2
|
import InfiniteScroll from 'react-infinite-scroll-component'
|
|
3
|
+
import { AutoFocus } from '../../components/AutoFocus'
|
|
3
4
|
import { HistoryList } from '../../components/HistoryList'
|
|
4
|
-
import { MessageInterceptor } from '../../state/ChatState'
|
|
5
5
|
import { HistoryItem } from './HistoryItem'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Renders the list of conversations (history).
|
|
9
|
+
*/
|
|
10
|
+
export const ChatHistoryPanel = () => {
|
|
8
11
|
const [chats, { fetchNextPage, hasNextPage }] = aiClient.chats.useInfiniteQuery({ size: 40 })
|
|
9
12
|
return (
|
|
10
|
-
<
|
|
13
|
+
<AutoFocus id="chatHistoryList" style={{ height: '100%', overflow: 'auto' }}>
|
|
11
14
|
<InfiniteScroll
|
|
12
15
|
scrollableTarget="chatHistoryList"
|
|
13
16
|
dataLength={chats.length}
|
|
@@ -19,10 +22,10 @@ export const ChatHistoryPanel = ({ interceptors }: { interceptors: MessageInterc
|
|
|
19
22
|
items={chats}
|
|
20
23
|
getDate={c => new Date(c.updated || c.created || '')}
|
|
21
24
|
keygen={c => c.id}
|
|
22
|
-
renderItem={c => <HistoryItem item={c}
|
|
25
|
+
renderItem={c => <HistoryItem item={c} />}
|
|
23
26
|
style={{ marginRight: '6px' }}
|
|
24
27
|
/>
|
|
25
28
|
</InfiniteScroll>
|
|
26
|
-
</
|
|
29
|
+
</AutoFocus>
|
|
27
30
|
)
|
|
28
31
|
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { IconButton, LoadingCircular } from '@citric/ui'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconButton, Input, MenuItem, MenuOverlay, ProgressCircular } from '@stack-spot/citric-react'
|
|
4
3
|
import { aiClient } from '@stack-spot/portal-network'
|
|
5
4
|
import { ConversationResponse } from '@stack-spot/portal-network/api/ai'
|
|
6
5
|
import { theme } from '@stack-spot/portal-theme'
|
|
7
|
-
import { last } from 'lodash'
|
|
8
6
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
9
|
-
import { OverlayMenu } from '../../components/OverlayMenu'
|
|
10
7
|
import { useWidget } from '../../context/hooks'
|
|
11
|
-
import { ChatEntry } from '../../state/ChatEntry'
|
|
12
|
-
import { ChatState, MessageInterceptor } from '../../state/ChatState'
|
|
13
|
-
import { ButtonAction } from '../../types'
|
|
14
8
|
import { download } from '../../utils/download'
|
|
15
|
-
import { genericSourcesToKnowledgeSources } from '../../utils/knowledge-source'
|
|
16
9
|
import { useHistoryDictionary } from './dictionary'
|
|
17
10
|
import { HistoryItemBox } from './styled'
|
|
18
|
-
import {
|
|
11
|
+
import { loadChat } from './utils'
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Renders an item of the list of conversations (history).
|
|
15
|
+
*/
|
|
16
|
+
export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
21
17
|
const t = useHistoryDictionary()
|
|
22
18
|
const [isLoading, setLoading] = useState(false)
|
|
23
19
|
const [isRenaming, setRenaming] = useState(false)
|
|
@@ -80,29 +76,7 @@ export const HistoryItem = ({ item, interceptors }: { item: ConversationResponse
|
|
|
80
76
|
if (tab) return widget.chatTabs.select(item.id)
|
|
81
77
|
setLoading(true)
|
|
82
78
|
try {
|
|
83
|
-
|
|
84
|
-
const [stack, workspace, agents] = await Promise.all([
|
|
85
|
-
findStack(chat.ai_stack_id),
|
|
86
|
-
findWorkspace(chat.workspace_id),
|
|
87
|
-
getAllAgents(),
|
|
88
|
-
])
|
|
89
|
-
const agent = agents.find(a => a.id === last(chat.history)?.custom_agent?.id)
|
|
90
|
-
const builtIn = !!last(chat.history ?? [])?.custom_agent?.built_in
|
|
91
|
-
widget.chatTabs.add(new ChatState({
|
|
92
|
-
id: chat.id,
|
|
93
|
-
initial: { label: chat.title, stack, workspace, agent: agent ? { ...agent, builtIn } : undefined },
|
|
94
|
-
interceptors,
|
|
95
|
-
entries: chat.history?.map(item => new ChatEntry({
|
|
96
|
-
agentType: item.agent === 'USER' ? 'user' : 'bot',
|
|
97
|
-
content: item.content,
|
|
98
|
-
type: 'md',
|
|
99
|
-
agent: agents.find(a => a.id === item.custom_agent?.id),
|
|
100
|
-
messageId: item.message_id,
|
|
101
|
-
knowledgeSources: item.agent === 'USER' ? undefined : genericSourcesToKnowledgeSources(item.sources),
|
|
102
|
-
updated: item.updated,
|
|
103
|
-
})),
|
|
104
|
-
}))
|
|
105
|
-
widget.chatTabs.select(chat.id)
|
|
79
|
+
await loadChat(widget, item.id)
|
|
106
80
|
} catch (error) {
|
|
107
81
|
// eslint-disable-next-line no-console
|
|
108
82
|
console.error(error)
|
|
@@ -110,10 +84,10 @@ export const HistoryItem = ({ item, interceptors }: { item: ConversationResponse
|
|
|
110
84
|
setLoading(false)
|
|
111
85
|
}, [])
|
|
112
86
|
|
|
113
|
-
const actions:
|
|
114
|
-
{ label: t.rename, onClick: onRename, icon: <Pencil /> },
|
|
115
|
-
{ label: t.download, onClick: onDownload, icon: <Download /> },
|
|
116
|
-
{ label: t.delete, onClick: onDelete, icon: <Trash />, color: theme.color.danger[500] },
|
|
87
|
+
const actions: MenuItem[] = [
|
|
88
|
+
{ label: t.rename, onClick: onRename, icon: <Icon icon="Pencil" /> },
|
|
89
|
+
{ label: t.download, onClick: onDownload, icon: <Icon icon="Download" /> },
|
|
90
|
+
{ label: t.delete, onClick: onDelete, icon: <Icon icon="Trash" />, style: { color: theme.color.danger[500] } },
|
|
117
91
|
]
|
|
118
92
|
|
|
119
93
|
return isDeleted ? null : (
|
|
@@ -123,17 +97,22 @@ export const HistoryItem = ({ item, interceptors }: { item: ConversationResponse
|
|
|
123
97
|
<Input
|
|
124
98
|
ref={renameInput}
|
|
125
99
|
value={renamed}
|
|
126
|
-
onChange={
|
|
127
|
-
|
|
100
|
+
onChange={setRenamed}
|
|
101
|
+
style={{ flex: 1 }}
|
|
102
|
+
onKeyDown={(e) => {
|
|
103
|
+
if (['Enter', 'Escape'].includes(e.key)) {
|
|
104
|
+
e.key === 'Enter' ? onSubmitRename() : setRenaming(false)
|
|
105
|
+
}
|
|
106
|
+
}}
|
|
128
107
|
/>
|
|
129
|
-
<IconButton onClick={onSubmitRename}
|
|
108
|
+
<IconButton icon="Check" onClick={onSubmitRename} />
|
|
130
109
|
</>
|
|
131
110
|
) : (
|
|
132
111
|
<>
|
|
133
112
|
<button className="label" onClick={onSelect} disabled={isLoading}>{title}</button>
|
|
134
|
-
{isLoading ? <
|
|
135
|
-
<
|
|
136
|
-
</
|
|
113
|
+
{isLoading ? <ProgressCircular size="xs" /> : <MenuOverlay items={actions} position="left">
|
|
114
|
+
<Icon icon="EllipsisHorizontal" size="xs" />
|
|
115
|
+
</MenuOverlay>}
|
|
137
116
|
</>
|
|
138
117
|
)}
|
|
139
118
|
</HistoryItemBox>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { FallbackBoundary } from '@stack-spot/citric-react'
|
|
1
2
|
import { useEffect } from 'react'
|
|
2
|
-
import { FallbackBoundary } from '../../components/FallbackBoundary'
|
|
3
3
|
import { useWidget, useWidgetState } from '../../context/hooks'
|
|
4
4
|
import { useRightPanel } from '../../right-panel/hooks'
|
|
5
|
-
import { MessageInterceptor } from '../../state/ChatState'
|
|
6
5
|
import { ChatHistoryPanel } from './ChatHistoryPanel'
|
|
7
6
|
import { useHistoryDictionary } from './dictionary'
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Chat History in the Right Panel if this is the panel that is currently opened.
|
|
10
|
+
*/
|
|
11
|
+
export const ChatHistory = () => {
|
|
10
12
|
const t = useHistoryDictionary()
|
|
11
13
|
const panel = useWidgetState('panel')
|
|
12
14
|
const { open } = useRightPanel()
|
|
@@ -14,7 +16,7 @@ export const ChatHistory = ({ interceptors }: { interceptors: MessageInterceptor
|
|
|
14
16
|
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
if (panel === 'history') open(
|
|
17
|
-
<FallbackBoundary><ChatHistoryPanel
|
|
19
|
+
<FallbackBoundary><ChatHistoryPanel /></FallbackBoundary>,
|
|
18
20
|
{
|
|
19
21
|
title: t.title,
|
|
20
22
|
description: t.description,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IconBox } from '@citric/core'
|
|
2
|
-
import { IconButton } from '@citric/ui'
|
|
3
1
|
import { theme } from '@stack-spot/portal-theme'
|
|
4
2
|
import { styled } from 'styled-components'
|
|
5
3
|
|
|
@@ -42,7 +40,7 @@ export const HistoryItemBox = styled.div`
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
${IconBox}, ${IconButton} {
|
|
43
|
+
/* $ {IconBox}, $ {IconButton} {
|
|
46
44
|
padding: 0;
|
|
47
45
|
border: none;
|
|
48
46
|
background-color: transparent;
|
|
@@ -54,7 +52,7 @@ export const HistoryItemBox = styled.div`
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
${IconButton} svg {
|
|
55
|
+
$ {IconButton} svg {
|
|
58
56
|
width: 16px;
|
|
59
|
-
}
|
|
57
|
+
} */
|
|
60
58
|
`
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { agentToolsClient, aiClient, AnswerChatStep, ChatAgentTool, ChatStep, PlanningChatStep, workspaceClient } from '@stack-spot/portal-network'
|
|
2
|
+
import { AgentModel } from '@stack-spot/portal-network/api/agent-tools'
|
|
3
|
+
import { last } from 'lodash'
|
|
4
|
+
import { ChatEntry } from '../../state/ChatEntry'
|
|
5
|
+
import { ChatProperties, ChatState } from '../../state/ChatState'
|
|
6
|
+
import { WidgetState } from '../../state/WidgetState'
|
|
7
|
+
import { LabeledAgent } from '../../state/types'
|
|
8
|
+
import { genericSourcesToKnowledgeSources } from '../../utils/knowledge-source'
|
|
4
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Finds a stack by its id.
|
|
12
|
+
* @param id the id of the stack.
|
|
13
|
+
* @returns the stack or undefined.
|
|
14
|
+
*/
|
|
5
15
|
export async function findStack(id: string | null): Promise<ChatProperties['stack'] | undefined> {
|
|
6
16
|
if (!id) return
|
|
7
17
|
try {
|
|
@@ -14,9 +24,15 @@ export async function findStack(id: string | null): Promise<ChatProperties['stac
|
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Finds a workspace by its id.
|
|
29
|
+
* @param id the id of the workspace.
|
|
30
|
+
* @returns the workspace or undefined.
|
|
31
|
+
*/
|
|
17
32
|
export async function findWorkspace(id: string | null): Promise<ChatProperties['workspace'] | undefined> {
|
|
18
33
|
if (!id) return
|
|
19
34
|
try {
|
|
35
|
+
// const ws = await workspaceAiClient.workspaceAi.query({ id })
|
|
20
36
|
const ws = await workspaceClient.workspace.query({ workspaceId: id })
|
|
21
37
|
return { id, label: ws.name }
|
|
22
38
|
} catch (error) {
|
|
@@ -26,13 +42,130 @@ export async function findWorkspace(id: string | null): Promise<ChatProperties['
|
|
|
26
42
|
}
|
|
27
43
|
}
|
|
28
44
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
function toJSONString(data: any) {
|
|
46
|
+
if (data === undefined || data === null) return undefined
|
|
47
|
+
if (typeof data === 'object') {
|
|
48
|
+
try {
|
|
49
|
+
return JSON.stringify(data, null, 2)
|
|
50
|
+
} catch { /* empty */ }
|
|
51
|
+
} else {
|
|
52
|
+
try {
|
|
53
|
+
return JSON.stringify(JSON.parse(data), null, 2)
|
|
54
|
+
} catch { /* empty */ }
|
|
55
|
+
}
|
|
56
|
+
return `${data}`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function findTool(agent: AgentModel | undefined, id: string) {
|
|
60
|
+
const allToolkits = [
|
|
61
|
+
...agent?.toolkits?.builtin_toolkits ?? [],
|
|
62
|
+
...agent?.toolkits?.custom_toolkits ?? [],
|
|
63
|
+
...agent?.toolkits?.mcp_toolkits ?? [],
|
|
64
|
+
]
|
|
65
|
+
for (const toolkit of allToolkits) {
|
|
66
|
+
for (const tool of toolkit.tools ?? []) {
|
|
67
|
+
if ('id' in tool && tool.id === id) return { toolkit, tool }
|
|
68
|
+
}
|
|
37
69
|
}
|
|
70
|
+
return { toolkit: undefined, tool: { name: id } }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function stepsFromAgentInfo(
|
|
74
|
+
agentInfo: any[] | null | undefined, agentId: string | undefined, isLastEntry: boolean,
|
|
75
|
+
): Promise<ChatStep[] | undefined> {
|
|
76
|
+
const planningInfo = agentInfo?.find(i => i.type === 'planning' && !!i.data)
|
|
77
|
+
if (planningInfo) {
|
|
78
|
+
let agent: AgentModel | undefined
|
|
79
|
+
try {
|
|
80
|
+
agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
|
|
81
|
+
} catch { /* empty */ }
|
|
82
|
+
const planning: PlanningChatStep = {
|
|
83
|
+
type: 'planning',
|
|
84
|
+
goal: planningInfo.data.plan_goal,
|
|
85
|
+
status: planningInfo.action === 'awaiting_approval' ? 'awaiting_approval' : 'success',
|
|
86
|
+
id: `${Math.random()}`,
|
|
87
|
+
steps: planningInfo.data.steps,
|
|
88
|
+
duration: planningInfo.duration,
|
|
89
|
+
user_question: planningInfo.data.user_question,
|
|
90
|
+
}
|
|
91
|
+
const steps = planningInfo?.data?.steps?.map((s: any): ChatStep => {
|
|
92
|
+
const lastTool = agentInfo!.find(i => i.id === last(s.tools as any[])?.tool_execution_id && i.action === 'end')
|
|
93
|
+
return {
|
|
94
|
+
type: 'step',
|
|
95
|
+
id: s.id,
|
|
96
|
+
status: isLastEntry && planningInfo.action === 'awaiting_approval' ? 'pending' : 'success',
|
|
97
|
+
input: s.goal,
|
|
98
|
+
output: toJSONString(lastTool?.data?.output),
|
|
99
|
+
duration: lastTool?.duration,
|
|
100
|
+
attempts: [{
|
|
101
|
+
tools: s.tools?.map((t: any): ChatAgentTool => {
|
|
102
|
+
const { toolkit, tool } = findTool(agent, t.tool_id)
|
|
103
|
+
const start = agentInfo!.find(i => i.id === t.tool_execution_id && i.action === 'start')
|
|
104
|
+
const end = agentInfo!.find(i => i.id === t.tool_execution_id && i.action === 'end')
|
|
105
|
+
return {
|
|
106
|
+
id: t.tool_id,
|
|
107
|
+
executionId: t.tool_execution_id,
|
|
108
|
+
name: tool?.name,
|
|
109
|
+
description: 'description' in tool ? tool.description : undefined,
|
|
110
|
+
image: toolkit ? (('image_url' in toolkit ? toolkit?.image_url : toolkit?.avatar) ?? undefined) : undefined,
|
|
111
|
+
goal: t.goal,
|
|
112
|
+
duration: end?.duration,
|
|
113
|
+
input: toJSONString(start?.data?.input),
|
|
114
|
+
output: toJSONString(end?.data?.output),
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
}],
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
const answerInfo = agentInfo?.find(i => i.type === 'chat' && i.action === 'end')
|
|
121
|
+
const answer: AnswerChatStep | undefined = answerInfo ? {
|
|
122
|
+
id: `${Math.random()}`,
|
|
123
|
+
status: 'success',
|
|
124
|
+
type: 'answer',
|
|
125
|
+
duration: answerInfo.duration,
|
|
126
|
+
} : undefined
|
|
127
|
+
return answer ? [planning, ...steps, answer] : [planning, ...steps]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function toolsFromAgentInfo(agentInfo: any[] | null | undefined): string[] {
|
|
132
|
+
return agentInfo?.find(i => i.type === 'chat' && i.action === 'end')?.data?.used_tools
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Loads the chat identified by `conversationId` into the widget passed as parameter.
|
|
137
|
+
* @param widget
|
|
138
|
+
* @param conversationId
|
|
139
|
+
*/
|
|
140
|
+
export async function loadChat(widget: WidgetState, conversationId: string) {
|
|
141
|
+
const chat = await aiClient.chat.query({ conversationId })
|
|
142
|
+
const historyAgentIds = chat.history?.map(item => item.custom_agent?.id).filter(Boolean) as string[] ?? []
|
|
143
|
+
const [stack, workspace, agents] = await Promise.all([
|
|
144
|
+
findStack(chat.ai_stack_id),
|
|
145
|
+
findWorkspace(chat.workspace_id),
|
|
146
|
+
agentToolsClient.agentsByIds.query({ searchAgentsRequest: { ids: historyAgentIds } }),
|
|
147
|
+
])
|
|
148
|
+
const agentsAsLabeledAgents: LabeledAgent[] = agents
|
|
149
|
+
.map((a) => ({ ...a, label: a.name, image: a.avatar ?? '', builtIn: a.visibility_level === 'built_in' }))
|
|
150
|
+
|
|
151
|
+
const agent = agentsAsLabeledAgents.find(a => a.id === last(chat.history)?.custom_agent?.id)
|
|
152
|
+
const builtIn = !!last(chat.history ?? [])?.custom_agent?.built_in
|
|
153
|
+
widget.chatTabs.add(new ChatState({
|
|
154
|
+
id: chat.id,
|
|
155
|
+
initial: { features: widget.chatFeatures, label: chat.title, stack, workspace, agent: agent ? {
|
|
156
|
+
...agent, builtIn } : undefined },
|
|
157
|
+
interceptors: widget.interceptors,
|
|
158
|
+
entries: await Promise.all(chat.history?.map(async (item, index) => new ChatEntry({
|
|
159
|
+
agentType: item.agent === 'USER' ? 'user' : 'bot',
|
|
160
|
+
content: item.content,
|
|
161
|
+
type: 'md',
|
|
162
|
+
agent: agentsAsLabeledAgents.find(a => a.id === item.custom_agent?.id),
|
|
163
|
+
messageId: item.message_id,
|
|
164
|
+
knowledgeSources: item.agent === 'USER' ? undefined : genericSourcesToKnowledgeSources(item.sources),
|
|
165
|
+
updated: item.updated,
|
|
166
|
+
steps: await stepsFromAgentInfo(item.agent_info, item.custom_agent?.id, index === chat.history!.length - 1),
|
|
167
|
+
tools: toolsFromAgentInfo(item.agent_info),
|
|
168
|
+
})) ?? []),
|
|
169
|
+
}))
|
|
170
|
+
widget.chatTabs.select(chat.id)
|
|
38
171
|
}
|