@memori.ai/memori-react 7.32.8 → 7.33.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +44 -43
  3. package/dist/components/Chat/Chat.d.ts +1 -0
  4. package/dist/components/Chat/Chat.js +2 -2
  5. package/dist/components/Chat/Chat.js.map +1 -1
  6. package/dist/components/ChatBubble/ChatBubble.d.ts +1 -0
  7. package/dist/components/ChatBubble/ChatBubble.js +2 -2
  8. package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
  9. package/dist/components/MemoriWidget/MemoriWidget.d.ts +3 -1
  10. package/dist/components/MemoriWidget/MemoriWidget.js +4 -2
  11. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  12. package/dist/components/layouts/HiddenChat.js +8 -5
  13. package/dist/components/layouts/HiddenChat.js.map +1 -1
  14. package/dist/helpers/message.d.ts +1 -1
  15. package/dist/helpers/message.js +4 -2
  16. package/dist/helpers/message.js.map +1 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +3 -2
  19. package/dist/index.js.map +1 -1
  20. package/esm/components/Chat/Chat.d.ts +1 -0
  21. package/esm/components/Chat/Chat.js +2 -2
  22. package/esm/components/Chat/Chat.js.map +1 -1
  23. package/esm/components/ChatBubble/ChatBubble.d.ts +1 -0
  24. package/esm/components/ChatBubble/ChatBubble.js +2 -2
  25. package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
  26. package/esm/components/MemoriWidget/MemoriWidget.d.ts +3 -1
  27. package/esm/components/MemoriWidget/MemoriWidget.js +4 -2
  28. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  29. package/esm/components/layouts/HiddenChat.js +8 -5
  30. package/esm/components/layouts/HiddenChat.js.map +1 -1
  31. package/esm/helpers/message.d.ts +1 -1
  32. package/esm/helpers/message.js +4 -2
  33. package/esm/helpers/message.js.map +1 -1
  34. package/esm/index.d.ts +1 -0
  35. package/esm/index.js +3 -2
  36. package/esm/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/components/Chat/Chat.tsx +3 -0
  39. package/src/components/ChatBubble/ChatBubble.stories.tsx +84 -0
  40. package/src/components/ChatBubble/ChatBubble.test.tsx +17 -0
  41. package/src/components/ChatBubble/ChatBubble.tsx +4 -1
  42. package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +104 -1
  43. package/src/components/MemoriWidget/MemoriWidget.tsx +7 -0
  44. package/src/components/layouts/HiddenChat.tsx +17 -3
  45. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +284 -13
  46. package/src/helpers/message.ts +6 -6
  47. package/src/index.stories.tsx +2 -1
  48. package/src/index.tsx +5 -1
