@stack-spot/ai-chat-widget 1.38.2-beta.2 → 2.0.0-beta.1
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 +33 -32
- package/dist/StackspotAIWidget.d.ts +14 -2
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -8
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +13 -5
- package/dist/chat-interceptors/quick-commands.js +3 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +1 -1
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +1 -1
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.js +4 -5
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
- package/dist/components/AgentCard/index.d.ts.map +1 -1
- package/dist/components/AgentCard/index.js +5 -6
- package/dist/components/AgentCard/index.js.map +1 -1
- package/dist/components/ButtonFavorite.d.ts +8 -7
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +5 -14
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +11 -9
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts.map +1 -1
- package/dist/components/ComponentNavigator.js +2 -4
- package/dist/components/ComponentNavigator.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +3 -4
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts.map +1 -1
- package/dist/components/FileDescription.js +3 -4
- package/dist/components/FileDescription.js.map +1 -1
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +3 -1
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/ListResource.js +3 -3
- package/dist/components/ListResource.js.map +1 -1
- package/dist/components/Markdown.js +1 -1
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Modal.d.ts.map +1 -1
- package/dist/components/Modal.js +2 -4
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/QuickStartButton.d.ts +2 -3
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +4 -3
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +20 -13
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +1 -4
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +4 -16
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +5 -8
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +8 -5
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/components/StackedBadge.js +5 -5
- package/dist/components/StackedBadge.js.map +1 -1
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +9 -32
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +3 -8
- package/dist/components/ToolBadge.d.ts.map +1 -1
- package/dist/components/ToolBadge.js +23 -99
- package/dist/components/ToolBadge.js.map +1 -1
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
- package/dist/components/WorkspaceTabNavigator.js +7 -9
- package/dist/components/WorkspaceTabNavigator.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +24 -2
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +46 -29
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +24 -4
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +39 -18
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/context/hooks.d.ts +6 -1
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +4 -1
- package/dist/context/hooks.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 +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +0 -26
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +2 -4
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +3 -4
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/constants.d.ts.map +1 -1
- package/dist/state/constants.js +1 -0
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +9 -3
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +1 -6
- package/dist/utils/tools.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +8 -13
- package/dist/views/Agents/AgentDescription.js.map +1 -1
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
- package/dist/views/Agents/AgentsPanel.js +7 -7
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +30 -29
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Agents/useAgentFavorites.js +3 -3
- package/dist/views/Agents/useAgentFavorites.js.map +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +3 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts +24 -2
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +36 -47
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +1 -1
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +2 -2
- package/dist/views/Chat/ChatMessages.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +10 -10
- package/dist/views/Chat/StepsList.js.map +1 -1
- package/dist/views/Chat/index.d.ts +1 -1
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +2 -2
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +11 -16
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +10 -48
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/index.js +1 -1
- 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 +7 -0
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +40 -1
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +6 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +13 -8
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +6 -12
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.js +2 -3
- package/dist/views/Home/BuiltInAgent.js.map +1 -1
- package/dist/views/Home/CustomAgent.js +3 -3
- package/dist/views/Home/CustomAgent.js.map +1 -1
- package/dist/views/Home/index.js +2 -2
- package/dist/views/Home/index.js.map +1 -1
- package/dist/views/Home/styled.d.ts.map +1 -1
- package/dist/views/Home/styled.js +21 -22
- package/dist/views/Home/styled.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +3 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +14 -36
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +7 -5
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +4 -5
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonBar.js +2 -4
- package/dist/views/MessageInput/ButtonBar.js.map +1 -1
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ContextBar.js +3 -6
- package/dist/views/MessageInput/ContextBar.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
- package/dist/views/MessageInput/SelectContent.js +30 -29
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/index.d.ts +2 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +5 -6
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +1 -3
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +11 -15
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +3 -4
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Resources.d.ts.map +1 -1
- package/dist/views/Resources.js +11 -8
- package/dist/views/Resources.js.map +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +23 -28
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.js +3 -3
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
- package/dist/views/Steps/StepModal.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.js +4 -6
- package/dist/views/Steps/StepModal.js.map +1 -1
- package/dist/views/Steps/dictionary.d.ts +1 -1
- package/dist/views/Steps/index.d.ts.map +1 -1
- package/dist/views/Steps/index.js +3 -4
- package/dist/views/Steps/index.js.map +1 -1
- package/dist/views/Steps/utils.d.ts +2 -1
- package/dist/views/Steps/utils.d.ts.map +1 -1
- package/dist/views/Steps/utils.js +8 -8
- package/dist/views/Steps/utils.js.map +1 -1
- package/dist/views/Tools.js +1 -1
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +7 -10
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
- package/dist/views/Workspaces/index.js +4 -2
- package/dist/views/Workspaces/index.js.map +1 -1
- package/package.json +5 -3
- package/src/StackspotAIWidget.tsx +51 -37
- package/src/app-metadata.json +13 -5
- package/src/chat-interceptors/quick-commands.ts +3 -3
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
- package/src/components/AgentCard/index.tsx +7 -7
- package/src/components/ButtonFavorite.tsx +20 -47
- package/src/components/Code.tsx +31 -36
- package/src/components/ComponentNavigator.tsx +4 -8
- package/src/components/FadingOverflow.tsx +6 -7
- package/src/components/FileDescription.tsx +14 -10
- package/src/components/HistoryList.tsx +4 -1
- package/src/components/ListResource.tsx +5 -5
- package/src/components/Markdown.tsx +1 -1
- package/src/components/Modal.tsx +2 -4
- package/src/components/QuickStartButton.tsx +5 -4
- package/src/components/RightPanelForm.tsx +20 -13
- package/src/components/RightPanelTabs.tsx +4 -32
- package/src/components/Selector/index.tsx +17 -13
- package/src/components/Selector/styled.ts +8 -5
- package/src/components/StackedBadge.tsx +5 -5
- package/src/components/TabManager.tsx +31 -55
- package/src/components/ToolBadge.tsx +48 -129
- package/src/components/WorkspaceTabNavigator.tsx +22 -25
- package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
- package/src/components/form/DescribedRadioGroup.tsx +78 -46
- package/src/context/hooks.ts +4 -1
- package/src/hooks/midnight-update-view.ts +36 -0
- package/src/index.ts +4 -2
- package/src/layout.css +0 -26
- package/src/right-panel/DefaultPanel.tsx +3 -7
- package/src/state/ChatEntry.ts +3 -4
- package/src/state/constants.ts +2 -1
- package/src/types.ts +9 -3
- package/src/utils/tools.ts +3 -12
- package/src/views/Agents/AgentDescription.tsx +20 -36
- package/src/views/Agents/AgentsPanel.tsx +11 -12
- package/src/views/Agents/AgentsTab.tsx +38 -57
- package/src/views/Agents/useAgentFavorites.ts +3 -3
- package/src/views/Chat/AgentInfo.tsx +7 -6
- package/src/views/Chat/ChatMessage.tsx +163 -145
- package/src/views/Chat/ChatMessages.tsx +2 -1
- package/src/views/Chat/StepsList.tsx +10 -11
- package/src/views/Chat/index.tsx +9 -2
- package/src/views/Chat/styled.ts +11 -16
- package/src/views/ChatHistory/HistoryItem.tsx +15 -54
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatHistory/utils.ts +43 -2
- package/src/views/ChatTabSelection.tsx +18 -10
- package/src/views/Editor.tsx +9 -14
- package/src/views/Home/BuiltInAgent.tsx +7 -8
- package/src/views/Home/CustomAgent.tsx +3 -3
- package/src/views/Home/index.tsx +2 -2
- package/src/views/Home/styled.ts +21 -22
- package/src/views/KSDocument.tsx +7 -8
- package/src/views/KnowledgeSources.tsx +24 -66
- package/src/views/MessageInput/AgentSelector.tsx +10 -8
- package/src/views/MessageInput/ButtonAgent.tsx +24 -12
- package/src/views/MessageInput/ButtonBar.tsx +25 -21
- package/src/views/MessageInput/ContextBar.tsx +16 -14
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +39 -62
- package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
- package/src/views/MessageInput/index.tsx +8 -9
- package/src/views/MessageInput/styled.ts +12 -16
- package/src/views/MinimizedHeader.tsx +5 -7
- package/src/views/Resources.tsx +31 -30
- package/src/views/Stacks.tsx +31 -54
- package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
- package/src/views/Steps/StepModal.tsx +14 -18
- package/src/views/Steps/index.tsx +4 -5
- package/src/views/Steps/utils.tsx +9 -9
- package/src/views/Tools.tsx +0 -1
- package/src/views/Workspaces/WorkspacesTab.tsx +17 -21
- package/src/views/Workspaces/index.tsx +4 -2
- package/dist/components/Accordion.d.ts +0 -20
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -51
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -33
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -52
- 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 -17
- 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 -10
- package/dist/components/IconInput.d.ts.map +0 -1
- package/dist/components/IconInput.js +0 -61
- package/dist/components/IconInput.js.map +0 -1
- package/dist/components/OverlayMenu.d.ts +0 -21
- package/dist/components/OverlayMenu.d.ts.map +0 -1
- package/dist/components/OverlayMenu.js +0 -79
- package/dist/components/OverlayMenu.js.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -37
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/ProgressBar.js +0 -131
- package/dist/components/ProgressBar.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -37
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -30
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +0 -29
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.js +0 -107
- 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 -27
- package/dist/components/Tooltip/types.d.ts.map +0 -1
- package/dist/components/Tooltip/types.js +0 -2
- package/dist/components/Tooltip/types.js.map +0 -1
- package/src/components/Accordion.tsx +0 -75
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -71
- package/src/components/FallbackBoundary/Loading.tsx +0 -14
- package/src/components/FallbackBoundary/index.tsx +0 -26
- package/src/components/IconInput.tsx +0 -73
- package/src/components/OverlayMenu.tsx +0 -133
- package/src/components/ProgressBar.tsx +0 -183
- package/src/components/Tooltip/Tooltip.tsx +0 -78
- package/src/components/Tooltip/TooltipAPI.ts +0 -101
- 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 -28
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { Button } from '@citric
|
|
2
|
-
import { Search } from '@citric/icons'
|
|
1
|
+
import { Button, Tab } from '@stack-spot/citric-react'
|
|
3
2
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
3
|
import { aiClient, dataIntegrationClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
5
|
-
import {
|
|
4
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
6
5
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
7
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
8
|
-
import {
|
|
9
|
-
import React, { ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
10
|
-
import { ButtonFavorite } from '../components/ButtonFavorite'
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
11
8
|
import { NavigationComponent } from '../components/ComponentNavigator'
|
|
12
9
|
import { DescribedCheckboxGroup } from '../components/form/DescribedCheckboxGroup'
|
|
13
|
-
import { IconInput } from '../components/IconInput'
|
|
14
10
|
import { RightPanelContentList } from '../components/RightPanelContentList'
|
|
15
11
|
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
16
12
|
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator'
|
|
@@ -28,8 +24,6 @@ export interface TabProps {
|
|
|
28
24
|
onSubmit?: () => void,
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
type TabElement = { title: string, content: ReactElement }
|
|
32
|
-
|
|
33
27
|
export const KnowledgeSources = () => {
|
|
34
28
|
const t = useTranslate(dictionary)
|
|
35
29
|
const panel = useWidgetState('panel')
|
|
@@ -69,15 +63,15 @@ const KnowledgeSourcesPanel = () => {
|
|
|
69
63
|
allKS.current = chat.get('knowledgeSources') ?? []
|
|
70
64
|
}, [chat])
|
|
71
65
|
|
|
72
|
-
const allTabsMap: Partial<Record<Scope,
|
|
73
|
-
favorite: {
|
|
66
|
+
const allTabsMap: Partial<Record<Scope, Omit<Tab, 'key'>>> = {
|
|
67
|
+
favorite: { label: t.favorites,
|
|
74
68
|
content: <KnowledgeSourcesTab key="favorite" visibility="favorite" allKS={allKS} onSubmit={onSubmit} /> },
|
|
75
|
-
personal: {
|
|
69
|
+
personal: { label: t.personal,
|
|
76
70
|
content: <KnowledgeSourcesTab key="personal" visibility="personal" allKS={allKS} onSubmit={onSubmit} /> },
|
|
77
|
-
shared: {
|
|
78
|
-
workspace: {
|
|
71
|
+
shared: { label: t.shared, content: <KnowledgeSourcesTab key="shared" visibility="shared" allKS={allKS} onSubmit={onSubmit} /> },
|
|
72
|
+
workspace: { label: t.spots,
|
|
79
73
|
content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
|
|
80
|
-
account: {
|
|
74
|
+
account: { label: t.account, content: <KnowledgeSourcesTab key="account" visibility="account" allKS={allKS} onSubmit={onSubmit} /> },
|
|
81
75
|
}
|
|
82
76
|
|
|
83
77
|
const defaultScopes: Scope[] = ['favorite', 'personal', 'shared', 'workspace', 'account']
|
|
@@ -89,8 +83,8 @@ const KnowledgeSourcesPanel = () => {
|
|
|
89
83
|
: rawScopes
|
|
90
84
|
|
|
91
85
|
const tabs = scopesToRender
|
|
92
|
-
.map(scope => allTabsMap[scope])
|
|
93
|
-
.filter(Boolean) as
|
|
86
|
+
.map(scope => scope in allTabsMap ? { key: scope, ...allTabsMap[scope] } : undefined)
|
|
87
|
+
.filter(Boolean) as Tab[]
|
|
94
88
|
|
|
95
89
|
return (isGroupResourcesByScope ? (
|
|
96
90
|
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
@@ -101,14 +95,15 @@ const KnowledgeSourcesPanel = () => {
|
|
|
101
95
|
|
|
102
96
|
export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId, showSubmitButton = true }: TabProps) => {
|
|
103
97
|
const t = useTranslate(dictionary)
|
|
104
|
-
const [filter, setFilter] = useState('')
|
|
105
|
-
|
|
106
98
|
const knowledgeSources = workspaceId
|
|
107
99
|
? workspaceAiClient.getKSFromWorkspaceAi.useQuery({ workspaceId })
|
|
108
100
|
: aiClient.knowledgeSources.useQuery({
|
|
109
101
|
visibility, order: 'a-to-z', types: ['snippet', 'api', 'event', 'custom'],
|
|
110
102
|
})
|
|
111
|
-
|
|
103
|
+
const initialValue = useMemo(() => {
|
|
104
|
+
const currentlySelected = allKS.current?.map(ks => ks.id)
|
|
105
|
+
return knowledgeSources.filter(ks => currentlySelected?.includes(ks.slug))
|
|
106
|
+
}, [])
|
|
112
107
|
const listFavorites = dataIntegrationClient.knowledgeSources.useQuery({ visibility: 'favorite' })
|
|
113
108
|
const [addFavorite, pendingAddFav] = dataIntegrationClient.addFavoriteKnowledgeSource.useMutation()
|
|
114
109
|
const [removeFavorite, pendingRemoveFav] = dataIntegrationClient.removeFavoriteKnowledgeSource.useMutation()
|
|
@@ -165,56 +160,19 @@ export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId,
|
|
|
165
160
|
}
|
|
166
161
|
})
|
|
167
162
|
|
|
168
|
-
const [value, setValue] = useState<KnowledgeSourceItemResponse[]>((() => {
|
|
169
|
-
const currentlySelected = allKS.current?.map(ks => ks.id)
|
|
170
|
-
return knowledgeSources.filter(ks => currentlySelected?.includes(ks.slug))
|
|
171
|
-
})())
|
|
172
|
-
const filtered = useMemo(
|
|
173
|
-
() => filter
|
|
174
|
-
// Recreate the list so that the favorites list is taken into account
|
|
175
|
-
? knowledgeSources.filter(ks => value.includes(ks) || ks.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
176
|
-
: [...knowledgeSources]
|
|
177
|
-
, [knowledgeSources, filter, value, listFavorites],
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
const onChange = useCallback((newValue: KnowledgeSourceItemResponse[]) => {
|
|
181
|
-
setValue((current) => {
|
|
182
|
-
const added = difference(newValue, current)
|
|
183
|
-
const removed = difference(current, newValue)
|
|
184
|
-
allKS.current = allKS.current?.filter(ks => !removed.some(r => r.slug === ks.id)) ?? []
|
|
185
|
-
allKS.current = uniqBy([...allKS.current, ...added.map(ks => ({ id: ks.slug, label: ks.name }))], 'id')
|
|
186
|
-
return newValue
|
|
187
|
-
})
|
|
188
|
-
}, [])
|
|
189
|
-
|
|
190
163
|
return (
|
|
191
164
|
<>
|
|
192
165
|
<div className="content">
|
|
193
|
-
<
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
keygen={ks => ks.id}
|
|
202
|
-
value={value}
|
|
203
|
-
onChange={onChange}
|
|
204
|
-
renderLabel={ks => ks.name}
|
|
205
|
-
renderDescription={ks => ks.description}
|
|
206
|
-
optionClassName={ks => (filter && !ks.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()) && value.includes(ks))
|
|
207
|
-
? 'filtered-out'
|
|
208
|
-
: ''
|
|
209
|
-
}
|
|
210
|
-
className="option-list"
|
|
211
|
-
/>}
|
|
212
|
-
{!!filtered.length && !filtered.length && (
|
|
213
|
-
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} />
|
|
214
|
-
)}
|
|
215
|
-
{!filtered.length && <Placeholder title={t.noData} description={t.noDataDescription} className="no-data-placeholder" />}
|
|
166
|
+
<DescribedCheckboxGroup
|
|
167
|
+
options={knowledgeSources}
|
|
168
|
+
initialValue={initialValue}
|
|
169
|
+
globalSelection={allKS}
|
|
170
|
+
data={ks => ({ idOrSlug: ks.slug, description: ks.description, name: ks.name, listFavorites, onAddFavorite, onRemoveFavorite })}
|
|
171
|
+
emptyResults={<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} />}
|
|
172
|
+
emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} className="no-data-placeholder" />}
|
|
173
|
+
/>
|
|
216
174
|
</div>
|
|
217
|
-
{!!
|
|
175
|
+
{!!knowledgeSources.length && showSubmitButton && <Button onClick={onSubmit}>{t.apply}</Button>}
|
|
218
176
|
</>
|
|
219
177
|
)
|
|
220
178
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconBox, Row, Text } from '@stack-spot/citric-react'
|
|
3
3
|
import { AgentResponseWithBuiltIn, agentToolsClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
4
4
|
import { useCallback } from 'react'
|
|
5
5
|
import { Selector } from '../../components/Selector'
|
|
@@ -10,15 +10,17 @@ import { useAgentFavorites } from '../Agents/useAgentFavorites'
|
|
|
10
10
|
type AgentWithSpaceName = AgentResponseWithBuiltIn
|
|
11
11
|
|
|
12
12
|
const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
|
|
13
|
-
const avatarComponent = avatar
|
|
13
|
+
const avatarComponent = avatar
|
|
14
|
+
? <img style={{ width: '32px', height: '32px', borderRadius: '50%' }} src={avatar} />
|
|
15
|
+
: <IconBox size="md" icon="Agent" style={{ backgroundColor: 'transparent' }} />
|
|
14
16
|
|
|
15
|
-
return <
|
|
17
|
+
return <Row gap="8px" style={{ flexWrap: 'nowrap' }}>
|
|
16
18
|
{avatarComponent}
|
|
17
19
|
<div>
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
+
<Text className="selector-description">{spaceName}</Text>
|
|
21
|
+
<Text className="selector-title">{name}</Text>
|
|
20
22
|
</div>
|
|
21
|
-
</
|
|
23
|
+
</Row>
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export const AgentSelector = ({ inputRef, isTrial }: {
|
|
@@ -72,7 +74,7 @@ export const AgentSelector = ({ inputRef, isTrial }: {
|
|
|
72
74
|
selectorConfig={{
|
|
73
75
|
resourceName: 'Agent',
|
|
74
76
|
shortcut: '@',
|
|
75
|
-
icon: <Agent />,
|
|
77
|
+
icon: <Icon icon="Agent" />,
|
|
76
78
|
regex: agentRegex,
|
|
77
79
|
urlBuilder: (agent) => `/agents/${agent?.id}`,
|
|
78
80
|
searchProp: 'name',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { IconButton, Tooltip } from '@citric/ui'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Center, ImageButton, ImageWithFallback, Tooltip } from '@stack-spot/citric-react'
|
|
4
3
|
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
5
4
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
6
5
|
import { useEffect } from 'react'
|
|
@@ -41,17 +40,30 @@ export const ButtonAgent = () => {
|
|
|
41
40
|
<div className="button-group">
|
|
42
41
|
{features.agent && (
|
|
43
42
|
<div className="group-agent">
|
|
44
|
-
<
|
|
43
|
+
<ImageButton
|
|
44
|
+
aria-label={t.agent}
|
|
45
|
+
title={t.agent}
|
|
46
|
+
className="agent"
|
|
47
|
+
onClick={() => widget.set('panel', 'agent')}
|
|
48
|
+
>
|
|
45
49
|
{agentDefault?.avatar ? <img src={agentDefault.avatar} className="image" /> : <MiniLogo />}
|
|
46
|
-
</
|
|
50
|
+
</ImageButton>
|
|
47
51
|
{agent?.id && !isAgentDefault() &&
|
|
48
|
-
<Tooltip
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
<Tooltip content={t.remove} >
|
|
53
|
+
<ImageButton
|
|
54
|
+
aria-label={t.remove}
|
|
55
|
+
className="agent agent-selected"
|
|
56
|
+
onClick={setAgentDefault}
|
|
57
|
+
>
|
|
58
|
+
<ImageWithFallback
|
|
59
|
+
src={agent.image ?? ''}
|
|
60
|
+
className="image"
|
|
61
|
+
fallback={<Icon className="image" size="xs" icon="Agent" />}
|
|
62
|
+
/>
|
|
63
|
+
<Center className="icon-remove">
|
|
64
|
+
<Icon icon="TimesMini" />
|
|
65
|
+
</Center>
|
|
66
|
+
</ImageButton>
|
|
55
67
|
</Tooltip>
|
|
56
68
|
}
|
|
57
69
|
</div>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ArrowUp, Code, Stop } from '@citric/icons'
|
|
3
|
-
import { IconButton } from '@citric/ui'
|
|
1
|
+
import { IconButton, Row } from '@stack-spot/citric-react'
|
|
4
2
|
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
5
3
|
import { useMessageInputDictionary } from './dictionary'
|
|
6
4
|
import { SelectContent } from './SelectContent'
|
|
@@ -25,27 +23,33 @@ export const ButtonBar = ({ onSend, isLoading }: SelectionBarProps) => {
|
|
|
25
23
|
|
|
26
24
|
return (
|
|
27
25
|
<SelectionBarWrapper className="button-group">
|
|
28
|
-
<
|
|
26
|
+
<Row center={false} gap="4px">
|
|
29
27
|
<SelectContent />
|
|
30
28
|
{features.editor && (
|
|
31
|
-
<IconButton
|
|
32
|
-
<Code />
|
|
33
|
-
</IconButton>
|
|
29
|
+
<IconButton icon="Code" appearance="square" aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')} />
|
|
34
30
|
)}
|
|
35
|
-
</
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
</Row>
|
|
32
|
+
{isLoading ? (
|
|
33
|
+
<IconButton
|
|
34
|
+
icon="Stop"
|
|
35
|
+
appearance="square"
|
|
36
|
+
colorScheme="inverse"
|
|
37
|
+
aria-label={t.cancel}
|
|
38
|
+
onClick={() => chat.abort()}
|
|
39
|
+
className="send"
|
|
40
|
+
title={t.cancel}
|
|
41
|
+
/>
|
|
42
|
+
) : (
|
|
43
|
+
<IconButton
|
|
44
|
+
icon="ArrowUp"
|
|
45
|
+
appearance="square"
|
|
46
|
+
colorScheme="inverse"
|
|
47
|
+
aria-label={t.send}
|
|
48
|
+
onClick={onSend}
|
|
49
|
+
className="send"
|
|
50
|
+
title={t.send}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
49
53
|
</SelectionBarWrapper>
|
|
50
54
|
)
|
|
51
55
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { Text } from '@citric/core'
|
|
2
|
-
import { TimesMini } from '@citric/icons'
|
|
3
|
-
import { Badge, IconButton } from '@citric/ui'
|
|
4
1
|
import { loader } from '@monaco-editor/react'
|
|
2
|
+
import { Badge, IconButton, Text } from '@stack-spot/citric-react'
|
|
5
3
|
import { ColorPaletteName, listToClass } from '@stack-spot/portal-theme'
|
|
6
4
|
import { useCallback, useMemo } from 'react'
|
|
7
5
|
import { FadingOverflow } from '../../components/FadingOverflow'
|
|
@@ -16,14 +14,16 @@ interface ContextBadgeProps {
|
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
const ContextBadge = ({ label, color, dismiss, onDismiss }: ContextBadgeProps) => (
|
|
19
|
-
<Badge appearance="square"
|
|
20
|
-
afterElement={
|
|
21
|
-
onDismiss &&
|
|
22
|
-
<IconButton appearance="square" colorIcon={`${color}.800`} onClick={onDismiss} title={dismiss} aria-label={dismiss}>
|
|
23
|
-
<TimesMini />
|
|
24
|
-
</IconButton>
|
|
25
|
-
}>
|
|
17
|
+
<Badge appearance="square" colorPalette={color} className="context-badge">
|
|
26
18
|
<Text nowrapEllipsis>{label}</Text>
|
|
19
|
+
{onDismiss && <IconButton
|
|
20
|
+
icon="TimesMini"
|
|
21
|
+
appearance="none"
|
|
22
|
+
onClick={onDismiss}
|
|
23
|
+
title={dismiss}
|
|
24
|
+
arial-label={dismiss}
|
|
25
|
+
style={{ padding: '2px 0 2px 2px', color: 'inherit' }}
|
|
26
|
+
/>}
|
|
27
27
|
</Badge>
|
|
28
28
|
)
|
|
29
29
|
|
|
@@ -74,10 +74,12 @@ export const ContextBar = () => {
|
|
|
74
74
|
<div className="content">
|
|
75
75
|
{shouldRenderRemoveAllButton && (
|
|
76
76
|
<IconButton
|
|
77
|
-
|
|
78
|
-
aria-label={t.removeConfig}
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
icon="TimesMini"
|
|
78
|
+
aria-label={t.removeConfig}
|
|
79
|
+
title={t.removeConfig}
|
|
80
|
+
onClick={removeAll}
|
|
81
|
+
style={{ marginLeft: '8px' }}
|
|
82
|
+
/>
|
|
81
83
|
)}
|
|
82
84
|
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
83
85
|
<ul>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
2
|
import { aiClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
3
3
|
import { QuickCommandResponse } from '@stack-spot/portal-network/api/ai'
|
|
4
4
|
import { useCallback } from 'react'
|
|
@@ -113,7 +113,7 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
|
|
|
113
113
|
selectorConfig={{
|
|
114
114
|
resourceName: 'Quick Command',
|
|
115
115
|
shortcut: '/',
|
|
116
|
-
icon: <QuickCommand />,
|
|
116
|
+
icon: <Icon icon="QuickCommand" />,
|
|
117
117
|
searchProp: 'slug',
|
|
118
118
|
urlBuilder: (qc) => `/quick-command/${qc?.slug}`,
|
|
119
119
|
regex: quickCommandRegex,
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IconButton } from '@citric
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo, useState } from 'react'
|
|
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'
|
|
5
4
|
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
6
5
|
import { useUploadManager } from '../../utils/upload/context'
|
|
7
6
|
import { useMessageInputDictionary } from './dictionary'
|
|
8
7
|
|
|
9
|
-
type ChatFeatures = 'workspace' | 'knowledgeSource' | 'stack'
|
|
10
|
-
type ChatPanel = 'ks' | 'workspace' | 'stack'
|
|
11
|
-
|
|
12
8
|
export const SelectContent = () => {
|
|
13
9
|
const widget = useWidget()
|
|
14
|
-
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
15
10
|
const features = useCurrentChatState('features')
|
|
16
11
|
const t = useMessageInputDictionary()
|
|
17
12
|
const uploadManager = useUploadManager()
|
|
18
13
|
const hasFeatureButtons = features.workspace || features.knowledgeSource || features.stack || features.upload
|
|
19
14
|
const chat = useCurrentChat()
|
|
20
15
|
|
|
21
|
-
const itemConfigs = [
|
|
16
|
+
const itemConfigs = useMemo<(MenuAction & { key: keyof typeof features, section: 0 | 1 })[]>(() => ([
|
|
22
17
|
{
|
|
23
18
|
role: 'button',
|
|
24
19
|
key: 'agent',
|
|
20
|
+
section: 0,
|
|
25
21
|
label: t.chatAgent,
|
|
26
|
-
icon: <Agent />,
|
|
22
|
+
icon: <Icon icon="Agent" />,
|
|
27
23
|
onClick: (event?: React.MouseEvent) => {
|
|
28
24
|
event?.stopPropagation()
|
|
29
25
|
chat.set('nextMessage', '@')
|
|
@@ -32,8 +28,9 @@ export const SelectContent = () => {
|
|
|
32
28
|
{
|
|
33
29
|
role: 'button',
|
|
34
30
|
key: 'quickCommands',
|
|
31
|
+
section: 0,
|
|
35
32
|
label: 'Quick Commands',
|
|
36
|
-
icon: <QuickCommand />,
|
|
33
|
+
icon: <Icon icon="QuickCommand" />,
|
|
37
34
|
onClick: (event?: React.MouseEvent) => {
|
|
38
35
|
event?.stopPropagation()
|
|
39
36
|
chat.set('nextMessage', '/')
|
|
@@ -42,81 +39,61 @@ export const SelectContent = () => {
|
|
|
42
39
|
{
|
|
43
40
|
role: 'button',
|
|
44
41
|
key: 'knowledgeSource',
|
|
42
|
+
section: 0,
|
|
45
43
|
label: 'Knowledge Sources',
|
|
46
|
-
icon: <KnowledgeSource />,
|
|
47
|
-
|
|
44
|
+
icon: <Icon icon="KnowledgeSource" />,
|
|
45
|
+
onClick: () => widget.set('panel', 'ks'),
|
|
48
46
|
},
|
|
49
47
|
{
|
|
50
48
|
role: 'button',
|
|
51
49
|
key: 'stack',
|
|
50
|
+
section: 0,
|
|
52
51
|
label: 'Stacks AI',
|
|
53
|
-
icon: <Stack />,
|
|
54
|
-
|
|
52
|
+
icon: <Icon icon="Stack" />,
|
|
53
|
+
onClick: () => widget.set('panel', 'stack'),
|
|
55
54
|
},
|
|
56
55
|
{
|
|
57
56
|
role: 'button',
|
|
58
57
|
key: 'workspace',
|
|
58
|
+
section: 0,
|
|
59
59
|
label: 'Spots',
|
|
60
|
-
icon: <Spaces />,
|
|
61
|
-
|
|
60
|
+
icon: <Icon icon="Spaces" />,
|
|
61
|
+
onClick: () => widget.set('panel', 'workspace'),
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
role: 'button',
|
|
65
65
|
key: 'upload',
|
|
66
|
+
section: 1,
|
|
66
67
|
label: t.upload,
|
|
67
68
|
onClick: () => uploadManager.open(),
|
|
68
69
|
className: 'upload-item',
|
|
69
|
-
icon: <DocumentUpload />,
|
|
70
|
+
icon: <Icon icon="DocumentUpload" />,
|
|
70
71
|
},
|
|
71
|
-
]
|
|
72
|
+
] as const).filter(({ key }) => features[key]), [features, widget])
|
|
72
73
|
|
|
73
|
-
const listItems = useMemo(() =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
setVisibleMenu(false)
|
|
82
|
-
}) : chatFeatures.onClick,
|
|
83
|
-
role: chatFeatures.role,
|
|
84
|
-
})), [features, widget])
|
|
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])
|
|
85
82
|
|
|
86
83
|
if (!hasFeatureButtons) return null
|
|
87
84
|
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
<IconButton
|
|
91
|
-
|
|
92
|
-
color="light"
|
|
93
|
-
appearance="square"
|
|
94
|
-
title={t.chatViewMenu}
|
|
95
|
-
data-test-hint="button-options"
|
|
96
|
-
aria-label={t.chatViewMenu}
|
|
97
|
-
aria-controls="chatMessageMenu"
|
|
98
|
-
aria-expanded={visibleMenu}
|
|
99
|
-
onClick={() => setVisibleMenu(state => !state)}>
|
|
100
|
-
<Plus />
|
|
101
|
-
</IconButton>
|
|
102
|
-
<SelectionList
|
|
103
|
-
className="message-menu"
|
|
104
|
-
id="chatMessageMenu"
|
|
105
|
-
visible={visibleMenu}
|
|
106
|
-
onHide={() => setVisibleMenu(false)}
|
|
107
|
-
items={listItems}
|
|
108
|
-
aria-label={t.chatViewMenu}
|
|
109
|
-
/>
|
|
110
|
-
</>
|
|
85
|
+
return itemConfigs.length > 1 ? (
|
|
86
|
+
<MenuOverlay items={listItems} position="top" bgLevel={500} spaced roundedItems>
|
|
87
|
+
<IconButton icon="Plus" />
|
|
88
|
+
</MenuOverlay>
|
|
111
89
|
) : (
|
|
112
|
-
<
|
|
113
|
-
color="light"
|
|
90
|
+
<ImageButton
|
|
114
91
|
appearance="square"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
{
|
|
120
|
-
</
|
|
92
|
+
title={`${itemConfigs[0].label}`}
|
|
93
|
+
aria-label={`${itemConfigs[0].label}`}
|
|
94
|
+
onClick={itemConfigs[0].onClick}
|
|
95
|
+
>
|
|
96
|
+
{itemConfigs[0].icon}
|
|
97
|
+
</ImageButton>
|
|
121
98
|
)
|
|
122
99
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Document } from '@citric/icons'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
3
2
|
import { DragEvent, useCallback, useEffect, useState } from 'react'
|
|
4
3
|
import { useCurrentChat } from '../../context/hooks'
|
|
5
4
|
import { useMessageInputDictionary } from './dictionary'
|
|
@@ -72,9 +71,7 @@ export const UploadDragNDrop = ({ isDragging, onDrop, onDragLeave }: UploadDragN
|
|
|
72
71
|
e.stopPropagation()
|
|
73
72
|
}}
|
|
74
73
|
>
|
|
75
|
-
<
|
|
76
|
-
<Document />
|
|
77
|
-
</IconBox>
|
|
74
|
+
<Icon icon="Document" size="lg" aria-hidden={true} />
|
|
78
75
|
<h2 id="upload-drag-drop-title">{t.uploadDragDropTitle}</h2>
|
|
79
76
|
<p id="upload-drag-drop-description">{t.uploadDragDropDescription}</p>
|
|
80
77
|
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProgressBar } from '@stack-spot/citric-react'
|
|
2
2
|
import { interpolate } from '@stack-spot/portal-translate'
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { AdaptiveTextArea } from '../../components/AdaptiveTextArea'
|
|
5
|
-
import { ProgressBar } from '../../components/ProgressBar'
|
|
6
5
|
import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks'
|
|
7
6
|
import { quickCommandRegex } from '../../regex'
|
|
8
7
|
import { ChatEntry } from '../../state/ChatEntry'
|
|
@@ -25,7 +24,8 @@ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
|
|
|
25
24
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
26
25
|
* Commands panel for auto completing.
|
|
27
26
|
*/
|
|
28
|
-
export const MessageInput = ({ chatWindowRef }:
|
|
27
|
+
export const MessageInput = ({ chatWindowRef, customInputMessage }:
|
|
28
|
+
{ chatWindowRef?: React.RefObject<HTMLElement>, customInputMessage?: string }) => {
|
|
29
29
|
const t = useMessageInputDictionary()
|
|
30
30
|
const [focused, setFocused] = useState(false)
|
|
31
31
|
const [, setExpanded] = useState(true)
|
|
@@ -137,11 +137,11 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
137
137
|
|
|
138
138
|
return (
|
|
139
139
|
<UploadProvider value={chat.uploadManager}>
|
|
140
|
-
<MessageInputBox aria-busy={isLoading} className=
|
|
140
|
+
<MessageInputBox aria-busy={isLoading} className={`message-input ${focused ? 'focused' : ''}`}>
|
|
141
141
|
<div className="wrapper-action">
|
|
142
142
|
<QuickCommandSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
143
143
|
<AgentSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
144
|
-
<div className=
|
|
144
|
+
<div className="action-box">
|
|
145
145
|
<ButtonAgent />
|
|
146
146
|
<AdaptiveTextArea
|
|
147
147
|
maxHeight={() => isMinimized
|
|
@@ -151,10 +151,10 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
151
151
|
ref={textAreaRef}
|
|
152
152
|
placeholder={
|
|
153
153
|
agentLabel
|
|
154
|
-
? interpolate(t.placeholder, agentLabel)
|
|
154
|
+
? customInputMessage ?? interpolate(t.placeholder, agentLabel)
|
|
155
155
|
: t.typing
|
|
156
156
|
}
|
|
157
|
-
onChange={
|
|
157
|
+
onChange={v => chat.set('nextMessage', v)}
|
|
158
158
|
value={value}
|
|
159
159
|
onFocus={() => setFocused(true)}
|
|
160
160
|
onBlur={() => setFocused(false)}
|
|
@@ -165,8 +165,7 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
165
165
|
/>
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
168
|
-
<ProgressBar
|
|
169
|
-
backgroundColor={isLoading || !focused ? theme.color.light[500] : theme.color.primary[500]} />
|
|
168
|
+
<ProgressBar className="progress-bar" progress={isLoading ? undefined : (focused ? 100 : 0)} speed="fast" />
|
|
170
169
|
<ContextBar />
|
|
171
170
|
{chat.get('features').upload && <UploadBar />}
|
|
172
171
|
<ButtonBar onSend={onSend} isLoading={isLoading} />
|