@stack-spot/ai-chat-widget 1.25.1-beta.0 → 1.26.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 +7 -0
- package/dist/app-metadata.json +2 -2
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +9 -2
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/AgentCard/dictionary.d.ts +2 -4
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
- package/dist/components/AgentCard/dictionary.js +2 -4
- package/dist/components/AgentCard/dictionary.js.map +1 -1
- package/dist/components/FileDescription.js +4 -4
- package/dist/components/FileDescription.js.map +1 -1
- package/dist/components/Selector/index.d.ts +2 -2
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +2 -2
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/features.d.ts +12 -0
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +3 -0
- package/dist/features.js.map +1 -1
- package/dist/state/types.d.ts +1 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +2 -2
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +6 -3
- package/dist/utils/tools.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts +9 -2
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +9 -11
- 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 +11 -11
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts +2 -2
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +4 -4
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
- package/dist/views/Agents/useAgentFavorites.js +4 -4
- package/dist/views/Agents/useAgentFavorites.js.map +1 -1
- package/dist/views/Chat/ChatMessage.js +3 -3
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/styled.js +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +5 -8
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +6 -0
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +16 -1
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/Home/CustomAgent.js +3 -3
- package/dist/views/Home/CustomAgent.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +4 -4
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +2 -2
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/dist/views/MessageInput/SelectContent.js +12 -12
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/index.js +1 -1
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/Tools.js +3 -3
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +1 -1
- package/package.json +2 -2
- package/src/app-metadata.json +2 -2
- package/src/chat-interceptors/send-message.ts +9 -2
- package/src/components/AgentCard/dictionary.ts +2 -4
- package/src/components/FileDescription.tsx +4 -4
- package/src/components/Selector/index.tsx +5 -4
- package/src/features.ts +15 -0
- package/src/state/types.ts +1 -1
- package/src/utils/tools.ts +7 -5
- package/src/views/Agents/AgentDescription.tsx +25 -18
- package/src/views/Agents/AgentsPanel.tsx +12 -11
- package/src/views/Agents/AgentsTab.tsx +16 -8
- package/src/views/Agents/useAgentFavorites.ts +4 -4
- package/src/views/Chat/ChatMessage.tsx +3 -3
- package/src/views/Chat/styled.ts +1 -1
- package/src/views/ChatHistory/HistoryItem.tsx +5 -10
- package/src/views/ChatHistory/utils.ts +18 -1
- package/src/views/Home/CustomAgent.tsx +4 -4
- package/src/views/MessageInput/AgentSelector.tsx +4 -4
- package/src/views/MessageInput/ButtonAgent.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +16 -16
- package/src/views/MessageInput/index.tsx +1 -1
- package/src/views/Tools.tsx +3 -4
- package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
|
@@ -6,8 +6,8 @@ import { useCurrentChatState, useWidget } from '../../context/hooks'
|
|
|
6
6
|
import { useUploadManager } from '../../utils/upload/context'
|
|
7
7
|
import { useMessageInputDictionary } from './dictionary'
|
|
8
8
|
|
|
9
|
-
type
|
|
10
|
-
type
|
|
9
|
+
type ChatFeatures = 'workspace' | 'knowledgeSource' | 'stack'
|
|
10
|
+
type ChatPanel = 'ks' | 'workspace' | 'stack'
|
|
11
11
|
|
|
12
12
|
export const SelectContent = () => {
|
|
13
13
|
const widget = useWidget()
|
|
@@ -15,7 +15,7 @@ export const SelectContent = () => {
|
|
|
15
15
|
const features = useCurrentChatState('features')
|
|
16
16
|
const t = useMessageInputDictionary()
|
|
17
17
|
const uploadManager = useUploadManager()
|
|
18
|
-
const hasFeatureButtons = features.workspace || features.knowledgeSource || features.stack
|
|
18
|
+
const hasFeatureButtons = features.workspace || features.knowledgeSource || features.stack || features.upload
|
|
19
19
|
|
|
20
20
|
const itemConfigs = [
|
|
21
21
|
{
|
|
@@ -36,17 +36,25 @@ export const SelectContent = () => {
|
|
|
36
36
|
icon: <Spaces />,
|
|
37
37
|
panel: 'workspace',
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
key: 'upload',
|
|
41
|
+
label: t.upload,
|
|
42
|
+
onClick: () => uploadManager.open(),
|
|
43
|
+
className: 'upload-item',
|
|
44
|
+
icon: <DocumentUpload />,
|
|
45
|
+
},
|
|
39
46
|
]
|
|
40
47
|
|
|
41
48
|
const listItems = useMemo(() =>
|
|
42
|
-
itemConfigs.filter(chatFeatures => features[chatFeatures.key as
|
|
49
|
+
itemConfigs.filter(chatFeatures => features[chatFeatures.key as ChatFeatures])
|
|
43
50
|
.map(chatFeatures => ({
|
|
44
51
|
label: chatFeatures.label,
|
|
45
52
|
icon: chatFeatures.icon,
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
className: chatFeatures.className,
|
|
54
|
+
onClick: chatFeatures.panel ? (() => {
|
|
55
|
+
widget.set('panel', chatFeatures.panel as ChatPanel)
|
|
48
56
|
setVisibleMenu(false)
|
|
49
|
-
},
|
|
57
|
+
}) : chatFeatures.onClick,
|
|
50
58
|
})), [features, widget])
|
|
51
59
|
|
|
52
60
|
if (!hasFeatureButtons) return null
|
|
@@ -70,15 +78,7 @@ export const SelectContent = () => {
|
|
|
70
78
|
id="chatMessageMenu"
|
|
71
79
|
visible={visibleMenu}
|
|
72
80
|
onHide={() => setVisibleMenu(false)}
|
|
73
|
-
items={
|
|
74
|
-
...listItems,
|
|
75
|
-
{
|
|
76
|
-
label: t.upload,
|
|
77
|
-
onClick: () => uploadManager.open(),
|
|
78
|
-
className: 'upload-item',
|
|
79
|
-
icon: <DocumentUpload />,
|
|
80
|
-
},
|
|
81
|
-
]}
|
|
81
|
+
items={listItems}
|
|
82
82
|
/>
|
|
83
83
|
</>
|
|
84
84
|
)
|
|
@@ -128,7 +128,7 @@ export const MessageInput = () => {
|
|
|
128
128
|
<ProgressBar visible={true} animate={isLoading}
|
|
129
129
|
backgroundColor={isLoading || !focused ? theme.color.light[500] : theme.color.primary[500]} />
|
|
130
130
|
<ContextBar />
|
|
131
|
-
<UploadBar />
|
|
131
|
+
{chat.get('features').upload && <UploadBar />}
|
|
132
132
|
<ButtonBar onSend={onSend} isLoading={isLoading} />
|
|
133
133
|
</MessageInputBox>
|
|
134
134
|
</UploadProvider>
|
package/src/views/Tools.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { agentClient } from '@stack-spot/portal-network'
|
|
2
2
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
3
3
|
import { useEffect, useMemo } from 'react'
|
|
4
4
|
import styled from 'styled-components'
|
|
@@ -40,9 +40,8 @@ const ToolsPanel = () => {
|
|
|
40
40
|
const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
|
|
41
41
|
return chat?.getMessages().find(m => m.id === messageId)?.getValue()
|
|
42
42
|
}, [messageId])
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits) ?? { id }), [messageId, toolKits])
|
|
43
|
+
const [agent] = agentClient.agent.useStatefulQuery({ agentId: message?.agent?.id ?? '' }, { enabled: !!message?.agent?.id })
|
|
44
|
+
const tools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits) ?? { id }), [messageId, agent])
|
|
46
45
|
|
|
47
46
|
return !!tools?.length && (
|
|
48
47
|
<ToolList>
|
|
@@ -60,7 +60,7 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }: Omit<Ta
|
|
|
60
60
|
const handleNavigate = (resource: WorkspaceResource) => {
|
|
61
61
|
startTransition(() => {
|
|
62
62
|
if (resource.resourceType === 'agent')
|
|
63
|
-
navigate({ component: 'agent', props: { visibility: '
|
|
63
|
+
navigate({ component: 'agent', props: { visibility: 'WORKSPACE', agent, workspaceId, showSubmitButton }, fullScreen: true })
|
|
64
64
|
|
|
65
65
|
if (resource.resourceType === 'ks')
|
|
66
66
|
navigate({ component: 'ks', props: { visibility: 'workspace', allKS, workspaceId, showSubmitButton }, fullScreen: true })
|