oomi-ai 0.2.12 → 0.2.13
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/bin/oomi-ai.js +28 -1
- package/package.json +1 -1
package/bin/oomi-ai.js
CHANGED
|
@@ -945,7 +945,34 @@ function prepareGatewayFrameForLocalGateway(frameText, gatewayAuth, options = {}
|
|
|
945
945
|
|
|
946
946
|
try {
|
|
947
947
|
const frame = JSON.parse(frameText);
|
|
948
|
-
if (frame?.type !== 'req'
|
|
948
|
+
if (frame?.type !== 'req') {
|
|
949
|
+
return { frameText, waitForChallenge: false };
|
|
950
|
+
}
|
|
951
|
+
const method = typeof frame.method === 'string' ? frame.method.trim() : '';
|
|
952
|
+
if (!method) {
|
|
953
|
+
return { frameText, waitForChallenge: false };
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
if (method !== 'connect') {
|
|
957
|
+
const shouldStripBridgeOnlyParams = method === 'chat.send' || method === 'chat.history';
|
|
958
|
+
if (!shouldStripBridgeOnlyParams) {
|
|
959
|
+
return { frameText, waitForChallenge: false };
|
|
960
|
+
}
|
|
961
|
+
const rawParams = frame.params && typeof frame.params === 'object' ? frame.params : {};
|
|
962
|
+
const sanitized = { ...rawParams };
|
|
963
|
+
let changed = false;
|
|
964
|
+
if (Object.prototype.hasOwnProperty.call(sanitized, 'correlationId')) {
|
|
965
|
+
delete sanitized.correlationId;
|
|
966
|
+
changed = true;
|
|
967
|
+
}
|
|
968
|
+
if (Object.prototype.hasOwnProperty.call(sanitized, 'metadata')) {
|
|
969
|
+
delete sanitized.metadata;
|
|
970
|
+
changed = true;
|
|
971
|
+
}
|
|
972
|
+
if (changed) {
|
|
973
|
+
frame.params = sanitized;
|
|
974
|
+
return { frameText: JSON.stringify(frame), waitForChallenge: false };
|
|
975
|
+
}
|
|
949
976
|
return { frameText, waitForChallenge: false };
|
|
950
977
|
}
|
|
951
978
|
|