@stack-spot/ai-chat-widget 1.27.1 → 1.28.1-beta.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/CHANGELOG.md +7 -0
- 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 +19 -1
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/AgentCard/dictionary.d.ts +4 -2
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
- package/dist/components/AgentCard/dictionary.js +4 -2
- package/dist/components/AgentCard/dictionary.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/layout.css +17 -0
- 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 +3 -6
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/upload/UploadManager.d.ts +2 -0
- package/dist/utils/upload/UploadManager.d.ts.map +1 -1
- package/dist/utils/upload/UploadManager.js +32 -25
- package/dist/utils/upload/UploadManager.js.map +1 -1
- package/dist/utils/upload/use-paste-upload.d.ts +8 -0
- package/dist/utils/upload/use-paste-upload.d.ts.map +1 -0
- package/dist/utils/upload/use-paste-upload.js +19 -0
- package/dist/utils/upload/use-paste-upload.js.map +1 -0
- package/dist/views/Agents/AgentDescription.d.ts +2 -9
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +12 -9
- 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 +6 -6
- 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.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +3 -3
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +8 -5
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +0 -6
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +1 -16
- 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/QuickCommandSelector.js +4 -4
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts +14 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.js +52 -0
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -0
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +9 -0
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +13 -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 +3 -3
- package/src/chat-interceptors/quick-commands.ts +25 -3
- package/src/components/AgentCard/dictionary.ts +4 -2
- package/src/components/Selector/index.tsx +4 -5
- package/src/layout.css +17 -0
- package/src/state/types.ts +1 -1
- package/src/utils/tools.ts +5 -7
- package/src/utils/upload/UploadManager.ts +32 -23
- package/src/utils/upload/use-paste-upload.tsx +30 -0
- package/src/views/Agents/AgentDescription.tsx +19 -25
- package/src/views/Agents/AgentsPanel.tsx +11 -12
- package/src/views/Agents/AgentsTab.tsx +12 -17
- package/src/views/Agents/useAgentFavorites.ts +4 -4
- package/src/views/Chat/ChatMessage.tsx +3 -4
- package/src/views/ChatHistory/HistoryItem.tsx +10 -5
- package/src/views/ChatHistory/utils.ts +1 -18
- 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/QuickCommandSelector.tsx +4 -4
- package/src/views/MessageInput/UploadDragNDrop.tsx +83 -0
- package/src/views/MessageInput/dictionary.ts +9 -0
- package/src/views/MessageInput/index.tsx +17 -1
- package/src/views/Tools.tsx +4 -3
- package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
|
@@ -8,6 +8,7 @@ import { quickCommandRegex } from '../../regex'
|
|
|
8
8
|
import { ChatEntry } from '../../state/ChatEntry'
|
|
9
9
|
import { checkIsTrial } from '../../utils/check-is-trial'
|
|
10
10
|
import { UploadProvider } from '../../utils/upload/context'
|
|
11
|
+
import { usePasteUpload } from '../../utils/upload/use-paste-upload'
|
|
11
12
|
import { AgentSelector } from './AgentSelector'
|
|
12
13
|
import { ButtonAgent } from './ButtonAgent'
|
|
13
14
|
import { ButtonBar } from './ButtonBar'
|
|
@@ -17,6 +18,7 @@ import { useMessageInputDictionary } from './dictionary'
|
|
|
17
18
|
import { QuickCommandSelector } from './QuickCommandSelector'
|
|
18
19
|
import { MAX_INPUT_HEIGHT, MessageInputBox, MIN_INPUT_HEIGHT } from './styled'
|
|
19
20
|
import { UploadBar } from './UploadBar'
|
|
21
|
+
import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* This renders the MessageInput part of the layout which includes the progress bar, the actual textarea, the badges telling what is
|
|
@@ -36,6 +38,13 @@ export const MessageInput = () => {
|
|
|
36
38
|
const agentLabel = useCurrentChatState('agent')?.label
|
|
37
39
|
const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut()
|
|
38
40
|
const isTrial = checkIsTrial()
|
|
41
|
+
const { isDragging, handleDrop, handleDragLeave } = useUploadDragDrop()
|
|
42
|
+
|
|
43
|
+
usePasteUpload({
|
|
44
|
+
textAreaRef,
|
|
45
|
+
onUploadFiles: files => chat.uploadManager.add(files),
|
|
46
|
+
enabled: !isLoading,
|
|
47
|
+
})
|
|
39
48
|
|
|
40
49
|
const checkSendRequirements = useCallback(() => {
|
|
41
50
|
if (chat.uploadManager.status === 'error') {
|
|
@@ -112,7 +121,13 @@ export const MessageInput = () => {
|
|
|
112
121
|
<ButtonAgent />
|
|
113
122
|
<AdaptiveTextArea
|
|
114
123
|
ref={textAreaRef}
|
|
115
|
-
placeholder={
|
|
124
|
+
placeholder={
|
|
125
|
+
isDragging
|
|
126
|
+
? t.uploadDragging
|
|
127
|
+
: agentLabel
|
|
128
|
+
? interpolate(t.placeholder, agentLabel)
|
|
129
|
+
: t.typing
|
|
130
|
+
}
|
|
116
131
|
onChange={e => chat.set('nextMessage', e.target.value)}
|
|
117
132
|
value={value}
|
|
118
133
|
onFocus={() => setFocused(true)}
|
|
@@ -130,6 +145,7 @@ export const MessageInput = () => {
|
|
|
130
145
|
<ContextBar />
|
|
131
146
|
{chat.get('features').upload && <UploadBar />}
|
|
132
147
|
<ButtonBar onSend={onSend} isLoading={isLoading} />
|
|
148
|
+
<UploadDragNDrop isDragging={isDragging} onDrop={handleDrop} onDragLeave={handleDragLeave} />
|
|
133
149
|
</MessageInputBox>
|
|
134
150
|
</UploadProvider>
|
|
135
151
|
)
|
package/src/views/Tools.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { agentToolsClient } 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,8 +40,9 @@ 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
|
|
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])
|
|
45
46
|
|
|
46
47
|
return !!tools?.length && (
|
|
47
48
|
<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 })
|