@stack-spot/ai-chat-widget 1.31.2-beta.1 → 1.32.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 +25 -7
- package/dist/app-metadata.json +3 -3
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +16 -71
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/RightPanelContentList.d.ts +10 -0
- package/dist/components/RightPanelContentList.d.ts.map +1 -0
- package/dist/components/RightPanelContentList.js +7 -0
- package/dist/components/RightPanelContentList.js.map +1 -0
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +3 -2
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/features.d.ts +15 -0
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +1 -0
- package/dist/features.js.map +1 -1
- package/dist/layout.css +5 -1
- package/dist/state/constants.js +1 -1
- package/dist/state/constants.js.map +1 -1
- package/dist/views/Agents/AgentDescription.js +1 -1
- 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 +24 -15
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts +1 -1
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +3 -1
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +2 -1
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +24 -11
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +6 -2
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +9 -4
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/Stacks.d.ts +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +21 -11
- package/dist/views/Stacks.js.map +1 -1
- package/package.json +2 -2
- package/src/app-metadata.json +3 -3
- package/src/chat-interceptors/quick-commands.ts +18 -84
- package/src/components/RightPanelContentList.tsx +15 -0
- package/src/components/Selector/index.tsx +8 -6
- package/src/features.ts +17 -0
- package/src/index.ts +1 -0
- package/src/layout.css +5 -1
- package/src/state/constants.ts +1 -1
- package/src/views/Agents/AgentDescription.tsx +1 -1
- package/src/views/Agents/AgentsPanel.tsx +36 -17
- package/src/views/Agents/AgentsTab.tsx +1 -1
- package/src/views/ChatHistory/HistoryItem.tsx +2 -1
- package/src/views/KSDocument.tsx +2 -1
- package/src/views/KnowledgeSources.tsx +38 -14
- package/src/views/MessageInput/AgentSelector.tsx +9 -3
- package/src/views/MessageInput/QuickCommandSelector.tsx +18 -5
- package/src/views/Stacks.tsx +34 -14
package/src/views/Stacks.tsx
CHANGED
|
@@ -5,18 +5,22 @@ import { aiClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
|
5
5
|
import { GetAiStackResponse, VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
6
6
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
7
7
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
8
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
8
|
+
import { ReactElement, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
9
9
|
import { ButtonFavorite } from '../components/ButtonFavorite'
|
|
10
10
|
import { NavigationComponent } from '../components/ComponentNavigator'
|
|
11
11
|
import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup'
|
|
12
12
|
import { IconInput } from '../components/IconInput'
|
|
13
|
+
import { RightPanelContentList } from '../components/RightPanelContentList'
|
|
13
14
|
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
14
15
|
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator'
|
|
15
16
|
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks'
|
|
17
|
+
import { Scope } from '../features'
|
|
16
18
|
import { useRightPanel } from '../right-panel/hooks'
|
|
17
19
|
import { ChatProperties } from '../state/ChatState'
|
|
18
20
|
import { checkIsTrial } from '../utils/check-is-trial'
|
|
19
21
|
|
|
22
|
+
type TabElement = { title: string, content: ReactElement }
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* Renders the Stack selection form in the Right Panel if this is the panel that is currently opened.
|
|
22
26
|
*/
|
|
@@ -41,27 +45,43 @@ const StacksPanel = () => {
|
|
|
41
45
|
const chat = useCurrentChat()
|
|
42
46
|
const isTrial = checkIsTrial()
|
|
43
47
|
const stack = useRef(chat.get('stack'))
|
|
48
|
+
const features = useWidgetState('features')
|
|
49
|
+
const isGroupResourcesByScope = features?.groupResourcesByScope
|
|
50
|
+
const scopes = features?.scopes ?? []
|
|
51
|
+
const spotId = features?.workspaceId
|
|
44
52
|
|
|
45
53
|
useEffect(() => {
|
|
46
54
|
stack.current = chat.get('stack')
|
|
47
55
|
}, [chat])
|
|
48
56
|
|
|
49
|
-
const
|
|
50
|
-
{ title: t.favorites, content: <StacksTab key="favorites" visibility="favorite" stack={stack} /> },
|
|
51
|
-
{ title: t.personal, content: <StacksTab key="personal" visibility="personal" stack={stack} /> },
|
|
52
|
-
|
|
53
|
-
{ title: t.
|
|
54
|
-
{ title: t.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const allTabsMap: Partial<Record<Scope, TabElement>> = {
|
|
58
|
+
favorite: { title: t.favorites, content: <StacksTab key="favorites" visibility="favorite" stack={stack} /> },
|
|
59
|
+
personal: { title: t.personal, content: <StacksTab key="personal" visibility="personal" stack={stack} /> },
|
|
60
|
+
shared: { title: t.shared, content: <StacksTab key="shared" visibility="shared" stack={stack} /> },
|
|
61
|
+
workspace: { title: t.spots, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
|
|
62
|
+
account: { title: t.account, content: <StacksTab key="account" visibility="account" stack={stack} /> },
|
|
63
|
+
}
|
|
64
|
+
const defaultScopes: Scope[] = ['favorite', 'personal', 'shared', 'workspace', 'account']
|
|
65
|
+
|
|
66
|
+
const rawScopes: Scope[] = scopes?.length ? scopes : defaultScopes
|
|
67
|
+
|
|
68
|
+
const scopesToRender: Scope[] = isTrial
|
|
69
|
+
? ['favorite', 'personal']
|
|
70
|
+
: rawScopes
|
|
71
|
+
|
|
72
|
+
const tabs = scopesToRender
|
|
73
|
+
.map(scope => allTabsMap[scope])
|
|
74
|
+
.filter(Boolean) as TabElement[]
|
|
75
|
+
|
|
76
|
+
return (isGroupResourcesByScope ? (
|
|
77
|
+
<RightPanelTabs key={chat.id} tabs={tabs} />
|
|
78
|
+
) : (
|
|
79
|
+
<RightPanelContentList><StacksTab stack={stack} workspaceId={spotId} /></RightPanelContentList>
|
|
80
|
+
))
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
export interface StacksTabProps {
|
|
64
|
-
visibility
|
|
84
|
+
visibility?: VisibilityLevelEnum,
|
|
65
85
|
workspaceId?: string,
|
|
66
86
|
stack: React.MutableRefObject<ChatProperties['stack']>,
|
|
67
87
|
showSubmitButton?: boolean,
|