@stack-spot/ai-chat-widget 1.25.1-beta.1 → 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.
Files changed (87) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/app-metadata.json +2 -2
  3. package/dist/chat-interceptors/send-message.d.ts.map +1 -1
  4. package/dist/chat-interceptors/send-message.js +9 -2
  5. package/dist/chat-interceptors/send-message.js.map +1 -1
  6. package/dist/components/AgentCard/dictionary.d.ts +2 -4
  7. package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
  8. package/dist/components/AgentCard/dictionary.js +2 -4
  9. package/dist/components/AgentCard/dictionary.js.map +1 -1
  10. package/dist/components/FileDescription.js +4 -4
  11. package/dist/components/FileDescription.js.map +1 -1
  12. package/dist/components/Selector/index.d.ts +2 -2
  13. package/dist/components/Selector/index.d.ts.map +1 -1
  14. package/dist/components/Selector/index.js +2 -2
  15. package/dist/components/Selector/index.js.map +1 -1
  16. package/dist/features.d.ts +12 -0
  17. package/dist/features.d.ts.map +1 -1
  18. package/dist/features.js +3 -0
  19. package/dist/features.js.map +1 -1
  20. package/dist/state/types.d.ts +1 -1
  21. package/dist/state/types.d.ts.map +1 -1
  22. package/dist/utils/tools.d.ts +2 -2
  23. package/dist/utils/tools.d.ts.map +1 -1
  24. package/dist/utils/tools.js +6 -3
  25. package/dist/utils/tools.js.map +1 -1
  26. package/dist/views/Agents/AgentDescription.d.ts +9 -2
  27. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  28. package/dist/views/Agents/AgentDescription.js +9 -11
  29. package/dist/views/Agents/AgentDescription.js.map +1 -1
  30. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  31. package/dist/views/Agents/AgentsPanel.js +11 -11
  32. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  33. package/dist/views/Agents/AgentsTab.d.ts +2 -2
  34. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  35. package/dist/views/Agents/AgentsTab.js +6 -6
  36. package/dist/views/Agents/AgentsTab.js.map +1 -1
  37. package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
  38. package/dist/views/Agents/useAgentFavorites.js +4 -4
  39. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  40. package/dist/views/Chat/ChatMessage.js +3 -3
  41. package/dist/views/Chat/ChatMessage.js.map +1 -1
  42. package/dist/views/Chat/styled.js +1 -1
  43. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  44. package/dist/views/ChatHistory/HistoryItem.js +5 -8
  45. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  46. package/dist/views/ChatHistory/utils.d.ts +6 -0
  47. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  48. package/dist/views/ChatHistory/utils.js +16 -1
  49. package/dist/views/ChatHistory/utils.js.map +1 -1
  50. package/dist/views/Home/CustomAgent.js +3 -3
  51. package/dist/views/Home/CustomAgent.js.map +1 -1
  52. package/dist/views/MessageInput/AgentSelector.js +4 -4
  53. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  54. package/dist/views/MessageInput/ButtonAgent.js +2 -2
  55. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  56. package/dist/views/MessageInput/SelectContent.js +12 -12
  57. package/dist/views/MessageInput/SelectContent.js.map +1 -1
  58. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  59. package/dist/views/MessageInput/index.js +1 -1
  60. package/dist/views/MessageInput/index.js.map +1 -1
  61. package/dist/views/Tools.js +3 -3
  62. package/dist/views/Tools.js.map +1 -1
  63. package/dist/views/Workspaces/WorkspacesTab.js +1 -1
  64. package/package.json +2 -2
  65. package/src/app-metadata.json +2 -2
  66. package/src/chat-interceptors/send-message.ts +9 -2
  67. package/src/components/AgentCard/dictionary.ts +2 -4
  68. package/src/components/FileDescription.tsx +4 -4
  69. package/src/components/Selector/index.tsx +5 -4
  70. package/src/features.ts +15 -0
  71. package/src/state/types.ts +1 -1
  72. package/src/utils/tools.ts +7 -5
  73. package/src/views/Agents/AgentDescription.tsx +25 -18
  74. package/src/views/Agents/AgentsPanel.tsx +12 -11
  75. package/src/views/Agents/AgentsTab.tsx +17 -12
  76. package/src/views/Agents/useAgentFavorites.ts +4 -4
  77. package/src/views/Chat/ChatMessage.tsx +3 -3
  78. package/src/views/Chat/styled.ts +1 -1
  79. package/src/views/ChatHistory/HistoryItem.tsx +5 -10
  80. package/src/views/ChatHistory/utils.ts +18 -1
  81. package/src/views/Home/CustomAgent.tsx +4 -4
  82. package/src/views/MessageInput/AgentSelector.tsx +4 -4
  83. package/src/views/MessageInput/ButtonAgent.tsx +2 -2
  84. package/src/views/MessageInput/SelectContent.tsx +16 -16
  85. package/src/views/MessageInput/index.tsx +1 -1
  86. package/src/views/Tools.tsx +3 -4
  87. 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 chatFeatures = 'workspace' | 'knowledgeSource' | 'stack'
10
- type chatPanel = 'ks' | 'workspace' | 'stack'
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 chatFeatures])
49
+ itemConfigs.filter(chatFeatures => features[chatFeatures.key as ChatFeatures])
43
50
  .map(chatFeatures => ({
44
51
  label: chatFeatures.label,
45
52
  icon: chatFeatures.icon,
46
- onClick: () => {
47
- widget.set('panel', chatFeatures.panel as chatPanel)
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>
@@ -1,4 +1,4 @@
1
- import { agentToolsClient } from '@stack-spot/portal-network'
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 [toolKits] = agentToolsClient.tools.useStatefulQuery({ enabled: !!message?.agent?.id })
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: 'workspace', agent, workspaceId, showSubmitButton }, fullScreen: true })
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 })