@memori.ai/memori-react 8.2.0 → 8.4.0-rc.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 +27 -0
- package/dist/components/Chat/Chat.js +8 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +166 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +3 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +115 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +104 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.d.ts +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js +50 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +4 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +78 -0
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.d.ts +12 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.js +22 -0
- package/dist/components/MemoriArtifactSystem/context/ArtifactSystemContext.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.d.ts +12 -0
- package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.js +288 -0
- package/dist/components/MemoriArtifactSystem/hooks/useArtifactSystem.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/index.d.ts +9 -0
- package/dist/components/MemoriArtifactSystem/index.js +28 -0
- package/dist/components/MemoriArtifactSystem/index.js.map +1 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.d.ts +108 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.js +31 -0
- package/dist/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
- package/dist/components/icons/Print.d.ts +6 -0
- package/dist/components/icons/Print.js +6 -0
- package/dist/components/icons/Print.js.map +1 -0
- package/dist/components/layouts/Chat.js +29 -1
- package/dist/components/layouts/Chat.js.map +1 -1
- package/dist/components/layouts/FullPage.js +33 -1
- package/dist/components/layouts/FullPage.js.map +1 -1
- package/dist/components/layouts/ZoomedFullBody.js +29 -2
- package/dist/components/layouts/ZoomedFullBody.js.map +1 -1
- package/dist/components/layouts/chat.css +335 -13
- package/dist/components/layouts/zoomed-full-body.css +1 -3
- package/dist/helpers/message.js +1 -0
- package/dist/helpers/message.js.map +1 -1
- package/dist/helpers/stt/useSTT.js +76 -9
- package/dist/helpers/stt/useSTT.js.map +1 -1
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -0
- package/esm/components/Chat/Chat.js +8 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.d.ts +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js +163 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.d.ts +3 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js +112 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.d.ts +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js +101 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.d.ts +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js +47 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.d.ts +4 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +75 -0
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.d.ts +12 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.js +17 -0
- package/esm/components/MemoriArtifactSystem/context/ArtifactSystemContext.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.d.ts +12 -0
- package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.js +281 -0
- package/esm/components/MemoriArtifactSystem/hooks/useArtifactSystem.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/index.d.ts +9 -0
- package/esm/components/MemoriArtifactSystem/index.js +9 -0
- package/esm/components/MemoriArtifactSystem/index.js.map +1 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.d.ts +108 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.js +28 -0
- package/esm/components/MemoriArtifactSystem/types/artifact.types.js.map +1 -0
- package/esm/components/icons/Print.d.ts +6 -0
- package/esm/components/icons/Print.js +4 -0
- package/esm/components/icons/Print.js.map +1 -0
- package/esm/components/layouts/Chat.js +29 -1
- package/esm/components/layouts/Chat.js.map +1 -1
- package/esm/components/layouts/FullPage.js +33 -1
- package/esm/components/layouts/FullPage.js.map +1 -1
- package/esm/components/layouts/ZoomedFullBody.js +30 -3
- package/esm/components/layouts/ZoomedFullBody.js.map +1 -1
- package/esm/components/layouts/chat.css +335 -13
- package/esm/components/layouts/zoomed-full-body.css +1 -3
- package/esm/helpers/message.js +1 -0
- package/esm/helpers/message.js.map +1 -1
- package/esm/helpers/stt/useSTT.js +76 -9
- package/esm/helpers/stt/useSTT.js.map +1 -1
- package/esm/index.js +58 -15
- package/esm/index.js.map +1 -1
- package/esm/styles.css +5 -0
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.test.tsx +13 -0
- package/src/components/Chat/Chat.stories.tsx +33 -2
- package/src/components/Chat/Chat.test.tsx +340 -213
- package/src/components/Chat/Chat.tsx +27 -4
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +160 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +278 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +877 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +308 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +238 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +282 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.css +319 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactHistory/ArtifactHistory.tsx +178 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +343 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +190 -0
- package/src/components/MemoriArtifactSystem/context/ArtifactSystemContext.tsx +57 -0
- package/src/components/MemoriArtifactSystem/hooks/useArtifactSystem.ts +419 -0
- package/src/components/MemoriArtifactSystem/index.ts +45 -0
- package/src/components/MemoriArtifactSystem/types/artifact.types.ts +180 -0
- package/src/components/icons/Print.tsx +34 -0
- package/src/components/layouts/Chat.test.tsx +13 -0
- package/src/components/layouts/Chat.tsx +80 -25
- package/src/components/layouts/FullPage.test.tsx +40 -11
- package/src/components/layouts/FullPage.tsx +92 -24
- package/src/components/layouts/HiddenChat.test.tsx +13 -0
- package/src/components/layouts/Totem.test.tsx +13 -0
- package/src/components/layouts/WebsiteAssistant.test.tsx +13 -0
- package/src/components/layouts/ZoomedFullBody.test.tsx +13 -0
- package/src/components/layouts/ZoomedFullBody.tsx +78 -14
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +252 -248
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +504 -496
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +252 -248
- package/src/components/layouts/chat.css +335 -13
- package/src/components/layouts/layouts.stories.tsx +13 -2
- package/src/components/layouts/zoomed-full-body.css +1 -3
- package/src/helpers/message.ts +1 -0
- package/src/helpers/stt/useSTT.ts +101 -16
- package/src/index.stories.tsx +26 -22
- package/src/index.tsx +46 -0
- package/src/mocks/data.ts +258 -0
- package/src/styles.css +5 -0
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
background: none;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.memori-widget > .memori-spin.memori-chat-layout
|
|
9
|
+
.memori-widget > .memori-spin.memori-chat-layout {
|
|
10
10
|
display: flex;
|
|
11
11
|
height: 100%;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.memori-chat-layout--main, .memori-chat-layout--controls{
|
|
16
|
+
min-height: calc(100% - 25px);
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
.memori-chat-layout--header {
|
|
16
20
|
text-align: right;
|
|
17
21
|
}
|
|
@@ -21,6 +25,98 @@
|
|
|
21
25
|
width: auto;
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
.memori-chat-layout-controls-hide{
|
|
29
|
+
display: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.memori-chat-layout-artifact-panel-full-screen{
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
flex:1 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
.memori-chat-layout--main {
|
|
40
|
+
position: relative;
|
|
41
|
+
display: flex;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
flex: 1;
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
/* max-width: 1200px; */
|
|
50
|
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.memori-chat-layout--main-with-artifact {
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
padding: 1rem;
|
|
56
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
57
|
+
backdrop-filter: blur(20px);
|
|
58
|
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
|
|
59
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
|
60
|
+
gap: 1rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.memori-chat-layout--controls {
|
|
64
|
+
position: relative;
|
|
65
|
+
z-index: 5;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
flex: 1;
|
|
69
|
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.memori-chat-layout--controls-with-artifact {
|
|
73
|
+
max-height: 100%;
|
|
74
|
+
flex: 0 0 50%;
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.memori-chat-layout--artifact-panel {
|
|
79
|
+
position: relative;
|
|
80
|
+
display: flex;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
width: 100%;
|
|
83
|
+
min-width: 0;
|
|
84
|
+
height: 100%;
|
|
85
|
+
flex: 0 0 50%;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
88
|
+
border-radius: 12px;
|
|
89
|
+
backdrop-filter: blur(20px);
|
|
90
|
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
|
|
91
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
92
|
+
opacity: 0;
|
|
93
|
+
transform: translateX(100%) scale(0.95);
|
|
94
|
+
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.memori-chat-layout--artifact-panel-enter {
|
|
98
|
+
animation: artifact-panel-slide-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
99
|
+
opacity: 1;
|
|
100
|
+
transform: translateX(0) scale(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes artifact-panel-slide-in {
|
|
104
|
+
0% {
|
|
105
|
+
opacity: 0;
|
|
106
|
+
transform: translateX(100%) scale(0.95);
|
|
107
|
+
}
|
|
108
|
+
50% {
|
|
109
|
+
opacity: 0.8;
|
|
110
|
+
transform: translateX(50%) scale(0.98);
|
|
111
|
+
}
|
|
112
|
+
100% {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
transform: translateX(0) scale(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
24
120
|
.memori-chat-layout .memori--avatar {
|
|
25
121
|
top: 0;
|
|
26
122
|
}
|
|
@@ -52,25 +148,17 @@
|
|
|
52
148
|
}
|
|
53
149
|
}
|
|
54
150
|
|
|
55
|
-
.memori-chat-layout--controls {
|
|
56
|
-
position: relative;
|
|
57
|
-
z-index: 5;
|
|
58
|
-
max-height: calc(100% - 50px);
|
|
59
|
-
flex: 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
151
|
.memori-chat-layout--controls .memori--start-panel,
|
|
63
152
|
.memori-chat-layout--controls .memori-chat--wrapper {
|
|
64
153
|
max-width: 1200px;
|
|
154
|
+
height: 100%;
|
|
155
|
+
min-height: calc(87vh - 1rem);
|
|
65
156
|
margin: 0 auto;
|
|
66
157
|
}
|
|
67
158
|
|
|
68
|
-
.memori-chat-layout--controls .memori--start-panel {
|
|
69
|
-
margin-top: 3rem;
|
|
70
|
-
}
|
|
71
159
|
|
|
72
160
|
.memori-chat-layout--controls .memori-chat--wrapper {
|
|
73
|
-
height: calc(
|
|
161
|
+
height: calc(87vh - 1rem);
|
|
74
162
|
}
|
|
75
163
|
|
|
76
164
|
.memori-chat-layout .memori-chat--content {
|
|
@@ -125,5 +213,239 @@
|
|
|
125
213
|
}
|
|
126
214
|
|
|
127
215
|
.memori-chat-layout .memori--global-background-image {
|
|
128
|
-
|
|
216
|
+
position: relative;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(200, 200, 200, 0.8) 100%);
|
|
219
|
+
transition: all 0.2s ease-in-out;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.memori-chat-layout .memori--global-background-image::before {
|
|
223
|
+
position: absolute;
|
|
224
|
+
top: 0;
|
|
225
|
+
right: 0;
|
|
226
|
+
bottom: 0;
|
|
227
|
+
left: 0;
|
|
228
|
+
animation: background-shimmer 4s ease-in-out infinite;
|
|
229
|
+
background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
|
|
230
|
+
background-size: 200% 200%;
|
|
231
|
+
content: '';
|
|
232
|
+
pointer-events: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes background-shimmer {
|
|
236
|
+
0%, 100% { background-position: 200% 200%; }
|
|
237
|
+
50% { background-position: -200% -200%; }
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Enhanced micro-interactions */
|
|
241
|
+
|
|
242
|
+
.memori-chat-layout--main:hover {
|
|
243
|
+
transform: translateY(-2px);
|
|
244
|
+
/* box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15); */
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
.memori-chat-layout--controls:hover {
|
|
249
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
|
250
|
+
transform: translateY(-1px);
|
|
129
251
|
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
.memori-chat-layout--artifact-panel:hover {
|
|
256
|
+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
|
257
|
+
transform: translateY(-1px) scale(1.01);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* Loading states */
|
|
261
|
+
.memori-chat-layout--loading {
|
|
262
|
+
position: relative;
|
|
263
|
+
overflow: hidden;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.memori-chat-layout--loading::before {
|
|
267
|
+
position: absolute;
|
|
268
|
+
z-index: 1;
|
|
269
|
+
top: 0;
|
|
270
|
+
left: -100%;
|
|
271
|
+
width: 100%;
|
|
272
|
+
height: 100%;
|
|
273
|
+
animation: loading-shimmer 1.5s infinite;
|
|
274
|
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
|
275
|
+
content: '';
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@keyframes loading-shimmer {
|
|
279
|
+
0% { left: -100%; }
|
|
280
|
+
100% { left: 100%; }
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Success animations */
|
|
284
|
+
.memori-chat-layout--success {
|
|
285
|
+
animation: success-pulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
@keyframes success-pulse {
|
|
289
|
+
0% { transform: scale(1); }
|
|
290
|
+
50% { transform: scale(1.02); }
|
|
291
|
+
100% { transform: scale(1); }
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* Error states */
|
|
295
|
+
.memori-chat-layout--error {
|
|
296
|
+
animation: error-shake 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@keyframes error-shake {
|
|
300
|
+
0%, 100% { transform: translateX(0); }
|
|
301
|
+
25% { transform: translateX(-4px); }
|
|
302
|
+
75% { transform: translateX(4px); }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* Focus states for accessibility */
|
|
306
|
+
.memori-chat-layout--controls:focus-within {
|
|
307
|
+
border-radius: 12px;
|
|
308
|
+
box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
|
|
309
|
+
outline: 2px solid #007bff;
|
|
310
|
+
outline-offset: 2px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/* High contrast mode support */
|
|
314
|
+
@media (prefers-contrast: high) {
|
|
315
|
+
.memori-chat-layout--main {
|
|
316
|
+
border: 2px solid #333;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.memori-chat-layout--controls {
|
|
320
|
+
border: 2px solid #333;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.memori-chat-layout--artifact-panel {
|
|
324
|
+
border: 2px solid #333;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* Reduced motion support */
|
|
329
|
+
@media (prefers-reduced-motion: reduce) {
|
|
330
|
+
.memori-chat-layout--main,
|
|
331
|
+
.memori-chat-layout--controls,
|
|
332
|
+
.memori-chat-layout--artifact-panel,
|
|
333
|
+
.memori-chat-layout--header {
|
|
334
|
+
animation: none;
|
|
335
|
+
transition: none;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.memori-chat-layout--main:hover {
|
|
339
|
+
transform: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.memori-chat-layout--controls:hover {
|
|
343
|
+
transform: none;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.memori-chat-layout--artifact-panel:hover {
|
|
347
|
+
transform: none;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.memori-chat-layout--artifact-panel-enter {
|
|
351
|
+
animation: none;
|
|
352
|
+
opacity: 1;
|
|
353
|
+
transform: translateX(0) scale(1);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
.memori-chat-layout--artifact-drawer {
|
|
359
|
+
position: fixed;
|
|
360
|
+
z-index: 1000;
|
|
361
|
+
top: 0;
|
|
362
|
+
right: 0;
|
|
363
|
+
bottom: 0;
|
|
364
|
+
left: 0;
|
|
365
|
+
pointer-events: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.memori-chat-layout--artifact-drawer .memori-artifact-drawer {
|
|
369
|
+
pointer-events: auto;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Mobile drawer animations */
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
.memori-chat-layout--artifact-drawer[data-headlessui-state~="open"] {
|
|
376
|
+
opacity: 1;
|
|
377
|
+
visibility: visible;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.memori-chat-layout--artifact-drawer[data-headlessui-state~="open"] .memori-artifact-drawer {
|
|
381
|
+
animation: mobile-drawer-slide-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
382
|
+
transform: translateX(0);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@keyframes mobile-drawer-slide-in {
|
|
386
|
+
0% {
|
|
387
|
+
opacity: 0;
|
|
388
|
+
transform: translateX(100%);
|
|
389
|
+
}
|
|
390
|
+
50% {
|
|
391
|
+
opacity: 0.8;
|
|
392
|
+
transform: translateX(50%);
|
|
393
|
+
}
|
|
394
|
+
100% {
|
|
395
|
+
opacity: 1;
|
|
396
|
+
transform: translateX(0);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* Adjust chat layout when drawer is open */
|
|
401
|
+
.memori-chat-layout:has(.memori-chat-layout--artifact-drawer .memori-artifact-drawer[data-headlessui-state~="open"]) .memori-chat-layout--controls {
|
|
402
|
+
margin-right: 50%;
|
|
403
|
+
filter: blur(1px);
|
|
404
|
+
opacity: 0.8;
|
|
405
|
+
transform: scale(0.98);
|
|
406
|
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.memori-chat-layout:has(.memori-chat-layout--artifact-drawer .memori-artifact-drawer[data-headlessui-state~="open"]) .memori-chat-layout--main {
|
|
410
|
+
backdrop-filter: blur(5px);
|
|
411
|
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(248, 250, 252, 0.02) 100%);
|
|
412
|
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* Mobile adjustments */
|
|
416
|
+
@media (max-width: 768px) {
|
|
417
|
+
.memori-chat-layout--main {
|
|
418
|
+
flex-direction: column !important;
|
|
419
|
+
padding: 0.5rem !important;
|
|
420
|
+
backdrop-filter: blur(10px) !important;
|
|
421
|
+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(248, 250, 252, 0.02) 100%) !important;
|
|
422
|
+
gap: 0.5rem !important;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.memori-chat-layout--artifact-panel {
|
|
426
|
+
display: none !important;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.memori-chat-layout--controls {
|
|
430
|
+
max-height: calc(100% - 50px) !important;
|
|
431
|
+
flex: 1 !important;
|
|
432
|
+
border: 1px solid rgba(255, 255, 255, 0.3) !important;
|
|
433
|
+
margin: 0 !important;
|
|
434
|
+
/* background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(248, 250, 252, 0.6) 100%) !important;
|
|
435
|
+
backdrop-filter: blur(20px) !important;
|
|
436
|
+
border-radius: 12px !important; */
|
|
437
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.memori-chat-layout:has(.memori-chat-layout--artifact-drawer .memori-artifact-drawer[data-headlessui-state~="open"]) .memori-chat-layout--controls {
|
|
441
|
+
margin-right: 0;
|
|
442
|
+
filter: blur(2px);
|
|
443
|
+
opacity: 0.7;
|
|
444
|
+
transform: scale(0.95);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.memori-chat-layout--artifact-drawer {
|
|
448
|
+
backdrop-filter: blur(12px) saturate(200%) !important;
|
|
449
|
+
background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 100%) !important;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
@@ -5,6 +5,7 @@ import Memori, { LayoutProps, Props } from '../MemoriWidget/MemoriWidget';
|
|
|
5
5
|
import I18nWrapper from '../../I18nWrapper';
|
|
6
6
|
import Spin from '../ui/Spin';
|
|
7
7
|
import { VisemeProvider } from '../../context/visemeContext';
|
|
8
|
+
import { ArtifactSystemProvider } from '../MemoriArtifactSystem';
|
|
8
9
|
|
|
9
10
|
const meta: Meta = {
|
|
10
11
|
title: 'General/Layouts',
|
|
@@ -26,9 +27,21 @@ export default meta;
|
|
|
26
27
|
|
|
27
28
|
const Template: Story<Props> = args => (
|
|
28
29
|
<I18nWrapper>
|
|
30
|
+
<ArtifactSystemProvider config={{
|
|
31
|
+
supportedMimeTypes: {
|
|
32
|
+
html: {
|
|
33
|
+
name: 'HTML',
|
|
34
|
+
icon: '🌐',
|
|
35
|
+
hasPreview: true,
|
|
36
|
+
language: 'html',
|
|
37
|
+
mimeType: 'text/html',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}}>
|
|
29
41
|
<VisemeProvider>
|
|
30
42
|
<Memori {...args} />
|
|
31
43
|
</VisemeProvider>
|
|
44
|
+
</ArtifactSystemProvider>
|
|
32
45
|
</I18nWrapper>
|
|
33
46
|
);
|
|
34
47
|
// By passing using the Args format for exported stories, you can control the props for a component for reuse in a test
|
|
@@ -267,8 +280,6 @@ export const CustomLayout: React.FC<LayoutProps> = ({
|
|
|
267
280
|
startPanelProps,
|
|
268
281
|
integrationStyle,
|
|
269
282
|
integrationBackground,
|
|
270
|
-
ChangeMode,
|
|
271
|
-
changeModeProps,
|
|
272
283
|
sessionId,
|
|
273
284
|
hasUserActivatedSpeak,
|
|
274
285
|
loading = false,
|
package/src/helpers/message.ts
CHANGED
|
@@ -87,6 +87,7 @@ export const renderMsg = (
|
|
|
87
87
|
/<document_attachment filename="([^"]+)" type="([^"]+)">([\s\S]*?)<\/document_attachment>/g,
|
|
88
88
|
''
|
|
89
89
|
)
|
|
90
|
+
.replaceAll(/<output\s+class\s*=\s*["\']memori-artifact["\'][^>]*data-mimetype\s*=\s*["\']([^"']+)["\'][^>]*>([\s\S]*?)(?:<\/output>|$)/gi, '')
|
|
90
91
|
.replaceAll(/```markdown([^```]+)```/g, '$1')
|
|
91
92
|
.replaceAll('($', '( $')
|
|
92
93
|
.replaceAll(':$', ': $')
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
// hooks/useSTT.ts
|
|
1
|
+
// hooks/useSTT.ts - Modified version for Azure WAV support
|
|
2
2
|
// Audio format compatibility:
|
|
3
3
|
// - MediaRecorder supports: webm, mp4, ogg formats
|
|
4
4
|
// - Azure STT supported formats:
|
|
5
|
-
// *
|
|
5
|
+
// * WAV format (required for Azure Speech SDK)
|
|
6
|
+
// * webm-16khz-16bit-mono-opus (for REST API)
|
|
6
7
|
// * webm-24khz-16bit-24kbps-mono-opus
|
|
7
8
|
// * webm-24khz-16bit-mono-opus
|
|
8
9
|
// - OpenAI: Supports multiple formats including webm, mp4, ogg
|
|
@@ -48,6 +49,76 @@ export interface UseSTTOptions {
|
|
|
48
49
|
*/
|
|
49
50
|
export type RecordingState = 'idle' | 'recording' | 'processing' | 'error';
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Convert audio blob to WAV format
|
|
54
|
+
*/
|
|
55
|
+
async function convertToWav(audioBlob: Blob): Promise<Blob> {
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
const audioContext = new (window.AudioContext || (window as any).webkitAudioContext)();
|
|
58
|
+
const fileReader = new FileReader();
|
|
59
|
+
|
|
60
|
+
fileReader.onload = async () => {
|
|
61
|
+
try {
|
|
62
|
+
const arrayBuffer = fileReader.result as ArrayBuffer;
|
|
63
|
+
const audioBuffer = await audioContext.decodeAudioData(arrayBuffer);
|
|
64
|
+
|
|
65
|
+
// Convert to WAV format
|
|
66
|
+
const wavBlob = audioBufferToWav(audioBuffer);
|
|
67
|
+
resolve(wavBlob);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
reject(error);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
fileReader.onerror = () => reject(new Error('Failed to read audio file'));
|
|
74
|
+
fileReader.readAsArrayBuffer(audioBlob);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Convert AudioBuffer to WAV Blob
|
|
80
|
+
*/
|
|
81
|
+
function audioBufferToWav(buffer: AudioBuffer): Blob {
|
|
82
|
+
const length = buffer.length;
|
|
83
|
+
const sampleRate = buffer.sampleRate;
|
|
84
|
+
const numberOfChannels = buffer.numberOfChannels;
|
|
85
|
+
const arrayBuffer = new ArrayBuffer(44 + length * numberOfChannels * 2);
|
|
86
|
+
const view = new DataView(arrayBuffer);
|
|
87
|
+
|
|
88
|
+
// WAV header
|
|
89
|
+
const writeString = (offset: number, string: string) => {
|
|
90
|
+
for (let i = 0; i < string.length; i++) {
|
|
91
|
+
view.setUint8(offset + i, string.charCodeAt(i));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
writeString(0, 'RIFF');
|
|
96
|
+
view.setUint32(4, 36 + length * numberOfChannels * 2, true);
|
|
97
|
+
writeString(8, 'WAVE');
|
|
98
|
+
writeString(12, 'fmt ');
|
|
99
|
+
view.setUint32(16, 16, true);
|
|
100
|
+
view.setUint16(20, 1, true);
|
|
101
|
+
view.setUint16(22, numberOfChannels, true);
|
|
102
|
+
view.setUint32(24, sampleRate, true);
|
|
103
|
+
view.setUint32(28, sampleRate * numberOfChannels * 2, true);
|
|
104
|
+
view.setUint16(32, numberOfChannels * 2, true);
|
|
105
|
+
view.setUint16(34, 16, true);
|
|
106
|
+
writeString(36, 'data');
|
|
107
|
+
view.setUint32(40, length * numberOfChannels * 2, true);
|
|
108
|
+
|
|
109
|
+
// Convert audio data
|
|
110
|
+
let offset = 44;
|
|
111
|
+
for (let i = 0; i < length; i++) {
|
|
112
|
+
for (let channel = 0; channel < numberOfChannels; channel++) {
|
|
113
|
+
const sample = Math.max(-1, Math.min(1, buffer.getChannelData(channel)[i]));
|
|
114
|
+
view.setInt16(offset, sample < 0 ? sample * 0x8000 : sample * 0x7FFF, true);
|
|
115
|
+
offset += 2;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return new Blob([arrayBuffer], { type: 'audio/wav' });
|
|
120
|
+
}
|
|
121
|
+
|
|
51
122
|
/**
|
|
52
123
|
* Unified hook for handling Speech-to-Text functionality
|
|
53
124
|
*/
|
|
@@ -80,9 +151,7 @@ export function useSTT(
|
|
|
80
151
|
const analyserRef = useRef<AnalyserNode | null>(null);
|
|
81
152
|
const dataArrayRef = useRef<Uint8Array | null>(null);
|
|
82
153
|
const apiUrl = options.apiUrl || '/api/stt';
|
|
83
|
-
const silenceTimeout = options.silenceTimeout || 2; // Default
|
|
84
|
-
|
|
85
|
-
// Replace the initializeRecording function in your useSTT.ts with this:
|
|
154
|
+
const silenceTimeout = options.silenceTimeout || 2; // Default 2 seconds
|
|
86
155
|
|
|
87
156
|
const initializeRecording = useCallback(async (): Promise<boolean> => {
|
|
88
157
|
try {
|
|
@@ -117,20 +186,22 @@ export function useSTT(
|
|
|
117
186
|
}
|
|
118
187
|
}
|
|
119
188
|
|
|
120
|
-
// Format selection based on provider
|
|
189
|
+
// Format selection based on provider
|
|
121
190
|
let mimeType = '';
|
|
122
191
|
|
|
123
192
|
if (config.provider === 'azure') {
|
|
124
|
-
|
|
193
|
+
// For Azure, we'll record in a supported format and convert to WAV
|
|
194
|
+
if (MediaRecorder.isTypeSupported('audio/webm;codecs=opus')) {
|
|
195
|
+
mimeType = 'audio/webm;codecs=opus';
|
|
196
|
+
} else if (MediaRecorder.isTypeSupported('audio/webm')) {
|
|
197
|
+
mimeType = 'audio/webm';
|
|
198
|
+
} else if (MediaRecorder.isTypeSupported('audio/mp4')) {
|
|
125
199
|
mimeType = 'audio/mp4';
|
|
126
200
|
} else if (MediaRecorder.isTypeSupported('audio/ogg;codecs=opus')) {
|
|
127
201
|
mimeType = 'audio/ogg;codecs=opus';
|
|
128
|
-
} else if (MediaRecorder.isTypeSupported('audio/ogg')) {
|
|
129
|
-
mimeType = 'audio/ogg';
|
|
130
|
-
} else if (MediaRecorder.isTypeSupported('audio/webm')) {
|
|
131
|
-
mimeType = 'audio/webm';
|
|
132
202
|
}
|
|
133
203
|
} else {
|
|
204
|
+
// For OpenAI, use the best available format
|
|
134
205
|
if (MediaRecorder.isTypeSupported('audio/webm;codecs=opus')) {
|
|
135
206
|
mimeType = 'audio/webm;codecs=opus';
|
|
136
207
|
} else if (MediaRecorder.isTypeSupported('audio/webm')) {
|
|
@@ -165,7 +236,7 @@ export function useSTT(
|
|
|
165
236
|
throw new Error('No audio data recorded');
|
|
166
237
|
}
|
|
167
238
|
|
|
168
|
-
|
|
239
|
+
let audioBlob = new Blob(chunksRef.current, {
|
|
169
240
|
type: mediaRecorder.mimeType,
|
|
170
241
|
});
|
|
171
242
|
|
|
@@ -173,6 +244,18 @@ export function useSTT(
|
|
|
173
244
|
throw new Error('Recorded audio is empty');
|
|
174
245
|
}
|
|
175
246
|
|
|
247
|
+
// Convert to WAV if using Azure
|
|
248
|
+
if (config.provider === 'azure') {
|
|
249
|
+
try {
|
|
250
|
+
console.log('Converting audio to WAV format for Azure');
|
|
251
|
+
audioBlob = await convertToWav(audioBlob);
|
|
252
|
+
console.log('Audio converted to WAV successfully');
|
|
253
|
+
} catch (conversionError) {
|
|
254
|
+
console.error('Failed to convert audio to WAV:', conversionError);
|
|
255
|
+
throw new Error('Failed to convert audio to WAV format for Azure');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
176
259
|
const result = await transcribeAudio(audioBlob);
|
|
177
260
|
|
|
178
261
|
if (processSpeechAndSendMessage) {
|
|
@@ -225,7 +308,7 @@ export function useSTT(
|
|
|
225
308
|
|
|
226
309
|
return false;
|
|
227
310
|
}
|
|
228
|
-
}, [config.provider, options, silenceTimeout]);
|
|
311
|
+
}, [config.provider, options, silenceTimeout]);
|
|
229
312
|
|
|
230
313
|
/**
|
|
231
314
|
* Detect if there's audio activity (not silence)
|
|
@@ -241,7 +324,6 @@ export function useSTT(
|
|
|
241
324
|
const average = dataArrayRef.current.reduce((sum, value) => sum + value, 0) / dataArrayRef.current.length;
|
|
242
325
|
|
|
243
326
|
// Consider audio active if average volume is above threshold
|
|
244
|
-
// Adjust this threshold based on your needs
|
|
245
327
|
const threshold = 10; // Adjust this value as needed
|
|
246
328
|
return average > threshold;
|
|
247
329
|
}, []);
|
|
@@ -306,7 +388,10 @@ export function useSTT(
|
|
|
306
388
|
const formData = new FormData();
|
|
307
389
|
let fileExtension = 'webm'; // default fallback
|
|
308
390
|
|
|
309
|
-
|
|
391
|
+
// Determine file extension based on provider and blob type
|
|
392
|
+
if (config.provider === 'azure') {
|
|
393
|
+
fileExtension = 'wav'; // We convert to WAV for Azure
|
|
394
|
+
} else if (mediaRecorderRef.current?.mimeType) {
|
|
310
395
|
if (mediaRecorderRef.current.mimeType.includes('webm')) {
|
|
311
396
|
fileExtension = 'webm';
|
|
312
397
|
} else if (mediaRecorderRef.current.mimeType.includes('mp4')) {
|
|
@@ -548,4 +633,4 @@ export function useSTT(
|
|
|
548
633
|
// Utils
|
|
549
634
|
cleanup,
|
|
550
635
|
};
|
|
551
|
-
}
|
|
636
|
+
}
|
package/src/index.stories.tsx
CHANGED
|
@@ -258,20 +258,20 @@ NunzioFiore.args = {
|
|
|
258
258
|
|
|
259
259
|
export const TestCustomAnimationsWithRPMSequence = Template.bind({});
|
|
260
260
|
TestCustomAnimationsWithRPMSequence.args = {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
261
|
+
memoriName: 'Dancing Avatar',
|
|
262
|
+
ownerUserName: 'andrea.patini3',
|
|
263
|
+
memoriID: '45420d30-a103-455c-bab1-b708a0566a02',
|
|
264
|
+
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
265
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
266
|
+
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
267
|
+
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
268
|
+
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
269
|
+
uiLang: 'IT',
|
|
270
|
+
spokenLang: 'IT',
|
|
271
|
+
layout: 'HIDDEN_CHAT',
|
|
272
|
+
showLogin: true,
|
|
273
|
+
autoStart: true,
|
|
274
|
+
integrationID: '2f6e11a0-d799-4974-aa17-cf111d0af82a',
|
|
275
275
|
};
|
|
276
276
|
|
|
277
277
|
export const TestCustomGLBSingleAnimation = Template.bind({});
|
|
@@ -397,12 +397,16 @@ WithCustomUserAvatar.args = {
|
|
|
397
397
|
|
|
398
398
|
export const Test = Template.bind({});
|
|
399
399
|
Test.args = {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
400
|
+
memoriName: 'Test Artifact',
|
|
401
|
+
ownerUserName: 'Andrea-Patini',
|
|
402
|
+
memoriID: '8cec936c-d440-4781-91df-e4ddf044255e',
|
|
403
|
+
ownerUserID: '91dbc9ba-b684-4fbe-9828-b5980af6cda9',
|
|
404
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
405
|
+
engineURL: 'https://engine-staging.memori.ai/memori/v2',
|
|
406
|
+
apiURL: 'https://backend-staging.memori.ai/api/v2',
|
|
407
|
+
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
408
|
+
layout: 'FULLPAGE',
|
|
409
|
+
uiLang: 'EN',
|
|
410
|
+
spokenLang: 'EN',
|
|
411
|
+
integrationID: '2b37c25d-8cf9-456f-b9ee-2c27dc4d54fc',
|
|
408
412
|
};
|