@sinequa/assistant 3.7.7 → 3.9.0

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.
Files changed (149) hide show
  1. package/chat/charts/chart/chart.component.d.ts +13 -13
  2. package/chat/chat-message/chat-message.component.d.ts +85 -81
  3. package/chat/chat-message/i18n/en.json +11 -0
  4. package/chat/chat-message/i18n/fr.json +11 -0
  5. package/chat/chat-reference/chat-reference.component.d.ts +14 -14
  6. package/chat/chat-reference/i18n/en.json +4 -0
  7. package/chat/chat-reference/i18n/fr.json +4 -0
  8. package/chat/chat-settings-v3/chat-settings-v3.component.d.ts +48 -49
  9. package/chat/chat-settings-v3/i18n/en.json +14 -0
  10. package/chat/chat-settings-v3/i18n/fr.json +14 -0
  11. package/chat/chat.component.d.ts +388 -1410
  12. package/chat/chat.service.d.ts +247 -228
  13. package/chat/debug-message/debug-message.component.d.ts +17 -17
  14. package/chat/debug-message/i18n/en.json +3 -0
  15. package/chat/debug-message/i18n/fr.json +3 -0
  16. package/chat/dialogs/delete-saved-chat.component.d.ts +22 -0
  17. package/chat/dialogs/i18n/en.json +19 -0
  18. package/chat/dialogs/i18n/fr.json +19 -0
  19. package/chat/dialogs/rename-saved-chat.component.d.ts +21 -0
  20. package/chat/dialogs/updates.component.d.ts +15 -0
  21. package/chat/documents-upload/document-list/document-list.component.d.ts +68 -0
  22. package/chat/documents-upload/document-overview/document-overview.component.d.ts +31 -0
  23. package/chat/documents-upload/document-upload/document-upload.component.d.ts +96 -0
  24. package/chat/documents-upload/documents-upload.model.d.ts +66 -0
  25. package/chat/documents-upload/documents-upload.service.d.ts +170 -0
  26. package/chat/documents-upload/i18n/en.json +24 -0
  27. package/chat/documents-upload/i18n/fr.json +24 -0
  28. package/chat/format-icon/format-icon.component.d.ts +10 -10
  29. package/chat/format-icon/icons.d.ts +5 -5
  30. package/chat/i18n/en.json +42 -0
  31. package/chat/i18n/fr.json +42 -0
  32. package/chat/index.d.ts +5 -5
  33. package/chat/initials-avatar/initials-avatar.component.d.ts +35 -35
  34. package/chat/instance-manager.service.d.ts +28 -28
  35. package/chat/pipes/message-content.pipe.d.ts +16 -0
  36. package/chat/prompt.component.d.ts +25 -21
  37. package/chat/public-api.d.ts +17 -12
  38. package/chat/references/i18n/en.json +6 -0
  39. package/chat/references/i18n/fr.json +6 -0
  40. package/chat/references/inline-image-reference.d.ts +21 -0
  41. package/chat/references/inline-page-reference.d.ts +21 -0
  42. package/chat/rest-chat.service.d.ts +31 -33
  43. package/chat/saved-chats/i18n/en.json +4 -0
  44. package/chat/saved-chats/i18n/fr.json +4 -0
  45. package/chat/saved-chats/saved-chats.component.d.ts +30 -36
  46. package/chat/services/app.service.d.ts +8 -0
  47. package/chat/services/dialog.service.d.ts +12 -0
  48. package/chat/services/notification.service.d.ts +10 -0
  49. package/chat/services/principal.service.d.ts +7 -0
  50. package/chat/services/search.service.d.ts +7 -0
  51. package/chat/services/signalR.web.service.d.ts +45 -0
  52. package/chat/services/ui.service.d.ts +13 -0
  53. package/chat/services/user-settings.service.d.ts +7 -0
  54. package/chat/styles/assistant.scss +2 -0
  55. package/chat/token-progress-bar/i18n/en.json +4 -0
  56. package/chat/token-progress-bar/i18n/fr.json +4 -0
  57. package/chat/token-progress-bar/token-progress-bar.component.d.ts +24 -27
  58. package/chat/tooltip/tooltip.component.d.ts +12 -0
  59. package/chat/tooltip/tooltip.directive.d.ts +81 -0
  60. package/chat/types/message-content.types.d.ts +54 -0
  61. package/chat/types/message-reference.types.d.ts +11 -0
  62. package/chat/types.d.ts +913 -817
  63. package/chat/unified-plugins/embedded-image-reference.plugin.d.ts +3 -0
  64. package/chat/unified-plugins/embedded-page-reference.plugin.d.ts +3 -0
  65. package/chat/utils/assistant-json.d.ts +2 -0
  66. package/chat/websocket-chat.service.d.ts +102 -103
  67. package/esm2022/chat/charts/chart/chart.component.mjs +40 -0
  68. package/esm2022/chat/chat-message/chat-message.component.mjs +351 -0
  69. package/esm2022/chat/chat-reference/chat-reference.component.mjs +40 -0
  70. package/esm2022/chat/chat-settings-v3/chat-settings-v3.component.mjs +118 -0
  71. package/esm2022/chat/chat.component.mjs +1090 -0
  72. package/esm2022/chat/chat.service.mjs +417 -0
  73. package/esm2022/chat/debug-message/debug-message.component.mjs +43 -0
  74. package/esm2022/chat/dialogs/delete-saved-chat.component.mjs +81 -0
  75. package/esm2022/chat/dialogs/rename-saved-chat.component.mjs +84 -0
  76. package/esm2022/chat/dialogs/updates.component.mjs +61 -0
  77. package/esm2022/chat/documents-upload/document-list/document-list.component.mjs +140 -0
  78. package/esm2022/chat/documents-upload/document-overview/document-overview.component.mjs +65 -0
  79. package/esm2022/chat/documents-upload/document-upload/document-upload.component.mjs +256 -0
  80. package/esm2022/chat/documents-upload/documents-upload.model.mjs +2 -0
  81. package/esm2022/chat/documents-upload/documents-upload.service.mjs +291 -0
  82. package/{esm2020 → esm2022}/chat/format-icon/format-icon.component.mjs +23 -23
  83. package/{esm2020 → esm2022}/chat/format-icon/icons.mjs +137 -137
  84. package/{esm2020 → esm2022}/chat/initials-avatar/initials-avatar.component.mjs +60 -60
  85. package/esm2022/chat/instance-manager.service.mjs +46 -0
  86. package/esm2022/chat/pipes/message-content.pipe.mjs +34 -0
  87. package/esm2022/chat/prompt.component.mjs +88 -0
  88. package/esm2022/chat/public-api.mjs +18 -0
  89. package/esm2022/chat/references/inline-image-reference.mjs +110 -0
  90. package/esm2022/chat/references/inline-page-reference.mjs +110 -0
  91. package/esm2022/chat/rest-chat.service.mjs +296 -0
  92. package/esm2022/chat/saved-chats/saved-chats.component.mjs +82 -0
  93. package/esm2022/chat/services/app.service.mjs +19 -0
  94. package/esm2022/chat/services/dialog.service.mjs +40 -0
  95. package/esm2022/chat/services/notification.service.mjs +25 -0
  96. package/esm2022/chat/services/principal.service.mjs +16 -0
  97. package/esm2022/chat/services/search.service.mjs +13 -0
  98. package/esm2022/chat/services/signalR.web.service.mjs +79 -0
  99. package/esm2022/chat/services/ui.service.mjs +61 -0
  100. package/esm2022/chat/services/user-settings.service.mjs +22 -0
  101. package/{esm2020 → esm2022}/chat/sinequa-assistant-chat.mjs +4 -4
  102. package/esm2022/chat/token-progress-bar/token-progress-bar.component.mjs +52 -0
  103. package/esm2022/chat/tooltip/tooltip.component.mjs +44 -0
  104. package/esm2022/chat/tooltip/tooltip.directive.mjs +203 -0
  105. package/esm2022/chat/types/message-content.types.mjs +2 -0
  106. package/esm2022/chat/types/message-reference.types.mjs +2 -0
  107. package/esm2022/chat/types.mjs +130 -0
  108. package/esm2022/chat/unified-plugins/embedded-image-reference.plugin.mjs +57 -0
  109. package/esm2022/chat/unified-plugins/embedded-page-reference.plugin.mjs +57 -0
  110. package/esm2022/chat/utils/assistant-json.mjs +12 -0
  111. package/esm2022/chat/websocket-chat.service.mjs +654 -0
  112. package/{esm2020 → esm2022}/public-api.mjs +2 -2
  113. package/{esm2020 → esm2022}/sinequa-assistant.mjs +4 -4
  114. package/fesm2022/sinequa-assistant-chat.mjs +5340 -0
  115. package/fesm2022/sinequa-assistant-chat.mjs.map +1 -0
  116. package/{fesm2015 → fesm2022}/sinequa-assistant.mjs +3 -3
  117. package/index.d.ts +5 -5
  118. package/package.json +51 -22
  119. package/public-api.d.ts +1 -1
  120. package/chat/messages/de.d.ts +0 -4
  121. package/chat/messages/en.d.ts +0 -4
  122. package/chat/messages/fr.d.ts +0 -4
  123. package/chat/messages/index.d.ts +0 -4
  124. package/esm2020/chat/charts/chart/chart.component.mjs +0 -40
  125. package/esm2020/chat/chat-message/chat-message.component.mjs +0 -263
  126. package/esm2020/chat/chat-reference/chat-reference.component.mjs +0 -40
  127. package/esm2020/chat/chat-settings-v3/chat-settings-v3.component.mjs +0 -114
  128. package/esm2020/chat/chat.component.mjs +0 -1072
  129. package/esm2020/chat/chat.service.mjs +0 -333
  130. package/esm2020/chat/debug-message/debug-message.component.mjs +0 -43
  131. package/esm2020/chat/instance-manager.service.mjs +0 -46
  132. package/esm2020/chat/messages/de.mjs +0 -4
  133. package/esm2020/chat/messages/en.mjs +0 -4
  134. package/esm2020/chat/messages/fr.mjs +0 -4
  135. package/esm2020/chat/messages/index.mjs +0 -9
  136. package/esm2020/chat/prompt.component.mjs +0 -88
  137. package/esm2020/chat/public-api.mjs +0 -13
  138. package/esm2020/chat/rest-chat.service.mjs +0 -241
  139. package/esm2020/chat/saved-chats/saved-chats.component.mjs +0 -175
  140. package/esm2020/chat/token-progress-bar/token-progress-bar.component.mjs +0 -54
  141. package/esm2020/chat/types.mjs +0 -101
  142. package/esm2020/chat/websocket-chat.service.mjs +0 -641
  143. package/fesm2015/sinequa-assistant-chat.mjs +0 -3416
  144. package/fesm2015/sinequa-assistant-chat.mjs.map +0 -1
  145. package/fesm2020/sinequa-assistant-chat.mjs +0 -3388
  146. package/fesm2020/sinequa-assistant-chat.mjs.map +0 -1
  147. package/fesm2020/sinequa-assistant.mjs +0 -9
  148. package/fesm2020/sinequa-assistant.mjs.map +0 -1
  149. /package/{fesm2015 → fesm2022}/sinequa-assistant.mjs.map +0 -0
