@brainfish-ai/components 0.8.3 → 0.9.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/chat-search.d.ts +9 -1
- package/dist/components/ui/switch.d.ts +2 -2
- package/dist/esm/chunks/{ChatSearch.SKfNDI-w.js → ChatSearch.C05QyX0s.js} +35 -12
- package/dist/esm/chunks/ChatSearch.C05QyX0s.js.map +1 -0
- package/dist/esm/chunks/{FormattedMessage.DPRps9mh.js → FormattedMessage.DkFftNx6.js} +14 -28
- package/dist/esm/chunks/FormattedMessage.DkFftNx6.js.map +1 -0
- package/dist/esm/chunks/{filters.C1glI--f.js → filters.Dx9TXuJ4.js} +3 -4
- package/dist/esm/chunks/{filters.C1glI--f.js.map → filters.Dx9TXuJ4.js.map} +1 -1
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/components/filter.js +1 -1
- package/dist/esm/components/markdown.js +1 -1
- package/dist/esm/components/ui/switch.js +2 -2
- package/dist/esm/components/ui/switch.js.map +1 -1
- package/dist/esm/index.css +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/index.d.ts +9 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
- package/dist/esm/chunks/ChatSearch.SKfNDI-w.js.map +0 -1
- package/dist/esm/chunks/FormattedMessage.DPRps9mh.js.map +0 -1
package/dist/chat-search.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export declare interface Answer {
|
|
|
98
98
|
|
|
99
99
|
declare type AnswerBlock = MarkdownTextBlock | ActionButtonsBlock | ActionInputFormBlock;
|
|
100
100
|
|
|
101
|
-
declare type AnswerListAction = SetAnswers | ClearAll | AppendNewAnswer | SetSearchResults | AppendAnswerChunk | SetAnswerError | SetUserFeedback | ClearUserFeedback | SetFollowUpQuestions | AppendBlock | CompleteAnswer | MarkAsUncertain | InvokeAction | GetActionInputs | AddActionButtons;
|
|
101
|
+
declare type AnswerListAction = SetAnswers | ClearAll | AppendNewAnswer | SetSearchResults | AppendAnswerChunk | SetAnswerError | SetUserFeedback | ClearUserFeedback | SetFollowUpQuestions | AppendBlock | CompleteAnswer | MarkAsUncertain | InvokeAction | GetActionInputs | AddActionButtons | NoArticlesFound;
|
|
102
102
|
|
|
103
103
|
declare const AnswersActions: {
|
|
104
104
|
readonly SET_ANSWERS: "answers/set_answers";
|
|
@@ -113,6 +113,7 @@ declare const AnswersActions: {
|
|
|
113
113
|
readonly SET_USER_FEEDBACK: "answers/set_user_feedback";
|
|
114
114
|
readonly CLEAR_USER_FEEDBACK: "answers/clear_user_feedback";
|
|
115
115
|
readonly MARK_AS_UNCERTAIN: "answers/mark_as_uncertain";
|
|
116
|
+
readonly NO_ARTICLES_FOUND: "answers/no_articles_found";
|
|
116
117
|
readonly GET_ACTION_INPUTS: "answers/request_action_inputs";
|
|
117
118
|
readonly INVOKE_ACTION: "answers/invoke_action";
|
|
118
119
|
readonly ADD_ACTION_BUTTONS: "answers/add_action_buttons";
|
|
@@ -317,6 +318,13 @@ declare enum NextBestActionType {
|
|
|
317
318
|
Function = "function"
|
|
318
319
|
}
|
|
319
320
|
|
|
321
|
+
declare type NoArticlesFound = {
|
|
322
|
+
type: typeof AnswersActions.NO_ARTICLES_FOUND;
|
|
323
|
+
payload: {
|
|
324
|
+
index?: number;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
|
|
320
328
|
/**
|
|
321
329
|
* Defines a URL redirect rule with pattern matching
|
|
322
330
|
* @example { source: '/knowledge/:id/:path', destination: '/knowledge/test/:path' }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as SwitchPrimitives from
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
3
|
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export { Switch };
|
|
@@ -6,7 +6,7 @@ import { XCircle, Check, Copy, CaretDown, ArrowSquareOut, CaretRight, ArrowsVert
|
|
|
6
6
|
import { appendErrors, useForm, Controller } from 'react-hook-form';
|
|
7
7
|
import { validateFieldsNatively, toNestErrors } from '@hookform/resolvers';
|
|
8
8
|
import require$$0 from 'ajv';
|
|
9
|
-
import { g as getDefaultExportFromCjs, F as FormattedMessage } from './FormattedMessage.
|
|
9
|
+
import { g as getDefaultExportFromCjs, F as FormattedMessage } from './FormattedMessage.DkFftNx6.js';
|
|
10
10
|
import { Input } from '../components/ui/input.js';
|
|
11
11
|
import { Label } from '../components/ui/label.js';
|
|
12
12
|
import { Textarea } from '../components/ui/textarea.js';
|
|
@@ -3726,6 +3726,7 @@ const AnswersActions = {
|
|
|
3726
3726
|
SET_USER_FEEDBACK: "answers/set_user_feedback",
|
|
3727
3727
|
CLEAR_USER_FEEDBACK: "answers/clear_user_feedback",
|
|
3728
3728
|
MARK_AS_UNCERTAIN: "answers/mark_as_uncertain",
|
|
3729
|
+
NO_ARTICLES_FOUND: "answers/no_articles_found",
|
|
3729
3730
|
// action flow
|
|
3730
3731
|
GET_ACTION_INPUTS: "answers/request_action_inputs",
|
|
3731
3732
|
INVOKE_ACTION: "answers/invoke_action",
|
|
@@ -3807,6 +3808,12 @@ const invokeAction = ({ index } = {}) => ({
|
|
|
3807
3808
|
index
|
|
3808
3809
|
}
|
|
3809
3810
|
});
|
|
3811
|
+
const noArticlesFound = ({ index } = {}) => ({
|
|
3812
|
+
type: AnswersActions.NO_ARTICLES_FOUND,
|
|
3813
|
+
payload: {
|
|
3814
|
+
index
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3810
3817
|
const getActionInputs = ({
|
|
3811
3818
|
searchIntentId,
|
|
3812
3819
|
actionId,
|
|
@@ -3980,6 +3987,17 @@ const reducer = (draft, action) => {
|
|
|
3980
3987
|
}
|
|
3981
3988
|
return;
|
|
3982
3989
|
}
|
|
3990
|
+
case AnswersActions.NO_ARTICLES_FOUND: {
|
|
3991
|
+
const answer = getTargetAnswer(draft, action.payload.index);
|
|
3992
|
+
const block = answer && getLastTextBlock(answer);
|
|
3993
|
+
if (block && isMarkdownTextBlock(block)) {
|
|
3994
|
+
block.text += "No articles found.";
|
|
3995
|
+
}
|
|
3996
|
+
if (answer) {
|
|
3997
|
+
answer.state = "completed";
|
|
3998
|
+
}
|
|
3999
|
+
return;
|
|
4000
|
+
}
|
|
3983
4001
|
default: {
|
|
3984
4002
|
throw new Error(`Answer List Reducer: unknown action type '${action.type}'`);
|
|
3985
4003
|
}
|
|
@@ -5563,6 +5581,7 @@ const ChatSearchComponent = forwardRef(
|
|
|
5563
5581
|
});
|
|
5564
5582
|
if (searchResponse.results.length === 0) {
|
|
5565
5583
|
trackEvent?.("No Articles Found", { conversationId, searchQuery });
|
|
5584
|
+
return;
|
|
5566
5585
|
}
|
|
5567
5586
|
answerListDispatch(
|
|
5568
5587
|
setSearchResults({
|
|
@@ -5596,16 +5615,20 @@ const ChatSearchComponent = forwardRef(
|
|
|
5596
5615
|
secretAttributes,
|
|
5597
5616
|
allowedRegions
|
|
5598
5617
|
});
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5618
|
+
if (searchQueryId) {
|
|
5619
|
+
event && trackEvent?.(event.name, {
|
|
5620
|
+
conversationId,
|
|
5621
|
+
searchQuery,
|
|
5622
|
+
searchQueryId,
|
|
5623
|
+
...event.metaData
|
|
5624
|
+
});
|
|
5625
|
+
await generateAnswerForQuery({
|
|
5626
|
+
searchQueryId,
|
|
5627
|
+
conversationId
|
|
5628
|
+
});
|
|
5629
|
+
} else {
|
|
5630
|
+
answerListDispatch(noArticlesFound());
|
|
5631
|
+
}
|
|
5609
5632
|
} catch (error) {
|
|
5610
5633
|
console.error("Error generating answer:", error);
|
|
5611
5634
|
event && trackEvent?.(`${event.name} - Search Error`, {
|
|
@@ -5949,4 +5972,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
|
|
|
5949
5972
|
ChatSearch.displayName = "ChatSearch";
|
|
5950
5973
|
|
|
5951
5974
|
export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
|
|
5952
|
-
//# sourceMappingURL=ChatSearch.
|
|
5975
|
+
//# sourceMappingURL=ChatSearch.C05QyX0s.js.map
|