@memori.ai/memori-react 7.25.1 → 7.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 +35 -0
- package/dist/components/Chat/Chat.d.ts +5 -10
- package/dist/components/Chat/Chat.js +3 -3
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.css +10 -0
- package/dist/components/ChatBubble/ChatBubble.d.ts +1 -0
- package/dist/components/ChatBubble/ChatBubble.js +16 -20
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.d.ts +6 -10
- package/dist/components/ChatInputs/ChatInputs.js +37 -30
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/FilePreview/FilePreview.css +169 -140
- package/dist/components/FilePreview/FilePreview.d.ts +2 -6
- package/dist/components/FilePreview/FilePreview.js +58 -5
- package/dist/components/FilePreview/FilePreview.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +2 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +10 -18
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.css +506 -27
- package/dist/components/UploadButton/UploadButton.d.ts +14 -11
- package/dist/components/UploadButton/UploadButton.js +110 -288
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +19 -0
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +211 -0
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.d.ts +13 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.js +207 -0
- package/dist/components/UploadButton/UploadImages/UploadImages.js.map +1 -0
- package/dist/components/icons/Bug.d.ts +5 -0
- package/dist/components/icons/Bug.js +6 -0
- package/dist/components/icons/Bug.js.map +1 -0
- package/dist/components/icons/Document.d.ts +5 -0
- package/dist/components/icons/Document.js +10 -0
- package/dist/components/icons/Document.js.map +1 -0
- package/dist/components/icons/Image.d.ts +4 -0
- package/dist/components/icons/Image.js +9 -0
- package/dist/components/icons/Image.js.map +1 -0
- package/dist/components/icons/Preview.d.ts +4 -5
- package/dist/components/icons/Preview.js +5 -2
- package/dist/components/icons/Preview.js.map +1 -1
- package/dist/components/icons/Upload.d.ts +4 -5
- package/dist/components/icons/Upload.js +5 -2
- package/dist/components/icons/Upload.js.map +1 -1
- package/dist/components/layouts/HiddenChat.js +100 -10
- package/dist/components/layouts/HiddenChat.js.map +1 -1
- package/dist/components/layouts/hidden-chat.css +189 -119
- package/dist/locales/de.json +16 -0
- package/dist/locales/en.json +24 -0
- package/dist/locales/es.json +16 -0
- package/dist/locales/fr.json +16 -0
- package/dist/locales/it.json +22 -0
- package/esm/components/Chat/Chat.d.ts +5 -10
- package/esm/components/Chat/Chat.js +3 -3
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.css +10 -0
- package/esm/components/ChatBubble/ChatBubble.d.ts +1 -0
- package/esm/components/ChatBubble/ChatBubble.js +16 -20
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.d.ts +6 -10
- package/esm/components/ChatInputs/ChatInputs.js +37 -30
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/FilePreview/FilePreview.css +169 -140
- package/esm/components/FilePreview/FilePreview.d.ts +2 -6
- package/esm/components/FilePreview/FilePreview.js +58 -5
- package/esm/components/FilePreview/FilePreview.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +2 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +10 -18
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.css +506 -27
- package/esm/components/UploadButton/UploadButton.d.ts +14 -11
- package/esm/components/UploadButton/UploadButton.js +111 -289
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.d.ts +19 -0
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +208 -0
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.d.ts +13 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.js +204 -0
- package/esm/components/UploadButton/UploadImages/UploadImages.js.map +1 -0
- package/esm/components/icons/Bug.d.ts +5 -0
- package/esm/components/icons/Bug.js +4 -0
- package/esm/components/icons/Bug.js.map +1 -0
- package/esm/components/icons/Document.d.ts +5 -0
- package/esm/components/icons/Document.js +6 -0
- package/esm/components/icons/Document.js.map +1 -0
- package/esm/components/icons/Image.d.ts +4 -0
- package/esm/components/icons/Image.js +5 -0
- package/esm/components/icons/Image.js.map +1 -0
- package/esm/components/icons/Preview.d.ts +4 -5
- package/esm/components/icons/Preview.js +4 -3
- package/esm/components/icons/Preview.js.map +1 -1
- package/esm/components/icons/Upload.d.ts +4 -5
- package/esm/components/icons/Upload.js +4 -3
- package/esm/components/icons/Upload.js.map +1 -1
- package/esm/components/layouts/HiddenChat.js +101 -11
- package/esm/components/layouts/HiddenChat.js.map +1 -1
- package/esm/components/layouts/hidden-chat.css +189 -119
- package/esm/locales/de.json +16 -0
- package/esm/locales/en.json +24 -0
- package/esm/locales/es.json +16 -0
- package/esm/locales/fr.json +16 -0
- package/esm/locales/it.json +22 -0
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +8 -8
- package/src/components/ChatBubble/ChatBubble.css +10 -0
- package/src/components/ChatBubble/ChatBubble.stories.tsx +25 -0
- package/src/components/ChatBubble/ChatBubble.tsx +41 -17
- package/src/components/ChatInputs/ChatInputs.tsx +92 -43
- package/src/components/FilePreview/FilePreview.css +169 -140
- package/src/components/FilePreview/FilePreview.tsx +106 -14
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +146 -29
- package/src/components/MemoriWidget/MemoriWidget.tsx +7 -19
- package/src/components/UploadButton/UploadButton.css +506 -27
- package/src/components/UploadButton/UploadButton.stories.tsx +122 -20
- package/src/components/UploadButton/UploadButton.test.tsx +1 -1
- package/src/components/UploadButton/UploadButton.tsx +264 -454
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +352 -0
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +434 -0
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +140 -13
- package/src/components/icons/Bug.tsx +81 -0
- package/src/components/icons/Document.tsx +50 -0
- package/src/components/icons/Image.tsx +37 -0
- package/src/components/icons/Preview.tsx +28 -22
- package/src/components/icons/Upload.tsx +33 -22
- package/src/components/layouts/HiddenChat.tsx +143 -7
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +1 -1
- package/src/components/layouts/hidden-chat.css +189 -119
- package/src/index.stories.tsx +19 -19
- package/src/locales/de.json +16 -0
- package/src/locales/en.json +24 -0
- package/src/locales/es.json +16 -0
- package/src/locales/fr.json +16 -0
- package/src/locales/it.json +22 -0
|
@@ -1,155 +1,184 @@
|
|
|
1
|
-
|
|
2
|
-
min-width: 200px;
|
|
3
|
-
padding: 12px;
|
|
4
|
-
border-radius: 8px;
|
|
5
|
-
margin-bottom: 12px;
|
|
6
|
-
animation: slide-in 0.3s ease;
|
|
7
|
-
background: white;
|
|
8
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
9
|
-
transition: all 0.3s ease;
|
|
10
|
-
}
|
|
1
|
+
/* Updated FilePreview Styles */
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
3
|
+
.memori--preview-container {
|
|
4
|
+
min-width: 100%;
|
|
5
|
+
padding: 12px;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
margin-bottom: 12px;
|
|
8
|
+
animation: slide-in 0.3s ease;
|
|
9
|
+
background: white;
|
|
10
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
11
|
+
transition: all 0.3s ease;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.memori--preview-container.slide-down {
|
|
15
|
+
animation: slide-down 0.3s ease;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.memori--absolute-preview {
|
|
19
|
+
position: absolute;
|
|
20
|
+
bottom: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.memori--message-preview {
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
margin: 12px 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.memori--preview-list {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
overflow-x: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.memori--preview-item {
|
|
36
|
+
position: relative;
|
|
37
|
+
display: flex;
|
|
38
|
+
max-width: fit-content;
|
|
39
|
+
align-items: center;
|
|
40
|
+
padding: 8px;
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
animation: slide-in 0.3s ease;
|
|
43
|
+
background-color: #f8f9fa;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
transition: all 0.2s ease;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.memori--preview-item:hover {
|
|
50
|
+
background-color: #f1f3f5;
|
|
51
|
+
transform: translateX(4px);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.memori--preview-icon {
|
|
55
|
+
width: 20px;
|
|
56
|
+
height: 20px;
|
|
57
|
+
flex-shrink: 0;
|
|
58
|
+
color: #fff;
|
|
59
|
+
fill: var(--memori-primary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.memori--preview-file-info {
|
|
63
|
+
display: flex;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.memori--preview-filename {
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
max-width: 200px;
|
|
71
|
+
color: #495057;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
font-weight: 500;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.memori--preview-filetype {
|
|
79
|
+
margin-top: 2px;
|
|
80
|
+
color: #868e96;
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.memori--modal-title-preview {
|
|
85
|
+
margin-top: 12px;
|
|
86
|
+
margin-bottom: 12px;
|
|
87
|
+
font-size: 20px;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.memori--remove-button {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: -4px;
|
|
94
|
+
right: -4px;
|
|
95
|
+
padding: 4px;
|
|
96
|
+
border: none;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
background-color: #e03131;
|
|
99
|
+
color: white;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
opacity: 0;
|
|
102
|
+
transform: scale(0.75);
|
|
103
|
+
transition: all 0.2s ease;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.memori--remove-button.visible {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
transform: scale(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.memori--remove-button:hover {
|
|
112
|
+
background-color: #c92a2a;
|
|
113
|
+
transform: scale(1.1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.memori--remove-icon {
|
|
117
|
+
width: 12px;
|
|
118
|
+
height: 12px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.memori--modal-preview-file {
|
|
122
|
+
width: 100%;
|
|
123
|
+
max-width: 800px;
|
|
124
|
+
height: 100%;
|
|
125
|
+
padding: 12px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.memori--preview-content {
|
|
129
|
+
padding: 16px;
|
|
130
|
+
border-radius: 8px;
|
|
131
|
+
background-color: #f8f9fa;
|
|
132
|
+
font-family: monospace;
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
line-height: 1.5;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@keyframes fadeIn {
|
|
138
|
+
from { opacity: 0; }
|
|
139
|
+
to { opacity: 1; }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@keyframes scaleIn {
|
|
143
|
+
from {
|
|
85
144
|
opacity: 0;
|
|
86
|
-
transform: scale(0.
|
|
87
|
-
transition: all 0.2s ease;
|
|
145
|
+
transform: scale(0.95);
|
|
88
146
|
}
|
|
89
|
-
|
|
90
|
-
.memori--remove-button.visible {
|
|
147
|
+
to {
|
|
91
148
|
opacity: 1;
|
|
92
149
|
transform: scale(1);
|
|
93
150
|
}
|
|
151
|
+
}
|
|
94
152
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.memori--remove-icon {
|
|
101
|
-
width: 12px;
|
|
102
|
-
height: 12px;
|
|
153
|
+
@keyframes slide-up {
|
|
154
|
+
from {
|
|
155
|
+
opacity: 0;
|
|
156
|
+
transform: translateY(10px);
|
|
103
157
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
max-width: 800px;
|
|
108
|
-
height: 100%;
|
|
109
|
-
padding: 12px;
|
|
158
|
+
to {
|
|
159
|
+
opacity: 1;
|
|
160
|
+
transform: translateY(0);
|
|
110
161
|
}
|
|
162
|
+
}
|
|
111
163
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
164
|
+
@keyframes slide-in {
|
|
165
|
+
from {
|
|
166
|
+
opacity: 0;
|
|
167
|
+
transform: translateY(-10px);
|
|
115
168
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
opacity: 0;
|
|
120
|
-
transform: scale(0.95);
|
|
121
|
-
}
|
|
122
|
-
to {
|
|
123
|
-
opacity: 1;
|
|
124
|
-
transform: scale(1);
|
|
125
|
-
}
|
|
169
|
+
to {
|
|
170
|
+
opacity: 1;
|
|
171
|
+
transform: translateY(0);
|
|
126
172
|
}
|
|
173
|
+
}
|
|
127
174
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
to {
|
|
134
|
-
opacity: 1;
|
|
135
|
-
transform: translateY(0);
|
|
136
|
-
}
|
|
175
|
+
@keyframes slide-down {
|
|
176
|
+
from {
|
|
177
|
+
opacity: 1;
|
|
178
|
+
transform: translateY(0);
|
|
137
179
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
opacity: 0;
|
|
142
|
-
transform: translateY(-10px);
|
|
143
|
-
}
|
|
144
|
-
to {
|
|
145
|
-
opacity: 1;
|
|
146
|
-
transform: translateY(0);
|
|
147
|
-
}
|
|
180
|
+
to {
|
|
181
|
+
opacity: 0;
|
|
182
|
+
transform: translateY(10px);
|
|
148
183
|
}
|
|
149
|
-
|
|
150
|
-
@keyframes slide-down {
|
|
151
|
-
from {
|
|
152
|
-
opacity: 1;
|
|
153
|
-
transform: translateY(0);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
184
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
type FilePreviewProps = {
|
|
2
|
-
previewFiles:
|
|
3
|
-
|
|
4
|
-
id: string;
|
|
5
|
-
content: string;
|
|
6
|
-
}[];
|
|
7
|
-
removeFile: (id: string) => void;
|
|
2
|
+
previewFiles: any;
|
|
3
|
+
removeFile: (id: string, mediumID: string | undefined) => void;
|
|
8
4
|
allowRemove?: boolean;
|
|
9
5
|
isMessagePreview?: boolean;
|
|
10
6
|
};
|
|
@@ -3,19 +3,72 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const Document_1 = require("../icons/Document");
|
|
7
7
|
const Close_1 = tslib_1.__importDefault(require("../icons/Close"));
|
|
8
8
|
const Button_1 = tslib_1.__importDefault(require("../ui/Button"));
|
|
9
9
|
const Modal_1 = tslib_1.__importDefault(require("../ui/Modal"));
|
|
10
|
+
const utils_1 = require("../../helpers/utils");
|
|
10
11
|
const FilePreview = ({ previewFiles, removeFile, allowRemove = true, isMessagePreview = false, }) => {
|
|
11
12
|
const [selectedFile, setSelectedFile] = (0, react_1.useState)(null);
|
|
12
13
|
const [hoveredId, setHoveredId] = (0, react_1.useState)(null);
|
|
13
|
-
|
|
14
|
+
const getFileType = (filename, type) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
if (type === 'image') {
|
|
17
|
+
const extension = (_a = filename.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
18
|
+
switch (extension) {
|
|
19
|
+
case 'jpg':
|
|
20
|
+
case 'jpeg':
|
|
21
|
+
return 'JPEG';
|
|
22
|
+
case 'png':
|
|
23
|
+
return 'PNG';
|
|
24
|
+
default:
|
|
25
|
+
return 'Image';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const extension = (_b = filename.split('.').pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
29
|
+
switch (extension) {
|
|
30
|
+
case 'pdf':
|
|
31
|
+
return 'PDF';
|
|
32
|
+
case 'txt':
|
|
33
|
+
return 'Text';
|
|
34
|
+
case 'json':
|
|
35
|
+
return 'JSON';
|
|
36
|
+
case 'xlsx':
|
|
37
|
+
return 'Excel';
|
|
38
|
+
case 'csv':
|
|
39
|
+
return 'CSV';
|
|
40
|
+
case 'jpg':
|
|
41
|
+
case 'jpeg':
|
|
42
|
+
return 'JPEG';
|
|
43
|
+
case 'png':
|
|
44
|
+
return 'PNG';
|
|
45
|
+
default:
|
|
46
|
+
return 'Document';
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const isImageContent = (content, type) => {
|
|
50
|
+
if (type === 'image')
|
|
51
|
+
return true;
|
|
52
|
+
const hasImageExtension = /\.(jpg|jpeg|png|gif|webp|svg)$/i.test(content);
|
|
53
|
+
const isImageUrl = content.startsWith('http') &&
|
|
54
|
+
(content.includes('/image/') ||
|
|
55
|
+
content.includes('/img/') ||
|
|
56
|
+
hasImageExtension);
|
|
57
|
+
return isImageUrl || hasImageExtension;
|
|
58
|
+
};
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [previewFiles.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: `memori--preview-container ${isMessagePreview
|
|
14
60
|
? 'memori--message-preview'
|
|
15
|
-
: 'memori--absolute-preview'}`, children: (0, jsx_runtime_1.jsx)("div", { className: "memori--preview-list", children: previewFiles.map(file => ((0, jsx_runtime_1.jsxs)("div", { className:
|
|
61
|
+
: 'memori--absolute-preview'}`, children: (0, jsx_runtime_1.jsx)("div", { className: "memori--preview-list", children: previewFiles.map((file) => ((0, jsx_runtime_1.jsxs)("div", { className: `memori--preview-item ${isImageContent(file.content, file.type)
|
|
62
|
+
? 'memori--preview-item--image'
|
|
63
|
+
: 'memori--preview-item--document'}`, onMouseEnter: () => setHoveredId(file.id), onMouseLeave: () => setHoveredId(null), onClick: () => setSelectedFile(file), children: [isImageContent(file.content, file.type) ? ((0, jsx_runtime_1.jsx)("div", { className: "memori--preview-thumbnail", children: (0, jsx_runtime_1.jsx)("img", { src: file.content, alt: file.name }) })) : ((0, jsx_runtime_1.jsx)(Document_1.DocumentIcon, { className: "memori--preview-icon" })), (0, jsx_runtime_1.jsxs)("div", { className: "memori--preview-file-info", children: [(0, jsx_runtime_1.jsx)("span", { className: "memori--preview-filename", children: file.name }), (0, jsx_runtime_1.jsx)("span", { className: "memori--preview-filetype", children: getFileType(file.name, file.type) })] }), allowRemove && ((0, jsx_runtime_1.jsx)(Button_1.default, { shape: "rounded", icon: (0, jsx_runtime_1.jsx)(Close_1.default, {}), danger: true, className: `memori--remove-button ${hoveredId === file.id ? 'visible' : ''}`, onClick: e => {
|
|
16
64
|
e.stopPropagation();
|
|
17
|
-
removeFile(file.id);
|
|
18
|
-
} }))] }, file.id))) }) })), (0, jsx_runtime_1.jsx)(Modal_1.default, { width: "80%", widthMd: "80%", open: !!selectedFile, className: "memori--modal-preview-file", onClose: () => setSelectedFile(null), closable: true, title: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name, children: (0, jsx_runtime_1.jsx)("div", { className: "memori--preview-content", style: {
|
|
65
|
+
removeFile(file.id, file === null || file === void 0 ? void 0 : file.mediumID);
|
|
66
|
+
} }))] }, file.id))) }) })), (0, jsx_runtime_1.jsx)(Modal_1.default, { width: "80%", widthMd: "80%", open: !!selectedFile, className: "memori--modal-preview-file", onClose: () => setSelectedFile(null), closable: true, title: selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.name, children: (0, jsx_runtime_1.jsx)("div", { className: "memori--preview-content", style: {
|
|
67
|
+
maxHeight: '70vh',
|
|
68
|
+
overflowY: 'auto',
|
|
69
|
+
textAlign: 'center',
|
|
70
|
+
whiteSpace: selectedFile && !isImageContent(selectedFile.content, selectedFile.type) ? 'pre-wrap' : 'normal'
|
|
71
|
+
}, children: selectedFile && isImageContent(selectedFile.content, selectedFile.type) ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("img", { src: selectedFile.content, alt: selectedFile.name, style: { maxWidth: '100%', maxHeight: '60vh' } }) })) : ((0, utils_1.stripHTML)((selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.content) || '')) }) })] }));
|
|
19
72
|
};
|
|
20
73
|
exports.default = FilePreview;
|
|
21
74
|
//# sourceMappingURL=FilePreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePreview.js","sourceRoot":"","sources":["../../../src/components/FilePreview/FilePreview.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwC;
|
|
1
|
+
{"version":3,"file":"FilePreview.js","sourceRoot":"","sources":["../../../src/components/FilePreview/FilePreview.tsx"],"names":[],"mappings":";;;;AAAA,iCAAwC;AAExC,gDAAiD;AAEjD,mEAAuC;AACvC,kEAAkC;AAClC,gEAAgC;AAChC,+CAAgD;AAShD,MAAM,WAAW,GAAG,CAAC,EACnB,YAAY,EACZ,UAAU,EACV,WAAW,GAAG,IAAI,EAClB,gBAAgB,GAAG,KAAK,GACP,EAAE,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,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zB,GAAG,EAAE,YAAY,CAAC,IAAI,EACtB,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAChD,GACC,CACJ,CAAC,CAAC,CAAC,CACF,IAAA,iBAAS,EAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,KAAI,EAAE,CAAC,CACvC,GACG,GACA,IACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -116,6 +116,7 @@ export interface Props {
|
|
|
116
116
|
useMathFormatting?: boolean;
|
|
117
117
|
autoStart?: boolean;
|
|
118
118
|
applyVarsToRoot?: boolean;
|
|
119
|
+
showFunctionCache?: boolean;
|
|
119
120
|
}
|
|
120
|
-
declare const MemoriWidget: ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview, embed, showCopyButton, showTranslationOriginal, showInputs, showDates, showContextPerLine, showSettings, showTypingText, showClear, showLogin, showUpload, showOnlyLastMessages, height, secret, baseUrl, apiURL, engineURL, initialContextVars, initialQuestion, ogImage, sessionID: initialSessionID, tenant, personification, authToken, AZURE_COGNITIVE_SERVICES_TTS_KEY, enableAudio, defaultSpeakerActive, disableTextEnteredEvents, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting, autoStart, applyVarsToRoot, }: Props) => JSX.Element;
|
|
121
|
+
declare const MemoriWidget: ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview, embed, showCopyButton, showTranslationOriginal, showInputs, showDates, showContextPerLine, showSettings, showTypingText, showClear, showLogin, showUpload, showOnlyLastMessages, height, secret, baseUrl, apiURL, engineURL, initialContextVars, initialQuestion, ogImage, sessionID: initialSessionID, tenant, personification, authToken, AZURE_COGNITIVE_SERVICES_TTS_KEY, enableAudio, defaultSpeakerActive, disableTextEnteredEvents, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting, autoStart, applyVarsToRoot, showFunctionCache, }: Props) => JSX.Element;
|
|
121
122
|
export default MemoriWidget;
|
|
@@ -160,7 +160,7 @@ let memoriPassword;
|
|
|
160
160
|
let speakerMuted = false;
|
|
161
161
|
let memoriSpeaking = false;
|
|
162
162
|
let userToken;
|
|
163
|
-
const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, height = '100vh', secret, baseUrl = 'https://aisuru.com', apiURL = 'https://backend.memori.ai', engineURL = 'https://engine.memori.ai', initialContextVars, initialQuestion, ogImage, sessionID: initialSessionID, tenant, personification, authToken, AZURE_COGNITIVE_SERVICES_TTS_KEY, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, }) => {
|
|
163
|
+
const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenantID, memoriLang, multilingual, integration, layout, customLayout, showShare, preview = false, embed = false, showCopyButton = true, showTranslationOriginal = false, showInputs = true, showDates = false, showContextPerLine = false, showSettings, showTypingText = false, showClear = false, showLogin = false, showUpload, showOnlyLastMessages, height = '100vh', secret, baseUrl = 'https://aisuru.com', apiURL = 'https://backend.memori.ai', engineURL = 'https://engine.memori.ai', initialContextVars, initialQuestion, ogImage, sessionID: initialSessionID, tenant, personification, authToken, AZURE_COGNITIVE_SERVICES_TTS_KEY, enableAudio, defaultSpeakerActive = true, disableTextEnteredEvents = false, onStateChange, additionalInfo, additionalSettings, customMediaRenderer, userAvatar, useMathFormatting = false, autoStart = false, applyVarsToRoot = false, showFunctionCache = false, }) => {
|
|
164
164
|
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
165
165
|
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
166
166
|
const [isClient, setIsClient] = (0, react_1.useState)(false);
|
|
@@ -341,7 +341,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
341
341
|
});
|
|
342
342
|
};
|
|
343
343
|
const sendMessage = async (text, media, newSessionId, translate = true, translatedText, hidden = false, typingText, useLoaderTextAsMsg = false, hasBatchQueued = false) => {
|
|
344
|
-
var _a, _b, _c, _d, _f
|
|
344
|
+
var _a, _b, _c, _d, _f;
|
|
345
345
|
const sessionID = newSessionId ||
|
|
346
346
|
sessionId ||
|
|
347
347
|
((_a = window.getMemoriState()) === null || _a === void 0 ? void 0 : _a.sessionID);
|
|
@@ -369,8 +369,9 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
369
369
|
const translation = await (0, translations_1.getTranslation)(text, language, userLang, baseUrl);
|
|
370
370
|
msg = translation.text;
|
|
371
371
|
}
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
const findMediaDocument = media === null || media === void 0 ? void 0 : media.find(m => { var _a; return !m.mediumID && ((_a = m.properties) === null || _a === void 0 ? void 0 : _a.isAttachedFile); });
|
|
373
|
+
if (findMediaDocument) {
|
|
374
|
+
msg = msg + ' ' + findMediaDocument.content;
|
|
374
375
|
}
|
|
375
376
|
const { currentState, ...response } = await postTextEnteredEvent({
|
|
376
377
|
sessionId: sessionID,
|
|
@@ -379,7 +380,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
379
380
|
if (response.resultCode === 0 && currentState) {
|
|
380
381
|
const emission = useLoaderTextAsMsg && typingText
|
|
381
382
|
? typingText
|
|
382
|
-
: (
|
|
383
|
+
: (_b = currentState.emission) !== null && _b !== void 0 ? _b : currentDialogState === null || currentDialogState === void 0 ? void 0 : currentDialogState.emission;
|
|
383
384
|
if (userLang.toLowerCase() !== language.toLowerCase() &&
|
|
384
385
|
emission &&
|
|
385
386
|
isMultilanguageEnabled) {
|
|
@@ -399,7 +400,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
399
400
|
pushMessage({
|
|
400
401
|
text: emission,
|
|
401
402
|
emitter: currentState.emitter,
|
|
402
|
-
media: (
|
|
403
|
+
media: (_c = currentState.emittedMedia) !== null && _c !== void 0 ? _c : currentState.media,
|
|
403
404
|
fromUser: false,
|
|
404
405
|
questionAnswered: msg,
|
|
405
406
|
generatedByAI: !!currentState.completion,
|
|
@@ -420,7 +421,7 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
420
421
|
setHistory(h => [...h.slice(0, h.length - 1)]);
|
|
421
422
|
reopenSession(false, memoriPwd || memori.secretToken, memoriTokens, undefined, undefined, {
|
|
422
423
|
PATHNAME: window.location.pathname,
|
|
423
|
-
ROUTE: ((
|
|
424
|
+
ROUTE: ((_f = (_d = window.location.pathname) === null || _d === void 0 ? void 0 : _d.split('/')) === null || _f === void 0 ? void 0 : _f.pop()) || '',
|
|
424
425
|
...(initialContextVars || {}),
|
|
425
426
|
}, initialQuestion).then(state => {
|
|
426
427
|
console.info('session timeout');
|
|
@@ -2293,22 +2294,13 @@ const MemoriWidget = ({ memori, memoriConfigs, ownerUserID, ownerUserName, tenan
|
|
|
2293
2294
|
setAttachmentsMenuOpen,
|
|
2294
2295
|
showInputs,
|
|
2295
2296
|
showMicrophone: !!AZURE_COGNITIVE_SERVICES_TTS_KEY,
|
|
2297
|
+
showFunctionCache,
|
|
2296
2298
|
userMessage,
|
|
2297
2299
|
onChangeUserMessage,
|
|
2298
2300
|
sendMessage: (msg, media) => {
|
|
2299
2301
|
stopAudio();
|
|
2300
2302
|
stopListening();
|
|
2301
|
-
sendMessage(msg, media
|
|
2302
|
-
? [
|
|
2303
|
-
{
|
|
2304
|
-
mediumID: media.mediumID,
|
|
2305
|
-
mimeType: media.mimeType,
|
|
2306
|
-
content: media.content,
|
|
2307
|
-
title: media.title,
|
|
2308
|
-
properties: media.properties,
|
|
2309
|
-
},
|
|
2310
|
-
]
|
|
2311
|
-
: undefined);
|
|
2303
|
+
sendMessage(msg, media);
|
|
2312
2304
|
setUserMessage('');
|
|
2313
2305
|
resetTranscript();
|
|
2314
2306
|
},
|