@fencyai/react 0.1.64 → 0.1.66

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.
@@ -20,6 +20,12 @@ export function useCreateFiles(props) {
20
20
  ? { ...fileUpload, textContent: streamData.textContent }
21
21
  : fileUpload));
22
22
  },
23
+ onFileSearchIndexReady: (streamData) => {
24
+ props?.onFileSearchIndexReady?.(streamData);
25
+ setFiles((prev) => prev.map((fileUpload) => fileUpload.id === streamData.fileId
26
+ ? { ...fileUpload, searchIndexReady: true }
27
+ : fileUpload));
28
+ },
23
29
  });
24
30
  const createFile = async (params) => {
25
31
  const clientSecret = params.fetchClientSecret
@@ -23,7 +23,7 @@ export function useListFiles(props) {
23
23
  return {
24
24
  type: 'success',
25
25
  page: {
26
- items: response.files,
26
+ items: response.items,
27
27
  hasNextPage: response.pagination.nextPageToken != null,
28
28
  hasPreviousPage: response.pagination.previousPageToken != null,
29
29
  pagination: response.pagination,
@@ -47,6 +47,9 @@ export const useStream = (props) => {
47
47
  case 'WebsiteTextContentReady':
48
48
  props?.onWebsiteTextContentReady?.(streamData);
49
49
  return true;
50
+ case 'FileSearchIndexReady':
51
+ props?.onFileSearchIndexReady?.(streamData);
52
+ return true;
50
53
  }
51
54
  },
52
55
  });
@@ -34,6 +34,8 @@ const toStreamDataRaw = (data) => {
34
34
  return toWebsiteHtmlContentReady(data);
35
35
  case 'WebsiteTextContentReady':
36
36
  return toWebsiteTextContentReady(data);
37
+ case 'FileSearchIndexReady':
38
+ return toFileSearchIndexReady(data);
37
39
  }
38
40
  return null;
39
41
  };
@@ -104,3 +106,11 @@ const toWebsiteTextContentReady = (data) => {
104
106
  timestamp: data.timestamp,
105
107
  };
106
108
  };
109
+ const toFileSearchIndexReady = (data) => {
110
+ return {
111
+ type: 'FileSearchIndexReady',
112
+ streamId: data.streamId,
113
+ fileId: data.fileId,
114
+ timestamp: data.timestamp,
115
+ };
116
+ };
@@ -1,7 +1,7 @@
1
1
  import { PaginationDto } from '@fencyai/js/lib/openapi';
2
- import { FencyListFile } from '@fencyai/js/lib/types/FencyListFile';
2
+ import { FencyListFileItem } from '@fencyai/js/lib/types/FencyListFileItem';
3
3
  export interface ListFilesPage {
4
- items: FencyListFile[];
4
+ items: FencyListFileItem[];
5
5
  hasNextPage: boolean;
6
6
  hasPreviousPage: boolean;
7
7
  pagination: PaginationDto;
@@ -49,4 +49,10 @@ export type WebsiteTextContentReady = {
49
49
  textContent: string;
50
50
  timestamp: string;
51
51
  };
52
- export type StreamData = NewChatCompletionStreamChunk | ChatCompletionStreamCompleted | StreamTimeout | StreamNotFound | FileUploadCompleted | FileTextContentReady | WebsiteHtmlContentReady | WebsiteTextContentReady;
52
+ export type FileSearchIndexReady = {
53
+ type: 'FileSearchIndexReady';
54
+ streamId: string;
55
+ fileId: string;
56
+ timestamp: string;
57
+ };
58
+ export type StreamData = NewChatCompletionStreamChunk | ChatCompletionStreamCompleted | StreamTimeout | StreamNotFound | FileUploadCompleted | FileTextContentReady | WebsiteHtmlContentReady | WebsiteTextContentReady | FileSearchIndexReady;
@@ -1,5 +1,6 @@
1
- import { FileTextContentReady, FileUploadCompleted } from './StreamData';
1
+ import { FileSearchIndexReady, FileTextContentReady, FileUploadCompleted } from './StreamData';
2
2
  export interface UseCreateFilesProps {
3
3
  onUploadCompleted?: (event: FileUploadCompleted) => void;
4
4
  onTextContentReady?: (event: FileTextContentReady) => void;
5
+ onFileSearchIndexReady?: (event: FileSearchIndexReady) => void;
5
6
  }
@@ -1,4 +1,4 @@
1
- import { ChatCompletionStreamCompleted, NewChatCompletionStreamChunk, StreamNotFound, StreamTimeout, FileUploadCompleted, FileTextContentReady, WebsiteHtmlContentReady, WebsiteTextContentReady } from './StreamData';
1
+ import { ChatCompletionStreamCompleted, NewChatCompletionStreamChunk, StreamNotFound, StreamTimeout, FileUploadCompleted, FileTextContentReady, WebsiteHtmlContentReady, WebsiteTextContentReady, FileSearchIndexReady } from './StreamData';
2
2
  import { StreamError } from './StreamError';
3
3
  export interface UseStreamProps {
4
4
  onNewChatCompletionStreamChunk?: (streamData: NewChatCompletionStreamChunk) => void;
@@ -9,5 +9,6 @@ export interface UseStreamProps {
9
9
  onFileTextContentReady?: (error: FileTextContentReady) => void;
10
10
  onWebsiteHtmlContentReady?: (error: WebsiteHtmlContentReady) => void;
11
11
  onWebsiteTextContentReady?: (error: WebsiteTextContentReady) => void;
12
+ onFileSearchIndexReady?: (error: FileSearchIndexReady) => void;
12
13
  onStreamError?: (error: StreamError) => void;
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fencyai/react",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -34,7 +34,7 @@
34
34
  "prepublishOnly": "npm run build"
35
35
  },
36
36
  "devDependencies": {
37
- "@fencyai/js": "^0.1.64",
37
+ "@fencyai/js": "^0.1.66",
38
38
  "@types/jest": "^29.5.11",
39
39
  "@types/node": "^20.10.5",
40
40
  "@types/react": "^18.2.45",
@@ -43,7 +43,7 @@
43
43
  "typescript": "^5.3.3"
44
44
  },
45
45
  "peerDependencies": {
46
- "@fencyai/js": "^0.1.64",
46
+ "@fencyai/js": "^0.1.66",
47
47
  "react": ">=16.8.0",
48
48
  "zod": "^4.0.5"
49
49
  },
@@ -52,5 +52,5 @@
52
52
  "optional": false
53
53
  }
54
54
  },
55
- "gitHead": "aa579549b3b9b701ccad73d7a8c310ec11787f4e"
55
+ "gitHead": "dc4108844ded9240231f975ae8e0d0c01fdd74b8"
56
56
  }