@memori.ai/memori-react 8.31.0 → 8.33.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 +21 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.css +351 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +34 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +105 -0
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -0
- package/dist/components/Header/ChatConsumptionDropdown.d.ts +8 -0
- package/dist/components/Header/ChatConsumptionDropdown.js +103 -0
- package/dist/components/Header/ChatConsumptionDropdown.js.map +1 -0
- package/dist/components/Header/Header.css +128 -17
- package/dist/components/Header/Header.js +2 -72
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.css +14 -3
- package/dist/components/MicrophoneButton/MicrophoneButton.js +1 -1
- package/dist/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/dist/components/PositionPopover/PositionPopover.js +8 -2
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/icons/GasStation.d.ts +6 -0
- package/dist/components/icons/GasStation.js +6 -0
- package/dist/components/icons/GasStation.js.map +1 -0
- package/dist/components/ui/Tooltip.js +6 -3
- package/dist/components/ui/Tooltip.js.map +1 -1
- package/dist/locales/de.json +3 -0
- package/dist/locales/en.json +3 -0
- package/dist/locales/es.json +3 -0
- package/dist/locales/fr.json +3 -0
- package/dist/locales/it.json +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.css +351 -0
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +34 -0
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js +102 -0
- package/esm/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -0
- package/esm/components/Header/ChatConsumptionDropdown.d.ts +8 -0
- package/esm/components/Header/ChatConsumptionDropdown.js +100 -0
- package/esm/components/Header/ChatConsumptionDropdown.js.map +1 -0
- package/esm/components/Header/Header.css +128 -17
- package/esm/components/Header/Header.js +3 -73
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.css +14 -3
- package/esm/components/MicrophoneButton/MicrophoneButton.js +1 -1
- package/esm/components/MicrophoneButton/MicrophoneButton.js.map +1 -1
- package/esm/components/PositionPopover/PositionPopover.js +9 -3
- package/esm/components/PositionPopover/PositionPopover.js.map +1 -1
- package/esm/components/icons/GasStation.d.ts +6 -0
- package/esm/components/icons/GasStation.js +4 -0
- package/esm/components/icons/GasStation.js.map +1 -0
- package/esm/components/ui/Tooltip.js +6 -3
- package/esm/components/ui/Tooltip.js.map +1 -1
- package/esm/locales/de.json +3 -0
- package/esm/locales/en.json +3 -0
- package/esm/locales/es.json +3 -0
- package/esm/locales/fr.json +3 -0
- package/esm/locales/it.json +3 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +2 -2
- package/src/components/Header/ChatConsumptionDropdown.test.tsx +86 -0
- package/src/components/Header/ChatConsumptionDropdown.tsx +266 -0
- package/src/components/Header/Header.css +128 -17
- package/src/components/Header/Header.stories.tsx +48 -41
- package/src/components/Header/Header.tsx +7 -147
- package/src/components/MicrophoneButton/MicrophoneButton.css +14 -3
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +12 -3
- package/src/components/icons/GasStation.tsx +36 -0
- package/src/components/ui/Tooltip.tsx +12 -3
- package/src/locales/de.json +3 -0
- package/src/locales/en.json +3 -0
- package/src/locales/es.json +3 -0
- package/src/locales/fr.json +3 -0
- package/src/locales/it.json +3 -0
- package/src/version.ts +1 -1
|
@@ -4,7 +4,7 @@ import { memori, tenant, history } from '../../mocks/data';
|
|
|
4
4
|
import I18nWrapper from '../../I18nWrapper';
|
|
5
5
|
import Header, { Props } from './Header';
|
|
6
6
|
import SettingsDrawer from '../SettingsDrawer/SettingsDrawer';
|
|
7
|
-
import LoginDrawer from '../LoginDrawer/LoginDrawer';
|
|
7
|
+
import LoginDrawer from '../LoginDrawer/LoginDrawer';
|
|
8
8
|
import { ArtifactProvider } from '../MemoriArtifactSystem/context/ArtifactContext';
|
|
9
9
|
|
|
10
10
|
import './Header.css';
|
|
@@ -42,6 +42,13 @@ const historyWithConsumption = [
|
|
|
42
42
|
...history[history.length - 1],
|
|
43
43
|
text: 'Second sustainability sample',
|
|
44
44
|
llmUsage: {
|
|
45
|
+
provider: 'OpenAI',
|
|
46
|
+
model: 'gpt-5',
|
|
47
|
+
totalInputTokens: 19168,
|
|
48
|
+
inputCacheReadTokens: 0,
|
|
49
|
+
inputCacheWriteTokens: 0,
|
|
50
|
+
outputTokens: 588,
|
|
51
|
+
durationMs: 13697,
|
|
45
52
|
energyImpact: {
|
|
46
53
|
energy: 0.0008,
|
|
47
54
|
gwp: { source: '0.00035' },
|
|
@@ -64,46 +71,46 @@ const Template: Story<Props> = args => {
|
|
|
64
71
|
return (
|
|
65
72
|
<I18nWrapper>
|
|
66
73
|
<ArtifactProvider>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
74
|
+
<Header
|
|
75
|
+
{...args}
|
|
76
|
+
speakerMuted={speakerMuted}
|
|
77
|
+
setSpeakerMuted={setSpeakerMuted}
|
|
78
|
+
showSettings
|
|
79
|
+
setShowSettingsDrawer={() => setShowSettingsDrawer(true)}
|
|
80
|
+
setShowKnownFactsDrawer={() => setShowKnownFactsDrawer(true)}
|
|
81
|
+
setShowExpertsDrawer={() => setShowExpertsDrawer(true)}
|
|
82
|
+
setShowLoginDrawer={() => setShowLoginDrawer(true)}
|
|
83
|
+
/>
|
|
84
|
+
<SettingsDrawer
|
|
85
|
+
open={!!showSettingsDrawer}
|
|
86
|
+
onClose={() => setShowSettingsDrawer(false)}
|
|
87
|
+
microphoneMode="HOLD_TO_TALK"
|
|
88
|
+
setMicrophoneMode={() => {}}
|
|
89
|
+
continuousSpeechTimeout={2}
|
|
90
|
+
setContinuousSpeechTimeout={() => {}}
|
|
91
|
+
controlsPosition="bottom"
|
|
92
|
+
setControlsPosition={() => {}}
|
|
93
|
+
hideEmissions={false}
|
|
94
|
+
setHideEmissions={() => {}}
|
|
95
|
+
setAvatarType={() => {}}
|
|
96
|
+
setEnablePositionControls={() => {}}
|
|
97
|
+
/>
|
|
98
|
+
<LoginDrawer
|
|
99
|
+
setUser={() => {}}
|
|
100
|
+
tenant={tenant}
|
|
101
|
+
open={!!showLoginDrawer}
|
|
102
|
+
onClose={() => setShowLoginDrawer(false)}
|
|
103
|
+
onLogin={(user, token) => {
|
|
104
|
+
console.log(user, token);
|
|
105
|
+
setShowLoginDrawer(false);
|
|
106
|
+
}}
|
|
107
|
+
onLogout={() => setShowLoginDrawer(false)}
|
|
108
|
+
apiClient={
|
|
109
|
+
{
|
|
110
|
+
backend: {},
|
|
111
|
+
} as any
|
|
112
|
+
}
|
|
113
|
+
/>
|
|
107
114
|
</ArtifactProvider>
|
|
108
115
|
</I18nWrapper>
|
|
109
116
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect,
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import {
|
|
4
4
|
Memori,
|
|
@@ -23,13 +23,12 @@ 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';
|
|
27
26
|
import Logout from '../icons/Logout';
|
|
28
27
|
import { getErrori18nKey } from '../../helpers/error';
|
|
29
28
|
import toast from 'react-hot-toast';
|
|
30
29
|
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
31
30
|
import { Props as WidgetProps } from '../MemoriWidget/MemoriWidget';
|
|
32
|
-
import
|
|
31
|
+
import ChatConsumptionDropdown from './ChatConsumptionDropdown';
|
|
33
32
|
|
|
34
33
|
const imgMimeTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif'];
|
|
35
34
|
|
|
@@ -106,90 +105,6 @@ const Header: React.FC<Props> = ({
|
|
|
106
105
|
const { uploadAsset, pwlUpdateUser } = apiClient.backend;
|
|
107
106
|
const [fullScreenAvailable, setFullScreenAvailable] = useState(false);
|
|
108
107
|
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
|
-
);
|
|
193
108
|
useEffect(() => {
|
|
194
109
|
if (document.fullscreenEnabled) {
|
|
195
110
|
setFullScreenAvailable(true);
|
|
@@ -307,66 +222,11 @@ const Header: React.FC<Props> = ({
|
|
|
307
222
|
onClick={() => setShowChatHistoryDrawer(true)}
|
|
308
223
|
/>
|
|
309
224
|
)}
|
|
310
|
-
{showMessageConsumption &&
|
|
311
|
-
<
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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>
|
|
225
|
+
{showMessageConsumption && (
|
|
226
|
+
<ChatConsumptionDropdown
|
|
227
|
+
history={history}
|
|
228
|
+
hasSpacedButtons={hasSpacedButtons}
|
|
229
|
+
/>
|
|
370
230
|
)}
|
|
371
231
|
{fullScreenAvailable && (
|
|
372
232
|
<Button
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
.memori-chat-inputs--mic {
|
|
5
2
|
z-index: 1;
|
|
6
3
|
margin-left: 0.33rem;
|
|
@@ -117,6 +114,20 @@
|
|
|
117
114
|
color: red !important;
|
|
118
115
|
}
|
|
119
116
|
|
|
117
|
+
.memori-chat-inputs--mic-tooltip.memori-tooltip--align-topLeft .memori-tooltip--content {
|
|
118
|
+
top: -50%;
|
|
119
|
+
right: 115%;
|
|
120
|
+
width: 100%;
|
|
121
|
+
height: 100%;
|
|
122
|
+
background: rgba(0, 0, 0, 0.8);
|
|
123
|
+
color: #fff;
|
|
124
|
+
font-size: 0.85em;
|
|
125
|
+
opacity: 0;
|
|
126
|
+
text-align: center;
|
|
127
|
+
/* left: 0; */
|
|
128
|
+
transform: translateY(-100%);
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
/* Mobile-specific improvements for listening state */
|
|
121
132
|
@media (hover: none) and (pointer: coarse) {
|
|
122
133
|
.memori-chat-inputs--mic.memori-chat-inputs--mic--listening {
|
|
@@ -49,7 +49,7 @@ const MicrophoneButton = ({
|
|
|
49
49
|
e.preventDefault();
|
|
50
50
|
e.stopPropagation();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
if (intervalRef.current) {
|
|
54
54
|
clearTimeout(intervalRef.current);
|
|
55
55
|
intervalRef.current = null;
|
|
@@ -64,13 +64,21 @@ const MicrophoneButton = ({
|
|
|
64
64
|
e.stopPropagation();
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
const handleTouchStart = (
|
|
67
|
+
const handleTouchStart = (
|
|
68
|
+
e:
|
|
69
|
+
| React.TouchEvent<HTMLButtonElement>
|
|
70
|
+
| React.MouseEvent<Element, MouseEvent>
|
|
71
|
+
) => {
|
|
68
72
|
e.preventDefault();
|
|
69
73
|
e.stopPropagation();
|
|
70
74
|
startHold(e);
|
|
71
75
|
};
|
|
72
76
|
|
|
73
|
-
const handleTouchEnd = (
|
|
77
|
+
const handleTouchEnd = (
|
|
78
|
+
e:
|
|
79
|
+
| React.TouchEvent<HTMLButtonElement>
|
|
80
|
+
| React.MouseEvent<Element, MouseEvent>
|
|
81
|
+
) => {
|
|
74
82
|
e.preventDefault();
|
|
75
83
|
e.stopPropagation();
|
|
76
84
|
stopHold(e);
|
|
@@ -83,6 +91,7 @@ const MicrophoneButton = ({
|
|
|
83
91
|
return (
|
|
84
92
|
<Tooltip
|
|
85
93
|
visible={!!micBtnTooltip}
|
|
94
|
+
className="memori-chat-inputs--mic-tooltip"
|
|
86
95
|
content={
|
|
87
96
|
<span>
|
|
88
97
|
{micBtnTooltip ||
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
const GasStation = ({ className, title }: { className?: string; title?: string }) => (
|
|
3
|
+
<svg
|
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
5
|
+
width={800}
|
|
6
|
+
height={800}
|
|
7
|
+
fill="none"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
className={className}
|
|
10
|
+
aria-label={title}
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
strokeWidth={1.5}
|
|
15
|
+
d="M16 22V8c0-2.828 0-4.243-.879-5.121C14.243 2 12.828 2 10 2H9c-2.828 0-4.243 0-5.121.879C3 3.757 3 5.172 3 8v14"
|
|
16
|
+
/>
|
|
17
|
+
<path
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
strokeWidth={1.5}
|
|
20
|
+
d="M11 6H8c-.943 0-1.414 0-1.707.293C6 6.586 6 7.057 6 8c0 .943 0 1.414.293 1.707C6.586 10 7.057 10 8 10h3c.943 0 1.414 0 1.707-.293C13 9.414 13 8.943 13 8c0-.943 0-1.414-.293-1.707C12.414 6 11.943 6 11 6Z"
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
stroke="currentColor"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
strokeWidth={1.5}
|
|
26
|
+
d="M7 17h5M17 22H2M19.5 4l1.233.986c.138.11.207.166.27.222a3 3 0 0 1 .992 2.066c.005.084.005.172.005.348V18.5a1.5 1.5 0 0 1-3 0v-.071c0-.79-.64-1.429-1.429-1.429H16"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
stroke="currentColor"
|
|
30
|
+
strokeLinecap="round"
|
|
31
|
+
strokeWidth={1.5}
|
|
32
|
+
d="M22 8h-1.5A1.5 1.5 0 0 0 19 9.5v2.419a1.5 1.5 0 0 0 1.026 1.423L22 14"
|
|
33
|
+
/>
|
|
34
|
+
</svg>
|
|
35
|
+
)
|
|
36
|
+
export default GasStation;
|
|
@@ -5,7 +5,13 @@ import cx from 'classnames';
|
|
|
5
5
|
export interface Props {
|
|
6
6
|
content: string | JSX.Element | React.ReactNode;
|
|
7
7
|
className?: string;
|
|
8
|
-
align?:
|
|
8
|
+
align?:
|
|
9
|
+
| 'left'
|
|
10
|
+
| 'right'
|
|
11
|
+
| 'topLeft'
|
|
12
|
+
| 'topRight'
|
|
13
|
+
| 'bottomLeft'
|
|
14
|
+
| 'bottomRight';
|
|
9
15
|
disabled?: boolean;
|
|
10
16
|
children: React.ReactNode;
|
|
11
17
|
visible?: boolean;
|
|
@@ -73,7 +79,10 @@ const Tooltip: FC<Props> = ({
|
|
|
73
79
|
if (!isOpen) return;
|
|
74
80
|
updatePosition();
|
|
75
81
|
const onScrollOrResize = () => updatePosition();
|
|
76
|
-
window.addEventListener('scroll', onScrollOrResize, {
|
|
82
|
+
window.addEventListener('scroll', onScrollOrResize, {
|
|
83
|
+
passive: true,
|
|
84
|
+
capture: true,
|
|
85
|
+
});
|
|
77
86
|
window.addEventListener('resize', onScrollOrResize);
|
|
78
87
|
return () => {
|
|
79
88
|
window.removeEventListener('scroll', onScrollOrResize, true);
|
|
@@ -100,6 +109,7 @@ const Tooltip: FC<Props> = ({
|
|
|
100
109
|
'memori-tooltip',
|
|
101
110
|
'memori-tooltip--portal',
|
|
102
111
|
`memori-tooltip--align-${align}`,
|
|
112
|
+
className,
|
|
103
113
|
{ 'memori-tooltip--visible': true }
|
|
104
114
|
)}
|
|
105
115
|
style={{
|
|
@@ -114,7 +124,6 @@ const Tooltip: FC<Props> = ({
|
|
|
114
124
|
>
|
|
115
125
|
<div
|
|
116
126
|
className="memori-tooltip--content memori-tooltip--content-portal"
|
|
117
|
-
style={{ pointerEvents: 'auto' }}
|
|
118
127
|
onMouseEnter={handleContentEnter}
|
|
119
128
|
onMouseLeave={handleContentLeave}
|
|
120
129
|
>
|
package/src/locales/de.json
CHANGED
|
@@ -383,6 +383,9 @@
|
|
|
383
383
|
"co2": "CO2",
|
|
384
384
|
"water": "Wasser",
|
|
385
385
|
"usageBadgesHint": "Klicke auf einen dieser Buttons, um mehr Informationen zu sehen",
|
|
386
|
+
"totalChatConsumptionTitle": "Gesamter Chat-Verbrauch",
|
|
387
|
+
"modelUsage": "Modellnutzung",
|
|
388
|
+
"environmentalImpact": "Umweltbelastung",
|
|
386
389
|
"impactComparisonUnavailable": "Indikativer Vergleich nicht verfuegbar.",
|
|
387
390
|
"impactComparisonEnergy": "Indikativer Vergleich: in etwa wie eine 10-W-LED-Lampe fuer {{duration}} eingeschaltet lassen.",
|
|
388
391
|
"impactComparisonCo2": "Indikativer Vergleich: etwa {{distance}} mit einem durchschnittlichen Benzinauto gefahren.",
|
package/src/locales/en.json
CHANGED
|
@@ -454,6 +454,9 @@
|
|
|
454
454
|
"co2": "CO2",
|
|
455
455
|
"water": "Water",
|
|
456
456
|
"usageBadgesHint": "Click one of these buttons to show more information",
|
|
457
|
+
"totalChatConsumptionTitle": "Total Chat Consumption",
|
|
458
|
+
"modelUsage": "Model usage",
|
|
459
|
+
"environmentalImpact": "Environmental impact",
|
|
457
460
|
"impactComparisonUnavailable": "Indicative comparison unavailable.",
|
|
458
461
|
"impactComparisonEnergy": "Indicative comparison: roughly like keeping a 10 W LED bulb on for {{duration}}.",
|
|
459
462
|
"impactComparisonCo2": "Indicative comparison: about {{distance}} traveled by an average gasoline car.",
|
package/src/locales/es.json
CHANGED
|
@@ -410,6 +410,9 @@
|
|
|
410
410
|
"co2": "CO2",
|
|
411
411
|
"water": "Agua",
|
|
412
412
|
"usageBadgesHint": "Haz clic en uno de estos botones para ver más información",
|
|
413
|
+
"totalChatConsumptionTitle": "Consumo Total del Chat",
|
|
414
|
+
"modelUsage": "Uso del modelo",
|
|
415
|
+
"environmentalImpact": "Impacto ambiental",
|
|
413
416
|
"impactComparisonUnavailable": "Comparacion indicativa no disponible.",
|
|
414
417
|
"impactComparisonEnergy": "Comparacion indicativa: aproximadamente como mantener encendida una bombilla LED de 10 W durante {{duration}}.",
|
|
415
418
|
"impactComparisonCo2": "Comparacion indicativa: aproximadamente {{distance}} recorridos en un coche de gasolina promedio.",
|
package/src/locales/fr.json
CHANGED
|
@@ -418,6 +418,9 @@
|
|
|
418
418
|
"co2": "CO2",
|
|
419
419
|
"water": "Eau",
|
|
420
420
|
"usageBadgesHint": "Cliquez sur un de ces boutons pour afficher plus d'informations",
|
|
421
|
+
"totalChatConsumptionTitle": "Consommation Totale du Chat",
|
|
422
|
+
"modelUsage": "Utilisation du modèle",
|
|
423
|
+
"environmentalImpact": "Impact environnemental",
|
|
421
424
|
"impactComparisonUnavailable": "Comparaison indicative non disponible.",
|
|
422
425
|
"impactComparisonEnergy": "Comparaison indicative : environ comme laisser allumee une ampoule LED de 10 W pendant {{duration}}.",
|
|
423
426
|
"impactComparisonCo2": "Comparaison indicative : environ {{distance}} parcourus en voiture essence moyenne.",
|
package/src/locales/it.json
CHANGED
|
@@ -451,6 +451,9 @@
|
|
|
451
451
|
"co2": "CO2",
|
|
452
452
|
"water": "Acqua",
|
|
453
453
|
"usageBadgesHint": "Clicca uno di questi pulsanti per mostrare maggiori informazioni",
|
|
454
|
+
"totalChatConsumptionTitle": "Consumo Totale Chat",
|
|
455
|
+
"modelUsage": "Utilizzo del modello",
|
|
456
|
+
"environmentalImpact": "Impatto ambientale",
|
|
454
457
|
"impactComparisonUnavailable": "Confronto indicativo non disponibile.",
|
|
455
458
|
"impactComparisonEnergy": "Confronto indicativo: circa quanto tenere accesa una lampadina LED da 10 W per {{duration}}.",
|
|
456
459
|
"impactComparisonCo2": "Confronto indicativo: circa {{distance}} percorsi in auto a benzina media.",
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const version = '8.
|
|
2
|
+
export const version = '8.33.0';
|