@memori.ai/memori-react 7.26.2 → 7.27.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 +31 -0
- package/dist/components/ChatBubble/ChatBubble.css +34 -1
- package/dist/components/ChatBubble/ChatBubble.js +7 -6
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.d.ts +7 -0
- package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.js +69 -0
- package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.js.map +1 -0
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +23 -22
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/ShareButton/ShareButton.css +6 -0
- package/dist/components/ShareButton/ShareButton.d.ts +3 -1
- package/dist/components/ShareButton/ShareButton.js +3 -3
- package/dist/components/ShareButton/ShareButton.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +2 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/layouts/HiddenChat.js +13 -11
- package/dist/components/layouts/HiddenChat.js.map +1 -1
- package/dist/helpers/message.d.ts +1 -1
- package/dist/helpers/message.js +2 -1
- package/dist/helpers/message.js.map +1 -1
- package/dist/helpers/utils.js +3 -0
- package/dist/helpers/utils.js.map +1 -1
- package/dist/locales/de.json +2 -0
- package/dist/locales/en.json +2 -0
- package/dist/locales/es.json +2 -0
- package/dist/locales/fr.json +2 -0
- package/dist/locales/it.json +2 -0
- package/esm/components/ChatBubble/ChatBubble.css +34 -1
- package/esm/components/ChatBubble/ChatBubble.js +7 -6
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.d.ts +7 -0
- package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.js +67 -0
- package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.js.map +1 -0
- package/esm/components/Header/Header.d.ts +1 -0
- package/esm/components/Header/Header.js +23 -22
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/ShareButton/ShareButton.css +6 -0
- package/esm/components/ShareButton/ShareButton.d.ts +3 -1
- package/esm/components/ShareButton/ShareButton.js +3 -3
- package/esm/components/ShareButton/ShareButton.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +2 -0
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/layouts/HiddenChat.js +13 -11
- package/esm/components/layouts/HiddenChat.js.map +1 -1
- package/esm/helpers/message.d.ts +1 -1
- package/esm/helpers/message.js +2 -1
- package/esm/helpers/message.js.map +1 -1
- package/esm/helpers/utils.js +3 -0
- package/esm/helpers/utils.js.map +1 -1
- package/esm/locales/de.json +2 -0
- package/esm/locales/en.json +2 -0
- package/esm/locales/es.json +2 -0
- package/esm/locales/fr.json +2 -0
- package/esm/locales/it.json +2 -0
- package/package.json +1 -1
- package/src/components/ChatBubble/ChatBubble.css +34 -1
- package/src/components/ChatBubble/ChatBubble.stories.tsx +83 -0
- package/src/components/ChatBubble/ChatBubble.test.tsx +32 -0
- package/src/components/ChatBubble/ChatBubble.tsx +26 -16
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +232 -0
- package/src/components/Header/Header.stories.tsx +7 -1
- package/src/components/Header/Header.tsx +27 -22
- package/src/components/MemoriWidget/MemoriWidget.tsx +2 -0
- package/src/components/ShareButton/ShareButton.css +6 -0
- package/src/components/ShareButton/ShareButton.stories.tsx +18 -1
- package/src/components/ShareButton/ShareButton.test.tsx +8 -1
- package/src/components/ShareButton/ShareButton.tsx +33 -2
- package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +35 -0
- package/src/components/UploadButton/UploadButton.tsx +3 -1
- package/src/components/layouts/HiddenChat.tsx +10 -18
- package/src/components/layouts/layouts.stories.tsx +1 -1
- package/src/helpers/message.ts +6 -1
- package/src/helpers/utils.ts +5 -0
- package/src/locales/de.json +2 -0
- package/src/locales/en.json +2 -0
- package/src/locales/es.json +2 -0
- package/src/locales/fr.json +2 -0
- package/src/locales/it.json +2 -0
|
@@ -7627,6 +7627,238 @@ exports[`renders ChatBubble with msg generated by AI unchanged 1`] = `
|
|
|
7627
7627
|
</div>
|
|
7628
7628
|
`;
|
|
7629
7629
|
|
|
7630
|
+
exports[`renders ChatBubble with output code unchanged 1`] = `
|
|
7631
|
+
<div>
|
|
7632
|
+
<div
|
|
7633
|
+
class="memori-chat--bubble-container"
|
|
7634
|
+
>
|
|
7635
|
+
<picture
|
|
7636
|
+
class="memori-chat--bubble-avatar transition ease-in-out duration-300 opacity-0 scale-075 translate-x--15"
|
|
7637
|
+
title="Memori"
|
|
7638
|
+
>
|
|
7639
|
+
<img
|
|
7640
|
+
alt="Memori"
|
|
7641
|
+
class="memori-chat--bubble-avatar-img"
|
|
7642
|
+
src="https://aisuru.com/images/aisuru/square_logo.png"
|
|
7643
|
+
/>
|
|
7644
|
+
</picture>
|
|
7645
|
+
<div
|
|
7646
|
+
class="memori-chat--bubble memori-chat--with-addon transition ease-in-out duration-300 opacity-0 scale-09 translate-x--30"
|
|
7647
|
+
>
|
|
7648
|
+
<div
|
|
7649
|
+
class="memori-chat--bubble-content"
|
|
7650
|
+
dir="auto"
|
|
7651
|
+
>
|
|
7652
|
+
<p>
|
|
7653
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
7654
|
+
</p>
|
|
7655
|
+
|
|
7656
|
+
|
|
7657
|
+
<h1>
|
|
7658
|
+
titolo
|
|
7659
|
+
</h1>
|
|
7660
|
+
|
|
7661
|
+
|
|
7662
|
+
<p>
|
|
7663
|
+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
7664
|
+
</p>
|
|
7665
|
+
|
|
7666
|
+
|
|
7667
|
+
<p>
|
|
7668
|
+
<output
|
|
7669
|
+
class="memori-output"
|
|
7670
|
+
>
|
|
7671
|
+
{ "data": [ 0, 1, 2 ] }
|
|
7672
|
+
</output>
|
|
7673
|
+
</p>
|
|
7674
|
+
</div>
|
|
7675
|
+
<div
|
|
7676
|
+
class="memori-chat--bubble-addon"
|
|
7677
|
+
>
|
|
7678
|
+
<button
|
|
7679
|
+
class="memori-button memori-button--ghost memori-button--circle memori-button--padded memori-button--icon-only memori-chat--bubble-action-icon"
|
|
7680
|
+
title="copy"
|
|
7681
|
+
>
|
|
7682
|
+
<span
|
|
7683
|
+
class="memori-button--icon"
|
|
7684
|
+
>
|
|
7685
|
+
<svg
|
|
7686
|
+
aria-hidden="true"
|
|
7687
|
+
fill="none"
|
|
7688
|
+
focusable="false"
|
|
7689
|
+
role="img"
|
|
7690
|
+
stroke="currentColor"
|
|
7691
|
+
stroke-linecap="round"
|
|
7692
|
+
stroke-linejoin="round"
|
|
7693
|
+
stroke-width="1.5"
|
|
7694
|
+
viewBox="0 0 24 24"
|
|
7695
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7696
|
+
>
|
|
7697
|
+
<rect
|
|
7698
|
+
height="14"
|
|
7699
|
+
rx="2"
|
|
7700
|
+
ry="2"
|
|
7701
|
+
width="14"
|
|
7702
|
+
x="8"
|
|
7703
|
+
y="8"
|
|
7704
|
+
/>
|
|
7705
|
+
<path
|
|
7706
|
+
d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
7707
|
+
/>
|
|
7708
|
+
</svg>
|
|
7709
|
+
</span>
|
|
7710
|
+
</button>
|
|
7711
|
+
<button
|
|
7712
|
+
class="memori-button memori-button--ghost memori-button--circle memori-button--padded memori-button--icon-only memori-chat--bubble-action-icon"
|
|
7713
|
+
title="copyRawCode"
|
|
7714
|
+
>
|
|
7715
|
+
<span
|
|
7716
|
+
class="memori-button--icon"
|
|
7717
|
+
>
|
|
7718
|
+
<svg
|
|
7719
|
+
aria-hidden="true"
|
|
7720
|
+
fill="none"
|
|
7721
|
+
focusable="false"
|
|
7722
|
+
role="img"
|
|
7723
|
+
stroke="currentColor"
|
|
7724
|
+
stroke-linecap="round"
|
|
7725
|
+
stroke-linejoin="round"
|
|
7726
|
+
stroke-width="1.5"
|
|
7727
|
+
viewBox="0 0 24 24"
|
|
7728
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7729
|
+
>
|
|
7730
|
+
<path
|
|
7731
|
+
d="M10 9.5 8 12l2 2.5"
|
|
7732
|
+
/>
|
|
7733
|
+
<path
|
|
7734
|
+
d="m14 9.5 2 2.5-2 2.5"
|
|
7735
|
+
/>
|
|
7736
|
+
<rect
|
|
7737
|
+
height="18"
|
|
7738
|
+
rx="2"
|
|
7739
|
+
width="18"
|
|
7740
|
+
x="3"
|
|
7741
|
+
y="3"
|
|
7742
|
+
/>
|
|
7743
|
+
</svg>
|
|
7744
|
+
</span>
|
|
7745
|
+
</button>
|
|
7746
|
+
</div>
|
|
7747
|
+
</div>
|
|
7748
|
+
</div>
|
|
7749
|
+
</div>
|
|
7750
|
+
`;
|
|
7751
|
+
|
|
7752
|
+
exports[`renders ChatBubble with reasoning unchanged 1`] = `
|
|
7753
|
+
<div>
|
|
7754
|
+
<div
|
|
7755
|
+
class="memori-chat--bubble-container"
|
|
7756
|
+
>
|
|
7757
|
+
<picture
|
|
7758
|
+
class="memori-chat--bubble-avatar transition ease-in-out duration-300 opacity-0 scale-075 translate-x--15"
|
|
7759
|
+
title="Memori"
|
|
7760
|
+
>
|
|
7761
|
+
<img
|
|
7762
|
+
alt="Memori"
|
|
7763
|
+
class="memori-chat--bubble-avatar-img"
|
|
7764
|
+
src="https://aisuru.com/images/aisuru/square_logo.png"
|
|
7765
|
+
/>
|
|
7766
|
+
</picture>
|
|
7767
|
+
<div
|
|
7768
|
+
class="memori-chat--bubble memori-chat--with-addon transition ease-in-out duration-300 opacity-0 scale-09 translate-x--30"
|
|
7769
|
+
>
|
|
7770
|
+
<div
|
|
7771
|
+
class="memori-chat--bubble-content"
|
|
7772
|
+
dir="auto"
|
|
7773
|
+
>
|
|
7774
|
+
<details
|
|
7775
|
+
class="memori-think"
|
|
7776
|
+
>
|
|
7777
|
+
<summary>
|
|
7778
|
+
reasoning
|
|
7779
|
+
</summary>
|
|
7780
|
+
Lorem ipsum is a dummy or placeholder text commonly used in graphic design, publishing, and web development. Its purpose is to permit a page layout to be designed, independently of the copy that will subsequently populate it, or to demonstrate various fonts of a typeface without meaningful text that could be distracting. More at WikipediaDicta sequi dignissimos quis earum. Quis vel sint voluptas eos ex assumenda. Similique sed modi deleniti et ut quas cumque. Quaerat quis labore ut asperiores aliquid. Voluptatem similique nostrum neque culpa. Ex et iste voluptas est itaque aut aliquam. Qui error perspiciatis aut fuga maiores sint aut aspernatur. Veritatis ipsam iure voluptas asperiores consequuntur unde consequatur vitae. Sequi doloremque inventore reiciendis doloremque voluptates. Quidem repellendus id maxime. Fuga autem quam reiciendis provident in ad. Quia ut nihil voluptate voluptas ipsa porro. Magnam assumenda earum ipsam quisquam aut perspiciatis officiis. Et totam deleniti sed quisquam repellat. Ducimus nostrum voluptatem deleniti sed. Et accusamus temporibus occaecati. Est explicabo vel eum animi deleniti. Qui vel totam est officiis ducimus eligendi iure. Impedit eum ipsa omnis qui dolorem nobis at inventore. Aliquid aliquam esse neque ut vel magni accusamus. Et quia quas consectetur. Dolor dolorum sunt aut enim et quam ut expedita. Quia ut odio totam mollitia. Qui tempore quia quaerat quis enim. Numquam quasi maiores ipsa qui illo. Ea iste iure in corporis non nihil molestias quisquam. Sed suscipit esse dolorem omnis dolore aut. Enim eos id eligendi doloremque.
|
|
7781
|
+
</details>
|
|
7782
|
+
|
|
7783
|
+
Proin libero ante, dignissim sit amet turpis a, pretium condimentum dolor.
|
|
7784
|
+
</div>
|
|
7785
|
+
<div
|
|
7786
|
+
class="memori-chat--bubble-addon"
|
|
7787
|
+
>
|
|
7788
|
+
<button
|
|
7789
|
+
class="memori-button memori-button--ghost memori-button--circle memori-button--padded memori-button--icon-only memori-chat--bubble-action-icon"
|
|
7790
|
+
title="copy"
|
|
7791
|
+
>
|
|
7792
|
+
<span
|
|
7793
|
+
class="memori-button--icon"
|
|
7794
|
+
>
|
|
7795
|
+
<svg
|
|
7796
|
+
aria-hidden="true"
|
|
7797
|
+
fill="none"
|
|
7798
|
+
focusable="false"
|
|
7799
|
+
role="img"
|
|
7800
|
+
stroke="currentColor"
|
|
7801
|
+
stroke-linecap="round"
|
|
7802
|
+
stroke-linejoin="round"
|
|
7803
|
+
stroke-width="1.5"
|
|
7804
|
+
viewBox="0 0 24 24"
|
|
7805
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7806
|
+
>
|
|
7807
|
+
<rect
|
|
7808
|
+
height="14"
|
|
7809
|
+
rx="2"
|
|
7810
|
+
ry="2"
|
|
7811
|
+
width="14"
|
|
7812
|
+
x="8"
|
|
7813
|
+
y="8"
|
|
7814
|
+
/>
|
|
7815
|
+
<path
|
|
7816
|
+
d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
7817
|
+
/>
|
|
7818
|
+
</svg>
|
|
7819
|
+
</span>
|
|
7820
|
+
</button>
|
|
7821
|
+
<button
|
|
7822
|
+
class="memori-button memori-button--ghost memori-button--circle memori-button--padded memori-button--icon-only memori-chat--bubble-action-icon"
|
|
7823
|
+
title="copyRawCode"
|
|
7824
|
+
>
|
|
7825
|
+
<span
|
|
7826
|
+
class="memori-button--icon"
|
|
7827
|
+
>
|
|
7828
|
+
<svg
|
|
7829
|
+
aria-hidden="true"
|
|
7830
|
+
fill="none"
|
|
7831
|
+
focusable="false"
|
|
7832
|
+
role="img"
|
|
7833
|
+
stroke="currentColor"
|
|
7834
|
+
stroke-linecap="round"
|
|
7835
|
+
stroke-linejoin="round"
|
|
7836
|
+
stroke-width="1.5"
|
|
7837
|
+
viewBox="0 0 24 24"
|
|
7838
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7839
|
+
>
|
|
7840
|
+
<path
|
|
7841
|
+
d="M10 9.5 8 12l2 2.5"
|
|
7842
|
+
/>
|
|
7843
|
+
<path
|
|
7844
|
+
d="m14 9.5 2 2.5-2 2.5"
|
|
7845
|
+
/>
|
|
7846
|
+
<rect
|
|
7847
|
+
height="18"
|
|
7848
|
+
rx="2"
|
|
7849
|
+
width="18"
|
|
7850
|
+
x="3"
|
|
7851
|
+
y="3"
|
|
7852
|
+
/>
|
|
7853
|
+
</svg>
|
|
7854
|
+
</span>
|
|
7855
|
+
</button>
|
|
7856
|
+
</div>
|
|
7857
|
+
</div>
|
|
7858
|
+
</div>
|
|
7859
|
+
</div>
|
|
7860
|
+
`;
|
|
7861
|
+
|
|
7630
7862
|
exports[`renders ChatBubble with translation and original unchanged 1`] = `
|
|
7631
7863
|
<div>
|
|
7632
7864
|
<div
|
|
@@ -58,6 +58,8 @@ const Template: Story<Props> = args => {
|
|
|
58
58
|
setControlsPosition={() => {}}
|
|
59
59
|
hideEmissions={false}
|
|
60
60
|
setHideEmissions={() => {}}
|
|
61
|
+
setAvatarType={() => {}}
|
|
62
|
+
setEnablePositionControls={() => {}}
|
|
61
63
|
/>
|
|
62
64
|
<LoginDrawer
|
|
63
65
|
tenant={tenant}
|
|
@@ -68,7 +70,11 @@ const Template: Story<Props> = args => {
|
|
|
68
70
|
setShowLoginDrawer(false);
|
|
69
71
|
}}
|
|
70
72
|
onLogout={() => setShowLoginDrawer(false)}
|
|
71
|
-
|
|
73
|
+
apiClient={
|
|
74
|
+
{
|
|
75
|
+
backend: {},
|
|
76
|
+
} as any
|
|
77
|
+
}
|
|
72
78
|
/>
|
|
73
79
|
</I18nWrapper>
|
|
74
80
|
);
|
|
@@ -48,6 +48,7 @@ export interface Props {
|
|
|
48
48
|
loginToken?: string;
|
|
49
49
|
user?: User;
|
|
50
50
|
sessionID?: string;
|
|
51
|
+
fullScreenHandler?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const Header: React.FC<Props> = ({
|
|
@@ -75,6 +76,7 @@ const Header: React.FC<Props> = ({
|
|
|
75
76
|
loginToken,
|
|
76
77
|
user,
|
|
77
78
|
sessionID,
|
|
79
|
+
fullScreenHandler,
|
|
78
80
|
}) => {
|
|
79
81
|
const { t } = useTranslation();
|
|
80
82
|
const [fullScreenAvailable, setFullScreenAvailable] = useState(false);
|
|
@@ -137,30 +139,33 @@ const Header: React.FC<Props> = ({
|
|
|
137
139
|
: t('fullscreenEnter') || 'Enter fullscreen'
|
|
138
140
|
}
|
|
139
141
|
icon={fullScreen ? <FullscreenExit /> : <Fullscreen />}
|
|
140
|
-
onClick={
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
(memoriWidget
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
onClick={
|
|
143
|
+
fullScreenHandler ||
|
|
144
|
+
(() => {
|
|
145
|
+
if (!document.fullscreenElement) {
|
|
146
|
+
const memoriWidget = document.querySelector('.memori-widget');
|
|
147
|
+
if (memoriWidget) {
|
|
148
|
+
// Set white background before entering fullscreen
|
|
149
|
+
(memoriWidget as HTMLElement).style.backgroundColor =
|
|
150
|
+
'#FFFFFF';
|
|
151
|
+
memoriWidget.requestFullscreen().catch(err => {
|
|
152
|
+
console.warn('Error attempting to enable fullscreen:', err);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
setFullScreen(true);
|
|
156
|
+
} else if (document.exitFullscreen) {
|
|
157
|
+
const memoriWidget = document.querySelector('.memori-widget');
|
|
158
|
+
if (memoriWidget) {
|
|
159
|
+
// Reset background on exit
|
|
160
|
+
(memoriWidget as HTMLElement).style.backgroundColor = '';
|
|
161
|
+
}
|
|
162
|
+
document.exitFullscreen().catch(err => {
|
|
163
|
+
console.warn('Error attempting to exit fullscreen:', err);
|
|
149
164
|
});
|
|
165
|
+
setFullScreen(false);
|
|
150
166
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const memoriWidget = document.querySelector('.memori-widget');
|
|
154
|
-
if (memoriWidget) {
|
|
155
|
-
// Reset background on exit
|
|
156
|
-
(memoriWidget as HTMLElement).style.backgroundColor = '';
|
|
157
|
-
}
|
|
158
|
-
document.exitFullscreen().catch(err => {
|
|
159
|
-
console.warn('Error attempting to exit fullscreen:', err);
|
|
160
|
-
});
|
|
161
|
-
setFullScreen(false);
|
|
162
|
-
}
|
|
163
|
-
}}
|
|
167
|
+
})
|
|
168
|
+
}
|
|
164
169
|
/>
|
|
165
170
|
)}
|
|
166
171
|
{memori.enableDeepThought && !!loginToken && user?.pAndCUAccepted && (
|
|
@@ -352,6 +352,7 @@ export interface LayoutProps {
|
|
|
352
352
|
hasUserActivatedSpeak?: boolean;
|
|
353
353
|
showUpload?: boolean;
|
|
354
354
|
loading?: boolean;
|
|
355
|
+
onClickStart?: () => void;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
export interface Props {
|
|
@@ -3654,6 +3655,7 @@ const MemoriWidget = ({
|
|
|
3654
3655
|
sessionId={sessionId}
|
|
3655
3656
|
hasUserActivatedSpeak={hasUserActivatedSpeak}
|
|
3656
3657
|
loading={loading}
|
|
3658
|
+
onClickStart={onClickStart}
|
|
3657
3659
|
/>
|
|
3658
3660
|
|
|
3659
3661
|
<audio
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
3
|
import I18nWrapper from '../../I18nWrapper';
|
|
4
4
|
import ShareButton, { Props } from './ShareButton';
|
|
5
|
-
import { tenant } from '../../mocks/data';
|
|
5
|
+
import { tenant, memori, sessionID } from '../../mocks/data';
|
|
6
6
|
|
|
7
7
|
import './ShareButton.css';
|
|
8
8
|
|
|
@@ -79,3 +79,20 @@ WithQrCodeAndOtherTenant.args = {
|
|
|
79
79
|
theme: 'tailoor',
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
export const WithMemoriAndSessionID = Template.bind({});
|
|
84
|
+
WithMemoriAndSessionID.args = {
|
|
85
|
+
url: 'https://memori.ai',
|
|
86
|
+
memori,
|
|
87
|
+
sessionID,
|
|
88
|
+
showQrCode: false,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const WithMemoriAndSessionIDAndQrCode = Template.bind({});
|
|
92
|
+
WithMemoriAndSessionIDAndQrCode.args = {
|
|
93
|
+
url: 'https://memori.ai',
|
|
94
|
+
memori,
|
|
95
|
+
sessionID,
|
|
96
|
+
showQrCode: true,
|
|
97
|
+
align: 'right',
|
|
98
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import ShareButton from './ShareButton';
|
|
4
|
-
import { tenant } from '../../mocks/data';
|
|
4
|
+
import { tenant, memori, sessionID } from '../../mocks/data';
|
|
5
5
|
|
|
6
6
|
it('renders ShareButton unchanged', () => {
|
|
7
7
|
const { container } = render(<ShareButton />);
|
|
@@ -44,3 +44,10 @@ it('renders ShareButton with other tenant img set unchanged', () => {
|
|
|
44
44
|
);
|
|
45
45
|
expect(container).toMatchSnapshot();
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
it('renders ShareButton with share chat unchanged', () => {
|
|
49
|
+
const { container } = render(
|
|
50
|
+
<ShareButton memori={memori} sessionID={sessionID} />
|
|
51
|
+
);
|
|
52
|
+
expect(container).toMatchSnapshot();
|
|
53
|
+
});
|
|
@@ -13,10 +13,12 @@ import { QRCodeCanvas } from 'qrcode.react';
|
|
|
13
13
|
import { Menu } from '@headlessui/react';
|
|
14
14
|
import Button from '../ui/Button';
|
|
15
15
|
import cx from 'classnames';
|
|
16
|
-
import { Tenant } from '@memori.ai/memori-api-client/dist/types';
|
|
16
|
+
import { Tenant, Memori } from '@memori.ai/memori-api-client/dist/types';
|
|
17
17
|
|
|
18
18
|
export interface Props {
|
|
19
19
|
tenant?: Tenant;
|
|
20
|
+
memori?: Memori;
|
|
21
|
+
sessionID?: string;
|
|
20
22
|
url?: string;
|
|
21
23
|
title?: string;
|
|
22
24
|
className?: string;
|
|
@@ -28,6 +30,8 @@ export interface Props {
|
|
|
28
30
|
|
|
29
31
|
const ShareButton: React.FC<Props> = ({
|
|
30
32
|
tenant,
|
|
33
|
+
memori,
|
|
34
|
+
sessionID,
|
|
31
35
|
url,
|
|
32
36
|
title = '',
|
|
33
37
|
className,
|
|
@@ -36,7 +40,7 @@ const ShareButton: React.FC<Props> = ({
|
|
|
36
40
|
showQrCode = true,
|
|
37
41
|
align = 'right',
|
|
38
42
|
}: Props) => {
|
|
39
|
-
const { t } = useTranslation();
|
|
43
|
+
const { t, i18n } = useTranslation();
|
|
40
44
|
const [targetUrl, setTargetUrl] = useState(url);
|
|
41
45
|
|
|
42
46
|
const qrImageURL = useMemo(
|
|
@@ -132,6 +136,33 @@ const ShareButton: React.FC<Props> = ({
|
|
|
132
136
|
</div>
|
|
133
137
|
</Menu.Button>
|
|
134
138
|
<Menu.Items className="memori-share-button--overlay" as="ul">
|
|
139
|
+
{memori && sessionID && (
|
|
140
|
+
<Menu.Item
|
|
141
|
+
key="shared"
|
|
142
|
+
as="li"
|
|
143
|
+
className="memori-share-button--li memori-share-button--li-shared"
|
|
144
|
+
>
|
|
145
|
+
<a
|
|
146
|
+
className={cx(
|
|
147
|
+
'memori-button',
|
|
148
|
+
'memori-button--with-icon',
|
|
149
|
+
'memori-button--ghost',
|
|
150
|
+
'memori-button--padded',
|
|
151
|
+
'memori-share-button--link'
|
|
152
|
+
)}
|
|
153
|
+
href={`${baseUrl ?? 'https://www.aisuru.com'}/${
|
|
154
|
+
i18n.language === 'it' ? 'it' : 'en'
|
|
155
|
+
}/shared/${memori.ownerUserID}/${memori.memoriID}/${sessionID}`}
|
|
156
|
+
target="_blank"
|
|
157
|
+
rel="noopener noreferrer"
|
|
158
|
+
>
|
|
159
|
+
<div className="memori-button--icon">
|
|
160
|
+
<Share />
|
|
161
|
+
</div>
|
|
162
|
+
{t('widget.shareChat') || 'Share chat'}
|
|
163
|
+
</a>
|
|
164
|
+
</Menu.Item>
|
|
165
|
+
)}
|
|
135
166
|
<Menu.Item key="copy" as="li" className="memori-share-button--li">
|
|
136
167
|
<Button
|
|
137
168
|
className="memori-share-button--link"
|
|
@@ -140,6 +140,41 @@ exports[`renders ShareButton with other tenant img set unchanged 1`] = `
|
|
|
140
140
|
</div>
|
|
141
141
|
`;
|
|
142
142
|
|
|
143
|
+
exports[`renders ShareButton with share chat unchanged 1`] = `
|
|
144
|
+
<div>
|
|
145
|
+
<div
|
|
146
|
+
class="memori-share-button"
|
|
147
|
+
data-headlessui-state=""
|
|
148
|
+
>
|
|
149
|
+
<button
|
|
150
|
+
aria-expanded="false"
|
|
151
|
+
aria-haspopup="true"
|
|
152
|
+
class="memori-button memori-button--circle memori-button--icon-only memori-share-button--button memori-button--primary"
|
|
153
|
+
data-headlessui-state=""
|
|
154
|
+
id="headlessui-menu-button-:rg:"
|
|
155
|
+
title="widget.share"
|
|
156
|
+
type="button"
|
|
157
|
+
>
|
|
158
|
+
<div
|
|
159
|
+
class="memori-button--icon"
|
|
160
|
+
>
|
|
161
|
+
<svg
|
|
162
|
+
aria-hidden="true"
|
|
163
|
+
focusable="false"
|
|
164
|
+
role="img"
|
|
165
|
+
viewBox="0 0 1024 1024"
|
|
166
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
167
|
+
>
|
|
168
|
+
<path
|
|
169
|
+
d="M752 664c-28.5 0-54.8 10-75.4 26.7L469.4 540.8a160.68 160.68 0 0 0 0-57.6l207.2-149.9C697.2 350 723.5 360 752 360c66.2 0 120-53.8 120-120s-53.8-120-120-120-120 53.8-120 120c0 11.6 1.6 22.7 4.7 33.3L439.9 415.8C410.7 377.1 364.3 352 312 352c-88.4 0-160 71.6-160 160s71.6 160 160 160c52.3 0 98.7-25.1 127.9-63.8l196.8 142.5c-3.1 10.6-4.7 21.8-4.7 33.3 0 66.2 53.8 120 120 120s120-53.8 120-120-53.8-120-120-120zm0-476c28.7 0 52 23.3 52 52s-23.3 52-52 52-52-23.3-52-52 23.3-52 52-52zM312 600c-48.5 0-88-39.5-88-88s39.5-88 88-88 88 39.5 88 88-39.5 88-88 88zm440 236c-28.7 0-52-23.3-52-52s23.3-52 52-52 52 23.3 52 52-23.3 52-52 52z"
|
|
170
|
+
/>
|
|
171
|
+
</svg>
|
|
172
|
+
</div>
|
|
173
|
+
</button>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
`;
|
|
177
|
+
|
|
143
178
|
exports[`renders ShareButton with tenant img set unchanged 1`] = `
|
|
144
179
|
<div>
|
|
145
180
|
<div
|
|
@@ -125,11 +125,13 @@ const UploadButton: React.FC<UploadManagerProps> = ({
|
|
|
125
125
|
.replace(/>/g, '>');
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
-
// ✅ MIGLIORE SOLUZIONE: Tag XML valido con attributi chiari
|
|
129
128
|
const escapedFileName = escapeAttributeValue(file.name);
|
|
130
129
|
const formattedContent = `<document_attachment filename="${escapedFileName}" type="${file.mimeType}">
|
|
130
|
+
|
|
131
131
|
${file.content}
|
|
132
|
+
|
|
132
133
|
</document_attachment>`;
|
|
134
|
+
|
|
133
135
|
//keep just the images in the documentPreviewFiles
|
|
134
136
|
const imageFiles = documentPreviewFiles.filter(
|
|
135
137
|
(file: any) => file.type === 'image'
|
|
@@ -15,11 +15,13 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
15
15
|
// startPanelProps,
|
|
16
16
|
sessionId,
|
|
17
17
|
hasUserActivatedSpeak,
|
|
18
|
+
onClickStart,
|
|
18
19
|
}) => {
|
|
19
20
|
const { t } = useTranslation();
|
|
20
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
21
22
|
const [fullScreen, setFullScreen] = useState(false);
|
|
22
23
|
const [fullScreenAvailable, setFullScreenAvailable] = useState(false);
|
|
24
|
+
const hasStarted = useRef(false);
|
|
23
25
|
|
|
24
26
|
// Use refs to store original sidebar properties to restore them later
|
|
25
27
|
const originalSidebarStyles = useRef({
|
|
@@ -81,7 +83,13 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
setIsOpen(prev => {
|
|
84
|
-
|
|
86
|
+
const newIsOpen = !prev;
|
|
87
|
+
// Only call onClickStart when opening the sidebar for the first time
|
|
88
|
+
if (newIsOpen && !hasStarted.current && onClickStart) {
|
|
89
|
+
hasStarted.current = true;
|
|
90
|
+
onClickStart();
|
|
91
|
+
}
|
|
92
|
+
return newIsOpen;
|
|
85
93
|
});
|
|
86
94
|
};
|
|
87
95
|
|
|
@@ -188,25 +196,9 @@ const HiddenChatLayout: React.FC<LayoutProps> = ({
|
|
|
188
196
|
}}
|
|
189
197
|
{...headerProps}
|
|
190
198
|
className="memori-hidden-chat-layout-header--layout"
|
|
199
|
+
fullScreenHandler={handleFullscreenToggle}
|
|
191
200
|
/>
|
|
192
201
|
)}
|
|
193
|
-
{fullScreenAvailable && (
|
|
194
|
-
<button
|
|
195
|
-
className="memori-fullscreen-button memori-button--primary memori-button--icon"
|
|
196
|
-
onClick={handleFullscreenToggle}
|
|
197
|
-
title={
|
|
198
|
-
fullScreen
|
|
199
|
-
? t('fullscreenExit') || 'Exit fullscreen'
|
|
200
|
-
: t('fullscreenEnter') || 'Enter fullscreen'
|
|
201
|
-
}
|
|
202
|
-
>
|
|
203
|
-
{fullScreen ? (
|
|
204
|
-
<FullscreenExit className="memori-icon" />
|
|
205
|
-
) : (
|
|
206
|
-
<Fullscreen className="memori-icon" />
|
|
207
|
-
)}
|
|
208
|
-
</button>
|
|
209
|
-
)}
|
|
210
202
|
</div>
|
|
211
203
|
</div>
|
|
212
204
|
<div id="extension" />
|
package/src/helpers/message.ts
CHANGED
|
@@ -62,7 +62,8 @@ export const truncateMessage = (message: string) => {
|
|
|
62
62
|
|
|
63
63
|
export const renderMsg = (
|
|
64
64
|
text: string,
|
|
65
|
-
useMathFormatting = false
|
|
65
|
+
useMathFormatting = false,
|
|
66
|
+
reasoningText = 'Reasoning...'
|
|
66
67
|
): {
|
|
67
68
|
text: string;
|
|
68
69
|
} => {
|
|
@@ -74,6 +75,10 @@ export const renderMsg = (
|
|
|
74
75
|
/\[([^\]]+)\]\(([^\)]+)\)/g,
|
|
75
76
|
'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'
|
|
76
77
|
)
|
|
78
|
+
.replaceAll(
|
|
79
|
+
/<think>([\s\S]*?)<\/think>/g,
|
|
80
|
+
`<details class="memori-think"><summary>${reasoningText}</summary>$1</details>`
|
|
81
|
+
)
|
|
77
82
|
.replaceAll(/```markdown([^```]+)```/g, '$1')
|
|
78
83
|
.replaceAll('($', '( $')
|
|
79
84
|
.replaceAll(':$', ': $')
|
package/src/helpers/utils.ts
CHANGED
|
@@ -4,6 +4,11 @@ import * as THREE from 'three';
|
|
|
4
4
|
|
|
5
5
|
export const hasTouchscreen = (): boolean => {
|
|
6
6
|
let hasTouchScreen = false;
|
|
7
|
+
|
|
8
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
|
9
|
+
return hasTouchScreen;
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
if ('maxTouchPoints' in navigator) {
|
|
8
13
|
hasTouchScreen = navigator.maxTouchPoints > 0;
|
|
9
14
|
} else if ('msMaxTouchPoints' in navigator) {
|
package/src/locales/de.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"memoriBlockedReasonExceedChats": "weil der monatliche Schwellenwert für erlaubte Chats überschritten wurde.",
|
|
46
46
|
"memoriBlockedGiverHelper": "Sie können es weiterhin als Administrator verwalten, andere Benutzer können jedoch nicht damit interagieren.",
|
|
47
47
|
"generatedByAI": "Von KI generierte Antworten können gelegentlich falsche Informationen generieren",
|
|
48
|
+
"reasoning": "Überlegung...",
|
|
48
49
|
"whyThisAnswer": "Warum diese Antwort?",
|
|
49
50
|
"whyThisAnswerHelper": "Diese Antwort wurde automatisch von einer künstlichen Intelligenz auf Basis dieser verifizierten Inhalte generiert.",
|
|
50
51
|
"receiverLabel": "Zugewiesen an",
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
"position": "Positionspräferenzen",
|
|
107
108
|
"settings": "Einstellungen",
|
|
108
109
|
"share": "Aktie",
|
|
110
|
+
"shareChat": "Chat teilen",
|
|
109
111
|
"sendOnKeypress": "Drücken Sie zum Senden die Eingabetaste",
|
|
110
112
|
"sendOnClick": "Klicken Sie auf Senden",
|
|
111
113
|
"boardOfExperts": "Expertengremium",
|
package/src/locales/en.json
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"memoriBlockedReasonExceedChats": "because it has exceeded the monthly threshold of allowed chats.",
|
|
46
46
|
"memoriBlockedGiverHelper": "You can still manage it as administrator, but other users will not be able to interact with it.",
|
|
47
47
|
"generatedByAI": "Answer generated by AI, may occasionally generate incorrect informations",
|
|
48
|
+
"reasoning": "Reasoning...",
|
|
48
49
|
"whyThisAnswer": "Why this answer?",
|
|
49
50
|
"whyThisAnswerHelper": "This answer was generated automatically by an artificial intelligence based on these verified contents.",
|
|
50
51
|
"receiverLabel": "Assigned to",
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
"position": "Position preferences",
|
|
107
108
|
"settings": "Settings",
|
|
108
109
|
"share": "Share",
|
|
110
|
+
"shareChat": "Share chat",
|
|
109
111
|
"sendOnKeypress": "Hit Enter to send",
|
|
110
112
|
"sendOnClick": "Click on Submit",
|
|
111
113
|
"boardOfExperts": "Board of experts",
|