@memori.ai/memori-react 7.19.1 → 7.21.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 +57 -0
- package/dist/components/Avatar/Avatar.js +3 -3
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.d.ts +3 -2
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js +13 -6
- package/dist/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.d.ts +14 -18
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js +19 -77
- package/dist/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.d.ts +17 -2
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +95 -70
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.d.ts +65 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js +747 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js.map +1 -0
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.d.ts +9 -2
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +60 -2
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.d.ts +3 -4
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js +5 -11
- package/dist/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js.map +1 -1
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +13 -52
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js +68 -70
- package/dist/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
- package/dist/components/Avatar/AvatarView/index.d.ts +1 -1
- package/dist/components/Avatar/AvatarView/index.js +2 -2
- package/dist/components/Avatar/AvatarView/index.js.map +1 -1
- package/dist/components/Chat/Chat.js +2 -2
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatBubble/ChatBubble.js +12 -9
- package/dist/components/ChatBubble/ChatBubble.js.map +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/dist/components/LoginDrawer/LoginDrawer.js +6 -6
- package/dist/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +143 -64
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/SignupForm/SignupForm.js +4 -4
- package/dist/components/SignupForm/SignupForm.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +5 -5
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +2 -2
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/dist/components/WhyThisAnswer/WhyThisAnswer.js +2 -1
- package/dist/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
- package/dist/context/visemeContext.js +0 -39
- package/dist/context/visemeContext.js.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/locales/de.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/it.json +1 -0
- package/esm/components/Avatar/Avatar.js +3 -3
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.d.ts +3 -2
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js +13 -6
- package/esm/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.d.ts +14 -18
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js +20 -78
- package/esm/components/Avatar/AvatarView/AvatarComponent/avatarComponent.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.d.ts +17 -2
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js +99 -74
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.d.ts +65 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js +743 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.js.map +1 -0
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.d.ts +9 -2
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js +61 -3
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.d.ts +3 -4
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js +5 -11
- package/esm/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.js.map +1 -1
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.d.ts +13 -52
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js +67 -69
- package/esm/components/Avatar/AvatarView/AvatarComponent/constants.js.map +1 -1
- package/esm/components/Avatar/AvatarView/index.d.ts +1 -1
- package/esm/components/Avatar/AvatarView/index.js +2 -2
- package/esm/components/Avatar/AvatarView/index.js.map +1 -1
- package/esm/components/Chat/Chat.js +2 -2
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/ChatBubble/ChatBubble.js +12 -9
- package/esm/components/ChatBubble/ChatBubble.js.map +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/esm/components/LoginDrawer/LoginDrawer.js +6 -6
- package/esm/components/LoginDrawer/LoginDrawer.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +143 -64
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/SignupForm/SignupForm.js +4 -4
- package/esm/components/SignupForm/SignupForm.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +5 -5
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +2 -2
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/esm/components/WhyThisAnswer/WhyThisAnswer.js +2 -1
- package/esm/components/WhyThisAnswer/WhyThisAnswer.js.map +1 -1
- package/esm/context/visemeContext.js +0 -39
- package/esm/context/visemeContext.js.map +1 -1
- package/esm/index.js +4 -3
- package/esm/index.js.map +1 -1
- package/esm/locales/de.json +1 -0
- package/esm/locales/en.json +1 -0
- package/esm/locales/es.json +1 -0
- package/esm/locales/fr.json +1 -0
- package/esm/locales/it.json +1 -0
- package/package.json +2 -2
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.tsx +15 -8
- package/src/components/Avatar/AvatarView/AvatarComponent/avatarComponent.tsx +64 -219
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +221 -124
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.ts +1250 -0
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +164 -8
- package/src/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.tsx +19 -17
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +80 -79
- package/src/components/Avatar/AvatarView/index.tsx +1 -7
- package/src/components/Chat/Chat.tsx +2 -2
- package/src/components/ChatBubble/ChatBubble.tsx +37 -26
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +1 -1
- package/src/components/LoginDrawer/LoginDrawer.tsx +6 -6
- package/src/components/MemoriWidget/MemoriWidget.tsx +184 -78
- package/src/components/SignupForm/SignupForm.tsx +5 -5
- package/src/components/StartPanel/StartPanel.tsx +5 -5
- package/src/components/UploadButton/UploadButton.tsx +4 -4
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +1 -1
- package/src/components/WhyThisAnswer/WhyThisAnswer.css +43 -0
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +44 -3
- package/src/components/WhyThisAnswer/WhyThisAnswer.test.tsx +128 -8
- package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +28 -3
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +15 -1
- package/src/components/layouts/layouts.stories.tsx +0 -8
- package/src/context/visemeContext.tsx +40 -41
- package/src/index.stories.tsx +63 -65
- package/src/index.tsx +5 -3
- package/src/locales/de.json +1 -0
- package/src/locales/en.json +1 -0
- package/src/locales/es.json +1 -0
- package/src/locales/fr.json +1 -0
- package/src/locales/it.json +1 -0
- package/src/mocks/data.ts +3 -9
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.ts +0 -308
- package/src/helpers/tenant.ts +0 -47
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import { sessionID
|
|
3
|
+
import { sessionID } from '../../mocks/data';
|
|
4
4
|
import I18nWrapper from '../../I18nWrapper';
|
|
5
5
|
import WhyThisAnswer, { Props } from './WhyThisAnswer';
|
|
6
|
+
import { SearchMatches } from '@memori.ai/memori-api-client/dist/types';
|
|
6
7
|
|
|
7
8
|
import './WhyThisAnswer.css';
|
|
8
|
-
import { SearchMatches } from '@memori.ai/memori-api-client/dist/types';
|
|
9
9
|
|
|
10
10
|
const meta: Meta = {
|
|
11
11
|
title: 'Why This Answer',
|
|
@@ -69,6 +69,7 @@ WithData.args = {
|
|
|
69
69
|
confidenceLevel: 'HIGH',
|
|
70
70
|
memory: {
|
|
71
71
|
memoryID: '1',
|
|
72
|
+
memoryType: 'Question',
|
|
72
73
|
title: 'This is the title of the content',
|
|
73
74
|
titleVariants: [
|
|
74
75
|
"This is a variant of the content's title",
|
|
@@ -89,6 +90,7 @@ WithData.args = {
|
|
|
89
90
|
confidenceLevel: 'LOW',
|
|
90
91
|
memory: {
|
|
91
92
|
memoryID: '2',
|
|
93
|
+
memoryType: 'Question',
|
|
92
94
|
title: 'Content with a long answer',
|
|
93
95
|
titleVariants: undefined,
|
|
94
96
|
answers: [
|
|
@@ -105,6 +107,7 @@ WithData.args = {
|
|
|
105
107
|
memoryID: '3',
|
|
106
108
|
title: 'Content with sources',
|
|
107
109
|
titleVariants: undefined,
|
|
110
|
+
memoryType: 'Question',
|
|
108
111
|
answers: [
|
|
109
112
|
{
|
|
110
113
|
text: 'This is a test answer',
|
|
@@ -130,9 +133,9 @@ WithData.args = {
|
|
|
130
133
|
confidence: 0.7,
|
|
131
134
|
confidenceLevel: 'MEDIUM',
|
|
132
135
|
memory: {
|
|
133
|
-
...memoryQuestion,
|
|
134
136
|
memoryID: '4',
|
|
135
137
|
title: 'Content with links',
|
|
138
|
+
memoryType: 'Question',
|
|
136
139
|
titleVariants: undefined,
|
|
137
140
|
answers: [
|
|
138
141
|
{
|
|
@@ -155,5 +158,43 @@ WithData.args = {
|
|
|
155
158
|
],
|
|
156
159
|
},
|
|
157
160
|
} as SearchMatches,
|
|
161
|
+
{
|
|
162
|
+
confidence: 0.7,
|
|
163
|
+
confidenceLevel: 'MEDIUM',
|
|
164
|
+
memory: {
|
|
165
|
+
memoryID: '5',
|
|
166
|
+
memoryType: 'Question',
|
|
167
|
+
title: 'Content with receiver',
|
|
168
|
+
titleVariants: undefined,
|
|
169
|
+
receiverName: 'receiver',
|
|
170
|
+
receiverTag: '🧑💻',
|
|
171
|
+
answers: [
|
|
172
|
+
{
|
|
173
|
+
text: 'This is a an answer',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
media: [],
|
|
177
|
+
},
|
|
178
|
+
} as SearchMatches,
|
|
179
|
+
{
|
|
180
|
+
confidence: 0.5,
|
|
181
|
+
confidenceLevel: 'MEDIUM',
|
|
182
|
+
memory: {
|
|
183
|
+
memoryID: '5',
|
|
184
|
+
memoryType: 'Question',
|
|
185
|
+
title: 'Content with context',
|
|
186
|
+
titleVariants: undefined,
|
|
187
|
+
contextVars: {
|
|
188
|
+
KEY1: 'VALUE1',
|
|
189
|
+
KEY2: 'VALUE2',
|
|
190
|
+
},
|
|
191
|
+
answers: [
|
|
192
|
+
{
|
|
193
|
+
text: 'This is a an answer',
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
media: [],
|
|
197
|
+
},
|
|
198
|
+
} as SearchMatches,
|
|
158
199
|
],
|
|
159
200
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import WhyThisAnswer from './WhyThisAnswer';
|
|
4
|
-
import { sessionID
|
|
4
|
+
import { sessionID } from '../../mocks/data';
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
7
|
// @ts-ignore
|
|
@@ -61,12 +61,37 @@ it('renders WhyThisAnswer visible unchanged', () => {
|
|
|
61
61
|
expect(container).toMatchSnapshot();
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
+
it('renders WhyThisAnswer loading unchanged', () => {
|
|
65
|
+
const { container } = render(
|
|
66
|
+
<WhyThisAnswer
|
|
67
|
+
apiURL="https://backend.memori.ai"
|
|
68
|
+
sessionID={sessionID}
|
|
69
|
+
visible={true}
|
|
70
|
+
message={{
|
|
71
|
+
questionAnswered: 'Test message',
|
|
72
|
+
text: 'This is a test content',
|
|
73
|
+
date: '2021-01-01',
|
|
74
|
+
placeName: 'Test Place',
|
|
75
|
+
placeLatitude: 0,
|
|
76
|
+
placeLongitude: 0,
|
|
77
|
+
placeUncertaintyKm: 0,
|
|
78
|
+
contextVars: {
|
|
79
|
+
KEY: 'value',
|
|
80
|
+
},
|
|
81
|
+
}}
|
|
82
|
+
closeDrawer={jest.fn()}
|
|
83
|
+
_TEST_loading={true}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
expect(container).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
|
|
64
89
|
it('renders WhyThisAnswer with data unchanged', () => {
|
|
65
90
|
const { container } = render(
|
|
66
91
|
<WhyThisAnswer
|
|
67
92
|
apiURL="https://backend.memori.ai"
|
|
68
93
|
sessionID={sessionID}
|
|
69
|
-
visible={
|
|
94
|
+
visible={true}
|
|
70
95
|
message={{
|
|
71
96
|
questionAnswered: 'Test message',
|
|
72
97
|
text: 'This is a test content',
|
|
@@ -84,7 +109,8 @@ it('renders WhyThisAnswer with data unchanged', () => {
|
|
|
84
109
|
confidence: 0.8,
|
|
85
110
|
confidenceLevel: 'HIGH',
|
|
86
111
|
memory: {
|
|
87
|
-
|
|
112
|
+
memoryID: '1',
|
|
113
|
+
memoryType: 'Question',
|
|
88
114
|
title: 'This is the title of the content',
|
|
89
115
|
titleVariants: [
|
|
90
116
|
"This is a variant of the content's title",
|
|
@@ -94,26 +120,120 @@ it('renders WhyThisAnswer with data unchanged', () => {
|
|
|
94
120
|
{
|
|
95
121
|
text: 'This is a test answer',
|
|
96
122
|
},
|
|
123
|
+
{
|
|
124
|
+
text: 'This is another answer',
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
confidence: 0.5,
|
|
131
|
+
confidenceLevel: 'LOW',
|
|
132
|
+
memory: {
|
|
133
|
+
memoryID: '2',
|
|
134
|
+
memoryType: 'Question',
|
|
135
|
+
title: 'Content with a long answer',
|
|
136
|
+
titleVariants: undefined,
|
|
137
|
+
answers: [
|
|
138
|
+
{
|
|
139
|
+
text: 'Suspendisse a sodales nulla, sed semper nisi. Suspendisse a sodales nulla, sed semper nisi. Suspendisse a sodales nulla, sed semper nisi. Suspendisse a sodales nulla, sed semper nisi. Suspendisse a sodales nulla, sed semper nisi.',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
confidence: 0.5,
|
|
146
|
+
confidenceLevel: 'LOW',
|
|
147
|
+
memory: {
|
|
148
|
+
memoryID: '3',
|
|
149
|
+
title: 'Content with sources',
|
|
150
|
+
titleVariants: undefined,
|
|
151
|
+
memoryType: 'Question',
|
|
152
|
+
answers: [
|
|
153
|
+
{
|
|
154
|
+
text: 'This is a test answer',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
media: [
|
|
158
|
+
{
|
|
159
|
+
mediumID: '1',
|
|
160
|
+
mimeType: 'text/plain',
|
|
161
|
+
content:
|
|
162
|
+
'This is a source. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse a sodales nulla, sed semper nisi. Suspendisse a sodales nulla, sed semper nisi.',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
mediumID: '2',
|
|
166
|
+
mimeType: 'text/plain',
|
|
167
|
+
content:
|
|
168
|
+
'This is a source.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit.\nCras lobortis volutpat nunc.\nProin tincidunt enim in felis aliquet, a ultricies purus bibendum.\n\nQuisque in ultrices lectus.\nNulla at urna diam.\n\nProin sodales lobortis libero eu facilisis.',
|
|
169
|
+
},
|
|
97
170
|
],
|
|
98
|
-
memoryID: '1',
|
|
99
171
|
},
|
|
100
172
|
},
|
|
101
173
|
{
|
|
102
174
|
confidence: 0.7,
|
|
103
175
|
confidenceLevel: 'MEDIUM',
|
|
104
176
|
memory: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
177
|
+
memoryID: '4',
|
|
178
|
+
title: 'Content with links',
|
|
179
|
+
memoryType: 'Question',
|
|
108
180
|
titleVariants: undefined,
|
|
109
181
|
answers: [
|
|
110
182
|
{
|
|
111
183
|
text: 'This is a an answer',
|
|
112
184
|
},
|
|
185
|
+
],
|
|
186
|
+
media: [
|
|
113
187
|
{
|
|
114
|
-
|
|
188
|
+
mediumID: '1',
|
|
189
|
+
mimeType: 'text/html',
|
|
190
|
+
url: 'https://memori.ai',
|
|
191
|
+
title: 'Memori.AI',
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
mediumID: '2',
|
|
195
|
+
mimeType: 'text/html',
|
|
196
|
+
url: 'https://nzambello.dev',
|
|
197
|
+
title: 'Nicola Zambello',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
confidence: 0.7,
|
|
204
|
+
confidenceLevel: 'MEDIUM',
|
|
205
|
+
memory: {
|
|
206
|
+
memoryID: '5',
|
|
207
|
+
memoryType: 'Question',
|
|
208
|
+
title: 'Content with receiver',
|
|
209
|
+
titleVariants: undefined,
|
|
210
|
+
receiverName: 'receiver',
|
|
211
|
+
receiverTag: '🧑💻',
|
|
212
|
+
answers: [
|
|
213
|
+
{
|
|
214
|
+
text: 'This is a an answer',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
media: [],
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
confidence: 0.5,
|
|
222
|
+
confidenceLevel: 'MEDIUM',
|
|
223
|
+
memory: {
|
|
224
|
+
memoryID: '5',
|
|
225
|
+
memoryType: 'Question',
|
|
226
|
+
title: 'Content with context',
|
|
227
|
+
titleVariants: undefined,
|
|
228
|
+
contextVars: {
|
|
229
|
+
KEY: 'VALUE',
|
|
230
|
+
},
|
|
231
|
+
answers: [
|
|
232
|
+
{
|
|
233
|
+
text: 'This is a an answer',
|
|
115
234
|
},
|
|
116
235
|
],
|
|
236
|
+
media: [],
|
|
117
237
|
},
|
|
118
238
|
},
|
|
119
239
|
]}
|
|
@@ -12,6 +12,7 @@ import { getErrori18nKey } from '../../helpers/error';
|
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import Snippet from '../Snippet/Snippet';
|
|
14
14
|
import MediaWidget from '../MediaWidget/MediaWidget';
|
|
15
|
+
import Card from '../ui/Card';
|
|
15
16
|
|
|
16
17
|
export interface Props {
|
|
17
18
|
apiURL: string;
|
|
@@ -152,16 +153,40 @@ const WhyThisAnswer = ({
|
|
|
152
153
|
{m.confidenceLevel}
|
|
153
154
|
</span>
|
|
154
155
|
<div className="memori--whythisanswer-title-text">
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
|
|
156
|
+
<div className="memori--whythisanswer-title-text-top-container">
|
|
157
|
+
<p>
|
|
158
|
+
<strong>{addQuestionMark(m.memory.title ?? '')}</strong>
|
|
159
|
+
</p>
|
|
160
|
+
</div>
|
|
158
161
|
<p>
|
|
159
162
|
{m.memory.titleVariants
|
|
160
163
|
?.map(t => addQuestionMark(t))
|
|
161
164
|
?.join(' | ')}
|
|
162
165
|
</p>
|
|
166
|
+
{(m.memory.receiverName || m.memory.receiverTag) && (
|
|
167
|
+
<p className="memori--whythisanswer-title-text-top">
|
|
168
|
+
{t('receiverLabel')}: {m.memory.receiverTag}{' '}
|
|
169
|
+
{m.memory.receiverName}
|
|
170
|
+
</p>
|
|
171
|
+
)}
|
|
163
172
|
</div>
|
|
164
173
|
</div>
|
|
174
|
+
{m.memory.contextVars && (
|
|
175
|
+
<div className="memori--whythisanswer-contextvars">
|
|
176
|
+
{Object.entries(m.memory.contextVars || {}).map(
|
|
177
|
+
([key, value]) => (
|
|
178
|
+
<Card
|
|
179
|
+
key={key}
|
|
180
|
+
className="memori--whythisanswer-contextvars-card"
|
|
181
|
+
>
|
|
182
|
+
<span>
|
|
183
|
+
{key}: {value?.toString() || '✔️'}
|
|
184
|
+
</span>
|
|
185
|
+
</Card>
|
|
186
|
+
)
|
|
187
|
+
)}
|
|
188
|
+
</div>
|
|
189
|
+
)}
|
|
165
190
|
{m.memory.answers?.map((a, i) => (
|
|
166
191
|
<p key={i} className="memori--whythisanswer-answer">
|
|
167
192
|
<Expandable rows={3}>{a.text}</Expandable>
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`renders WhyThisAnswer hidden unchanged 1`] = `<div />`;
|
|
4
4
|
|
|
5
|
+
exports[`renders WhyThisAnswer loading unchanged 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
<div
|
|
8
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
9
|
+
/>
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
12
|
+
|
|
5
13
|
exports[`renders WhyThisAnswer visible unchanged 1`] = `
|
|
6
14
|
<div>
|
|
7
15
|
<div
|
|
@@ -10,4 +18,10 @@ exports[`renders WhyThisAnswer visible unchanged 1`] = `
|
|
|
10
18
|
</div>
|
|
11
19
|
`;
|
|
12
20
|
|
|
13
|
-
exports[`renders WhyThisAnswer with data unchanged 1`] =
|
|
21
|
+
exports[`renders WhyThisAnswer with data unchanged 1`] = `
|
|
22
|
+
<div>
|
|
23
|
+
<div
|
|
24
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
@@ -572,14 +572,6 @@ ZoomedFullBody.args = {
|
|
|
572
572
|
lastChangeTimestamp: '2022-06-13T14:44:52.833573Z',
|
|
573
573
|
},
|
|
574
574
|
],
|
|
575
|
-
avatarURL:
|
|
576
|
-
'https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png',
|
|
577
|
-
coverURL:
|
|
578
|
-
'https://assets.memori.ai/api/v2/asset/e9bb9f6d-8f34-45ab-af9e-6d630d9a51a8.png',
|
|
579
|
-
avatar3DURL:
|
|
580
|
-
'https://assets.memori.ai/api/v2/asset/3932bf70-e953-4e8a-b63a-f316544c283e.glb',
|
|
581
|
-
avatarOriginal3DURL:
|
|
582
|
-
'https://assets.memori.ai/api/v2/asset/3932bf70-e953-4e8a-b63a-f316544c283e.glb',
|
|
583
575
|
needsPosition: false,
|
|
584
576
|
voiceType: 'FEMALE',
|
|
585
577
|
culture: 'it-IT',
|
|
@@ -115,19 +115,18 @@ const timing = {
|
|
|
115
115
|
currentWeight + (targetWeight - currentWeight) * SMOOTHING_FACTOR,
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
const createLogger =
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const logVisemeDebug = createLogger('debug');
|
|
118
|
+
// const createLogger =
|
|
119
|
+
// (type: 'event' | 'error' | 'debug') => (event: string, data: any) => {
|
|
120
|
+
// const styles = {
|
|
121
|
+
// event: 'color: #4CAF50; font-weight: bold;',
|
|
122
|
+
// error: 'color: #f44336; font-weight: bold;',
|
|
123
|
+
// debug: 'color: #2196F3; font-weight: bold;',
|
|
124
|
+
// };
|
|
125
|
+
// };
|
|
126
|
+
|
|
127
|
+
// const logVisemeEvent = createLogger('event');
|
|
128
|
+
// const logVisemeError = createLogger('error');
|
|
129
|
+
// const logVisemeDebug = createLogger('debug');
|
|
131
130
|
|
|
132
131
|
type VisemeState = 'idle' | 'preparing' | 'active' | 'paused' | 'finished';
|
|
133
132
|
|
|
@@ -148,10 +147,10 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
148
147
|
|
|
149
148
|
// Listen to audio context state changes
|
|
150
149
|
ctx.onstatechange = () => {
|
|
151
|
-
logVisemeEvent('Audio Context State Change', {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
150
|
+
// logVisemeEvent('Audio Context State Change', {
|
|
151
|
+
// state: ctx.state,
|
|
152
|
+
// currentTime: ctx.currentTime,
|
|
153
|
+
// });
|
|
155
154
|
|
|
156
155
|
switch (ctx.state) {
|
|
157
156
|
case 'running':
|
|
@@ -212,7 +211,7 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
212
211
|
|
|
213
212
|
const startProcessing = useCallback((audioCtx: IAudioContext) => {
|
|
214
213
|
if (!audioCtx) {
|
|
215
|
-
logVisemeError('No audio context provided', { state: visemeState });
|
|
214
|
+
// logVisemeError('No audio context provided', { state: visemeState });
|
|
216
215
|
return;
|
|
217
216
|
}
|
|
218
217
|
|
|
@@ -222,11 +221,11 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
222
221
|
setIsProcessing(true);
|
|
223
222
|
setVisemeState('active');
|
|
224
223
|
|
|
225
|
-
logVisemeEvent('Started Processing', {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
});
|
|
224
|
+
// logVisemeEvent('Started Processing', {
|
|
225
|
+
// audioTime: audioCtx.currentTime,
|
|
226
|
+
// queueLength: visemeQueueRef.current.length,
|
|
227
|
+
// state: visemeState,
|
|
228
|
+
// });
|
|
230
229
|
}, []);
|
|
231
230
|
|
|
232
231
|
const stopProcessing = useCallback(() => {
|
|
@@ -237,10 +236,10 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
237
236
|
frameCountRef.current = 0;
|
|
238
237
|
audioContextRef.current = null;
|
|
239
238
|
|
|
240
|
-
logVisemeEvent('Stopped Processing', {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
239
|
+
// logVisemeEvent('Stopped Processing', {
|
|
240
|
+
// queueLength: visemeQueueRef.current.length,
|
|
241
|
+
// state: visemeState,
|
|
242
|
+
// });
|
|
244
243
|
}, []);
|
|
245
244
|
|
|
246
245
|
const updateCurrentViseme = useCallback(
|
|
@@ -263,13 +262,13 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
263
262
|
);
|
|
264
263
|
|
|
265
264
|
//log it every LOG_INTERVAL frames
|
|
266
|
-
if (frameCountRef.current % LOG_INTERVAL === 60) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
265
|
+
// if (frameCountRef.current % LOG_INTERVAL === 60) {
|
|
266
|
+
// logVisemeDebug('Current Viseme', {
|
|
267
|
+
// currentViseme,
|
|
268
|
+
// audioTime,
|
|
269
|
+
// visemeQueue: visemeQueueRef.current,
|
|
270
|
+
// });
|
|
271
|
+
// }
|
|
273
272
|
|
|
274
273
|
if (currentViseme) {
|
|
275
274
|
const progress =
|
|
@@ -312,17 +311,17 @@ export const VisemeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
312
311
|
frameCountRef.current = 0;
|
|
313
312
|
setVisemeState('idle');
|
|
314
313
|
|
|
315
|
-
logVisemeEvent('Reset Viseme Queue', {
|
|
316
|
-
|
|
317
|
-
});
|
|
314
|
+
// logVisemeEvent('Reset Viseme Queue', {
|
|
315
|
+
// previousState: visemeState,
|
|
316
|
+
// });
|
|
318
317
|
}, [visemeState]);
|
|
319
318
|
|
|
320
319
|
const resetAndStartProcessing = useCallback(
|
|
321
320
|
(audioCtx: IAudioContext) => {
|
|
322
|
-
logVisemeEvent('Reset And Start Processing', {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
});
|
|
321
|
+
// logVisemeEvent('Reset And Start Processing', {
|
|
322
|
+
// previousState: visemeState,
|
|
323
|
+
// queueLength: visemeQueueRef.current.length,
|
|
324
|
+
// });
|
|
326
325
|
|
|
327
326
|
stopProcessing();
|
|
328
327
|
resetVisemeQueue();
|
package/src/index.stories.tsx
CHANGED
|
@@ -179,64 +179,6 @@ Giovanna.args = {
|
|
|
179
179
|
layout: 'ZOOMED_FULL_BODY',
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
export const GiovannaRPMProva = Template.bind({});
|
|
183
|
-
GiovannaRPMProva.args = {
|
|
184
|
-
memoriName: 'Giovanna Test',
|
|
185
|
-
ownerUserName: 'andrea.patini3',
|
|
186
|
-
memoriID: '431d9819-c958-442c-a799-f90617371c0c',
|
|
187
|
-
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
188
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
189
|
-
engineURL: 'https://engine-staging.memori.ai',
|
|
190
|
-
apiURL: 'https://backend-staging.memori.ai',
|
|
191
|
-
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
192
|
-
uiLang: 'EN',
|
|
193
|
-
spokenLang: 'IT',
|
|
194
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
195
|
-
integrationID: '061898c0-2138-49da-a6b3-5d86267aad05',
|
|
196
|
-
initialQuestion: 'inizio simulazione',
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export const GiovannaGLBProva = Template.bind({});
|
|
200
|
-
GiovannaGLBProva.args = {
|
|
201
|
-
...GiovannaRPMProva.args,
|
|
202
|
-
integrationID: 'd2099459-0f10-40cd-85e1-06e77a678723',
|
|
203
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export const MoodChefAssistant = Template.bind({});
|
|
207
|
-
MoodChefAssistant.args = {
|
|
208
|
-
memoriName: 'Mood Chef Assistant',
|
|
209
|
-
ownerUserName: 'andrea.patini3',
|
|
210
|
-
memoriID: 'fb4f9251-e7ec-4002-b0e5-ffa6e75b2fd8',
|
|
211
|
-
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
212
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
213
|
-
engineURL: 'https://engine-staging-tmp.memori.ai',
|
|
214
|
-
apiURL: 'https://backend-staging.memori.ai',
|
|
215
|
-
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
216
|
-
uiLang: 'EN',
|
|
217
|
-
spokenLang: 'IT',
|
|
218
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
219
|
-
integrationID: '6e289cc1-df99-4879-8a3a-fe10baea7eac',
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const GiovannaProvaWithPreviousSession = Template.bind({});
|
|
223
|
-
GiovannaProvaWithPreviousSession.args = {
|
|
224
|
-
memoriName: 'Giovanna Test',
|
|
225
|
-
ownerUserName: 'andrea.patini3',
|
|
226
|
-
memoriID: '431d9819-c958-442c-a799-f90617371c0c',
|
|
227
|
-
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
228
|
-
tenantID: 'aisuru-staging.aclambda.online',
|
|
229
|
-
engineURL: 'https://engine-staging.memori.ai',
|
|
230
|
-
apiURL: 'https://backend-staging.memori.ai',
|
|
231
|
-
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
232
|
-
uiLang: 'EN',
|
|
233
|
-
spokenLang: 'IT',
|
|
234
|
-
layout: 'ZOOMED_FULL_BODY',
|
|
235
|
-
integrationID: 'e92ac275-39b5-474d-8f9e-826cc5284f1e',
|
|
236
|
-
initialQuestion: 'inizio simulazione',
|
|
237
|
-
sessionID: 'c1d13cec-1571-41a0-90bc-15bd2d62e263',
|
|
238
|
-
};
|
|
239
|
-
|
|
240
182
|
export const CreaRiassunti = Template.bind({});
|
|
241
183
|
CreaRiassunti.args = {
|
|
242
184
|
memoriName: 'Crea Riassunti',
|
|
@@ -287,22 +229,78 @@ NunzioFiore.args = {
|
|
|
287
229
|
enableAudio: 'true',
|
|
288
230
|
};
|
|
289
231
|
|
|
290
|
-
export const
|
|
291
|
-
|
|
292
|
-
memoriName: '
|
|
232
|
+
export const TestCustomAnimationsWithRPMSequence = Template.bind({});
|
|
233
|
+
TestCustomAnimationsWithRPMSequence.args = {
|
|
234
|
+
memoriName: 'Test Custom Animations with RPM sequence',
|
|
293
235
|
ownerUserName: 'andrea.patini3',
|
|
294
|
-
memoriID: '
|
|
236
|
+
memoriID: '45420d30-a103-455c-bab1-b708a0566a02',
|
|
295
237
|
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
296
238
|
tenantID: 'aisuru-staging.aclambda.online',
|
|
239
|
+
engineURL: 'https://engine-staging-tmp.memori.ai',
|
|
297
240
|
apiURL: 'https://backend-staging.memori.ai',
|
|
241
|
+
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
242
|
+
uiLang: 'IT',
|
|
243
|
+
spokenLang: 'IT',
|
|
244
|
+
layout: 'ZOOMED_FULL_BODY',
|
|
245
|
+
showInstruct: 'false',
|
|
246
|
+
showSettings: 'true',
|
|
247
|
+
showClear: 'false',
|
|
248
|
+
showTypingText: 'false',
|
|
249
|
+
showOnlyLastMessages: 'false',
|
|
250
|
+
showTranslationOriginal: 'false',
|
|
251
|
+
showCopyButton: 'false',
|
|
252
|
+
showShare: 'true',
|
|
253
|
+
showLogin: 'false',
|
|
254
|
+
useMathFormatting: 'false',
|
|
255
|
+
showUpload: 'false',
|
|
256
|
+
autoStart: 'false',
|
|
257
|
+
enableAudio: 'true',
|
|
258
|
+
integrationID: 'a2b9bddc-bb8c-4b0e-b80f-b50ec90e9c99',
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export const TestCustomGLBSingleAnimation = Template.bind({});
|
|
262
|
+
TestCustomGLBSingleAnimation.args = {
|
|
263
|
+
memoriName: "Dragon's Journey",
|
|
264
|
+
ownerUserName: 'andrea.patini3',
|
|
265
|
+
memoriID: 'fa0568c0-aac2-494b-bde7-6a8ec7725a2d',
|
|
266
|
+
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
267
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
298
268
|
engineURL: 'https://engine-staging-tmp.memori.ai',
|
|
269
|
+
apiURL: 'https://backend-staging.memori.ai',
|
|
299
270
|
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
300
271
|
uiLang: 'IT',
|
|
301
272
|
spokenLang: 'IT',
|
|
302
|
-
layout: '
|
|
303
|
-
|
|
273
|
+
layout: 'TOTEM',
|
|
274
|
+
showInstruct: 'false',
|
|
275
|
+
showSettings: 'true',
|
|
276
|
+
showClear: 'false',
|
|
277
|
+
showTypingText: 'false',
|
|
278
|
+
showOnlyLastMessages: 'false',
|
|
279
|
+
showTranslationOriginal: 'false',
|
|
280
|
+
showCopyButton: 'false',
|
|
304
281
|
showShare: 'true',
|
|
305
|
-
|
|
282
|
+
showLogin: 'false',
|
|
283
|
+
useMathFormatting: 'false',
|
|
284
|
+
showUpload: 'false',
|
|
285
|
+
autoStart: 'false',
|
|
286
|
+
enableAudio: 'true',
|
|
287
|
+
integrationID: 'eea150e2-3ab3-47ae-a9ad-d3ea1704f623',
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export const TestRPMEmotionFunction = Template.bind({});
|
|
291
|
+
TestRPMEmotionFunction.args = {
|
|
292
|
+
memoriName: 'Test RPM',
|
|
293
|
+
ownerUserName: 'andrea.patini3',
|
|
294
|
+
memoriID: '35b7059f-08f4-45ab-98d8-899957666b77',
|
|
295
|
+
ownerUserID: '58770358-a5db-4b49-b3a4-734fc468e745',
|
|
296
|
+
tenantID: 'aisuru-staging.aclambda.online',
|
|
297
|
+
engineURL: 'https://engine-staging-tmp.memori.ai',
|
|
298
|
+
apiURL: 'https://backend-staging.memori.ai',
|
|
299
|
+
baseURL: 'https://aisuru-staging.aclambda.online',
|
|
300
|
+
uiLang: 'IT',
|
|
301
|
+
spokenLang: 'IT',
|
|
302
|
+
layout: 'ZOOMED_FULL_BODY',
|
|
303
|
+
integrationID: '60a37903-44a2-48c2-82e3-c7b8b620cb64',
|
|
306
304
|
};
|
|
307
305
|
|
|
308
306
|
const TemplateWithBatchButton: Story<Props> = args => (
|
package/src/index.tsx
CHANGED
|
@@ -15,7 +15,6 @@ import MemoriWidget, {
|
|
|
15
15
|
import { VisemeProvider } from './context/visemeContext';
|
|
16
16
|
|
|
17
17
|
import { Toaster } from 'react-hot-toast';
|
|
18
|
-
import { getTenant } from './helpers/tenant';
|
|
19
18
|
import { safeParseJSON } from './helpers/utils';
|
|
20
19
|
|
|
21
20
|
import i18n from './i18n';
|
|
@@ -217,8 +216,11 @@ const Memori: React.FC<Props> = ({
|
|
|
217
216
|
* Fetches the Tenant data from the backend
|
|
218
217
|
*/
|
|
219
218
|
const fetchTenant = useCallback(async () => {
|
|
220
|
-
const tenant = await
|
|
221
|
-
|
|
219
|
+
const { tenant, ...resp } = await client.backend.tenant.getTenantConfig(
|
|
220
|
+
tenantID
|
|
221
|
+
);
|
|
222
|
+
if (tenant && resp.resultCode === 0) setTenant(tenant);
|
|
223
|
+
else console.debug('[TENANT]', resp, tenant);
|
|
222
224
|
}, [tenantID, apiURL]);
|
|
223
225
|
useEffect(() => {
|
|
224
226
|
fetchTenant();
|