@brainfish-ai/components 0.13.4 → 0.13.6

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.
@@ -369,6 +369,7 @@ declare type SetSearchResults = {
369
369
  searchQueryId: string;
370
370
  results: SearchResult[];
371
371
  index?: number;
372
+ state?: Answer['state'];
372
373
  };
373
374
  };
374
375
 
@@ -1,3 +1,8 @@
1
- import * as React from "react";
2
- declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
1
+ import { default as React } from 'react';
2
+ import { Icon } from '@phosphor-icons/react';
3
+ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
4
+ startIcon?: Icon;
5
+ endIcon?: Icon;
6
+ }
7
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
3
8
  export { Input };
@@ -3735,13 +3735,15 @@ const appendNewAnswer = ({ id, query }) => ({
3735
3735
  const setSearchResults = ({
3736
3736
  searchQueryId,
3737
3737
  results,
3738
- index
3738
+ index,
3739
+ state
3739
3740
  }) => ({
3740
3741
  type: AnswersActions.SET_SEARCH_RESULTS,
3741
3742
  payload: {
3742
3743
  searchQueryId,
3743
3744
  results,
3744
- index
3745
+ index,
3746
+ state
3745
3747
  }
3746
3748
  });
3747
3749
  const appendAnswerChunk = ({ text, index }) => ({
@@ -3870,7 +3872,7 @@ const reducer = (draft, action) => {
3870
3872
  if (answer) {
3871
3873
  answer.searchQueryId = action.payload.searchQueryId;
3872
3874
  answer.searchResults = action.payload.results;
3873
- answer.state = "fetching-stream";
3875
+ answer.state = action.payload.state || "fetching-stream";
3874
3876
  }
3875
3877
  return;
3876
3878
  }
@@ -4256,7 +4258,8 @@ async function searchApi({
4256
4258
  });
4257
4259
  return {
4258
4260
  results: payload?.data,
4259
- searchQueryId: payload?.searchQuery?.id
4261
+ searchQueryId: payload?.searchQuery?.id,
4262
+ isAgenticResponse: payload?.isAgenticResponse
4260
4263
  };
4261
4264
  }
4262
4265
  async function fetchAnswerStream({
@@ -5431,6 +5434,15 @@ const ChatSearchComponent = forwardRef(
5431
5434
  })
5432
5435
  );
5433
5436
  }
5437
+ if (event.type === "citations") {
5438
+ answerListDispatch(
5439
+ setSearchResults({
5440
+ searchQueryId,
5441
+ results: event.data,
5442
+ state: "completed"
5443
+ })
5444
+ );
5445
+ }
5434
5446
  } catch {
5435
5447
  console.warn("Failed to parse answer stream block");
5436
5448
  }
@@ -5571,7 +5583,7 @@ const ChatSearchComponent = forwardRef(
5571
5583
  secretAttributes: secretAttributes2,
5572
5584
  allowedRegions: allowedRegions2
5573
5585
  });
5574
- if (searchResponse.results.length === 0) {
5586
+ if (searchResponse.results.length === 0 && !searchResponse.isAgenticResponse) {
5575
5587
  trackEvent?.("No Articles Found", { conversationId, searchQuery });
5576
5588
  return;
5577
5589
  }
@@ -5964,4 +5976,4 @@ const ChatSearch = forwardRef(({ featureFlags, ...props }, ref) => /* @__PURE__
5964
5976
  ChatSearch.displayName = "ChatSearch";
5965
5977
 
5966
5978
  export { ChatSearch as C, ChatSearchProvider as a, useIsChatSearchDirty as b, useChatSearch as u };
5967
- //# sourceMappingURL=ChatSearch.BsztdMaK.js.map
5979
+ //# sourceMappingURL=ChatSearch.D_zJGwAf.js.map