@@ -0,0 +1,21 @@
1
+ import { ElementRef } from "@angular/core";
2
+ import { Subscription } from "rxjs";
3
+ import { ChatService } from "../chat.service";
4
+ import { NotificationsService } from "../services/notification.service";
5
+ import { SavedChat } from "../types";
6
+ import * as i0 from "@angular/core";
7
+ export type SavedChatEdit = SavedChat & {
8
+ currentTitle: string;
9
+ };
10
+ export declare class DialogRenameSavedChatComponent {
11
+ renameDialog: import("@angular/core").Signal<ElementRef<HTMLDialogElement> | undefined>;
12
+ notificationsService: NotificationsService;
13
+ private readonly transloco;
14
+ chatService: import("@angular/core").InputSignal<ChatService>;
15
+ savedChat: import("@angular/core").WritableSignal<SavedChatEdit>;
16
+ subscription: Subscription;
17
+ showModal(event: Event, savedChat: SavedChat): void;
18
+ protected onRename(event: Event, savedChat: SavedChatEdit): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogRenameSavedChatComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<DialogRenameSavedChatComponent, "sq-dialog-rename-saved-chat", never, { "chatService": { "alias": "chatService"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
21
+ }
@@ -0,0 +1,15 @@
1
+ import { ElementRef } from "@angular/core";
2
+ import { DialogEvent } from "../services/dialog.service";
3
+ import * as i0 from "@angular/core";
4
+ export declare class DialogUpdatesComponent {
5
+ protected dialogRef: import("@angular/core").Signal<ElementRef<any> | undefined>;
6
+ protected dialog: import("@angular/core").Signal<HTMLDialogElement>;
7
+ closed: import("@angular/core").OutputEmitterRef<DialogEvent>;
8
+ open(): void;
9
+ close(eventType?: DialogEvent): void;
10
+ seeNoMore(): void;
11
+ remindMeLater(): void;
12
+ update(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<DialogUpdatesComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<DialogUpdatesComponent, "sq-dialog-updates", never, {}, { "closed": "closed"; }, never, never, true, never>;
15
+ }
@@ -0,0 +1,68 @@
1
+ import { OnDestroy, OnInit } from "@angular/core";
2
+ import { BehaviorSubject } from "rxjs";
3
+ import { InstanceManagerService } from "../../instance-manager.service";
4
+ import { ChatService } from "../../chat.service";
5
+ import { DocumentsUploadService } from "../documents-upload.service";
6
+ import { UploadedDocument } from "../documents-upload.model";
7
+ import { NotificationsService } from "../../services/notification.service";
8
+ import * as i0 from "@angular/core";
9
+ export declare class DocumentListComponent implements OnInit, OnDestroy {
10
+ /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */
11
+ instanceId: string;
12
+ chatService: ChatService;
13
+ groupedUploadedDocuments$: BehaviorSubject<{
14
+ key: string;
15
+ value: UploadedDocument[];
16
+ }[]>;
17
+ documentToDelete?: UploadedDocument;
18
+ deletingAll: boolean;
19
+ private _subscription;
20
+ instanceManagerService: InstanceManagerService;
21
+ documentsUploadService: DocumentsUploadService;
22
+ notificationsService: NotificationsService;
23
+ private readonly transloco;
24
+ ngOnInit(): void;
25
+ ngOnDestroy(): void;
26
+ instantiateChatService(): void;
27
+ /**
28
+ * Updates the list of uploaded documents by fetching the latest data from the service.
29
+ * The fetched documents are grouped by date.
30
+ *
31
+ * @returns {void}
32
+ */
33
+ updateUploadedDocumentsList(): void;
34
+ deleteDocument(event: Event, doc: UploadedDocument): void;
35
+ /**
36
+ * Handles the deletion of an uploaded document. This method triggers a confirmation modal
37
+ * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request
38
+ * to delete the document and provides feedback to the user upon success or failure.
39
+ *
40
+ * @param event - The event object associated with the delete action, used to stop propagation.
41
+ * @param doc - The document to be deleted, represented as an instance of `UploadedDocument`.
42
+ *
43
+ * @remarks
44
+ * - Displays a confirmation modal with a warning message.
45
+ * - On confirmation, deletes the document.
46
+ * - Shows a success notification upon successful deletion.
47
+ * - Logs and notifies the user of any errors encountered during the deletion process.
48
+ */
49
+ performDeleteDocument(): void;
50
+ deleteAllDocuments(event?: Event): void;
51
+ /**
52
+ * Handles the deletion of all uploaded documents. This method triggers a confirmation modal
53
+ * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request
54
+ * to delete the whole list of documents and provides feedback to the user upon success or failure.
55
+ *
56
+ * @param event - (Optional) The event object associated with the delete action, used to stop propagation.
57
+ *
58
+ * @remarks
59
+ * - Displays a confirmation modal with a warning message.
60
+ * - On confirmation, deletes all documents.
61
+ * - Shows a success notification upon successful deletion.
62
+ * - Logs and notifies the user of any errors encountered during the deletion process.
63
+ */
64
+ performDeleteAllDocuments(): void;
65
+ private _groupUploadedDocumentsByDate;
66
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
67
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "sq-document-list", never, { "instanceId": { "alias": "instanceId"; "required": false; }; }, {}, never, never, true, never>;
68
+ }
@@ -0,0 +1,31 @@
1
+ import { EventEmitter, OnDestroy, OnInit } from "@angular/core";
2
+ import { BehaviorSubject } from "rxjs";
3
+ import { InstanceManagerService } from "../../instance-manager.service";
4
+ import { ChatService } from "../../chat.service";
5
+ import { DocumentsUploadService } from "../documents-upload.service";
6
+ import { UploadedDocument } from "../documents-upload.model";
7
+ import { NotificationsService } from "../../services/notification.service";
8
+ import * as i0 from "@angular/core";
9
+ export declare class DocumentOverviewComponent implements OnInit, OnDestroy {
10
+ /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */
11
+ instanceId: string;
12
+ disabledUpload: boolean;
13
+ onUpload: EventEmitter<any>;
14
+ chatService: ChatService;
15
+ uploadedDocuments$: BehaviorSubject<UploadedDocument[]>;
16
+ private _subscription;
17
+ instanceManagerService: InstanceManagerService;
18
+ documentsUploadService: DocumentsUploadService;
19
+ notificationsService: NotificationsService;
20
+ ngOnInit(): void;
21
+ ngOnDestroy(): void;
22
+ instantiateChatService(): void;
23
+ /**
24
+ * Updates the list of uploaded documents by fetching the latest data from the service.
25
+ *
26
+ * @returns {void}
27
+ */
28
+ updateUploadedDocumentsList(): void;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentOverviewComponent, never>;
30
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentOverviewComponent, "sq-document-overview", never, { "instanceId": { "alias": "instanceId"; "required": false; }; "disabledUpload": { "alias": "disabledUpload"; "required": false; }; }, { "onUpload": "onUpload"; }, never, never, true, never>;
31
+ }
@@ -0,0 +1,96 @@
1
+ import { OnDestroy, OnInit } from "@angular/core";
2
+ import { FlowDirective, Transfer } from "@flowjs/ngx-flow";
3
+ import { BehaviorSubject } from "rxjs";
4
+ import { InstanceManagerService } from "../../instance-manager.service";
5
+ import { ChatService } from "../../chat.service";
6
+ import { DocumentsUploadService } from "../documents-upload.service";
7
+ import { IndexingInfos, UploadingInfos } from "../documents-upload.model";
8
+ import { NotificationsService } from "../../services/notification.service";
9
+ import * as i0 from "@angular/core";
10
+ export declare class DocumentUploadComponent implements OnInit, OnDestroy {
11
+ /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */
12
+ instanceId: string;
13
+ /** Polling interval in milliseconds to update the indexing status of the uploaded documents */
14
+ pollingInterval: number;
15
+ flow: FlowDirective;
16
+ chatService: ChatService;
17
+ readonly flowConfig: flowjs.FlowOptions;
18
+ errorAlerts: string[];
19
+ dragging$: BehaviorSubject<boolean>;
20
+ indexing$: BehaviorSubject<boolean>;
21
+ indexingInfos$: BehaviorSubject<IndexingInfos | undefined>;
22
+ uploading$: BehaviorSubject<boolean>;
23
+ uploadingInfos$: BehaviorSubject<UploadingInfos | undefined>;
24
+ private _subscription;
25
+ instanceManagerService: InstanceManagerService;
26
+ documentsUploadService: DocumentsUploadService;
27
+ notificationsService: NotificationsService;
28
+ private readonly transloco;
29
+ ngOnInit(): void;
30
+ ngOnDestroy(): void;
31
+ instantiateChatService(): void;
32
+ /**
33
+ * Handles the submission of files.
34
+ *
35
+ * @remarks
36
+ * This method performs the following checks on the submitted files:
37
+ *
38
+ * 1. Checks if the number of files submitted exceeds the remainingFileCount defined in the constraints.
39
+ * - If the number of files exceeds the allowed count, all files are removed from the flow.
40
+ * - An error message is added to the error alerts.
41
+ *
42
+ * 2. Checks if the total size of the files submitted exceeds the remainingFileSize defined in the constraints.
43
+ * - If the total size exceeds the allowed size, all files are removed from the flow.
44
+ * - An error message is added to the error alerts.
45
+ *
46
+ * 3. Checks if the file extension of the files submitted is not allowed.
47
+ * - If the file extension is not allowed, the file is removed from the flow.
48
+ * - An error message is added to the error alerts.
49
+ */
50
+ private _onFilesSubmitted;
51
+ private _onFilesAdded;
52
+ onDragenter(): void;
53
+ onDragleave(event: DragEvent): void;
54
+ onDrop(): void;
55
+ trackTransfer(transfer: Transfer): string;
56
+ /**
57
+ * Initiates the upload process by invoking the `upload` method
58
+ * of the `flow` instance.
59
+ * The `upload` method is overridden in the `ngOnInit` method to match the requirements of the assistant API.
60
+ */
61
+ upload(): void;
62
+ /**
63
+ * Initiates the file upload process by preparing the form data,
64
+ * setting the uploading flag, and making an API call to upload the files.
65
+ *
66
+ * @remarks
67
+ * - Collects all files from the `flowJs` instance and appends them to a `FormData` object.
68
+ * - Subscribes to the upload process to handle progress updates, completion, and errors.
69
+ * - Triggers tracking the indexing process upon successful upload completion.
70
+ * - Cleans up the `flow` instance after the upload process is finalized.
71
+ */
72
+ private startUpload;
73
+ /**
74
+ * Tracks the indexing process for a single documents upload session by polling the API for its status.
75
+ *
76
+ * @param token - A unique token representing the single documents upload session.
77
+ *
78
+ * @remarks
79
+ * - Clears the uploading flags and sets the indexing flag to true before starting the process.
80
+ * - Polls the API every (pollingInterval: default = 1 second) to retrieve the current indexing status.
81
+ * - Updates the `indexingInfos` property with the latest status.
82
+ * - Stops polling when the indexing process is completed or an error occurs.
83
+ * - Cleans up by resetting the indexing flags and clearing the `indexingInfos` property when the process is finalized.
84
+ */
85
+ trackIndexingProcess(token: string): void;
86
+ /**
87
+ * Calculates the indexing progress as a percentage of completed documents.
88
+ *
89
+ * @param infos - The indexing information containing the list of documents and their statuses.
90
+ * @returns The progress as a number between 0 and 1, where 0 indicates no progress and 1 indicates all documents are processed (processed means either indexed or errored).
91
+ * Returns 0 if the input is invalid or there are no documents.
92
+ */
93
+ getIndexingProgress(infos: IndexingInfos | undefined): number;
94
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentUploadComponent, never>;
95
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentUploadComponent, "sq-document-upload", never, { "instanceId": { "alias": "instanceId"; "required": false; }; "pollingInterval": { "alias": "pollingInterval"; "required": false; }; }, {}, never, never, true, never>;
96
+ }
@@ -0,0 +1,66 @@
1
+ export type UploadConfig = {
2
+ documentsUploadEnabled: boolean;
3
+ constraints: {
4
+ maxTotalFileSizeMB: number;
5
+ remainingFileSizeMB: number;
6
+ maxTotalFileCount: number;
7
+ remainingFileCount: number;
8
+ supportedFileExtensions: string[];
9
+ };
10
+ };
11
+ export type UploadResponse = {
12
+ statusToken: string;
13
+ executionTime: string;
14
+ connectorResponse?: {
15
+ collection: string;
16
+ action: string;
17
+ stats: {
18
+ nbDocUpdated: number;
19
+ };
20
+ };
21
+ };
22
+ export type UploadingInfos = {
23
+ loaded: number;
24
+ total: number;
25
+ progress: number;
26
+ };
27
+ export type UploadProgressEvent = {
28
+ type: 'uploadProgress';
29
+ } & UploadingInfos;
30
+ export interface UploadResponseEvent {
31
+ type: 'response';
32
+ body: UploadResponse;
33
+ }
34
+ export type UploadEvent = UploadProgressEvent | UploadResponseEvent;
35
+ export type IndexingInfos = {
36
+ docs: {
37
+ id: string;
38
+ fileName: string;
39
+ operation: "Add" | "Update";
40
+ status: "Indexing" | "Indexed" | "Error";
41
+ previousIndexationTime: string | null;
42
+ currentIndexationTime: string | null;
43
+ }[];
44
+ isCompleted: boolean;
45
+ executionTime: string;
46
+ };
47
+ export interface UploadedDocuments {
48
+ docs: UploadedDocument[];
49
+ count: number;
50
+ totalCount: number;
51
+ executionTime: string;
52
+ }
53
+ export interface UploadedDocument {
54
+ id: string;
55
+ fileName: string;
56
+ title: string;
57
+ fileExt: string;
58
+ indexationTime: string;
59
+ size: string;
60
+ sizeDisplay: string;
61
+ [key: string]: any;
62
+ }
63
+ export interface deleteDocumentsResponse {
64
+ deletedCount: number;
65
+ executionTime: string;
66
+ }
@@ -0,0 +1,170 @@
1
+ import { ChatService } from '../chat.service';
2
+ import { BehaviorSubject, Observable } from 'rxjs';
3
+ import { deleteDocumentsResponse, IndexingInfos, UploadConfig, UploadedDocuments, UploadEvent } from './documents-upload.model';
4
+ import { HttpClient } from '@angular/common/http';
5
+ import { AppService } from '../services/app.service';
6
+ import * as i0 from "@angular/core";
7
+ export declare class DocumentsUploadService {
8
+ /** Name of the assistant plugin. */
9
+ REQUEST_URL: string;
10
+ /** Documents' upload configuration. */
11
+ uploadConfig$: BehaviorSubject<UploadConfig | undefined>;
12
+ chatService: ChatService;
13
+ appService: AppService;
14
+ http: HttpClient;
15
+ /**
16
+ * Initializes the file upload service with the provided chat service instance.
17
+ *
18
+ * @param chatService - An instance of ChatService. If not provided, an error is thrown.
19
+ * @throws {Error} If the chatService instance is not provided or if there is an error during initialization.
20
+ */
21
+ init(chatService: ChatService | undefined): void;
22
+ /**
23
+ * Fetch the endpoint to use for the file upload related requests
24
+ * @throws {Error} If the property 'restEndpoint' is not provided in the assistant configuration
25
+ */
26
+ getRequestsUrl(): void;
27
+ /**
28
+ * Retrieves the upload configuration for documents.
29
+ * The response, which contains the upload configuration, is emitted to the `uploadConfig$` observable.
30
+ *
31
+ * @throws {Error} If there is an error invoking the `documentsUploadConfigGet` action.
32
+ */
33
+ getUploadConfig(): void;
34
+ /**
35
+ * Uploads documents to the server.
36
+ *
37
+ * This method takes a FormData object which should contain all files to be uploaded.
38
+ * Each file should be appended to the FormData object with its original name.
39
+ *
40
+ * For example:
41
+ * ```typescript
42
+ * const formData = new FormData();
43
+ * formData.append(file.name, file.file);
44
+ * ```
45
+ *
46
+ * @param formData - The FormData object containing the files to be uploaded.
47
+ * - Each file should be appended to the FormData object with its original name.
48
+ * For example:
49
+ * ```typescript
50
+ * const formData = new FormData();
51
+ * formData.append(file.name, file.file);
52
+ * ```
53
+ *
54
+ * @param enableProgress - (Optional) A boolean parameter that controls whether progress reporting is enabled.
55
+ * - Defaults to `true`.
56
+ * - If `true`, the `reportProgress` option is set in the request options, enabling the track of upload progress based on the underlying browser's progress events.
57
+ * - If `false`, progress events are not reported.
58
+ *
59
+ * @returns An Observable that emits events of type `UploadEvent`:
60
+ * - `UploadProgressEvent`: Emitted during the upload process, containing:
61
+ * - * `type`: "uploadProgress" - The type of the event.
62
+ * - * `loaded`: number - The number of bytes uploaded so far.
63
+ * - * `total`: number - The total number of bytes to be uploaded (if available).
64
+ * - * `progress`: number - The percentage of upload progress (calculated as `(loaded / total) * 100`).
65
+ * - `UploadResponseEvent`: Emitted when the upload is complete, containing:
66
+ * - * `type`: "response" - The type of the event.
67
+ * - * `body`: `UploadResponse` - The server's response, including:
68
+ * - * - * `statusToken`: string - A token to track the status of the indexing process.
69
+ * - * - * `executionTime`: string - The time taken to execute the upload.
70
+ * - * - * `connectorResponse` (optional): Additional response data from the connector, containing:
71
+ * - * - * - * `collection`: string - The collection name.
72
+ * - * - * - * `action`: string - The action performed.
73
+ * - * - * - * `stats`: object - Statistics about the upload, including:
74
+ * - * - * - * - * `nbDocUpdated`: number - The number of documents updated.
75
+ *
76
+ * @throws {Error} If there is an error invoking the `documentsupload` action.
77
+ *
78
+ * Example usage:
79
+ * ```typescript
80
+ * const formData = new FormData();
81
+ * formData.append(file.name, file.file);
82
+ * this.documentsUploadService.uploadDocuments(formData).subscribe(event => {
83
+ * if (event.type === 'uploadProgress') {
84
+ * console.log(`Progress: ${event.progress}%`);
85
+ * } else if (event.type === 'response') {
86
+ * console.log('Upload complete:', event.body);
87
+ * }
88
+ * });
89
+ * ```
90
+ */
91
+ uploadDocuments(formData: FormData, enableProgress?: boolean): Observable<UploadEvent>;
92
+ /**
93
+ * Retrieves the indexing status of a predefined uploaded document(s)
94
+ * based on the provided status token returned from the upload process.
95
+ *
96
+ * @param token - The status token used to track the indexing process.
97
+ * @returns An Observable that emits the server response of type `IndexingResponse`.
98
+ * The `IndexingResponse` object contains:
99
+ * - `docs`: array - An array of document status objects, each containing:
100
+ * - * `id`: string - The document ID.
101
+ * - * `fileName`: string - The name of the file.
102
+ * - * `operation`: "Add" | "Update" - The operation performed on the document.
103
+ * - * `status`: "Indexing" | "Indexed" | "Error" - The status of the document.
104
+ * - * `previousIndexationTime`: string | null - The previous indexation time.
105
+ * - * `currentIndexationTime`: string | null - The current indexation time.
106
+ * - `executionTime`: string - The time taken to retrieve the indexing status.
107
+ * @throws {Error} If there is an error invoking the `documentsUploadStatus` action.
108
+ */
109
+ getIndexingStatus(token: string): Observable<IndexingInfos>;
110
+ /**
111
+ * Retrieves a list of uploaded documents.
112
+ *
113
+ * @param {string[]} [columns] - Optional array of additional index columns to include for each document.
114
+ * @param {number} [skip] - Optional number of documents to skip for pagination. If set, count also needs to be set. No skip if not set.
115
+ * @param {number} [count] - Optional number of documents to take for pagination (unlimited if not set).
116
+ * @returns {Observable<UploadedDocuments>} An observable that emits the list of uploaded documents.
117
+ * The `UploadedDocuments` object contains:
118
+ * - `docs`: array - An array of objects representing a single document with the following properties:
119
+ * - * `id`: string - A unique identifier for the document.
120
+ * - * `fileName`: string - The name of the file.
121
+ * - * `title`: string - The title of the document.
122
+ * - * `fileExt`: string - The file extension of the document.
123
+ * - * `indexationTime`: string - The time when the document was indexed.
124
+ * - * `size`: number - The size of the document.
125
+ * - * `sizeDisplay`: string - A human-readable representation of the document size.
126
+ * - * `[key: string]`: any - Additional columns asked in the request, value of the column for the document.
127
+ * - `count`: number - The count of documents in the current batch or subset.
128
+ * - `totalCount`: number - The total count of documents available.
129
+ * - `executionTime`: string - The time taken to process the documents.
130
+ * @throws {Error} Throws an error if the request fails.
131
+ */
132
+ getDocumentsList(columns?: string[], skip?: number, count?: number): Observable<UploadedDocuments>;
133
+ /**
134
+ * Deletes the uploaded documents with the specified IDs.
135
+ *
136
+ * @param docIds - An array of document IDs to delete.
137
+ * @returns An observable that emits the server response of type `deleteDocumentsResponse`.
138
+ * The `deleteDocumentsResponse` object contains:
139
+ * - `deletedCount`: number - The number of deleted documents.
140
+ * - `executionTime`: string - The time taken to delete the documents.
141
+ * @throws {Error} If there is an error invoking the `documentsDelete` action.
142
+ */
143
+ deleteDocuments(docIds: string[]): Observable<deleteDocumentsResponse>;
144
+ /**
145
+ * Deletes all uploaded documents.
146
+ *
147
+ * @returns An observable that emits the server response of type `deleteDocumentsResponse`.
148
+ * The `deleteDocumentsResponse` object contains:
149
+ * - `deletedCount`: number - The number of deleted documents.
150
+ * - `executionTime`: string - The time taken to delete the documents.
151
+ * @throws {Error} If there is an error invoking the `documentsDeleteAll` action.
152
+ */
153
+ deleteAllDocuments(): Observable<deleteDocumentsResponse>;
154
+ /**
155
+ * Formats the given file size in bytes into a human-readable string.
156
+ *
157
+ * @param bytes - The size of the file in bytes.
158
+ * @returns A string representing the file size in a human-readable format (e.g., "10.24 KB", "1.00 MB").
159
+ */
160
+ formatFileSize(bytes: number): string;
161
+ /**
162
+ * Converts the given file size in bytes into megabytes.
163
+ *
164
+ * @param bytes - The size of the file in bytes.
165
+ * @returns The size of the file in megabytes.
166
+ */
167
+ convertBytesToMB(bytes: number): number;
168
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentsUploadService, never>;
169
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentsUploadService>;
170
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "cancel": "Cancel",
3
+ "confirm": "Confirm",
4
+ "delete": "Delete",
5
+ "deleteDocumentText": "You are about to delete the document '{{title}}'. Do you want to continue ?",
6
+ "deleteDocumentSuccess": "The document '{{title}}' has been successfully deleted.",
7
+ "deleteDocumentError": "An error occurred while deleting the document '{{title}}'.",
8
+ "deleteAllDocumentsText": "You are about to delete all the documents. Do you want to continue ?",
9
+ "deleteAllDocumentsSuccess": "All documents have been successfully deleted.",
10
+ "deleteAllDocumentsError": "An error occurred while deleting all documents.",
11
+ "uploadedDocuments": "{count, plural,=0 {No documents uploaded} one {# uploaded document} other {# uploaded documents}}",
12
+ "uploadToSources": "Upload to sources",
13
+ "dragAndDrop": "Drag and drop files here or",
14
+ "clickToBrowse": "click to browse",
15
+ "dropFiles": "Drop files here",
16
+ "uploadingFiles": "{count, plural, one {Uploading # file} other {Uploading # files}}",
17
+ "indexingFiles": "{count, plural, one {Indexing # file} other {Indexing # files}}",
18
+ "upload": "Upload",
19
+ "filesNumberLimitExceeded": "The number of files exceeds the allowed limit. You can upload up to {{max}} files.",
20
+ "filesSizeLimitExceeded": "The total size of the files exceeds the allowed limit. You can upload files up to {{max}} MB.",
21
+ "fileExtensionUnsupported": "The file extension {{extension}} is not supported.",
22
+ "errorUploadingFiles": "An error occurred while uploading the files.",
23
+ "errorIndexingStatus": "Error retrieving indexing status."
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "cancel": "Annuler",
3
+ "confirm": "Confirmer",
4
+ "delete": "Supprimer",
5
+ "deleteDocumentText": "Vous êtes sur le point de supprimer le document '{{title}}'. Voulez-vous continuer ?",
6
+ "deleteDocumentSuccess": "Le document '{{title}}' a été supprimé avec succès.",
7
+ "deleteDocumentError": "Une erreur s'est produite lors de la suppression du document '{{title}}'.",
8
+ "deleteAllDocumentsText": "Vous êtes sur le point de supprimer tous les documents. Voulez-vous continuer ?",
9
+ "deleteAllDocumentsSuccess": "Tous les documents ont été supprimés avec succès.",
10
+ "deleteAllDocumentsError": "Une erreur s'est produite lors de la suppression de tous les documents.",
11
+ "uploadedDocuments": "{count, plural, =0 {Aucun document téléversé} one {# document téléversé} other {# documents téléversés}}",
12
+ "uploadToSources": "Téléverser vers les sources",
13
+ "dragAndDrop": "Glisser-déposer des fichiers ici ou",
14
+ "clickToBrowse": "cliquer pour parcourir",
15
+ "dropFiles": "Déposer des fichiers ici",
16
+ "uploadingFiles": "{count, plural, one {Téléversement de # fichier} other {Téléversement de # fichiers}}",
17
+ "indexingFiles": "{count, plural, one {Indexation de # fichier} other {Indexation de # fichiers}}",
18
+ "upload": "Téléverser",
19
+ "filesNumberLimitExceeded": "Le nombre de fichiers dépasse la limite autorisée. Vous pouvez téléverser jusqu'à {{max}} fichiers.",
20
+ "filesSizeLimitExceeded": "La taille totale des fichiers dépasse la limite autorisée. Vous pouvez téléverser des fichiers jusqu'à {{max}} Mo.",
21
+ "fileExtensionUnsupported": "L'extension de fichier {{extension}} n'est pas prise en charge.",
22
+ "errorUploadingFiles": "Une erreur s'est produite lors du téléversement des fichiers.",
23
+ "errorIndexingStatus": "Erreur lors de la récupération de l'état d'indexation."
24
+ }
@@ -1,10 +1,10 @@
1
- import { OnChanges } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export declare class FormatIconComponent implements OnChanges {
4
- extension: string;
5
- private _formatIcons;
6
- icon: string;
7
- ngOnChanges(): void;
8
- static ɵfac: i0.ɵɵFactoryDeclaration<FormatIconComponent, never>;
9
- static ɵcmp: i0.ɵɵComponentDeclaration<FormatIconComponent, "sq-format-icon", never, { "extension": "extension"; }, {}, never, never, true>;
10
- }
1
+ import { OnChanges } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class FormatIconComponent implements OnChanges {
4
+ extension: string;
5
+ private _formatIcons;
6
+ icon: string;
7
+ ngOnChanges(): void;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormatIconComponent, never>;
9
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormatIconComponent, "sq-format-icon", never, { "extension": { "alias": "extension"; "required": false; }; }, {}, never, never, true, never>;
10
+ }
@@ -1,5 +1,5 @@
1
- export interface IconFormat {
2
- icon: string;
3
- color?: string;
4
- }
5
- export declare const defaultFormatIcons: Record<string, IconFormat>;
1
+ export interface IconFormat {
2
+ icon: string;
3
+ color?: string;
4
+ }
5
+ export declare const defaultFormatIcons: Record<string, IconFormat>;
@@ -0,0 +1,42 @@
1
+ {
2
+ "tryAgain": "Try again",
3
+ "loading": "Loading…",
4
+ "askSomething": "Ask something",
5
+ "sendMessage": "Send message",
6
+ "cancelEdition": "Cancel edition",
7
+ "generating": "Generating",
8
+ "stopping": "Stopping",
9
+ "stopGeneration": "Stop generation",
10
+ "issueType": "Issue type",
11
+ "chooseIssueType": "Choose an issue type",
12
+ "askUnlikeReasons": "What was unsatisfying about this response? (optional)",
13
+ "askLikeReasons": "What did you like about this response? (optional)",
14
+ "writeComment": "Write your comment",
15
+ "send": "Send",
16
+ "doNotSend": "Do not send report",
17
+ "userInterfaceBug": "User interface bug",
18
+ "incorrectResponse": "Incorrect or misleading response",
19
+ "incompleteResponse": "Incomplete response",
20
+ "technicalIssue": "Technical issue",
21
+ "privacyDataSecurityIssue": "Privacy or data security issue",
22
+ "otherIssue": "Other issue",
23
+ "sendReportNotification": "Your report has been successfully sent",
24
+ "today": "Today",
25
+ "yesterday": "Yesterday",
26
+ "thisWeek": "This week",
27
+ "lastWeek": "Last week",
28
+ "thisMonth": "This month",
29
+ "lastMonth": "Last month",
30
+ "thisQuarter": "This quarter",
31
+ "lastQuarter": "Last quarter",
32
+ "thisYear": "This year",
33
+ "lastYear": "Last year",
34
+ "clipboard": {
35
+ "success": "\"{{value}}\" has been copied in the clipboard.",
36
+ "fail": "Failed to copy."
37
+ },
38
+ "saveChatConfig": {
39
+ "success": "Assistant {{value}} instance configuration has been successfully updated.",
40
+ "fail": "Assistant {{value}} instance configuration update failed."
41
+ }
42
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "tryAgain": "Réessayer",
3
+ "loading": "Chargement…",
4
+ "askSomething": "Posez une question",
5
+ "sendMessage": "Envoyer le message",
6
+ "cancelEdition": "Annuler l'édition",
7
+ "generating": "Génération",
8
+ "stopping": "Arrêt",
9
+ "stopGeneration": "Arrêter la génération",
10
+ "issueType": "Type de problème",
11
+ "chooseIssueType": "Choisissez un type de problème",
12
+ "askUnlikeReasons": "Qu'est-ce qui n'était pas satisfaisant dans cette réponse? (optionnel)",
13
+ "askLikeReasons": "Qu'avez-vous aimé dans cette réponse? (optionnel)",
14
+ "writeComment": "Écrivez votre commentaire",
15
+ "send": "Envoyer",
16
+ "doNotSend": "Ne pas envoyer le rapport",
17
+ "userInterfaceBug": "Problème de l'interface utilisateur",
18
+ "incorrectResponse": "Réponse incorrecte ou trompeuse",
19
+ "incompleteResponse": "Réponse incomplète",
20
+ "technicalIssue": "Problème technique",
21
+ "privacyDataSecurityIssue": "Problème de confidentialité ou de sécurité des données",
22
+ "otherIssue": "Autre problème",
23
+ "sendReportNotification": "Votre rapport a été envoyé avec succès",
24
+ "today": "Aujourd'hui",
25
+ "yesterday": "Hier",
26
+ "thisWeek": "Cette semaine",
27
+ "lastWeek": "La semaine dernière",
28
+ "thisMonth": "Ce mois-ci",
29
+ "lastMonth": "Le mois dernier",
30
+ "thisQuarter": "Ce trimestre",
31
+ "lastQuarter": "Le trimestre dernier",
32
+ "thisYear": "Cette année",
33
+ "lastYear": "L'année dernière",
34
+ "clipboard": {
35
+ "success": "\"{{value}}\" copié dans le presse-papiers.",
36
+ "fail": "Échec de la copie."
37
+ },
38
+ "saveChatConfig": {
39
+ "success": "La configuration d'instance de l'assistant {{value}} a été mise à jour.",
40
+ "fail": "La mise à jour de l'instance de l'assistant {{value}} à échouée."
41
+ }
42
+ }
package/chat/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@sinequa/assistant/chat" />
5
- export * from './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@sinequa/assistant/chat" />
5
+ export * from './public-api';