@memori.ai/memori-react 7.30.0 → 7.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.d.ts +38 -0
  3. package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.js +181 -0
  4. package/dist/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.js.map +1 -0
  5. package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.d.ts +7 -0
  6. package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.js +69 -0
  7. package/dist/components/ChatBubble/VirtualizedContent/VirtualizedContent.js.map +1 -0
  8. package/dist/components/ChatHistoryDrawer/ChatHistory.css +71 -42
  9. package/dist/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -2
  10. package/dist/components/ChatHistoryDrawer/ChatHistory.js +87 -12
  11. package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  12. package/dist/components/Header/Header.js +3 -4
  13. package/dist/components/Header/Header.js.map +1 -1
  14. package/dist/components/MemoriWidget/MemoriWidget.js +1 -11
  15. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  16. package/dist/locales/de.json +1 -0
  17. package/dist/locales/en.json +1 -0
  18. package/dist/locales/es.json +1 -0
  19. package/dist/locales/fr.json +1 -0
  20. package/dist/locales/it.json +1 -0
  21. package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.d.ts +38 -0
  22. package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.js +177 -0
  23. package/esm/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.js.map +1 -0
  24. package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.d.ts +7 -0
  25. package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.js +67 -0
  26. package/esm/components/ChatBubble/VirtualizedContent/VirtualizedContent.js.map +1 -0
  27. package/esm/components/ChatHistoryDrawer/ChatHistory.css +71 -42
  28. package/esm/components/ChatHistoryDrawer/ChatHistory.d.ts +3 -2
  29. package/esm/components/ChatHistoryDrawer/ChatHistory.js +88 -13
  30. package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
  31. package/esm/components/Header/Header.js +3 -4
  32. package/esm/components/Header/Header.js.map +1 -1
  33. package/esm/components/MemoriWidget/MemoriWidget.js +1 -11
  34. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  35. package/esm/locales/de.json +1 -0
  36. package/esm/locales/en.json +1 -0
  37. package/esm/locales/es.json +1 -0
  38. package/esm/locales/fr.json +1 -0
  39. package/esm/locales/it.json +1 -0
  40. package/package.json +1 -1
  41. package/src/components/ChatHistoryDrawer/ChatHistory.css +71 -42
  42. package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +7 -7
  43. package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +4 -0
  44. package/src/components/ChatHistoryDrawer/ChatHistory.tsx +301 -94
  45. package/src/components/Header/Header.tsx +4 -7
  46. package/src/components/Header/__snapshots__/Header.test.tsx.snap +26 -472
  47. package/src/components/MemoriWidget/MemoriWidget.tsx +11 -10
  48. package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +1 -30
  49. package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +2 -60
  50. package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +1 -30
  51. package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +1 -30
  52. package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +1 -30
  53. package/src/locales/de.json +1 -0
  54. package/src/locales/en.json +1 -0
  55. package/src/locales/es.json +1 -0
  56. package/src/locales/fr.json +1 -0
  57. package/src/locales/it.json +1 -0
  58. package/src/components/ChatHistoryDrawer/ChatHistory.scss +0 -41
  59. package/src/components/ExportHistoryButton/ExportHistoryButton.stories.tsx +0 -73
  60. package/src/components/ExportHistoryButton/ExportHistoryButton.test.tsx +0 -69
  61. package/src/components/ExportHistoryButton/ExportHistoryButton.tsx +0 -103
  62. package/src/components/ExportHistoryButton/__snapshots__/ExportHistoryButton.test.tsx.snap +0 -239
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
 
2
2
 
