@stack-spot/ai-chat-widget 1.37.0-beta.1 → 2.0.0-betacitric.2
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 -71
- package/dist/StackspotAIWidget.d.ts +6 -2
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -8
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +13 -17
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +3 -9
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +1 -1
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +1 -1
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.js +4 -5
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
- package/dist/components/AgentCard/index.d.ts.map +1 -1
- package/dist/components/AgentCard/index.js +5 -6
- package/dist/components/AgentCard/index.js.map +1 -1
- package/dist/components/ButtonFavorite.d.ts +8 -7
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +5 -14
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +11 -9
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts.map +1 -1
- package/dist/components/ComponentNavigator.js +2 -4
- package/dist/components/ComponentNavigator.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +3 -4
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts +0 -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 +8 -31
- 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 +1 -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/state/constants.js +2 -2
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +7 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +1 -2
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +1 -12
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/upload/FileUpload.d.ts.map +1 -1
- package/dist/utils/upload/FileUpload.js +2 -1
- 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 +5 -6
- 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 +6 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +12 -7
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +6 -12
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.js +2 -3
- package/dist/views/Home/BuiltInAgent.js.map +1 -1
- package/dist/views/Home/CustomAgent.js +3 -3
- package/dist/views/Home/CustomAgent.js.map +1 -1
- package/dist/views/Home/index.js +2 -2
- package/dist/views/Home/index.js.map +1 -1
- package/dist/views/Home/styled.d.ts.map +1 -1
- package/dist/views/Home/styled.js +21 -22
- package/dist/views/Home/styled.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +3 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +14 -36
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +7 -5
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +4 -5
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonBar.js +2 -4
- package/dist/views/MessageInput/ButtonBar.js.map +1 -1
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ContextBar.js +3 -6
- package/dist/views/MessageInput/ContextBar.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
- package/dist/views/MessageInput/SelectContent.js +30 -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 -4
- 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 +2 -4
- 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 +12 -13
- package/src/StackspotAIWidget.tsx +36 -34
- package/src/app-metadata.json +13 -17
- package/src/chat-interceptors/quick-commands.ts +5 -11
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
- package/src/components/AgentCard/index.tsx +7 -7
- package/src/components/ButtonFavorite.tsx +20 -47
- package/src/components/Code.tsx +31 -36
- package/src/components/ComponentNavigator.tsx +4 -8
- package/src/components/FadingOverflow.tsx +6 -7
- package/src/components/FileDescription.tsx +14 -11
- 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 +28 -54
- 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 +1 -2
- package/src/layout.css +1 -27
- package/src/right-panel/DefaultPanel.tsx +3 -7
- package/src/state/ChatEntry.ts +3 -4
- package/src/state/constants.ts +2 -2
- package/src/types.ts +8 -3
- package/src/utils/tools.ts +2 -23
- package/src/utils/upload/FileUpload.ts +2 -1
- package/src/views/Agents/AgentDescription.tsx +6 -7
- 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 +17 -9
- package/src/views/Editor.tsx +9 -14
- package/src/views/Home/BuiltInAgent.tsx +7 -8
- package/src/views/Home/CustomAgent.tsx +3 -3
- package/src/views/Home/index.tsx +2 -2
- package/src/views/Home/styled.ts +21 -22
- package/src/views/KSDocument.tsx +7 -8
- package/src/views/KnowledgeSources.tsx +24 -66
- package/src/views/MessageInput/AgentSelector.tsx +10 -8
- package/src/views/MessageInput/ButtonAgent.tsx +24 -12
- package/src/views/MessageInput/ButtonBar.tsx +25 -21
- package/src/views/MessageInput/ContextBar.tsx +17 -14
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +39 -68
- package/src/views/MessageInput/UploadBar.tsx +2 -40
- package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
- package/src/views/MessageInput/dictionary.ts +0 -4
- 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 +12 -19
- 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,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Badge, IconButton, Tooltip } from '@citric/ui'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Badge, Button, CheckboxGroup, Column, IconButton, Input, RadioGroup, Row, Text, Tooltip } from '@stack-spot/citric-react'
|
|
4
3
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
5
|
-
import { listToClass } from '@stack-spot/portal-theme'
|
|
4
|
+
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
6
5
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
6
|
import { groupBy } from 'lodash'
|
|
8
7
|
import { createElement, Dispatch, useCallback, useMemo, useRef, useState } from 'react'
|
|
@@ -58,49 +57,47 @@ interface RenderInputsEntryProps {
|
|
|
58
57
|
|
|
59
58
|
const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }: RenderInputsEntryProps) => {
|
|
60
59
|
const chat = useCurrentChat()
|
|
60
|
+
const [radioValue, setRadioValue] = useState<Required<TextChatEntry>['options'][number] | undefined>()
|
|
61
|
+
const [checkboxValue, setCheckboxValue] = useState<Required<TextChatEntry>['options']>([])
|
|
61
62
|
|
|
62
63
|
const renderInputs = () => {
|
|
63
64
|
if (entry.type === 'input-text') {
|
|
64
|
-
return <Input
|
|
65
|
+
return <Input
|
|
66
|
+
name={entry.name}
|
|
65
67
|
value={value[0] ?? ''}
|
|
66
|
-
|
|
68
|
+
style={{ maxWidth: '500px' }}
|
|
67
69
|
autoFocus
|
|
68
|
-
{...entry.validations}
|
|
70
|
+
{...entry.validations}
|
|
71
|
+
onChange={v => setValue([v])}
|
|
72
|
+
required={entry.required}
|
|
73
|
+
/>
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
if (entry.type === 'input-radio') {
|
|
72
|
-
return <
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
required={true} sx={{ height: '30px' }} />
|
|
90
|
-
</Box>
|
|
91
|
-
}
|
|
92
|
-
</Flex>
|
|
93
|
-
</Box>
|
|
94
|
-
))}
|
|
95
|
-
</Flex>
|
|
77
|
+
return <RadioGroup
|
|
78
|
+
value={radioValue}
|
|
79
|
+
onChange={(v) => {
|
|
80
|
+
setRadioValue(v)
|
|
81
|
+
setValue([v.label])
|
|
82
|
+
v.value && setLabels([v.value])
|
|
83
|
+
}}
|
|
84
|
+
options={entry.options ?? []}
|
|
85
|
+
renderKey={o => `${o.value}_${o.label}`}
|
|
86
|
+
renderLabel={o => (
|
|
87
|
+
<Row gap={3} w="50%">
|
|
88
|
+
<Text>{o.label}</Text>
|
|
89
|
+
{o.hasInput && o.value && labels.findIndex((label) => label === o.value) !== -1 &&
|
|
90
|
+
<Input name={entry.name} onChange={v => setValue([v])} required style={{ height: '30px', width: '33%' }} />}
|
|
91
|
+
</Row>
|
|
92
|
+
)}
|
|
93
|
+
/>
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
if (entry.type === 'button-list') {
|
|
99
|
-
return <
|
|
97
|
+
return <Row className="button-group" gap="8px">
|
|
100
98
|
{entry.options?.map((item) => <Button
|
|
101
99
|
key={item.label}
|
|
102
100
|
colorScheme={item.color}
|
|
103
|
-
style={{ margin: 0 }}
|
|
104
101
|
onClick={() => {
|
|
105
102
|
item.value && chat.pushMessage(
|
|
106
103
|
ChatEntry.createUserEntry(item.value, false, entry.name, item?.label ? [item?.label] : undefined),
|
|
@@ -108,46 +105,46 @@ const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }
|
|
|
108
105
|
}}
|
|
109
106
|
>
|
|
110
107
|
{item.label}
|
|
111
|
-
</Button>)
|
|
112
|
-
|
|
108
|
+
</Button>)}
|
|
109
|
+
</Row>
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
if (entry.type === 'input-checkbox') {
|
|
116
|
-
return <
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
return <CheckboxGroup
|
|
114
|
+
value={checkboxValue}
|
|
115
|
+
onChange={(v) => {
|
|
116
|
+
setCheckboxValue(v)
|
|
117
|
+
setValue(v.map(i => i.label))
|
|
118
|
+
setLabels(v.map(i => i.value).filter(i => !!i) as string[])
|
|
119
|
+
}}
|
|
120
|
+
options={entry.options ?? []}
|
|
121
|
+
renderKey={o => `${o.value}_${o.label}`}
|
|
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>
|
|
125
144
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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>
|
|
145
|
+
</Row>
|
|
146
|
+
)}
|
|
147
|
+
/>
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
if (entry.type === 'input-phone') {
|
|
@@ -162,17 +159,17 @@ const RenderInputsEntry = ({ isLast, entry, value, setValue, labels, setLabels }
|
|
|
162
159
|
return <p className="plain-text">{entry.content}</p>
|
|
163
160
|
}
|
|
164
161
|
|
|
165
|
-
return <
|
|
166
|
-
<Text appearance="body2"
|
|
162
|
+
return <Column gap={4}>
|
|
163
|
+
<Text appearance="body2">{entry.content}</Text>
|
|
167
164
|
{isLast && renderInputs()}
|
|
168
|
-
</
|
|
165
|
+
</Column>
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
const UserInfo = ({ entry }: { entry: TextChatEntry }) => {
|
|
172
169
|
switch (entry.agentType) {
|
|
173
170
|
case 'user': return
|
|
174
171
|
case 'bot': return <AgentInfo agent={entry.agent} />
|
|
175
|
-
case 'system': return <AgentInfo agent={{ id: 'system', label: 'System' }} icon={<Cog />} />
|
|
172
|
+
case 'system': return <AgentInfo agent={{ id: 'system', label: 'System' }} icon={<Icon icon="Cog" />} />
|
|
176
173
|
}
|
|
177
174
|
}
|
|
178
175
|
|
|
@@ -301,9 +298,9 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
301
298
|
|
|
302
299
|
return <form>
|
|
303
300
|
<RenderInputsEntry entry={entry} isLast={isLast} value={value} setValue={setValue} setLabels={setLabels} labels={labels} />
|
|
304
|
-
<
|
|
301
|
+
<div style={{ marginTop: theme.spacing[4] }}>
|
|
305
302
|
{renderActions()}
|
|
306
|
-
</
|
|
303
|
+
</div>
|
|
307
304
|
</form>
|
|
308
305
|
}
|
|
309
306
|
|
|
@@ -324,7 +321,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
324
321
|
{(entry.content || entry.steps || entry.upload?.length) && (
|
|
325
322
|
<div className={listToClass(['message-content', entry.card && 'card', entry.type])}>
|
|
326
323
|
{!!entry.badges?.length && <div className="badges">
|
|
327
|
-
{entry.badges.map((b, index) => <Badge key={index}
|
|
324
|
+
{entry.badges.map((b, index) => <Badge key={index} colorPalette={b.color ?? 'cyan'} appearance="square">{b.label}</Badge>)}
|
|
328
325
|
</div>}
|
|
329
326
|
{renderContent()}
|
|
330
327
|
|
|
@@ -334,7 +331,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
334
331
|
|
|
335
332
|
{entry.error && (
|
|
336
333
|
<div className="error">
|
|
337
|
-
<
|
|
334
|
+
<Icon icon="TimesCircle" size="xs" />
|
|
338
335
|
<Text appearance="microtext1">{entry.error}</Text>
|
|
339
336
|
</div>
|
|
340
337
|
)}
|
|
@@ -349,12 +346,13 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
349
346
|
label={t.tools}
|
|
350
347
|
images={entry.tools.slice(0, 3).map((id) => {
|
|
351
348
|
const tool = toolById(id, toolKits)
|
|
352
|
-
return { key: id, name: tool?.name || id, icon: <Cog />, url: tool?.image }
|
|
349
|
+
return { key: id, name: tool?.name || id, icon: <Icon icon="Cog" />, url: tool?.image }
|
|
353
350
|
})}
|
|
354
351
|
onClick={openToolsPanel}
|
|
352
|
+
style={{ marginTop: '12px', width: 'fit-content' }}
|
|
355
353
|
/>}
|
|
356
354
|
{!!entry.knowledgeSources?.length && <div className="ks-box">
|
|
357
|
-
<Text appearance="microtext1"
|
|
355
|
+
<Text appearance="microtext1" color="light.700">Knowledge Sources:</Text>
|
|
358
356
|
<ul>{entry.knowledgeSources.map((ks, index) => (
|
|
359
357
|
<li key={index}>
|
|
360
358
|
<Button size="sm" colorScheme="light" onClick={() => detailKS(ks)}>{ks.name}</Button>
|
|
@@ -365,38 +363,35 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
365
363
|
{shouldShowFooter && <div className="message-footer">
|
|
366
364
|
{entry.agentType === 'bot' && !entry.error && <div className="message-actions">
|
|
367
365
|
{entry.type === 'md' && (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
<Check />
|
|
378
|
-
</IconButton>
|
|
379
|
-
</Tooltip>
|
|
380
|
-
) : (
|
|
381
|
-
<IconButton
|
|
382
|
-
appearance="square"
|
|
383
|
-
color="light"
|
|
384
|
-
title={t.copy}
|
|
385
|
-
aria-label={t.copy}
|
|
386
|
-
onClick={handleCopy}
|
|
387
|
-
>
|
|
388
|
-
<Copy />
|
|
389
|
-
</IconButton>
|
|
390
|
-
)
|
|
366
|
+
<IconButton
|
|
367
|
+
icon="Copy"
|
|
368
|
+
className="copy-btn"
|
|
369
|
+
appearance="square"
|
|
370
|
+
title={t.copy}
|
|
371
|
+
aria-label={t.copy}
|
|
372
|
+
feedback={t.copied}
|
|
373
|
+
onClick={handleCopy}
|
|
374
|
+
/>
|
|
391
375
|
)}
|
|
392
376
|
{entry.messageId && (
|
|
393
377
|
<>
|
|
394
|
-
<IconButton
|
|
395
|
-
{liked === true ?
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
{
|
|
399
|
-
|
|
378
|
+
<IconButton
|
|
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
|
+
/>
|
|
386
|
+
<IconButton
|
|
387
|
+
group={liked === false ? 'fill' : 'outline'}
|
|
388
|
+
icon="Dislike"
|
|
389
|
+
appearance="square"
|
|
390
|
+
color="light"
|
|
391
|
+
title={t.dislike}
|
|
392
|
+
aria-label={t.dislike}
|
|
393
|
+
onClick={dislike}
|
|
394
|
+
/>
|
|
400
395
|
</>
|
|
401
396
|
)}
|
|
402
397
|
</div>}
|
|
@@ -404,37 +399,33 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
404
399
|
{entry.agentType === 'user' && (
|
|
405
400
|
<div className="message-actions">
|
|
406
401
|
{copied ? (
|
|
407
|
-
<Tooltip
|
|
402
|
+
<Tooltip content={t.copied} position={'left'}>
|
|
408
403
|
<IconButton
|
|
404
|
+
icon="Check"
|
|
409
405
|
appearance="square"
|
|
410
|
-
colorBg="light"
|
|
411
406
|
title={t.copied}
|
|
412
407
|
aria-label={t.copied}
|
|
413
408
|
size="sm"
|
|
414
|
-
|
|
415
|
-
<Check />
|
|
416
|
-
</IconButton>
|
|
409
|
+
/>
|
|
417
410
|
</Tooltip>
|
|
418
411
|
) : (
|
|
419
412
|
showUserButtonCopy && (
|
|
420
413
|
<div className="action-bar">
|
|
421
414
|
<IconButton
|
|
415
|
+
icon="Copy"
|
|
422
416
|
appearance="square"
|
|
423
|
-
color="light"
|
|
424
417
|
title={t.copy}
|
|
425
418
|
aria-label={t.copy}
|
|
426
419
|
onClick={handleCopy}
|
|
427
420
|
size="sm"
|
|
428
|
-
|
|
429
|
-
<Copy className="copy-btn"/>
|
|
430
|
-
</IconButton>
|
|
421
|
+
/>
|
|
431
422
|
</div>
|
|
432
423
|
)
|
|
433
424
|
)}
|
|
434
425
|
</div>
|
|
435
426
|
)}
|
|
436
427
|
|
|
437
|
-
<Text
|
|
428
|
+
<Text appearance="microtext1" className="chat-date">
|
|
438
429
|
{dateFormatter.formatForChatMessage(date)}
|
|
439
430
|
</Text>
|
|
440
431
|
</div>}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { LoadingCircular } from '@citric/ui'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Button, ProgressCircular, Text } from '@stack-spot/citric-react'
|
|
4
3
|
import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
|
|
5
4
|
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'
|
|
11
10
|
|
|
12
11
|
interface Props {
|
|
13
12
|
steps: ChatStep[],
|
|
@@ -23,12 +22,12 @@ interface StepProps {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
function getStatusIcon(status: ChatStep['status']) {
|
|
26
|
-
const
|
|
25
|
+
const iconProps = { style: { color: theme.color.light[700] }, size: 'xs' } as const
|
|
27
26
|
switch (status) {
|
|
28
|
-
case 'error': return <
|
|
29
|
-
case 'success': return <
|
|
30
|
-
case 'pending': return <
|
|
31
|
-
case 'running': return <
|
|
27
|
+
case 'error': return <Icon group="fill" icon="TimesCircle" {...iconProps} />
|
|
28
|
+
case 'success': return <Icon group="fill" icon="CheckCircle" {...iconProps} />
|
|
29
|
+
case 'pending': return <Icon icon="Spaces" {...iconProps} />
|
|
30
|
+
case 'running': return <ProgressCircular className="loading" colorScheme="inverse" size="xs" />
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -37,7 +36,7 @@ const Step = ({ step, index, total, onClick }: StepProps) => {
|
|
|
37
36
|
return (
|
|
38
37
|
<li tabIndex={onClick ? 0 : undefined} onClick={onClick} role={onClick ? 'button' : 'listitem'}>
|
|
39
38
|
<div className="step-status-icon">{getStatusIcon(step.status)}</div>
|
|
40
|
-
<Text className="step-title" appearance="microtext1"
|
|
39
|
+
<Text className="step-title" appearance="microtext1" color="light.700">
|
|
41
40
|
{t.step} {index}/{total}: {step.input}
|
|
42
41
|
</Text>
|
|
43
42
|
</li>
|
|
@@ -74,7 +73,7 @@ export const StepsList = ({ steps, chatId, messageId }: Props) => {
|
|
|
74
73
|
{isExpanded && <div className="step-actions">
|
|
75
74
|
<Button colorScheme="light" size="sm" onClick={() => setExpanded(false)}>{t.hideSteps}</Button>
|
|
76
75
|
<Button colorScheme="light" size="sm" className="icon-button details" onClick={openToolsPanel}>
|
|
77
|
-
<
|
|
76
|
+
<Icon group="fill" icon="Play" size="xs" />
|
|
78
77
|
{t.detailed}
|
|
79
78
|
</Button>
|
|
80
79
|
</div>}
|
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
|
-
svg {
|
|
28
|
+
/* svg {
|
|
29
29
|
fill: ${theme.color.danger.contrastText};
|
|
30
|
-
}
|
|
30
|
+
} */
|
|
31
31
|
|
|
32
32
|
small {
|
|
33
33
|
margin-top: 1px;
|
|
@@ -78,6 +78,12 @@ 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
|
+
}
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
> li {
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { IconButton, LoadingCircular } from '@citric/ui'
|
|
4
|
-
import { focusNextIgnoringChildren } from '@stack-spot/portal-components'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { IconButton, Input, MenuItem, MenuOverlay, ProgressCircular } from '@stack-spot/citric-react'
|
|
5
3
|
import { agentToolsClient, aiClient } from '@stack-spot/portal-network'
|
|
6
4
|
import { ConversationResponse } from '@stack-spot/portal-network/api/ai'
|
|
7
5
|
import { theme } from '@stack-spot/portal-theme'
|
|
8
6
|
import { last } from 'lodash'
|
|
9
7
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
10
|
-
import { OverlayMenu } from '../../components/OverlayMenu'
|
|
11
8
|
import { useWidget } from '../../context/hooks'
|
|
12
9
|
import { ChatEntry } from '../../state/ChatEntry'
|
|
13
10
|
import { ChatState } from '../../state/ChatState'
|
|
14
11
|
import { LabeledAgent } from '../../state/types'
|
|
15
|
-
import { ButtonAction } from '../../types'
|
|
16
12
|
import { download } from '../../utils/download'
|
|
17
13
|
import { genericSourcesToKnowledgeSources } from '../../utils/knowledge-source'
|
|
18
14
|
import { useHistoryDictionary } from './dictionary'
|
|
@@ -31,7 +27,6 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
31
27
|
const [isDeleted, setDeleted] = useState(false)
|
|
32
28
|
const renameInput = useRef<HTMLInputElement>(null)
|
|
33
29
|
const widget = useWidget()
|
|
34
|
-
const overlayRef = useRef<HTMLDivElement>(null)
|
|
35
30
|
|
|
36
31
|
useEffect(() => {
|
|
37
32
|
if (isRenaming) renameInput.current?.focus()
|
|
@@ -58,7 +53,6 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
58
53
|
}
|
|
59
54
|
|
|
60
55
|
const onDownload = useCallback(async () => {
|
|
61
|
-
setTimeout(() => focusNextIgnoringChildren(overlayRef.current), 10)
|
|
62
56
|
setLoading(true)
|
|
63
57
|
try {
|
|
64
58
|
const content = await aiClient.downloadChat.mutate({ conversationId: item.id })
|
|
@@ -72,7 +66,6 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
72
66
|
|
|
73
67
|
const onDelete = useCallback(async () => {
|
|
74
68
|
setDeleted(true)
|
|
75
|
-
setTimeout(() => overlayRef.current?.focus(), 10)
|
|
76
69
|
try {
|
|
77
70
|
await aiClient.deleteChat.mutate({ conversationId: item.id })
|
|
78
71
|
aiClient.chats.invalidate()
|
|
@@ -123,10 +116,10 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
123
116
|
setLoading(false)
|
|
124
117
|
}, [])
|
|
125
118
|
|
|
126
|
-
const actions:
|
|
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] },
|
|
119
|
+
const actions: MenuItem[] = [
|
|
120
|
+
{ label: t.rename, onClick: onRename, icon: <Icon icon="Pencil" /> },
|
|
121
|
+
{ label: t.download, onClick: onDownload, icon: <Icon icon="Download" /> },
|
|
122
|
+
{ label: t.delete, onClick: onDelete, icon: <Icon icon="Trash" />, style: { color: theme.color.danger[500] } },
|
|
130
123
|
]
|
|
131
124
|
|
|
132
125
|
return isDeleted ? null : (
|
|
@@ -136,22 +129,22 @@ export const HistoryItem = ({ item }: { item: ConversationResponse }) => {
|
|
|
136
129
|
<Input
|
|
137
130
|
ref={renameInput}
|
|
138
131
|
value={renamed}
|
|
139
|
-
onChange={
|
|
132
|
+
onChange={setRenamed}
|
|
133
|
+
style={{ flex: 1 }}
|
|
140
134
|
onKeyDown={(e) => {
|
|
141
135
|
if (['Enter', 'Escape'].includes(e.key)) {
|
|
142
136
|
e.key === 'Enter' ? onSubmitRename() : setRenaming(false)
|
|
143
|
-
setTimeout(() => overlayRef.current?.focus(), 10)
|
|
144
137
|
}
|
|
145
138
|
}}
|
|
146
139
|
/>
|
|
147
|
-
<IconButton onClick={onSubmitRename}
|
|
140
|
+
<IconButton icon="Check" onClick={onSubmitRename} />
|
|
148
141
|
</>
|
|
149
142
|
) : (
|
|
150
143
|
<>
|
|
151
144
|
<button className="label" onClick={onSelect} disabled={isLoading}>{title}</button>
|
|
152
|
-
{isLoading ? <
|
|
153
|
-
<
|
|
154
|
-
</
|
|
145
|
+
{isLoading ? <ProgressCircular size="xs" /> : <MenuOverlay items={actions} position="left">
|
|
146
|
+
<Icon icon="EllipsisHorizontal" size="xs" />
|
|
147
|
+
</MenuOverlay>}
|
|
155
148
|
</>
|
|
156
149
|
)}
|
|
157
150
|
</HistoryItemBox>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { FallbackBoundary } from '@stack-spot/citric-react'
|
|
1
2
|
import { useEffect } from 'react'
|
|
2
|
-
import { FallbackBoundary } from '../../components/FallbackBoundary'
|
|
3
3
|
import { useWidget, useWidgetState } from '../../context/hooks'
|
|
4
4
|
import { useRightPanel } from '../../right-panel/hooks'
|
|
5
5
|
import { ChatHistoryPanel } from './ChatHistoryPanel'
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IconBox } from '@citric/core'
|
|
2
|
-
import { IconButton } from '@citric/ui'
|
|
3
1
|
import { theme } from '@stack-spot/portal-theme'
|
|
4
2
|
import { styled } from 'styled-components'
|
|
5
3
|
|
|
@@ -42,7 +40,7 @@ export const HistoryItemBox = styled.div`
|
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
${IconBox}, ${IconButton} {
|
|
43
|
+
/* $ {IconBox}, $ {IconButton} {
|
|
46
44
|
padding: 0;
|
|
47
45
|
border: none;
|
|
48
46
|
background-color: transparent;
|
|
@@ -54,7 +52,7 @@ export const HistoryItemBox = styled.div`
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
${IconButton} svg {
|
|
55
|
+
$ {IconButton} svg {
|
|
58
56
|
width: 16px;
|
|
59
|
-
}
|
|
57
|
+
} */
|
|
60
58
|
`
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Clock, Plus } from '@citric/icons'
|
|
2
1
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
3
2
|
import { useMemo } from 'react'
|
|
4
3
|
import { TabManager } from '../components/TabManager'
|
|
@@ -7,6 +6,10 @@ import { useRightPanel } from '../right-panel/hooks'
|
|
|
7
6
|
import { ChatState } from '../state/ChatState'
|
|
8
7
|
import { ButtonAction } from '../types'
|
|
9
8
|
|
|
9
|
+
interface Props {
|
|
10
|
+
buttons?: ButtonAction[],
|
|
11
|
+
}
|
|
12
|
+
|
|
10
13
|
const TabLabel = ({ id }: { id: string }) => {
|
|
11
14
|
const label = useChatState(id, 'label')
|
|
12
15
|
return <div title={label}>{label}</div>
|
|
@@ -15,7 +18,7 @@ const TabLabel = ({ id }: { id: string }) => {
|
|
|
15
18
|
/**
|
|
16
19
|
* This renders the top-most part of the layout, which includes the chat selection through tabs.
|
|
17
20
|
*/
|
|
18
|
-
export const ChatTabSelection = () => {
|
|
21
|
+
export const ChatTabSelection = ({ buttons: extraButtons = [] }: Props) => {
|
|
19
22
|
const t = useTranslate(dictionary)
|
|
20
23
|
const widget = useWidget()
|
|
21
24
|
const { chatHistory } = useWidgetState('features') ?? {}
|
|
@@ -39,18 +42,23 @@ export const ChatTabSelection = () => {
|
|
|
39
42
|
|
|
40
43
|
const buttons = useMemo<ButtonAction[]>(
|
|
41
44
|
() => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (extraButtons.length) extraButtons[0].style = { ...extraButtons[0].style, marginLeft: 'auto' }
|
|
46
|
+
const actions: ButtonAction[] = [
|
|
47
|
+
{
|
|
48
|
+
icon: 'Plus',
|
|
49
|
+
ariaLabel: t.newChat,
|
|
50
|
+
onClick: create,
|
|
51
|
+
appearance: 'text',
|
|
52
|
+
},
|
|
53
|
+
...extraButtons,
|
|
54
|
+
]
|
|
47
55
|
if (chatHistory) {
|
|
48
56
|
actions.push({
|
|
49
|
-
icon:
|
|
57
|
+
icon: 'Clock',
|
|
50
58
|
label: t.history,
|
|
51
59
|
ariaLabel: t.openHistory,
|
|
52
60
|
className: 'test',
|
|
53
|
-
style: { marginLeft: 'auto' },
|
|
61
|
+
style: extraButtons.length ? undefined : { marginLeft: 'auto' },
|
|
54
62
|
onClick: () => widget.set('panel', 'history'),
|
|
55
63
|
})
|
|
56
64
|
}
|
package/src/views/Editor.tsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Text } from '@citric/core'
|
|
2
|
-
import { LoadingCircular } from '@citric/ui'
|
|
3
1
|
import MonacoEditor, { OnMount } from '@monaco-editor/react'
|
|
2
|
+
import { ProgressCircular, Select, Text } from '@stack-spot/citric-react'
|
|
4
3
|
import { delay } from '@stack-spot/portal-components'
|
|
5
|
-
import { Select } from '@stack-spot/portal-components/Select'
|
|
6
4
|
import { useThemeKind } from '@stack-spot/portal-theme'
|
|
7
5
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
8
6
|
import { debounce } from 'lodash'
|
|
@@ -29,17 +27,13 @@ const TitleBox = styled.div`
|
|
|
29
27
|
position: relative;
|
|
30
28
|
|
|
31
29
|
.language-selector {
|
|
32
|
-
|
|
30
|
+
height: 28px;
|
|
33
31
|
position: absolute;
|
|
34
32
|
top: -4px;
|
|
35
33
|
right: 0;
|
|
36
34
|
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.current-value {
|
|
42
|
-
padding: 2px 8px;
|
|
35
|
+
.search-bar {
|
|
36
|
+
display: none;
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
`
|
|
@@ -78,11 +72,12 @@ const Title = () => {
|
|
|
78
72
|
<Text appearance="h5">Editor</Text>
|
|
79
73
|
<Select
|
|
80
74
|
options={languages}
|
|
81
|
-
renderLabel={l => l
|
|
82
|
-
|
|
75
|
+
renderLabel={l => l?.label ?? defaultLanguage}
|
|
76
|
+
renderKey={l => l?.value}
|
|
83
77
|
value={language}
|
|
84
|
-
onChange={l => chat.set('codeLanguage', l
|
|
78
|
+
onChange={l => chat.set('codeLanguage', l?.value ?? defaultLanguage)}
|
|
85
79
|
className="language-selector"
|
|
80
|
+
searchable
|
|
86
81
|
/>
|
|
87
82
|
</TitleBox>
|
|
88
83
|
)
|
|
@@ -125,7 +120,7 @@ const EditorPanel = () => {
|
|
|
125
120
|
options={{ minimap: { enabled: false } }}
|
|
126
121
|
value={value}
|
|
127
122
|
onChange={v => chat.set('code', v)}
|
|
128
|
-
loading={<
|
|
123
|
+
loading={<ProgressCircular />}
|
|
129
124
|
onMount={setup}
|
|
130
125
|
/>
|
|
131
126
|
</EditorBox>
|