@memori.ai/memori-react 7.31.0 → 7.32.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 +24 -0
- package/dist/components/MemoriWidget/MemoriWidget.js +14 -11
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +14 -11
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/index.js +1 -3
- package/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/MemoriWidget/MemoriWidget.tsx +19 -11
- package/src/index.tsx +1 -6
|
@@ -685,7 +685,8 @@ const MemoriWidget = ({
|
|
|
685
685
|
const [position, _setPosition] = useState<Venue>();
|
|
686
686
|
const applyPosition = async (venue?: Venue, sessionID?: string) => {
|
|
687
687
|
const session = sessionID ?? sessionId;
|
|
688
|
-
if
|
|
688
|
+
// Only apply position if memori.needsPosition is true
|
|
689
|
+
if (venue && session && memori.needsPosition) {
|
|
689
690
|
const { currentState, ...response } = await postPlaceChangedEvent({
|
|
690
691
|
sessionId: session,
|
|
691
692
|
placeName: venue.placeName,
|
|
@@ -708,19 +709,23 @@ const MemoriWidget = ({
|
|
|
708
709
|
_setPosition(venue);
|
|
709
710
|
applyPosition(venue);
|
|
710
711
|
|
|
711
|
-
if
|
|
712
|
+
// Only save position to local config if memori.needsPosition is true
|
|
713
|
+
if (venue && memori.needsPosition) {
|
|
712
714
|
setLocalConfig('position', JSON.stringify(venue));
|
|
713
|
-
} else {
|
|
715
|
+
} else if (!venue) {
|
|
714
716
|
removeLocalConfig('position');
|
|
715
717
|
}
|
|
716
718
|
};
|
|
717
719
|
|
|
718
720
|
useEffect(() => {
|
|
719
|
-
|
|
720
|
-
if (
|
|
721
|
-
|
|
721
|
+
// Only load position from local config if memori.needsPosition is true
|
|
722
|
+
if (memori.needsPosition) {
|
|
723
|
+
const position = getLocalConfig<Venue | undefined>('position', undefined);
|
|
724
|
+
if (position) {
|
|
725
|
+
_setPosition(position);
|
|
726
|
+
}
|
|
722
727
|
}
|
|
723
|
-
}, []);
|
|
728
|
+
}, [memori.needsPosition]);
|
|
724
729
|
|
|
725
730
|
/**
|
|
726
731
|
* History e gestione invio messaggi
|
|
@@ -854,6 +859,8 @@ const MemoriWidget = ({
|
|
|
854
859
|
emission &&
|
|
855
860
|
isMultilanguageEnabled
|
|
856
861
|
) {
|
|
862
|
+
currentState.emission = emission;
|
|
863
|
+
|
|
857
864
|
translateDialogState(currentState, userLang, msg).then(ts => {
|
|
858
865
|
let text = ts.translatedEmission || ts.emission;
|
|
859
866
|
if (text) {
|
|
@@ -1224,7 +1231,7 @@ const MemoriWidget = ({
|
|
|
1224
1231
|
setInstruct(false);
|
|
1225
1232
|
}
|
|
1226
1233
|
|
|
1227
|
-
if (position) applyPosition(position, session.sessionID);
|
|
1234
|
+
if (position && memori.needsPosition) applyPosition(position, session.sessionID);
|
|
1228
1235
|
|
|
1229
1236
|
setLoading(false);
|
|
1230
1237
|
return {
|
|
@@ -1427,7 +1434,7 @@ const MemoriWidget = ({
|
|
|
1427
1434
|
}
|
|
1428
1435
|
|
|
1429
1436
|
// Apply position and date settings if needed
|
|
1430
|
-
if (position) {
|
|
1437
|
+
if (position && memori.needsPosition) {
|
|
1431
1438
|
// console.log('[REOPEN_SESSION] Applying position');
|
|
1432
1439
|
applyPosition(position, sessionID);
|
|
1433
1440
|
}
|
|
@@ -3072,6 +3079,7 @@ const MemoriWidget = ({
|
|
|
3072
3079
|
'position',
|
|
3073
3080
|
undefined
|
|
3074
3081
|
);
|
|
3082
|
+
// Only check for position requirement if memori.needsPosition is true
|
|
3075
3083
|
if (autoStart && !localPosition && memori.needsPosition) {
|
|
3076
3084
|
console.log('position required', localPosition);
|
|
3077
3085
|
setShowPositionDrawer(true);
|
|
@@ -3226,7 +3234,7 @@ const MemoriWidget = ({
|
|
|
3226
3234
|
setHistory([]);
|
|
3227
3235
|
|
|
3228
3236
|
// date and place events
|
|
3229
|
-
if (position) applyPosition(position, sessionID);
|
|
3237
|
+
if (position && memori.needsPosition) applyPosition(position, sessionID);
|
|
3230
3238
|
if (memori.needsDateTime)
|
|
3231
3239
|
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
3232
3240
|
|
|
@@ -3468,7 +3476,7 @@ const MemoriWidget = ({
|
|
|
3468
3476
|
}
|
|
3469
3477
|
|
|
3470
3478
|
// date and place events
|
|
3471
|
-
if (position) applyPosition(position, sessionID);
|
|
3479
|
+
if (position && memori.needsPosition) applyPosition(position, sessionID);
|
|
3472
3480
|
if (memori.needsDateTime)
|
|
3473
3481
|
sendDateChangedEvent({ sessionID: sessionID, state: currentState });
|
|
3474
3482
|
}
|
package/src/index.tsx
CHANGED
|
@@ -157,12 +157,7 @@ const Memori: React.FC<Props> = ({
|
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const client = memoriApiClient(
|
|
161
|
-
apiURL === 'https://backend.memori.ai'
|
|
162
|
-
? 'https://backend-proxy.aisuru.com'
|
|
163
|
-
: apiURL,
|
|
164
|
-
engineURL
|
|
165
|
-
);
|
|
160
|
+
const client = memoriApiClient(apiURL, engineURL);
|
|
166
161
|
|
|
167
162
|
const fetchSpeechKey = useCallback(async () => {
|
|
168
163
|
const url =
|