3
+ ## [7.30.2](https://github.com/memori-ai/memori-react/compare/v7.30.1...v7.30.2) (2025-06-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * add download chat button and localization support in ChatHistoryDrawer ([2b5cb43](https://github.com/memori-ai/memori-react/commit/2b5cb43d55c75d1b021678f632af95d2301571ae))
9
+
10
+ ## [7.30.1](https://github.com/memori-ai/memori-react/compare/v7.30.0...v7.30.1) (2025-06-17)
11
+
12
+
13
+ ### Features
14
+
15
+ * add download chat button and localization support in ChatHistoryDrawer ([130524c](https://github.com/memori-ai/memori-react/commit/130524c6bb600cb51922cfae2336cfe27fa2b499))
16
+
17
+
18
+ ### Changes
19
+
20
+ * enhance ChatHistoryDrawer with export functionality and new title handling ([5b1b5f4](https://github.com/memori-ai/memori-react/commit/5b1b5f4cd367afea75d1f14f320d9154d8fbaf7a))
21
+ * removed Export Chat Button form the Header component ([7ccd463](https://github.com/memori-ai/memori-react/commit/7ccd463ddebd0f3e9edb6104f8cf5bb35ce68e3e))
22
+ * removed unused .scss file for ChatHistory component and improved UX ([cc1910b](https://github.com/memori-ai/memori-react/commit/cc1910b4a09872d86fe410383192c726946c28f3))
23
+
3
24
  ## [7.30.0](https://github.com/memori-ai/memori-react/compare/v7.29.1...v7.30.0) (2025-06-17)
4
25
 
5
26
 
@@ -0,0 +1,38 @@
1
+ import { AnimationState, AnimationConfig } from '../FullbodyAvatar/types';
2
+ import { AnimationAction, AnimationMixer } from 'three';
3
+ export declare class AnimationController {
4
+ private currentState;
5
+ private currentAction;
6
+ private mixer;
7
+ private actions;
8
+ private config;
9
+ private lastIdleIndex;
10
+ private isTransitioning;
11
+ private currentIdleLoopCount;
12
+ private readonly MAX_IDLE_LOOPS;
13
+ private lastAnimationTime;
14
+ private isChatAlreadyStarted;
15
+ private sequence;
16
+ private sequenceIndex;
17
+ constructor(mixer: AnimationMixer, actions: Record<string, AnimationAction>, config?: AnimationConfig);
18
+ private checkForLoop;
19
+ private forceIdleChange;
20
+ private getNextIdleAnimation;
21
+ playSequence(sequenceString: string): void;
22
+ private parseAnimationName;
23
+ transitionTo(state: AnimationState, emotionName?: string): void;
24
+ update(delta: number): void;
25
+ getCurrentState(): AnimationState;
26
+ getLoopCount(): number;
27
+ setTimeScale(timeScale: number): void;
28
+ updateIsChatAlreadyStarted(isChatAlreadyStarted: boolean): void;
29
+ getDebugInfo(): {
30
+ currentState: AnimationState;
31
+ currentIdleIndex: number;
32
+ loopCount: number;
33
+ currentTime: number;
34
+ lastTime: number;
35
+ isTransitioning: boolean;
36
+ isChatAlreadyStarted: boolean;
37
+ };
38
+ }
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnimationController = void 0;
4
+ const types_1 = require("../FullbodyAvatar/types");
5
+ const three_1 = require("three");
6
+ const constants_1 = require("../../constants");
7
+ class AnimationController {
8
+ constructor(mixer, actions, config = constants_1.DEFAULT_CONFIG) {
9
+ this.currentState = types_1.AnimationState.LOADING;
10
+ this.currentAction = null;
11
+ this.lastIdleIndex = -1;
12
+ this.isTransitioning = false;
13
+ this.currentIdleLoopCount = 0;
14
+ this.MAX_IDLE_LOOPS = constants_1.MAX_IDLE_LOOPS_DEFAULT;
15
+ this.lastAnimationTime = 0;
16
+ this.isChatAlreadyStarted = false;
17
+ this.sequence = null;
18
+ this.sequenceIndex = 0;
19
+ this.mixer = mixer;
20
+ this.actions = actions;
21
+ this.config = config;
22
+ }
23
+ checkForLoop() {
24
+ if (!this.currentAction || this.currentState !== types_1.AnimationState.IDLE)
25
+ return;
26
+ const clip = this.currentAction.getClip();
27
+ const currentTime = this.currentAction.time;
28
+ if (currentTime < this.lastAnimationTime) {
29
+ this.currentIdleLoopCount++;
30
+ if (this.currentIdleLoopCount >= this.MAX_IDLE_LOOPS) {
31
+ this.forceIdleChange();
32
+ }
33
+ }
34
+ this.lastAnimationTime = currentTime;
35
+ }
36
+ forceIdleChange() {
37
+ this.currentIdleLoopCount = 0;
38
+ this.lastAnimationTime = 0;
39
+ this.transitionTo(types_1.AnimationState.IDLE);
40
+ }
41
+ getNextIdleAnimation() {
42
+ let nextIndex;
43
+ do {
44
+ nextIndex = Math.floor(Math.random() * this.config.idleCount) + 1;
45
+ } while (nextIndex === this.lastIdleIndex);
46
+ if (this.isChatAlreadyStarted && nextIndex === 3) {
47
+ nextIndex = this.lastIdleIndex !== 4 ? 4 : 2;
48
+ }
49
+ this.lastIdleIndex = nextIndex;
50
+ const idleAction = this.actions[`Idle${nextIndex}`];
51
+ if (!idleAction) {
52
+ throw new Error(`Idle animation ${nextIndex} not found`);
53
+ }
54
+ return idleAction;
55
+ }
56
+ playSequence(sequenceString) {
57
+ const animations = sequenceString.split('->').map(anim => anim.trim());
58
+ console.log('[AnimationController] playSequence:', animations);
59
+ this.sequence = animations;
60
+ this.sequenceIndex = 0;
61
+ const firstAnim = this.parseAnimationName(animations[0]);
62
+ this.transitionTo(types_1.AnimationState.EMOTION, firstAnim);
63
+ }
64
+ parseAnimationName(animation) {
65
+ const randomMatch = animation.match(/(\w+)\[(\d+),(\d+)\]/);
66
+ if (randomMatch) {
67
+ const [_, base, min, max] = randomMatch;
68
+ const random = Math.floor(Math.random() * (Number(max) - Number(min) + 1)) +
69
+ Number(min);
70
+ return `${base}${random}`;
71
+ }
72
+ return animation;
73
+ }
74
+ transitionTo(state, emotionName) {
75
+ if (this.isTransitioning) {
76
+ return;
77
+ }
78
+ this.isTransitioning = true;
79
+ try {
80
+ let nextAction = null;
81
+ switch (state) {
82
+ case types_1.AnimationState.LOADING:
83
+ nextAction = this.actions[emotionName || 'Loading1'];
84
+ this.currentIdleLoopCount = 0;
85
+ this.lastAnimationTime = 0;
86
+ break;
87
+ case types_1.AnimationState.EMOTION:
88
+ nextAction = this.actions[emotionName || 'Timore1'];
89
+ this.currentIdleLoopCount = 0;
90
+ this.lastAnimationTime = 0;
91
+ break;
92
+ case types_1.AnimationState.IDLE:
93
+ nextAction = this.getNextIdleAnimation();
94
+ if (this.currentState !== types_1.AnimationState.IDLE) {
95
+ this.currentIdleLoopCount = 0;
96
+ this.lastAnimationTime = 0;
97
+ }
98
+ break;
99
+ }
100
+ if (!nextAction) {
101
+ throw new Error(`No animation found for state: ${state}`);
102
+ }
103
+ if (this.currentAction) {
104
+ this.currentAction.fadeOut(this.config.fadeOutDuration);
105
+ }
106
+ nextAction.reset().fadeIn(this.config.fadeInDuration).play();
107
+ nextAction.timeScale = this.config.timeScale;
108
+ if (state !== types_1.AnimationState.IDLE) {
109
+ nextAction.setLoop(three_1.LoopOnce, 1);
110
+ nextAction.clampWhenFinished = true;
111
+ }
112
+ else {
113
+ nextAction.setLoop(Infinity, Infinity);
114
+ }
115
+ this.currentAction = nextAction;
116
+ this.currentState = state;
117
+ }
118
+ catch (error) {
119
+ console.error('[AnimationController] Error during animation transition:', error);
120
+ if (state !== types_1.AnimationState.IDLE) {
121
+ this.transitionTo(types_1.AnimationState.IDLE);
122
+ }
123
+ }
124
+ finally {
125
+ this.isTransitioning = false;
126
+ }
127
+ }
128
+ update(delta) {
129
+ if (!this.currentAction)
130
+ return;
131
+ this.checkForLoop();
132
+ if (this.sequence &&
133
+ this.currentState === types_1.AnimationState.EMOTION &&
134
+ this.currentAction.time >= this.currentAction.getClip().duration * 0.9) {
135
+ this.sequenceIndex++;
136
+ if (this.sequenceIndex < this.sequence.length) {
137
+ const nextAnim = this.parseAnimationName(this.sequence[this.sequenceIndex]);
138
+ this.transitionTo(types_1.AnimationState.EMOTION, nextAnim);
139
+ }
140
+ else {
141
+ this.sequence = null;
142
+ this.sequenceIndex = 0;
143
+ this.transitionTo(types_1.AnimationState.IDLE);
144
+ }
145
+ }
146
+ if (this.currentState !== types_1.AnimationState.IDLE &&
147
+ this.currentAction.time >= this.currentAction.getClip().duration * 0.9) {
148
+ this.transitionTo(types_1.AnimationState.IDLE);
149
+ }
150
+ this.mixer.update(delta);
151
+ }
152
+ getCurrentState() {
153
+ return this.currentState;
154
+ }
155
+ getLoopCount() {
156
+ return this.currentIdleLoopCount;
157
+ }
158
+ setTimeScale(timeScale) {
159
+ this.config.timeScale = timeScale;
160
+ if (this.currentAction) {
161
+ this.currentAction.timeScale = timeScale;
162
+ }
163
+ }
164
+ updateIsChatAlreadyStarted(isChatAlreadyStarted) {
165
+ this.isChatAlreadyStarted = isChatAlreadyStarted;
166
+ }
167
+ getDebugInfo() {
168
+ var _a;
169
+ return {
170
+ currentState: this.currentState,
171
+ currentIdleIndex: this.lastIdleIndex,
172
+ loopCount: this.currentIdleLoopCount,
173
+ currentTime: ((_a = this.currentAction) === null || _a === void 0 ? void 0 : _a.time) || 0,
174
+ lastTime: this.lastAnimationTime,
175
+ isTransitioning: this.isTransitioning,
176
+ isChatAlreadyStarted: this.isChatAlreadyStarted,
177
+ };
178
+ }
179
+ }
180
+ exports.AnimationController = AnimationController;
181
+ //# sourceMappingURL=AnimationController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationController.js","sourceRoot":"","sources":["../../../../../../../src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AnimationController.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAC1E,iCAAkE;AAClE,+CAAyE;AAKzE,MAAa,mBAAmB;IA4B9B,YACE,KAAqB,EACrB,OAAwC,EACxC,SAA0B,0BAAc;QA7BlC,iBAAY,GAAmB,sBAAc,CAAC,OAAO,CAAC;QAEtD,kBAAa,GAA2B,IAAI,CAAC;QAQ7C,kBAAa,GAAW,CAAC,CAAC,CAAC;QAE3B,oBAAe,GAAY,KAAK,CAAC;QAEjC,yBAAoB,GAAW,CAAC,CAAC;QAExB,mBAAc,GAAG,kCAAsB,CAAC;QAEjD,sBAA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AC1C,QAAQ,EAAE,IAAI,CAAC,iBAAiB;YAChC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;SAChD,CAAC;IACJ,CAAC;CACF;AA5SD,kDA4SC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ content: string;
4
+ className?: string;
5
+ }
6
+ declare const VirtualizedContent: React.FC<Props>;
7
+ export default VirtualizedContent;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
5
+ const VirtualizedContent = ({ content, className = '' }) => {
6
+ const [processedContent, setProcessedContent] = (0, react_1.useState)('');
7
+ const containerRef = (0, react_1.useRef)(null);
8
+ const [height, setHeight] = (0, react_1.useState)(500);
9
+ const [loading, setLoading] = (0, react_1.useState)(true);
10
+ const [mounted, setMounted] = (0, react_1.useState)(false);
11
+ (0, react_1.useEffect)(() => {
12
+ setMounted(true);
13
+ return () => setMounted(false);
14
+ }, []);
15
+ (0, react_1.useEffect)(() => {
16
+ if (!content) {
17
+ setProcessedContent('');
18
+ setLoading(false);
19
+ return;
20
+ }
21
+ setLoading(true);
22
+ const processContent = () => {
23
+ try {
24
+ if (content.includes('<')) {
25
+ return `<div class="html-content">${content}</div>`;
26
+ }
27
+ return content
28
+ .split(/\n{2,}/)
29
+ .filter(para => para.trim().length > 0)
30
+ .map(para => `<p>${para.trim()}</p>`)
31
+ .join('');
32
+ }
33
+ catch (error) {
34
+ console.error('Error processing content:', error);
35
+ return `<p>${content}</p>`;
36
+ }
37
+ };
38
+ setTimeout(() => {
39
+ if (mounted) {
40
+ const processed = processContent();
41
+ setProcessedContent(processed);
42
+ setLoading(false);
43
+ }
44
+ }, 0);
45
+ }, [content, mounted]);
46
+ (0, react_1.useEffect)(() => {
47
+ setHeight(Math.min(500, window.innerHeight * 0.6));
48
+ if (containerRef.current) {
49
+ const resizeObserver = new ResizeObserver(() => {
50
+ setHeight(Math.min(500, window.innerHeight * 0.6));
51
+ });
52
+ resizeObserver.observe(containerRef.current);
53
+ return () => {
54
+ if (containerRef.current) {
55
+ resizeObserver.unobserve(containerRef.current);
56
+ }
57
+ };
58
+ }
59
+ }, []);
60
+ if (loading) {
61
+ return (0, jsx_runtime_1.jsx)("div", { className: "virtualized-content-loading", children: "Processing content..." });
62
+ }
63
+ if (!processedContent) {
64
+ return (0, jsx_runtime_1.jsx)("div", { className: "virtualized-content-empty", children: "No content to display" });
65
+ }
66
+ return ((0, jsx_runtime_1.jsx)("div", { ref: containerRef, className: `virtualized-content-container ${className}`, style: { height: height + 'px', width: '100%', position: 'relative' }, children: (0, jsx_runtime_1.jsx)("div", { className: "virtualized-content", style: { height: height, width: '100%', overflow: 'auto' }, dangerouslySetInnerHTML: { __html: processedContent } }) }));
67
+ };
68
+ exports.default = VirtualizedContent;
69
+ //# sourceMappingURL=VirtualizedContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualizedContent.js","sourceRoot":"","sources":["../../../../src/components/ChatBubble/VirtualizedContent/VirtualizedContent.tsx"],"names":[],"mappings":";;;AAAA,iCAA2D;AAY3D,MAAM,kBAAkB,GAAoB,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE;IAC1E,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAS,EAAE,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAA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}
@@ -44,13 +44,13 @@
44
44
  flex-direction: row;
45
45
  align-items: center;
46
46
  justify-content: space-between;
47
- gap: 1rem;
47
+ gap: 0.5rem;
48
48
  }
49
49
 
50
50
  .memori-chat-history-drawer--card--header--icon-wrapper {
51
51
  display: flex;
52
- width: 2.5rem;
53
- height: 2.5rem;
52
+ width: 2rem;
53
+ height: 2rem;
54
54
  align-items: center;
55
55
  justify-content: center;
56
56
  border-radius: 0.5rem;
@@ -105,18 +105,50 @@
105
105
  }
106
106
 
107
107
  .memori-chat-history-drawer--card--content {
108
+ position: relative;
108
109
  display: flex;
110
+ height: 100%;
109
111
  flex-direction: column;
110
- padding: 1rem;
111
- border-top: 1px solid var(--memori-border);
112
- background-color: var(--memori-background-alt);
113
- gap: 1rem;
114
112
  }
115
113
 
116
- .memori-chat-history-drawer--card--content--messages {
114
+ .memori-chat-history-drawer--card--content--header {
115
+ position: absolute;
116
+ z-index: 10;
117
+ right: 12px;
118
+ }
119
+
120
+ .memori-chat-history-drawer--card--content--export-button {
117
121
  display: flex;
118
- flex-direction: column;
119
- gap: 1rem;
122
+ align-items: center;
123
+ padding: 8px;
124
+ border: none;
125
+ background: transparent;
126
+ color: var(--memori-primary);
127
+ cursor: pointer;
128
+ gap: 8px;
129
+ transition: color 0.2s ease;
130
+ }
131
+
132
+ .memori-chat-history-drawer--card--content--export-button:hover {
133
+ color: var(--memori-primary);
134
+ }
135
+
136
+ .memori-chat-history-drawer--card--content--export-button--content {
137
+ display: flex;
138
+ align-items: center;
139
+ gap: 8px;
140
+ }
141
+
142
+ .memori-chat-history-drawer--card--content--export-button--icon {
143
+ width: 18px;
144
+ height: 18px;
145
+ fill: var(--memori-primary);
146
+ }
147
+
148
+ .memori-chat-history-drawer--card--content--messages {
149
+ flex: 1;
150
+ padding: 16px;
151
+ overflow-y: auto;
120
152
  }
121
153
 
122
154
  .memori-chat-history-drawer--card--content--messages .memori-chat--cover {
@@ -143,55 +175,40 @@
143
175
 
144
176
  .memori-chat-history-drawer--card--content--actions {
145
177
  position: sticky;
178
+ z-index: 10;
179
+ right: 0;
146
180
  bottom: 0;
181
+ left: 0;
147
182
  display: flex;
148
- width: 100%;
149
183
  justify-content: center;
150
- padding: 1rem;
151
- border-top: 1px solid var(--memori-border);
152
- margin-top: 1rem;
153
- background-color: var(--memori-background-alt);
184
+ padding: 16px;
185
+ background: linear-gradient(to top, var(--memori-background-color, #fff) 80%, transparent);
154
186
  }
155
187
 
156
188
  .memori-chat-history-drawer--card--content--resume-button {
157
- padding: 0.75rem 1.5rem;
158
- border-radius: 0.5rem;
159
- -webkit-backdrop-filter: blur(16px);
160
- backdrop-filter: blur(16px);
161
- background-color: rgba(255, 255, 255, 0.8);
162
- color: var(--memori-primary);
163
- font-weight: 500;
164
- transition: all 0.2s ease-in-out;
189
+ display: flex;
190
+ min-width: 200px;
191
+ align-items: center;
192
+ justify-content: center;
193
+ padding: 12px 24px;
194
+ border-radius: 24px;
195
+ gap: 8px;
196
+ transition: transform 0.2s ease;
165
197
  }
166
198
 
167
199
  .memori-chat-history-drawer--card--content--resume-button:hover {
168
- -webkit-backdrop-filter: blur(0);
169
- backdrop-filter: blur(0);
170
- background-color: var(--memori-primary);
171
- box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.27), 0 2px 4px -1px rgba(0, 0, 0, 0.35);
172
- color: var(--memori-primary-text);
173
- transform: translateY(-1px);
200
+ transform: translateY(-2px);
174
201
  }
175
202
 
176
203
  .memori-chat-history-drawer--card--content--resume-button--content {
177
204
  display: flex;
178
205
  align-items: center;
179
- gap: 0.5rem;
206
+ gap: 8px;
180
207
  }
181
208
 
182
209
  .memori-chat-history-drawer--card--content--resume-button--icon {
183
- color: var(--memori-primary);
184
- transition: transform 0.2s ease-in-out;
185
- }
186
-
187
- .memori-chat-history-drawer--card--content--resume-button:hover
188
- .memori-chat-history-drawer--card--content--resume-button--icon {
189
- color: #fff;
190
- transform: scale(1.1);
191
- }
192
-
193
- .memori-chat-history-drawer--card--content--resume-button--text {
194
- font-weight: 500;
210
+ width: 20px;
211
+ height: 20px;
195
212
  }
196
213
 
197
214
  /* Loading state */
@@ -322,3 +339,15 @@
322
339
  border-color: var(--memori-primary);
323
340
  box-shadow: 0 0 0 2px var(--memori-primary-light);
324
341
  }
342
+
343
+ .memori-chat-history-drawer--download-button-wrapper{
344
+ display: flex;
345
+ align-items: center;
346
+ gap: 8px;
347
+ }
348
+
349
+ .memori-chat-history-drawer--download-button-wrapper--text{
350
+ color: var(--memori-primary);
351
+ font-size: 0.875rem;
352
+ font-weight: 500;
353
+ }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import memoriApiClient from '@memori.ai/memori-api-client';
3
- import { ChatLog, Memori } from '@memori.ai/memori-api-client/dist/types';
3
+ import { ChatLog, Memori, Message } from '@memori.ai/memori-api-client/dist/types';
4
4
  export interface Props {
5
5
  open: boolean;
6
6
  onClose: () => void;
@@ -10,6 +10,7 @@ export interface Props {
10
10
  resumeSession: (chatLog: ChatLog) => void;
11
11
  baseUrl: string;
12
12
  apiUrl: string;
13
+ history: Message[];
13
14
  }
14
- declare const ChatHistoryDrawer: ({ open, onClose, apiClient, sessionId, memori, resumeSession, baseUrl, apiUrl, }: Props) => JSX.Element;
15
+ declare const ChatHistoryDrawer: ({ open, onClose, apiClient, sessionId, memori, resumeSession, baseUrl, apiUrl, history, }: Props) => JSX.Element;
15
16
  export default ChatHistoryDrawer;