@@ -143,23 +143,294 @@ exports[`renders HIDDEN_CHAT layout unchanged 1`] = `
143
143
  class="memori-loading"
144
144
  >
145
145
  <div
146
- class="memori-spin"
146
+ class="memori--start-panel"
147
147
  >
148
148
  <div
149
- class="memori-spin--spinner"
149
+ class="memori--cover"
150
150
  >
151
- <svg
152
- aria-hidden="true"
153
- class="memori-loading-icon"
154
- focusable="false"
155
- role="img"
156
- viewBox="0 0 1024 1024"
157
- xmlns="http://www.w3.org/2000/svg"
151
+ <div
152
+ class="memori--completions-enabled"
158
153
  >
159
- <path
160
- d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"
161
- />
162
- </svg>
154
+ <div
155
+ class="memori-tooltip memori-tooltip--align-left"
156
+ >
157
+ <div
158
+ class="memori-tooltip--content"
159
+ >
160
+ IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette
161
+ </div>
162
+ <div
163
+ class="memori-tooltip--trigger"
164
+ >
165
+ <span
166
+ aria-label="IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette"
167
+ >
168
+ <svg
169
+ aria-hidden="true"
170
+ fill="none"
171
+ focusable="false"
172
+ role="img"
173
+ viewBox="0 0 24 24"
174
+ xmlns="http://www.w3.org/2000/svg"
175
+ >
176
+ <g
177
+ clip-rule="evenodd"
178
+ fill="currentColor"
179
+ fill-rule="evenodd"
180
+ >
181
+ <path
182
+ clip-rule="evenodd"
183
+ d="M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z"
184
+ fill-rule="evenodd"
185
+ />
186
+ <path
187
+ clip-rule="evenodd"
188
+ d="M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z"
189
+ fill-rule="evenodd"
190
+ />
191
+ <path
192
+ clip-rule="evenodd"
193
+ d="M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z"
194
+ fill-rule="evenodd"
195
+ />
196
+ </g>
197
+ </svg>
198
+ </span>
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ <picture
204
+ class="memori--avatar"
205
+ >
206
+ <source
207
+ src="https://aisuru.com/images/aisuru/square_logo.png"
208
+ />
209
+ <img
210
+ alt="Memori"
211
+ src="https://aisuru.com/images/aisuru/square_logo.png"
212
+ />
213
+ </picture>
214
+ <h2
215
+ class="memori--title"
216
+ >
217
+ Memori
218
+ </h2>
219
+ <div
220
+ class="memori--description"
221
+ >
222
+ <p>
223
+ <span
224
+ class="memori--description-text"
225
+ >
226
+ Lorem ipsum.
227
+ </span>
228
+ </p>
229
+ <div
230
+ class="memori--language-chooser"
231
+ >
232
+ <label
233
+ for="user-lang-pref"
234
+ id="user-lang-pref-label"
235
+ >
236
+ Voglio parlare con Memori in
237
+ </label>
238
+ <select
239
+ aria-labelledby="user-lang-pref-label"
240
+ class="memori-select--button"
241
+ id="user-lang-pref"
242
+ >
243
+ <option
244
+ aria-label="Italiano"
245
+ value="IT"
246
+ >
247
+ Italiano
248
+ </option>
249
+ <option
250
+ aria-label="English"
251
+ value="EN"
252
+ >
253
+ English
254
+ </option>
255
+ <option
256
+ aria-label="Deutsch"
257
+ value="DE"
258
+ >
259
+ Deutsch
260
+ </option>
261
+ <option
262
+ aria-label="Español"
263
+ value="ES"
264
+ >
265
+ Español
266
+ </option>
267
+ <option
268
+ aria-label="Français"
269
+ value="FR"
270
+ >
271
+ Français
272
+ </option>
273
+ <option
274
+ aria-label="Português"
275
+ value="PT"
276
+ >
277
+ Português
278
+ </option>
279
+ <option
280
+ aria-label="Українська"
281
+ value="UK"
282
+ >
283
+ Українська
284
+ </option>
285
+ <option
286
+ aria-label="Русский"
287
+ value="RU"
288
+ >
289
+ Русский
290
+ </option>
291
+ <option
292
+ aria-label="Polski"
293
+ value="PL"
294
+ >
295
+ Polski
296
+ </option>
297
+ <option
298
+ aria-label="Suomi"
299
+ value="FI"
300
+ >
301
+ Suomi
302
+ </option>
303
+ <option
304
+ aria-label="Ελληνικά"
305
+ value="EL"
306
+ >
307
+ Ελληνικά
308
+ </option>
309
+ <option
310
+ aria-label="العربية"
311
+ value="AR"
312
+ >
313
+ العربية
314
+ </option>
315
+ <option
316
+ aria-label="中文"
317
+ value="ZH"
318
+ >
319
+ 中文
320
+ </option>
321
+ <option
322
+ aria-label="日本語"
323
+ value="JA"
324
+ >
325
+ 日本語
326
+ </option>
327
+ </select>
328
+ </div>
329
+ <div
330
+ class="memori--start-privacy-explanation-container"
331
+ >
332
+ <p
333
+ class="memori--start-privacy-explanation"
334
+ >
335
+ Le conversazioni sono visibili all'autore dell'agente
336
+ </p>
337
+ <div
338
+ class="memori-tooltip memori-tooltip--align-right"
339
+ >
340
+ <div
341
+ class="memori-tooltip--content"
342
+ >
343
+ <div
344
+ class="memori--privacy-tooltip-content"
345
+ >
346
+ <p>
347
+
348
+ Tutte le conversazioni con questo agente sono visibili all'autore dell'agente
349
+ </p>
350
+ <ul
351
+ class="memori--privacy-tooltip-content-list"
352
+ >
353
+ <li>
354
+ L'autore può vedere il contenuto e il tuo indirizzo IP
355
+ </li>
356
+ </ul>
357
+ <p>
358
+ L'autore utilizza queste informazioni per migliorare le funzionalità dell'agente. Continuando, accetti queste condizioni.
359
+ </p>
360
+ <a
361
+ href="https://memori.ai/en/privacy-policy"
362
+ rel="noopener noreferrer"
363
+ target="_blank"
364
+ >
365
+ Informativa sulla privacy
366
+ </a>
367
+ </div>
368
+ </div>
369
+ <div
370
+ class="memori-tooltip--trigger"
371
+ >
372
+ <svg
373
+ aria-hidden="true"
374
+ class="memori--start-privacy-explanation-icon"
375
+ fill="none"
376
+ focusable="false"
377
+ role="img"
378
+ stroke="currentColor"
379
+ stroke-linecap="round"
380
+ stroke-linejoin="round"
381
+ stroke-width="1.5"
382
+ viewBox="0 0 24 24"
383
+ xmlns="http://www.w3.org/2000/svg"
384
+ >
385
+ <circle
386
+ cx="12"
387
+ cy="12"
388
+ r="10"
389
+ />
390
+ <path
391
+ d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"
392
+ />
393
+ <path
394
+ d="M12 17L12.01 17"
395
+ />
396
+ </svg>
397
+ </div>
398
+ </div>
399
+ </div>
400
+ <button
401
+ class="memori-button memori-button--primary memori-button--rounded memori-button--padded memori--start-button"
402
+ >
403
+ INIZIAMO
404
+ </button>
405
+ <div
406
+ class="memori--completion-provider-status--loading"
407
+ >
408
+ <div
409
+ class="memori-spin memori-spin--spinning"
410
+ >
411
+ <div
412
+ class="memori-spin--spinner"
413
+ >
414
+ <svg
415
+ aria-hidden="true"
416
+ class="memori-loading-icon"
417
+ focusable="false"
418
+ role="img"
419
+ viewBox="0 0 1024 1024"
420
+ xmlns="http://www.w3.org/2000/svg"
421
+ >
422
+ <path
423
+ d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"
424
+ />
425
+ </svg>
426
+ </div>
427
+ </div>
428
+ </div>
429
+ <p
430
+ class="memori--start-description"
431
+ >
432
+ Per parlare con me clicca sul pulsante INIZIAMO per cominciare
433
+ </p>
163
434
  </div>
164
435
  </div>
165
436
  </div>
@@ -63,7 +63,8 @@ export const truncateMessage = (message: string) => {
63
63
  export const renderMsg = (
64
64
  text: string,
65
65
  useMathFormatting = false,
66
- reasoningText = 'Reasoning...'
66
+ reasoningText = 'Reasoning...',
67
+ showReasoning = false
67
68
  ): {
68
69
  text: string;
69
70
  } => {
@@ -77,7 +78,9 @@ export const renderMsg = (
77
78
  )
78
79
  .replaceAll(
79
80
  /<think>([\s\S]*?)<\/think>/g,
80
- `<details class="memori-think"><summary>${reasoningText}</summary>$1</details>`
81
+ showReasoning
82
+ ? `<details class="memori-think"><summary>${reasoningText}</summary>$1</details>`
83
+ : ''
81
84
  )
82
85
  // Remove document_attachment tags from text - they will be handled as media
83
86
  .replaceAll(
@@ -94,10 +97,7 @@ export const renderMsg = (
94
97
  // Correzione dei delimitatori LaTeX inconsistenti
95
98
  if (useMathFormatting) {
96
99
  // Abilita il supporto per KaTeX
97
- marked.use(
98
- markedKatex({
99
- })
100
- );
100
+ marked.use(markedKatex({}));
101
101
 
102
102
  // Normalizza tutti i delimitatori LaTeX per equazioni su linea separata
103
103
  // Da \\[ ... \\] o \\[ ... ] a $$ ... $$
@@ -268,8 +268,9 @@ TestCustomAnimationsWithRPMSequence.args = {
268
268
  baseURL: "https://aisuru-staging.aclambda.online",
269
269
  uiLang: "IT",
270
270
  spokenLang: "IT",
271
- layout: "ZOOMED_FULL_BODY",
271
+ layout: "HIDDEN_CHAT",
272
272
  showLogin: true,
273
+ autoStart: false,
273
274
  integrationID: "ea181116-1b9a-4562-b8b2-41608221adb2",
274
275
  };
275
276
 
package/src/index.tsx CHANGED
@@ -46,6 +46,7 @@ export interface Props {
46
46
  showTypingText?: boolean;
47
47
  showLogin?: boolean;
48
48
  showUpload?: boolean;
49
+ showReasoning?: boolean;
49
50
  height?: number | string;
50
51
  baseURL?: string;
51
52
  apiURL?: string;
@@ -121,6 +122,7 @@ const Memori: React.FC<Props> = ({
121
122
  showContextPerLine = false,
122
123
  showUpload,
123
124
  showLogin,
125
+ showReasoning,
124
126
  height = '100%',
125
127
  baseURL,
126
128
  apiURL = 'https://backend.memori.ai',
@@ -305,12 +307,13 @@ const Memori: React.FC<Props> = ({
305
307
  showContextPerLine={showContextPerLine}
306
308
  showLogin={showLogin ?? memori?.enableDeepThought}
307
309
  showUpload={showUpload}
310
+ showReasoning={showReasoning}
308
311
  integration={layoutIntegration}
309
312
  initialContextVars={initialContextVars}
310
313
  initialQuestion={initialQuestionLayout}
311
314
  authToken={authToken}
312
315
  AZURE_COGNITIVE_SERVICES_TTS_KEY={speechKey}
313
- autoStart={layout === 'HIDDEN_CHAT' ? false : autoStart}
316
+ autoStart={autoStart}
314
317
  enableAudio={enableAudio && !!speechKey}
315
318
  defaultSpeakerActive={defaultSpeakerActive}
316
319
  disableTextEnteredEvents={disableTextEnteredEvents}
@@ -379,6 +382,7 @@ Memori.propTypes = {
379
382
  showTypingText: PropTypes.bool,
380
383
  showLogin: PropTypes.bool,
381
384
  showUpload: PropTypes.bool,
385
+ showReasoning: PropTypes.bool,
382
386
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
383
387
  baseURL: PropTypes.string,
384
388
  apiURL: PropTypes.string,