@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Text } from '@citric/core'
|
|
2
|
+
import { Badge, Skeleton } from '@citric/ui'
|
|
2
3
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
3
4
|
import { useMemo } from 'react'
|
|
4
5
|
import { ToolBadge } from '../../components/ToolBadge'
|
|
@@ -10,18 +11,18 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
10
11
|
const t = useAgentsDictionary()
|
|
11
12
|
const [agent, , , { isLoading }] = agentToolsClient.agent.useStatefulQuery({ agentId: agentId! }, { enabled: !!agentId })
|
|
12
13
|
const [toolKits, , , { isLoading: isLoadingToolKit }] = agentToolsClient.tools.useStatefulQuery({})
|
|
13
|
-
const numberOfKnowledgeSources = agent?.
|
|
14
|
+
const numberOfKnowledgeSources = agent?.knowledge_sources_config?.knowledge_sources.length ?? 0
|
|
14
15
|
|
|
15
16
|
const knowledgeSources = useMemo(
|
|
16
|
-
() => agent?.
|
|
17
|
-
<li key={index}><Badge
|
|
17
|
+
() => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
|
|
18
|
+
<li key={index}><Badge palette="teal" appearance="square">{ks.name}</Badge></li>
|
|
18
19
|
)),
|
|
19
20
|
[agent],
|
|
20
21
|
)
|
|
21
22
|
const skeleton = useMemo(() => {
|
|
22
23
|
const loadingKS: React.ReactElement[] = []
|
|
23
24
|
for (let i = 0; i < numberOfKnowledgeSources; i++) {
|
|
24
|
-
loadingKS.push(<li key={i}><Badge
|
|
25
|
+
loadingKS.push(<li key={i}><Badge palette="teal" appearance="square"><Skeleton className="ks-skeleton" /></Badge></li>)
|
|
25
26
|
}
|
|
26
27
|
return loadingKS
|
|
27
28
|
}, [numberOfKnowledgeSources])
|
|
@@ -69,7 +70,7 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
69
70
|
</section>}
|
|
70
71
|
{agent?.model_name && <section>
|
|
71
72
|
<Text appearance="microtext1" className="title">LLM</Text>
|
|
72
|
-
<Badge
|
|
73
|
+
<Badge palette="orange" appearance="square">{agent?.model_name}</Badge>
|
|
73
74
|
</section>}
|
|
74
75
|
</AgentDescriptionBox>
|
|
75
76
|
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Tab } from '@stack-spot/citric-react'
|
|
2
1
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
3
|
-
import { useEffect, useRef } from 'react'
|
|
2
|
+
import { ReactElement, useEffect, useRef } from 'react'
|
|
4
3
|
import { RightPanelContentList } from '../../components/RightPanelContentList'
|
|
5
4
|
import { RightPanelTabs } from '../../components/RightPanelTabs'
|
|
6
5
|
import { useCurrentChat, useWidgetState } from '../../context/hooks'
|
|
@@ -9,6 +8,8 @@ import { checkIsTrial } from '../../utils/check-is-trial'
|
|
|
9
8
|
import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
|
|
10
9
|
import { useAgentsDictionary } from './dictionary'
|
|
11
10
|
|
|
11
|
+
type TabElement = { title: string, content: ReactElement }
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
|
|
14
15
|
*/
|
|
@@ -28,13 +29,13 @@ export const AgentsPanel = () => {
|
|
|
28
29
|
}
|
|
29
30
|
}, [chat])
|
|
30
31
|
|
|
31
|
-
const allTabsMap: Record<Scope,
|
|
32
|
-
favorite: {
|
|
33
|
-
builtin: {
|
|
34
|
-
personal: {
|
|
35
|
-
shared: {
|
|
36
|
-
workspace: {
|
|
37
|
-
account: {
|
|
32
|
+
const allTabsMap: Record<Scope, TabElement> = {
|
|
33
|
+
favorite: { title: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
|
|
34
|
+
builtin: { title: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
|
|
35
|
+
personal: { title: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
|
|
36
|
+
shared: { title: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
|
|
37
|
+
workspace: { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
|
|
38
|
+
account: { title: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
const defaultScopes: Scope[] = ['favorite', 'builtin', 'personal', 'shared', 'workspace', 'account']
|
|
@@ -46,8 +47,8 @@ export const AgentsPanel = () => {
|
|
|
46
47
|
: rawScopes
|
|
47
48
|
|
|
48
49
|
const tabs = scopesToRender
|
|
49
|
-
.map(scope =>
|
|
50
|
-
.filter(Boolean) as
|
|
50
|
+
.map(scope => allTabsMap[scope])
|
|
51
|
+
.filter(Boolean) as TabElement[]
|
|
51
52
|
|
|
52
53
|
return (isGroupResourcesByScope ? (
|
|
53
54
|
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Button, IconBox, Text } from '@citric/core'
|
|
2
|
+
import { Agent, Search } from '@citric/icons'
|
|
3
3
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
|
+
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
4
5
|
import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
|
|
5
6
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
6
|
-
import { useMemo, useState } from 'react'
|
|
7
|
+
import { useCallback, useMemo, useState } from 'react'
|
|
8
|
+
import { ButtonFavorite } from '../../components/ButtonFavorite'
|
|
7
9
|
import { NavigationComponent } from '../../components/ComponentNavigator'
|
|
8
10
|
import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
|
|
11
|
+
import { IconInput } from '../../components/IconInput'
|
|
9
12
|
import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
|
|
10
13
|
import { useCurrentChat } from '../../context/hooks'
|
|
11
14
|
import { useRightPanel } from '../../right-panel/hooks'
|
|
12
15
|
import { ChatProperties } from '../../state/ChatState'
|
|
13
16
|
import { AgentDescription } from './AgentDescription'
|
|
14
17
|
import { useAgentsDictionary } from './dictionary'
|
|
18
|
+
import { AgentLabel } from './styled'
|
|
15
19
|
import { useAgentFavorites } from './useAgentFavorites'
|
|
16
20
|
|
|
17
21
|
export interface AgentTabProps {
|
|
@@ -25,58 +29,73 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
25
29
|
const t = useAgentsDictionary()
|
|
26
30
|
const { close } = useRightPanel()
|
|
27
31
|
const chat = useCurrentChat()
|
|
32
|
+
const [filter, setFilter] = useState('')
|
|
28
33
|
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
29
|
-
const [submitEnabled, setSubmitEnabled] = useState(false)
|
|
30
34
|
const listFavorites = useFavorites()
|
|
31
35
|
const agentDefault = agentToolsClient.agentDefault.useQuery()
|
|
32
36
|
const agents = workspaceId
|
|
33
37
|
? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId }) as AgentResponseWithBuiltIn[]
|
|
34
38
|
: agentToolsClient.agents.useQuery({ visibility })
|
|
35
39
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
[agents],
|
|
40
|
+
const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
|
|
41
|
+
agent.current
|
|
42
|
+
? agents.find(a => a.id === agent.current?.id)
|
|
43
|
+
: chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const filtered = useMemo(
|
|
47
|
+
// Recreate the list so that the favorites list is taken into account
|
|
48
|
+
() => filter ? agents.filter(a => a === value || a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : [...agents],
|
|
49
|
+
[agents, filter, value, listFavorites],
|
|
45
50
|
)
|
|
46
51
|
|
|
47
52
|
function submit() {
|
|
48
|
-
if (
|
|
53
|
+
if (value) {
|
|
54
|
+
chat.set(
|
|
55
|
+
'agent',
|
|
56
|
+
{ id: value.id, label: value.name, image: value.avatar!, builtIn: value.visibility_level === 'built_in', slug: value.slug },
|
|
57
|
+
)
|
|
58
|
+
}
|
|
49
59
|
close()
|
|
50
60
|
}
|
|
51
61
|
|
|
62
|
+
const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
|
|
63
|
+
setValue(newValue)
|
|
64
|
+
agent.current = { ...newValue, label: newValue.name, builtIn: newValue.visibility_level === 'built_in' }
|
|
65
|
+
}, [])
|
|
66
|
+
|
|
52
67
|
return (
|
|
53
68
|
<>
|
|
54
69
|
<div className="content">
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
<IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
|
|
71
|
+
{!!filtered.length && <DescribedRadioGroup
|
|
72
|
+
options={filtered}
|
|
73
|
+
renderAfterElement={({ id }) => (
|
|
74
|
+
<ButtonFavorite favorite={{
|
|
75
|
+
idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite,
|
|
76
|
+
}} />
|
|
77
|
+
)}
|
|
78
|
+
keygen={a => a.id}
|
|
79
|
+
value={value}
|
|
80
|
+
onChange={onChange}
|
|
81
|
+
renderLabel={({ name, avatar, id }) => (
|
|
82
|
+
<AgentLabel>
|
|
83
|
+
{id ? (avatar ? <img src={avatar} /> : <IconBox size="xs"><Agent /></IconBox>) : <MiniLogo />}
|
|
84
|
+
<Text>{name}</Text>
|
|
85
|
+
</AgentLabel>
|
|
86
|
+
)}
|
|
87
|
+
renderDescription={a => <AgentDescription agentId={a.id} />}
|
|
88
|
+
optionClassName={a => (a === value && filter && !a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
89
|
+
? 'filtered-out'
|
|
90
|
+
: ''
|
|
75
91
|
}
|
|
76
|
-
|
|
77
|
-
/>
|
|
92
|
+
className="option-list"
|
|
93
|
+
/>}
|
|
94
|
+
{!!agents.length && !filtered.length &&
|
|
95
|
+
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
|
|
96
|
+
{!agents.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
78
97
|
</div>
|
|
79
|
-
{!!
|
|
98
|
+
{!!filtered.length && showSubmitButton && <Button onClick={submit} disabled={!value}>{t.apply}</Button>}
|
|
80
99
|
</>
|
|
81
100
|
)
|
|
82
101
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconBox, Text } from '@citric/core'
|
|
2
|
+
import { Agent } from '@citric/icons'
|
|
3
3
|
import { LabeledWithImage } from '../../state/types'
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
@@ -12,11 +12,10 @@ interface Props {
|
|
|
12
12
|
*/
|
|
13
13
|
export const AgentInfo = ({ agent, icon }: Props) => (
|
|
14
14
|
<>
|
|
15
|
-
|
|
16
|
-
src={agent
|
|
17
|
-
className="
|
|
18
|
-
|
|
19
|
-
/>
|
|
15
|
+
{agent?.image
|
|
16
|
+
? <img src={agent.image} className="custom-agent-image" />
|
|
17
|
+
: <IconBox className="default-image-wrapper" colorIcon="light.700">{icon ?? <Agent className="agent-image" />}</IconBox>
|
|
18
|
+
}
|
|
20
19
|
<Text appearance="body2">{agent?.label}</Text>
|
|
21
20
|
</>
|
|
22
21
|
)
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Box, Button, Checkbox, Flex, IconBox, Input, Label, Radio, Text } from '@citric/core'
|
|
2
|
+
import { Check, Cog, Copy, Dislike, DislikeFill, Like, LikeFill, TimesCircle } from '@citric/icons'
|
|
3
|
+
import { Badge, IconButton, Tooltip } from '@citric/ui'
|
|
3
4
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
4
|
-
import { listToClass
|
|
5
|
+
import { listToClass } from '@stack-spot/portal-theme'
|
|
5
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
6
7
|
import { groupBy } from 'lodash'
|
|
7
8
|
import { createElement, Dispatch, useCallback, useMemo, useRef, useState } from 'react'
|
|
@@ -57,47 +58,49 @@ interface RenderInputsEntryProps {
|
|
|
57
58
|
|
|
58
59
|
const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }: RenderInputsEntryProps) => {
|
|
59
60
|
const chat = useCurrentChat()
|
|
60
|
-
const [radioValue, setRadioValue] = useState<Required<TextChatEntry>['options'][number] | undefined>()
|
|
61
|
-
const [checkboxValue, setCheckboxValue] = useState<Required<TextChatEntry>['options']>([])
|
|
62
61
|
|
|
63
62
|
const renderInputs = () => {
|
|
64
63
|
if (entry.type === 'input-text') {
|
|
65
|
-
return <Input
|
|
66
|
-
name={entry.name}
|
|
64
|
+
return <Input name={entry.name}
|
|
67
65
|
value={value[0] ?? ''}
|
|
68
|
-
|
|
66
|
+
sx={{ maxWidth: '500px' }}
|
|
69
67
|
autoFocus
|
|
70
|
-
{...entry.validations}
|
|
71
|
-
onChange={v => setValue([v])}
|
|
72
|
-
required={entry.required}
|
|
73
|
-
/>
|
|
68
|
+
{...entry.validations} onChange={(data) => setValue([data.target.value])} required={entry.required} />
|
|
74
69
|
}
|
|
75
70
|
|
|
76
71
|
if (entry.type === 'input-radio') {
|
|
77
|
-
return <
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
return <Flex className="radio-group">
|
|
73
|
+
{entry.options?.map((option) => (<Box w={6} key={option.value} className="radio-item">
|
|
74
|
+
<Flex alignItems="center">
|
|
75
|
+
<Label htmlFor={option.value} colorScheme="light.contrastText">
|
|
76
|
+
<Radio name={entry.name} id={option.value} onChange={(data) => {
|
|
77
|
+
if (data.target.checked) {
|
|
78
|
+
setValue([option.label])
|
|
79
|
+
option.value && setLabels([option.value])
|
|
80
|
+
} else {
|
|
81
|
+
setValue([])
|
|
82
|
+
}
|
|
83
|
+
}} />
|
|
84
|
+
<Text ml={3}>{option.label}</Text>
|
|
85
|
+
</Label>
|
|
86
|
+
{option.hasInput && option.value && labels.findIndex((label) => label === option.value) !== -1 &&
|
|
87
|
+
<Box w={4} ml={2}>
|
|
88
|
+
<Input name={entry.name} onChange={(data) => setValue([data.target.value])}
|
|
89
|
+
required={true} sx={{ height: '30px' }} />
|
|
90
|
+
</Box>
|
|
91
|
+
}
|
|
92
|
+
</Flex>
|
|
93
|
+
</Box>
|
|
94
|
+
))}
|
|
95
|
+
</Flex>
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
if (entry.type === 'button-list') {
|
|
97
|
-
return <
|
|
99
|
+
return <Flex className="button-group" style={{ gap: '8px' }}>
|
|
98
100
|
{entry.options?.map((item) => <Button
|
|
99
101
|
key={item.label}
|
|
100
102
|
colorScheme={item.color}
|
|
103
|
+
style={{ margin: 0 }}
|
|
101
104
|
onClick={() => {
|
|
102
105
|
item.value && chat.pushMessage(
|
|
103
106
|
ChatEntry.createUserEntry(item.value, false, entry.name, item?.label ? [item?.label] : undefined),
|
|
@@ -105,46 +108,46 @@ const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }
|
|
|
105
108
|
}}
|
|
106
109
|
>
|
|
107
110
|
{item.label}
|
|
108
|
-
</Button>)
|
|
109
|
-
|
|
111
|
+
</Button>)
|
|
112
|
+
}</Flex>
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
if (entry.type === 'input-checkbox') {
|
|
113
|
-
return <
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
renderLabel={o => (
|
|
123
|
-
<Row gap={3}>
|
|
124
|
-
<Text>{o.label}</Text>
|
|
125
|
-
{o.hasInput && o.value && labels.findIndex((label) => label === o.value)!== -1 &&
|
|
126
|
-
<div style={{ width: '33%' }}>
|
|
127
|
-
<Input
|
|
128
|
-
name={entry.name}
|
|
129
|
-
{...entry.validations}
|
|
130
|
-
onChange={(v) => {
|
|
131
|
-
const customIndex = value.findIndex(v => !entry.options?.map(o => o.label).includes(v))
|
|
132
|
-
if (customIndex === -1) {
|
|
133
|
-
setValue([...value, v])
|
|
134
|
-
} else {
|
|
135
|
-
const newValue = [...value]
|
|
136
|
-
newValue[customIndex] = v
|
|
137
|
-
setValue(newValue)
|
|
138
|
-
}
|
|
139
|
-
}}
|
|
140
|
-
required={true}
|
|
141
|
-
style={{ height: '30px' }}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
116
|
+
return <Flex className="checkbox-group">
|
|
117
|
+
{entry.options?.map((option) => (<Flex as="label" w={6} key={option.label} alignItems="center" className="checkbox-item">
|
|
118
|
+
<Checkbox name={entry.name} key={option.label} onChange={(data) => {
|
|
119
|
+
if (data.target.checked) {
|
|
120
|
+
setValue([...value, option.label])
|
|
121
|
+
option.value && setLabels([...labels, option.value])
|
|
122
|
+
} else {
|
|
123
|
+
const newValue = value.filter(((item) => item !== option.label))
|
|
124
|
+
setValue([...newValue])
|
|
144
125
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
126
|
+
}}/>
|
|
127
|
+
<Text ml={3}>{option.label}</Text>
|
|
128
|
+
{option.hasInput && option.value && labels.findIndex((label) => label === option.value)!== -1 &&
|
|
129
|
+
<Box w={4} ml={2}>
|
|
130
|
+
<Input
|
|
131
|
+
name={entry.name}
|
|
132
|
+
{...entry.validations}
|
|
133
|
+
onChange={(data) => {
|
|
134
|
+
const customIndex = value.findIndex(v => !entry.options?.map(o => o.label).includes(v))
|
|
135
|
+
if (customIndex === -1) {
|
|
136
|
+
setValue([...value, data.target.value])
|
|
137
|
+
} else {
|
|
138
|
+
const newValue = [...value]
|
|
139
|
+
newValue[customIndex] = data.target.value
|
|
140
|
+
setValue(newValue)
|
|
141
|
+
}
|
|
142
|
+
}}
|
|
143
|
+
required={true}
|
|
144
|
+
sx={{ height: '30px' }}
|
|
145
|
+
/>
|
|
146
|
+
</Box>
|
|
147
|
+
}
|
|
148
|
+
</Flex>
|
|
149
|
+
))}
|
|
150
|
+
</Flex>
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
if (entry.type === 'input-phone') {
|
|
@@ -159,17 +162,17 @@ const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }
|
|
|
159
162
|
return <p className="plain-text">{entry.content}</p>
|
|
160
163
|
}
|
|
161
164
|
|
|
162
|
-
return <
|
|
163
|
-
<Text appearance="body2">{entry.content}</Text>
|
|
165
|
+
return <Flex flexDirection="column">
|
|
166
|
+
<Text appearance="body2" mb={4}>{entry.content}</Text>
|
|
164
167
|
{isLast && renderInputs()}
|
|
165
|
-
</
|
|
168
|
+
</Flex>
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
const UserInfo = ({ entry }: { entry: TextChatEntry }) => {
|
|
169
172
|
switch (entry.agentType) {
|
|
170
173
|
case 'user': return
|
|
171
174
|
case 'bot': return <AgentInfo agent={entry.agent} />
|
|
172
|
-
case 'system': return <AgentInfo agent={{ id: 'system', label: 'System' }} icon={<
|
|
175
|
+
case 'system': return <AgentInfo agent={{ id: 'system', label: 'System' }} icon={<Cog />} />
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
|
|
@@ -298,9 +301,9 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
298
301
|
|
|
299
302
|
return <form>
|
|
300
303
|
<RenderInputsEntry entry={entry} isLast={isLast} value={value} setValue={setValue} setLabels={setLabels} labels={labels} />
|
|
301
|
-
<
|
|
304
|
+
<Box mt="4">
|
|
302
305
|
{renderActions()}
|
|
303
|
-
</
|
|
306
|
+
</Box>
|
|
304
307
|
</form>
|
|
305
308
|
}
|
|
306
309
|
|
|
@@ -321,7 +324,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
321
324
|
{(entry.content || entry.steps || entry.upload?.length) && (
|
|
322
325
|
<div className={listToClass(['message-content', entry.card && 'card', entry.type])}>
|
|
323
326
|
{!!entry.badges?.length && <div className="badges">
|
|
324
|
-
{entry.badges.map((b, index) => <Badge key={index}
|
|
327
|
+
{entry.badges.map((b, index) => <Badge key={index} palette={b.color ?? 'cyan'} appearance="square">{b.label}</Badge>)}
|
|
325
328
|
</div>}
|
|
326
329
|
{renderContent()}
|
|
327
330
|
|
|
@@ -331,7 +334,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
331
334
|
|
|
332
335
|
{entry.error && (
|
|
333
336
|
<div className="error">
|
|
334
|
-
<
|
|
337
|
+
<IconBox size="xs"><TimesCircle /></IconBox>
|
|
335
338
|
<Text appearance="microtext1">{entry.error}</Text>
|
|
336
339
|
</div>
|
|
337
340
|
)}
|
|
@@ -346,13 +349,12 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
346
349
|
label={t.tools}
|
|
347
350
|
images={entry.tools.slice(0, 3).map((id) => {
|
|
348
351
|
const tool = toolById(id, toolKits)
|
|
349
|
-
return { key: id, name: tool?.name || id, icon: <
|
|
352
|
+
return { key: id, name: tool?.name || id, icon: <Cog />, url: tool?.image }
|
|
350
353
|
})}
|
|
351
354
|
onClick={openToolsPanel}
|
|
352
|
-
style={{ marginTop: '12px', width: 'fit-content' }}
|
|
353
355
|
/>}
|
|
354
356
|
{!!entry.knowledgeSources?.length && <div className="ks-box">
|
|
355
|
-
<Text appearance="microtext1"
|
|
357
|
+
<Text appearance="microtext1" colorScheme="light.700">Knowledge Sources:</Text>
|
|
356
358
|
<ul>{entry.knowledgeSources.map((ks, index) => (
|
|
357
359
|
<li key={index}>
|
|
358
360
|
<Button size="sm" colorScheme="light" onClick={() => detailKS(ks)}>{ks.name}</Button>
|
|
@@ -363,35 +365,38 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
363
365
|
{shouldShowFooter && <div className="message-footer">
|
|
364
366
|
{entry.agentType === 'bot' && !entry.error && <div className="message-actions">
|
|
365
367
|
{entry.type === 'md' && (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
group={liked === true ? 'fill' : 'outline'}
|
|
380
|
-
icon="Like"
|
|
381
|
-
appearance="square"
|
|
382
|
-
title={t.like}
|
|
383
|
-
aria-label={t.like}
|
|
384
|
-
onClick={like}
|
|
385
|
-
/>
|
|
368
|
+
copied ? (
|
|
369
|
+
<Tooltip text={t.copied} position={'right'}>
|
|
370
|
+
<IconButton
|
|
371
|
+
appearance="square"
|
|
372
|
+
colorBg="light"
|
|
373
|
+
title={t.copied}
|
|
374
|
+
aria-label={t.copied}
|
|
375
|
+
onClick={handleCopy}
|
|
376
|
+
>
|
|
377
|
+
<Check />
|
|
378
|
+
</IconButton>
|
|
379
|
+
</Tooltip>
|
|
380
|
+
) : (
|
|
386
381
|
<IconButton
|
|
387
|
-
group={liked === false ? 'fill' : 'outline'}
|
|
388
|
-
icon="Dislike"
|
|
389
382
|
appearance="square"
|
|
390
383
|
color="light"
|
|
391
|
-
title={t.
|
|
392
|
-
aria-label={t.
|
|
393
|
-
onClick={
|
|
394
|
-
|
|
384
|
+
title={t.copy}
|
|
385
|
+
aria-label={t.copy}
|
|
386
|
+
onClick={handleCopy}
|
|
387
|
+
>
|
|
388
|
+
<Copy />
|
|
389
|
+
</IconButton>
|
|
390
|
+
)
|
|
391
|
+
)}
|
|
392
|
+
{entry.messageId && (
|
|
393
|
+
<>
|
|
394
|
+
<IconButton appearance="square" color="light" title={t.like} aria-label={t.like} onClick={like}>
|
|
395
|
+
{liked === true ? <LikeFill /> : <Like />}
|
|
396
|
+
</IconButton>
|
|
397
|
+
<IconButton appearance="square" color="light" title={t.dislike} aria-label={t.dislike} onClick={dislike}>
|
|
398
|
+
{liked === false ? <DislikeFill /> : <Dislike />}
|
|
399
|
+
</IconButton>
|
|
395
400
|
</>
|
|
396
401
|
)}
|
|
397
402
|
</div>}
|
|
@@ -399,33 +404,37 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
399
404
|
{entry.agentType === 'user' && (
|
|
400
405
|
<div className="message-actions">
|
|
401
406
|
{copied ? (
|
|
402
|
-
<Tooltip
|
|
407
|
+
<Tooltip text={t.copied} position={'left'}>
|
|
403
408
|
<IconButton
|
|
404
|
-
icon="Check"
|
|
405
409
|
appearance="square"
|
|
410
|
+
colorBg="light"
|
|
406
411
|
title={t.copied}
|
|
407
412
|
aria-label={t.copied}
|
|
408
413
|
size="sm"
|
|
409
|
-
|
|
414
|
+
>
|
|
415
|
+
<Check />
|
|
416
|
+
</IconButton>
|
|
410
417
|
</Tooltip>
|
|
411
418
|
) : (
|
|
412
419
|
showUserButtonCopy && (
|
|
413
420
|
<div className="action-bar">
|
|
414
421
|
<IconButton
|
|
415
|
-
icon="Copy"
|
|
416
422
|
appearance="square"
|
|
423
|
+
color="light"
|
|
417
424
|
title={t.copy}
|
|
418
425
|
aria-label={t.copy}
|
|
419
426
|
onClick={handleCopy}
|
|
420
427
|
size="sm"
|
|
421
|
-
|
|
428
|
+
>
|
|
429
|
+
<Copy className="copy-btn"/>
|
|
430
|
+
</IconButton>
|
|
422
431
|
</div>
|
|
423
432
|
)
|
|
424
433
|
)}
|
|
425
434
|
</div>
|
|
426
435
|
)}
|
|
427
436
|
|
|
428
|
-
<Text appearance="microtext1" className="chat-date">
|
|
437
|
+
<Text as="label" appearance="microtext1" className="chat-date">
|
|
429
438
|
{dateFormatter.formatForChatMessage(date)}
|
|
430
439
|
</Text>
|
|
431
440
|
</div>}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Button, IconBox, Text } from '@citric/core'
|
|
2
|
+
import { CheckCircleFill, PlayFill, Spaces, TimesCircleFill } from '@citric/icons'
|
|
3
|
+
import { LoadingCircular } from '@citric/ui'
|
|
3
4
|
import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
|
|
4
5
|
import { ChatStep, StepChatStep } from '@stack-spot/portal-network'
|
|
5
|
-
import { theme } from '@stack-spot/portal-theme'
|
|
6
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
7
|
import { findLastIndex } from 'lodash'
|
|
8
8
|
import { useState } from 'react'
|
|
9
9
|
import { useWidget } from '../../context/hooks'
|
|
10
|
+
import { PropsOf } from '../../types'
|
|
10
11
|
|
|
11
12
|
interface Props {
|
|
12
13
|
steps: ChatStep[],
|
|
@@ -22,12 +23,12 @@ interface StepProps {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
function getStatusIcon(status: ChatStep['status']) {
|
|
25
|
-
const
|
|
26
|
+
const iconBoxProps: PropsOf<typeof IconBox> = { colorIcon: 'light.700', size: 'xs' }
|
|
26
27
|
switch (status) {
|
|
27
|
-
case 'error': return <
|
|
28
|
-
case 'success': return <
|
|
29
|
-
case 'pending': return <
|
|
30
|
-
case 'running': return <
|
|
28
|
+
case 'error': return <IconBox {...iconBoxProps}><TimesCircleFill /></IconBox>
|
|
29
|
+
case 'success': return <IconBox {...iconBoxProps}><CheckCircleFill /></IconBox>
|
|
30
|
+
case 'pending': return <IconBox {...iconBoxProps}><Spaces /></IconBox>
|
|
31
|
+
case 'running': return <LoadingCircular className="loading" colorScheme="inverse" size="xs" />
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -36,7 +37,7 @@ const Step = ({ step, index, total, onClick }: StepProps) => {
|
|
|
36
37
|
return (
|
|
37
38
|
<li tabIndex={onClick ? 0 : undefined} onClick={onClick} role={onClick ? 'button' : 'listitem'}>
|
|
38
39
|
<div className="step-status-icon">{getStatusIcon(step.status)}</div>
|
|
39
|
-
<Text className="step-title" appearance="microtext1"
|
|
40
|
+
<Text className="step-title" appearance="microtext1" colorScheme="light.700">
|
|
40
41
|
{t.step} {index}/{total}: {step.input}
|
|
41
42
|
</Text>
|
|
42
43
|
</li>
|
|
@@ -73,7 +74,7 @@ export const StepsList = ({ steps, chatId, messageId }: Props) => {
|
|
|
73
74
|
{isExpanded && <div className="step-actions">
|
|
74
75
|
<Button colorScheme="light" size="sm" onClick={() => setExpanded(false)}>{t.hideSteps}</Button>
|
|
75
76
|
<Button colorScheme="light" size="sm" className="icon-button details" onClick={openToolsPanel}>
|
|
76
|
-
<
|
|
77
|
+
<IconBox size="xs"><PlayFill /></IconBox>
|
|
77
78
|
{t.detailed}
|
|
78
79
|
</Button>
|
|
79
80
|
</div>}
|