@memori.ai/memori-react 8.30.1 → 8.31.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 +8 -0
- package/dist/components/DrawerFooter/DrawerFooter.css +62 -0
- package/dist/components/DrawerFooter/DrawerFooter.d.ts +12 -0
- package/dist/components/DrawerFooter/DrawerFooter.js +10 -0
- package/dist/components/DrawerFooter/DrawerFooter.js.map +1 -0
- package/dist/components/Header/Header.css +45 -0
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +74 -3
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +5 -17
- package/dist/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +1 -0
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/PositionPopover/PositionPopover.css +194 -0
- package/dist/components/PositionPopover/PositionPopover.d.ts +15 -0
- package/dist/components/PositionPopover/PositionPopover.js +181 -0
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +4 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js +37 -0
- package/dist/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -0
- package/dist/components/layouts/WebsiteAssistant/website-assistant.css +671 -0
- package/dist/components/layouts/chat.css +14 -0
- package/dist/components/layouts/fullpage.css +119 -0
- package/dist/helpers/userMessage.d.ts +2 -0
- package/dist/helpers/userMessage.js +23 -0
- package/dist/helpers/userMessage.js.map +1 -0
- package/dist/icons/FacebookIcon.d.ts +3 -0
- package/dist/icons/FacebookIcon.js +6 -0
- package/dist/icons/FacebookIcon.js.map +1 -0
- package/dist/icons/LinkedinIcon.d.ts +3 -0
- package/dist/icons/LinkedinIcon.js +6 -0
- package/dist/icons/LinkedinIcon.js.map +1 -0
- package/dist/icons/TelegramIcon.d.ts +3 -0
- package/dist/icons/TelegramIcon.js +6 -0
- package/dist/icons/TelegramIcon.js.map +1 -0
- package/dist/icons/TwitterIcon.d.ts +3 -0
- package/dist/icons/TwitterIcon.js +6 -0
- package/dist/icons/TwitterIcon.js.map +1 -0
- package/dist/icons/WhatsappIcon.d.ts +3 -0
- package/dist/icons/WhatsappIcon.js +6 -0
- package/dist/icons/WhatsappIcon.js.map +1 -0
- package/dist/testUtils.d.ts +5 -0
- package/dist/testUtils.js +18 -0
- package/dist/testUtils.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/DrawerFooter/DrawerFooter.css +62 -0
- package/esm/components/DrawerFooter/DrawerFooter.d.ts +12 -0
- package/esm/components/DrawerFooter/DrawerFooter.js +8 -0
- package/esm/components/DrawerFooter/DrawerFooter.js.map +1 -0
- package/esm/components/Header/Header.css +45 -0
- package/esm/components/Header/Header.d.ts +1 -0
- package/esm/components/Header/Header.js +75 -4
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js +5 -17
- package/esm/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +1 -0
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/PositionPopover/PositionPopover.css +194 -0
- package/esm/components/PositionPopover/PositionPopover.d.ts +15 -0
- package/esm/components/PositionPopover/PositionPopover.js +178 -0
- package/esm/components/PositionPopover/PositionPopover.js.map +1 -0
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.d.ts +4 -0
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js +34 -0
- package/esm/components/layouts/WebsiteAssistant/WebsiteAssistant.js.map +1 -0
- package/esm/components/layouts/WebsiteAssistant/website-assistant.css +671 -0
- package/esm/components/layouts/chat.css +14 -0
- package/esm/components/layouts/fullpage.css +119 -0
- package/esm/helpers/userMessage.d.ts +2 -0
- package/esm/helpers/userMessage.js +18 -0
- package/esm/helpers/userMessage.js.map +1 -0
- package/esm/icons/FacebookIcon.d.ts +3 -0
- package/esm/icons/FacebookIcon.js +4 -0
- package/esm/icons/FacebookIcon.js.map +1 -0
- package/esm/icons/LinkedinIcon.d.ts +3 -0
- package/esm/icons/LinkedinIcon.js +4 -0
- package/esm/icons/LinkedinIcon.js.map +1 -0
- package/esm/icons/TelegramIcon.d.ts +3 -0
- package/esm/icons/TelegramIcon.js +4 -0
- package/esm/icons/TelegramIcon.js.map +1 -0
- package/esm/icons/TwitterIcon.d.ts +3 -0
- package/esm/icons/TwitterIcon.js +4 -0
- package/esm/icons/TwitterIcon.js.map +1 -0
- package/esm/icons/WhatsappIcon.d.ts +3 -0
- package/esm/icons/WhatsappIcon.js +4 -0
- package/esm/icons/WhatsappIcon.js.map +1 -0
- package/esm/testUtils.d.ts +5 -0
- package/esm/testUtils.js +15 -0
- package/esm/testUtils.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/components/Header/Header.css +45 -0
- package/src/components/Header/Header.stories.tsx +46 -0
- package/src/components/Header/Header.tsx +151 -2
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +71 -0
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +10 -24
- package/src/components/MemoriWidget/MemoriWidget.tsx +1 -0
- package/src/components/layouts/chat.css +14 -0
- package/src/components/layouts/layouts.stories.tsx +14 -14
- package/src/version.ts +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* FullPage layout – spacing, typography and structure using global design tokens */
|
|
2
|
+
|
|
3
|
+
.memori-widget.memori-layout-fullpage {
|
|
4
|
+
max-width: var(--memori-layout-max-width);
|
|
5
|
+
padding: var(--memori-spacing-md);
|
|
6
|
+
margin-right: auto;
|
|
7
|
+
margin-left: auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.memori-widget.memori-layout-fullpage > .memori-spin {
|
|
11
|
+
display: flex;
|
|
12
|
+
height: 100%;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--memori-spacing-lg);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Header spacing */
|
|
18
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--header {
|
|
19
|
+
min-width: 100%;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
border-radius: var(--memori-radius-box);
|
|
22
|
+
margin-bottom: var(--memori-spacing-md);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Grid: main + left column (avatar) */
|
|
26
|
+
.memori-widget.memori-layout-fullpage .memori--grid {
|
|
27
|
+
display: flex;
|
|
28
|
+
height: auto;
|
|
29
|
+
height: 95vh;
|
|
30
|
+
min-height: 0;
|
|
31
|
+
flex: 1 1 auto;
|
|
32
|
+
align-items: stretch;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
gap: var(--memori-spacing-xl);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-left {
|
|
38
|
+
width: 50%;
|
|
39
|
+
max-width: 420px;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
margin-right: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--main {
|
|
45
|
+
display: flex;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
flex: 1;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls {
|
|
54
|
+
display: flex;
|
|
55
|
+
width: 100%;
|
|
56
|
+
max-width: 720px;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
align-items: center;
|
|
59
|
+
padding: var(--memori-spacing-md);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls .memori--start-panel,
|
|
63
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls .memori-chat--wrapper {
|
|
64
|
+
width: 100%;
|
|
65
|
+
max-width: 100%;
|
|
66
|
+
padding: 0 !important;
|
|
67
|
+
margin-right: 0;
|
|
68
|
+
margin-left: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Typography: title and description in fullpage left column */
|
|
72
|
+
.memori-widget.memori-layout-fullpage .memori--title {
|
|
73
|
+
margin-bottom: var(--memori-spacing-xs);
|
|
74
|
+
color: var(--memori-text-color);
|
|
75
|
+
font-size: var(--memori-text-size-heading-large);
|
|
76
|
+
font-weight: var(--memori-text-weight-semibold);
|
|
77
|
+
line-height: var(--memori-text-line-tight);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.memori-widget.memori-layout-fullpage .memori--description,
|
|
81
|
+
.memori-widget.memori-layout-fullpage .memori--needsPosition {
|
|
82
|
+
padding: var(--memori-spacing-lg);
|
|
83
|
+
padding-top: var(--memori-spacing-xs);
|
|
84
|
+
color: var(--memori-text-color);
|
|
85
|
+
font-size: var(--memori-text-size-base);
|
|
86
|
+
line-height: var(--memori-text-line-relaxed);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Powered-by position in fullpage */
|
|
90
|
+
.memori-widget.memori-layout-fullpage .memori--powered-by {
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
padding: var(--memori-spacing-sm) var(--memori-spacing-md);
|
|
93
|
+
border-radius: var(--memori-radius-box);
|
|
94
|
+
font-size: var(--memori-text-size-small);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (max-width: 870px) {
|
|
98
|
+
.memori-widget.memori-layout-fullpage {
|
|
99
|
+
padding: var(--memori-spacing-sm);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.memori-widget.memori-layout-fullpage > .memori-spin {
|
|
103
|
+
gap: var(--memori-spacing-md);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.memori-widget.memori-layout-fullpage .memori--grid-column-left {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls {
|
|
111
|
+
padding: var(--memori-spacing-sm);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (max-width: 480px) {
|
|
116
|
+
.memori-widget.memori-layout-fullpage .memori-chat-layout--controls {
|
|
117
|
+
padding: var(--memori-spacing-xs);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import DOMPurify from 'dompurify';
|
|
2
|
+
import { escapeHTML } from './utils';
|
|
3
|
+
import { truncateMessagePlain } from './message';
|
|
4
|
+
export function sanitizeUserMessageInput(raw) {
|
|
5
|
+
if (raw == null || typeof raw !== 'string') {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
const stripped = DOMPurify.sanitize(raw, {
|
|
9
|
+
ALLOWED_TAGS: [],
|
|
10
|
+
ALLOWED_ATTR: [],
|
|
11
|
+
});
|
|
12
|
+
return stripped.trim();
|
|
13
|
+
}
|
|
14
|
+
export function formatUserBubbleHtml(cleanText) {
|
|
15
|
+
const truncated = truncateMessagePlain(cleanText);
|
|
16
|
+
return escapeHTML(truncated).replace(/\n/g, '<br />');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=userMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userMessage.js","sourceRoot":"","sources":["../../src/helpers/userMessage.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAMjD,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE;QACvC,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,EAAE;KACjB,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAGD,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,MAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const FacebookIcon = (props) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 800, height: 800, fill: "currentColor", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { fill: "currentColor", d: "M17.3 9.6a1 1 0 1 0-1.6-1.2l-2.308 3.078-2.185-2.185A1 1 0 0 0 9.7 9.4l-3 4a1 1 0 0 0 1.6 1.2l2.308-3.078 2.185 2.185A1 1 0 0 0 14.3 13.6l3-4Z" }), _jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 23c-1.224 0-1.9-.131-3-.5l-2.106 1.053A2 2 0 0 1 4 21.763V19.5c-2.153-2.008-3-4.323-3-7.5C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11Zm-6-4.37-.636-.593C3.691 16.477 3 14.733 3 12a9 9 0 1 1 9 9c-.986 0-1.448-.089-2.364-.396l-.788-.264L6 21.764V18.63Z", clipRule: "evenodd" })] }));
|
|
3
|
+
export default FacebookIcon;
|
|
4
|
+
//# sourceMappingURL=FacebookIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FacebookIcon.js","sourceRoot":"","sources":["../../src/icons/FacebookIcon.tsx"],"names":[],"mappings":";AACA,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC7D,eACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,EACX,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,WAAW,KACf,KAAK,aAET,eACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,gJAAgJ,GAClJ,EACF,eACE,IAAI,EAAC,cAAc,EACnB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,uQAAuQ,EACzQ,QAAQ,EAAC,SAAS,GAClB,IACE,CACP,CAAA;AACD,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const LinkedinIcon = (props) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 800, height: 800, fill: "currentColor", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { fill: "currentColor", d: "M6.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM5 10a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-8ZM11 19h1a1 1 0 0 0 1-1v-4.5c0-1.5 3-2.5 3-.5v5a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-6c0-2-1.5-3-3.5-3S13 10.5 13 10.5V10a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1Z" }), _jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M20 1a3 3 0 0 1 3 3v16a3 3 0 0 1-3 3H4a3 3 0 0 1-3-3V4a3 3 0 0 1 3-3h16Zm0 2a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h16Z", clipRule: "evenodd" })] }));
|
|
3
|
+
export default LinkedinIcon;
|
|
4
|
+
//# sourceMappingURL=LinkedinIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkedinIcon.js","sourceRoot":"","sources":["../../src/icons/LinkedinIcon.tsx"],"names":[],"mappings":";AACA,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC7D,eACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,EACX,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,WAAW,KACf,KAAK,aAET,eACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,sRAAsR,GACxR,EACF,eACE,IAAI,EAAC,cAAc,EACnB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,iJAAiJ,EACnJ,QAAQ,EAAC,SAAS,GAClB,IACE,CACP,CAAA;AACD,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const TelegramIcon = (props) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 800, height: 800, fill: "currentColor", viewBox: "0 0 24 24", ...props, children: _jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M23.112 4.494c.318-1.55-1.205-2.837-2.68-2.267L2.342 9.216c-1.647.637-1.72 2.941-.117 3.682l3.94 1.818 1.873 6.559a1 1 0 0 0 1.67.432l2.886-2.887 4.043 3.033a2 2 0 0 0 3.16-1.198l3.315-16.16ZM3.063 11.082l18.09-6.99-3.316 16.161L13.1 16.7a1 1 0 0 0-1.307.093l-1.236 1.236.371-2.043 7.28-7.279a1 1 0 0 0-1.204-1.575L6.95 12.876l-3.888-1.794Zm5.114 3.397.606 2.123.233-1.281a1 1 0 0 1 .277-.528l2.22-2.22-3.336 1.906Z", clipRule: "evenodd" }) }));
|
|
3
|
+
export default TelegramIcon;
|
|
4
|
+
//# sourceMappingURL=TelegramIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TelegramIcon.js","sourceRoot":"","sources":["../../src/icons/TelegramIcon.tsx"],"names":[],"mappings":";AACA,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC7D,cACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,EACX,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,WAAW,KACf,KAAK,YAET,eACE,IAAI,EAAC,cAAc,EACnB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,iaAAia,EACna,QAAQ,EAAC,SAAS,GAClB,GACE,CACP,CAAA;AACD,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const TwitterIcon = (props) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 800, height: 800, fill: "currentColor", viewBox: "0 0 100 100", ...props, children: [_jsx("path", { fill: "currentColor", d: "M69.7 8.7H30.4C18.7 8.7 9.1 18.2 9.1 30v41.2c0 11.7 9.5 21.3 21.3 21.3h39.4c11.7 0 21.3-9.5 21.3-21.3V29.9C91 18.2 81.5 8.7 69.7 8.7zm7.1 69.6H61.4c-.1 0-.2 0-.2-.1L46.8 57.3h-.1C40.9 64 35.2 70.6 29.6 77.1c-.3.4-.7.7-1 1-.1.1-.2.1-.3.1h-4.2c-.1 0-.2 0-.1-.1l20.5-23.8c.1-.1.1-.2 0-.3L24.1 24.3v-.1h15.5c.1 0 .1 0 .2.1L53.4 44h.1l16.9-19.7c.1-.1.2-.1.3-.1h4.2c.2 0 .2.1.1.2L55.6 46.9c-.1.1-.1.2 0 .3l21.3 31s0 .1-.1.1z" }), _jsx("path", { d: "M37.8 27.8h-6.7c-.1 0-.1.1-.1.2l32.2 46.7H69.9c.1 0 .1-.1.1-.2L37.8 27.8z" })] }));
|
|
3
|
+
export default TwitterIcon;
|
|
4
|
+
//# sourceMappingURL=TwitterIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwitterIcon.js","sourceRoot":"","sources":["../../src/icons/TwitterIcon.tsx"],"names":[],"mappings":";AACA,MAAM,WAAW,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC5D,eAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,cAAc,EAAC,OAAO,EAAC,aAAa,KAAK,KAAK,aAClH,eAAM,IAAI,EAAC,cAAc,EAAC,CAAC,EAAC,oaAAoa,GAAG,EACnc,eAAM,CAAC,EAAC,2EAA2E,GAAG,IAClF,CACP,CAAA;AACD,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const WhatsappIcon = (props) => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 800, height: 800, fill: "currentColor", viewBox: "0 0 24 24", ...props, children: [_jsx("path", { fill: "currentColor", d: "M6.014 8.006c.114-.904 1.289-2.132 2.22-1.996V6.01c.907.172 1.625 1.734 2.03 2.436.286.509.1 1.025-.167 1.243-.361.29-.926.692-.808 1.095C9.5 11.5 12 14 13.23 14.711c.466.269.804-.44 1.092-.804.21-.28.726-.447 1.234-.171.759.442 1.474.956 2.135 1.534.33.276.408.684.179 1.115-.403.76-1.569 1.76-2.415 1.557C13.976 17.587 8 15.27 6.08 8.558c-.108-.318-.08-.438-.066-.552Z" }), _jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 23c-1.224 0-1.9-.131-3-.5l-2.106 1.053A2 2 0 0 1 4 21.763V19.5c-2.153-2.008-3-4.323-3-7.5C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11Zm-6-4.37-.636-.593C3.691 16.477 3 14.733 3 12a9 9 0 1 1 9 9c-.986 0-1.448-.089-2.364-.396l-.788-.264L6 21.764V18.63Z", clipRule: "evenodd" })] }));
|
|
3
|
+
export default WhatsappIcon;
|
|
4
|
+
//# sourceMappingURL=WhatsappIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhatsappIcon.js","sourceRoot":"","sources":["../../src/icons/WhatsappIcon.tsx"],"names":[],"mappings":";AACA,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE,CAAC,CAC7D,eACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,EACX,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,WAAW,KACf,KAAK,aAET,eACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,oXAAoX,GACtX,EACF,eACE,IAAI,EAAC,cAAc,EACnB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,uQAAuQ,EACzQ,QAAQ,EAAC,SAAS,GAClB,IACE,CACP,CAAA;AACD,eAAe,YAAY,CAAA"}
|
package/esm/testUtils.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { render as rtlRender, } from '@testing-library/react';
|
|
3
|
+
import { AlertProvider, AlertViewport } from '@memori.ai/ui';
|
|
4
|
+
function AlertProviderWrapper({ children }) {
|
|
5
|
+
return (_jsxs(AlertProvider, { children: [children, _jsx(AlertViewport, {})] }));
|
|
6
|
+
}
|
|
7
|
+
function render(ui, options) {
|
|
8
|
+
return rtlRender(ui, {
|
|
9
|
+
wrapper: AlertProviderWrapper,
|
|
10
|
+
...options,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export * from '@testing-library/react';
|
|
14
|
+
export { render };
|
|
15
|
+
//# sourceMappingURL=testUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../src/testUtils.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,IAAI,SAAS,GAGpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM7D,SAAS,oBAAoB,CAAC,EAAE,QAAQ,EAAiC;IACvE,OAAO,CACL,MAAC,aAAa,eACX,QAAQ,EACT,KAAC,aAAa,KAAG,IACH,CACjB,CAAC;AACJ,CAAC;AAUD,SAAS,MAAM,CACb,EAAsB,EACtB,OAAwC;IAExC,OAAO,SAAS,CAAC,EAAE,EAAE;QACnB,OAAO,EAAE,oBAAoB;QAC7B,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAGD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.
|
|
1
|
+
export declare const version = "8.31.0";
|
package/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '8.
|
|
1
|
+
export const version = '8.31.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -124,3 +124,48 @@
|
|
|
124
124
|
.memori-dropdown--avatar-initial:hover + .memori-dropdown--avatar-input,.memori-dropdown--avatar:hover + .memori-dropdown--avatar-input{
|
|
125
125
|
display: block;
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
.memori-dropdown--sustainability {
|
|
129
|
+
min-width: 260px;
|
|
130
|
+
padding: 0.625rem 0.75rem;
|
|
131
|
+
border-radius: 8px;
|
|
132
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 249, 252, 0.96) 100%);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.memori-dropdown--sustainability-title {
|
|
136
|
+
margin: 0 0 0.5rem 0;
|
|
137
|
+
font-size: 0.95rem;
|
|
138
|
+
font-weight: 700;
|
|
139
|
+
line-height: 1.2;
|
|
140
|
+
text-align: center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.memori-dropdown--sustainability-metrics {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: 0.35rem;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.memori-dropdown--sustainability-row {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: space-between;
|
|
153
|
+
padding: 0.4rem 0.5rem;
|
|
154
|
+
border-radius: 6px;
|
|
155
|
+
background: rgba(255, 255, 255, 0.8);
|
|
156
|
+
gap: 1rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.memori-dropdown--sustainability-label {
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
font-size: 0.82rem;
|
|
163
|
+
font-weight: 500;
|
|
164
|
+
gap: 0.35rem;
|
|
165
|
+
opacity: 0.9;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.memori-dropdown--sustainability-value {
|
|
169
|
+
font-size: 0.85rem;
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
}
|
|
@@ -26,6 +26,31 @@ const meta: Meta = {
|
|
|
26
26
|
|
|
27
27
|
export default meta;
|
|
28
28
|
|
|
29
|
+
const historyWithConsumption = [
|
|
30
|
+
...history,
|
|
31
|
+
{
|
|
32
|
+
...history[history.length - 1],
|
|
33
|
+
llmUsage: {
|
|
34
|
+
energyImpact: {
|
|
35
|
+
energy: { parsedValue: 0.0012 },
|
|
36
|
+
gwp: { parsedValue: 0.00045 },
|
|
37
|
+
wcf: { parsedValue: 0.0021 },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
...history[history.length - 1],
|
|
43
|
+
text: 'Second sustainability sample',
|
|
44
|
+
llmUsage: {
|
|
45
|
+
energyImpact: {
|
|
46
|
+
energy: 0.0008,
|
|
47
|
+
gwp: { source: '0.00035' },
|
|
48
|
+
wcf: { source: '0.0014' },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
] as any;
|
|
53
|
+
|
|
29
54
|
const Template: Story<Props> = args => {
|
|
30
55
|
const [speakerMuted, setSpeakerMuted] = React.useState(args.speakerMuted);
|
|
31
56
|
const [showSettingsDrawer, setShowSettingsDrawer] = React.useState(false);
|
|
@@ -283,3 +308,24 @@ WithLogin.args = {
|
|
|
283
308
|
hasUserActivatedSpeak: false,
|
|
284
309
|
showLogin: true,
|
|
285
310
|
};
|
|
311
|
+
|
|
312
|
+
export const WithSustainabilityPopover = Template.bind({});
|
|
313
|
+
WithSustainabilityPopover.args = {
|
|
314
|
+
memori,
|
|
315
|
+
history: historyWithConsumption,
|
|
316
|
+
setShowPositionDrawer: () => {},
|
|
317
|
+
setShowSettingsDrawer: () => {},
|
|
318
|
+
setShowChatHistoryDrawer: () => {},
|
|
319
|
+
setShowKnownFactsDrawer: () => {},
|
|
320
|
+
setShowExpertsDrawer: () => {},
|
|
321
|
+
setShowLoginDrawer: () => {},
|
|
322
|
+
clearHistory: () => {},
|
|
323
|
+
speakerMuted: false,
|
|
324
|
+
hasUserActivatedSpeak: true,
|
|
325
|
+
showShare: false,
|
|
326
|
+
showSettings: false,
|
|
327
|
+
showMessageConsumption: true,
|
|
328
|
+
apiClient: {
|
|
329
|
+
backend: {},
|
|
330
|
+
} as any,
|
|
331
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import {
|
|
4
4
|
Memori,
|
|
@@ -23,11 +23,13 @@ import DeepThought from '../icons/DeepThought';
|
|
|
23
23
|
import Group from '../icons/Group';
|
|
24
24
|
import UserIcon from '../icons/User';
|
|
25
25
|
import MessageIcon from '../icons/Message';
|
|
26
|
+
import Info from '../icons/Info';
|
|
26
27
|
import Logout from '../icons/Logout';
|
|
27
28
|
import { getErrori18nKey } from '../../helpers/error';
|
|
28
29
|
import toast from 'react-hot-toast';
|
|
29
30
|
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
30
31
|
import { Props as WidgetProps } from '../MemoriWidget/MemoriWidget';
|
|
32
|
+
import { BADGE_EMOJI } from '../../helpers/llmUsage';
|
|
31
33
|
|
|
32
34
|
const imgMimeTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
|
|
33
35
|
|
|
@@ -63,6 +65,7 @@ export interface Props {
|
|
|
63
65
|
apiClient: ReturnType<typeof memoriApiClient>;
|
|
64
66
|
layout?: WidgetProps['layout'];
|
|
65
67
|
additionalSettings?: WidgetProps['additionalSettings'];
|
|
68
|
+
showMessageConsumption?: boolean;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
const Header: React.FC<Props> = ({
|
|
@@ -97,11 +100,96 @@ const Header: React.FC<Props> = ({
|
|
|
97
100
|
apiClient,
|
|
98
101
|
layout,
|
|
99
102
|
additionalSettings,
|
|
103
|
+
showMessageConsumption = false,
|
|
100
104
|
}) => {
|
|
101
|
-
const { t } = useTranslation();
|
|
105
|
+
const { t, i18n } = useTranslation();
|
|
102
106
|
const { uploadAsset, pwlUpdateUser } = apiClient.backend;
|
|
103
107
|
const [fullScreenAvailable, setFullScreenAvailable] = useState(false);
|
|
104
108
|
const [fullScreen, setFullScreen] = useState(false);
|
|
109
|
+
|
|
110
|
+
type ImpactMetricType = 'energy' | 'co2' | 'water';
|
|
111
|
+
|
|
112
|
+
type LlmUsageEnergyImpact = {
|
|
113
|
+
energy?: number | { source?: string; parsedValue?: number };
|
|
114
|
+
gwp?: number | { source?: string; parsedValue?: number };
|
|
115
|
+
wcf?: number | { source?: string; parsedValue?: number };
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const getMetricValue = (
|
|
119
|
+
metric?: number | { source?: string; parsedValue?: number },
|
|
120
|
+
): number | undefined => {
|
|
121
|
+
if (typeof metric === 'number' && Number.isFinite(metric)) return metric;
|
|
122
|
+
if (!metric || typeof metric !== 'object') return undefined;
|
|
123
|
+
if (
|
|
124
|
+
typeof metric.parsedValue === 'number' &&
|
|
125
|
+
Number.isFinite(metric.parsedValue)
|
|
126
|
+
) {
|
|
127
|
+
return metric.parsedValue;
|
|
128
|
+
}
|
|
129
|
+
if (typeof metric.source === 'string') {
|
|
130
|
+
const parsed = Number(metric.source);
|
|
131
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
132
|
+
}
|
|
133
|
+
return undefined;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const formatMetricValue = (value: number, locale: string): string =>
|
|
137
|
+
new Intl.NumberFormat(locale, {
|
|
138
|
+
minimumFractionDigits: 0,
|
|
139
|
+
maximumFractionDigits: Math.abs(value) >= 1 ? 3 : 4,
|
|
140
|
+
}).format(value);
|
|
141
|
+
|
|
142
|
+
const formatImpactInReadableUnit = (
|
|
143
|
+
value: number,
|
|
144
|
+
metricType: ImpactMetricType,
|
|
145
|
+
locale: string,
|
|
146
|
+
): string => {
|
|
147
|
+
const absValue = Math.abs(value);
|
|
148
|
+
|
|
149
|
+
if (metricType === 'energy') {
|
|
150
|
+
if (absValue >= 1) return `${formatMetricValue(value, locale)} kWh`;
|
|
151
|
+
const wh = value * 1000;
|
|
152
|
+
if (Math.abs(wh) >= 1) return `${formatMetricValue(wh, locale)} Wh`;
|
|
153
|
+
return `${formatMetricValue(wh * 1000, locale)} mWh`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (metricType === 'co2') {
|
|
157
|
+
if (absValue >= 1) return `${formatMetricValue(value, locale)} kg`;
|
|
158
|
+
const g = value * 1000;
|
|
159
|
+
if (Math.abs(g) >= 1) return `${formatMetricValue(g, locale)} g`;
|
|
160
|
+
return `${formatMetricValue(g * 1000, locale)} mg`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (absValue >= 1) return `${formatMetricValue(value, locale)} L`;
|
|
164
|
+
const ml = value * 1000;
|
|
165
|
+
if (Math.abs(ml) >= 1) return `${formatMetricValue(ml, locale)} mL`;
|
|
166
|
+
return `${formatMetricValue(ml * 1000, locale)} μL`;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const currentLocale = i18n.language || navigator.language || 'en';
|
|
170
|
+
const chatLog = useMemo(() => ({ lines: history }), [history]);
|
|
171
|
+
const sustainabilityTotals = useMemo(() => {
|
|
172
|
+
const totals = { energy: 0, gwp: 0, wcf: 0 };
|
|
173
|
+
(chatLog?.lines ?? []).forEach(line => {
|
|
174
|
+
const energyImpact = (line as Message & {
|
|
175
|
+
llmUsage?: { energyImpact?: LlmUsageEnergyImpact };
|
|
176
|
+
}).llmUsage?.energyImpact;
|
|
177
|
+
if (!energyImpact) return;
|
|
178
|
+
totals.energy += getMetricValue(energyImpact.energy) ?? 0;
|
|
179
|
+
totals.gwp += getMetricValue(energyImpact.gwp) ?? 0;
|
|
180
|
+
totals.wcf += getMetricValue(energyImpact.wcf) ?? 0;
|
|
181
|
+
});
|
|
182
|
+
return totals;
|
|
183
|
+
}, [chatLog]);
|
|
184
|
+
const hasSustainabilityData = useMemo(
|
|
185
|
+
() =>
|
|
186
|
+
(chatLog?.lines ?? []).some(
|
|
187
|
+
line =>
|
|
188
|
+
!!(line as Message & { llmUsage?: { energyImpact?: LlmUsageEnergyImpact } })
|
|
189
|
+
.llmUsage?.energyImpact
|
|
190
|
+
),
|
|
191
|
+
[chatLog]
|
|
192
|
+
);
|
|
105
193
|
useEffect(() => {
|
|
106
194
|
if (document.fullscreenEnabled) {
|
|
107
195
|
setFullScreenAvailable(true);
|
|
@@ -219,6 +307,67 @@ const Header: React.FC<Props> = ({
|
|
|
219
307
|
onClick={() => setShowChatHistoryDrawer(true)}
|
|
220
308
|
/>
|
|
221
309
|
)}
|
|
310
|
+
{showMessageConsumption && hasSustainabilityData && (
|
|
311
|
+
<Dropdown
|
|
312
|
+
placement="bottom-right"
|
|
313
|
+
trigger={
|
|
314
|
+
<Button
|
|
315
|
+
primary
|
|
316
|
+
shape="circle"
|
|
317
|
+
className={cx('memori-header--button', 'memori-header--button--sustainability', hasSpacedButtons && 'memori-header--button-spaced')}
|
|
318
|
+
title={t('write_and_speak.showMessageConsumptionLabel') || 'LLM consumption'}
|
|
319
|
+
icon={<Info />}
|
|
320
|
+
/>
|
|
321
|
+
}
|
|
322
|
+
>
|
|
323
|
+
<div className="memori-dropdown--sustainability">
|
|
324
|
+
<h4 className="memori-dropdown--sustainability-title">
|
|
325
|
+
Consumo Totale Chat
|
|
326
|
+
</h4>
|
|
327
|
+
<div className="memori-dropdown--sustainability-metrics">
|
|
328
|
+
<div className="memori-dropdown--sustainability-row">
|
|
329
|
+
<span className="memori-dropdown--sustainability-label">
|
|
330
|
+
<span aria-hidden="true">{BADGE_EMOJI.energy}</span>{' '}
|
|
331
|
+
{t('energy') || 'Energy'}
|
|
332
|
+
</span>
|
|
333
|
+
<strong className="memori-dropdown--sustainability-value">
|
|
334
|
+
{formatImpactInReadableUnit(
|
|
335
|
+
sustainabilityTotals.energy,
|
|
336
|
+
'energy',
|
|
337
|
+
currentLocale
|
|
338
|
+
)}
|
|
339
|
+
</strong>
|
|
340
|
+
</div>
|
|
341
|
+
<div className="memori-dropdown--sustainability-row">
|
|
342
|
+
<span className="memori-dropdown--sustainability-label">
|
|
343
|
+
<span aria-hidden="true">{BADGE_EMOJI.co2}</span>{' '}
|
|
344
|
+
{t('co2') || 'CO2'}
|
|
345
|
+
</span>
|
|
346
|
+
<strong className="memori-dropdown--sustainability-value">
|
|
347
|
+
{formatImpactInReadableUnit(
|
|
348
|
+
sustainabilityTotals.gwp,
|
|
349
|
+
'co2',
|
|
350
|
+
currentLocale
|
|
351
|
+
)}
|
|
352
|
+
</strong>
|
|
353
|
+
</div>
|
|
354
|
+
<div className="memori-dropdown--sustainability-row">
|
|
355
|
+
<span className="memori-dropdown--sustainability-label">
|
|
356
|
+
<span aria-hidden="true">{BADGE_EMOJI.water}</span>{' '}
|
|
357
|
+
{t('water') || 'Water'}
|
|
358
|
+
</span>
|
|
359
|
+
<strong className="memori-dropdown--sustainability-value">
|
|
360
|
+
{formatImpactInReadableUnit(
|
|
361
|
+
sustainabilityTotals.wcf,
|
|
362
|
+
'water',
|
|
363
|
+
currentLocale
|
|
364
|
+
)}
|
|
365
|
+
</strong>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
</Dropdown>
|
|
370
|
+
)}
|
|
222
371
|
{fullScreenAvailable && (
|
|
223
372
|
<Button
|
|
224
373
|
primary
|
|
@@ -790,6 +790,43 @@ function hello() {
|
|
|
790
790
|
This project helps you build amazing applications.
|
|
791
791
|
</output>`;
|
|
792
792
|
|
|
793
|
+
const markdownCustomArtifact = `<output class="memori-artifact" data-mimetype="markdown" data-title="CUSTOM_MARKDOWN_TEST.md">
|
|
794
|
+
# Custom Markdown Rendering Test
|
|
795
|
+
|
|
796
|
+
## Text formatting
|
|
797
|
+
Use **bold**, *italic*, and \`inline code\` in the same sentence.
|
|
798
|
+
|
|
799
|
+
## Checklist
|
|
800
|
+
- [x] Parse headings
|
|
801
|
+
- [x] Render lists
|
|
802
|
+
- [ ] Verify custom table support
|
|
803
|
+
|
|
804
|
+
## Table
|
|
805
|
+
| Feature | Expected |
|
|
806
|
+
| --- | --- |
|
|
807
|
+
| Link rendering | Opens in a new tab |
|
|
808
|
+
| Code block | Preserves indentation |
|
|
809
|
+
| Blockquote | Styled correctly |
|
|
810
|
+
|
|
811
|
+
## Blockquote
|
|
812
|
+
> This is a quoted note to verify markdown styling in preview mode.
|
|
813
|
+
|
|
814
|
+
## Code block
|
|
815
|
+
\`\`\`ts
|
|
816
|
+
type User = {
|
|
817
|
+
id: string;
|
|
818
|
+
name: string;
|
|
819
|
+
active: boolean;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
const toLabel = (user: User) => \`\${user.name} (\${user.id})\`;
|
|
823
|
+
\`\`\`
|
|
824
|
+
|
|
825
|
+
## Links
|
|
826
|
+
- [Memori website](https://memori.ai)
|
|
827
|
+
- [Example docs](https://example.com/docs)
|
|
828
|
+
</output>`;
|
|
829
|
+
|
|
793
830
|
const cssArtifact = `<output class="memori-artifact" data-mimetype="css">
|
|
794
831
|
/* Modern CSS Grid Layout */
|
|
795
832
|
.container {
|
|
@@ -1112,6 +1149,40 @@ This includes all the essential sections for a project README with proper format
|
|
|
1112
1149
|
),
|
|
1113
1150
|
};
|
|
1114
1151
|
|
|
1152
|
+
export const MarkdownCustomRendering: Story = {
|
|
1153
|
+
args: {},
|
|
1154
|
+
render: () => (
|
|
1155
|
+
<Chat
|
|
1156
|
+
memori={mockMemori}
|
|
1157
|
+
tenant={mockTenant}
|
|
1158
|
+
sessionID="test-session"
|
|
1159
|
+
history={[
|
|
1160
|
+
{
|
|
1161
|
+
text: `I generated a custom markdown artifact to validate rendering behavior:
|
|
1162
|
+
|
|
1163
|
+
${markdownCustomArtifact}
|
|
1164
|
+
|
|
1165
|
+
Please check preview and code tabs to verify the output.`,
|
|
1166
|
+
fromUser: false,
|
|
1167
|
+
timestamp: new Date().toISOString(),
|
|
1168
|
+
},
|
|
1169
|
+
]}
|
|
1170
|
+
pushMessage={mockPushMessage}
|
|
1171
|
+
simulateUserPrompt={mockSimulateUserPrompt}
|
|
1172
|
+
onChangeUserMessage={mockOnChangeUserMessage}
|
|
1173
|
+
sendMessage={mockSendMessage}
|
|
1174
|
+
setEnableFocusChatInput={mockSetEnableFocusChatInput}
|
|
1175
|
+
stopAudio={mockStopAudio}
|
|
1176
|
+
startListening={mockStartListening}
|
|
1177
|
+
stopListening={mockStopListening}
|
|
1178
|
+
setSendOnEnter={mockSetSendOnEnter}
|
|
1179
|
+
setAttachmentsMenuOpen={mockSetAttachmentsMenuOpen}
|
|
1180
|
+
showInputs={false}
|
|
1181
|
+
isChatlogPanel={false}
|
|
1182
|
+
/>
|
|
1183
|
+
),
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1115
1186
|
export const CSSStyles: Story = {
|
|
1116
1187
|
args: {},
|
|
1117
1188
|
render: () => (
|