@stack-spot/ai-chat-widget 1.0.0 → 1.1.0
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 +9 -0
- package/dist/StackspotAIWidget.d.ts +20 -0
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -3
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/chat-interceptors/CustomInputs.d.ts +4 -1
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -1
- package/dist/chat-interceptors/CustomInputs.js +10 -1
- package/dist/chat-interceptors/CustomInputs.js.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +10 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.js +12 -2
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -1
- package/dist/chat-interceptors/quick-commands.d.ts +11 -0
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +42 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +10 -0
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +18 -0
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/Accordion.d.ts +10 -0
- package/dist/components/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion.js +3 -0
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +12 -0
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +3 -0
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AutoFocus.d.ts +17 -0
- package/dist/components/AutoFocus.d.ts.map +1 -1
- package/dist/components/AutoFocus.js +6 -5
- package/dist/components/AutoFocus.js.map +1 -1
- package/dist/components/Fading.d.ts +19 -2
- package/dist/components/Fading.d.ts.map +1 -1
- package/dist/components/Fading.js +6 -4
- package/dist/components/Fading.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts +25 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +11 -2
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FallbackBoundary/index.d.ts +6 -0
- package/dist/components/FallbackBoundary/index.d.ts.map +1 -1
- package/dist/components/FallbackBoundary/index.js.map +1 -1
- package/dist/components/HistoryList.d.ts +15 -0
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +3 -1
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/IconInput.d.ts +3 -0
- package/dist/components/IconInput.d.ts.map +1 -1
- package/dist/components/IconInput.js +3 -0
- package/dist/components/IconInput.js.map +1 -1
- package/dist/components/OverlayMenu.d.ts +11 -0
- package/dist/components/OverlayMenu.d.ts.map +1 -1
- package/dist/components/OverlayMenu.js +5 -1
- package/dist/components/OverlayMenu.js.map +1 -1
- package/dist/components/ProgressBar.d.ts +22 -0
- package/dist/components/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar.js +5 -0
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +3 -0
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelForm.d.ts +3 -0
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +3 -0
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +3 -0
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +3 -0
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/TabManager.d.ts +6 -0
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +8 -0
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +23 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +4 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +16 -0
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +1 -1
- package/dist/components/Tooltip/TooltipAPI.js +17 -0
- package/dist/components/Tooltip/TooltipAPI.js.map +1 -1
- package/dist/components/Tooltip/types.d.ts +13 -0
- package/dist/components/Tooltip/types.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +4 -0
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +4 -0
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +4 -0
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +4 -0
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/components/form/types.d.ts +34 -0
- package/dist/components/form/types.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.d.ts +19 -0
- package/dist/context/AIWidgetProvider.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.js +19 -0
- package/dist/context/AIWidgetProvider.js.map +1 -1
- package/dist/context/hooks.d.ts +56 -0
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +56 -1
- package/dist/context/hooks.js.map +1 -1
- package/dist/features.d.ts +28 -0
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +1 -0
- package/dist/features.js.map +1 -1
- package/dist/right-panel/DefaultPanel.d.ts +3 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +4 -3
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/right-panel/RightPanel.d.ts +3 -0
- package/dist/right-panel/RightPanel.d.ts.map +1 -1
- package/dist/right-panel/RightPanel.js +3 -0
- package/dist/right-panel/RightPanel.js.map +1 -1
- package/dist/right-panel/RightPanelProvider.d.ts +15 -0
- package/dist/right-panel/RightPanelProvider.d.ts.map +1 -1
- package/dist/right-panel/RightPanelProvider.js.map +1 -1
- package/dist/right-panel/hooks.d.ts +6 -0
- package/dist/right-panel/hooks.d.ts.map +1 -1
- package/dist/right-panel/hooks.js +6 -0
- package/dist/right-panel/hooks.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +58 -2
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +20 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +73 -8
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +24 -7
- package/dist/state/ChatState.js.map +1 -1
- package/dist/state/ChatTabsController.d.ts +31 -0
- package/dist/state/ChatTabsController.d.ts.map +1 -1
- package/dist/state/ChatTabsController.js +31 -0
- package/dist/state/ChatTabsController.js.map +1 -1
- package/dist/state/ObservableState.d.ts +14 -0
- package/dist/state/ObservableState.d.ts.map +1 -1
- package/dist/state/ObservableState.js +14 -0
- package/dist/state/ObservableState.js.map +1 -1
- package/dist/state/WidgetState.d.ts +5 -0
- package/dist/state/WidgetState.d.ts.map +1 -1
- package/dist/state/WidgetState.js +5 -0
- package/dist/state/WidgetState.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/chat.d.ts +13 -0
- package/dist/utils/chat.d.ts.map +1 -1
- package/dist/utils/chat.js +14 -0
- package/dist/utils/chat.js.map +1 -1
- package/dist/utils/date.d.ts +25 -0
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +25 -0
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/download.d.ts +5 -0
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +5 -0
- package/dist/utils/download.js.map +1 -1
- package/dist/utils/knowledge-source.d.ts +10 -0
- package/dist/utils/knowledge-source.d.ts.map +1 -1
- package/dist/utils/knowledge-source.js +16 -0
- package/dist/utils/knowledge-source.js.map +1 -1
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +5 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/views/Agents.js +3 -0
- package/dist/views/Agents.js.map +1 -1
- package/dist/views/Chat/AgentInfo.d.ts +3 -0
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +3 -0
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts +17 -2
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +6 -32
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +3 -0
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +3 -0
- package/dist/views/Chat/ChatMessages.js.map +1 -1
- package/dist/views/Chat/chat-scroll.d.ts +1 -1
- package/dist/views/Chat/chat-scroll.js +1 -1
- package/dist/views/Chat/events.d.ts +22 -0
- package/dist/views/Chat/events.d.ts.map +1 -0
- package/dist/views/Chat/events.js +66 -0
- package/dist/views/Chat/events.js.map +1 -0
- package/dist/views/Chat/index.d.ts +6 -0
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +3 -0
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +3 -0
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +3 -0
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +3 -0
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +3 -0
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/index.d.ts +10 -2
- package/dist/views/ChatHistory/index.d.ts.map +1 -1
- package/dist/views/ChatHistory/index.js +3 -0
- package/dist/views/ChatHistory/index.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +14 -0
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +14 -0
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +3 -0
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +3 -0
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts +3 -0
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +4 -0
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home.d.ts +8 -0
- package/dist/views/Home.d.ts.map +1 -1
- package/dist/views/Home.js +5 -0
- package/dist/views/Home.js.map +1 -1
- package/dist/views/KSDocument.d.ts +3 -0
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +3 -0
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.js +3 -0
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/ButtonGroup.d.ts +22 -0
- package/dist/views/MessageInput/ButtonGroup.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonGroup.js +4 -0
- package/dist/views/MessageInput/ButtonGroup.js.map +1 -1
- package/dist/views/MessageInput/InfoBar.d.ts +7 -0
- package/dist/views/MessageInput/InfoBar.d.ts.map +1 -1
- package/dist/views/MessageInput/InfoBar.js +7 -0
- package/dist/views/MessageInput/InfoBar.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +7 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +4 -0
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +8 -0
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +5 -0
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts +4 -0
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +4 -0
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Stacks.d.ts +3 -0
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +3 -0
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Workspaces.d.ts +3 -0
- package/dist/views/Workspaces.d.ts.map +1 -1
- package/dist/views/Workspaces.js +3 -0
- package/dist/views/Workspaces.js.map +1 -1
- package/package.json +6 -6
- package/src/StackspotAIWidget.tsx +23 -2
- package/src/chat-interceptors/CustomInputs.ts +14 -1
- package/src/chat-interceptors/quick-command-questions.ts +12 -2
- package/src/chat-interceptors/quick-commands.ts +42 -3
- package/src/chat-interceptors/send-message.ts +18 -0
- package/src/components/Accordion.tsx +10 -0
- package/src/components/AdaptiveTextArea.tsx +12 -0
- package/src/components/AutoFocus.tsx +19 -5
- package/src/components/Fading.tsx +25 -5
- package/src/components/FadingOverflow.tsx +31 -3
- package/src/components/FallbackBoundary/index.tsx +6 -0
- package/src/components/HistoryList.tsx +15 -1
- package/src/components/IconInput.tsx +3 -0
- package/src/components/OverlayMenu.tsx +17 -1
- package/src/components/ProgressBar.tsx +23 -0
- package/src/components/QuickStartButton.tsx +3 -0
- package/src/components/RightPanelForm.tsx +3 -0
- package/src/components/RightPanelTabs.tsx +3 -0
- package/src/components/TabManager.tsx +8 -0
- package/src/components/Tooltip/Tooltip.tsx +23 -0
- package/src/components/Tooltip/TooltipAPI.ts +17 -0
- package/src/components/Tooltip/types.ts +13 -0
- package/src/components/form/DescribedCheckboxGroup.tsx +4 -0
- package/src/components/form/DescribedRadioGroup.tsx +4 -0
- package/src/components/form/types.ts +34 -0
- package/src/context/AIWidgetProvider.tsx +19 -0
- package/src/context/hooks.ts +56 -1
- package/src/features.ts +29 -0
- package/src/right-panel/DefaultPanel.tsx +12 -13
- package/src/right-panel/RightPanel.tsx +3 -0
- package/src/right-panel/RightPanelProvider.tsx +15 -0
- package/src/right-panel/hooks.tsx +6 -0
- package/src/state/ChatEntry.ts +60 -2
- package/src/state/ChatState.ts +74 -9
- package/src/state/ChatTabsController.ts +31 -0
- package/src/state/ObservableState.ts +14 -0
- package/src/state/WidgetState.ts +5 -0
- package/src/types.ts +10 -0
- package/src/utils/chat.ts +14 -0
- package/src/utils/date.ts +25 -1
- package/src/utils/download.ts +5 -0
- package/src/utils/knowledge-source.ts +16 -0
- package/src/utils/string.ts +5 -1
- package/src/views/Agents.tsx +3 -0
- package/src/views/Chat/AgentInfo.tsx +3 -0
- package/src/views/Chat/ChatMessage.tsx +21 -32
- package/src/views/Chat/ChatMessages.tsx +3 -0
- package/src/views/Chat/chat-scroll.ts +1 -1
- package/src/views/Chat/events.ts +69 -0
- package/src/views/Chat/index.tsx +6 -0
- package/src/views/ChatHistory/ChatHistoryPanel.tsx +3 -0
- package/src/views/ChatHistory/HistoryItem.tsx +3 -0
- package/src/views/ChatHistory/index.tsx +11 -1
- package/src/views/ChatHistory/utils.ts +14 -0
- package/src/views/ChatTabSelection.tsx +3 -0
- package/src/views/Editor.tsx +4 -0
- package/src/views/Home.tsx +8 -0
- package/src/views/KSDocument.tsx +3 -0
- package/src/views/KnowledgeSources.tsx +3 -0
- package/src/views/MessageInput/ButtonGroup.tsx +22 -0
- package/src/views/MessageInput/InfoBar.tsx +7 -0
- package/src/views/MessageInput/QuickCommandSelector.tsx +7 -0
- package/src/views/MessageInput/index.tsx +8 -0
- package/src/views/MinimizedHeader.tsx +4 -0
- package/src/views/Stacks.tsx +3 -0
- package/src/views/Workspaces.tsx +3 -0
|
@@ -2,6 +2,11 @@ import { agentClient, aiClient, workspaceClient } from '@stack-spot/portal-netwo
|
|
|
2
2
|
import { ChatProperties } from '../../state/ChatState'
|
|
3
3
|
import { LabeledWithImage } from '../../state/types'
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Finds a stack by its id.
|
|
7
|
+
* @param id the id of the stack.
|
|
8
|
+
* @returns the stack or undefined.
|
|
9
|
+
*/
|
|
5
10
|
export async function findStack(id: string | null): Promise<ChatProperties['stack'] | undefined> {
|
|
6
11
|
if (!id) return
|
|
7
12
|
try {
|
|
@@ -14,6 +19,11 @@ export async function findStack(id: string | null): Promise<ChatProperties['stac
|
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Finds a workspace by its id.
|
|
24
|
+
* @param id the id of the workspace.
|
|
25
|
+
* @returns the workspace or undefined.
|
|
26
|
+
*/
|
|
17
27
|
export async function findWorkspace(id: string | null): Promise<ChatProperties['workspace'] | undefined> {
|
|
18
28
|
if (!id) return
|
|
19
29
|
try {
|
|
@@ -26,6 +36,10 @@ export async function findWorkspace(id: string | null): Promise<ChatProperties['
|
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Finds all the agents, including common agents and public agents.
|
|
41
|
+
* @returns an array with every agent.
|
|
42
|
+
*/
|
|
29
43
|
export async function getAllAgents(): Promise<LabeledWithImage[]> {
|
|
30
44
|
try {
|
|
31
45
|
const [agents, publicAgents] = await Promise.all([agentClient.agents.query({}), agentClient.publicAgents.query({})])
|
|
@@ -17,6 +17,9 @@ const TabLabel = ({ id }: { id: string }) => {
|
|
|
17
17
|
return <div title={label}>{label}</div>
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* This renders the top-most part of the layout, which includes the chat selection through tabs.
|
|
22
|
+
*/
|
|
20
23
|
export const ChatTabSelection = ({ history, interceptors }: Props) => {
|
|
21
24
|
const t = useTranslate(dictionary)
|
|
22
25
|
const widget = useWidget()
|
package/src/views/Editor.tsx
CHANGED
|
@@ -42,6 +42,9 @@ const TitleBox = styled.div`
|
|
|
42
42
|
}
|
|
43
43
|
`
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Renders the Editor in the Right Panel if this is the panel that is currently opened.
|
|
47
|
+
*/
|
|
45
48
|
export const Editor = () => {
|
|
46
49
|
const t = useTranslate(dictionary)
|
|
47
50
|
const panel = useWidgetState('panel')
|
|
@@ -94,6 +97,7 @@ const EditorPanel = () => {
|
|
|
94
97
|
const selectedText = editor.getModel()?.getValueInRange(e.selection)
|
|
95
98
|
chat.set('codeSelection', selectedText?.trim() ? selectedText : undefined)
|
|
96
99
|
}, MIN_SELECTION_UPDATE_MS))
|
|
100
|
+
editor.focus()
|
|
97
101
|
}, [])
|
|
98
102
|
|
|
99
103
|
useEffect(() => () => {
|
package/src/views/Home.tsx
CHANGED
|
@@ -8,6 +8,9 @@ import { useCurrentChat } from '../context/hooks'
|
|
|
8
8
|
import { ChatEntry } from '../state/ChatEntry'
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
|
+
/**
|
|
12
|
+
* The name of the user currently logged in.
|
|
13
|
+
*/
|
|
11
14
|
username: string,
|
|
12
15
|
}
|
|
13
16
|
|
|
@@ -44,6 +47,11 @@ const HomeBox = styled.div`
|
|
|
44
47
|
}
|
|
45
48
|
`
|
|
46
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Renders the default home page for the chat. This shows up when no message has been sent yet.
|
|
52
|
+
*
|
|
53
|
+
* The home page can be replaced by providing children to the component `StackspotAIWidget`.
|
|
54
|
+
*/
|
|
47
55
|
export const Home = ({ username }: Props) => {
|
|
48
56
|
const t = useTranslate(dictionary)
|
|
49
57
|
const chat = useCurrentChat()
|
package/src/views/KSDocument.tsx
CHANGED
|
@@ -8,6 +8,9 @@ import { useWidget, useWidgetState } from '../context/hooks'
|
|
|
8
8
|
import { useRightPanel } from '../right-panel/hooks'
|
|
9
9
|
import { extractCodeFromKSDocument } from '../utils/knowledge-source'
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Renders the KS document in the Right Panel if this is the panel that is currently opened.
|
|
13
|
+
*/
|
|
11
14
|
export const KSDocument = () => {
|
|
12
15
|
const t = useTranslate(dictionary)
|
|
13
16
|
const panel = useWidgetState('panel')
|
|
@@ -35,6 +35,9 @@ export const KnowledgeSources = () => {
|
|
|
35
35
|
return null
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Renders the KS selection form in the Right Panel if this is the panel that is currently opened.
|
|
40
|
+
*/
|
|
38
41
|
const KnowledgeSourcesPanel = () => {
|
|
39
42
|
const t = useTranslate(dictionary)
|
|
40
43
|
const chat = useCurrentChat()
|
|
@@ -8,14 +8,36 @@ import { MessageInputFeatures } from '../../features'
|
|
|
8
8
|
import { useMessageInputDictionary } from './dictionary'
|
|
9
9
|
|
|
10
10
|
interface ButtonGroupProps {
|
|
11
|
+
/**
|
|
12
|
+
* The features enabled and accessible through the message input.
|
|
13
|
+
*/
|
|
11
14
|
features: MessageInputFeatures,
|
|
15
|
+
/**
|
|
16
|
+
* Whether or not the button group is expanded.
|
|
17
|
+
*/
|
|
12
18
|
expanded: boolean,
|
|
19
|
+
/**
|
|
20
|
+
* A function to set the button group as expanded or collapsed.
|
|
21
|
+
*/
|
|
13
22
|
setExpanded: React.Dispatch<React.SetStateAction<boolean>>,
|
|
23
|
+
/**
|
|
24
|
+
* Whether or not the message is currently being sent. This is used to decide which button to show: send or cancel.
|
|
25
|
+
*/
|
|
14
26
|
isLoading: boolean,
|
|
27
|
+
/**
|
|
28
|
+
* A function to run when the send button is clicked.
|
|
29
|
+
*/
|
|
15
30
|
onSend: () => void,
|
|
31
|
+
/**
|
|
32
|
+
* A function to run when the cancel button is clicked.
|
|
33
|
+
*/
|
|
16
34
|
onCancel: () => void,
|
|
17
35
|
}
|
|
18
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Renders the button group at right bottom side of the message input. This includes the send button as well as the buttons to open the
|
|
39
|
+
* editor, change the agent, the stack, etc.
|
|
40
|
+
*/
|
|
19
41
|
export const ButtonGroup = ({ features, onSend, onCancel, expanded, setExpanded, isLoading }: ButtonGroupProps) => {
|
|
20
42
|
const t = useMessageInputDictionary()
|
|
21
43
|
const widget = useWidget()
|
|
@@ -21,6 +21,13 @@ const InfoBadge = ({ label, color, dismiss, onDismiss }: InfoBadgeProps) => (
|
|
|
21
21
|
</Badge>
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* This renders the bar on top of the textarea to send the message. This tells:
|
|
26
|
+
* - if there's any code selected in the editor;
|
|
27
|
+
* - which workspace is being used;
|
|
28
|
+
* - which stack is being used;
|
|
29
|
+
* - which knowledge sources are being used.
|
|
30
|
+
*/
|
|
24
31
|
export const InfoBar = () => {
|
|
25
32
|
const t = useMessageInputDictionary()
|
|
26
33
|
const chat = useCurrentChat()
|
|
@@ -13,6 +13,9 @@ import { quickCommandRegex } from '../../regex'
|
|
|
13
13
|
import { getUrlToStackSpotAI } from '../../utils/url'
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
|
+
/**
|
|
17
|
+
* A reference to the input this quick commands panel is attached to.
|
|
18
|
+
*/
|
|
16
19
|
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -127,6 +130,10 @@ const SelectorContent = ({ filter, onClose, inputRef }: ContentProps) => {
|
|
|
127
130
|
)
|
|
128
131
|
}
|
|
129
132
|
|
|
133
|
+
/**
|
|
134
|
+
* This renders the floating Quick Commands panel that allows the user to select a quick command. This appears whenever the user types "/"
|
|
135
|
+
* in the textarea.
|
|
136
|
+
*/
|
|
130
137
|
export const QuickCommandSelector = ({ inputRef }: Props) => {
|
|
131
138
|
const value = useCurrentChatState('nextMessage') ?? ''
|
|
132
139
|
const filter = useMemo(() => value === '/' || quickCommandRegex.test(value) ? value.substring(1) : undefined, [value])
|
|
@@ -13,9 +13,17 @@ import { QuickCommandSelector } from './QuickCommandSelector'
|
|
|
13
13
|
import { MAX_INPUT_HEIGHT, MessageInputBox, MIN_INPUT_HEIGHT } from './styled'
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
|
+
/**
|
|
17
|
+
* The features enabled and accessible through the message input.
|
|
18
|
+
*/
|
|
16
19
|
features: MessageInputFeatures,
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
/**
|
|
23
|
+
* This renders the MessageInput part of the layout which includes the progress bar, the actual textarea, the badges telling what is
|
|
24
|
+
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
25
|
+
* Commands panel for auto completing.
|
|
26
|
+
*/
|
|
19
27
|
export const MessageInput = ({ features }: Props) => {
|
|
20
28
|
const t = useMessageInputDictionary()
|
|
21
29
|
const [focused, setFocused] = useState(false)
|
|
@@ -47,6 +47,10 @@ const Header = styled.header`
|
|
|
47
47
|
}
|
|
48
48
|
`
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* When the chat is minimized, there's no chat selection, i.e. the tabs are not rendered. In place of the tabs this header with the current
|
|
52
|
+
* chat name and buttons to collapse and close is rendered.
|
|
53
|
+
*/
|
|
50
54
|
export const MinimizedHeader = ({ onClose, onCollapse, onExpand }: MinimizedActions) => {
|
|
51
55
|
const t = useTranslate(dictionary)
|
|
52
56
|
const { active } = useChatTabs()
|
package/src/views/Stacks.tsx
CHANGED
|
@@ -11,6 +11,9 @@ import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
|
11
11
|
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks'
|
|
12
12
|
import { useRightPanel } from '../right-panel/hooks'
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Renders the Stack selection form in the Right Panel if this is the panel that is currently opened.
|
|
16
|
+
*/
|
|
14
17
|
export const Stacks = () => {
|
|
15
18
|
const t = useTranslate(dictionary)
|
|
16
19
|
const panel = useWidgetState('panel')
|
package/src/views/Workspaces.tsx
CHANGED
|
@@ -11,6 +11,9 @@ import { RightPanelForm } from '../components/RightPanelForm'
|
|
|
11
11
|
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks'
|
|
12
12
|
import { useRightPanel } from '../right-panel/hooks'
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Renders the Workspace selection form in the Right Panel if this is the panel that is currently opened.
|
|
16
|
+
*/
|
|
14
17
|
export const Workspaces = () => {
|
|
15
18
|
const t = useTranslate(dictionary)
|
|
16
19
|
const panel = useWidgetState('panel')
|