@memori.ai/memori-react 8.14.0 → 8.14.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 +13 -0
- package/dist/components/Chat/Chat.js +21 -11
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.css +0 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +4 -2
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.css +4 -2
- package/dist/components/PoweredBy/PoweredBy.css +3 -2
- package/dist/components/layouts/website-assistant.css +1 -0
- package/esm/components/Chat/Chat.js +22 -12
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.css +0 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +4 -2
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.css +4 -2
- package/esm/components/PoweredBy/PoweredBy.css +3 -2
- package/esm/components/layouts/website-assistant.css +1 -0
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +33 -13
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +343 -275
- package/src/components/ChatInputs/ChatInputs.css +0 -1
- package/src/components/MediaWidget/MediaItemWidget.tsx +9 -2
- package/src/components/MemoriWidget/MemoriWidget.css +4 -2
- package/src/components/PoweredBy/PoweredBy.css +3 -2
- package/src/components/layouts/layouts.stories.tsx +29 -3
- package/src/components/layouts/website-assistant.css +1 -0
|
@@ -415,7 +415,11 @@ export const RenderMediaItem = ({
|
|
|
415
415
|
// Helper function to count lines in content
|
|
416
416
|
const countLines = (content: string | undefined): number => {
|
|
417
417
|
if (!content) return 0;
|
|
418
|
-
|
|
418
|
+
// Support all common newline conventions:
|
|
419
|
+
// - Unix: \n
|
|
420
|
+
// - Windows: \r\n
|
|
421
|
+
// - Classic Mac: \r
|
|
422
|
+
return content.split(/\r\n|\r|\n/).length;
|
|
419
423
|
};
|
|
420
424
|
|
|
421
425
|
export const RenderSnippetItem = ({
|
|
@@ -434,7 +438,10 @@ export const RenderSnippetItem = ({
|
|
|
434
438
|
onClick?: (mediumID: string) => void;
|
|
435
439
|
}) => {
|
|
436
440
|
const lineCount = countLines(item.content);
|
|
437
|
-
const
|
|
441
|
+
const contentLength = item.content?.length ?? 0;
|
|
442
|
+
// Treat very long single-line snippets as "long" so we show a preview,
|
|
443
|
+
// otherwise plain-text uploads with only '\r' (or no '\n') would render full.
|
|
444
|
+
const isShortSnippet = lineCount <= 5 && contentLength <= 200;
|
|
438
445
|
|
|
439
446
|
// For short snippets, show them directly without the clickable link
|
|
440
447
|
if (isShortSnippet) {
|
|
@@ -142,12 +142,14 @@
|
|
|
142
142
|
bottom: 0;
|
|
143
143
|
left: 0;
|
|
144
144
|
display: inline-flex;
|
|
145
|
-
flex-wrap:
|
|
146
|
-
|
|
145
|
+
flex-wrap: nowrap;
|
|
146
|
+
align-items: center;
|
|
147
|
+
padding: 0.25rem 1rem;
|
|
147
148
|
border-radius: 10px;
|
|
148
149
|
background-color: var(--memori-inner-bg, transparent);
|
|
149
150
|
color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
|
|
150
151
|
font-size: 0.7em;
|
|
152
|
+
white-space: nowrap;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
@media (max-width: 870px) {
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
bottom: 1rem;
|
|
5
5
|
left: 0;
|
|
6
6
|
display: inline-flex;
|
|
7
|
-
flex-wrap:
|
|
7
|
+
flex-wrap: nowrap;
|
|
8
8
|
align-items: center;
|
|
9
|
-
padding: 0.25rem
|
|
9
|
+
padding: 0.25rem 1rem;
|
|
10
10
|
border-radius: 10px;
|
|
11
11
|
background-color: var(--memori-inner-bg, transparent);
|
|
12
12
|
box-shadow: var(--memori-button-box-shadow);
|
|
13
13
|
color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
|
|
14
14
|
font-size: 0.7em;
|
|
15
|
+
white-space: nowrap;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
@media (max-width: 768px) {
|
|
@@ -134,13 +134,39 @@ Custom.args = {
|
|
|
134
134
|
|
|
135
135
|
export const WebsiteAssistant = Template.bind({});
|
|
136
136
|
WebsiteAssistant.args = {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
showShare: true,
|
|
137
|
+
uiLang: 'EN',
|
|
138
|
+
showShare: false,
|
|
140
139
|
showSettings: true,
|
|
141
140
|
memori: memori,
|
|
142
141
|
tenant,
|
|
143
142
|
layout: 'WEBSITE_ASSISTANT',
|
|
143
|
+
memoriName: 'Memori',
|
|
144
|
+
memoriID: '25ced51c-3520-41af-8bbe-222d861b8e32',
|
|
145
|
+
ownerUserName: 'memoridev',
|
|
146
|
+
tenantID: 'www.aisuru.com',
|
|
147
|
+
apiURL: 'https://backend.memori.ai',
|
|
148
|
+
baseURL: 'https://www.aisuru.com',
|
|
149
|
+
spokenLang: 'EN',
|
|
150
|
+
context: {
|
|
151
|
+
SOURCE: 'WEBSITE',
|
|
152
|
+
PATH: '/en/',
|
|
153
|
+
},
|
|
154
|
+
multilingual: true,
|
|
155
|
+
integrationID: 'cb3c4776-7f0b-4f97-a773-c32a5d7a3bf1',
|
|
156
|
+
integration: {
|
|
157
|
+
...integration,
|
|
158
|
+
customData: JSON.stringify({
|
|
159
|
+
textColor: '#2a2a2a',
|
|
160
|
+
buttonBgColor: '#653165',
|
|
161
|
+
buttonTextColor: '#ffffff',
|
|
162
|
+
blurBackground: true,
|
|
163
|
+
innerBgColor: 'light',
|
|
164
|
+
innerBgAlpha: 0.8,
|
|
165
|
+
multilanguage: true,
|
|
166
|
+
avatar: 'readyplayerme',
|
|
167
|
+
avatarURL: 'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
|
|
168
|
+
}),
|
|
169
|
+
},
|
|
144
170
|
};
|
|
145
171
|
|
|
146
172
|
export const HiddenChat = Template.bind({});
|