@stack-spot/ai-chat-widget 1.36.1-beta.1 → 1.36.1-betacitric.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 +1 -26
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +6 -7
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +12 -16
- 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 +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.js +1 -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 +5 -30
- 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 +21 -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/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +1 -27
- 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/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +4 -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 +29 -28
- 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 +3 -5
- 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 +28 -36
- 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 +8 -2
- 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 +7 -14
- 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/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +2 -3
- 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 +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 +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 +4 -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 -35
- 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 +2 -29
- 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 +2 -3
- 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 +0 -2
- 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 +3 -4
- 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 -27
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +2 -4
- package/dist/views/MinimizedHeader.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 +11 -12
- package/src/StackspotAIWidget.tsx +30 -33
- package/src/app-metadata.json +12 -16
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +3 -5
- 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 +1 -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 +8 -36
- package/src/components/ToolBadge.tsx +39 -129
- package/src/components/WorkspaceTabNavigator.tsx +22 -25
- package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
- package/src/components/form/DescribedRadioGroup.tsx +79 -46
- package/src/index.ts +0 -2
- package/src/layout.css +1 -27
- package/src/right-panel/DefaultPanel.tsx +3 -7
- package/src/state/ChatEntry.ts +3 -4
- package/src/types.ts +4 -3
- package/src/views/Agents/AgentDescription.tsx +4 -5
- package/src/views/Agents/AgentsPanel.tsx +11 -12
- package/src/views/Agents/AgentsTab.tsx +37 -56
- package/src/views/Chat/AgentInfo.tsx +7 -6
- package/src/views/Chat/ChatMessage.tsx +109 -118
- package/src/views/Chat/StepsList.tsx +10 -11
- package/src/views/Chat/styled.ts +8 -2
- package/src/views/ChatHistory/HistoryItem.tsx +12 -19
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatTabSelection.tsx +2 -3
- 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 +1 -1
- 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 +12 -14
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +39 -69
- package/src/views/MessageInput/UploadBar.tsx +1 -39
- package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
- package/src/views/MessageInput/dictionary.ts +0 -2
- package/src/views/MessageInput/index.tsx +5 -7
- package/src/views/MessageInput/styled.ts +12 -28
- package/src/views/MinimizedHeader.tsx +4 -7
- 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,29 +1,24 @@
|
|
|
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
|
key: 'agent',
|
|
19
|
+
section: 0,
|
|
24
20
|
label: t.chatAgent,
|
|
25
|
-
icon: <Agent />,
|
|
26
|
-
'aria-label': 'Botão de agent',
|
|
21
|
+
icon: <Icon icon="Agent" />,
|
|
27
22
|
onClick: (event?: React.MouseEvent) => {
|
|
28
23
|
event?.stopPropagation()
|
|
29
24
|
chat.set('nextMessage', '@')
|
|
@@ -31,9 +26,9 @@ export const SelectContent = () => {
|
|
|
31
26
|
},
|
|
32
27
|
{
|
|
33
28
|
key: 'quickCommands',
|
|
29
|
+
section: 0,
|
|
34
30
|
label: 'Quick Commands',
|
|
35
|
-
icon: <QuickCommand />,
|
|
36
|
-
'aria-label': 'Botão de quickCommands',
|
|
31
|
+
icon: <Icon icon="QuickCommand" />,
|
|
37
32
|
onClick: (event?: React.MouseEvent) => {
|
|
38
33
|
event?.stopPropagation()
|
|
39
34
|
chat.set('nextMessage', '/')
|
|
@@ -41,83 +36,58 @@ export const SelectContent = () => {
|
|
|
41
36
|
},
|
|
42
37
|
{
|
|
43
38
|
key: 'knowledgeSource',
|
|
39
|
+
section: 0,
|
|
44
40
|
label: 'Knowledge Sources',
|
|
45
|
-
icon: <KnowledgeSource />,
|
|
46
|
-
|
|
47
|
-
panel: 'ks',
|
|
41
|
+
icon: <Icon icon="KnowledgeSource" />,
|
|
42
|
+
onClick: () => widget.set('panel', 'ks'),
|
|
48
43
|
},
|
|
49
44
|
{
|
|
50
45
|
key: 'stack',
|
|
46
|
+
section: 0,
|
|
51
47
|
label: 'Stacks AI',
|
|
52
|
-
icon: <Stack />,
|
|
53
|
-
'
|
|
54
|
-
panel: 'stack',
|
|
48
|
+
icon: <Icon icon="Stack" />,
|
|
49
|
+
onClick: () => widget.set('panel', 'stack'),
|
|
55
50
|
},
|
|
56
51
|
{
|
|
57
52
|
key: 'workspace',
|
|
53
|
+
section: 0,
|
|
58
54
|
label: 'Spots',
|
|
59
|
-
icon: <Spaces />,
|
|
60
|
-
'
|
|
61
|
-
panel: 'workspace',
|
|
55
|
+
icon: <Icon icon="Spaces" />,
|
|
56
|
+
onClick: () => widget.set('panel', 'workspace'),
|
|
62
57
|
},
|
|
63
58
|
{
|
|
64
59
|
key: 'upload',
|
|
60
|
+
section: 1,
|
|
65
61
|
label: t.upload,
|
|
66
62
|
onClick: () => uploadManager.open(),
|
|
67
63
|
className: 'upload-item',
|
|
68
|
-
icon: <DocumentUpload />,
|
|
69
|
-
'aria-label': 'Botão de upload de arquivos',
|
|
64
|
+
icon: <Icon icon="DocumentUpload" />,
|
|
70
65
|
},
|
|
71
|
-
]
|
|
66
|
+
] as const).filter(({ key }) => features[key]), [features, widget])
|
|
72
67
|
|
|
73
|
-
const listItems = useMemo(() =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
setVisibleMenu(false)
|
|
82
|
-
}) : chatFeatures.onClick,
|
|
83
|
-
'aria-label': chatFeatures['aria-label'],
|
|
84
|
-
})), [features, widget])
|
|
68
|
+
const listItems = useMemo(() => {
|
|
69
|
+
const sections: [MenuSection, MenuSection] = [
|
|
70
|
+
{ type: 'section', children: [] },
|
|
71
|
+
{ type: 'section', children: [] },
|
|
72
|
+
]
|
|
73
|
+
itemConfigs.forEach(item => sections[item.section].children.push(item))
|
|
74
|
+
return sections.filter(s => !!s.children.length)
|
|
75
|
+
}, [itemConfigs])
|
|
85
76
|
|
|
86
77
|
if (!hasFeatureButtons) return null
|
|
87
78
|
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
<IconButton
|
|
91
|
-
|
|
92
|
-
color="light"
|
|
93
|
-
appearance="square"
|
|
94
|
-
role="button"
|
|
95
|
-
title={visibleMenu ? t.collapse : t.expand}
|
|
96
|
-
data-test-hint="button-options"
|
|
97
|
-
aria-label={visibleMenu ? t.collapse : t.expand}
|
|
98
|
-
aria-controls="chatMessageMenu"
|
|
99
|
-
aria-expanded={visibleMenu}
|
|
100
|
-
onClick={() => setVisibleMenu(state => !state)}>
|
|
101
|
-
<Plus />
|
|
102
|
-
</IconButton>
|
|
103
|
-
<SelectionList
|
|
104
|
-
className="message-menu"
|
|
105
|
-
id="chatMessageMenu"
|
|
106
|
-
visible={visibleMenu}
|
|
107
|
-
onHide={() => setVisibleMenu(false)}
|
|
108
|
-
items={listItems}
|
|
109
|
-
aria-label="Menu de opções do chat"
|
|
110
|
-
/>
|
|
111
|
-
</>
|
|
79
|
+
return itemConfigs.length > 1 ? (
|
|
80
|
+
<MenuOverlay items={listItems} position="top" bgLevel={500} spaced roundedItems>
|
|
81
|
+
<IconButton icon="Plus" />
|
|
82
|
+
</MenuOverlay>
|
|
112
83
|
) : (
|
|
113
|
-
<
|
|
114
|
-
color="light"
|
|
84
|
+
<ImageButton
|
|
115
85
|
appearance="square"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{
|
|
121
|
-
</
|
|
86
|
+
title={`${itemConfigs[0].label}`}
|
|
87
|
+
aria-label={`${itemConfigs[0].label}`}
|
|
88
|
+
onClick={itemConfigs[0].onClick}
|
|
89
|
+
>
|
|
90
|
+
{itemConfigs[0].icon}
|
|
91
|
+
</ImageButton>
|
|
122
92
|
)
|
|
123
93
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
2
2
|
import { interpolate } from '@stack-spot/portal-translate'
|
|
3
|
-
import {
|
|
3
|
+
import { useMemo } from 'react'
|
|
4
4
|
import { FadingOverflow } from '../../components/FadingOverflow'
|
|
5
5
|
import { FileDescription } from '../../components/FileDescription'
|
|
6
6
|
import { useCurrentChat } from '../../context/hooks'
|
|
@@ -37,29 +37,6 @@ export const UploadBar = () => {
|
|
|
37
37
|
const t = useMessageInputDictionary()
|
|
38
38
|
const chat = useCurrentChat()
|
|
39
39
|
const visible = !!uploads.length
|
|
40
|
-
const [ariaMessage, setAriaMessage] = useState('')
|
|
41
|
-
const prevUploadsRef = useRef<FileUpload[]>([])
|
|
42
|
-
const announcedUploadsRef = useRef<Set<string>>(new Set())
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
const prevUploads = prevUploadsRef.current
|
|
46
|
-
const newUploads = uploads.filter(
|
|
47
|
-
up => !prevUploads.some(prev => prev.id === up.id),
|
|
48
|
-
)
|
|
49
|
-
newUploads.forEach((up) => {
|
|
50
|
-
if (!announcedUploadsRef.current.has(up.id)) {
|
|
51
|
-
setAriaMessage('')
|
|
52
|
-
setTimeout(() => {
|
|
53
|
-
setAriaMessage(`${t.uploadSuccessStatus}: ${up.file.name}`)
|
|
54
|
-
setTimeout(() => setAriaMessage(''), 2500)
|
|
55
|
-
}, 100)
|
|
56
|
-
announcedUploadsRef.current.add(up.id)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
if (uploads.some(up => up.status === 'error')) {
|
|
60
|
-
setTimeout(() => setAriaMessage(''), 2000)
|
|
61
|
-
}
|
|
62
|
-
}, [uploads])
|
|
63
40
|
|
|
64
41
|
useUploadErrorEffect((errors) => {
|
|
65
42
|
const sizeErrors = errors.filter(e => e instanceof FileIsTooLarge)
|
|
@@ -76,26 +53,11 @@ export const UploadBar = () => {
|
|
|
76
53
|
lines.push(`${interpolate(t.uploadItemLimitError, maxItems)}\n- ${maxItemsErrorsNames.join('\n- ')}`)
|
|
77
54
|
}
|
|
78
55
|
if (!lines.length) return
|
|
79
|
-
setAriaMessage(lines.join(' '))
|
|
80
|
-
setTimeout(() => setAriaMessage(''), 2000)
|
|
81
56
|
chat.pushMessage(new ChatEntry({ agentType: 'system', type: 'md', content: lines.join('\n\n') }))
|
|
82
|
-
|
|
83
|
-
if (lines.length) {
|
|
84
|
-
setAriaMessage(lines.join(' '))
|
|
85
|
-
setTimeout(() => setAriaMessage(''), 2000)
|
|
86
|
-
chat.pushMessage(new ChatEntry({ agentType: 'system', type: 'md', content: lines.join('\n\n') }))
|
|
87
|
-
}
|
|
88
57
|
})
|
|
89
58
|
|
|
90
|
-
|
|
91
59
|
return (
|
|
92
60
|
<div className={listToClass(['info-bar', 'upload-bar', visible && 'visible'])}>
|
|
93
|
-
<div className="aria-live"
|
|
94
|
-
aria-live="polite"
|
|
95
|
-
aria-atomic="true"
|
|
96
|
-
>
|
|
97
|
-
{ariaMessage}
|
|
98
|
-
</div>
|
|
99
61
|
<div className="space"></div>
|
|
100
62
|
<div className="content">
|
|
101
63
|
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
@@ -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>
|
|
@@ -33,7 +33,6 @@ const dictionary = {
|
|
|
33
33
|
cantSendBecauseOfEmptyContent: 'You can\'t send empty messages. Please write some text or upload a file.',
|
|
34
34
|
cantSendBecausePromptMaxLength: 'You can\'t send messages longer than $0 characters. Please, shorten your message.',
|
|
35
35
|
chatAgent: 'Agents',
|
|
36
|
-
uploadSuccessStatus: 'File sent successfully',
|
|
37
36
|
},
|
|
38
37
|
pt: {
|
|
39
38
|
stack: 'Selecionar stack',
|
|
@@ -67,7 +66,6 @@ const dictionary = {
|
|
|
67
66
|
cantSendBecauseOfEmptyContent: 'Não é possível enviar mensagens vazias. Por favor, escreva algum texto ou envie um arquivo.',
|
|
68
67
|
cantSendBecausePromptMaxLength: 'Você não pode enviar mensagens com mais de $0 caracteres. Por favor, reduza sua mensagem.',
|
|
69
68
|
chatAgent: 'Agentes',
|
|
70
|
-
uploadSuccessStatus: 'Arquivo anexado com sucesso',
|
|
71
69
|
},
|
|
72
70
|
} satisfies Dictionary
|
|
73
71
|
|
|
@@ -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'
|
|
@@ -137,11 +136,11 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
137
136
|
|
|
138
137
|
return (
|
|
139
138
|
<UploadProvider value={chat.uploadManager}>
|
|
140
|
-
<MessageInputBox aria-busy={isLoading} className="message-input"
|
|
139
|
+
<MessageInputBox aria-busy={isLoading} className="message-input">
|
|
141
140
|
<div className="wrapper-action">
|
|
142
141
|
<QuickCommandSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
143
142
|
<AgentSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
144
|
-
<div className=
|
|
143
|
+
<div className="action-box">
|
|
145
144
|
<ButtonAgent />
|
|
146
145
|
<AdaptiveTextArea
|
|
147
146
|
maxHeight={() => isMinimized
|
|
@@ -154,7 +153,7 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
154
153
|
? interpolate(t.placeholder, agentLabel)
|
|
155
154
|
: t.typing
|
|
156
155
|
}
|
|
157
|
-
onChange={
|
|
156
|
+
onChange={v => chat.set('nextMessage', v)}
|
|
158
157
|
value={value}
|
|
159
158
|
onFocus={() => setFocused(true)}
|
|
160
159
|
onBlur={() => setFocused(false)}
|
|
@@ -165,8 +164,7 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
|
|
|
165
164
|
/>
|
|
166
165
|
</div>
|
|
167
166
|
</div>
|
|
168
|
-
<ProgressBar
|
|
169
|
-
backgroundColor={isLoading || !focused ? theme.color.light[500] : theme.color.primary[500]} />
|
|
167
|
+
<ProgressBar progress={isLoading ? undefined : (focused ? 100 : 0)} />
|
|
170
168
|
<ContextBar />
|
|
171
169
|
{chat.get('features').upload && <UploadBar />}
|
|
172
170
|
<ButtonBar onSend={onSend} isLoading={isLoading} />
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IconButton } from '@citric/ui'
|
|
2
1
|
import { theme } from '@stack-spot/portal-theme'
|
|
3
2
|
import { styled } from 'styled-components'
|
|
4
3
|
|
|
@@ -51,7 +50,7 @@ export const SelectionBarWrapper = styled.div`
|
|
|
51
50
|
}
|
|
52
51
|
`
|
|
53
52
|
|
|
54
|
-
export const MessageInputBox = styled.div
|
|
53
|
+
export const MessageInputBox = styled.div`
|
|
55
54
|
display: flex;
|
|
56
55
|
flex-direction: column;
|
|
57
56
|
|
|
@@ -65,18 +64,6 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
> .aria-live {
|
|
69
|
-
position: absolute;
|
|
70
|
-
width: 1;
|
|
71
|
-
height: 1;
|
|
72
|
-
margin: -1;
|
|
73
|
-
padding: 0;
|
|
74
|
-
overflow: hidden;
|
|
75
|
-
clip: rect(0 0 0 0);
|
|
76
|
-
white-Space: nowrap;
|
|
77
|
-
border: 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
67
|
> .space {
|
|
81
68
|
height: 0;
|
|
82
69
|
transition: height 0.4s;
|
|
@@ -127,7 +114,7 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
127
114
|
line-height: 0.75rem;
|
|
128
115
|
white-space: nowrap;
|
|
129
116
|
|
|
130
|
-
${IconButton} {
|
|
117
|
+
/* $ {IconButton} {
|
|
131
118
|
padding: 4px 0;
|
|
132
119
|
background: none;
|
|
133
120
|
border: none;
|
|
@@ -138,7 +125,7 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
138
125
|
width: auto;
|
|
139
126
|
height: 12px;
|
|
140
127
|
}
|
|
141
|
-
}
|
|
128
|
+
} */
|
|
142
129
|
}
|
|
143
130
|
}
|
|
144
131
|
|
|
@@ -175,18 +162,15 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
175
162
|
background-color: ${theme.color.light[300]};
|
|
176
163
|
padding: 10px 8px;
|
|
177
164
|
transition: border-color 0.3s, background-color 0.3s;
|
|
178
|
-
|
|
179
|
-
&.focused {
|
|
180
|
-
border: 2px solid ${theme.color.light[300]};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
&.disabled {
|
|
185
|
-
background-color: ${theme.color.light[300]};
|
|
186
|
-
}
|
|
187
165
|
}
|
|
188
166
|
}
|
|
189
167
|
|
|
168
|
+
[data-citric="progress-bar"] {
|
|
169
|
+
background-color: ${theme.color.light[500]};
|
|
170
|
+
border: 0;
|
|
171
|
+
padding: 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
190
174
|
.button-group {
|
|
191
175
|
display: flex;
|
|
192
176
|
flex-direction: row;
|
|
@@ -239,10 +223,10 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
239
223
|
}
|
|
240
224
|
}
|
|
241
225
|
|
|
242
|
-
${IconButton} {
|
|
226
|
+
/* $ {IconButton} {
|
|
243
227
|
width: 24px;
|
|
244
228
|
height: 24px;
|
|
245
|
-
}
|
|
229
|
+
} */
|
|
246
230
|
|
|
247
231
|
.group-agent {
|
|
248
232
|
display: flex;
|
|
@@ -302,7 +286,7 @@ export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
|
302
286
|
transition: height 0.3s;
|
|
303
287
|
background-color: transparent;
|
|
304
288
|
&:focus {
|
|
305
|
-
box-shadow: none;
|
|
289
|
+
box-shadow: none !important;
|
|
306
290
|
}
|
|
307
291
|
}
|
|
308
292
|
`
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Text } from '@citric
|
|
2
|
-
import { ChevronDown, Times } from '@citric/icons'
|
|
3
|
-
import { IconButton } from '@citric/ui'
|
|
1
|
+
import { IconButton, Text } from '@stack-spot/citric-react'
|
|
4
2
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
5
3
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
4
|
import { useCallback, useRef, useState } from 'react'
|
|
@@ -69,14 +67,13 @@ export const MinimizedHeader = ({ onClose, onCollapse, onExpand }: MinimizedActi
|
|
|
69
67
|
<FadingOverflow className="title"><Text title={label}>{label}</Text></FadingOverflow>
|
|
70
68
|
{showButtons && <div className="button-group">
|
|
71
69
|
{(onExpand || onCollapse) && <IconButton
|
|
70
|
+
icon="ChevronDown"
|
|
72
71
|
title={collapsed ? t.expand : t.collapse}
|
|
73
72
|
aria-label={collapsed ? t.expand : t.collapse}
|
|
74
73
|
className={listToClass(['collapse', collapsed && 'collapsed'])}
|
|
75
74
|
onClick={toggleCollapsed}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
</IconButton>}
|
|
79
|
-
{onClose && <IconButton title={t.close} aria-label={t.close} onClick={onClose}><Times /></IconButton>}
|
|
75
|
+
/>}
|
|
76
|
+
{onClose && <IconButton icon="Times" title={t.close} aria-label={t.close} onClick={onClose} />}
|
|
80
77
|
</div>}
|
|
81
78
|
</Header>
|
|
82
79
|
)
|
package/src/views/Stacks.tsx
CHANGED
|
@@ -1,15 +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, 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 { ButtonFavorite } from '../components/ButtonFavorite'
|
|
7
|
+
import { useEffect, useMemo, useRef, useState } from 'react'
|
|
10
8
|
import { NavigationComponent } from '../components/ComponentNavigator'
|
|
11
9
|
import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup'
|
|
12
|
-
import { IconInput } from '../components/IconInput'
|
|
13
10
|
import { RightPanelContentList } from '../components/RightPanelContentList'
|
|
14
11
|
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
15
12
|
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator'
|
|
@@ -19,8 +16,6 @@ import { useRightPanel } from '../right-panel/hooks'
|
|
|
19
16
|
import { ChatProperties } from '../state/ChatState'
|
|
20
17
|
import { checkIsTrial } from '../utils/check-is-trial'
|
|
21
18
|
|
|
22
|
-
type TabElement = { title: string, content: ReactElement }
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* Renders the Stack selection form in the Right Panel if this is the panel that is currently opened.
|
|
26
21
|
*/
|
|
@@ -54,12 +49,12 @@ const StacksPanel = () => {
|
|
|
54
49
|
stack.current = chat.get('stack')
|
|
55
50
|
}, [chat])
|
|
56
51
|
|
|
57
|
-
const allTabsMap: Partial<Record<Scope,
|
|
58
|
-
favorite: {
|
|
59
|
-
personal: {
|
|
60
|
-
shared: {
|
|
61
|
-
workspace: {
|
|
62
|
-
account: {
|
|
52
|
+
const allTabsMap: Partial<Record<Scope, Omit<Tab, 'key'>>> = {
|
|
53
|
+
favorite: { label: t.favorites, content: <StacksTab key="favorites" visibility="favorite" stack={stack} /> },
|
|
54
|
+
personal: { label: t.personal, content: <StacksTab key="personal" visibility="personal" stack={stack} /> },
|
|
55
|
+
shared: { label: t.shared, content: <StacksTab key="shared" visibility="shared" stack={stack} /> },
|
|
56
|
+
workspace: { label: t.spots, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
|
|
57
|
+
account: { label: t.account, content: <StacksTab key="account" visibility="account" stack={stack} /> },
|
|
63
58
|
}
|
|
64
59
|
const defaultScopes: Scope[] = ['favorite', 'personal', 'shared', 'workspace', 'account']
|
|
65
60
|
|
|
@@ -70,8 +65,8 @@ const StacksPanel = () => {
|
|
|
70
65
|
: rawScopes
|
|
71
66
|
|
|
72
67
|
const tabs = scopesToRender
|
|
73
|
-
.map(scope => allTabsMap[scope])
|
|
74
|
-
.filter(Boolean) as
|
|
68
|
+
.map(scope => scope in allTabsMap ? { key: scope, ...allTabsMap[scope] } : undefined)
|
|
69
|
+
.filter(Boolean) as Tab[]
|
|
75
70
|
|
|
76
71
|
return (isGroupResourcesByScope ? (
|
|
77
72
|
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
@@ -91,11 +86,10 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
|
|
|
91
86
|
const t = useTranslate(dictionary)
|
|
92
87
|
const { close } = useRightPanel()
|
|
93
88
|
const chat = useCurrentChat()
|
|
94
|
-
const [filter, setFilter] = useState('')
|
|
95
|
-
|
|
96
89
|
const listFavorites = aiClient.aiStacks.useQuery({ visibility: 'favorite' })
|
|
97
90
|
const [addFavorite, pendingAddFav] = aiClient.addFavoriteStackAi.useMutation()
|
|
98
91
|
const [removeFavorite, pendingRemoveFav] = aiClient.removeFavoriteStackAi.useMutation()
|
|
92
|
+
const [submitEnabled, setSubmitEnabled] = useState(false)
|
|
99
93
|
|
|
100
94
|
const removeFavoriteStack = async (idOrSlug: string) => {
|
|
101
95
|
try {
|
|
@@ -146,57 +140,40 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
|
|
|
146
140
|
reject(error)
|
|
147
141
|
}
|
|
148
142
|
})
|
|
149
|
-
|
|
150
|
-
|
|
151
143
|
|
|
152
144
|
const stacks = workspaceId
|
|
153
145
|
? workspaceAiClient.getStackFromWorkspaceAi.useQuery({ workspaceId })
|
|
154
146
|
//@ts-ignore
|
|
155
147
|
: aiClient.aiStacks.useQuery({ visibility, order: 'a-to-z' })
|
|
156
148
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
[stacks
|
|
163
|
-
)
|
|
149
|
+
const initialValue = useMemo(() => {
|
|
150
|
+
const currentStackId = stack.current ? stack.current.id : chat.get('stack')?.id
|
|
151
|
+
const initial = stacks.find(s => s.id === currentStackId)
|
|
152
|
+
if (initial) setSubmitEnabled(true)
|
|
153
|
+
return initial
|
|
154
|
+
}, [stacks])
|
|
164
155
|
|
|
165
156
|
function submit() {
|
|
166
|
-
if (
|
|
157
|
+
if (stack.current) chat.set('stack', stack.current)
|
|
167
158
|
close()
|
|
168
159
|
}
|
|
169
160
|
|
|
170
|
-
const onChange = useCallback((newValue: GetAiStackResponse) => {
|
|
171
|
-
setValue(newValue)
|
|
172
|
-
stack.current = { ...newValue, label: newValue.name }
|
|
173
|
-
}, [])
|
|
174
|
-
|
|
175
161
|
return (
|
|
176
162
|
<>
|
|
177
163
|
<div className="content">
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
optionClassName={s => (s === value && filter && !s.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
190
|
-
? 'filtered-out'
|
|
191
|
-
: ''
|
|
192
|
-
}
|
|
193
|
-
className="option-list"
|
|
194
|
-
/>}
|
|
195
|
-
{!!stacks.length && !filtered.length &&
|
|
196
|
-
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder"/>}
|
|
197
|
-
{!stacks.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
164
|
+
<DescribedRadioGroup
|
|
165
|
+
options={stacks}
|
|
166
|
+
initialValue={initialValue}
|
|
167
|
+
data={s => ({ idOrSlug: s.id, description: s.use_case, name: s.name, listFavorites, onAddFavorite, onRemoveFavorite })}
|
|
168
|
+
emptyResults={<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder"/>}
|
|
169
|
+
emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
170
|
+
onChange={(s) => {
|
|
171
|
+
stack.current = s ? { ...s, label: s.name } : undefined
|
|
172
|
+
setSubmitEnabled(true)
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
198
175
|
</div>
|
|
199
|
-
{!!
|
|
176
|
+
{!!stacks.length && showSubmitButton && <Button onClick={submit} disabled={!submitEnabled}>{t.apply}</Button>}
|
|
200
177
|
</>
|
|
201
178
|
)
|
|
202
179
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Text } from '@stack-spot/citric-react'
|
|
3
3
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
4
4
|
import { StackedBadge } from '../../../components/StackedBadge'
|
|
5
5
|
import { useStepsDictionary } from '../dictionary'
|
|
@@ -24,7 +24,7 @@ export const NodeStep = ({ data: { step, index, nextStatus, onClick } }: Props)
|
|
|
24
24
|
aria-label={getTitle(t, step, index)}
|
|
25
25
|
>
|
|
26
26
|
<header>
|
|
27
|
-
<
|
|
27
|
+
<Icon {...getTypeIcon(step.type)} />
|
|
28
28
|
<Text className="step-index">{getTitle(t, step, index)}</Text>
|
|
29
29
|
{getStatusIcon(step.status)}
|
|
30
30
|
</header>
|
|
@@ -36,7 +36,9 @@ export const NodeStep = ({ data: { step, index, nextStatus, onClick } }: Props)
|
|
|
36
36
|
</Text>
|
|
37
37
|
{!!step.attempts[0].tools?.length && <StackedBadge
|
|
38
38
|
label={t.tools}
|
|
39
|
-
images={step.attempts[0].tools?.slice(0, 3).map(
|
|
39
|
+
images={step.attempts[0].tools?.slice(0, 3).map(
|
|
40
|
+
tool => ({ key: tool.id, name: tool.name, url: tool.image, icon: <Icon icon="Cog" /> }),
|
|
41
|
+
)}
|
|
40
42
|
/>}
|
|
41
43
|
</div>}
|
|
42
44
|
<HandleGroup renderSource={step.type !== 'answer'} renderTarget={step.type !== 'planning'} />
|