@brainfish-ai/components 0.18.6 → 0.18.8
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/chat-search.d.ts +1 -0
- package/dist/esm/chunks/{ChatSearch.DSB-T76c.js → ChatSearch.DCnEmHuh.js} +51 -17
- package/dist/esm/chunks/ChatSearch.DCnEmHuh.js.map +1 -0
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/components/convos.js +1 -1
- package/dist/esm/components/convos.js.map +1 -1
- package/dist/esm/global.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/stats.html +1 -1
- package/package.json +1 -1
- package/dist/esm/chunks/ChatSearch.DSB-T76c.js.map +0 -1
package/dist/chat-search.d.ts
CHANGED
|
@@ -3677,7 +3677,9 @@ const reducer = (draft, action) => {
|
|
|
3677
3677
|
const answer = getTargetAnswer(draft, action.payload.index ?? -1);
|
|
3678
3678
|
const block = answer && getLastTextBlock(answer);
|
|
3679
3679
|
if (block && isMarkdownTextBlock(block)) {
|
|
3680
|
-
block.text
|
|
3680
|
+
block.text = action.payload.error;
|
|
3681
|
+
answer.state = "completed";
|
|
3682
|
+
answer.hasError = true;
|
|
3681
3683
|
}
|
|
3682
3684
|
return;
|
|
3683
3685
|
}
|
|
@@ -3691,7 +3693,8 @@ const reducer = (draft, action) => {
|
|
|
3691
3693
|
case AnswersActions.COMPLETE_ANSWER: {
|
|
3692
3694
|
const answer = getTargetAnswer(draft, action.payload.index);
|
|
3693
3695
|
if (answer) {
|
|
3694
|
-
|
|
3696
|
+
const shouldComplete = answer.state === "streaming" || answer.state === "fetching-search-results" || answer.state === "fetching-stream";
|
|
3697
|
+
if (shouldComplete) {
|
|
3695
3698
|
answer.state = "completed";
|
|
3696
3699
|
}
|
|
3697
3700
|
}
|
|
@@ -4447,7 +4450,9 @@ const useConversationLoader = ({ loadConversationEndpoint, headers, mergedTextCo
|
|
|
4447
4450
|
answerListDispatch(clearAll());
|
|
4448
4451
|
clearConversationId();
|
|
4449
4452
|
setShowResults(false);
|
|
4450
|
-
setLoadError(
|
|
4453
|
+
setLoadError(
|
|
4454
|
+
mergedTextConfig.errorText || "Sorry, we were unable to process the request right now. Please try again in a moment."
|
|
4455
|
+
);
|
|
4451
4456
|
}).finally(() => {
|
|
4452
4457
|
setIsLoadingConversation(false);
|
|
4453
4458
|
});
|
|
@@ -4648,7 +4653,8 @@ function Answer({
|
|
|
4648
4653
|
handleActionClick,
|
|
4649
4654
|
nextBestActions,
|
|
4650
4655
|
isLastAnswer,
|
|
4651
|
-
onFeedbackReasonSubmit
|
|
4656
|
+
onFeedbackReasonSubmit,
|
|
4657
|
+
hasError = false
|
|
4652
4658
|
}) {
|
|
4653
4659
|
const [isCopied, setIsCopied] = useState(false);
|
|
4654
4660
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
@@ -4658,6 +4664,7 @@ function Answer({
|
|
|
4658
4664
|
const isFetchingSearchResults = state === "fetching-search-results";
|
|
4659
4665
|
const isIdle = state === "getting-action-inputs" || state === "completed";
|
|
4660
4666
|
const isCompleted = state === "completed";
|
|
4667
|
+
const showError = hasError && isCompleted;
|
|
4661
4668
|
const handleCopy = async () => {
|
|
4662
4669
|
try {
|
|
4663
4670
|
await navigator.clipboard.writeText(answer);
|
|
@@ -4692,10 +4699,20 @@ function Answer({
|
|
|
4692
4699
|
"data-name": "SearchResults",
|
|
4693
4700
|
"data-index": index
|
|
4694
4701
|
},
|
|
4695
|
-
/* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-4 pb-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start justify-between gap-2 min-h-9" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ React__default.createElement(GeneratingStar, { loading: !isIdle }), /* @__PURE__ */ React__default.createElement("h2", { className: "leading-normal font-semibold m-0 text-foreground self-center text-lg" }, question)), isCompleted && /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button, { variant: "ghost", size: "icon", onClick: () => void handleCopy(), className: "-mt-1 flex-shrink-0" }, isCopied ? /* @__PURE__ */ React__default.createElement(Check, { className: "text-feedback-positive", weight: "bold" }) : /* @__PURE__ */ React__default.createElement(Copy, { className: "text-secondary-foreground", weight: "bold" }))), /* @__PURE__ */ React__default.createElement(TooltipContent, null, /* @__PURE__ */ React__default.createElement("p", null, isCopied ? "Copied!" : "Copy")))))),
|
|
4696
|
-
isFetchingInitialAnswer && /* @__PURE__ */ React__default.createElement("div", { className: "
|
|
4697
|
-
/* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col" }, blocks?.map((block, i) => /* @__PURE__ */ React__default.createElement(
|
|
4698
|
-
|
|
4702
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-4 pb-2" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex items-start justify-between gap-2 min-h-9" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ React__default.createElement(GeneratingStar, { loading: !isIdle }), /* @__PURE__ */ React__default.createElement("h2", { className: "leading-normal font-semibold m-0 text-foreground self-center text-lg" }, question)), isCompleted && !showError && /* @__PURE__ */ React__default.createElement(TooltipProvider, null, /* @__PURE__ */ React__default.createElement(Tooltip, null, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(Button, { variant: "ghost", size: "icon", onClick: () => void handleCopy(), className: "-mt-1 flex-shrink-0" }, isCopied ? /* @__PURE__ */ React__default.createElement(Check, { className: "text-feedback-positive", weight: "bold" }) : /* @__PURE__ */ React__default.createElement(Copy, { className: "text-secondary-foreground", weight: "bold" }))), /* @__PURE__ */ React__default.createElement(TooltipContent, null, /* @__PURE__ */ React__default.createElement("p", null, isCopied ? "Copied!" : "Copy")))))),
|
|
4703
|
+
isFetchingInitialAnswer && /* @__PURE__ */ React__default.createElement("div", { className: "px-4 pt-0 pb-2" }, /* @__PURE__ */ React__default.createElement("p", { className: "text-sm text-muted-foreground" }, isFetchingSearchResults ? textConfig.loadingSearchText : textConfig.loadingAnswerText)),
|
|
4704
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col" }, blocks?.map((block, i) => /* @__PURE__ */ React__default.createElement(
|
|
4705
|
+
"div",
|
|
4706
|
+
{
|
|
4707
|
+
key: i,
|
|
4708
|
+
className: cn(
|
|
4709
|
+
"px-4 pt-0 pb-2 border-b last:border-b-0 border-dashed",
|
|
4710
|
+
showError && "text-muted-foreground"
|
|
4711
|
+
)
|
|
4712
|
+
},
|
|
4713
|
+
/* @__PURE__ */ React__default.createElement(AnswerBlock, { block, redirectRules, state })
|
|
4714
|
+
))),
|
|
4715
|
+
isCompleted && !showError && /* @__PURE__ */ React__default.createElement(
|
|
4699
4716
|
AnswerActions,
|
|
4700
4717
|
{
|
|
4701
4718
|
actions,
|
|
@@ -4708,7 +4725,7 @@ function Answer({
|
|
|
4708
4725
|
answer
|
|
4709
4726
|
}
|
|
4710
4727
|
),
|
|
4711
|
-
isCompleted && !disableFeedback && /* @__PURE__ */ React__default.createElement("div", { className: "p-4 pt-0" }, /* @__PURE__ */ React__default.createElement(
|
|
4728
|
+
isCompleted && !disableFeedback && !showError && /* @__PURE__ */ React__default.createElement("div", { className: "p-4 pt-0" }, /* @__PURE__ */ React__default.createElement(
|
|
4712
4729
|
Feedback,
|
|
4713
4730
|
{
|
|
4714
4731
|
feedback,
|
|
@@ -5449,7 +5466,7 @@ const defaultTextConfig = {
|
|
|
5449
5466
|
allDocumentsText: "All documents",
|
|
5450
5467
|
loadingSearchText: "Searching for relevant content...",
|
|
5451
5468
|
loadingAnswerText: "Crafting a response...",
|
|
5452
|
-
errorText: "Sorry,
|
|
5469
|
+
errorText: "Sorry, we were unable to process the request right now. Please try again in a moment.",
|
|
5453
5470
|
followUpPlaceholder: "Type your response or follow-up",
|
|
5454
5471
|
positiveAnswerText: "Helpful",
|
|
5455
5472
|
negativeAnswerText: "Not helpful",
|
|
@@ -5863,7 +5880,11 @@ const ChatSearchComponent = forwardRef(
|
|
|
5863
5880
|
}
|
|
5864
5881
|
} catch (e) {
|
|
5865
5882
|
console.error("Error generating answer for query:", e);
|
|
5866
|
-
answerListDispatch(
|
|
5883
|
+
answerListDispatch(
|
|
5884
|
+
setAnswerError({
|
|
5885
|
+
error: mergedTextConfig.errorText || "Sorry, we were unable to process the request right now. Please try again in a moment."
|
|
5886
|
+
})
|
|
5887
|
+
);
|
|
5867
5888
|
} finally {
|
|
5868
5889
|
answerListDispatch(completeAnswer());
|
|
5869
5890
|
}
|
|
@@ -5898,7 +5919,11 @@ const ChatSearchComponent = forwardRef(
|
|
|
5898
5919
|
});
|
|
5899
5920
|
} catch (e) {
|
|
5900
5921
|
console.error("Error generating answer for action:", e);
|
|
5901
|
-
answerListDispatch(
|
|
5922
|
+
answerListDispatch(
|
|
5923
|
+
setAnswerError({
|
|
5924
|
+
error: mergedTextConfig.errorText || "Sorry, we were unable to process the request right now. Please try again in a moment."
|
|
5925
|
+
})
|
|
5926
|
+
);
|
|
5902
5927
|
} finally {
|
|
5903
5928
|
answerListDispatch(completeAnswer());
|
|
5904
5929
|
setIsSearching(false);
|
|
@@ -5934,7 +5959,11 @@ const ChatSearchComponent = forwardRef(
|
|
|
5934
5959
|
});
|
|
5935
5960
|
} catch (e) {
|
|
5936
5961
|
console.error("Error generating answer for action:", e);
|
|
5937
|
-
answerListDispatch(
|
|
5962
|
+
answerListDispatch(
|
|
5963
|
+
setAnswerError({
|
|
5964
|
+
error: mergedTextConfig.errorText || "Sorry, we were unable to process the request right now. Please try again in a moment."
|
|
5965
|
+
})
|
|
5966
|
+
);
|
|
5938
5967
|
} finally {
|
|
5939
5968
|
answerListDispatch(completeAnswer());
|
|
5940
5969
|
setIsSearching(false);
|
|
@@ -6017,7 +6046,11 @@ const ChatSearchComponent = forwardRef(
|
|
|
6017
6046
|
searchQuery,
|
|
6018
6047
|
...event.metaData
|
|
6019
6048
|
});
|
|
6020
|
-
answerListDispatch(
|
|
6049
|
+
answerListDispatch(
|
|
6050
|
+
setAnswerError({
|
|
6051
|
+
error: mergedTextConfig.errorText || "Sorry, we were unable to process the request right now. Please try again in a moment."
|
|
6052
|
+
})
|
|
6053
|
+
);
|
|
6021
6054
|
} finally {
|
|
6022
6055
|
setIsSearching(false);
|
|
6023
6056
|
}
|
|
@@ -6412,10 +6445,11 @@ const ChatSearchComponent = forwardRef(
|
|
|
6412
6445
|
actions: answer.actions,
|
|
6413
6446
|
handleActionClick: handleNextBestActionClick,
|
|
6414
6447
|
isLastAnswer: i === answers.length - 1,
|
|
6415
|
-
onFeedbackReasonSubmit: (reason) => void handleFeedbackReasonSubmit(reason, answer.searchQueryId)
|
|
6448
|
+
onFeedbackReasonSubmit: (reason) => void handleFeedbackReasonSubmit(reason, answer.searchQueryId),
|
|
6449
|
+
hasError: answer.hasError
|
|
6416
6450
|
}
|
|
6417
6451
|
),
|
|
6418
|
-
i === answers.length - 1 && !disableFollowUpQuestions && answer.followUpQuestions && answer.state === "completed" && /* @__PURE__ */ React__default.createElement(
|
|
6452
|
+
i === answers.length - 1 && !disableFollowUpQuestions && answer.followUpQuestions && answer.state === "completed" && !answer.hasError && /* @__PURE__ */ React__default.createElement(
|
|
6419
6453
|
FollowUpQuestions,
|
|
6420
6454
|
{
|
|
6421
6455
|
questions: answer.followUpQuestions,
|
|
@@ -6479,4 +6513,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
|
|
|
6479
6513
|
ChatSearch.displayName = "ChatSearch";
|
|
6480
6514
|
|
|
6481
6515
|
export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
|
|
6482
|
-
//# sourceMappingURL=ChatSearch.
|
|
6516
|
+
//# sourceMappingURL=ChatSearch.DCnEmHuh.js.map
|