@stack-spot/ai-chat-widget 1.28.1-beta.2 → 1.28.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 +8 -0
- package/dist/app-metadata.json +3 -3
- package/dist/components/AdaptiveTextArea.js +1 -1
- package/dist/components/AdaptiveTextArea.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/Selector/index.d.ts +2 -2
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +3 -3
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +1 -1
- package/dist/components/Selector/styled.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 +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.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 +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/styled.d.ts +1 -1
- package/dist/views/MessageInput/styled.js +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/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/dictionary.ts +2 -4
- package/src/components/Selector/index.tsx +6 -5
- package/src/components/Selector/styled.ts +2 -2
- package/src/layout.css +0 -17
- package/src/state/types.ts +1 -1
- package/src/utils/tools.ts +7 -5
- package/src/utils/upload/UploadManager.ts +23 -32
- package/src/views/Agents/AgentDescription.tsx +25 -19
- package/src/views/Agents/AgentsPanel.tsx +12 -11
- package/src/views/Agents/AgentsTab.tsx +17 -12
- package/src/views/Agents/useAgentFavorites.ts +4 -4
- package/src/views/Chat/ChatMessage.tsx +3 -3
- 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/dictionary.ts +0 -9
- package/src/views/MessageInput/index.tsx +1 -15
- package/src/views/MessageInput/styled.ts +1 -1
- package/src/views/Tools.tsx +3 -4
- package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
- package/src/utils/upload/use-paste-upload.tsx +0 -30
- package/src/views/MessageInput/UploadDragNDrop.tsx +0 -83
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
interface UsePasteUploadProps {
|
|
4
|
-
textAreaRef: React.RefObject<HTMLTextAreaElement>,
|
|
5
|
-
onUploadFiles: (files: File[]) => void,
|
|
6
|
-
enabled?: boolean,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const usePasteUpload = ({
|
|
10
|
-
textAreaRef,
|
|
11
|
-
onUploadFiles,
|
|
12
|
-
enabled = true,
|
|
13
|
-
}: UsePasteUploadProps) => {
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const textarea = textAreaRef.current
|
|
16
|
-
if (!textarea || !enabled) return
|
|
17
|
-
|
|
18
|
-
const handlePaste = (e: ClipboardEvent) => {
|
|
19
|
-
if (e.clipboardData?.files?.length) {
|
|
20
|
-
onUploadFiles(Array.from(e.clipboardData.files))
|
|
21
|
-
e.preventDefault()
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
textarea.addEventListener('paste', handlePaste)
|
|
26
|
-
return () => {
|
|
27
|
-
textarea.removeEventListener('paste', handlePaste)
|
|
28
|
-
}
|
|
29
|
-
}, [onUploadFiles, textAreaRef, enabled])
|
|
30
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { IconBox } from '@citric/core'
|
|
2
|
-
import { Document } from '@citric/icons'
|
|
3
|
-
import { DragEvent, useCallback, useEffect, useState } from 'react'
|
|
4
|
-
import { useCurrentChat } from '../../context/hooks'
|
|
5
|
-
import { useMessageInputDictionary } from './dictionary'
|
|
6
|
-
|
|
7
|
-
export function useUploadDragDrop(containerSelector: string = '.chat-container') {
|
|
8
|
-
const [isDragging, setIsDragging] = useState(false)
|
|
9
|
-
const chat = useCurrentChat()
|
|
10
|
-
|
|
11
|
-
const handleDrop = useCallback((e: DragEvent) => {
|
|
12
|
-
e.preventDefault()
|
|
13
|
-
e.stopPropagation()
|
|
14
|
-
setIsDragging(false)
|
|
15
|
-
if (e.dataTransfer?.files?.length) {
|
|
16
|
-
chat.uploadManager.add(Array.from(e.dataTransfer.files))
|
|
17
|
-
}
|
|
18
|
-
}, [chat])
|
|
19
|
-
|
|
20
|
-
const handleDragLeave = useCallback((e: DragEvent) => {
|
|
21
|
-
e.preventDefault()
|
|
22
|
-
if (e.currentTarget && !e.currentTarget.contains(e.relatedTarget as Node)) {
|
|
23
|
-
setIsDragging(false)
|
|
24
|
-
}
|
|
25
|
-
}, [])
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
const container = document.querySelector(containerSelector) as HTMLDivElement | null
|
|
29
|
-
if (!container) return
|
|
30
|
-
|
|
31
|
-
const nativeHandleDragEnter = (e: Event) => {
|
|
32
|
-
e.preventDefault()
|
|
33
|
-
setIsDragging(true)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
container.addEventListener('dragenter', nativeHandleDragEnter)
|
|
37
|
-
return () => {
|
|
38
|
-
container.removeEventListener('dragenter', nativeHandleDragEnter)
|
|
39
|
-
}
|
|
40
|
-
}, [containerSelector])
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
isDragging,
|
|
44
|
-
handleDrop,
|
|
45
|
-
handleDragLeave,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface UploadDragNDropProps {
|
|
50
|
-
isDragging?: boolean,
|
|
51
|
-
onDrop?: (e: DragEvent) => void,
|
|
52
|
-
onDragLeave?: (e: DragEvent) => void,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const UploadDragNDrop = ({ isDragging, onDrop, onDragLeave }: UploadDragNDropProps) => {
|
|
56
|
-
const t = useMessageInputDictionary()
|
|
57
|
-
|
|
58
|
-
if (!isDragging) return null
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div
|
|
62
|
-
className="upload-drag-drop"
|
|
63
|
-
data-active={isDragging}
|
|
64
|
-
role="dialog"
|
|
65
|
-
aria-modal="true"
|
|
66
|
-
aria-labelledby="upload-drag-drop-title"
|
|
67
|
-
aria-describedby="upload-drag-drop-description"
|
|
68
|
-
onDrop={onDrop}
|
|
69
|
-
onDragLeave={onDragLeave}
|
|
70
|
-
onDragOver={e => {
|
|
71
|
-
e.preventDefault()
|
|
72
|
-
e.stopPropagation()
|
|
73
|
-
}}
|
|
74
|
-
tabIndex={-1}
|
|
75
|
-
>
|
|
76
|
-
<IconBox size="lg" aria-hidden={true}>
|
|
77
|
-
<Document />
|
|
78
|
-
</IconBox>
|
|
79
|
-
<h2 id="upload-drag-drop-title">{t.uploadDragDropTitle}</h2>
|
|
80
|
-
<p id="upload-drag-drop-description">{t.uploadDragDropDescription}</p>
|
|
81
|
-
</div>
|
|
82
|
-
)
|
|
83
|
-
}
|