@stack-spot/ai-chat-widget 1.36.1-betacitric.1 → 1.36.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 +36 -0
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -6
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +17 -13
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +9 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/Accordion.d.ts +20 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +51 -0
- package/dist/components/Accordion.js.map +1 -0
- 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 +3 -3
- 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 +6 -5
- package/dist/components/AgentCard/index.js.map +1 -1
- package/dist/components/ButtonFavorite.d.ts +7 -8
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +14 -5
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +9 -11
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts.map +1 -1
- package/dist/components/ComponentNavigator.js +4 -2
- package/dist/components/ComponentNavigator.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +4 -3
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +33 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.js +52 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.js.map +1 -0
- package/dist/components/FallbackBoundary/Loading.d.ts +2 -0
- package/dist/components/FallbackBoundary/Loading.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/Loading.js +12 -0
- package/dist/components/FallbackBoundary/Loading.js.map +1 -0
- package/dist/components/FallbackBoundary/index.d.ts +17 -0
- package/dist/components/FallbackBoundary/index.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/index.js +9 -0
- package/dist/components/FallbackBoundary/index.js.map +1 -0
- package/dist/components/FileDescription.d.ts.map +1 -1
- package/dist/components/FileDescription.js +4 -3
- package/dist/components/FileDescription.js.map +1 -1
- package/dist/components/HistoryList.js +1 -1
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/IconInput.d.ts +10 -0
- package/dist/components/IconInput.d.ts.map +1 -0
- package/dist/components/IconInput.js +61 -0
- package/dist/components/IconInput.js.map +1 -0
- 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 +4 -2
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/OverlayMenu.d.ts +21 -0
- package/dist/components/OverlayMenu.d.ts.map +1 -0
- package/dist/components/OverlayMenu.js +79 -0
- package/dist/components/OverlayMenu.js.map +1 -0
- package/dist/components/ProgressBar.d.ts +37 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +131 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/QuickStartButton.d.ts +3 -2
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +3 -4
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +13 -20
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +4 -1
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +16 -4
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +8 -5
- 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 +5 -8
- 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 +30 -5
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +8 -3
- package/dist/components/ToolBadge.d.ts.map +1 -1
- package/dist/components/ToolBadge.js +99 -21
- package/dist/components/ToolBadge.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +37 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +30 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/TooltipAPI.d.ts +29 -0
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipAPI.js +107 -0
- package/dist/components/Tooltip/TooltipAPI.js.map +1 -0
- package/dist/components/Tooltip/context.d.ts +5 -0
- package/dist/components/Tooltip/context.d.ts.map +1 -0
- package/dist/components/Tooltip/context.js +18 -0
- package/dist/components/Tooltip/context.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tooltip/style.d.ts +4 -0
- package/dist/components/Tooltip/style.d.ts.map +1 -0
- package/dist/components/Tooltip/style.js +22 -0
- package/dist/components/Tooltip/style.js.map +1 -0
- package/dist/components/Tooltip/types.d.ts +27 -0
- package/dist/components/Tooltip/types.d.ts.map +1 -0
- package/dist/components/Tooltip/types.js +2 -0
- package/dist/components/Tooltip/types.js.map +1 -0
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
- package/dist/components/WorkspaceTabNavigator.js +9 -7
- package/dist/components/WorkspaceTabNavigator.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +2 -24
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +29 -46
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +4 -24
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +18 -39
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +26 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +4 -2
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +4 -3
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/constants.js +2 -2
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +2 -1
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +12 -1
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/upload/FileUpload.d.ts.map +1 -1
- package/dist/utils/upload/FileUpload.js +1 -2
- package/dist/utils/upload/FileUpload.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +6 -5
- 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 +28 -29
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +5 -3
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +36 -28
- package/dist/views/Chat/ChatMessage.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/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +2 -8
- 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 +14 -7
- 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 +5 -3
- package/dist/views/ChatHistory/styled.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +3 -2
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +12 -6
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.js +3 -2
- 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 +1 -1
- 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 +22 -21
- package/dist/views/Home/styled.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +4 -3
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +36 -14
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +5 -7
- 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 +5 -4
- 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 +4 -2
- 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 +6 -4
- 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 +35 -30
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadBar.js +24 -2
- package/dist/views/MessageInput/UploadBar.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +3 -2
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- 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 +4 -0
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +4 -3
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +3 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +27 -11
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +4 -2
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +28 -23
- 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 +6 -4
- 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 +4 -3
- package/dist/views/Steps/index.js.map +1 -1
- package/dist/views/Steps/utils.d.ts +1 -2
- 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 +4 -2
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +10 -7
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
- package/dist/views/Workspaces/index.js +2 -4
- package/dist/views/Workspaces/index.js.map +1 -1
- package/package.json +13 -12
- package/src/StackspotAIWidget.tsx +33 -30
- package/src/app-metadata.json +17 -13
- package/src/chat-interceptors/quick-commands.ts +11 -5
- package/src/components/Accordion.tsx +75 -0
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +5 -3
- package/src/components/AgentCard/index.tsx +7 -7
- package/src/components/ButtonFavorite.tsx +47 -20
- package/src/components/Code.tsx +36 -31
- package/src/components/ComponentNavigator.tsx +8 -4
- package/src/components/FadingOverflow.tsx +7 -6
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +71 -0
- package/src/components/FallbackBoundary/Loading.tsx +14 -0
- package/src/components/FallbackBoundary/index.tsx +26 -0
- package/src/components/FileDescription.tsx +10 -14
- package/src/components/HistoryList.tsx +1 -1
- package/src/components/IconInput.tsx +73 -0
- package/src/components/ListResource.tsx +5 -5
- package/src/components/Markdown.tsx +1 -1
- package/src/components/Modal.tsx +4 -2
- package/src/components/OverlayMenu.tsx +133 -0
- package/src/components/ProgressBar.tsx +183 -0
- package/src/components/QuickStartButton.tsx +4 -5
- package/src/components/RightPanelForm.tsx +13 -20
- package/src/components/RightPanelTabs.tsx +32 -4
- package/src/components/Selector/index.tsx +13 -17
- package/src/components/Selector/styled.ts +5 -8
- package/src/components/StackedBadge.tsx +5 -5
- package/src/components/TabManager.tsx +36 -8
- package/src/components/ToolBadge.tsx +129 -39
- package/src/components/Tooltip/Tooltip.tsx +78 -0
- package/src/components/Tooltip/TooltipAPI.ts +101 -0
- package/src/components/Tooltip/context.tsx +24 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Tooltip/style.tsx +24 -0
- package/src/components/Tooltip/types.ts +28 -0
- package/src/components/WorkspaceTabNavigator.tsx +25 -22
- package/src/components/form/DescribedCheckboxGroup.tsx +65 -90
- package/src/components/form/DescribedRadioGroup.tsx +46 -79
- package/src/index.ts +2 -1
- package/src/layout.css +26 -0
- package/src/right-panel/DefaultPanel.tsx +7 -3
- package/src/state/ChatEntry.ts +4 -3
- package/src/state/constants.ts +2 -2
- package/src/types.ts +3 -4
- package/src/utils/tools.ts +23 -2
- package/src/utils/upload/FileUpload.ts +1 -2
- package/src/views/Agents/AgentDescription.tsx +7 -6
- package/src/views/Agents/AgentsPanel.tsx +12 -11
- package/src/views/Agents/AgentsTab.tsx +56 -37
- package/src/views/Chat/AgentInfo.tsx +6 -7
- package/src/views/Chat/ChatMessage.tsx +118 -109
- package/src/views/Chat/StepsList.tsx +11 -10
- package/src/views/Chat/styled.ts +2 -8
- package/src/views/ChatHistory/HistoryItem.tsx +19 -12
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +5 -3
- package/src/views/ChatTabSelection.tsx +3 -2
- package/src/views/Editor.tsx +14 -9
- package/src/views/Home/BuiltInAgent.tsx +8 -7
- package/src/views/Home/CustomAgent.tsx +3 -3
- package/src/views/Home/index.tsx +1 -1
- package/src/views/Home/styled.ts +22 -21
- package/src/views/KSDocument.tsx +8 -7
- package/src/views/KnowledgeSources.tsx +66 -24
- package/src/views/MessageInput/AgentSelector.tsx +8 -10
- package/src/views/MessageInput/ButtonAgent.tsx +12 -24
- package/src/views/MessageInput/ButtonBar.tsx +21 -25
- package/src/views/MessageInput/ContextBar.tsx +14 -12
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +68 -39
- package/src/views/MessageInput/UploadBar.tsx +34 -2
- package/src/views/MessageInput/UploadDragNDrop.tsx +5 -2
- package/src/views/MessageInput/dictionary.ts +4 -0
- package/src/views/MessageInput/index.tsx +7 -5
- package/src/views/MessageInput/styled.ts +28 -12
- package/src/views/MinimizedHeader.tsx +7 -4
- package/src/views/Stacks.tsx +54 -31
- package/src/views/Steps/FlowChart/NodeStep.tsx +4 -6
- package/src/views/Steps/StepModal.tsx +18 -14
- package/src/views/Steps/index.tsx +5 -4
- package/src/views/Steps/utils.tsx +9 -9
- package/src/views/Tools.tsx +19 -12
- package/src/views/Workspaces/WorkspacesTab.tsx +21 -17
- package/src/views/Workspaces/index.tsx +2 -4
package/src/views/Chat/styled.ts
CHANGED
|
@@ -25,9 +25,9 @@ export const ChatList: IStyledComponentBase<
|
|
|
25
25
|
border-radius: 8px;
|
|
26
26
|
align-self: start;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
svg {
|
|
29
29
|
fill: ${theme.color.danger.contrastText};
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
|
|
32
32
|
small {
|
|
33
33
|
margin-top: 1px;
|
|
@@ -78,12 +78,6 @@ export const ChatList: IStyledComponentBase<
|
|
|
78
78
|
opacity: 0.6;
|
|
79
79
|
margin-left: auto;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
// prevents the feedback from being cut by the overflow rules of the parent elements.
|
|
83
|
-
.copy-btn:after {
|
|
84
|
-
left: 0;
|
|
85
|
-
margin-top: -20px;
|
|
86
|
-
}
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
> li {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconBox, Input } from '@citric/core'
|
|
2
|
+
import { Check, Download, EllipsisHorizontal, Pencil, Trash } from '@citric/icons'
|
|
3
|
+
import { IconButton, LoadingCircular } from '@citric/ui'
|
|
4
|
+
import { focusNextIgnoringChildren } from '@stack-spot/portal-components'
|
|
3
5
|
import { agentToolsClient, aiClient } from '@stack-spot/portal-network'
|
|
4
6
|
import { ConversationResponse } from '@stack-spot/portal-network/api/ai'
|
|
5
7
|
import { theme } from '@stack-spot/portal-theme'
|
|
6
8
|
import { last } from 'lodash'
|
|
7
9
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
10
|
+
import { OverlayMenu } from '../../components/OverlayMenu'
|
|
8
11
|
import { useWidget } from '../../context/hooks'
|
|
9
12
|
import { ChatEntry } from '../../state/ChatEntry'
|
|
10
13
|
import { ChatState } from '../../state/ChatState'
|
|
11
14
|
import { LabeledAgent } from '../../state/types'
|
|
15
|
+
import { ButtonAction } from '../../types'
|
|
12
16
|
import { download } from '../../utils/download'
|
|
13
17
|
import { genericSourcesToKnowledgeSources } from '../../utils/knowledge-source'
|
|
14
18
|
import { useHistoryDictionary } from './dictionary'
|
|
@@ -27,6 +31,7 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
27
31
|
const [isDeleted, setDeleted] = useState(false)
|
|
28
32
|
const renameInput = useRef<HTMLInputElement>(null)
|
|
29
33
|
const widget = useWidget()
|
|
34
|
+
const overlayRef = useRef<HTMLDivElement>(null)
|
|
30
35
|
|
|
31
36
|
useEffect(() => {
|
|
32
37
|
if (isRenaming) renameInput.current?.focus()
|
|
@@ -53,6 +58,7 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
const onDownload = useCallback(async () => {
|
|
61
|
+
setTimeout(() => focusNextIgnoringChildren(overlayRef.current), 10)
|
|
56
62
|
setLoading(true)
|
|
57
63
|
try {
|
|
58
64
|
const content = await aiClient.downloadChat.mutate({ conversationId: item.id })
|
|
@@ -66,6 +72,7 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
66
72
|
|
|
67
73
|
const onDelete = useCallback(async () => {
|
|
68
74
|
setDeleted(true)
|
|
75
|
+
setTimeout(() => overlayRef.current?.focus(), 10)
|
|
69
76
|
try {
|
|
70
77
|
await aiClient.deleteChat.mutate({ conversationId: item.id })
|
|
71
78
|
aiClient.chats.invalidate()
|
|
@@ -116,10 +123,10 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
116
123
|
setLoading(false)
|
|
117
124
|
}, [])
|
|
118
125
|
|
|
119
|
-
const actions:
|
|
120
|
-
{ label: t.rename, onClick: onRename, icon: <
|
|
121
|
-
{ label: t.download, onClick: onDownload, icon: <
|
|
122
|
-
{ label: t.delete, onClick: onDelete, icon: <
|
|
126
|
+
const actions: ButtonAction[] = [
|
|
127
|
+
{ label: t.rename, onClick: onRename, icon: <Pencil /> },
|
|
128
|
+
{ label: t.download, onClick: onDownload, icon: <Download /> },
|
|
129
|
+
{ label: t.delete, onClick: onDelete, icon: <Trash />, color: theme.color.danger[500] },
|
|
123
130
|
]
|
|
124
131
|
|
|
125
132
|
return isDeleted ? null : (
|
|
@@ -129,22 +136,22 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
129
136
|
<Input
|
|
130
137
|
ref={renameInput}
|
|
131
138
|
value={renamed}
|
|
132
|
-
onChange={setRenamed}
|
|
133
|
-
style={{ flex: 1 }}
|
|
139
|
+
onChange={e => setRenamed(e.target.value)}
|
|
134
140
|
onKeyDown={(e) => {
|
|
135
141
|
if (['Enter', 'Escape'].includes(e.key)) {
|
|
136
142
|
e.key === 'Enter' ? onSubmitRename() : setRenaming(false)
|
|
143
|
+
setTimeout(() => overlayRef.current?.focus(), 10)
|
|
137
144
|
}
|
|
138
145
|
}}
|
|
139
146
|
/>
|
|
140
|
-
<IconButton
|
|
147
|
+
<IconButton onClick={onSubmitRename}><Check /></IconButton>
|
|
141
148
|
</>
|
|
142
149
|
) : (
|
|
143
150
|
<>
|
|
144
151
|
<button className="label" onClick={onSelect} disabled={isLoading}>{title}</button>
|
|
145
|
-
{isLoading ? <
|
|
146
|
-
<
|
|
147
|
-
</
|
|
152
|
+
{isLoading ? <LoadingCircular size="xs" /> : <OverlayMenu actions={actions} position="left" ref={overlayRef}>
|
|
153
|
+
<IconBox><EllipsisHorizontal /></IconBox>
|
|
154
|
+
</OverlayMenu>}
|
|
148
155
|
</>
|
|
149
156
|
)}
|
|
150
157
|
</HistoryItemBox>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FallbackBoundary } from '@stack-spot/citric-react'
|
|
2
1
|
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
5
|
import { ChatHistoryPanel } from './ChatHistoryPanel'
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IconBox } from '@citric/core'
|
|
2
|
+
import { IconButton } from '@citric/ui'
|
|
1
3
|
import { theme } from '@stack-spot/portal-theme'
|
|
2
4
|
import { styled } from 'styled-components'
|
|
3
5
|
|
|
@@ -40,7 +42,7 @@ export const HistoryItemBox = styled.div`
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
${IconBox}, ${IconButton} {
|
|
44
46
|
padding: 0;
|
|
45
47
|
border: none;
|
|
46
48
|
background-color: transparent;
|
|
@@ -52,7 +54,7 @@ export const HistoryItemBox = styled.div`
|
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
$
|
|
57
|
+
${IconButton} svg {
|
|
56
58
|
width: 16px;
|
|
57
|
-
}
|
|
59
|
+
}
|
|
58
60
|
`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Clock, Plus } from '@citric/icons'
|
|
1
2
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
2
3
|
import { useMemo } from 'react'
|
|
3
4
|
import { TabManager } from '../components/TabManager'
|
|
@@ -39,13 +40,13 @@ export const ChatTabSelection = () => {
|
|
|
39
40
|
const buttons = useMemo<ButtonAction[]>(
|
|
40
41
|
() => {
|
|
41
42
|
const actions: ButtonAction[] = [{
|
|
42
|
-
icon:
|
|
43
|
+
icon: <Plus />,
|
|
43
44
|
ariaLabel: t.newChat,
|
|
44
45
|
onClick: create,
|
|
45
46
|
}]
|
|
46
47
|
if (chatHistory) {
|
|
47
48
|
actions.push({
|
|
48
|
-
icon:
|
|
49
|
+
icon: <Clock />,
|
|
49
50
|
label: t.history,
|
|
50
51
|
ariaLabel: t.openHistory,
|
|
51
52
|
className: 'test',
|
package/src/views/Editor.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Text } from '@citric/core'
|
|
2
|
+
import { LoadingCircular } from '@citric/ui'
|
|
1
3
|
import MonacoEditor, { OnMount } from '@monaco-editor/react'
|
|
2
|
-
import { ProgressCircular, Select, Text } from '@stack-spot/citric-react'
|
|
3
4
|
import { delay } from '@stack-spot/portal-components'
|
|
5
|
+
import { Select } from '@stack-spot/portal-components/Select'
|
|
4
6
|
import { useThemeKind } from '@stack-spot/portal-theme'
|
|
5
7
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
8
|
import { debounce } from 'lodash'
|
|
@@ -27,13 +29,17 @@ const TitleBox = styled.div`
|
|
|
27
29
|
position: relative;
|
|
28
30
|
|
|
29
31
|
.language-selector {
|
|
30
|
-
|
|
32
|
+
width: 150px;
|
|
31
33
|
position: absolute;
|
|
32
34
|
top: -4px;
|
|
33
35
|
right: 0;
|
|
34
36
|
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
+
.options {
|
|
38
|
+
max-height: 250px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.current-value {
|
|
42
|
+
padding: 2px 8px;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
`
|
|
@@ -72,12 +78,11 @@ const Title = () => {
|
|
|
72
78
|
<Text appearance="h5">Editor</Text>
|
|
73
79
|
<Select
|
|
74
80
|
options={languages}
|
|
75
|
-
renderLabel={l => l
|
|
76
|
-
|
|
81
|
+
renderLabel={l => l.label}
|
|
82
|
+
renderValue={l => l.value}
|
|
77
83
|
value={language}
|
|
78
|
-
onChange={l => chat.set('codeLanguage', l
|
|
84
|
+
onChange={l => chat.set('codeLanguage', l.value)}
|
|
79
85
|
className="language-selector"
|
|
80
|
-
searchable
|
|
81
86
|
/>
|
|
82
87
|
</TitleBox>
|
|
83
88
|
)
|
|
@@ -120,7 +125,7 @@ const EditorPanel = () => {
|
|
|
120
125
|
options={{ minimap: { enabled: false } }}
|
|
121
126
|
value={value}
|
|
122
127
|
onChange={v => chat.set('code', v)}
|
|
123
|
-
loading={<
|
|
128
|
+
loading={<LoadingCircular />}
|
|
124
129
|
onMount={setup}
|
|
125
130
|
/>
|
|
126
131
|
</EditorBox>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Text } from '@citric/core'
|
|
2
|
+
import { FaceSmile, KnowledgeSource, QuickCommand, StackSpot } from '@citric/icons'
|
|
2
3
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
3
4
|
import { QuickStartButton } from '../../components/QuickStartButton'
|
|
4
5
|
import { useCurrentChat } from '../../context/hooks'
|
|
@@ -21,28 +22,28 @@ export const BuiltInAgent = ({ username }: HomeProps) => {
|
|
|
21
22
|
<HomeBox className="home-page">
|
|
22
23
|
<Text appearance="h2" className="title">{t.hello}, {username}</Text>
|
|
23
24
|
<Text appearance="h3" className="subtitle">{t.subtitle}</Text>
|
|
24
|
-
<
|
|
25
|
+
<div className="shortcuts">
|
|
25
26
|
<QuickStartButton
|
|
26
27
|
label={t['question.meta']}
|
|
27
28
|
onClick={() => send(t['question.meta'])}
|
|
28
|
-
icon=
|
|
29
|
+
icon={<StackSpot />}
|
|
29
30
|
/>
|
|
30
31
|
<QuickStartButton
|
|
31
32
|
label={t['question.ks']}
|
|
32
33
|
onClick={() => send(t['question.ks'])}
|
|
33
|
-
icon=
|
|
34
|
+
icon={<KnowledgeSource />}
|
|
34
35
|
/>
|
|
35
36
|
<QuickStartButton
|
|
36
37
|
label={t['question.agents']}
|
|
37
38
|
onClick={() => send(t['question.agents'])}
|
|
38
|
-
icon=
|
|
39
|
+
icon={<FaceSmile />}
|
|
39
40
|
/>
|
|
40
41
|
<QuickStartButton
|
|
41
42
|
label={t['question.qc']}
|
|
42
43
|
onClick={() => send(t['question.qc'])}
|
|
43
|
-
icon=
|
|
44
|
+
icon={<QuickCommand />}
|
|
44
45
|
/>
|
|
45
|
-
</
|
|
46
|
+
</div>
|
|
46
47
|
</HomeBox>
|
|
47
48
|
)
|
|
48
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconBox, Text } from '@citric/core'
|
|
2
|
+
import { Agent } from '@citric/icons'
|
|
3
3
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
4
4
|
import { useMemo } from 'react'
|
|
5
5
|
import { QuickStartButton } from '../../components/QuickStartButton'
|
|
@@ -28,7 +28,7 @@ export const CustomAgent = () => {
|
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<HomeBox className="home-page custom-agent">
|
|
31
|
-
{image ? <img src={image} className="avatar" /> : <
|
|
31
|
+
{image ? <img src={image} className="avatar" /> : <IconBox className="avatar"><Agent /></IconBox>}
|
|
32
32
|
<Text appearance="h3">{label}</Text>
|
|
33
33
|
<div className="shortcuts">{suggestions?.length ? suggestions : null}</div>
|
|
34
34
|
</HomeBox>
|
package/src/views/Home/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FallbackBoundary } from '@stack-spot/citric-react'
|
|
2
1
|
import { FadingOverflow } from '@stack-spot/portal-components/FadingOverflow'
|
|
3
2
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
4
3
|
import { styled } from 'styled-components'
|
|
5
4
|
import { AgentCard } from '../../components/AgentCard'
|
|
6
5
|
import { AgentCardCreate } from '../../components/AgentCard/AgentCardCreate'
|
|
6
|
+
import { FallbackBoundary } from '../../components/FallbackBoundary'
|
|
7
7
|
import { useCurrentChatState } from '../../context/hooks'
|
|
8
8
|
import { BuiltInAgent } from './BuiltInAgent'
|
|
9
9
|
import { CustomAgent } from './CustomAgent'
|
package/src/views/Home/styled.ts
CHANGED
|
@@ -21,34 +21,35 @@ export const HomeBox = styled.div`
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.shortcuts {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
padding-inline: 16px;
|
|
30
|
-
padding-block: 8px;
|
|
31
|
-
font-weight: 400;
|
|
32
|
-
line-height: normal;
|
|
33
|
-
border: none;
|
|
34
|
-
max-width: 30vw;
|
|
35
|
-
margin-bottom: 8px;
|
|
36
|
-
i {
|
|
37
|
-
width: 16px;
|
|
38
|
-
height: 16px;
|
|
24
|
+
li {
|
|
25
|
+
flex: 1;
|
|
26
|
+
}
|
|
27
|
+
button {
|
|
28
|
+
margin-left: 0;
|
|
39
29
|
margin-right: 8px;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
border-radius: 50px;
|
|
31
|
+
padding-inline: 16px;
|
|
32
|
+
padding-block: 8px;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
line-height: normal;
|
|
35
|
+
border: none;
|
|
36
|
+
max-width: 30vw;
|
|
37
|
+
margin-bottom: 8px;
|
|
38
|
+
i {
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
margin-right: 8px;
|
|
42
|
+
}
|
|
43
|
+
&:hover, &:visited, &:active, &:focus {
|
|
44
|
+
background-color: ${theme.color.light[600]}
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
.avatar {
|
|
49
|
+
.avatar, .avatar svg {
|
|
48
50
|
width: 74px;
|
|
49
51
|
height: 74px;
|
|
50
52
|
border-radius: 50%;
|
|
51
|
-
font-size: 74px;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
&.custom-agent {
|
package/src/views/KSDocument.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Flex, IconBox, Text } from '@citric/core'
|
|
2
|
+
import { Score } from '@citric/icons'
|
|
3
3
|
import { aiClient } from '@stack-spot/portal-network'
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
5
|
import { useEffect } from 'react'
|
|
6
6
|
import { Code } from '../components/Code'
|
|
7
|
+
import { FallbackBoundary } from '../components/FallbackBoundary'
|
|
7
8
|
import { useWidget, useWidgetState } from '../context/hooks'
|
|
8
9
|
import { useRightPanel } from '../right-panel/hooks'
|
|
9
10
|
import { extractCodeFromKSDocument } from '../utils/knowledge-source'
|
|
@@ -23,13 +24,13 @@ export const KSDocument = () => {
|
|
|
23
24
|
<FallbackBoundary><KSDocumentPanel documentId={ks.documentId} slug={ks.slug} /></FallbackBoundary>,
|
|
24
25
|
{
|
|
25
26
|
title: (
|
|
26
|
-
<
|
|
27
|
+
<Flex flexDirection="row" alignItems="center" flex="1">
|
|
27
28
|
<Text appearance="h5" style={{ flex: 1 }}>{ks.name}</Text>
|
|
28
|
-
<
|
|
29
|
-
<
|
|
29
|
+
<Flex flexDirection="row" alignItems="center" style={{ gap: '5px' }} title="Score" aria-label="Score">
|
|
30
|
+
<IconBox><Score /></IconBox>
|
|
30
31
|
<Text>{ks.score.toFixed(2)}</Text>
|
|
31
|
-
</
|
|
32
|
-
</
|
|
32
|
+
</Flex>
|
|
33
|
+
</Flex>
|
|
33
34
|
),
|
|
34
35
|
description: t.description,
|
|
35
36
|
onClose: () => widget.set('panel', undefined),
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import { Button
|
|
1
|
+
import { Button } from '@citric/core'
|
|
2
|
+
import { Search } from '@citric/icons'
|
|
2
3
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
3
4
|
import { aiClient, dataIntegrationClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
4
|
-
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
5
|
+
import { KnowledgeSourceItemResponse, VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
5
6
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
6
7
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
-
import
|
|
8
|
+
import { difference, uniqBy } from 'lodash'
|
|
9
|
+
import React, { ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
10
|
+
import { ButtonFavorite } from '../components/ButtonFavorite'
|
|
8
11
|
import { NavigationComponent } from '../components/ComponentNavigator'
|
|
9
12
|
import { DescribedCheckboxGroup } from '../components/form/DescribedCheckboxGroup'
|
|
13
|
+
import { IconInput } from '../components/IconInput'
|
|
10
14
|
import { RightPanelContentList } from '../components/RightPanelContentList'
|
|
11
15
|
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
12
16
|
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator'
|
|
@@ -24,6 +28,8 @@ export interface TabProps {
|
|
|
24
28
|
onSubmit?: () => void,
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
type TabElement = { title: string, content: ReactElement }
|
|
32
|
+
|
|
27
33
|
export const KnowledgeSources = () => {
|
|
28
34
|
const t = useTranslate(dictionary)
|
|
29
35
|
const panel = useWidgetState('panel')
|
|
@@ -63,15 +69,15 @@ const KnowledgeSourcesPanel = () => {
|
|
|
63
69
|
allKS.current = chat.get('knowledgeSources') ?? []
|
|
64
70
|
}, [chat])
|
|
65
71
|
|
|
66
|
-
const allTabsMap: Partial<Record<Scope,
|
|
67
|
-
favorite: {
|
|
72
|
+
const allTabsMap: Partial<Record<Scope, TabElement>> = {
|
|
73
|
+
favorite: { title: t.favorites,
|
|
68
74
|
content: <KnowledgeSourcesTab key="favorite" visibility="favorite" allKS={allKS} onSubmit={onSubmit} /> },
|
|
69
|
-
personal: {
|
|
75
|
+
personal: { title: t.personal,
|
|
70
76
|
content: <KnowledgeSourcesTab key="personal" visibility="personal" allKS={allKS} onSubmit={onSubmit} /> },
|
|
71
|
-
shared: {
|
|
72
|
-
workspace: {
|
|
77
|
+
shared: { title: t.shared, content: <KnowledgeSourcesTab key="shared" visibility="shared" allKS={allKS} onSubmit={onSubmit} /> },
|
|
78
|
+
workspace: { title: t.spots,
|
|
73
79
|
content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
|
|
74
|
-
account: {
|
|
80
|
+
account: { title: t.account, content: <KnowledgeSourcesTab key="account" visibility="account" allKS={allKS} onSubmit={onSubmit} /> },
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
const defaultScopes: Scope[] = ['favorite', 'personal', 'shared', 'workspace', 'account']
|
|
@@ -83,8 +89,8 @@ const KnowledgeSourcesPanel = () => {
|
|
|
83
89
|
: rawScopes
|
|
84
90
|
|
|
85
91
|
const tabs = scopesToRender
|
|
86
|
-
.map(scope =>
|
|
87
|
-
.filter(Boolean) as
|
|
92
|
+
.map(scope => allTabsMap[scope])
|
|
93
|
+
.filter(Boolean) as TabElement[]
|
|
88
94
|
|
|
89
95
|
return (isGroupResourcesByScope ? (
|
|
90
96
|
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
@@ -95,15 +101,14 @@ const KnowledgeSourcesPanel = () => {
|
|
|
95
101
|
|
|
96
102
|
export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId, showSubmitButton = true }: TabProps) => {
|
|
97
103
|
const t = useTranslate(dictionary)
|
|
104
|
+
const [filter, setFilter] = useState('')
|
|
105
|
+
|
|
98
106
|
const knowledgeSources = workspaceId
|
|
99
107
|
? workspaceAiClient.getKSFromWorkspaceAi.useQuery({ workspaceId })
|
|
100
108
|
: aiClient.knowledgeSources.useQuery({
|
|
101
109
|
visibility, order: 'a-to-z', types: ['snippet', 'api', 'event', 'custom'],
|
|
102
110
|
})
|
|
103
|
-
|
|
104
|
-
const currentlySelected = allKS.current?.map(ks => ks.id)
|
|
105
|
-
return knowledgeSources.filter(ks => currentlySelected?.includes(ks.slug))
|
|
106
|
-
}, [])
|
|
111
|
+
|
|
107
112
|
const listFavorites = dataIntegrationClient.knowledgeSources.useQuery({ visibility: 'favorite' })
|
|
108
113
|
const [addFavorite, pendingAddFav] = dataIntegrationClient.addFavoriteKnowledgeSource.useMutation()
|
|
109
114
|
const [removeFavorite, pendingRemoveFav] = dataIntegrationClient.removeFavoriteKnowledgeSource.useMutation()
|
|
@@ -160,19 +165,56 @@ export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId,
|
|
|
160
165
|
}
|
|
161
166
|
})
|
|
162
167
|
|
|
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
|
+
|
|
163
190
|
return (
|
|
164
191
|
<>
|
|
165
192
|
<div className="content">
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
193
|
+
<IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
|
|
194
|
+
{!!filtered.length && <DescribedCheckboxGroup
|
|
195
|
+
options={filtered}
|
|
196
|
+
renderAfterElement={({ slug }) => (
|
|
197
|
+
<ButtonFavorite
|
|
198
|
+
favorite={{
|
|
199
|
+
idOrSlug: slug, listFavorites, onAddFavorite, onRemoveFavorite }} />
|
|
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" />}
|
|
174
216
|
</div>
|
|
175
|
-
{!!
|
|
217
|
+
{!!filtered.length && showSubmitButton && <Button onClick={onSubmit}>{t.apply}</Button>}
|
|
176
218
|
</>
|
|
177
219
|
)
|
|
178
220
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Flex, IconBox, Image } from '@citric/core'
|
|
2
|
+
import { Agent } from '@citric/icons'
|
|
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,17 +10,15 @@ import { useAgentFavorites } from '../Agents/useAgentFavorites'
|
|
|
10
10
|
type AgentWithSpaceName = AgentResponseWithBuiltIn
|
|
11
11
|
|
|
12
12
|
const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
|
|
13
|
-
const avatarComponent = avatar
|
|
14
|
-
? <img style={{ width: '32px', height: '32px', borderRadius: '50%' }} src={avatar} />
|
|
15
|
-
: <IconBox size="md" icon="Agent" style={{ backgroundColor: 'transparent' }} />
|
|
13
|
+
const avatarComponent = avatar ? <Image width="32" height="32" radius="full" src={avatar} /> : <IconBox size="md"><Agent /></IconBox>
|
|
16
14
|
|
|
17
|
-
return <
|
|
15
|
+
return <Flex flexWrap="nowrap" alignItems="center" sx={{ gap: '8px' }}>
|
|
18
16
|
{avatarComponent}
|
|
19
17
|
<div>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
18
|
+
<p className="selector-description">{spaceName}</p>
|
|
19
|
+
<p className="selector-title">{name}</p>
|
|
22
20
|
</div>
|
|
23
|
-
</
|
|
21
|
+
</Flex>
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
export const AgentSelector = ({ inputRef, isTrial }: {
|
|
@@ -74,7 +72,7 @@ export const AgentSelector = ({ inputRef, isTrial }: {
|
|
|
74
72
|
selectorConfig={{
|
|
75
73
|
resourceName: 'Agent',
|
|
76
74
|
shortcut: '@',
|
|
77
|
-
icon: <
|
|
75
|
+
icon: <Agent />,
|
|
78
76
|
regex: agentRegex,
|
|
79
77
|
urlBuilder: (agent) => `/agents/${agent?.id}`,
|
|
80
78
|
searchProp: 'name',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Flex, IconBox } from '@citric/core'
|
|
2
|
+
import { Agent, TimesMini } from '@citric/icons'
|
|
3
|
+
import { IconButton, Tooltip } from '@citric/ui'
|
|
3
4
|
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
4
5
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
5
6
|
import { useEffect } from 'react'
|
|
@@ -40,30 +41,17 @@ export const ButtonAgent = () => {
|
|
|
40
41
|
<div className="button-group">
|
|
41
42
|
{features.agent && (
|
|
42
43
|
<div className="group-agent">
|
|
43
|
-
<
|
|
44
|
-
aria-label={t.agent}
|
|
45
|
-
title={t.agent}
|
|
46
|
-
className="agent"
|
|
47
|
-
onClick={() => widget.set('panel', 'agent')}
|
|
48
|
-
>
|
|
44
|
+
<IconButton aria-label={t.agent} title={t.agent} className="agent" onClick={() => widget.set('panel', 'agent')}>
|
|
49
45
|
{agentDefault?.avatar ? <img src={agentDefault.avatar} className="image" /> : <MiniLogo />}
|
|
50
|
-
</
|
|
46
|
+
</IconButton>
|
|
51
47
|
{agent?.id && !isAgentDefault() &&
|
|
52
|
-
<Tooltip
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
className="
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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>
|
|
48
|
+
<Tooltip text={t.remove} >
|
|
49
|
+
<IconButton aria-label={t.remove} className="agent agent-selected" onClick={setAgentDefault}>
|
|
50
|
+
{agent?.image ? <img src={agent.image} className="image" /> : <IconBox className="image" size="xs"><Agent /></IconBox>}
|
|
51
|
+
<Flex className="icon-remove" alignContent="center" justifyContent="center">
|
|
52
|
+
<TimesMini />
|
|
53
|
+
</Flex>
|
|
54
|
+
</IconButton>
|
|
67
55
|
</Tooltip>
|
|
68
56
|
}
|
|
69
57
|
</div>
|