react-instantsearch 7.49.0 → 7.49.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/widgets/Chat.js +7 -5
- package/dist/cjs/widgets/chat/tools/DisplayResultsTool.js +3 -3
- package/dist/es/index.js +1 -1
- package/dist/es/widgets/Chat.d.ts +2 -2
- package/dist/es/widgets/Chat.js +7 -8
- package/dist/es/widgets/chat/tools/DisplayResultsTool.d.ts +2 -2
- package/dist/es/widgets/chat/tools/DisplayResultsTool.js +2 -2
- package/dist/es/widgets/index.js +1 -1
- package/dist/umd/ReactInstantSearch.js +17 -52
- package/dist/umd/ReactInstantSearch.min.js +3 -3
- package/package.json +5 -5
package/dist/cjs/widgets/Chat.js
CHANGED
|
@@ -16,6 +16,9 @@ _export(exports, {
|
|
|
16
16
|
get DisplayResultsToolType () {
|
|
17
17
|
return _chat.DisplayResultsToolType;
|
|
18
18
|
},
|
|
19
|
+
get GroupedResultsToolType () {
|
|
20
|
+
return _chat.GroupedResultsToolType;
|
|
21
|
+
},
|
|
19
22
|
get MemorizeToolType () {
|
|
20
23
|
return _chat.MemorizeToolType;
|
|
21
24
|
},
|
|
@@ -65,14 +68,14 @@ var ChatUiComponent = (0, _instantsearchuicomponents.createChatComponent)({
|
|
|
65
68
|
function createDefaultTools(itemComponent, getSearchPageURL) {
|
|
66
69
|
var _obj;
|
|
67
70
|
return _obj = {}, _define_property._(_obj, _chat.SearchIndexToolType, _object_spread_props._(_object_spread._({}, (0, _SearchIndexTool.createCarouselTool)(true, itemComponent, getSearchPageURL)), {
|
|
68
|
-
// The agent decides per turn whether the richer
|
|
71
|
+
// The agent decides per turn whether the richer Grouped Results tool
|
|
69
72
|
// takes over the rendering of the search results.
|
|
70
73
|
shouldRender: isDisplayResultsDisabled
|
|
71
|
-
})), _define_property._(_obj, _chat.RecommendToolType, (0, _SearchIndexTool.createCarouselTool)(false, itemComponent, getSearchPageURL)), _define_property._(_obj, _chat.DisplayResultsToolType, (0, _DisplayResultsTool.
|
|
74
|
+
})), _define_property._(_obj, _chat.RecommendToolType, (0, _SearchIndexTool.createCarouselTool)(false, itemComponent, getSearchPageURL)), _define_property._(_obj, _chat.DisplayResultsToolType, (0, _DisplayResultsTool.createGroupedResultsTool)(itemComponent)), _define_property._(_obj, _chat.GroupedResultsToolType, (0, _DisplayResultsTool.createGroupedResultsTool)(itemComponent)), _define_property._(_obj, _chat.MemorizeToolType, {}), _define_property._(_obj, _chat.MemorySearchToolType, {}), _define_property._(_obj, _chat.PonderToolType, {}), _obj;
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
77
|
* Whether the search tool renders its own results, i.e. the agent did not hand
|
|
75
|
-
* the turn to the
|
|
78
|
+
* the turn to the Grouped Results tool. Set on the message by the backend.
|
|
76
79
|
*/ function isDisplayResultsDisabled(param) {
|
|
77
80
|
var parentMessage = param.parentMessage;
|
|
78
81
|
var _parentMessage_metadata;
|
|
@@ -203,7 +206,7 @@ function ChatInner(_0, _1) {
|
|
|
203
206
|
tools: tools,
|
|
204
207
|
disableTriggerValidation: effectiveDisableTriggerValidation
|
|
205
208
|
}));
|
|
206
|
-
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions,
|
|
209
|
+
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions, onFeedback = chatState.sendChatMessageFeedback, feedbackState = chatState.feedbackState, consumeInputFocus = chatState['~consumeInputFocus'], isOpenStatePersistenceEnabled = chatState['~isOpenStatePersistenceEnabled'];
|
|
207
210
|
var sendMessageAndScrollToBottom = (0, _react.useCallback)(function() {
|
|
208
211
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
209
212
|
args[_key] = arguments[_key];
|
|
@@ -361,7 +364,6 @@ function ChatInner(_0, _1) {
|
|
|
361
364
|
}),
|
|
362
365
|
suggestionsProps: {
|
|
363
366
|
suggestions: suggestions,
|
|
364
|
-
isLoading: suggestionsStatus === 'loading',
|
|
365
367
|
onSuggestionClick: function onSuggestionClick(suggestion) {
|
|
366
368
|
sendMessageAndScrollToBottom({
|
|
367
369
|
text: suggestion
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "createGroupedResultsTool", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function() {
|
|
9
|
-
return
|
|
9
|
+
return createGroupedResultsTool;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
var _instantsearchuicomponents = require("instantsearch-ui-components");
|
|
14
14
|
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
15
15
|
var _components = require("../../../components");
|
|
16
|
-
function
|
|
16
|
+
function createGroupedResultsTool(itemComponent) {
|
|
17
17
|
var DisplayResultsUIComponent = (0, _instantsearchuicomponents.createDisplayResultsToolComponent)({
|
|
18
18
|
createElement: _react.createElement,
|
|
19
19
|
Fragment: _react.Fragment,
|
package/dist/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export * from 'react-instantsearch-core';
|
|
|
2
2
|
export { useStickToBottom } from './lib/useStickToBottom.js';
|
|
3
3
|
export { Autocomplete, EXPERIMENTAL_Autocomplete } from './widgets/Autocomplete.js';
|
|
4
4
|
export { Breadcrumb } from './widgets/Breadcrumb.js';
|
|
5
|
-
export { DisplayResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
5
|
+
export { DisplayResultsToolType, GroupedResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
6
6
|
export { Chat, createDefaultTools } from './widgets/Chat.js';
|
|
7
7
|
export { PromptSuggestions } from './widgets/PromptSuggestions.js';
|
|
8
8
|
export { ChatTrigger } from './widgets/ChatTrigger.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SearchIndexToolType, RecommendToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, DisplayResultsToolType } from 'instantsearch.js/es/lib/chat';
|
|
1
|
+
import { SearchIndexToolType, RecommendToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, DisplayResultsToolType, GroupedResultsToolType } from 'instantsearch.js/es/lib/chat';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export { SearchIndexToolType, RecommendToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, DisplayResultsToolType, };
|
|
3
|
+
export { SearchIndexToolType, RecommendToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, DisplayResultsToolType, GroupedResultsToolType, };
|
|
4
4
|
import type { ChatProps as ChatUiProps, ChatLayoutOwnProps, RecommendComponentProps, RecordWithObjectID, UserClientSideTool, UserClientSideTools, ChatMessageProps } from 'instantsearch-ui-components';
|
|
5
5
|
import type { IndexUiState } from 'instantsearch.js';
|
|
6
6
|
import type { UIMessage } from 'instantsearch.js/es/lib/chat';
|
package/dist/es/widgets/Chat.js
CHANGED
|
@@ -10,13 +10,13 @@ import { _ as _$9 } from '@swc/helpers/esm/_sliced_to_array.js';
|
|
|
10
10
|
import { _ as _$7 } from '@swc/helpers/esm/_to_array.js';
|
|
11
11
|
import { _ as _$a } from '@swc/helpers/esm/_to_consumable_array.js';
|
|
12
12
|
import { createChatComponent } from 'instantsearch-ui-components';
|
|
13
|
-
import { SearchIndexToolType, RecommendToolType, DisplayResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
14
|
-
export { DisplayResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
13
|
+
import { SearchIndexToolType, RecommendToolType, DisplayResultsToolType, GroupedResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
14
|
+
export { DisplayResultsToolType, GroupedResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
15
15
|
import { getActiveContainerAnimations, holdContainerInertUntilReveal, restoreContainerInertUntilReveal, focusAfterReveal } from 'instantsearch.js/es/lib/chat/focusAfterReveal.js';
|
|
16
16
|
import React, { createElement, Fragment, useMemo, useState, useEffect, useRef, useCallback, useImperativeHandle } from 'react';
|
|
17
17
|
import { useInstantSearch, useChat } from 'react-instantsearch-core';
|
|
18
18
|
import { useStickToBottom } from '../lib/useStickToBottom.js';
|
|
19
|
-
import {
|
|
19
|
+
import { createGroupedResultsTool } from './chat/tools/DisplayResultsTool.js';
|
|
20
20
|
import { createCarouselTool } from './chat/tools/SearchIndexTool.js';
|
|
21
21
|
|
|
22
22
|
var ChatUiComponent = createChatComponent({
|
|
@@ -29,14 +29,14 @@ var ChatUiComponent = createChatComponent({
|
|
|
29
29
|
function createDefaultTools(itemComponent, getSearchPageURL) {
|
|
30
30
|
var _obj;
|
|
31
31
|
return _obj = {}, _$4(_obj, SearchIndexToolType, _$5(_$6({}, createCarouselTool(true, itemComponent, getSearchPageURL)), {
|
|
32
|
-
// The agent decides per turn whether the richer
|
|
32
|
+
// The agent decides per turn whether the richer Grouped Results tool
|
|
33
33
|
// takes over the rendering of the search results.
|
|
34
34
|
shouldRender: isDisplayResultsDisabled
|
|
35
|
-
})), _$4(_obj, RecommendToolType, createCarouselTool(false, itemComponent, getSearchPageURL)), _$4(_obj, DisplayResultsToolType,
|
|
35
|
+
})), _$4(_obj, RecommendToolType, createCarouselTool(false, itemComponent, getSearchPageURL)), _$4(_obj, DisplayResultsToolType, createGroupedResultsTool(itemComponent)), _$4(_obj, GroupedResultsToolType, createGroupedResultsTool(itemComponent)), _$4(_obj, MemorizeToolType, {}), _$4(_obj, MemorySearchToolType, {}), _$4(_obj, PonderToolType, {}), _obj;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Whether the search tool renders its own results, i.e. the agent did not hand
|
|
39
|
-
* the turn to the
|
|
39
|
+
* the turn to the Grouped Results tool. Set on the message by the backend.
|
|
40
40
|
*/ function isDisplayResultsDisabled(param) {
|
|
41
41
|
var parentMessage = param.parentMessage;
|
|
42
42
|
var _parentMessage_metadata;
|
|
@@ -167,7 +167,7 @@ function ChatInner(_0, _1) {
|
|
|
167
167
|
tools: tools,
|
|
168
168
|
disableTriggerValidation: effectiveDisableTriggerValidation
|
|
169
169
|
}));
|
|
170
|
-
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions,
|
|
170
|
+
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions, onFeedback = chatState.sendChatMessageFeedback, feedbackState = chatState.feedbackState, consumeInputFocus = chatState['~consumeInputFocus'], isOpenStatePersistenceEnabled = chatState['~isOpenStatePersistenceEnabled'];
|
|
171
171
|
var sendMessageAndScrollToBottom = useCallback(function() {
|
|
172
172
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
173
173
|
args[_key] = arguments[_key];
|
|
@@ -325,7 +325,6 @@ function ChatInner(_0, _1) {
|
|
|
325
325
|
}),
|
|
326
326
|
suggestionsProps: {
|
|
327
327
|
suggestions: suggestions,
|
|
328
|
-
isLoading: suggestionsStatus === 'loading',
|
|
329
328
|
onSuggestionClick: function onSuggestionClick(suggestion) {
|
|
330
329
|
sendMessageAndScrollToBottom({
|
|
331
330
|
text: suggestion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { RecommendComponentProps, RecordWithObjectID, UserClientSideTool } from 'instantsearch-ui-components';
|
|
2
2
|
type ItemComponent<TObject> = RecommendComponentProps<TObject>['itemComponent'];
|
|
3
|
-
declare function
|
|
4
|
-
export {
|
|
3
|
+
declare function createGroupedResultsTool<TObject extends RecordWithObjectID>(itemComponent?: ItemComponent<TObject>): UserClientSideTool;
|
|
4
|
+
export { createGroupedResultsTool };
|
|
@@ -2,7 +2,7 @@ import { createDisplayResultsToolComponent, createButtonComponent, ChevronLeftIc
|
|
|
2
2
|
import React, { createElement, Fragment, useEffect, useRef } from 'react';
|
|
3
3
|
import { Carousel } from '../../../components/Carousel.js';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function createGroupedResultsTool(itemComponent) {
|
|
6
6
|
var DisplayResultsUIComponent = createDisplayResultsToolComponent({
|
|
7
7
|
createElement: createElement,
|
|
8
8
|
Fragment: Fragment,
|
|
@@ -63,4 +63,4 @@ function createDisplayResultsTool(itemComponent) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export {
|
|
66
|
+
export { createGroupedResultsTool };
|
package/dist/es/widgets/index.js
CHANGED
|
@@ -27,4 +27,4 @@ export { ToggleRefinement } from './ToggleRefinement.js';
|
|
|
27
27
|
export { TrendingItems } from './TrendingItems.js';
|
|
28
28
|
export { TrendingFacets } from './TrendingFacets.js';
|
|
29
29
|
export { FilterSuggestions } from './FilterSuggestions.js';
|
|
30
|
-
export { DisplayResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
30
|
+
export { DisplayResultsToolType, GroupedResultsToolType, MemorizeToolType, MemorySearchToolType, PonderToolType, RecommendToolType, SearchIndexToolType } from 'instantsearch.js/es/lib/chat/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch 7.49.
|
|
1
|
+
/*! React InstantSearch 7.49.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.49.
|
|
27
|
+
var version$2 = '7.49.1';
|
|
28
28
|
|
|
29
29
|
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
@@ -9392,7 +9392,7 @@
|
|
|
9392
9392
|
});
|
|
9393
9393
|
}
|
|
9394
9394
|
|
|
9395
|
-
var version = '4.
|
|
9395
|
+
var version = '4.117.0';
|
|
9396
9396
|
|
|
9397
9397
|
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
9398
9398
|
function getCookie(name) {
|
|
@@ -15317,7 +15317,7 @@
|
|
|
15317
15317
|
return Promise.resolve();
|
|
15318
15318
|
} : _userProps_regenerate, _userProps_stop = userProps.stop, stop = _userProps_stop === void 0 ? function() {
|
|
15319
15319
|
return Promise.resolve();
|
|
15320
|
-
} : _userProps_stop, _userProps_open = userProps.open, open = _userProps_open === void 0 ? false : _userProps_open, _userProps_maximized = userProps.maximized, maximized = _userProps_maximized === void 0 ? false : _userProps_maximized, setInput = userProps.setInput, userTranslations = userProps.translations, userMessageProps = userProps.userMessageProps, assistantMessageProps = userProps.assistantMessageProps, _userProps_isClearing = userProps.isClearing, isClearing = _userProps_isClearing === void 0 ? false : _userProps_isClearing, onClearTransitionEnd = userProps.onClearTransitionEnd, isScrollAtBottom = userProps.isScrollAtBottom, scrollRef = userProps.scrollRef, contentRef = userProps.contentRef, onScrollToBottom = userProps.onScrollToBottom, suggestionsElement = userProps.suggestionsElement,
|
|
15320
|
+
} : _userProps_stop, _userProps_open = userProps.open, open = _userProps_open === void 0 ? false : _userProps_open, _userProps_maximized = userProps.maximized, maximized = _userProps_maximized === void 0 ? false : _userProps_maximized, setInput = userProps.setInput, userTranslations = userProps.translations, userMessageProps = userProps.userMessageProps, assistantMessageProps = userProps.assistantMessageProps, _userProps_isClearing = userProps.isClearing, isClearing = _userProps_isClearing === void 0 ? false : _userProps_isClearing, onClearTransitionEnd = userProps.onClearTransitionEnd, isScrollAtBottom = userProps.isScrollAtBottom, scrollRef = userProps.scrollRef, contentRef = userProps.contentRef, onScrollToBottom = userProps.onScrollToBottom, suggestionsElement = userProps.suggestionsElement, onFeedback = userProps.onFeedback, feedbackState = userProps.feedbackState, props = _object_without_properties(userProps, [
|
|
15321
15321
|
"classNames",
|
|
15322
15322
|
"messageClassNames",
|
|
15323
15323
|
"messageTranslations",
|
|
@@ -15356,7 +15356,6 @@
|
|
|
15356
15356
|
"contentRef",
|
|
15357
15357
|
"onScrollToBottom",
|
|
15358
15358
|
"suggestionsElement",
|
|
15359
|
-
"suggestionsLoading",
|
|
15360
15359
|
"onFeedback",
|
|
15361
15360
|
"feedbackState"
|
|
15362
15361
|
]);
|
|
@@ -15446,9 +15445,6 @@
|
|
|
15446
15445
|
loaderText: loaderText
|
|
15447
15446
|
}
|
|
15448
15447
|
}) : undefined;
|
|
15449
|
-
// Waits for the answer's text and for the loader to step aside, so two
|
|
15450
|
-
// progress affordances never stack up.
|
|
15451
|
-
var showPendingSuggestions = suggestionsLoading && !showLoader && lastMessage !== undefined && hasTextContent(lastMessage);
|
|
15452
15448
|
return /*#__PURE__*/ createElement("div", _object_spread_props(_object_spread({}, props), {
|
|
15453
15449
|
className: cx(cssClasses.root, props.className),
|
|
15454
15450
|
role: "log",
|
|
@@ -15492,7 +15488,7 @@
|
|
|
15492
15488
|
classNames: messageClassNames,
|
|
15493
15489
|
messageTranslations: messageTranslations,
|
|
15494
15490
|
context: context,
|
|
15495
|
-
suggestionsElement:
|
|
15491
|
+
suggestionsElement: status === 'ready' && message.role === 'assistant' && index === messages.length - 1 ? suggestionsElement : undefined,
|
|
15496
15492
|
loaderElement: isLoaderInline && index === messages.length - 1 ? loaderElement : undefined
|
|
15497
15493
|
});
|
|
15498
15494
|
}), !isLoaderInline && loaderElement, status === 'error' && /*#__PURE__*/ createElement(DefaultError, {
|
|
@@ -15800,31 +15796,23 @@
|
|
|
15800
15796
|
createElement: createElement
|
|
15801
15797
|
});
|
|
15802
15798
|
return function ChatPromptSuggestions(userProps) {
|
|
15803
|
-
var _userProps_suggestions = userProps.suggestions, suggestions = _userProps_suggestions === void 0 ? [] : _userProps_suggestions, onSuggestionClick = userProps.onSuggestionClick,
|
|
15799
|
+
var _userProps_suggestions = userProps.suggestions, suggestions = _userProps_suggestions === void 0 ? [] : _userProps_suggestions, onSuggestionClick = userProps.onSuggestionClick, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
15804
15800
|
var visibleSuggestions = suggestions.filter(function(suggestion) {
|
|
15805
15801
|
return suggestion.trim() !== '';
|
|
15806
15802
|
});
|
|
15807
|
-
if (visibleSuggestions.length === 0
|
|
15803
|
+
if (visibleSuggestions.length === 0) {
|
|
15808
15804
|
return null;
|
|
15809
15805
|
}
|
|
15810
15806
|
return /*#__PURE__*/ createElement("div", {
|
|
15811
15807
|
className: cx('ais-ChatPromptSuggestions', classNames.root)
|
|
15812
|
-
},
|
|
15813
|
-
return /*#__PURE__*/ createElement("div", {
|
|
15814
|
-
key: index,
|
|
15815
|
-
className: cx('ais-ChatPromptSuggestions-skeletonItem', classNames.skeletonItem)
|
|
15816
|
-
});
|
|
15817
|
-
}) : visibleSuggestions.map(function(suggestion, index) {
|
|
15808
|
+
}, visibleSuggestions.map(function(suggestion, index) {
|
|
15818
15809
|
return /*#__PURE__*/ createElement(Button, {
|
|
15819
15810
|
key: index,
|
|
15820
15811
|
size: "sm",
|
|
15821
15812
|
variant: "primary",
|
|
15822
15813
|
className: cx('ais-ChatPromptSuggestions-suggestion', classNames.suggestion),
|
|
15823
|
-
// A half-written suggestion can't be sent. Not `disabled`,
|
|
15824
|
-
// which would restyle the pill mid-stream.
|
|
15825
15814
|
onClick: function onClick() {
|
|
15826
|
-
|
|
15827
|
-
onSuggestionClick(suggestion);
|
|
15815
|
+
return onSuggestionClick(suggestion);
|
|
15828
15816
|
}
|
|
15829
15817
|
}, suggestion);
|
|
15830
15818
|
}));
|
|
@@ -15917,7 +15905,6 @@
|
|
|
15917
15905
|
error: error,
|
|
15918
15906
|
classNames: classNames.messages,
|
|
15919
15907
|
messageClassNames: classNames.message,
|
|
15920
|
-
suggestionsLoading: suggestionsProps.isLoading,
|
|
15921
15908
|
suggestionsElement: createElement(SuggestionsComponent || ChatPromptSuggestions, _object_spread_props(_object_spread({}, suggestionsProps), {
|
|
15922
15909
|
classNames: classNames.suggestions
|
|
15923
15910
|
}))
|
|
@@ -19595,6 +19582,7 @@
|
|
|
19595
19582
|
var MemorySearchToolType = 'algolia_memory_search';
|
|
19596
19583
|
var PonderToolType = 'algolia_ponder';
|
|
19597
19584
|
var DisplayResultsToolType = 'algolia_display_results';
|
|
19585
|
+
var GroupedResultsToolType = 'algolia_grouped_results';
|
|
19598
19586
|
/**
|
|
19599
19587
|
* Whether `toolName` is the search tool as the Algolia MCP Server exposes it:
|
|
19600
19588
|
* one tool per index, named after the index it searches
|
|
@@ -19963,7 +19951,7 @@
|
|
|
19963
19951
|
var hasValidatedEntryPoints = false;
|
|
19964
19952
|
var agentId = 'agentId' in options ? options.agentId : undefined;
|
|
19965
19953
|
// Collected here rather than by the tool that searched: that tool renders
|
|
19966
|
-
// nothing while
|
|
19954
|
+
// nothing while Grouped Results presents its records, and a record has to
|
|
19967
19955
|
// outlive the render that produced it.
|
|
19968
19956
|
var records = createChatRecordsStore();
|
|
19969
19957
|
var collectRecords = function collectRecords() {
|
|
@@ -19995,28 +19983,6 @@
|
|
|
19995
19983
|
var _findSuggestionsPart;
|
|
19996
19984
|
return (_findSuggestionsPart = findSuggestionsPart(findLastAssistantMessage(messages))) === null || _findSuggestionsPart === void 0 ? void 0 : _findSuggestionsPart.data.suggestions;
|
|
19997
19985
|
};
|
|
19998
|
-
// "Still coming" has to be inferred: the turn is running and has no
|
|
19999
|
-
// `data-suggestions` part yet. Expecting any at all needs evidence, or an
|
|
20000
|
-
// agent that never sends them would sit under a placeholder forever.
|
|
20001
|
-
var getSuggestionsStatus = function getSuggestionsStatus(messages) {
|
|
20002
|
-
var _lastAssistantMessage_metadata;
|
|
20003
|
-
var status = _chatInstance.status;
|
|
20004
|
-
if (status !== 'submitted' && status !== 'streaming') {
|
|
20005
|
-
return 'idle';
|
|
20006
|
-
}
|
|
20007
|
-
var lastAssistantMessage = findLastAssistantMessage(messages);
|
|
20008
|
-
if (findSuggestionsPart(lastAssistantMessage)) {
|
|
20009
|
-
return 'idle';
|
|
20010
|
-
}
|
|
20011
|
-
var declaresSuggestions = (lastAssistantMessage === null || lastAssistantMessage === void 0 ? void 0 : (_lastAssistantMessage_metadata = lastAssistantMessage.metadata) === null || _lastAssistantMessage_metadata === void 0 ? void 0 : _lastAssistantMessage_metadata.suggestionsEnabled) === true;
|
|
20012
|
-
if (declaresSuggestions) {
|
|
20013
|
-
return 'loading';
|
|
20014
|
-
}
|
|
20015
|
-
var hasSuggestionsHistory = messages.some(function(message) {
|
|
20016
|
-
return message !== lastAssistantMessage && message.role === 'assistant' && Boolean(findSuggestionsPart(message));
|
|
20017
|
-
});
|
|
20018
|
-
return hasSuggestionsHistory ? 'loading' : 'idle';
|
|
20019
|
-
};
|
|
20020
19986
|
var setMessages = function setMessages(messagesParam) {
|
|
20021
19987
|
if (typeof messagesParam === 'function') {
|
|
20022
19988
|
messagesParam = messagesParam(_chatInstance.messages);
|
|
@@ -20504,7 +20470,6 @@
|
|
|
20504
20470
|
'~isOpenStatePersistenceEnabled': normalizedPersistence.open,
|
|
20505
20471
|
setMessages: setMessages,
|
|
20506
20472
|
suggestions: getSuggestionsFromMessages(_chatInstance.messages),
|
|
20507
|
-
suggestionsStatus: getSuggestionsStatus(_chatInstance.messages),
|
|
20508
20473
|
clearMessages: clearMessages,
|
|
20509
20474
|
tools: toolsWithAddToolResult,
|
|
20510
20475
|
records: records,
|
|
@@ -27043,7 +27008,7 @@
|
|
|
27043
27008
|
createElement: React.createElement
|
|
27044
27009
|
});
|
|
27045
27010
|
|
|
27046
|
-
function
|
|
27011
|
+
function createGroupedResultsTool(itemComponent) {
|
|
27047
27012
|
var DisplayResultsUIComponent = createDisplayResultsToolComponent({
|
|
27048
27013
|
createElement: React.createElement,
|
|
27049
27014
|
Fragment: React.Fragment,
|
|
@@ -27138,14 +27103,14 @@
|
|
|
27138
27103
|
function createDefaultTools(itemComponent, getSearchPageURL) {
|
|
27139
27104
|
var _obj;
|
|
27140
27105
|
return _obj = {}, _define_property(_obj, SearchIndexToolType, _object_spread_props(_object_spread({}, createCarouselTool(true, itemComponent, getSearchPageURL)), {
|
|
27141
|
-
// The agent decides per turn whether the richer
|
|
27106
|
+
// The agent decides per turn whether the richer Grouped Results tool
|
|
27142
27107
|
// takes over the rendering of the search results.
|
|
27143
27108
|
shouldRender: isDisplayResultsDisabled
|
|
27144
|
-
})), _define_property(_obj, RecommendToolType, createCarouselTool(false, itemComponent, getSearchPageURL)), _define_property(_obj, DisplayResultsToolType,
|
|
27109
|
+
})), _define_property(_obj, RecommendToolType, createCarouselTool(false, itemComponent, getSearchPageURL)), _define_property(_obj, DisplayResultsToolType, createGroupedResultsTool(itemComponent)), _define_property(_obj, GroupedResultsToolType, createGroupedResultsTool(itemComponent)), _define_property(_obj, MemorizeToolType, {}), _define_property(_obj, MemorySearchToolType, {}), _define_property(_obj, PonderToolType, {}), _obj;
|
|
27145
27110
|
}
|
|
27146
27111
|
/**
|
|
27147
27112
|
* Whether the search tool renders its own results, i.e. the agent did not hand
|
|
27148
|
-
* the turn to the
|
|
27113
|
+
* the turn to the Grouped Results tool. Set on the message by the backend.
|
|
27149
27114
|
*/ function isDisplayResultsDisabled(param) {
|
|
27150
27115
|
var parentMessage = param.parentMessage;
|
|
27151
27116
|
var _parentMessage_metadata;
|
|
@@ -27276,7 +27241,7 @@
|
|
|
27276
27241
|
tools: tools,
|
|
27277
27242
|
disableTriggerValidation: effectiveDisableTriggerValidation
|
|
27278
27243
|
}));
|
|
27279
|
-
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions,
|
|
27244
|
+
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, clearMessages = chatState.clearMessages, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions, onFeedback = chatState.sendChatMessageFeedback, feedbackState = chatState.feedbackState, consumeInputFocus = chatState['~consumeInputFocus'], isOpenStatePersistenceEnabled = chatState['~isOpenStatePersistenceEnabled'];
|
|
27280
27245
|
var sendMessageAndScrollToBottom = React.useCallback(function() {
|
|
27281
27246
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
27282
27247
|
args[_key] = arguments[_key];
|
|
@@ -27437,7 +27402,6 @@
|
|
|
27437
27402
|
}),
|
|
27438
27403
|
suggestionsProps: {
|
|
27439
27404
|
suggestions: suggestions,
|
|
27440
|
-
isLoading: suggestionsStatus === 'loading',
|
|
27441
27405
|
onSuggestionClick: function onSuggestionClick(suggestion) {
|
|
27442
27406
|
sendMessageAndScrollToBottom({
|
|
27443
27407
|
text: suggestion
|
|
@@ -29387,6 +29351,7 @@
|
|
|
29387
29351
|
exports.Feeds = Feeds;
|
|
29388
29352
|
exports.FilterSuggestions = FilterSuggestions;
|
|
29389
29353
|
exports.FrequentlyBoughtTogether = FrequentlyBoughtTogether;
|
|
29354
|
+
exports.GroupedResultsToolType = GroupedResultsToolType;
|
|
29390
29355
|
exports.HierarchicalMenu = HierarchicalMenu;
|
|
29391
29356
|
exports.Highlight = Highlight;
|
|
29392
29357
|
exports.Hits = Hits;
|