@brainfish-ai/components 0.16.4 → 0.16.6-rc.2
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/esm/chunks/{ChatSearch.ComXrnDc.js → ChatSearch.aiZX0rXE.js} +26 -13
- package/dist/esm/chunks/ChatSearch.aiZX0rXE.js.map +1 -0
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
- package/dist/esm/chunks/ChatSearch.ComXrnDc.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { motion, AnimatePresence } from 'framer-motion';
|
|
|
3
3
|
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../components/ui/tooltip.js';
|
|
4
4
|
import { Button } from '../components/ui/button.js';
|
|
5
5
|
import { XCircle, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVertical, ArrowDown, Globe, LockSimple, MagnifyingGlass, X, Image, ArrowRight, ArrowLeft, ArrowsInSimple, ArrowsOutSimple } from '@phosphor-icons/react';
|
|
6
|
-
import { F as FormattedMessage, c as addPopupWidgetUtm } from './FormattedMessage.DdZqirSo.js';
|
|
6
|
+
import { F as FormattedMessage, c as addPopupWidgetUtm, M as MemoizedReactMarkdown } from './FormattedMessage.DdZqirSo.js';
|
|
7
7
|
import { appendErrors, useForm, Controller } from 'react-hook-form';
|
|
8
8
|
import { validateFieldsNatively, toNestErrors } from '@hookform/resolvers';
|
|
9
9
|
import require$$0 from 'ajv';
|
|
@@ -4041,6 +4041,17 @@ const getActionMapping = (action) => {
|
|
|
4041
4041
|
icon: "Link",
|
|
4042
4042
|
getValue: (a) => a.action?.options?.url || a.id,
|
|
4043
4043
|
getLabel: (a) => a.action?.options?.title || a.type
|
|
4044
|
+
},
|
|
4045
|
+
[ActionType.RunCallback]: {
|
|
4046
|
+
type: NextBestActionType.Callback,
|
|
4047
|
+
icon: "Sparkle",
|
|
4048
|
+
getValue: (a) => {
|
|
4049
|
+
return JSON.stringify({
|
|
4050
|
+
actionId: a.id,
|
|
4051
|
+
searchIntentId: a.searchIntentId
|
|
4052
|
+
});
|
|
4053
|
+
},
|
|
4054
|
+
getLabel: (a) => a.action?.options?.title || "Run Action"
|
|
4044
4055
|
}
|
|
4045
4056
|
};
|
|
4046
4057
|
const mapping = actionMapping[action.type] || {
|
|
@@ -4058,6 +4069,7 @@ const AnswerActions = ({
|
|
|
4058
4069
|
isLastAnswer,
|
|
4059
4070
|
handleActionClick,
|
|
4060
4071
|
searchQueryId,
|
|
4072
|
+
searchIntentId,
|
|
4061
4073
|
question,
|
|
4062
4074
|
answer
|
|
4063
4075
|
}) => {
|
|
@@ -4070,13 +4082,17 @@ const AnswerActions = ({
|
|
|
4070
4082
|
let mappedActions = [];
|
|
4071
4083
|
if (hasActions) {
|
|
4072
4084
|
mappedActions = actions.map((action) => {
|
|
4073
|
-
const
|
|
4085
|
+
const actionWithIntent = {
|
|
4086
|
+
...action,
|
|
4087
|
+
searchIntentId
|
|
4088
|
+
};
|
|
4089
|
+
const mapping = getActionMapping(actionWithIntent);
|
|
4074
4090
|
return {
|
|
4075
4091
|
id: action.id,
|
|
4076
|
-
label: mapping.getLabel(
|
|
4092
|
+
label: mapping.getLabel(actionWithIntent),
|
|
4077
4093
|
type: mapping.type,
|
|
4078
4094
|
icon: mapping.icon,
|
|
4079
|
-
value: mapping.getValue(
|
|
4095
|
+
value: mapping.getValue(actionWithIntent)
|
|
4080
4096
|
};
|
|
4081
4097
|
});
|
|
4082
4098
|
}
|
|
@@ -4490,6 +4506,7 @@ function Answer({
|
|
|
4490
4506
|
searchResults,
|
|
4491
4507
|
state = "completed",
|
|
4492
4508
|
searchQueryId,
|
|
4509
|
+
searchIntentId,
|
|
4493
4510
|
feedback,
|
|
4494
4511
|
onFeedback,
|
|
4495
4512
|
disableFeedback = false,
|
|
@@ -4554,6 +4571,7 @@ function Answer({
|
|
|
4554
4571
|
isLastAnswer,
|
|
4555
4572
|
handleActionClick,
|
|
4556
4573
|
searchQueryId: searchQueryId || "",
|
|
4574
|
+
searchIntentId,
|
|
4557
4575
|
question,
|
|
4558
4576
|
answer
|
|
4559
4577
|
}
|
|
@@ -5483,11 +5501,7 @@ const ChatSearchComponent = forwardRef(
|
|
|
5483
5501
|
headers,
|
|
5484
5502
|
mergedTextConfig
|
|
5485
5503
|
});
|
|
5486
|
-
const { scrollToLastAnswer, scrollToAnswer
|
|
5487
|
-
answerRefs,
|
|
5488
|
-
containerRef,
|
|
5489
|
-
bottomRef
|
|
5490
|
-
);
|
|
5504
|
+
const { scrollToLastAnswer, scrollToAnswer } = useScrollManager(answerRefs, containerRef, bottomRef);
|
|
5491
5505
|
const { subscribeToStateChanges } = useSubscriptionManager();
|
|
5492
5506
|
const loadFollowUpQuestions = async (searchQueryId, conversationId) => {
|
|
5493
5507
|
if (!followUpQuestionsEndpoint || disableFollowUpQuestions) {
|
|
@@ -5524,7 +5538,6 @@ const ChatSearchComponent = forwardRef(
|
|
|
5524
5538
|
for (const line of lines) {
|
|
5525
5539
|
try {
|
|
5526
5540
|
if (line === "[DONE]") {
|
|
5527
|
-
scrollToBottom();
|
|
5528
5541
|
continue;
|
|
5529
5542
|
}
|
|
5530
5543
|
const event = JSON.parse(line);
|
|
@@ -5535,7 +5548,6 @@ const ChatSearchComponent = forwardRef(
|
|
|
5535
5548
|
text: event.content
|
|
5536
5549
|
})
|
|
5537
5550
|
);
|
|
5538
|
-
scrollToBottom();
|
|
5539
5551
|
const uncertaintyCheck = isAnswerUncertain(accumulatedAnswer);
|
|
5540
5552
|
isUncertain = uncertaintyCheck.uncertain;
|
|
5541
5553
|
if (isUncertain) {
|
|
@@ -6091,6 +6103,7 @@ const ChatSearchComponent = forwardRef(
|
|
|
6091
6103
|
state: answer.state,
|
|
6092
6104
|
searchResults: answer.searchResults,
|
|
6093
6105
|
searchQueryId: answer.searchQueryId,
|
|
6106
|
+
searchIntentId: answer.searchIntentId,
|
|
6094
6107
|
feedback: answer.feedback,
|
|
6095
6108
|
onFeedback: (response) => void handleFeedback(response, answer.searchQueryId, i),
|
|
6096
6109
|
disableFeedback,
|
|
@@ -6122,7 +6135,7 @@ const ChatSearchComponent = forwardRef(
|
|
|
6122
6135
|
},
|
|
6123
6136
|
offset
|
|
6124
6137
|
}
|
|
6125
|
-
)), disclaimer && isWidgetMode && !(showResults && showFollowUp) && /* @__PURE__ */ React__default.createElement("div", { className: "mt-2 px-3 @3xl:px-0 text-xs text-dark-500 flex items-center gap-1 absolute bottom-12 justify-center text-center w-full" }, /* @__PURE__ */ React__default.createElement(MemoizedIcon, { iconName: "Info", className: "size-4" }), disclaimer), /* @__PURE__ */ React__default.createElement("div", { ref: bottomRef })),
|
|
6138
|
+
)), disclaimer && isWidgetMode && !(showResults && showFollowUp) && /* @__PURE__ */ React__default.createElement("div", { "data-name": "disclaimer", className: "mt-2 px-3 @3xl:px-0 text-xs text-dark-500 dark:text-dark-400 flex items-center gap-1 absolute bottom-12 justify-center text-center w-full md:static md:mt-4 md:text-left md:flex md:gap-4 leading-5" }, /* @__PURE__ */ React__default.createElement(MemoizedIcon, { iconName: "Info", className: "size-4" }), /* @__PURE__ */ React__default.createElement(MemoizedReactMarkdown, { className: "[&_a]:underline [&_a:hover]:no-underline" }, disclaimer)), /* @__PURE__ */ React__default.createElement("div", { ref: bottomRef })),
|
|
6126
6139
|
showResults && showFollowUp && /* @__PURE__ */ React__default.createElement(
|
|
6127
6140
|
FollowUpSearchBar,
|
|
6128
6141
|
{
|
|
@@ -6143,4 +6156,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
|
|
|
6143
6156
|
ChatSearch.displayName = "ChatSearch";
|
|
6144
6157
|
|
|
6145
6158
|
export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
|
|
6146
|
-
//# sourceMappingURL=ChatSearch.
|
|
6159
|
+
//# sourceMappingURL=ChatSearch.aiZX0rXE.js.map
|