react-instantsearch-core 7.39.0 → 7.39.1
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/dist/cjs/version.js
CHANGED
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.39.
|
|
1
|
+
declare const _default: "7.39.1";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.39.
|
|
1
|
+
/*! React InstantSearch Core 7.39.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.39.
|
|
27
|
+
var version$2 = '7.39.1';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -9192,7 +9192,7 @@
|
|
|
9192
9192
|
});
|
|
9193
9193
|
}
|
|
9194
9194
|
|
|
9195
|
-
var version = '4.
|
|
9195
|
+
var version = '4.106.0';
|
|
9196
9196
|
|
|
9197
9197
|
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
9198
9198
|
function getCookie(name) {
|
|
@@ -12608,15 +12608,14 @@
|
|
|
12608
12608
|
return Promise.resolve(value);
|
|
12609
12609
|
}
|
|
12610
12610
|
/**
|
|
12611
|
-
* Error
|
|
12612
|
-
* chunk. The `message` carries
|
|
12613
|
-
*
|
|
12614
|
-
*
|
|
12615
|
-
* behind a friendly default).
|
|
12611
|
+
* Error shape for custom chat implementations that still surface a
|
|
12612
|
+
* `data-guardrail-violation` chunk through the error UI. The `message` carries
|
|
12613
|
+
* the service-provided `fallbackResponse`, which is authored for end-user
|
|
12614
|
+
* display.
|
|
12616
12615
|
*
|
|
12617
12616
|
* Detection across package boundaries should rely on `error.name` rather than
|
|
12618
12617
|
* `instanceof` to avoid issues with mixed module copies in bundled apps.
|
|
12619
|
-
*/
|
|
12618
|
+
*/ /*#__PURE__*/ (function(Error1) {
|
|
12620
12619
|
_inherits(GuardrailViolationError, Error1);
|
|
12621
12620
|
function GuardrailViolationError(message) {
|
|
12622
12621
|
_class_call_check(this, GuardrailViolationError);
|
|
@@ -12628,7 +12627,7 @@
|
|
|
12628
12627
|
return _this;
|
|
12629
12628
|
}
|
|
12630
12629
|
return GuardrailViolationError;
|
|
12631
|
-
}(_wrap_native_super(Error));
|
|
12630
|
+
})(_wrap_native_super(Error));
|
|
12632
12631
|
/**
|
|
12633
12632
|
* Reads a non-empty `message` field off a JSON-serialized error envelope.
|
|
12634
12633
|
*
|
|
@@ -12720,6 +12719,7 @@
|
|
|
12720
12719
|
}
|
|
12721
12720
|
return fallbackInput;
|
|
12722
12721
|
};
|
|
12722
|
+
var defaultGuardrailFallbackResponse = 'Sorry, we are not able to generate a response at the moment.';
|
|
12723
12723
|
/**
|
|
12724
12724
|
* Abstract base class for chat implementations.
|
|
12725
12725
|
*/ var AbstractChat = /*#__PURE__*/ function() {
|
|
@@ -13546,28 +13546,37 @@
|
|
|
13546
13546
|
}
|
|
13547
13547
|
break;
|
|
13548
13548
|
}
|
|
13549
|
-
// Surface guardrail violations through the error state, but
|
|
13550
|
-
// distinct from generic cost-control / 4xx errors: throw a
|
|
13551
|
-
// `GuardrailViolationError` so the UI can render the
|
|
13552
|
-
// service-provided `fallbackResponse` verbatim (it's authored for
|
|
13553
|
-
// end-user display) instead of the friendly default used for
|
|
13554
|
-
// opaque transport errors. Also discard any in-progress assistant
|
|
13555
|
-
// message so no partial text lingers above the fallback, and
|
|
13556
|
-
// clear the local cursor so the `onFinish` callback doesn't
|
|
13557
|
-
// receive a `currentMessage` that no longer exists in state.
|
|
13558
13549
|
case 'data-guardrail-violation':
|
|
13559
13550
|
{
|
|
13560
|
-
isError = true;
|
|
13561
|
-
if (currentMessageIndex >= 0) {
|
|
13562
|
-
_this.state.messages = _this.state.messages.slice(0, currentMessageIndex);
|
|
13563
|
-
currentMessage = undefined;
|
|
13564
|
-
currentMessageIndex = -1;
|
|
13565
|
-
}
|
|
13566
13551
|
// `chunk.data` widens to `unknown` here: the chunk union also
|
|
13567
13552
|
// carries a generic `data-${string}` member, and the literal
|
|
13568
13553
|
// matches both, so narrowing can't pick the specific shape.
|
|
13569
13554
|
var fallbackResponse = chunk.data.fallbackResponse;
|
|
13570
|
-
|
|
13555
|
+
var fallbackText = fallbackResponse || defaultGuardrailFallbackResponse;
|
|
13556
|
+
// The stream closes after a guardrail violation; keep the
|
|
13557
|
+
// fallback as the current message so the normal finish path runs.
|
|
13558
|
+
currentMessage = {
|
|
13559
|
+
id: (currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.id) || currentMessageId || _this.generateId(),
|
|
13560
|
+
role: 'assistant',
|
|
13561
|
+
metadata: currentMessage === null || currentMessage === void 0 ? void 0 : currentMessage.metadata,
|
|
13562
|
+
parts: [
|
|
13563
|
+
{
|
|
13564
|
+
type: 'text',
|
|
13565
|
+
text: fallbackText,
|
|
13566
|
+
state: 'done'
|
|
13567
|
+
}
|
|
13568
|
+
]
|
|
13569
|
+
};
|
|
13570
|
+
if (currentMessageIndex >= 0) {
|
|
13571
|
+
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
13572
|
+
} else {
|
|
13573
|
+
_this.state.pushMessage(currentMessage);
|
|
13574
|
+
currentMessageIndex = _this.state.messages.length - 1;
|
|
13575
|
+
}
|
|
13576
|
+
currentMessageId = currentMessage.id;
|
|
13577
|
+
currentTextPartId = undefined;
|
|
13578
|
+
currentReasoningPartId = undefined;
|
|
13579
|
+
break;
|
|
13571
13580
|
}
|
|
13572
13581
|
default:
|
|
13573
13582
|
{
|
|
@@ -13702,7 +13711,7 @@
|
|
|
13702
13711
|
var ChatState = /*#__PURE__*/ function() {
|
|
13703
13712
|
function ChatState() {
|
|
13704
13713
|
var _this = this;
|
|
13705
|
-
var id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined, initialMessages = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
13714
|
+
var id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined, initialMessages = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : undefined, persistence = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
13706
13715
|
_class_call_check(this, ChatState);
|
|
13707
13716
|
_define_property(this, "_messages", void 0);
|
|
13708
13717
|
_define_property(this, "_status", 'ready');
|
|
@@ -13762,7 +13771,16 @@
|
|
|
13762
13771
|
return callback();
|
|
13763
13772
|
});
|
|
13764
13773
|
});
|
|
13765
|
-
|
|
13774
|
+
if (initialMessages !== undefined) {
|
|
13775
|
+
this._messages = initialMessages;
|
|
13776
|
+
} else if (persistence) {
|
|
13777
|
+
this._messages = getDefaultInitialMessages(id);
|
|
13778
|
+
} else {
|
|
13779
|
+
this._messages = [];
|
|
13780
|
+
}
|
|
13781
|
+
if (!persistence) {
|
|
13782
|
+
return;
|
|
13783
|
+
}
|
|
13766
13784
|
var saveMessagesInLocalStorage = function saveMessagesInLocalStorage() {
|
|
13767
13785
|
if (_this.status === 'ready') {
|
|
13768
13786
|
try {
|
|
@@ -13816,11 +13834,12 @@
|
|
|
13816
13834
|
function Chat(_0) {
|
|
13817
13835
|
_class_call_check(this, Chat);
|
|
13818
13836
|
var _this;
|
|
13819
|
-
var messages = _0.messages, agentId = _0.agentId, init = _object_without_properties(_0, [
|
|
13837
|
+
var messages = _0.messages, agentId = _0.agentId, _0_persistence = _0.persistence, persistence = _0_persistence === void 0 ? true : _0_persistence, init = _object_without_properties(_0, [
|
|
13820
13838
|
"messages",
|
|
13821
|
-
"agentId"
|
|
13839
|
+
"agentId",
|
|
13840
|
+
"persistence"
|
|
13822
13841
|
]);
|
|
13823
|
-
var state = new ChatState(agentId, messages);
|
|
13842
|
+
var state = new ChatState(agentId, messages, persistence);
|
|
13824
13843
|
_this = _call_super(this, Chat, [
|
|
13825
13844
|
_object_spread_props(_object_spread({}, init), {
|
|
13826
13845
|
state: state
|