@stack-spot/ai-chat-widget 1.7.2 → 1.8.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/package.json +1 -1
- package/src/app-metadata.json +2 -2
- package/src/views/MessageInput/chat-entry-history.ts +97 -0
- package/src/views/MessageInput/index.tsx +7 -1
- package/dist/AbortedError.d.ts +0 -5
- package/dist/AbortedError.d.ts.map +0 -1
- package/dist/AbortedError.js +0 -7
- package/dist/AbortedError.js.map +0 -1
- package/dist/StackspotAIWidget.d.ts +0 -23
- package/dist/StackspotAIWidget.d.ts.map +0 -1
- package/dist/StackspotAIWidget.js +0 -35
- package/dist/StackspotAIWidget.js.map +0 -1
- package/dist/app-metadata.json +0 -151
- package/dist/chat-interceptors/CustomInputs.d.ts +0 -22
- package/dist/chat-interceptors/CustomInputs.d.ts.map +0 -1
- package/dist/chat-interceptors/CustomInputs.js +0 -71
- package/dist/chat-interceptors/CustomInputs.js.map +0 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +0 -14
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +0 -1
- package/dist/chat-interceptors/quick-command-questions.js +0 -28
- package/dist/chat-interceptors/quick-command-questions.js.map +0 -1
- package/dist/chat-interceptors/quick-commands.d.ts +0 -17
- package/dist/chat-interceptors/quick-commands.d.ts.map +0 -1
- package/dist/chat-interceptors/quick-commands.js +0 -292
- package/dist/chat-interceptors/quick-commands.js.map +0 -1
- package/dist/chat-interceptors/send-message.d.ts +0 -14
- package/dist/chat-interceptors/send-message.d.ts.map +0 -1
- package/dist/chat-interceptors/send-message.js +0 -96
- package/dist/chat-interceptors/send-message.js.map +0 -1
- package/dist/components/Accordion.d.ts +0 -20
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -49
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/AdaptiveTextArea.d.ts +0 -22
- package/dist/components/AdaptiveTextArea.d.ts.map +0 -1
- package/dist/components/AdaptiveTextArea.js +0 -39
- package/dist/components/AdaptiveTextArea.js.map +0 -1
- package/dist/components/AutoFocus.d.ts +0 -23
- package/dist/components/AutoFocus.d.ts.map +0 -1
- package/dist/components/AutoFocus.js +0 -23
- package/dist/components/AutoFocus.js.map +0 -1
- package/dist/components/Code.d.ts +0 -19
- package/dist/components/Code.d.ts.map +0 -1
- package/dist/components/Code.js +0 -118
- package/dist/components/Code.js.map +0 -1
- package/dist/components/Fading.d.ts +0 -32
- package/dist/components/Fading.d.ts.map +0 -1
- package/dist/components/Fading.js +0 -33
- package/dist/components/Fading.js.map +0 -1
- package/dist/components/FadingOverflow.d.ts +0 -37
- package/dist/components/FadingOverflow.d.ts.map +0 -1
- package/dist/components/FadingOverflow.js +0 -225
- package/dist/components/FadingOverflow.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/HistoryList.d.ts +0 -25
- package/dist/components/HistoryList.d.ts.map +0 -1
- package/dist/components/HistoryList.js +0 -74
- package/dist/components/HistoryList.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/Markdown.d.ts +0 -9
- package/dist/components/Markdown.d.ts.map +0 -1
- package/dist/components/Markdown.js +0 -17
- package/dist/components/Markdown.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 -33
- 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/QuickStartButton.d.ts +0 -13
- package/dist/components/QuickStartButton.d.ts.map +0 -1
- package/dist/components/QuickStartButton.js +0 -47
- package/dist/components/QuickStartButton.js.map +0 -1
- package/dist/components/RightPanelForm.d.ts +0 -8
- package/dist/components/RightPanelForm.d.ts.map +0 -1
- package/dist/components/RightPanelForm.js +0 -50
- package/dist/components/RightPanelForm.js.map +0 -1
- package/dist/components/RightPanelTabs.d.ts +0 -13
- package/dist/components/RightPanelTabs.d.ts.map +0 -1
- package/dist/components/RightPanelTabs.js +0 -24
- package/dist/components/RightPanelTabs.js.map +0 -1
- package/dist/components/Selector/index.d.ts +0 -24
- package/dist/components/Selector/index.d.ts.map +0 -1
- package/dist/components/Selector/index.js +0 -134
- package/dist/components/Selector/index.js.map +0 -1
- package/dist/components/Selector/styled.d.ts +0 -2
- package/dist/components/Selector/styled.d.ts.map +0 -1
- package/dist/components/Selector/styled.js +0 -153
- package/dist/components/Selector/styled.js.map +0 -1
- package/dist/components/TabManager.d.ts +0 -40
- package/dist/components/TabManager.d.ts.map +0 -1
- package/dist/components/TabManager.js +0 -166
- package/dist/components/TabManager.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/dist/components/form/DescribedCheckboxGroup.d.ts +0 -7
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +0 -1
- package/dist/components/form/DescribedCheckboxGroup.js +0 -27
- package/dist/components/form/DescribedCheckboxGroup.js.map +0 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +0 -7
- package/dist/components/form/DescribedRadioGroup.d.ts.map +0 -1
- package/dist/components/form/DescribedRadioGroup.js +0 -22
- package/dist/components/form/DescribedRadioGroup.js.map +0 -1
- package/dist/components/form/styled.d.ts +0 -2
- package/dist/components/form/styled.d.ts.map +0 -1
- package/dist/components/form/styled.js +0 -42
- package/dist/components/form/styled.js.map +0 -1
- package/dist/components/form/types.d.ts +0 -53
- package/dist/components/form/types.d.ts.map +0 -1
- package/dist/components/form/types.js +0 -2
- package/dist/components/form/types.js.map +0 -1
- package/dist/context/AIWidgetProvider.d.ts +0 -23
- package/dist/context/AIWidgetProvider.d.ts.map +0 -1
- package/dist/context/AIWidgetProvider.js +0 -23
- package/dist/context/AIWidgetProvider.js.map +0 -1
- package/dist/context/hooks.d.ts +0 -69
- package/dist/context/hooks.d.ts.map +0 -1
- package/dist/context/hooks.js +0 -121
- package/dist/context/hooks.js.map +0 -1
- package/dist/features.d.ts +0 -40
- package/dist/features.d.ts.map +0 -1
- package/dist/features.js +0 -18
- package/dist/features.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/layout.css +0 -137
- package/dist/regex.d.ts +0 -3
- package/dist/regex.d.ts.map +0 -1
- package/dist/regex.js +0 -3
- package/dist/regex.js.map +0 -1
- package/dist/right-panel/DefaultPanel.d.ts +0 -12
- package/dist/right-panel/DefaultPanel.d.ts.map +0 -1
- package/dist/right-panel/DefaultPanel.js +0 -50
- package/dist/right-panel/DefaultPanel.js.map +0 -1
- package/dist/right-panel/RightPanel.d.ts +0 -5
- package/dist/right-panel/RightPanel.d.ts.map +0 -1
- package/dist/right-panel/RightPanel.js +0 -9
- package/dist/right-panel/RightPanel.js.map +0 -1
- package/dist/right-panel/RightPanelProvider.d.ts +0 -28
- package/dist/right-panel/RightPanelProvider.d.ts.map +0 -1
- package/dist/right-panel/RightPanelProvider.js +0 -10
- package/dist/right-panel/RightPanelProvider.js.map +0 -1
- package/dist/right-panel/constants.d.ts +0 -2
- package/dist/right-panel/constants.d.ts.map +0 -1
- package/dist/right-panel/constants.js +0 -2
- package/dist/right-panel/constants.js.map +0 -1
- package/dist/right-panel/hooks.d.ts +0 -19
- package/dist/right-panel/hooks.d.ts.map +0 -1
- package/dist/right-panel/hooks.js +0 -46
- package/dist/right-panel/hooks.js.map +0 -1
- package/dist/state/ChatEntry.d.ts +0 -112
- package/dist/state/ChatEntry.d.ts.map +0 -1
- package/dist/state/ChatEntry.js +0 -59
- package/dist/state/ChatEntry.js.map +0 -1
- package/dist/state/ChatState.d.ts +0 -154
- package/dist/state/ChatState.d.ts.map +0 -1
- package/dist/state/ChatState.js +0 -108
- package/dist/state/ChatState.js.map +0 -1
- package/dist/state/ChatTabsController.d.ts +0 -66
- package/dist/state/ChatTabsController.d.ts.map +0 -1
- package/dist/state/ChatTabsController.js +0 -116
- package/dist/state/ChatTabsController.js.map +0 -1
- package/dist/state/ObservableState.d.ts +0 -24
- package/dist/state/ObservableState.d.ts.map +0 -1
- package/dist/state/ObservableState.js +0 -39
- package/dist/state/ObservableState.js.map +0 -1
- package/dist/state/WidgetState.d.ts +0 -80
- package/dist/state/WidgetState.d.ts.map +0 -1
- package/dist/state/WidgetState.js +0 -68
- package/dist/state/WidgetState.js.map +0 -1
- package/dist/state/types.d.ts +0 -8
- package/dist/state/types.d.ts.map +0 -1
- package/dist/state/types.js +0 -2
- package/dist/state/types.js.map +0 -1
- package/dist/types.d.ts +0 -27
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/chat.d.ts +0 -12
- package/dist/utils/chat.d.ts.map +0 -1
- package/dist/utils/chat.js +0 -26
- package/dist/utils/chat.js.map +0 -1
- package/dist/utils/date.d.ts +0 -32
- package/dist/utils/date.d.ts.map +0 -1
- package/dist/utils/date.js +0 -66
- package/dist/utils/date.js.map +0 -1
- package/dist/utils/download.d.ts +0 -7
- package/dist/utils/download.d.ts.map +0 -1
- package/dist/utils/download.js +0 -15
- package/dist/utils/download.js.map +0 -1
- package/dist/utils/knowledge-source.d.ts +0 -19
- package/dist/utils/knowledge-source.d.ts.map +0 -1
- package/dist/utils/knowledge-source.js +0 -60
- package/dist/utils/knowledge-source.js.map +0 -1
- package/dist/utils/programming-languages.d.ts +0 -7
- package/dist/utils/programming-languages.d.ts.map +0 -1
- package/dist/utils/programming-languages.js +0 -464
- package/dist/utils/programming-languages.js.map +0 -1
- package/dist/utils/string.d.ts +0 -7
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/string.js +0 -11
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/url.d.ts +0 -2
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/url.js +0 -8
- package/dist/utils/url.js.map +0 -1
- package/dist/views/Agents/AgentDescription.d.ts +0 -9
- package/dist/views/Agents/AgentDescription.d.ts.map +0 -1
- package/dist/views/Agents/AgentDescription.js +0 -21
- package/dist/views/Agents/AgentDescription.js.map +0 -1
- package/dist/views/Agents/AgentsPanel.d.ts +0 -5
- package/dist/views/Agents/AgentsPanel.d.ts.map +0 -1
- package/dist/views/Agents/AgentsPanel.js +0 -19
- package/dist/views/Agents/AgentsPanel.js.map +0 -1
- package/dist/views/Agents/AgentsTab.d.ts +0 -5
- package/dist/views/Agents/AgentsTab.d.ts.map +0 -1
- package/dist/views/Agents/AgentsTab.js +0 -43
- package/dist/views/Agents/AgentsTab.js.map +0 -1
- package/dist/views/Agents/dictionary.d.ts +0 -2
- package/dist/views/Agents/dictionary.d.ts.map +0 -1
- package/dist/views/Agents/dictionary.js +0 -35
- package/dist/views/Agents/dictionary.js.map +0 -1
- package/dist/views/Agents/index.d.ts +0 -5
- package/dist/views/Agents/index.d.ts.map +0 -1
- package/dist/views/Agents/index.js +0 -21
- package/dist/views/Agents/index.js.map +0 -1
- package/dist/views/Agents/styled.d.ts +0 -3
- package/dist/views/Agents/styled.d.ts.map +0 -1
- package/dist/views/Agents/styled.js +0 -58
- package/dist/views/Agents/styled.js.map +0 -1
- package/dist/views/Chat/AgentInfo.d.ts +0 -10
- package/dist/views/Chat/AgentInfo.d.ts.map +0 -1
- package/dist/views/Chat/AgentInfo.js +0 -10
- package/dist/views/Chat/AgentInfo.js.map +0 -1
- package/dist/views/Chat/ChatMessage.d.ts +0 -22
- package/dist/views/Chat/ChatMessage.d.ts.map +0 -1
- package/dist/views/Chat/ChatMessage.js +0 -82
- package/dist/views/Chat/ChatMessage.js.map +0 -1
- package/dist/views/Chat/ChatMessages.d.ts +0 -10
- package/dist/views/Chat/ChatMessages.d.ts.map +0 -1
- package/dist/views/Chat/ChatMessages.js +0 -15
- package/dist/views/Chat/ChatMessages.js.map +0 -1
- package/dist/views/Chat/chat-scroll.d.ts +0 -7
- package/dist/views/Chat/chat-scroll.d.ts.map +0 -1
- package/dist/views/Chat/chat-scroll.js +0 -17
- package/dist/views/Chat/chat-scroll.js.map +0 -1
- package/dist/views/Chat/events.d.ts +0 -22
- package/dist/views/Chat/events.d.ts.map +0 -1
- package/dist/views/Chat/events.js +0 -66
- package/dist/views/Chat/events.js.map +0 -1
- package/dist/views/Chat/index.d.ts +0 -12
- package/dist/views/Chat/index.d.ts.map +0 -1
- package/dist/views/Chat/index.js +0 -11
- package/dist/views/Chat/index.js.map +0 -1
- package/dist/views/Chat/styled.d.ts +0 -2
- package/dist/views/Chat/styled.d.ts.map +0 -1
- package/dist/views/Chat/styled.js +0 -186
- package/dist/views/Chat/styled.js.map +0 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +0 -5
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +0 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +0 -14
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +0 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +0 -8
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +0 -1
- package/dist/views/ChatHistory/HistoryItem.js +0 -130
- package/dist/views/ChatHistory/HistoryItem.js.map +0 -1
- package/dist/views/ChatHistory/dictionary.d.ts +0 -2
- package/dist/views/ChatHistory/dictionary.d.ts.map +0 -1
- package/dist/views/ChatHistory/dictionary.js +0 -19
- package/dist/views/ChatHistory/dictionary.js.map +0 -1
- package/dist/views/ChatHistory/index.d.ts +0 -5
- package/dist/views/ChatHistory/index.d.ts.map +0 -1
- package/dist/views/ChatHistory/index.js +0 -26
- package/dist/views/ChatHistory/index.js.map +0 -1
- package/dist/views/ChatHistory/styled.d.ts +0 -2
- package/dist/views/ChatHistory/styled.d.ts.map +0 -1
- package/dist/views/ChatHistory/styled.js +0 -60
- package/dist/views/ChatHistory/styled.js.map +0 -1
- package/dist/views/ChatHistory/utils.d.ts +0 -20
- package/dist/views/ChatHistory/utils.d.ts.map +0 -1
- package/dist/views/ChatHistory/utils.js +0 -53
- package/dist/views/ChatHistory/utils.js.map +0 -1
- package/dist/views/ChatTabSelection.d.ts +0 -5
- package/dist/views/ChatTabSelection.d.ts.map +0 -1
- package/dist/views/ChatTabSelection.js +0 -48
- package/dist/views/ChatTabSelection.js.map +0 -1
- package/dist/views/Editor.d.ts +0 -5
- package/dist/views/Editor.d.ts.map +0 -1
- package/dist/views/Editor.js +0 -96
- package/dist/views/Editor.js.map +0 -1
- package/dist/views/Home/BuiltInAgent.d.ts +0 -6
- package/dist/views/Home/BuiltInAgent.d.ts.map +0 -1
- package/dist/views/Home/BuiltInAgent.js +0 -39
- package/dist/views/Home/BuiltInAgent.js.map +0 -1
- package/dist/views/Home/CustomAgent.d.ts +0 -5
- package/dist/views/Home/CustomAgent.d.ts.map +0 -1
- package/dist/views/Home/CustomAgent.js +0 -24
- package/dist/views/Home/CustomAgent.js.map +0 -1
- package/dist/views/Home/index.d.ts +0 -8
- package/dist/views/Home/index.d.ts.map +0 -1
- package/dist/views/Home/index.js +0 -15
- package/dist/views/Home/index.js.map +0 -1
- package/dist/views/Home/styled.d.ts +0 -2
- package/dist/views/Home/styled.d.ts.map +0 -1
- package/dist/views/Home/styled.js +0 -59
- package/dist/views/Home/styled.js.map +0 -1
- package/dist/views/Home/types.d.ts +0 -7
- package/dist/views/Home/types.d.ts.map +0 -1
- package/dist/views/Home/types.js +0 -2
- package/dist/views/Home/types.js.map +0 -1
- package/dist/views/KSDocument.d.ts +0 -5
- package/dist/views/KSDocument.d.ts.map +0 -1
- package/dist/views/KSDocument.js +0 -43
- package/dist/views/KSDocument.js.map +0 -1
- package/dist/views/KnowledgeSources.d.ts +0 -2
- package/dist/views/KnowledgeSources.d.ts.map +0 -1
- package/dist/views/KnowledgeSources.js +0 -96
- package/dist/views/KnowledgeSources.js.map +0 -1
- package/dist/views/MessageInput/AgentSelector.d.ts +0 -4
- package/dist/views/MessageInput/AgentSelector.d.ts.map +0 -1
- package/dist/views/MessageInput/AgentSelector.js +0 -58
- package/dist/views/MessageInput/AgentSelector.js.map +0 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts +0 -2
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonAgent.js +0 -17
- package/dist/views/MessageInput/ButtonAgent.js.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.d.ts +0 -29
- package/dist/views/MessageInput/ButtonGroup.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.js +0 -34
- package/dist/views/MessageInput/ButtonGroup.js.map +0 -1
- package/dist/views/MessageInput/InfoBar.d.ts +0 -9
- package/dist/views/MessageInput/InfoBar.d.ts.map +0 -1
- package/dist/views/MessageInput/InfoBar.js +0 -52
- package/dist/views/MessageInput/InfoBar.js.map +0 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +0 -4
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +0 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +0 -34
- package/dist/views/MessageInput/QuickCommandSelector.js.map +0 -1
- package/dist/views/MessageInput/dictionary.d.ts +0 -2
- package/dist/views/MessageInput/dictionary.d.ts.map +0 -1
- package/dist/views/MessageInput/dictionary.js +0 -43
- package/dist/views/MessageInput/dictionary.js.map +0 -1
- package/dist/views/MessageInput/index.d.ts +0 -7
- package/dist/views/MessageInput/index.d.ts.map +0 -1
- package/dist/views/MessageInput/index.js +0 -59
- package/dist/views/MessageInput/index.js.map +0 -1
- package/dist/views/MessageInput/styled.d.ts +0 -4
- package/dist/views/MessageInput/styled.d.ts.map +0 -1
- package/dist/views/MessageInput/styled.js +0 -257
- package/dist/views/MessageInput/styled.js.map +0 -1
- package/dist/views/MinimizedHeader.d.ts +0 -7
- package/dist/views/MinimizedHeader.d.ts.map +0 -1
- package/dist/views/MinimizedHeader.js +0 -79
- package/dist/views/MinimizedHeader.js.map +0 -1
- package/dist/views/Stacks.d.ts +0 -5
- package/dist/views/Stacks.d.ts.map +0 -1
- package/dist/views/Stacks.js +0 -80
- package/dist/views/Stacks.js.map +0 -1
- package/dist/views/Workspaces.d.ts +0 -5
- package/dist/views/Workspaces.d.ts.map +0 -1
- package/dist/views/Workspaces.js +0 -66
- package/dist/views/Workspaces.js.map +0 -1
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { groupBy, last, pull } from 'lodash';
|
|
2
|
-
/**
|
|
3
|
-
* Controls the chat tabs.
|
|
4
|
-
*/
|
|
5
|
-
export class ChatTabsController {
|
|
6
|
-
chats = [];
|
|
7
|
-
activeChatId = '';
|
|
8
|
-
listeners = [];
|
|
9
|
-
runListeners() {
|
|
10
|
-
this.listeners.forEach(l => l(this.chats, this.getActiveChat()));
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Adds new chats to the tab view.
|
|
14
|
-
* @param chats the chats to add.
|
|
15
|
-
*/
|
|
16
|
-
add(...chats) {
|
|
17
|
-
if (!chats.length)
|
|
18
|
-
return;
|
|
19
|
-
this.chats = [...this.chats, ...chats];
|
|
20
|
-
this.runListeners();
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* If the active chat is deleted, this selects a new chat based on the position of the chat that has been removed.
|
|
24
|
-
*
|
|
25
|
-
* @param previous the previous tabs.
|
|
26
|
-
* @param deleted the ids of the chats that have been deleted.
|
|
27
|
-
*/
|
|
28
|
-
reselect(previous, deleted) {
|
|
29
|
-
if (deleted.includes(this.activeChatId)) {
|
|
30
|
-
const currentActiveIndex = previous.findIndex(c => c.id === this.activeChatId);
|
|
31
|
-
if (currentActiveIndex === -1)
|
|
32
|
-
this.activeChatId = this.chats[0]?.id;
|
|
33
|
-
this.activeChatId = currentActiveIndex < this.chats.length ? this.chats[currentActiveIndex].id : last(this.chats)?.id ?? '';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Removes chats from the tab view. This will never remove a chat if this chat is the last one.
|
|
38
|
-
*
|
|
39
|
-
* @param ids the ids of the chats to remove.
|
|
40
|
-
*/
|
|
41
|
-
remove(...ids) {
|
|
42
|
-
ids.splice(this.chats.length - 1, ids.length - this.chats.length);
|
|
43
|
-
if (!ids.length)
|
|
44
|
-
return;
|
|
45
|
-
const previous = this.chats;
|
|
46
|
-
this.chats = this.chats.filter(c => !ids.includes(c.id));
|
|
47
|
-
this.reselect(previous, ids);
|
|
48
|
-
this.runListeners();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Removes all empty chats. The last chat will be kept if it's empty, but the only chat remaining.
|
|
52
|
-
*
|
|
53
|
-
* @param exceptions ids of chats that shouldn't be removed even if empty.
|
|
54
|
-
*/
|
|
55
|
-
removeEmptyChats(...exceptions) {
|
|
56
|
-
const lastChat = last(this.chats);
|
|
57
|
-
const previous = this.chats;
|
|
58
|
-
const { true: removed, false: kept = [] } = groupBy(this.chats, c => c.getMessages().length === 0 && !exceptions.includes(c.id));
|
|
59
|
-
if (removed) {
|
|
60
|
-
this.chats = kept;
|
|
61
|
-
if (lastChat && this.chats.length === 0)
|
|
62
|
-
this.chats.push(lastChat);
|
|
63
|
-
this.reselect(previous, removed.map(c => c.id));
|
|
64
|
-
this.runListeners();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @param id the id of the chat to retrieve.
|
|
69
|
-
* @returns a ChatState corresponding to the id.
|
|
70
|
-
*/
|
|
71
|
-
get(id) {
|
|
72
|
-
return this.chats.find(c => c.id === id);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @returns the id of the chat corresponding to the tab that is currently active.
|
|
76
|
-
*/
|
|
77
|
-
getActiveChatId() {
|
|
78
|
-
return this.activeChatId;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @returns the chat corresponding to the tab that is currently active.
|
|
82
|
-
*/
|
|
83
|
-
getActiveChat() {
|
|
84
|
-
const chat = this.chats.find(c => c.id === this.activeChatId);
|
|
85
|
-
if (!chat)
|
|
86
|
-
throw new Error('Chat state error, the active chat id corresponds to none chat in the tabs.');
|
|
87
|
-
return chat;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @returns all chats in tab view.
|
|
91
|
-
*/
|
|
92
|
-
getAll() {
|
|
93
|
-
return this.chats;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Watches for changes in the tab view.
|
|
97
|
-
* @param listener a function called whenever a tab is added, removed or selected. This function receives the list of chats as the first
|
|
98
|
-
* parameter and the id of the active chat as the second parameter.
|
|
99
|
-
* @returns a function to remove the listener.
|
|
100
|
-
*/
|
|
101
|
-
onChange(listener) {
|
|
102
|
-
this.listeners.push(listener);
|
|
103
|
-
return () => {
|
|
104
|
-
pull(this.listeners, listener);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Changes the chat (tab) that is currently active.
|
|
109
|
-
* @param id the id of the chat to select.
|
|
110
|
-
*/
|
|
111
|
-
select(id) {
|
|
112
|
-
this.activeChatId = id;
|
|
113
|
-
this.runListeners();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=ChatTabsController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatTabsController.js","sourceRoot":"","sources":["../../src/state/ChatTabsController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAK5C;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACrB,KAAK,GAAgB,EAAE,CAAA;IACvB,YAAY,GAAG,EAAE,CAAA;IACjB,SAAS,GAAwB,EAAE,CAAA;IAEnC,YAAY;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAA;IAClE,CAAC;IAED;;;OAGG;IACH,GAA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G;IACH,aAAa;QACX,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,CAAA;QAC7D,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;QACxG,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,QAA2B;QAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC7B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAChC,CAAC,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,EAAU;QACf,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;QACtB,IAAI,CAAC,YAAY,EAAE,CAAA;IACrB,CAAC;CACF"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type ObservableStateListener<T, K extends keyof T> = (value: T[K]) => void;
|
|
2
|
-
/**
|
|
3
|
-
* A generic representation of a state that can be observed for changes.
|
|
4
|
-
*
|
|
5
|
-
* Building our own state instead of using React is important because:
|
|
6
|
-
* 1. We need to be able to control it even outside the react context.
|
|
7
|
-
* 2. We need performance, we can't have everything re-rendering because something changes. We need to be careful to watch only the
|
|
8
|
-
* properties we need in a component.
|
|
9
|
-
*/
|
|
10
|
-
export declare class ObservableState<T> {
|
|
11
|
-
protected state: T;
|
|
12
|
-
private listeners;
|
|
13
|
-
constructor(initial: T);
|
|
14
|
-
set<K extends keyof T>(key: K, value: T[K]): void;
|
|
15
|
-
get<K extends keyof T>(key: K): T[K];
|
|
16
|
-
/**
|
|
17
|
-
* Watches for changes in the state referred by the provided key.
|
|
18
|
-
* @param key the key of the state to watch.
|
|
19
|
-
* @param listener a function called whenever the value of the state referred by `key` changes.
|
|
20
|
-
* @returns a function to remove the listener.
|
|
21
|
-
*/
|
|
22
|
-
onChange<K extends keyof T>(key: K, listener: (value: T[K]) => void): () => void;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=ObservableState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObservableState.d.ts","sourceRoot":"","sources":["../../src/state/ObservableState.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;AAMjF;;;;;;;GAOG;AACH,qBAAa,eAAe,CAAC,CAAC;IAC5B,SAAS,CAAC,KAAK,EAAE,CAAC,CAAA;IAClB,OAAO,CAAC,SAAS,CAAmB;gBAExB,OAAO,EAAE,CAAC;IAItB,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAO1C,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAIpC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;CAOpE"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { pull } from 'lodash';
|
|
2
|
-
/**
|
|
3
|
-
* A generic representation of a state that can be observed for changes.
|
|
4
|
-
*
|
|
5
|
-
* Building our own state instead of using React is important because:
|
|
6
|
-
* 1. We need to be able to control it even outside the react context.
|
|
7
|
-
* 2. We need performance, we can't have everything re-rendering because something changes. We need to be careful to watch only the
|
|
8
|
-
* properties we need in a component.
|
|
9
|
-
*/
|
|
10
|
-
export class ObservableState {
|
|
11
|
-
state;
|
|
12
|
-
listeners = {};
|
|
13
|
-
constructor(initial) {
|
|
14
|
-
this.state = { ...initial };
|
|
15
|
-
}
|
|
16
|
-
set(key, value) {
|
|
17
|
-
if (this.state[key] !== value) {
|
|
18
|
-
this.state[key] = value;
|
|
19
|
-
this.listeners[key]?.forEach(l => l(value));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
get(key) {
|
|
23
|
-
return this.state[key];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Watches for changes in the state referred by the provided key.
|
|
27
|
-
* @param key the key of the state to watch.
|
|
28
|
-
* @param listener a function called whenever the value of the state referred by `key` changes.
|
|
29
|
-
* @returns a function to remove the listener.
|
|
30
|
-
*/
|
|
31
|
-
onChange(key, listener) {
|
|
32
|
-
this.listeners[key] ??= [];
|
|
33
|
-
this.listeners[key].push(listener);
|
|
34
|
-
return () => {
|
|
35
|
-
pull(this.listeners[key], listener);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=ObservableState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ObservableState.js","sourceRoot":"","sources":["../../src/state/ObservableState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAQ7B;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IAChB,KAAK,CAAG;IACV,SAAS,GAAiB,EAAE,CAAA;IAEpC,YAAY,OAAU;QACpB,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,OAAO,EAAE,CAAA;IAC7B,CAAC;IAED,GAAG,CAAoB,GAAM,EAAE,KAAW;QACxC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;YACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IAED,GAAG,CAAoB,GAAM;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAoB,GAAM,EAAE,QAA+B;QACjE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,CAAA;QAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnC,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAE,EAAE,QAAQ,CAAC,CAAA;QACtC,CAAC,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { AIWidgetFeatures, ChatFeatures, GlobalFeatures } from '../features.js';
|
|
2
|
-
import { ChatEntry } from './ChatEntry.js';
|
|
3
|
-
import { ChatPropertiesWithOptionalFeatures, ChatState, MessageInterceptor } from './ChatState.js';
|
|
4
|
-
import { ChatTabsController } from './ChatTabsController.js';
|
|
5
|
-
import { ObservableState } from './ObservableState.js';
|
|
6
|
-
export interface WidgetProperties {
|
|
7
|
-
/**
|
|
8
|
-
* Current content of the right panel. Undefined for closed right panel.
|
|
9
|
-
*/
|
|
10
|
-
panel?: 'stack' | 'workspace' | 'agent' | 'ks' | 'editor' | 'history' | 'ks-details';
|
|
11
|
-
/**
|
|
12
|
-
* KS to use when the right panel "ks-details" is open.
|
|
13
|
-
*/
|
|
14
|
-
currentKSInPanel?: {
|
|
15
|
-
name: string;
|
|
16
|
-
slug: string;
|
|
17
|
-
score: number;
|
|
18
|
-
documentId: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Whether or not the widget is in its minimized version.
|
|
22
|
-
*/
|
|
23
|
-
isMinimized?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Global features of the chat widget. These features don't depend on the chat currently selected.
|
|
26
|
-
*/
|
|
27
|
-
features: GlobalFeatures;
|
|
28
|
-
}
|
|
29
|
-
interface Options {
|
|
30
|
-
/**
|
|
31
|
-
* Chat interceptors allows you to intercept chat messages, interpret them, modify them and even change the chat flow. See
|
|
32
|
-
* {@link ChatState} for more details.
|
|
33
|
-
*
|
|
34
|
-
* These interceptors, in addition to the default interceptors, will be used when creating a new chat via `WidgetState#createChat`.
|
|
35
|
-
*/
|
|
36
|
-
interceptors?: MessageInterceptor[];
|
|
37
|
-
/**
|
|
38
|
-
* Features to enable in the widget. If a feature is not set explicitly to false, it's interpreted as enabled.
|
|
39
|
-
*
|
|
40
|
-
* These features will be used when creating a new chat via `WidgetState#createChat`. Updating chat features only influence new chats.
|
|
41
|
-
*/
|
|
42
|
-
features?: Partial<AIWidgetFeatures>;
|
|
43
|
-
/**
|
|
44
|
-
* The initial values for the widget state.
|
|
45
|
-
*
|
|
46
|
-
* The default value for each feature under `initial.features` is true.
|
|
47
|
-
*/
|
|
48
|
-
initial?: Omit<WidgetProperties, 'features'>;
|
|
49
|
-
/**
|
|
50
|
-
* The initial tabs for the chat window.
|
|
51
|
-
*/
|
|
52
|
-
chatTabs?: ChatTabsController;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Holds the full state of the AI Chat Widget.
|
|
56
|
-
*
|
|
57
|
-
* This can be used to fully control the chat widget. This is the model of what gets rendered to the screen.
|
|
58
|
-
*/
|
|
59
|
-
export declare class WidgetState extends ObservableState<WidgetProperties> {
|
|
60
|
-
readonly chatTabs: ChatTabsController;
|
|
61
|
-
/**
|
|
62
|
-
* Chat interceptors to be used by default when creating a new chat.
|
|
63
|
-
*/
|
|
64
|
-
interceptors: MessageInterceptor[];
|
|
65
|
-
/**
|
|
66
|
-
* Chat features to be used by default when creating a new chat.
|
|
67
|
-
*/
|
|
68
|
-
chatFeatures: ChatFeatures;
|
|
69
|
-
constructor({ chatTabs, initial, interceptors, features }?: Options);
|
|
70
|
-
private getNextUntitledChatIndex;
|
|
71
|
-
/**
|
|
72
|
-
* Utility function for adding a new chat to the chat tabs. This also selects the new tab.
|
|
73
|
-
* @param properties the chat properties (initial state).
|
|
74
|
-
* @param entries the entries for the chat to start with.
|
|
75
|
-
* @returns the chat created.
|
|
76
|
-
*/
|
|
77
|
-
createChat({ label, ...properties }?: Partial<ChatPropertiesWithOptionalFeatures>, entries?: ChatEntry[]): ChatState;
|
|
78
|
-
}
|
|
79
|
-
export {};
|
|
80
|
-
//# sourceMappingURL=WidgetState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetState.d.ts","sourceRoot":"","sources":["../../src/state/WidgetState.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAA2B,cAAc,EAAE,MAAM,aAAa,CAAA;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,kCAAkC,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;IACrF;;OAEG;IACH,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,UAAU,OAAO;IACf;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrC;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAID;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,eAAe,CAAC,gBAAgB,CAAC;IAChE,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAA;IACrC;;OAEG;IACH,YAAY,EAAE,kBAAkB,EAAE,CAAK;IACvC;;OAEG;IACH,YAAY,EAAE,YAAY,CAAA;gBAEd,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAiB,EAAE,QAAQ,EAAE,GAAE,OAAY;IAc5E,OAAO,CAAC,wBAAwB;IAUhC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,GAAE,OAAO,CAAC,kCAAkC,CAAM,EAAE,OAAO,GAAE,SAAS,EAAO;CAYjH"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { loader } from '@monaco-editor/react';
|
|
2
|
-
import { ulid } from 'ulid';
|
|
3
|
-
import { quickCommandQuestionsInterceptor } from '../chat-interceptors/quick-command-questions.js';
|
|
4
|
-
import { createQuickCommandInterceptor } from '../chat-interceptors/quick-commands.js';
|
|
5
|
-
import { sendMessageInterceptor } from '../chat-interceptors/send-message.js';
|
|
6
|
-
import { getFeaturesWithDefaults } from '../features.js';
|
|
7
|
-
import { ChatState } from './ChatState.js';
|
|
8
|
-
import { ChatTabsController } from './ChatTabsController.js';
|
|
9
|
-
import { ObservableState } from './ObservableState.js';
|
|
10
|
-
const untitledChatPrefix = 'Chat ';
|
|
11
|
-
/**
|
|
12
|
-
* Holds the full state of the AI Chat Widget.
|
|
13
|
-
*
|
|
14
|
-
* This can be used to fully control the chat widget. This is the model of what gets rendered to the screen.
|
|
15
|
-
*/
|
|
16
|
-
export class WidgetState extends ObservableState {
|
|
17
|
-
chatTabs;
|
|
18
|
-
/**
|
|
19
|
-
* Chat interceptors to be used by default when creating a new chat.
|
|
20
|
-
*/
|
|
21
|
-
interceptors = [];
|
|
22
|
-
/**
|
|
23
|
-
* Chat features to be used by default when creating a new chat.
|
|
24
|
-
*/
|
|
25
|
-
chatFeatures;
|
|
26
|
-
constructor({ chatTabs, initial, interceptors = [], features } = {}) {
|
|
27
|
-
const featuresWithDefaults = getFeaturesWithDefaults(features);
|
|
28
|
-
super({ ...initial, features: featuresWithDefaults });
|
|
29
|
-
this.chatFeatures = featuresWithDefaults;
|
|
30
|
-
this.chatTabs = chatTabs ?? new ChatTabsController();
|
|
31
|
-
this.interceptors = [
|
|
32
|
-
...interceptors,
|
|
33
|
-
quickCommandQuestionsInterceptor,
|
|
34
|
-
createQuickCommandInterceptor(this, () => loader.__getMonacoInstance()?.editor),
|
|
35
|
-
sendMessageInterceptor,
|
|
36
|
-
];
|
|
37
|
-
this.createChat();
|
|
38
|
-
}
|
|
39
|
-
getNextUntitledChatIndex() {
|
|
40
|
-
let max = 0;
|
|
41
|
-
for (const chat of this.chatTabs.getAll()) {
|
|
42
|
-
const [, match] = chat.get('label').match(`${untitledChatPrefix}(\\d+)`) ?? [];
|
|
43
|
-
const index = parseInt(match);
|
|
44
|
-
if (index > max)
|
|
45
|
-
max = index;
|
|
46
|
-
}
|
|
47
|
-
return max + 1;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Utility function for adding a new chat to the chat tabs. This also selects the new tab.
|
|
51
|
-
* @param properties the chat properties (initial state).
|
|
52
|
-
* @param entries the entries for the chat to start with.
|
|
53
|
-
* @returns the chat created.
|
|
54
|
-
*/
|
|
55
|
-
createChat({ label, ...properties } = {}, entries = []) {
|
|
56
|
-
const chat = new ChatState({
|
|
57
|
-
id: ulid(),
|
|
58
|
-
initial: { label: label || `${untitledChatPrefix}${this.getNextUntitledChatIndex()}`, features: this.chatFeatures, ...properties },
|
|
59
|
-
entries,
|
|
60
|
-
interceptors: this.interceptors,
|
|
61
|
-
untitled: !label,
|
|
62
|
-
});
|
|
63
|
-
this.chatTabs.add(chat);
|
|
64
|
-
this.chatTabs.select(chat.id);
|
|
65
|
-
return chat;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=WidgetState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetState.js","sourceRoot":"","sources":["../../src/state/WidgetState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAA;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAkC,uBAAuB,EAAkB,MAAM,aAAa,CAAA;AAErG,OAAO,EAAsC,SAAS,EAAsB,MAAM,aAAa,CAAA;AAC/F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AA+CnD,MAAM,kBAAkB,GAAG,OAAO,CAAA;AAElC;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,eAAiC;IACvD,QAAQ,CAAoB;IACrC;;OAEG;IACH,YAAY,GAAyB,EAAE,CAAA;IACvC;;OAEG;IACH,YAAY,CAAc;IAE1B,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,EAAE,EAAE,QAAQ,KAAc,EAAE;QAC1E,MAAM,oBAAoB,GAAG,uBAAuB,CA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E;YAClI,OAAO;YACP,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,CAAC,KAAK;SACjB,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC7B,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
package/dist/state/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/state/types.js
DELETED
package/dist/state/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
|
-
export interface WithChildren<T = React.ReactNode> {
|
|
3
|
-
children?: T;
|
|
4
|
-
}
|
|
5
|
-
export type PropsOf<T extends React.FunctionComponent> = T extends React.FunctionComponent<infer P> ? P : never;
|
|
6
|
-
export interface ButtonAction extends WithStyle {
|
|
7
|
-
icon?: React.ReactElement;
|
|
8
|
-
color?: string;
|
|
9
|
-
label: string;
|
|
10
|
-
onClick: () => any;
|
|
11
|
-
}
|
|
12
|
-
export interface MinimizedActions {
|
|
13
|
-
/**
|
|
14
|
-
* When the chat is minimized, a button to collapse the window is rendered. This function is called whenever this button is clicked.
|
|
15
|
-
*/
|
|
16
|
-
onCollapse?: () => void;
|
|
17
|
-
/**
|
|
18
|
-
* If `onCollapse` is clicked, the button to collapse is replaced by a button to expand. This function is called whenever the expand
|
|
19
|
-
* button is clicked.
|
|
20
|
-
*/
|
|
21
|
-
onExpand?: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* When the chat is minimized, a button to close the window is rendered. This function is called whenever this button is clicked.
|
|
24
|
-
*/
|
|
25
|
-
onClose?: () => void;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS;IAC/C,QAAQ,CAAC,EAAE,CAAC,CAAC;CACd;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,iBAAiB,IAAI,CAAC,SAAS,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE/G,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/utils/chat.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FixedChatRequest } from '@stack-spot/portal-network';
|
|
2
|
-
import { ChatState } from '../state/ChatState.js';
|
|
3
|
-
/**
|
|
4
|
-
* Builds a conversation context from a ChatState.
|
|
5
|
-
*
|
|
6
|
-
* The conversation context is needed by most backend services.
|
|
7
|
-
*
|
|
8
|
-
* @param state the ChatState to build the context from.
|
|
9
|
-
* @returns the conversation context ready to be sent to the backend.
|
|
10
|
-
*/
|
|
11
|
-
export declare function buildConversationContext(state: ChatState): FixedChatRequest['context'];
|
|
12
|
-
//# sourceMappingURL=chat.d.ts.map
|
package/dist/utils/chat.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/utils/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CActF"}
|
package/dist/utils/chat.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import appData from '../app-metadata.json';
|
|
2
|
-
import { defaultLanguage } from './programming-languages.js';
|
|
3
|
-
/**
|
|
4
|
-
* Builds a conversation context from a ChatState.
|
|
5
|
-
*
|
|
6
|
-
* The conversation context is needed by most backend services.
|
|
7
|
-
*
|
|
8
|
-
* @param state the ChatState to build the context from.
|
|
9
|
-
* @returns the conversation context ready to be sent to the backend.
|
|
10
|
-
*/
|
|
11
|
-
export function buildConversationContext(state) {
|
|
12
|
-
return {
|
|
13
|
-
workspace: state.get('workspace')?.id,
|
|
14
|
-
conversation_id: state.id,
|
|
15
|
-
stack_id: state.get('stack')?.id,
|
|
16
|
-
language: state.get('codeLanguage') || (state.get('codeSelection') ? defaultLanguage : undefined),
|
|
17
|
-
knowledge_sources: state.get('knowledgeSources')?.map(ks => ks.id),
|
|
18
|
-
agent_id: state.get('agent')?.id,
|
|
19
|
-
agent_built_in: state.get('agent')?.builtIn,
|
|
20
|
-
os: navigator.userAgent,
|
|
21
|
-
platform: 'web-widget',
|
|
22
|
-
platform_version: navigator.userAgent,
|
|
23
|
-
stackspot_ai_version: appData.version,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=chat.js.map
|
package/dist/utils/chat.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/utils/chat.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,sBAAsB,CAAA;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAgB;IACvD,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE;QACrC,eAAe,EAAE,KAAK,CAAC,EAAE;QACzB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE;QAChC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;QACjG,iBAAiB,EAAE,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAClE,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE;QAChC,cAAc,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO;QAC3C,EAAE,EAAE,SAAS,CAAC,SAAS;QACvB,QAAQ,EAAE,YAAY;QACtB,gBAAgB,EAAE,SAAS,CAAC,SAAS;QACrC,oBAAoB,EAAE,OAAO,CAAC,OAAO;KACtC,CAAA;AACH,CAAC"}
|
package/dist/utils/date.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Language } from '@stack-spot/portal-translate';
|
|
2
|
-
/**
|
|
3
|
-
* Formats a date to show at the footer of a chat message.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* - Today, 14:11
|
|
7
|
-
* - Yesterday, 09:00
|
|
8
|
-
* - October 26 at 10:53
|
|
9
|
-
* @param date the Date to format.
|
|
10
|
-
* @param language the language to use.
|
|
11
|
-
* @returns the formatted date.
|
|
12
|
-
*/
|
|
13
|
-
export declare function formatDateForChatMessage(date: Date, language?: Language): string;
|
|
14
|
-
/**
|
|
15
|
-
* Uses the current language to format dates.
|
|
16
|
-
* @returns an object containing functions for formatting dates.
|
|
17
|
-
*/
|
|
18
|
-
export declare function useDateFormatter(): {
|
|
19
|
-
/**
|
|
20
|
-
* @param date the date to format using {@link formatDateForChatMessage}.
|
|
21
|
-
* @returns the formatted date according to the current language. If the language changes, this result also changes.
|
|
22
|
-
*/
|
|
23
|
-
formatForChatMessage: (date: Date) => string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Subtracts `numberOfDays` from `date`.
|
|
27
|
-
* @param date
|
|
28
|
-
* @param numberOfDays
|
|
29
|
-
* @returns the resulting Date object.
|
|
30
|
-
*/
|
|
31
|
-
export declare function subtractDays(date: Date, numberOfDays: number): Date;
|
|
32
|
-
//# sourceMappingURL=date.d.ts.map
|
package/dist/utils/date.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAA4B,MAAM,8BAA8B,CAAA;AAU7F;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAE,QAAwB,UAUtF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB;IAG5B;;;OAGG;iCAC0B,IAAI;EAEpC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAE5D"}
|
package/dist/utils/date.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { getLanguage, useLanguage } from '@stack-spot/portal-translate';
|
|
2
|
-
const OneDay = 24 * 60 * 60 * 1000;
|
|
3
|
-
const timeFormatOptions = { hour: '2-digit', minute: '2-digit' };
|
|
4
|
-
const fullFormatOptions = {
|
|
5
|
-
...timeFormatOptions,
|
|
6
|
-
day: '2-digit',
|
|
7
|
-
month: 'long',
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Formats a date to show at the footer of a chat message.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* - Today, 14:11
|
|
14
|
-
* - Yesterday, 09:00
|
|
15
|
-
* - October 26 at 10:53
|
|
16
|
-
* @param date the Date to format.
|
|
17
|
-
* @param language the language to use.
|
|
18
|
-
* @returns the formatted date.
|
|
19
|
-
*/
|
|
20
|
-
export function formatDateForChatMessage(date, language = getLanguage()) {
|
|
21
|
-
const formatted = [];
|
|
22
|
-
const now = new Date();
|
|
23
|
-
const isToday = date.toDateString() === now.toDateString();
|
|
24
|
-
const isYesterday = now.getTime() - date.getTime() < OneDay;
|
|
25
|
-
if (isToday)
|
|
26
|
-
formatted.push(dictionary[language].today);
|
|
27
|
-
else if (isYesterday)
|
|
28
|
-
formatted.push(dictionary[language].yesterday);
|
|
29
|
-
const options = isToday || isYesterday ? timeFormatOptions : fullFormatOptions;
|
|
30
|
-
formatted.push(date.toLocaleString([], options));
|
|
31
|
-
return formatted.join(', ');
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Uses the current language to format dates.
|
|
35
|
-
* @returns an object containing functions for formatting dates.
|
|
36
|
-
*/
|
|
37
|
-
export function useDateFormatter() {
|
|
38
|
-
const language = useLanguage();
|
|
39
|
-
return {
|
|
40
|
-
/**
|
|
41
|
-
* @param date the date to format using {@link formatDateForChatMessage}.
|
|
42
|
-
* @returns the formatted date according to the current language. If the language changes, this result also changes.
|
|
43
|
-
*/
|
|
44
|
-
formatForChatMessage: (date) => formatDateForChatMessage(date, language),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Subtracts `numberOfDays` from `date`.
|
|
49
|
-
* @param date
|
|
50
|
-
* @param numberOfDays
|
|
51
|
-
* @returns the resulting Date object.
|
|
52
|
-
*/
|
|
53
|
-
export function subtractDays(date, numberOfDays) {
|
|
54
|
-
return new Date(date.getTime() - 24 * numberOfDays * 60 * 60000);
|
|
55
|
-
}
|
|
56
|
-
const dictionary = {
|
|
57
|
-
en: {
|
|
58
|
-
today: 'Today',
|
|
59
|
-
yesterday: 'Yesterday',
|
|
60
|
-
},
|
|
61
|
-
pt: {
|
|
62
|
-
today: 'Hoje',
|
|
63
|
-
yesterday: 'Ontem',
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=date.js.map
|
package/dist/utils/date.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAE7F,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAClC,MAAM,iBAAiB,GAA+B,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAC,SAAS,EAAE,CAAA;AAC3F,MAAM,iBAAiB,GAA+B;IACpD,GAAG,iBAAiB;IACpB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,MAAM;CACd,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MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;QACd,SAAS,EAAE,WAAW;KACvB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,OAAO;KACnB;CACmB,CAAA"}
|
package/dist/utils/download.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAWtD"}
|
package/dist/utils/download.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Downloads `text` as a file named `filename`.
|
|
3
|
-
* @param filename the name of the file.
|
|
4
|
-
* @param text the content of the file.
|
|
5
|
-
*/
|
|
6
|
-
export function download(filename, text) {
|
|
7
|
-
const element = document.createElement('a');
|
|
8
|
-
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
|
9
|
-
element.setAttribute('download', filename);
|
|
10
|
-
element.style.display = 'none';
|
|
11
|
-
document.body.appendChild(element);
|
|
12
|
-
element.click();
|
|
13
|
-
document.body.removeChild(element);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=download.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,IAAY;IACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAC3C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,gCAAgC,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAA;IACzF,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAE1C,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;IAC9B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IAElC,OAAO,CAAC,KAAK,EAAE,CAAA;IAEf,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DocumentResponse, SourceKnowledgeSource, SourceProjectFile4, SourceStackAi } from '@stack-spot/portal-network/api/ai';
|
|
2
|
-
import { KnowledgeSource } from '../state/ChatEntry.js';
|
|
3
|
-
/**
|
|
4
|
-
* Extracts the important part of a KS document to show for the user.
|
|
5
|
-
* @param document the document to parse.
|
|
6
|
-
* @returns an object containing the programming language of the KS, its code snippet and a textual description.
|
|
7
|
-
*/
|
|
8
|
-
export declare function extractCodeFromKSDocument(document: DocumentResponse): {
|
|
9
|
-
language?: string;
|
|
10
|
-
snippet: string;
|
|
11
|
-
text?: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Extracts all knowledge sources from a mix of sources that can be used to shape an AI agent's answer.
|
|
15
|
-
* @param sources a list with sources of any kind.
|
|
16
|
-
* @returns a list of knowledge sources in the format expected by the chat.
|
|
17
|
-
*/
|
|
18
|
-
export declare function genericSourcesToKnowledgeSources(sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile4)[] | undefined): KnowledgeSource[] | undefined;
|
|
19
|
-
//# sourceMappingURL=knowledge-source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-source.d.ts","sourceRoot":"","sources":["../../src/utils/knowledge-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAC9H,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AA4BpD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAoB3H;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,CAAC,aAAa,GAAG,qBAAqB,GAAG,kBAAkB,CAAC,EAAE,GAAG,SAAS,GAClF,eAAe,EAAE,GAAG,SAAS,CAK/B"}
|