react-instantsearch-core 7.30.0 → 7.31.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/dist/cjs/version.js
CHANGED
package/dist/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.
|
|
1
|
+
declare const _default: "7.31.0";
|
|
2
2
|
export default _default;
|
package/dist/es/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.
|
|
1
|
+
/*! React InstantSearch Core 7.31.0 | © 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.
|
|
27
|
+
var version$2 = '7.31.0';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -1507,6 +1507,12 @@
|
|
|
1507
1507
|
* This doesn't contain any beta/hidden features.
|
|
1508
1508
|
* @private
|
|
1509
1509
|
*/ SearchParameters.PARAMETERS = Object.keys(new SearchParameters());
|
|
1510
|
+
// Returns a finite number or null. Used to reject Infinity/-Infinity from parseFloat.
|
|
1511
|
+
function parseFiniteFloat(value) {
|
|
1512
|
+
var n = parseFloat(value);
|
|
1513
|
+
// global isFinite is safe here: n is always a number type (no string coercion risk)
|
|
1514
|
+
return isFinite(n) ? n : null;
|
|
1515
|
+
}
|
|
1510
1516
|
/**
|
|
1511
1517
|
* @private
|
|
1512
1518
|
* @param {object} partialState full or part of a state
|
|
@@ -1532,8 +1538,18 @@
|
|
|
1532
1538
|
var value = partialState[k];
|
|
1533
1539
|
if (typeof value === 'string') {
|
|
1534
1540
|
var parsedValue = parseFloat(value);
|
|
1535
|
-
|
|
1536
|
-
|
|
1541
|
+
if (isNaN(parsedValue)) {
|
|
1542
|
+
// originally an unparseable string like "all", keep NaN
|
|
1543
|
+
numbers[k] = value;
|
|
1544
|
+
} else if (!isFinite(parsedValue)) {
|
|
1545
|
+
// Infinity/-Infinity — convert to null
|
|
1546
|
+
numbers[k] = null;
|
|
1547
|
+
} else {
|
|
1548
|
+
numbers[k] = parsedValue;
|
|
1549
|
+
}
|
|
1550
|
+
} else if (typeof value === 'number' && !isFinite(value)) {
|
|
1551
|
+
// Already-numeric Infinity — convert to null
|
|
1552
|
+
numbers[k] = null;
|
|
1537
1553
|
}
|
|
1538
1554
|
});
|
|
1539
1555
|
// there's two formats of insideBoundingBox, we need to parse
|
|
@@ -1542,7 +1558,13 @@
|
|
|
1542
1558
|
numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) {
|
|
1543
1559
|
if (Array.isArray(geoRect)) {
|
|
1544
1560
|
return geoRect.map(function(value) {
|
|
1545
|
-
|
|
1561
|
+
if (typeof value === 'string') {
|
|
1562
|
+
return parseFiniteFloat(value);
|
|
1563
|
+
}
|
|
1564
|
+
if (typeof value === 'number' && !isFinite(value)) {
|
|
1565
|
+
return null;
|
|
1566
|
+
}
|
|
1567
|
+
return value;
|
|
1546
1568
|
});
|
|
1547
1569
|
}
|
|
1548
1570
|
return geoRect;
|
|
@@ -1559,12 +1581,17 @@
|
|
|
1559
1581
|
if (Array.isArray(v)) {
|
|
1560
1582
|
return v.map(function(vPrime) {
|
|
1561
1583
|
if (typeof vPrime === 'string') {
|
|
1562
|
-
return
|
|
1584
|
+
return parseFiniteFloat(vPrime);
|
|
1585
|
+
}
|
|
1586
|
+
if (typeof vPrime === 'number' && !isFinite(vPrime)) {
|
|
1587
|
+
return null;
|
|
1563
1588
|
}
|
|
1564
1589
|
return vPrime;
|
|
1565
1590
|
});
|
|
1566
1591
|
} else if (typeof v === 'string') {
|
|
1567
|
-
return
|
|
1592
|
+
return parseFiniteFloat(v);
|
|
1593
|
+
} else if (typeof v === 'number' && !isFinite(v)) {
|
|
1594
|
+
return null;
|
|
1568
1595
|
}
|
|
1569
1596
|
return v;
|
|
1570
1597
|
});
|
|
@@ -3892,7 +3919,7 @@
|
|
|
3892
3919
|
function requireVersion() {
|
|
3893
3920
|
if (hasRequiredVersion) return version$1;
|
|
3894
3921
|
hasRequiredVersion = 1;
|
|
3895
|
-
version$1 = '3.28.
|
|
3922
|
+
version$1 = '3.28.2';
|
|
3896
3923
|
return version$1;
|
|
3897
3924
|
}
|
|
3898
3925
|
|
|
@@ -9721,7 +9748,7 @@
|
|
|
9721
9748
|
};
|
|
9722
9749
|
}
|
|
9723
9750
|
|
|
9724
|
-
var version = '4.
|
|
9751
|
+
var version = '4.95.0';
|
|
9725
9752
|
|
|
9726
9753
|
function hydrateSearchClient(client, results) {
|
|
9727
9754
|
if (!results) {
|
|
@@ -11046,6 +11073,25 @@
|
|
|
11046
11073
|
return bindEventForHits;
|
|
11047
11074
|
}
|
|
11048
11075
|
|
|
11076
|
+
function addQueryID(hits, queryID) {
|
|
11077
|
+
if (!queryID) {
|
|
11078
|
+
return hits;
|
|
11079
|
+
}
|
|
11080
|
+
return hits.map(function(hit) {
|
|
11081
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
11082
|
+
__queryID: queryID
|
|
11083
|
+
});
|
|
11084
|
+
});
|
|
11085
|
+
}
|
|
11086
|
+
|
|
11087
|
+
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
11088
|
+
return hits.map(function(hit, idx) {
|
|
11089
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
11090
|
+
__position: hitsPerPage * page + idx + 1
|
|
11091
|
+
});
|
|
11092
|
+
});
|
|
11093
|
+
}
|
|
11094
|
+
|
|
11049
11095
|
var withUsage$p = createDocumentationMessageGenerator({
|
|
11050
11096
|
name: 'autocomplete',
|
|
11051
11097
|
connector: true
|
|
@@ -11092,7 +11138,7 @@
|
|
|
11092
11138
|
}
|
|
11093
11139
|
var sendEventMap = {};
|
|
11094
11140
|
var indices = scopedResults.map(function(scopedResult) {
|
|
11095
|
-
var _scopedResult_results
|
|
11141
|
+
var _scopedResult_results;
|
|
11096
11142
|
// We need to escape the hits because highlighting
|
|
11097
11143
|
// exposes HTML tags to the end-user.
|
|
11098
11144
|
if (scopedResult.results) {
|
|
@@ -11103,10 +11149,11 @@
|
|
|
11103
11149
|
helper: scopedResult.helper,
|
|
11104
11150
|
widgetType: _this.$$type
|
|
11105
11151
|
});
|
|
11152
|
+
var hits = scopedResult.results ? addQueryID(addAbsolutePosition(scopedResult.results.hits, scopedResult.results.page, scopedResult.results.hitsPerPage), scopedResult.results.queryID) : [];
|
|
11106
11153
|
return {
|
|
11107
11154
|
indexId: scopedResult.indexId,
|
|
11108
11155
|
indexName: ((_scopedResult_results = scopedResult.results) === null || _scopedResult_results === void 0 ? void 0 : _scopedResult_results.index) || '',
|
|
11109
|
-
hits:
|
|
11156
|
+
hits: hits,
|
|
11110
11157
|
results: scopedResult.results || {}
|
|
11111
11158
|
};
|
|
11112
11159
|
});
|
|
@@ -11509,12 +11556,81 @@
|
|
|
11509
11556
|
return Promise.resolve(value);
|
|
11510
11557
|
}
|
|
11511
11558
|
|
|
11559
|
+
var tryParseJson = function tryParseJson(value) {
|
|
11560
|
+
try {
|
|
11561
|
+
return JSON.parse(value);
|
|
11562
|
+
} catch (unused) {
|
|
11563
|
+
return undefined;
|
|
11564
|
+
}
|
|
11565
|
+
};
|
|
11566
|
+
var repairPartialJson = function repairPartialJson(value) {
|
|
11567
|
+
var repaired = value.trim();
|
|
11568
|
+
if (!repaired) {
|
|
11569
|
+
return repaired;
|
|
11570
|
+
}
|
|
11571
|
+
var inString = false;
|
|
11572
|
+
var isEscaped = false;
|
|
11573
|
+
var stack = [];
|
|
11574
|
+
for(var index = 0; index < repaired.length; index++){
|
|
11575
|
+
var char = repaired[index];
|
|
11576
|
+
if (inString) {
|
|
11577
|
+
if (isEscaped) {
|
|
11578
|
+
isEscaped = false;
|
|
11579
|
+
} else if (char === '\\') {
|
|
11580
|
+
isEscaped = true;
|
|
11581
|
+
} else if (char === '"') {
|
|
11582
|
+
inString = false;
|
|
11583
|
+
}
|
|
11584
|
+
continue;
|
|
11585
|
+
}
|
|
11586
|
+
if (char === '"') {
|
|
11587
|
+
inString = true;
|
|
11588
|
+
continue;
|
|
11589
|
+
}
|
|
11590
|
+
if (char === '{' || char === '[') {
|
|
11591
|
+
stack.push(char);
|
|
11592
|
+
continue;
|
|
11593
|
+
}
|
|
11594
|
+
if (char === '}' && stack[stack.length - 1] === '{') {
|
|
11595
|
+
stack.pop();
|
|
11596
|
+
continue;
|
|
11597
|
+
}
|
|
11598
|
+
if (char === ']' && stack[stack.length - 1] === '[') {
|
|
11599
|
+
stack.pop();
|
|
11600
|
+
}
|
|
11601
|
+
}
|
|
11602
|
+
if (inString && !isEscaped) {
|
|
11603
|
+
repaired += '"';
|
|
11604
|
+
}
|
|
11605
|
+
repaired = repaired.replace(RegExp(",\\s*$", "u"), '');
|
|
11606
|
+
if (stack.length > 0) {
|
|
11607
|
+
repaired += stack.reverse().map(function(opening) {
|
|
11608
|
+
return opening === '{' ? '}' : ']';
|
|
11609
|
+
}).join('');
|
|
11610
|
+
}
|
|
11611
|
+
return repaired.replace(RegExp(",\\s*([}\\]])", "gu"), '$1');
|
|
11612
|
+
};
|
|
11613
|
+
var parseToolInputDelta = function parseToolInputDelta(accumulatedRawInput, fallbackInput) {
|
|
11614
|
+
var normalized = accumulatedRawInput.trim();
|
|
11615
|
+
if (!normalized) {
|
|
11616
|
+
return fallbackInput;
|
|
11617
|
+
}
|
|
11618
|
+
var directParsed = tryParseJson(normalized);
|
|
11619
|
+
if (directParsed !== undefined) {
|
|
11620
|
+
return directParsed;
|
|
11621
|
+
}
|
|
11622
|
+
var repairedParsed = tryParseJson(repairPartialJson(normalized));
|
|
11623
|
+
if (repairedParsed !== undefined) {
|
|
11624
|
+
return repairedParsed;
|
|
11625
|
+
}
|
|
11626
|
+
return fallbackInput;
|
|
11627
|
+
};
|
|
11512
11628
|
/**
|
|
11513
11629
|
* Abstract base class for chat implementations.
|
|
11514
11630
|
*/ var AbstractChat = /*#__PURE__*/ function() {
|
|
11515
11631
|
function AbstractChat(param) {
|
|
11516
11632
|
var _this = this;
|
|
11517
|
-
var _param_generateId = param.generateId, generateId$1 = _param_generateId === void 0 ? generateId : _param_generateId, _param_id = param.id, id = _param_id === void 0 ? generateId$1() : _param_id, transport = param.transport, state = param.state, onError = param.onError, onToolCall = param.onToolCall, onFinish = param.onFinish, onData = param.onData, sendAutomaticallyWhen = param.sendAutomaticallyWhen;
|
|
11633
|
+
var _param_generateId = param.generateId, generateId$1 = _param_generateId === void 0 ? generateId : _param_generateId, _param_id = param.id, id = _param_id === void 0 ? generateId$1() : _param_id, transport = param.transport, state = param.state, onError = param.onError, onToolCall = param.onToolCall, onFinish = param.onFinish, onData = param.onData, sendAutomaticallyWhen = param.sendAutomaticallyWhen, shouldRepairToolInput = param.shouldRepairToolInput;
|
|
11518
11634
|
var _this1 = this;
|
|
11519
11635
|
_class_call_check(this, AbstractChat);
|
|
11520
11636
|
_define_property(this, "id", void 0);
|
|
@@ -11526,6 +11642,7 @@
|
|
|
11526
11642
|
_define_property(this, "onFinish", void 0);
|
|
11527
11643
|
_define_property(this, "onData", void 0);
|
|
11528
11644
|
_define_property(this, "sendAutomaticallyWhen", void 0);
|
|
11645
|
+
_define_property(this, "shouldRepairToolInput", void 0);
|
|
11529
11646
|
_define_property(this, "activeResponse", null);
|
|
11530
11647
|
_define_property(this, "jobExecutor", new SerialJobExecutor());
|
|
11531
11648
|
/**
|
|
@@ -11735,6 +11852,7 @@
|
|
|
11735
11852
|
this.onFinish = onFinish;
|
|
11736
11853
|
this.onData = onData;
|
|
11737
11854
|
this.sendAutomaticallyWhen = sendAutomaticallyWhen;
|
|
11855
|
+
this.shouldRepairToolInput = shouldRepairToolInput;
|
|
11738
11856
|
}
|
|
11739
11857
|
_create_class(AbstractChat, [
|
|
11740
11858
|
{
|
|
@@ -11837,6 +11955,7 @@
|
|
|
11837
11955
|
// Track current text/reasoning part state
|
|
11838
11956
|
var currentTextPartId;
|
|
11839
11957
|
var currentReasoningPartId;
|
|
11958
|
+
var toolRawInputByCallId = {};
|
|
11840
11959
|
// Promise chain for handling tool calls that return promises
|
|
11841
11960
|
var pendingToolCall = Promise.resolve();
|
|
11842
11961
|
return new Promise(function(resolve) {
|
|
@@ -11975,11 +12094,14 @@
|
|
|
11975
12094
|
case 'tool-input-start':
|
|
11976
12095
|
{
|
|
11977
12096
|
if (!currentMessage) break;
|
|
12097
|
+
var initialRawInput = typeof chunk.input === 'string' ? chunk.input : chunk.input !== undefined ? JSON.stringify(chunk.input) : '';
|
|
12098
|
+
toolRawInputByCallId[chunk.toolCallId] = initialRawInput;
|
|
11978
12099
|
var toolPart = {
|
|
11979
12100
|
type: "tool-".concat(chunk.toolName),
|
|
11980
12101
|
toolCallId: chunk.toolCallId,
|
|
11981
12102
|
state: 'input-streaming',
|
|
11982
12103
|
input: chunk.input,
|
|
12104
|
+
rawInput: initialRawInput || undefined,
|
|
11983
12105
|
providerExecuted: chunk.providerExecuted
|
|
11984
12106
|
};
|
|
11985
12107
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
@@ -11992,11 +12114,47 @@
|
|
|
11992
12114
|
}
|
|
11993
12115
|
case 'tool-input-delta':
|
|
11994
12116
|
{
|
|
12117
|
+
var _ref, _ref1, _chunk_toolName, _ref2;
|
|
12118
|
+
var _existingPart_type, _this_shouldRepairToolInput, _this1;
|
|
12119
|
+
if (!currentMessage) break;
|
|
12120
|
+
var toolIndex = currentMessage.parts.findIndex(function(p) {
|
|
12121
|
+
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12122
|
+
});
|
|
12123
|
+
var existingPart = toolIndex >= 0 ? currentMessage.parts[toolIndex] : null;
|
|
12124
|
+
var previousRawInput = (_ref = (_ref1 = existingPart === null || existingPart === void 0 ? void 0 : existingPart.rawInput) !== null && _ref1 !== void 0 ? _ref1 : toolRawInputByCallId[chunk.toolCallId]) !== null && _ref !== void 0 ? _ref : '';
|
|
12125
|
+
var nextRawInput = "".concat(previousRawInput).concat(chunk.inputTextDelta);
|
|
12126
|
+
toolRawInputByCallId[chunk.toolCallId] = nextRawInput;
|
|
12127
|
+
var toolName = (_chunk_toolName = chunk.toolName) !== null && _chunk_toolName !== void 0 ? _chunk_toolName : existingPart === null || existingPart === void 0 ? void 0 : (_existingPart_type = existingPart.type) === null || _existingPart_type === void 0 ? void 0 : _existingPart_type.replace('tool-', '');
|
|
12128
|
+
var shouldRepair = toolName ? (_ref2 = (_this_shouldRepairToolInput = (_this1 = _this).shouldRepairToolInput) === null || _this_shouldRepairToolInput === void 0 ? void 0 : _this_shouldRepairToolInput.call(_this1, toolName)) !== null && _ref2 !== void 0 ? _ref2 : true : true;
|
|
12129
|
+
var parsedInput = shouldRepair ? parseToolInputDelta(nextRawInput, existingPart === null || existingPart === void 0 ? void 0 : existingPart.input) : existingPart === null || existingPart === void 0 ? void 0 : existingPart.input;
|
|
12130
|
+
var nextToolPart = _object_spread_props(_object_spread({}, existingPart !== null && existingPart !== void 0 ? existingPart : {
|
|
12131
|
+
type: "tool-".concat(chunk.toolName),
|
|
12132
|
+
toolCallId: chunk.toolCallId
|
|
12133
|
+
}), {
|
|
12134
|
+
state: 'input-streaming',
|
|
12135
|
+
input: parsedInput,
|
|
12136
|
+
rawInput: nextRawInput
|
|
12137
|
+
});
|
|
12138
|
+
if (toolIndex >= 0) {
|
|
12139
|
+
var updatedParts4 = _to_consumable_array(currentMessage.parts);
|
|
12140
|
+
updatedParts4[toolIndex] = nextToolPart;
|
|
12141
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12142
|
+
parts: updatedParts4
|
|
12143
|
+
});
|
|
12144
|
+
} else {
|
|
12145
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12146
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12147
|
+
nextToolPart
|
|
12148
|
+
])
|
|
12149
|
+
});
|
|
12150
|
+
}
|
|
12151
|
+
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
11995
12152
|
break;
|
|
11996
12153
|
}
|
|
11997
12154
|
case 'tool-input-available':
|
|
11998
12155
|
{
|
|
11999
12156
|
if (!currentMessage) break;
|
|
12157
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
12000
12158
|
// Find existing tool part or create new one
|
|
12001
12159
|
var existingIndex = currentMessage.parts.findIndex(function(p) {
|
|
12002
12160
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
@@ -12010,10 +12168,10 @@
|
|
|
12010
12168
|
providerExecuted: chunk.providerExecuted
|
|
12011
12169
|
};
|
|
12012
12170
|
if (existingIndex >= 0) {
|
|
12013
|
-
var
|
|
12014
|
-
|
|
12171
|
+
var updatedParts5 = _to_consumable_array(currentMessage.parts);
|
|
12172
|
+
updatedParts5[existingIndex] = toolPart1;
|
|
12015
12173
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12016
|
-
parts:
|
|
12174
|
+
parts: updatedParts5
|
|
12017
12175
|
});
|
|
12018
12176
|
} else {
|
|
12019
12177
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
@@ -12030,7 +12188,8 @@
|
|
|
12030
12188
|
toolCall: {
|
|
12031
12189
|
toolName: chunk.toolName,
|
|
12032
12190
|
toolCallId: chunk.toolCallId,
|
|
12033
|
-
input: chunk.input
|
|
12191
|
+
input: chunk.input,
|
|
12192
|
+
dynamic: 'dynamic' in chunk ? chunk.dynamic : undefined
|
|
12034
12193
|
}
|
|
12035
12194
|
});
|
|
12036
12195
|
if (result && typeof result.then === 'function') {
|
|
@@ -12044,20 +12203,21 @@
|
|
|
12044
12203
|
case 'tool-output-available':
|
|
12045
12204
|
{
|
|
12046
12205
|
if (!currentMessage) break;
|
|
12047
|
-
var
|
|
12206
|
+
var toolIndex1 = currentMessage.parts.findIndex(function(p) {
|
|
12048
12207
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12049
12208
|
});
|
|
12050
|
-
if (
|
|
12051
|
-
|
|
12052
|
-
var
|
|
12053
|
-
|
|
12209
|
+
if (toolIndex1 >= 0) {
|
|
12210
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
12211
|
+
var updatedParts6 = _to_consumable_array(currentMessage.parts);
|
|
12212
|
+
var existingPart1 = updatedParts6[toolIndex1];
|
|
12213
|
+
updatedParts6[toolIndex1] = _object_spread_props(_object_spread({}, existingPart1), {
|
|
12054
12214
|
state: 'output-available',
|
|
12055
12215
|
output: chunk.output,
|
|
12056
12216
|
callProviderMetadata: chunk.callProviderMetadata,
|
|
12057
12217
|
preliminary: chunk.preliminary
|
|
12058
12218
|
});
|
|
12059
12219
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12060
|
-
parts:
|
|
12220
|
+
parts: updatedParts6
|
|
12061
12221
|
});
|
|
12062
12222
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
12063
12223
|
}
|
|
@@ -12066,21 +12226,22 @@
|
|
|
12066
12226
|
case 'tool-error':
|
|
12067
12227
|
{
|
|
12068
12228
|
if (!currentMessage) break;
|
|
12069
|
-
var
|
|
12229
|
+
var toolIndex2 = currentMessage.parts.findIndex(function(p) {
|
|
12070
12230
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12071
12231
|
});
|
|
12072
|
-
if (
|
|
12232
|
+
if (toolIndex2 >= 0) {
|
|
12073
12233
|
var _chunk_input;
|
|
12074
|
-
|
|
12075
|
-
var
|
|
12076
|
-
|
|
12234
|
+
delete toolRawInputByCallId[chunk.toolCallId];
|
|
12235
|
+
var updatedParts7 = _to_consumable_array(currentMessage.parts);
|
|
12236
|
+
var existingPart2 = updatedParts7[toolIndex2];
|
|
12237
|
+
updatedParts7[toolIndex2] = _object_spread_props(_object_spread({}, existingPart2), {
|
|
12077
12238
|
state: 'output-error',
|
|
12078
12239
|
errorText: chunk.errorText,
|
|
12079
|
-
input: (_chunk_input = chunk.input) !== null && _chunk_input !== void 0 ? _chunk_input :
|
|
12240
|
+
input: (_chunk_input = chunk.input) !== null && _chunk_input !== void 0 ? _chunk_input : existingPart2.input,
|
|
12080
12241
|
callProviderMetadata: chunk.callProviderMetadata
|
|
12081
12242
|
});
|
|
12082
12243
|
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12083
|
-
parts:
|
|
12244
|
+
parts: updatedParts7
|
|
12084
12245
|
});
|
|
12085
12246
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
12086
12247
|
}
|
|
@@ -12993,6 +13154,14 @@
|
|
|
12993
13154
|
return new Chat(_object_spread_props(_object_spread({}, options), {
|
|
12994
13155
|
transport: transport,
|
|
12995
13156
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
13157
|
+
shouldRepairToolInput: function shouldRepairToolInput(toolName) {
|
|
13158
|
+
var tool = tools[toolName];
|
|
13159
|
+
if (!tool && toolName.startsWith("".concat(SearchIndexToolType, "_"))) {
|
|
13160
|
+
tool = tools[SearchIndexToolType];
|
|
13161
|
+
}
|
|
13162
|
+
if (!tool) return true;
|
|
13163
|
+
return Boolean(tool.streamInput);
|
|
13164
|
+
},
|
|
12996
13165
|
onToolCall: function onToolCall(param) {
|
|
12997
13166
|
var toolCall = param.toolCall;
|
|
12998
13167
|
var tool = tools[toolCall.toolName];
|
|
@@ -13527,25 +13696,6 @@
|
|
|
13527
13696
|
return useConnector(connectCurrentRefinements, props, additionalWidgetProperties);
|
|
13528
13697
|
}
|
|
13529
13698
|
|
|
13530
|
-
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
13531
|
-
return hits.map(function(hit, idx) {
|
|
13532
|
-
return _object_spread_props(_object_spread({}, hit), {
|
|
13533
|
-
__position: hitsPerPage * page + idx + 1
|
|
13534
|
-
});
|
|
13535
|
-
});
|
|
13536
|
-
}
|
|
13537
|
-
|
|
13538
|
-
function addQueryID(hits, queryID) {
|
|
13539
|
-
if (!queryID) {
|
|
13540
|
-
return hits;
|
|
13541
|
-
}
|
|
13542
|
-
return hits.map(function(hit) {
|
|
13543
|
-
return _object_spread_props(_object_spread({}, hit), {
|
|
13544
|
-
__queryID: queryID
|
|
13545
|
-
});
|
|
13546
|
-
});
|
|
13547
|
-
}
|
|
13548
|
-
|
|
13549
13699
|
var withUsage$k = createDocumentationMessageGenerator({
|
|
13550
13700
|
name: 'frequently-bought-together',
|
|
13551
13701
|
connector: true
|