@memori.ai/memori-react 6.7.2 → 6.8.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 +22 -0
- package/README.md +1 -1
- package/dist/I18nWrapper.js +21 -3
- package/dist/I18nWrapper.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.js +17 -12
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +19 -6
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/helpers/constants.js +3 -0
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -0
- package/dist/helpers/utils.js +28 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/index.js +51 -29
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -2
- package/esm/I18nWrapper.js +21 -3
- package/esm/I18nWrapper.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +17 -12
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +20 -7
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/helpers/constants.js +3 -0
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/utils.d.ts +2 -0
- package/esm/helpers/utils.js +25 -0
- package/esm/helpers/utils.js.map +1 -1
- package/esm/index.js +51 -29
- package/esm/index.js.map +1 -1
- package/esm/styles.css +2 -2
- package/package.json +1 -1
- package/src/I18nWrapper.tsx +21 -3
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +110 -99
- package/src/components/ChatBubble/ChatBubble.stories.tsx +39 -0
- package/src/components/ChatBubble/ChatBubble.tsx +32 -20
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +33 -33
- package/src/components/MemoriWidget/MemoriWidget.tsx +27 -7
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +18 -0
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +18 -0
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +18 -0
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +18 -0
- package/src/helpers/constants.ts +3 -0
- package/src/helpers/utils.test.ts +78 -1
- package/src/helpers/utils.ts +40 -0
- package/src/index.tsx +53 -37
- package/src/styles.css +2 -2
package/src/index.tsx
CHANGED
|
@@ -207,6 +207,59 @@ const Memori: React.FC<Props> = ({
|
|
|
207
207
|
}
|
|
208
208
|
}, [uiLang]);
|
|
209
209
|
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
window.MathJax = {
|
|
213
|
+
startup: {
|
|
214
|
+
elements: ['.memori-chat--bubble-content'],
|
|
215
|
+
},
|
|
216
|
+
options: {
|
|
217
|
+
processHtmlClass: 'memori-chat--bubble-content',
|
|
218
|
+
},
|
|
219
|
+
tex: {
|
|
220
|
+
inlineMath: [
|
|
221
|
+
['$', '$'],
|
|
222
|
+
['\\$', '\\$'],
|
|
223
|
+
['(', '\\)'],
|
|
224
|
+
['\\(', ')'],
|
|
225
|
+
['(', ')'],
|
|
226
|
+
['[', '\\]'],
|
|
227
|
+
['[', ']'],
|
|
228
|
+
['\\(', '\\)'],
|
|
229
|
+
['\\[', '\\]'],
|
|
230
|
+
['\\\\[', '\\\\]'],
|
|
231
|
+
['\\\\\\[', '\\\\\\]'],
|
|
232
|
+
['((', '))'],
|
|
233
|
+
],
|
|
234
|
+
displayMath: [
|
|
235
|
+
['$$', '$$'],
|
|
236
|
+
['\\[[', '\\]]'],
|
|
237
|
+
['\\\\[[', '\\\\]]'],
|
|
238
|
+
['\\\\\\[[', '\\\\\\]]'],
|
|
239
|
+
],
|
|
240
|
+
processEscapes: false,
|
|
241
|
+
},
|
|
242
|
+
asciimath: {
|
|
243
|
+
fixphi: true,
|
|
244
|
+
displaystyle: true,
|
|
245
|
+
decimalsign: '.',
|
|
246
|
+
},
|
|
247
|
+
skipStartupTypeset: true,
|
|
248
|
+
chtml: {
|
|
249
|
+
displayAlign: 'left',
|
|
250
|
+
},
|
|
251
|
+
svg: {
|
|
252
|
+
fontCache: 'global',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const script = document.createElement('script');
|
|
257
|
+
script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js';
|
|
258
|
+
script.async = true;
|
|
259
|
+
script.id = 'mathjax-script';
|
|
260
|
+
document.head.appendChild(script);
|
|
261
|
+
}, []);
|
|
262
|
+
|
|
210
263
|
const renderer = memori ? (
|
|
211
264
|
<MemoriWidget
|
|
212
265
|
layout={layout}
|
|
@@ -282,43 +335,6 @@ const Memori: React.FC<Props> = ({
|
|
|
282
335
|
<I18nextProvider i18n={i18n}>
|
|
283
336
|
<Toaster position="top-center" reverseOrder={true} />
|
|
284
337
|
{renderer}
|
|
285
|
-
|
|
286
|
-
<script
|
|
287
|
-
dangerouslySetInnerHTML={{
|
|
288
|
-
__html: `
|
|
289
|
-
MathJax = {
|
|
290
|
-
startup: {
|
|
291
|
-
elements: ['.memori-chat--bubble-content'],
|
|
292
|
-
},
|
|
293
|
-
options: {
|
|
294
|
-
processHtmlClass: 'memori-chat--bubble-content',
|
|
295
|
-
},
|
|
296
|
-
tex: {
|
|
297
|
-
inlineMath: [['$', '$'], ['\\$', '\\$'], ['(',')'], ['\(','\)'], ['\[', '\]'], ['[', ']'], ['\\(', '\\)'], ['\\[', '\\]'], ['((','))']],
|
|
298
|
-
displayMath: [['$$', '$$'], ['\\[[', '\\]]']],
|
|
299
|
-
processEscapes: true,
|
|
300
|
-
},
|
|
301
|
-
asciimath: {
|
|
302
|
-
fixphi: true,
|
|
303
|
-
displaystyle: true,
|
|
304
|
-
decimalsign: '.'
|
|
305
|
-
},
|
|
306
|
-
skipStartupTypeset: true,
|
|
307
|
-
chtml: {
|
|
308
|
-
displayAlign: 'left',
|
|
309
|
-
},
|
|
310
|
-
svg: {
|
|
311
|
-
fontCache: 'global'
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
`,
|
|
315
|
-
}}
|
|
316
|
-
/>
|
|
317
|
-
<script
|
|
318
|
-
id="MathJax-script"
|
|
319
|
-
async
|
|
320
|
-
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
|
|
321
|
-
></script>
|
|
322
338
|
</I18nextProvider>
|
|
323
339
|
);
|
|
324
340
|
};
|
package/src/styles.css
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
@import url('./components/layouts/website-assistant.css');
|
|
53
53
|
@import url('./components/layouts/chat.css');
|
|
54
54
|
|
|
55
|
-
@import url('
|
|
55
|
+
@import url('https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.css');
|
|
56
56
|
|
|
57
57
|
.sr-only {
|
|
58
58
|
position: absolute;
|
|
@@ -106,4 +106,4 @@ body.sb-show-main #root,
|
|
|
106
106
|
.mobile-hidden {
|
|
107
107
|
display: none;
|
|
108
108
|
}
|
|
109
|
-
}
|
|
109
|
+
}
|