@sinequa/assistant 3.9.2 → 3.9.3
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/chat/chat.component.d.ts +35 -38
- package/chat/chat.service.d.ts +190 -84
- package/chat/debug-message/debug-message-details/debug-message-details.component.d.ts +19 -0
- package/chat/debug-message/debug-message.component.d.ts +9 -12
- package/chat/debug-message/debug-message.service.d.ts +15 -0
- package/chat/documents-upload/document-list/document-list.component.d.ts +1 -0
- package/chat/public-api.d.ts +0 -2
- package/chat/saved-chats/i18n/en.json +1 -1
- package/chat/saved-chats/i18n/fr.json +1 -1
- package/chat/saved-chats/saved-chats.component.d.ts +1 -0
- package/chat/saved-chats/saved-chats.service.d.ts +27 -0
- package/chat/services/assistant-configuration.service.d.ts +34 -0
- package/chat/services/assistant-metadata.service.d.ts +18 -0
- package/chat/services/assistant-tokens-tracking.service.d.ts +23 -0
- package/chat/services/assistant-ws-frames.service.d.ts +50 -0
- package/chat/services/signalR-connection.service.d.ts +25 -0
- package/chat/types.d.ts +12 -3
- package/chat/utils/utils.service.d.ts +67 -0
- package/esm2022/chat/chat.component.mjs +198 -227
- package/esm2022/chat/chat.service.mjs +450 -267
- package/esm2022/chat/debug-message/debug-message-details/debug-message-details.component.mjs +43 -0
- package/esm2022/chat/debug-message/debug-message.component.mjs +27 -30
- package/esm2022/chat/debug-message/debug-message.service.mjs +52 -0
- package/esm2022/chat/dialogs/rename-saved-chat.component.mjs +6 -5
- package/esm2022/chat/documents-upload/document-list/document-list.component.mjs +4 -2
- package/esm2022/chat/public-api.mjs +1 -3
- package/esm2022/chat/saved-chats/saved-chats.component.mjs +11 -10
- package/esm2022/chat/saved-chats/saved-chats.service.mjs +165 -0
- package/esm2022/chat/services/assistant-configuration.service.mjs +171 -0
- package/esm2022/chat/services/assistant-metadata.service.mjs +67 -0
- package/esm2022/chat/services/assistant-tokens-tracking.service.mjs +57 -0
- package/esm2022/chat/services/assistant-ws-frames.service.mjs +392 -0
- package/esm2022/chat/services/signalR-connection.service.mjs +109 -0
- package/esm2022/chat/types.mjs +1 -1
- package/esm2022/chat/unified-plugins/embedded-image-reference.plugin.mjs +2 -3
- package/esm2022/chat/utils/utils.service.mjs +170 -0
- package/fesm2022/sinequa-assistant-chat.mjs +2020 -1648
- package/fesm2022/sinequa-assistant-chat.mjs.map +1 -1
- package/package.json +1 -1
- package/chat/rest-chat.service.d.ts +0 -31
- package/chat/websocket-chat.service.d.ts +0 -102
- package/esm2022/chat/rest-chat.service.mjs +0 -300
- package/esm2022/chat/websocket-chat.service.mjs +0 -659
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinequa-assistant-chat.mjs","sources":["../../../projects/assistant/chat/instance-manager.service.ts","../../../projects/assistant/chat/services/app.service.ts","../../../projects/assistant/chat/services/principal.service.ts","../../../projects/assistant/chat/utils/assistant-json.ts","../../../projects/assistant/chat/chat-settings-v3/chat-settings-v3.component.ts","../../../projects/assistant/chat/chat-settings-v3/chat-settings-v3.component.html","../../../projects/assistant/chat/charts/chart/chart.component.ts","../../../projects/assistant/chat/charts/chart/chart.component.html","../../../projects/assistant/chat/format-icon/icons.ts","../../../projects/assistant/chat/format-icon/format-icon.component.ts","../../../projects/assistant/chat/format-icon/format-icon.component.html","../../../projects/assistant/chat/tooltip/tooltip.component.ts","../../../projects/assistant/chat/tooltip/tooltip.directive.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.html","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.html","../../../projects/assistant/chat/pipes/message-content.pipe.ts","../../../projects/assistant/chat/references/inline-image-reference.ts","../../../projects/assistant/chat/references/inline-page-reference.ts","../../../projects/assistant/chat/unified-plugins/embedded-image-reference.plugin.ts","../../../projects/assistant/chat/unified-plugins/embedded-page-reference.plugin.ts","../../../projects/assistant/chat/services/notification.service.ts","../../../projects/assistant/chat/services/ui.service.ts","../../../projects/assistant/chat/chat-message/chat-message.component.ts","../../../projects/assistant/chat/chat-message/chat-message.component.html","../../../projects/assistant/chat/dialogs/updates.component.ts","../../../projects/assistant/chat/services/dialog.service.ts","../../../projects/assistant/chat/services/user-settings.service.ts","../../../projects/assistant/chat/types.ts","../../../projects/assistant/chat/chat.service.ts","../../../projects/assistant/chat/debug-message/debug-message.component.ts","../../../projects/assistant/chat/debug-message/debug-message.component.html","../../../projects/assistant/chat/rest-chat.service.ts","../../../projects/assistant/chat/services/search.service.ts","../../../projects/assistant/chat/token-progress-bar/token-progress-bar.component.ts","../../../projects/assistant/chat/token-progress-bar/token-progress-bar.component.html","../../../projects/assistant/chat/services/signalR.web.service.ts","../../../projects/assistant/chat/websocket-chat.service.ts","../../../projects/assistant/chat/chat.component.ts","../../../projects/assistant/chat/chat.component.html","../../../projects/assistant/chat/dialogs/delete-saved-chat.component.ts","../../../projects/assistant/chat/dialogs/rename-saved-chat.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.html","../../../projects/assistant/chat/prompt.component.ts","../../../projects/assistant/chat/documents-upload/documents-upload.service.ts","../../../projects/assistant/chat/documents-upload/document-upload/document-upload.component.ts","../../../projects/assistant/chat/documents-upload/document-upload/document-upload.component.html","../../../projects/assistant/chat/documents-upload/document-list/document-list.component.ts","../../../projects/assistant/chat/documents-upload/document-list/document-list.component.html","../../../projects/assistant/chat/documents-upload/document-overview/document-overview.component.ts","../../../projects/assistant/chat/documents-upload/document-overview/document-overview.component.html","../../../projects/assistant/chat/sinequa-assistant-chat.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { ChatService } from './chat.service';\n\n/**\n * A service to create and manage instances of ChatService dynamically based on the provided component references and the implementation type (http or websocket)\n * All chat-related components should share the same instance of this InstanceManagerService, which in turn provides the appropriate instance of ChatService\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class InstanceManagerService {\n private _serviceInstances: Map<string, ChatService> = new Map();\n\n /**\n * Store the instance of ChatService in the map\n * @param key key differentiator between components used to store their corresponding ChatService instance\n * @param service The ChatService instance\n */\n storeInstance(key: string, service: ChatService): void {\n this._serviceInstances.set(key, service);\n }\n\n /**\n * @param key key differentiator between components based on which the corresponding ChatService instance is fetched\n * @returns The instance of the service corresponding to the instance of the component\n */\n getInstance(key: string): ChatService {\n if (!this.checkInstance(key)) {\n throw new Error(`No assistant instance found for the given key : '${key}'`);\n }\n return this._serviceInstances.get(key)!;\n }\n\n /**\n *\n * @param key key differentiator between components based on which the check for an existent ChatService instance is performed\n * @returns True if a ChatService instance has been already instantiated for the given key. Otherwise, false.\n */\n checkInstance(key: string): boolean {\n return this._serviceInstances.has(key);\n }\n}\n","import { Injectable } from \"@angular/core\";\r\nimport { CCApp } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AppService {\r\n app: CCApp = {} as CCApp;\r\n get appName() {\r\n return this?.app?.name || \"\";\r\n }\r\n}","import { Injectable } from \"@angular/core\";\r\nimport { Principal } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class PrincipalService {\r\n principal: Principal = {} as Principal;\r\n}\r\n","import { CCApp } from \"@sinequa/atomic\";\n\nexport function getAssistantJsonFromCCApp(ccApp: CCApp, configId: string): any {\n const customJSONs = ccApp?.customJSONs;\n\n if (!!customJSONs) {\n const assistantsJson = ccApp.customJSONs.find(\n (json) => json.name === \"assistants\"\n );\n\n // try to fetch from sideJson\n if (!!assistantsJson) return assistantsJson?.data?.[configId];\n }\n\n // fallback to the main json\n return ccApp?.data?.assistants?.[configId];\n}\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { Subscription, filter, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated, sha512 } from \"@sinequa/atomic\";\n\nimport { ChatService } from \"../chat.service\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { ChatConfig, GllmModelDescription } from \"../types\";\n\nimport { AppService } from \"../services/app.service\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { getAssistantJsonFromCCApp } from \"../utils/assistant-json\";\n\n@Component({\n selector: 'sq-chat-settings-v3',\n templateUrl: './chat-settings-v3.component.html',\n styleUrls: [\"./chat-settings-v3.component.scss\"],\n standalone: true,\n imports: [CommonModule, FormsModule, TranslocoPipe],\n providers: [provideTranslocoScope('chat-settings')]\n})\nexport class ChatSettingsV3Component implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output(\"update\") _update = new EventEmitter<ChatConfig>();\n @Output(\"cancel\") _cancel = new EventEmitter<ChatConfig>();\n\n chatService: ChatService;\n config: ChatConfig;\n subscription = new Subscription();\n selectedModel: GllmModelDescription | undefined;\n functions: {name: string, enabled: boolean}[] = [];\n isAdmin = false;\n showDebugToggle = false;\n\n public instanceManagerService = inject(InstanceManagerService);\n public principalService = inject(PrincipalService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig)\n ).subscribe(_ => {\n this.isAdmin = this.principalService.principal!.isAdministrator;\n // Init config with a copy of the original chat config, so that it won't be modified by the user until he clicks on save\n this.config = JSON.parse(JSON.stringify(this.chatService.assistantConfig$.value));\n // Show debug toggle whether the user is an admin or a delegated admin with the debug mode enabled in the uiSettings\n this.showDebugToggle = (\n this.isAdmin || !!this.chatService.userOverride$.value || (this.principalService.principal!.isDelegatedAdmin && this.config.uiSettings.debug)\n ) ?? false;\n this.selectedModel = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.initFunctionsList();\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n get hasPrompts(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.displaySystemPrompt\n || !!this.config.uiSettings.displayUserPrompt;\n }\n\n get hasAdvancedParameters(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n get hasModel(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.servicesModels\n || !!this.config.uiSettings.functions\n || !!this.config.uiSettings.debug\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onChatModelChange(selectedModel: GllmModelDescription) {\n // Update properties based on the selected model\n this.config.defaultValues.service_id = selectedModel.serviceId;\n this.config.defaultValues.model_id = selectedModel.modelId;\n }\n\n getFunctionDescription(name: string): string {\n return this.chatService.functions?.find(fn => fn.functionName === name)?.description || \"\";\n }\n\n toggleFunctionsSelection(name: string) {\n // Update the enabled property of the function\n const index = this.config.defaultValues.functions.findIndex(func => func.name === name);\n this.config.defaultValues.functions[index].enabled = this.functions[index].enabled;\n }\n\n private initFunctionsList(): void {\n this.functions = this.config.defaultValues.functions.filter(func => !!this.chatService.functions?.find(fn => fn.functionName === func.name));\n }\n\n /**\n * Save the new chat config in the chat service and the user preferences\n * If the user has never modified the default values, we need to save the hash of the standard default values, as defined by the admin, in order to properly track changes afterwards.\n */\n async save() {\n const userSettingsConfig = this.chatService.assistants[this.instanceId] || {};\n if (!userSettingsConfig.defaultValues) { // At this point, it is the very first time the user makes changes to the default values\n const standardChatConfig = getAssistantJsonFromCCApp(this.appService.app, this.instanceId);\n const currentDefaultValuesHash = await sha512(JSON.stringify(standardChatConfig.defaultValues));\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash };\n this.chatService.updateChatConfig(this.config, hashes);\n } else {\n this.chatService.updateChatConfig(this.config);\n }\n this.chatService.generateAuditEvent(\"ast-configuration.click\", { 'configuration': JSON.stringify(this.config) });\n this._update.emit(this.config);\n }\n\n /**\n * Cancel the current changes\n */\n cancel() {\n this._cancel.emit(this.chatService.assistantConfig$.value);\n }\n}\n","<div class=\"sq-chat-settings\" *ngIf=\"isAdmin || config.uiSettings.display\">\n <div class=\"settings-panel p-2 small\" *ngIf=\"config\">\n\n <h5 *ngIf=\"hasModel\">{{ 'chatSettings.model' | transloco }}</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.servicesModels\">\n <label for=\"gllmModel\" class=\"form-label\">{{ 'chatSettings.model' | transloco }}</label>\n <select class=\"form-select\" id=\"gllmModel\" [(ngModel)]=\"selectedModel\" (ngModelChange)=\"onChatModelChange($event)\">\n <option *ngFor=\"let model of chatService.models\" [ngValue]=\"model\">{{model.name}}</option>\n </select>\n </div>\n\n <div class=\"mb-4\" *ngIf=\"isAdmin || config.uiSettings.functions\">\n <label for=\"gllmFunctions\" class=\"form-label\">{{ 'chatSettings.functions' | transloco }}</label>\n <div id=\"gllmFunctions\" *ngFor=\"let func of functions\" class=\"multi-option form-check form-switch\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" [id]=\"func.name\" [(ngModel)]=\"func.enabled\"\n (ngModelChange)=\"toggleFunctionsSelection(func.name)\">\n <label class=\"form-label\" [for]=\"func.name\" [title]=\"getFunctionDescription(func.name)\">{{ func.name }}</label>\n </div>\n </div>\n\n <div class=\"form-check form-switch mb-2\" *ngIf=\"showDebugToggle\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"debug\" [(ngModel)]=\"config.defaultValues.debug\">\n <label class=\"form-check-label\" for=\"debug\">{{ 'chatSettings.debug' | transloco }}</label>\n </div>\n\n <details *ngIf=\"hasAdvancedParameters\">\n <summary>{{ 'chatSettings.advancedParameters' | transloco }}</summary>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.temperature\">\n <label for=\"temperature\" class=\"form-label\">{{ 'chatSettings.temperature' | transloco }}: {{config.defaultValues.temperature}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"2\" step=\"0.1\" id=\"temperature\"\n [(ngModel)]=\"config.defaultValues.temperature\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.top_p\">\n <label for=\"top-p\" class=\"form-label\">{{ 'chatSettings.topP' | transloco }}: {{config.defaultValues.top_p}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"1\" step=\"0.05\" id=\"top-p\"\n [(ngModel)]=\"config.defaultValues.top_p\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.max_tokens\">\n <label for=\"max-tokens\" class=\"form-label\">{{ 'chatSettings.MaxGeneratedTokens' | transloco }}:\n {{config.defaultValues.max_tokens}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"1\" max=\"2048\" step=\"1\" id=\"max-tokens\"\n [(ngModel)]=\"config.defaultValues.max_tokens\">\n </div>\n </details>\n\n <hr>\n\n <h5 *ngIf=\"hasPrompts\">{{ 'chatSettings.Prompts' | transloco }}</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displaySystemPrompt\">\n <label for=\"initialSystemPrompt\" class=\"form-label\">{{ 'chatSettings.systemPrompt' | transloco }}</label>\n <textarea class=\"form-control\" id=\"initialSystemPrompt\" [(ngModel)]=\"config.defaultValues.systemPrompt\"></textarea>\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displayUserPrompt\">\n <label for=\"initialUserPrompt\" class=\"form-label\">{{ 'chatSettings.initialUserPrompt' | transloco }}</label>\n <textarea class=\"form-control\" id=\"initialUserPrompt\" [(ngModel)]=\"config.defaultValues.userPrompt\"></textarea>\n </div>\n\n </div>\n\n <div class=\"buttons-panel d-flex justify-content-end\">\n <button class=\"btn btn-light me-1\" (click)=\"cancel()\">{{ 'chatSettings.cancel' | transloco }}</button>\n <button class=\"btn btn-primary\" *ngIf=\"config\" (click)=\"save()\">{{ 'chatSettings.save' | transloco }}</button>\n </div>\n\n</div>\n","import { OnChanges, Component, Input, SimpleChanges } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Chart, registerables } from 'chart.js'\n\nChart.register(...registerables);\n\n@Component({\n selector: 'sq-assistant-chart',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './chart.component.html',\n styleUrls: ['./chart.component.css']\n})\nexport class ChartComponent implements OnChanges {\n @Input() rawChartData: string;\n\n public chart: Chart;\n private debounceTimer: any;\n\n constructor() { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['rawChartData']) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => this.initializeChart(), 300);\n }\n }\n\n private initializeChart() {\n Chart.getChart('chart-canvas')?.destroy();\n\n const canvasElement = document.getElementById('chart-canvas');\n\n if(canvasElement){\n try{\n const chartInput = this.rawChartData.match(/<chartjs>({[\\s\\S]*?)<\\/chartjs>/)?.[1]?.trim().replace(/'/g, '\"') as string;\n const chartConfig = JSON.parse(chartInput);\n\n this.chart = new Chart('chart-canvas', chartConfig);\n\n } catch (error) {\n console.error('Invalid chart configuration, check the assistant configuration: ', error);\n }\n\n }\n else {\n console.error('Chart Canvas is not found');\n }\n }\n}\n","<div class=\"chart-container\">\n <canvas id=\"chart-canvas\">{{ chart }}</canvas>\n</div>\n","export interface IconFormat {\n icon: string;\n color?: string;\n}\n\nexport const defaultFormatIcons: Record<string, IconFormat> = {\n \"extractslocations\": { icon: \"far fa-file-alt\" },\n \"matchlocations\": { icon: \"far fa-flag\" },\n \"geo\": { icon: \"fas fa-map-marker-alt\" },\n \"person\": { icon: \"fas fa-user\" },\n \"company\": { icon: \"fas fa-building\" },\n \"title\": { icon: \"fas fa-tag\" },\n \"modified\": { icon: \"far fa-calendar-alt\" },\n \"size\": { icon: \"fas fa-weight-hanging\" },\n \"treepath\": { icon: \"fas fa-folder-open\" },\n \"filename\": { icon: \"far fa-file-alt\" },\n \"authors\": { icon: \"fas fa-user-edit\" },\n \"accesslists\": { icon: \"fas fa-lock\" },\n \"doctype\": { icon: \"far fa-file\" },\n \"documentlanguages\": { icon: \"fas fa-globe-americas\" },\n \"globalrelevance\": { icon: \"far fa-star\" },\n \"indexationtime\": { icon: \"fas fa-search\" },\n \"concepts\": { icon: \"far fa-comment-dots\" },\n \"keywords\": { icon: \"fas fa-tags\" },\n \"matchingpartnames\": { icon: \"fas fa-align-left\" },\n \"msgfrom\": { icon: \"fas fa-envelope\" },\n \"msgto\": { icon: \"fas fa-envelope-open-text\" },\n\n \"file\": { icon: \"far fa-file\" },\n \"htm\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"html\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"xhtm\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"xhtml\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"mht\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"doc\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"docx\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"docm\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dot\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dotx\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dotm\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"rtf\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"odt\": { icon: \"far fa-file-word\", color: 'grey' },\n \"ott\": { icon: \"far fa-file-word\", color: 'grey' },\n \"gdoc\": { icon: \"far fa-file-word\", color: 'blue' },\n \"xls\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlsx\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlt\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xltx\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlsm\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xltm\": { icon: \"far fa-file-excel\", color: 'green' },\n \"gsheet\": { icon: \"far fa-file-excel\", color: 'darkgreen' },\n \"ods\": { icon: \"far fa-file-excel\", color: 'lightgreen' },\n \"ots\": { icon: \"far fa-file-excel\", color: 'lightgreen' },\n \"ppt\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptm2\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pps\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"ppsx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"ppsm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pot\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"potx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"potm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"odp\": { icon: \"far fa-file-powerpoint\", color: 'red' },\n \"otp\": { icon: \"far fa-file-powerpoint\", color: 'red' },\n \"gslides\": { icon: \"far fa-file-powerpoint\", color: 'orange' },\n \"pdf\": { icon: \"far fa-file-pdf\", color: '#ec2e2e' },\n \"jpg\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"jpeg\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"bmp\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"tiff\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"tif\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"gif\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"png\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"mp4\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"flv\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"swf\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mts\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"divx\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"wmv\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"avi\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mov\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mpg\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mpeg\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"asf\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"rm\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mp3\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"wav\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"ogg\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"wma\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"aac\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"m3u\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"txt\": { icon: \"far fa-file-alt\", color: '#202020' },\n \"text\": { icon: \"far fa-file-alt\", color: '#202020' },\n \"xml\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"cs\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"java\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"cpp\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"c\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"h\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"hpp\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"js\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"ts\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"zip\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"7zip\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"7z\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"rar\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"gz\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"notes\": { icon: \"fas fa-file-invoice\", color: 'orange' },\n \"quickr\": { icon: \"fas fa-file-invoice\", color: 'orange' },\n \"email\": { icon: \"far fa-envelope\", color: 'black' },\n \"mail\": { icon: \"far fa-envelope\", color: 'black' },\n \"msg\": { icon: \"far fa-envelope\", color: 'black' },\n \"mdb\": { icon: \"far fa-database\", color: 'purple' },\n \"odb\": { icon: \"far fa-database\", color: 'darkred' },\n \"otb\": { icon: \"far fa-database\", color: 'darkred' },\n \"xsn\": { icon: \"fas fa-file-excel\", color: 'purple' },\n \"gform\": { icon: \"fas fa-file-excel\", color: 'purple' },\n \"one\": { icon: \"far fa-book\", color: 'purple' },\n \"odf\": { icon: \"fas fa-file-medical-alt\", color: 'grey' },\n \"otf\": { icon: \"fas fa-file-medical-alt\", color: 'grey' },\n \"vsdx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vtx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vdx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vssx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vstx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsdm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vssm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vstm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vdw\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsd\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vss\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vst\": { icon: \"far fa-object-group\", color: 'purple' },\n \"odg\": { icon: \"far fa-object-group\", color: 'orange' },\n \"otg\": { icon: \"far fa-object-group\", color: 'orange' },\n \"gdraw\": { icon: \"far fa-object-group\", color: 'red' },\n \"pub\": { icon: \"far fa-object-group\", color: 'darkgreen' },\n \"ldap\": { icon: \"far fa-users\", color: 'brown' },\n \"ad\": { icon: \"far fa-users\", color: 'brown' },\n \"mmp\": { icon: \"fas fa-file-medical\", color: 'grey' },\n \"mppx\": { icon: \"fas fa-file-medical\", color: 'grey' },\n}","import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';\nimport { defaultFormatIcons } from './icons';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'sq-format-icon',\n templateUrl: './format-icon.component.html',\n encapsulation: ViewEncapsulation.None,\n standalone: true,\n imports: [CommonModule]\n})\nexport class FormatIconComponent implements OnChanges {\n\n @Input() extension: string;\n\n private _formatIcons = defaultFormatIcons;\n \n icon: string;\n\n ngOnChanges() {\n const icon = this.extension ? this._formatIcons[this.extension] : undefined;\n this.icon = icon?.icon || this._formatIcons.file.icon;\n }\n\n}\n","<span *ngIf=\"icon\" class=\"{{icon}}\"></span>","import { Component, ChangeDetectionStrategy, TemplateRef } from '@angular/core';\r\nimport { animate, style, transition, trigger } from '@angular/animations';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\n\r\n/**\r\n * Internal component that wraps the tooltip's content\r\n */\r\n@Component({\r\n selector: 'sqx-tooltip',\r\n standalone: true,\r\n styleUrls: ['./tooltip.component.scss'],\r\n imports: [NgTemplateOutlet],\r\n template: `\r\n <ng-container *ngTemplateOutlet=\"template || defaultTpl; context: {$implicit: data}\"></ng-container>\r\n <ng-template #defaultTpl let-data>\r\n <div class=\"sq-tooltip {{tooltipClass}}\" @tooltip [innerHTML]=\"data\"></div>\r\n </ng-template>`,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [\r\n trigger('tooltip', [\r\n transition(':enter', [\r\n style({ opacity: 0 }),\r\n animate(300, style({ opacity: 1 })),\r\n ]),\r\n transition(':leave', [\r\n animate(300, style({ opacity: 0 })),\r\n ]),\r\n ]),\r\n ],\r\n})\r\nexport class TooltipComponent<T=string> {\r\n data?: T;\r\n template?: TemplateRef<any>;\r\n tooltipClass?: string;\r\n}\r\n","import {\r\n Directive,\r\n ElementRef,\r\n HostBinding,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n TemplateRef\r\n} from \"@angular/core\";\r\nimport {\r\n ConnectedPosition,\r\n Overlay,\r\n OverlayPositionBuilder,\r\n OverlayRef\r\n} from \"@angular/cdk/overlay\";\r\nimport { ComponentPortal } from \"@angular/cdk/portal\";\r\nimport { TooltipComponent } from \"./tooltip.component\";\r\n\r\nimport { Observable, of, Subscription, delay } from \"rxjs\";\r\n\r\nexport type Placement = \"top\" | \"bottom\" | \"right\" | \"left\";\r\n/**\r\n * Directive that attaches a tooltip to the host element\r\n *\r\n * @example\r\n * <div sqTooltip=\"This is a tooltip's text\"></div>\r\n *\r\n * @example\r\n * // A template can be passed to the directive instead of a string. Here 'tooltip' is a template reference\r\n * <div sqTooltip=\"tooltip\"></div>\r\n *\r\n * <ng-template #tooltip>\r\n * <h2>Title</h2>\r\n * <p>{{ \"this is a comment\" | uppercase }}</p>\r\n * <h3>Other text</h3>\r\n * </ng-template>\r\n *\r\n * @example\r\n * //HTML can be used directly (not recommanded)\r\n * <div sqTooltip=\"<h1>Title</h1><br><p>This is a comment</p>\"></div>\r\n */\r\n@Directive({\r\n selector: \"[sqTooltip]\",\r\n standalone: true\r\n})\r\nexport class TooltipDirective<TooltipData=undefined, TooltipDisplay=string> implements OnDestroy {\r\n /**\r\n * Defining a property called textOrTemplate that can be a string, a function that\r\n * returns an Observable of a string or undefined, or a TemplateRef.\r\n */\r\n @Input(\"sqTooltip\") value?: TooltipDisplay | ((data?: TooltipData) => Observable<TooltipDisplay | undefined> | undefined);\r\n @Input(\"sqTooltipData\") data?: TooltipData;\r\n @Input(\"sqTooltipTemplate\") template?: TemplateRef<any>;\r\n\r\n /**\r\n * Setting the default value of the placement property to `bottom`\r\n */\r\n @Input() placement: Placement = \"bottom\";\r\n /**\r\n * List of fallback placement if *Placement* defined can't be applyied\r\n */\r\n @Input() fallbackPlacements: Placement[] = [];\r\n\r\n /**\r\n * Delay in millisecond before showing/hiding the tooltip.\r\n *\r\n * Default value is 300ms\r\n */\r\n @Input() delay = 300;\r\n /**\r\n * If the tooltip should stay opened on hover\r\n */\r\n @Input() hoverableTooltip = false;\r\n /**\r\n * Custom class for the tooltip\r\n */\r\n @Input() tooltipClass?: string;\r\n\r\n /**\r\n * Applies the \"has-tooltip\" class to its host when displayed\r\n */\r\n @HostBinding('class.has-tooltip') hasTooltip = false;\r\n\r\n private overlayRef: OverlayRef;\r\n private subscription?: Subscription;\r\n private clearTimeout?: any;\r\n static activeTooltip?: TooltipDirective<any, any>;\r\n\r\n constructor(\r\n private overlay: Overlay,\r\n private overlayPositionBuilder: OverlayPositionBuilder,\r\n private elementRef: ElementRef\r\n ) { }\r\n\r\n ngOnDestroy() {\r\n // do not forget to clear timeout function\r\n this.clear();\r\n }\r\n\r\n @HostListener(\"mouseenter\")\r\n show() {\r\n // The tooltip is already showing: just cancel the hiding\r\n if (this.clearTimeout) {\r\n this.cancelHide();\r\n return;\r\n }\r\n\r\n this.clear();\r\n\r\n if (!this.value) return;\r\n\r\n const obs = typeof this.value === 'function'\r\n ? (this.value as (data?: TooltipData) => Observable<TooltipDisplay | undefined> | undefined)(this.data)\r\n : of(this.value).pipe(delay(this.delay));\r\n\r\n this.subscription = obs?.subscribe(data => {\r\n\r\n // return when value is empty\r\n if (!data || (typeof data === 'string' && !data.trim())) return;\r\n\r\n this.clear();\r\n\r\n TooltipDirective.activeTooltip?.clear();\r\n TooltipDirective.activeTooltip = this;\r\n\r\n // set the tooltip's position strategy\r\n const positionStrategy = this.overlayPositionBuilder\r\n .flexibleConnectedTo(this.elementRef)\r\n .withPositions([this.position(), ...this.fallbackPositions()]);\r\n\r\n const scrollStrategy = this.overlay.scrollStrategies.close();\r\n this.overlayRef = this.overlay.create({ positionStrategy, scrollStrategy });\r\n\r\n // instance of the tooltip's component\r\n const tooltipRef = this.overlayRef.attach(new ComponentPortal(TooltipComponent<TooltipDisplay>));\r\n\r\n tooltipRef.instance.data = data;\r\n\r\n if (this.template) {\r\n tooltipRef.instance.template = this.template;\r\n }\r\n if (this.tooltipClass) {\r\n tooltipRef.instance.tooltipClass = this.tooltipClass;\r\n }\r\n\r\n if (this.hoverableTooltip) {\r\n this.overlayRef.overlayElement.addEventListener(\"mouseenter\", () => this.cancelHide());\r\n this.overlayRef.overlayElement.addEventListener('mouseleave', () => this.hide());\r\n }\r\n\r\n this.hasTooltip = true;\r\n });\r\n }\r\n\r\n @HostListener(\"mousedown\")\r\n mouseClick() {\r\n this.clear();\r\n }\r\n\r\n @HostListener(\"mouseleave\")\r\n hide() {\r\n if (!this.clearTimeout) {\r\n this.clearTimeout = setTimeout(() => this.clear(), this.hoverableTooltip ? this.delay : 10);\r\n }\r\n }\r\n\r\n cancelHide() {\r\n if (this.clearTimeout) {\r\n clearTimeout(this.clearTimeout);\r\n this.clearTimeout = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Clear timeout function and detach overlayRef\r\n */\r\n clear() {\r\n this.subscription?.unsubscribe();\r\n this.cancelHide();\r\n this.overlayRef?.detach();\r\n this.hasTooltip = false;\r\n }\r\n\r\n position(placement = this.placement): ConnectedPosition {\r\n switch (placement) {\r\n case \"bottom\":\r\n return {\r\n originX: \"center\",\r\n originY: \"bottom\",\r\n overlayX: \"center\",\r\n overlayY: \"top\",\r\n offsetY: 2\r\n };\r\n case \"right\":\r\n return {\r\n originX: \"end\",\r\n originY: \"center\",\r\n overlayX: \"start\",\r\n overlayY: \"center\",\r\n offsetX: 2\r\n };\r\n case \"left\":\r\n return {\r\n originX: \"start\",\r\n originY: \"center\",\r\n overlayX: \"end\",\r\n overlayY: \"center\",\r\n offsetX: -2\r\n };\r\n default:\r\n return {\r\n originX: \"center\",\r\n originY: \"top\",\r\n overlayX: \"center\",\r\n overlayY: \"bottom\",\r\n offsetY: -2\r\n };\r\n }\r\n }\r\n\r\n fallbackPositions(): ConnectedPosition[] {\r\n return Array.from(this.fallbackPlacements).map(p => this.position(p));\r\n }\r\n\r\n}\r\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from '../format-icon/format-icon.component';\nimport { ChatContextAttachment, DocumentPart } from '../types';\nimport { TooltipDirective } from '../tooltip/tooltip.directive';\n\n@Component({\n selector: 'sq-chat-reference',\n templateUrl: './chat-reference.component.html',\n styleUrls: ['./chat-reference.component.scss'],\n standalone: true,\n imports: [CommonModule, FormatIconComponent, TooltipDirective, TranslocoPipe],\n providers: [provideTranslocoScope('chat-reference')],\n})\nexport class ChatReferenceComponent {\n\n @Input() reference: string;\n @Input() attachment: ChatContextAttachment;\n @Input() partId?: number;\n\n @Output() openDocument = new EventEmitter<ChatContextAttachment>();\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n\n get parts(): DocumentPart[] {\n if (!this.attachment) return [];\n return this.attachment.parts.filter(part => (!this.partId || part.partId === this.partId) && !!part.text);\n }\n\n expandAttachment() {\n if (this.partId) return;\n this.attachment['$expanded'] = !this.attachment['$expanded'];\n }\n}\n","<div [class.reference-tooltip]=\"!!partId\">\n <div class=\"reference-data\" [class.expanded]=\"attachment['$expanded'] || !!partId\" (click)=\"expandAttachment()\">\n <span class=\"reference me-1\">{{reference}}</span>\n <sq-format-icon [extension]=\"attachment.record.fileext\"></sq-format-icon>\n <a [id]=\"'attachment-'+attachment.recordId\">\n {{attachment.record.title}}\n </a>\n <i class=\"fas fa-eye\" (click)=\"$event.stopPropagation(); openPreview.emit(attachment)\" [sqTooltip]=\"!partId ? ('chatReference.previewDocument' | transloco) : ''\"></i>\n <i class=\"fas fa-arrow-up-right-from-square\" *ngIf=\"attachment.record.url1 || attachment.record.originalUrl\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment)\" [sqTooltip]=\"!partId ? ('chatReference.openDocument' | transloco) : ''\">\n </i>\n </div>\n <div class=\"reference-passages\" *ngIf=\"!!partId || (attachment['$expanded']) && parts.length\">\n <div class=\"reference-passage\" *ngFor=\"let part of parts\">\n <span class=\"reference me-1\">{{reference}}.{{part.partId}}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n </div>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport SafeColor from 'safecolor'\n\n@Component({\n selector: 'sq-initials-avatar',\n templateUrl: './initials-avatar.component.html',\n styleUrls: ['./initials-avatar.component.scss'],\n standalone: true,\n imports: [CommonModule]\n})\nexport class InitialsAvatarComponent {\n\n @Input() fullName: string = '';\n @Input() size: number = 1.5; // in rem\n\n /**\n * Gives initials of a name and a safe color background to use,\n * assuming text color will be white\n * @param fullName full name to evaluate intials for\n * @param split string to use has splitter for `fullName`\n * @returns an `object` containing initials and color\n */\n getInitialsAndColorFromFullName(fullName: string, split: string = ' '): { initials: string; color: string } {\n return { initials: this.getInitialsFromFullName(fullName, split), color: this.getColorFromName(fullName) };\n }\n\n /**\n * Gives initials of a name, ie:\n * ```\n * getInitialForFullName('John Snow') => 'JS'\n * getInitialForFullName('Geralt of Rivia', ' of ') => 'GR'\n * ```\n * @param fullName full name to evaluate intial for\n * @param split string to use has splitter\n * @returns string containg the first letter of splitted name\n */\n getInitialsFromFullName(fullName: string, split: string = ' '): string {\n if (!fullName) return '';\n\n const names = fullName.split(split);\n return names[0][0] + (names[1]?.[0] ?? '');\n }\n\n /**\n * Gets a random color using text as seed\n * @param text string to use for color generation\n * @returns string formatted like `rgb(xxx, xxx, xxx)`\n */\n getColorFromName(text: string): string {\n const safeColor = new SafeColor({\n color: [255, 255, 255],\n contrast: 4.5\n });\n\n return safeColor.random(text);\n }\n\n}\n","<span class=\"sq-initials-avatar\" *ngIf=\"getInitialsAndColorFromFullName(fullName) as meta\"\n [ngStyle]=\"{ 'background-color': meta.color }\" [style.height.rem]=\"size\" [style.width.rem]=\"size\"\n [style.line-height.rem]=\"size\" [style.font-size.rem]=\"size/2\">\n {{ meta.initials | uppercase }}\n</span>","import { Pipe, PipeTransform } from \"@angular/core\";\nimport { MessageContent, RawMessageContent, TextMessageContent } from \"../types/message-content.types\";\n\n/**\n * Pipe to extract the content of a message\n * Main role is to support how to render each type of message directly from the template\n * \n * @param messageContent The message content to extract\n * \n * @returns The content of the message\n */\n@Pipe({\n name: \"messageContent\",\n standalone: true,\n})\nexport class MessageContentPipe implements PipeTransform {\n transform(messageContent: RawMessageContent): string {\n if (typeof messageContent === \"string\") return messageContent;\n\n if (!Array.isArray(messageContent)) {\n if (!!messageContent['type'] && messageContent['type'] === \"text\") return (messageContent as TextMessageContent).text;\n\n throw new Error(\n \"Invalid message format, should be an Array of element, got content as\" +\n typeof messageContent\n );\n }\n \n const content = messageContent[0] as MessageContent;\n\n if (content.type === \"text\") return (content as TextMessageContent).text;\n\n console.error(\"Invalid message format, type of message not supported\" + typeof content.type);\n\n return '';\n }\n}\n","import { Component, ElementRef, input, output, viewChild } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from \"../format-icon/format-icon.component\";\nimport { RawAttachment } from \"../types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\n\n@Component({\n selector: \"InlineImageReference\",\n standalone: true,\n providers: [provideTranslocoScope('chat-references')],\n imports: [FormatIconComponent, TranslocoPipe],\n template: `\n <header>\n <span class=\"reference\">{{ id().split('.')[0] }}</span>\n\n <sq-format-icon [extension]=\"ref().article?.fileext\" />\n\n <p>{{ ref().article?.title ?? ('chatReferences.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReferences.openDocumentPreview' | transloco\" (click)=\"previewClicked()\">\n <i class=\"fas fa-eye\"></i>\n </a>\n\n @if (ref().article?.url1 || ref().article?.originalUrl) {\n <a role=\"button\" [title]=\"'chatReferences.openDocument' | transloco\" (click)=\"documentClicked()\">\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </a>\n }\n </header>\n\n @if (ref().url) {\n <div style=\"display: flex; align-items: start; gap: 0.25rem\">\n <span class=\"reference\">Img-{{ id() }}</span>\n\n <img [src]=\"ref().url\" (click)=\"modalClicked()\" [alt]=\"ref().description\" />\n </div>\n }\n\n <dialog #modal>\n <button class=\"close\" (click)=\"modalTpl()?.nativeElement?.close()\">\n <i class=\"fas fa-xmark\"></i>\n </button>\n\n <img [src]=\"ref().url\" [alt]=\"ref().description\"/>\n </dialog>\n `,\n styleUrls: [\"./inline-reference.scss\"],\n})\nexport class InlineImageReferenceComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openDocument = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openModal = output<void>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n previewClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openPreview.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n documentClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openDocument.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","import { Component, ElementRef, input, output, viewChild } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from \"../format-icon/format-icon.component\";\nimport { RawAttachment } from \"../types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\n\n@Component({\n selector: \"InlinePageReference\",\n standalone: true,\n providers: [provideTranslocoScope('references')],\n imports: [FormatIconComponent, TranslocoPipe],\n template: `\n <header>\n <span class=\"reference\">{{ id().split(\".\")[0] }}</span>\n\n <sq-format-icon [extension]=\"ref().article?.fileext\" />\n\n <p>{{ ref().article?.title ?? ('chatReferences.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReferences.openDocumentPreview' | transloco\" (click)=\"previewClicked()\">\n <i class=\"fas fa-eye\"></i>\n </a>\n\n @if (ref().article?.url1 || ref().article?.originalUrl) {\n <a role=\"button\" [title]=\"'chatReferences.openDocument' | transloco\" (click)=\"documentClicked()\">\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </a>\n }\n </header>\n\n @if (ref().url) {\n <div style=\"display: flex; align-items: start; gap: 0.25rem\">\n <span class=\"reference\">Page-{{ id() }}</span>\n\n <img [src]=\"ref().url\" (click)=\"modalClicked()\" [alt]=\"ref().description\" />\n </div>\n }\n\n <dialog #modal>\n <button class=\"close\" (click)=\"modalTpl()?.nativeElement?.close()\">\n <i class=\"fas fa-xmark\"></i>\n </button>\n\n <img [src]=\"ref().url\" [alt]=\"ref().description\" />\n </dialog>\n `,\n styleUrls: [\"./inline-reference.scss\"],\n})\nexport class InlinePageReferenceComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openDocument = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openModal = output<void>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n previewClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openPreview.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n documentClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openDocument.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","import { Content, Parent, Text } from \"mdast\";\nimport { Node } from \"unist\";\nimport { CONTINUE, visit } from \"unist-util-visit\";\n\nexport const EMBEDDED_IMAGE_NAME = \"embedded-image-reference\";\nconst EMBEDDED_IMAGE_REGEX = /\\[(Img-(\\d+(?:\\.\\d+)+))((?:\\:\\d{1,4}){4})?\\]/g;\n\nexport default function embeddedImageReferencePlugin(tree: Node) {\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n const refs = Array.from(node.value.matchAll(EMBEDDED_IMAGE_REGEX));\n\n if (refs.length === 0) return CONTINUE;\n\n const nodes = getContentNodes(node, refs);\n\n if (nodes.length === 0) return CONTINUE;\n\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length;\n });\n\n return tree;\n}\n\n/** Transform node text content into a set of node */ \nfunction getContentNodes(node: Text, refs: RegExpExecArray[]): Content[] {\n let nodes = refs.reduce((acc, ref) => {\n handleLeadingText(acc, node, ref);\n\n acc.push({\n type: EMBEDDED_IMAGE_NAME,\n value: ref[2],\n boundingBox: ref[3],\n end: ref.index + ref[0].length,\n } as any as Content & { end: number });\n\n return acc;\n }, [] as (Content & { end: number })[]) as Content[];\n\n handleTrailingText(node, refs, nodes);\n\n return nodes;\n}\n\n/** Compute last block ending for leading text */\nfunction handleLeadingText(\n acc: (Content & { end: number })[],\n node: Text,\n ref: RegExpExecArray\n): Content[] {\n const lastEnd = acc.at(-1)?.end ?? 0;\n const leadingText = node.value.substring(lastEnd, ref.index);\n\n if (leadingText !== \"\") {\n acc.push({\n type: \"text\",\n value: leadingText,\n end: ref.index,\n } as Content & { end: number });\n }\n\n return acc;\n}\n\n/** Compute last block ending for trailing text */\nfunction handleTrailingText(\n node: Text,\n refs: RegExpExecArray[],\n nodes: Content[]\n): void {\n const lastEnd = refs.at(-1)?.index ?? 0;\n const trailingText = node.value.substring(\n lastEnd + (refs.at(-1)?.[0].length ?? 0)\n );\n\n if (trailingText !== \"\") {\n nodes.push({\n type: \"text\",\n value: trailingText,\n end: node.value.length,\n } as Content & { end: number });\n }\n}\n","import { Content, Parent, Text } from \"mdast\";\nimport { Node } from \"unist\";\nimport { CONTINUE, visit } from \"unist-util-visit\";\n\nexport const EMBEDDED_PAGE_NAME = \"embedded-page-reference\";\nconst EMBEDDED_PAGE_REGEX = /\\[(Page-(\\d+\\.\\d+))\\]/g;\n\nexport default function embeddedPageReferencePlugin(tree: Node) {\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n const refs = Array.from(node.value.matchAll(EMBEDDED_PAGE_REGEX));\n\n if (refs.length === 0) return CONTINUE;\n\n const nodes = getContentNodes(node, refs);\n\n if (nodes.length === 0) return CONTINUE;\n\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length;\n });\n\n return tree;\n}\n\n/** Transform node text content into a set of node */ \nfunction getContentNodes(node: Text, refs: RegExpExecArray[]): Content[] {\n let nodes = refs.reduce((acc, ref) => {\n handleLeadingText(acc, node, ref);\n\n acc.push({\n type: EMBEDDED_PAGE_NAME,\n value: ref[2],\n boundingBox: ref[3],\n end: ref.index + ref[0].length,\n } as any as Content & { end: number });\n\n return acc;\n }, [] as (Content & { end: number })[]) as Content[];\n\n handleTrailingText(node, refs, nodes);\n\n return nodes;\n}\n\n/** Compute last block ending for leading text */\nfunction handleLeadingText(\n acc: (Content & { end: number })[],\n node: Text,\n ref: RegExpExecArray\n): Content[] {\n const lastEnd = acc.at(-1)?.end ?? 0;\n const leadingText = node.value.substring(lastEnd, ref.index);\n\n if (leadingText !== \"\") {\n acc.push({\n type: \"text\",\n value: leadingText,\n end: ref.index,\n } as Content & { end: number });\n }\n\n return acc;\n}\n\n/** Compute last block ending for trailing text */\nfunction handleTrailingText(\n node: Text,\n refs: RegExpExecArray[],\n nodes: Content[]\n): void {\n const lastEnd = refs.at(-1)?.index ?? 0;\n const trailingText = node.value.substring(\n lastEnd + (refs.at(-1)?.[0].length ?? 0)\n );\n\n if (trailingText !== \"\") {\n nodes.push({\n type: \"text\",\n value: trailingText,\n end: node.value.length,\n } as Content & { end: number });\n }\n}\n","import { Injectable } from \"@angular/core\";\r\n\r\nexport type NotificationType = \"success\" | \"warning\" | \"error\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class NotificationsService {\r\n success(message: string, title?: string) {\r\n this.dispatchEvent(\"success\", message, title);\r\n }\r\n\r\n warning(message: string, title?: string) {\r\n this.dispatchEvent(\"warning\", message, title);\r\n }\r\n\r\n error(message: string, title?: string) {\r\n this.dispatchEvent(\"error\", message, title);\r\n }\r\n\r\n private dispatchEvent(type: NotificationType, message: string, title?: string) {\r\n dispatchEvent(new CustomEvent(\"notification\", { detail: { type, title, message } }));\r\n }\r\n}\r\n","import { Clipboard } from \"@angular/cdk/clipboard\";\nimport { inject, Injectable } from \"@angular/core\";\nimport { TranslocoService } from \"@jsverse/transloco\";\n\nimport { NotificationsService } from \"./notification.service\";\n\n@Injectable({\n providedIn: \"root\",\n})\nexport class UIService {\n notificationsService = inject(NotificationsService);\n clipboard: Clipboard = inject(Clipboard);\n private readonly transloco = inject(TranslocoService);\n\n copyToClipboard(data: string, maxLength = 30) {\n if (!navigator?.clipboard) {\n // Note: CDK seems to struggle with large chunks of text\n this.copyToClipboardCdk(data, maxLength);\n } else {\n // Navigator built-in clipboard management\n navigator.clipboard.writeText(data).then(\n () => {\n this.notifySuccess(data, maxLength);\n },\n (err) => {\n this.notificationsService.warning(\n this.transloco.translate(\"chat.clipboard.fail\")\n );\n }\n );\n }\n }\n\n copyToClipboardCdk(data: string, maxLength = 30) {\n const pending = this.clipboard.beginCopy(data);\n let remainingAttempts = 3;\n const attempt = () => {\n const result = pending.copy();\n if (!result && --remainingAttempts) {\n setTimeout(attempt);\n } else {\n // Remember to destroy when you're done!\n pending.destroy();\n if (result) this.notifySuccess(data, maxLength);\n else\n this.notificationsService.warning(\n this.transloco.translate(\"chat.clipboard.fail\")\n );\n }\n };\n attempt();\n }\n\n notifySuccess(message: string, maxLength = 30) {\n const value =\n message.length > maxLength\n ? message.slice(0, maxLength) + \"...\"\n : message;\n const translated =\n this.transloco.translate(\"chat.clipboard.success\", { value });\n this.notificationsService.success(translated);\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\nimport { Content, Parent, Text } from \"mdast\";\nimport { RemarkModule } from \"ngx-remark\";\nimport \"prismjs-components-importer/esm\";\nimport \"prismjs/plugins/autoloader/prism-autoloader\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkParse from \"remark-parse\";\nimport { Processor, unified } from \"unified\";\nimport { Node } from \"unist\";\nimport { CONTINUE, EXIT, visit } from \"unist-util-visit\";\n\nimport { ChartComponent } from \"../charts/chart/chart.component\";\nimport { ChatReferenceComponent } from \"../chat-reference/chat-reference.component\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { MessageContentPipe } from \"../pipes/message-content.pipe\";\nimport { InlineImageReferenceComponent } from \"../references/inline-image-reference\";\nimport { InlinePageReferenceComponent } from \"../references/inline-page-reference\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { UIService } from \"../services/ui.service\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { ChatContextAttachment, ChatMessage, SuggestedAction } from \"../types\";\nimport { TextMessageContent } from \"../types/message-content.types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\nimport embeddedImageReferencePlugin from \"../unified-plugins/embedded-image-reference.plugin\";\nimport embeddedPageReferencePlugin from \"../unified-plugins/embedded-page-reference.plugin\";\n\ndeclare module Prism {\n function highlightAllUnder(el: HTMLElement): void;\n}\n\n@Component({\n selector: \"sq-chat-message\",\n templateUrl: \"./chat-message.component.html\",\n styleUrls: [\"./chat-message.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n TooltipDirective,\n RemarkModule,\n InitialsAvatarComponent,\n ChatReferenceComponent,\n ChartComponent,\n MessageContentPipe,\n InlineImageReferenceComponent,\n InlinePageReferenceComponent,\n TranslocoPipe\n ],\n providers: [provideTranslocoScope('chat-message')],\n})\nexport class ChatMessageComponent implements OnChanges, AfterViewInit {\n @Input() message: ChatMessage;\n @Input() conversation: ChatMessage[];\n @Input() suggestedActions: SuggestedAction[] | undefined;\n @Input() assistantMessageIcon: string;\n @Input() userMessageIcon: string;\n @Input() connectionErrorMessageIcon: string;\n @Input() searchWarningMessageIcon: string;\n @Input() streaming: boolean;\n @Input() canEdit: boolean = false;\n @Input() canRegenerate: boolean = false;\n @Input() canCopy: boolean = false;\n @Input() canDebug: boolean = false;\n @Input() canLike: boolean = false;\n @Input() canDislike: boolean = false;\n @Output() openDocument = new EventEmitter<{\n reference: ChatContextAttachment;\n partId?: number;\n }>();\n @Output() openPreview = new EventEmitter<{\n reference: ChatContextAttachment;\n partId?: number;\n }>();\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n @Output() edit = new EventEmitter<ChatMessage>();\n @Output() copy = new EventEmitter<ChatMessage>();\n @Output() regenerate = new EventEmitter<ChatMessage>();\n @Output() like = new EventEmitter();\n @Output() dislike = new EventEmitter();\n @Output() debug = new EventEmitter<ChatMessage>();\n\n processor: Processor;\n\n references: string[] = [];\n referenceMap = new Map<string, ChatContextAttachment>();\n imageReferencesMap = new Map<string, MessageImageReference>();\n pageReferencesMap = new Map<string, MessageImageReference>();\n showReferences: boolean = true;\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n constructor(\n public ui: UIService,\n public principalService: PrincipalService,\n public cdr: ChangeDetectorRef,\n public el: ElementRef\n ) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.streaming) {\n this.collapseProgress = !this.streaming;\n }\n\n if (this.message?.role === \"assistant\") {\n this.references = [];\n this.referenceMap.clear();\n for (let m of this.conversation) {\n if (\n m.additionalProperties.$attachment &&\n m.additionalProperties.$attachment.length > 0\n ) {\n for (const attachment of m.additionalProperties.$attachment) {\n // skip empty attachment\n if (!attachment) continue;\n\n this.referenceMap.set(\"\" + attachment.contextId, {\n ...attachment,\n $partId: attachment.parts?.[0]?.partId,\n });\n if (!!attachment.parts && attachment.parts.length > 0) {\n for (let i = 0; i < attachment.parts.length; i++) {\n const refId = `${attachment.contextId}.${attachment.parts[i].partId}`;\n this.referenceMap.set(refId, {\n ...attachment,\n $partId: attachment.parts?.[i]?.partId,\n });\n }\n }\n }\n }\n\n this.processMessageType(m);\n }\n\n this.processor = unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(() => this.referencePlugin)\n .use(() => embeddedImageReferencePlugin)\n .use(() => embeddedPageReferencePlugin);\n\n if (this.streaming) {\n this.processor = this.processor.use(() => this.placeholderPlugin);\n }\n }\n }\n\n ngAfterViewInit(): void {\n Prism?.highlightAllUnder?.(this.el.nativeElement);\n }\n\n getEmbeddedImageReference(ref: string): MessageImageReference | undefined {\n const [doc, part, image] = ref.split(\".\");\n const images = this.referenceMap.get(doc)?.parts?.[+part - 1]?.images;\n\n if (!images || images.length === 0 || typeof images[0] !== \"object\")\n return undefined;\n\n const messageImageReference: MessageImageReference = Object.assign(\n {\n article: this.referenceMap.get(doc)?.record,\n articleId: this.referenceMap.get(doc)?.recordId,\n },\n images[+image - 1]\n );\n\n // save reference in map for reference list\n if (!this.imageReferencesMap.has(ref))\n this.imageReferencesMap.set(ref, messageImageReference);\n\n return messageImageReference;\n }\n\n getEmbeddedPageReference(ref: string): MessageImageReference | undefined {\n const [doc, page] = ref.split(\".\");\n const pageRef = this.referenceMap.get(doc)?.pages?.find(x => x.pageNumber === +page);\n \n if (!pageRef || typeof pageRef !== \"object\") return undefined;\n\n const messagePageReference: MessageImageReference = Object.assign(\n {\n article: this.referenceMap.get(doc)?.record,\n articleId: this.referenceMap.get(doc)?.recordId,\n },\n pageRef\n );\n\n // save reference in map for reference list\n if (!this.pageReferencesMap.has(ref))\n this.pageReferencesMap.set(ref, messagePageReference);\n\n return messagePageReference;\n }\n\n get name(): string {\n return !this.principalService.principal\n ? \"\"\n : (this.principalService.principal[\"fullName\"] as string) ||\n this.principalService.principal.name;\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n processMessageType(message: ChatMessage) {\n // Process message type when spec is done\n // nop for new message types\n if (typeof message.content !== \"string\") return;\n\n // Legacy message type\n if (message.content.startsWith(\"<chartjs>\")) {\n message.messageType = \"CHART\";\n } else {\n message.messageType = \"MARKDOWN\";\n }\n }\n\n /**\n * This Unified plugin looks a text nodes and replaces any reference in the\n * form [1], [2.3], etc. with custom nodes of type \"chat-reference\".\n */\n referencePlugin = (tree: Node) => {\n const references = new Set<number>();\n\n // Visit all text nodes\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n let text = node.value;\n\n text = this.reformatReferences(text);\n const matches = this.getReferenceMatches(text);\n\n // Quit if no references were found\n if (matches.length === 0) {\n return CONTINUE;\n }\n\n const nodes: (Content & { end: number })[] = [];\n\n for (const match of matches) {\n const refId = match[1].trim();\n const [ref] = refId.split(\".\");\n // We find a valid reference in the text\n if (!isNaN(+ref)) {\n references.add(+ref); // Add it to the set of used references\n\n // If needed, insert a text node before the reference\n const current = nodes.at(-1) ?? { end: 0 };\n if (match.index! > current.end) {\n nodes.push({\n type: \"text\",\n value: text.substring(current.end, match.index!),\n end: match.index!,\n });\n }\n\n // Add a custom reference node\n nodes.push({\n type: \"chat-reference\",\n refId,\n end: match.index! + match[0].length,\n } as any);\n }\n }\n\n // Quit if no references were found\n if (nodes.length === 0) {\n return CONTINUE;\n }\n\n if (nodes.at(-1)!.end < text.length) {\n nodes.push({\n type: \"text\",\n value: text.substring(nodes.at(-1)!.end, text.length),\n end: text.length,\n });\n }\n\n // Delete the current text node from the parent and replace it with the new nodes\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length; // Visit the next node after the inserted ones\n });\n\n if (references.size > 0) {\n this.references = Array.from(references.values())\n .sort((a, b) => a - b)\n .map((r) => \"\" + r);\n this.cdr.detectChanges();\n }\n\n return tree;\n };\n\n placeholderPlugin = (tree: Node) => {\n visit(\n tree,\n \"text\",\n (node: Text, index: number, parent: Parent) => {\n parent.children.push({ type: \"streaming-placeholder\" } as any);\n return EXIT;\n },\n true\n );\n\n return tree;\n };\n\n getLinkText(node: any): string {\n if (node.text) {\n return node.text; // Return directly if text is provided in node.text ([Example link](https://example.com))\n } else if (node.children && node.children.length > 0) {\n // Recursively search for text content in child nodes\n for (const child of node.children) {\n if (child.type === \"text\" && child.value) {\n return child.value; // Return the value of the first text node found ([**Emphasized Link Text**](https://example.com))\n } else if (child.children && child.children.length > 0) {\n const textContent = this.getLinkText(child); // Recursively search child nodes ([](https://example.com))\n if (textContent) {\n return textContent; // Return text content if found\n }\n }\n }\n }\n return \"link\"; // Return empty string if no text content is found\n }\n\n /**\n * Reformat [ids: 12.2, 42.5] to [12.2][42.5]\n */\n reformatReferences(content: string) {\n return content.replace(\n /\\[(?:ids?:?\\s*)?(?:documents?:?\\s*)?(\\s*(?:,?\\s*\\d+(?:\\.\\d+)?(?:\\.part)?\\s*)+)\\]/g,\n (str, match: string) =>\n `[${match\n .replace(/\\.part/g, \"\")\n .split(\",\")\n .join(\"] [\")}]`\n );\n }\n\n /**\n * Match all references in a given message\n */\n getReferenceMatches(content: string) {\n return Array.from(content.matchAll(/\\[(\\s*\\d+(?:\\.\\d+)?\\s*)\\]/g));\n }\n\n private _copyToClipboard(content: string) {\n this.ui.copyToClipboard(content);\n }\n\n copyMessage(message: ChatMessage) {\n let content: string = \"\";\n\n if (typeof message.content === \"string\")\n content = message.content;\n else if (Array.isArray(message.content))\n content = (message.content[0] as TextMessageContent).text;\n else {\n console.error(\"Unsupported message content type\", typeof message.content);\n return;\n }\n \n content = content.replaceAll(/\\s+\\[.+?\\]/g, \"\");\n\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n copyCode(code: string) {\n this._copyToClipboard(code);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment, partId?: number) {\n this.openPreview.emit({ reference: attachment, partId });\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment, partId?: number) {\n this.openDocument.emit({ reference: attachment, partId });\n this.hideTooltip();\n }\n\n hideTooltip(): void {\n this.hiddenTooltip = true;\n setTimeout(() => {\n this.hiddenTooltip = false;\n });\n }\n}\n","<!-- Message icon -->\n<span class=\"message-icon\" [title]=\"message?.role\">\n <i class=\"d-block\" [style.width.px]=\"iconSize\" *ngIf=\"!message\"></i>\n <ng-container [ngSwitch]=\"message?.role\">\n <!-- For 'assistant' -->\n <i *ngSwitchCase=\"'assistant'\" [ngClass]=\"assistantMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n\n <!-- For 'user' -->\n <ng-container *ngSwitchCase=\"'user'\">\n <i *ngIf=\"!!userMessageIcon; else initialsAvatar\" [ngClass]=\"userMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #initialsAvatar>\n <sq-initials-avatar [fullName]=\"name\"></sq-initials-avatar>\n </ng-template>\n </ng-container>\n\n <!-- For 'connection-error' -->\n <ng-container *ngSwitchCase=\"'connection-error'\">\n <i *ngIf=\"!!connectionErrorMessageIcon; else defaultErrorIcon\" [ngClass]=\"connectionErrorMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #defaultErrorIcon>\n <svg [style.--sq-size.px]=\"iconSize\" class=\"connection-error\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path fill=\"currentColor\" d=\"M17.1 292c-12.9-22.3-12.9-49.7 0-72L105.4 67.1c12.9-22.3 36.6-36 62.4-36l176.6 0c25.7 0 49.5 13.7 62.4 36L494.9 220c12.9 22.3 12.9 49.7 0 72L406.6 444.9c-12.9 22.3-36.6 36-62.4 36l-176.6 0c-25.7 0-49.5-13.7-62.4-36L17.1 292zM256 128c-13.3 0-24 10.7-24 24l0 112c0 13.3 10.7 24 24 24s24-10.7 24-24l0-112c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z\"/>\n </svg>\n </ng-template>\n </ng-container>\n\n <!-- For 'search-warning' -->\n <ng-container *ngSwitchCase=\"'search-warning'\">\n <i *ngIf=\"!!searchWarningMessageIcon; else defaultWarningIcon\" [ngClass]=\"searchWarningMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #defaultWarningIcon>\n <svg [style.--sq-size.px]=\"iconSize\" class=\"search-warning\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\">\n <path fill=\"currentColor\" d=\"M272 384c9.6-31.9 29.5-59.1 49.2-86.2c0 0 0 0 0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4c0 0 0 0 0 0c19.8 27.1 39.7 54.4 49.2 86.2l160 0zM192 512c44.2 0 80-35.8 80-80l0-16-160 0 0 16c0 44.2 35.8 80 80 80zm0-448c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM160 288a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"/>\n </svg>\n </ng-template>\n </ng-container>\n </ng-container>\n</span>\n\n<!-- Message body -->\n<div class=\"flex-grow-1 position-relative relative\" style=\"min-width: 0;\" [ngClass]=\"'message-'+message.role\">\n\n <!-- Progress steps -->\n <div *ngIf=\"message.additionalProperties.$progress as progress\" class=\"small ms-3 mb-2\">\n <details role=\"button\" class=\"select-none\" [open]=\"!collapseProgress\">\n <summary class=\"text-muted\">\n {{ 'chatMessage.viewProgress' | transloco }}\n </summary>\n <ul class=\"list-unstyled\">\n <li *ngFor=\"let step of progress\">\n <i class=\"fas fa-fw fa-check text-success\" *ngIf=\"step.done\"></i>\n <i class=\"fas fa-spinner fa-pulse step-ongoing\" *ngIf=\"!step.done && streaming\"></i>\n <i class=\"fa-solid fa-ban step-error\" *ngIf=\"!step.done && !streaming\"></i>\n <span class=\"ms-2 fw-bold\">{{step.title}}</span>\n <span *ngIf=\"step.content\" [innerHTML]=\"': ' + step.content\"></span>\n </li>\n </ul>\n </details>\n </div>\n\n <!-- Message content -->\n <div class=\"message-content\" *ngIf=\"message.content\">\n\n <!-- Custom rendering for WPS, to be remove with https://sinequa.atlassian.net/browse/ES-23710 -->\n <div *ngIf=\"message?.role === 'assistant' && message.messageType === 'CHART'\">\n <sq-assistant-chart [rawChartData]=\"message.content\"></sq-assistant-chart>\n </div>\n\n <!-- This section is responsible for customizing the template nodes used in the application.\n Template nodes are predefined structures that serve as blueprints for creating/customizing dynamic content -->\n <remark *ngIf=\"(message?.role === 'assistant' && message.messageType !== 'CHART') || message?.role === 'connection-error' || message?.role === 'search-warning'\" [markdown]=\"message.content | messageContent\" [processor]=\"processor\">\n\n <!-- Chat reference (badge with file and part number) -->\n <ng-template remarkTemplate=\"chat-reference\" let-ref>\n @let attachment = referenceMap.get(ref.refId);\n @if (attachment) {\n <a\n class=\"reference\"\n role=\"button\"\n [sqTooltip]=\"attachment\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n (click)=\"openAttachmentPreview(attachment, ref.refId)\"\n >\n {{ref.refId}}\n </a>\n }\n @else {\n <ng-template #staticRefTpl>\n <span class=\"reference\">{{ ref.refId }}</span>\n </ng-template>\n }\n </ng-template>\n\n <!-- Embedded reference image -->\n <ng-template remarkTemplate=\"embedded-image-reference\" let-ref>\n @let refObj = getEmbeddedImageReference(ref.value);\n @if (refObj && refObj.url) {\n <span\n [ngClass]=\"{ 'reference': true, 'has-bounding-box': ref.boundingBox }\"\n [sqTooltip]=\"{ obj: refObj, id: ref.value }\"\n [sqTooltipTemplate]=\"imageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Img-{{ ref.value }}\n </span>\n }\n </ng-template>\n\n <!-- Embedded reference page -->\n <ng-template remarkTemplate=\"embedded-page-reference\" let-ref>\n @let refObj = getEmbeddedPageReference(ref.value);\n @if (refObj && refObj.url) {\n <span\n [ngClass]=\"{ 'reference': true, 'has-bounding-box': ref.boundingBox }\"\n [sqTooltip]=\"{ obj: refObj, id: ref.value }\"\n [sqTooltipTemplate]=\"pageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Page-{{ ref.value }}\n </span>\n }\n </ng-template>\n\n <!-- Blinking cursor -->\n <ng-template remarkTemplate=\"streaming-placeholder\">\n <span class=\"placeholder-glow\" *ngIf=\"streaming\">\n <span class=\"placeholder ms-1\"></span>\n </span>\n </ng-template>\n\n <ng-template remarkTemplate=\"code\" let-node>\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-between align-items-center\">\n <span>{{node.lang}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"copyCode(node.value)\"><i class=\"far fa-fw fa-clipboard\"></i> {{ 'chatMessage.copyCode' | transloco }}</button>\n </div>\n <pre class=\"language-{{node.lang}} my-0 rounded-0 rounded-bottom\"><code class=\"language-{{node.lang}}\">{{node.value}}</code></pre>\n </div>\n </ng-template>\n\n <ng-template remarkTemplate=\"link\" let-node>\n <a [href]=\"node.url\" target=\"_blank\" rel=\"noopener noreferrer\">{{getLinkText(node)}}</a>\n </ng-template>\n\n </remark>\n\n <p *ngIf=\"message?.role === 'user'\">{{ message.content | messageContent }}</p>\n\n <!-- List of reference, if any -->\n @if (references?.length > 0 || imageReferencesMap?.size > 0 || pageReferencesMap?.size > 0) {\n <div class=\"references\">\n <details role=\"button\" class=\"select-none\" [open]=\"!showReferences\">\n <summary class=\"references-title\">{{ 'chatMessage.references' | transloco }}</summary>\n <ul>\n @for (reference of references; track $index) {\n <li *ngIf=\"referenceMap.get(reference) as attachment\" class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n }\n @for (imageReference of imageReferencesMap.entries(); track $index) {\n <li style=\"list-style-type: none;\">\n <InlineImageReference\n [id]=\"imageReference[0]\"\n [ref]=\"imageReference[1]\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </li>\n }\n @for (pageReference of pageReferencesMap.entries(); track $index) {\n <li style=\"list-style-type: none;\">\n <InlinePageReference\n [id]=\"pageReference[0]\"\n [ref]=\"pageReference[1]\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </li>\n }\n </ul>\n </details>\n </div>\n }\n </div>\n\n <!-- Edit / Regenerate floating actions -->\n <div class=\"sq-chat-message-actions\" *ngIf=\"message\">\n <!-- Common action buttons for \"user\" & \"assistant\" message -->\n <button class=\"btn btn-sm\" *ngIf=\"canCopy\" [sqTooltip]=\"'chatMessage.copyText' | transloco\" (click)=\"copyMessage(message)\">\n <i class=\"far fa-clipboard\"></i>\n </button>\n <!-- Action buttons for \"user\" message -->\n <button class=\"btn btn-sm\" *ngIf=\"canEdit\" [sqTooltip]=\"'chatMessage.editMessage' | transloco\" (click)=\"edit.emit(message)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <!-- Action buttons for \"assistant\" message -->\n <button class=\"btn btn-sm\" [class.bounce]=\"message.additionalProperties.$liked\" *ngIf=\"canLike\" [sqTooltip]=\"'chatMessage.likeAnswer' | transloco\" (click)=\"like.emit()\">\n <i *ngIf=\"!message.additionalProperties.$liked\" class=\"far fa-thumbs-up \"></i>\n <i *ngIf=\"message.additionalProperties.$liked\" class=\"fas fa-thumbs-up\"></i>\n </button>\n <button class=\"btn btn-sm\" [class.bounce]=\"message.additionalProperties.$disliked\" *ngIf=\"canDislike\" [sqTooltip]=\"'chatMessage.reportIssue' | transloco\" (click)=\"dislike.emit()\">\n <i *ngIf=\"!message.additionalProperties.$disliked\" class=\"far fa-thumbs-down \"></i>\n <i *ngIf=\"message.additionalProperties.$disliked\" class=\"fas fa-thumbs-down\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canRegenerate\" [sqTooltip]=\"'chatMessage.regenerateResponse' | transloco\" (click)=\"regenerate.emit(message)\">\n <i class=\"fas fa-sync-alt\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canDebug\" [sqTooltip]=\"'chatMessage.showLogInformation' | transloco\" (click)=\"debug.emit(message);\">\n <i class=\"far fa-list-alt\"></i>\n </button>\n </div>\n\n <!-- List of suggested actions, if any -->\n <div *ngIf=\"suggestedActions\" class=\"mt-2 message-suggestion\">\n <div class=\"suggested-action\" *ngFor=\"let suggestedAction of suggestedActions\" (click)=\"suggestAction.emit(suggestedAction)\">\n <div class=\"message-icon\" [style.width.px]=\"iconSize\"></div>\n <div class=\"message-content\">\n <p><i class=\"fas fa-clipboard-question\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n <ng-template #imageTooltipTpl let-ref>\n <InlineImageReference\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </ng-template>\n\n <ng-template #pageTooltipTpl let-ref>\n <InlinePageReference\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </ng-template>\n\n <ng-template #tooltipTpl let-ref>\n <sq-chat-reference\n *ngIf=\"!hiddenTooltip\"\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"openAttachmentPreview($event, ref.$partId)\"\n (openDocument)=\"openOriginalAttachment($event, ref.$partId)\">\n </sq-chat-reference>\n </ng-template>\n\n</div>\n","import { Component, computed, ElementRef, output, viewChild } from \"@angular/core\";\r\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\r\n\r\nimport { DialogEvent } from \"../services/dialog.service\";\r\n\r\n@Component({\r\n selector: 'sq-dialog-updates',\r\n standalone: true,\r\n imports: [TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #dialog class=\"z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.availableUpdates' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.availableUpdatesText' | transloco }}</p>\r\n <div class=\"flex justify-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost outline-none w-24\" (click)=\"seeNoMore()\">{{ 'chatDialogs.seeNoMore' | transloco }}</button>\r\n <button class=\"btn btn-secondary\" (click)=\"remindMeLater()\">{{ 'chatDialogs.remindMeLater' | transloco }}</button>\r\n <button class=\"btn btn-primary w-24\" (click)=\"update()\">{{ 'chatDialogs.update' | transloco }}</button>\r\n </div>\r\n </div>\r\n </dialog>\r\n `,\r\n styles: [`\r\n .flex {\r\n display: flex;\r\n }\r\n .flex-col {\r\n flex-direction: column;\r\n }\r\n .justify-end {\r\n justify-content: end;\r\n }\r\n `]\r\n})\r\nexport class DialogUpdatesComponent {\r\n protected dialogRef = viewChild('dialog', { read: ElementRef<HTMLDialogElement> });\r\n protected dialog = computed(() => this.dialogRef()?.nativeElement as HTMLDialogElement);\r\n\r\n closed = output<DialogEvent>();\r\n\r\n open() {\r\n this.dialog().showModal();\r\n }\r\n\r\n close(eventType: DialogEvent = \"dialog-close\") {\r\n this.dialog().close();\r\n this.closed.emit(eventType);\r\n // dispatch a javascript event\r\n document.dispatchEvent(new Event(eventType));\r\n }\r\n\r\n seeNoMore() {\r\n this.close(\"dialog-no\");\r\n }\r\n\r\n remindMeLater() {\r\n this.close();\r\n }\r\n\r\n update() {\r\n this.close(\"dialog-confirm\");\r\n }\r\n}\r\n","import {\r\n ApplicationRef,\r\n ComponentRef,\r\n createComponent,\r\n Injectable,\r\n Type,\r\n} from '@angular/core';\r\n\r\n\r\nexport type DialogEvent = 'dialog-close' | 'dialog-cancel' | 'dialog-confirm' | 'dialog-no' | 'dialog-yes';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class DialogService {\r\n protected dialogRef?: ComponentRef<any>;\r\n\r\n constructor(private appRef: ApplicationRef) {}\r\n\r\n open<T>(componentType: Type<T>): Promise<DialogEvent> {\r\n this.removeDialog();\r\n\r\n this.dialogRef = createComponent(componentType, {\r\n environmentInjector: this.appRef.injector,\r\n });\r\n\r\n document.body.appendChild(this.dialogRef.location.nativeElement);\r\n this.appRef.attachView(this.dialogRef.hostView);\r\n\r\n this.dialogRef.instance.open();\r\n\r\n return new Promise((resolve) => {\r\n const subscription = this.dialogRef?.instance.closed.subscribe((e: DialogEvent) => {\r\n this.removeDialog();\r\n resolve(e);\r\n subscription.unsubscribe();\r\n })\r\n });\r\n }\r\n\r\n protected removeDialog() {\r\n // remove previous dialog if exists\r\n if (this.dialogRef) {\r\n this.appRef.detachView(this.dialogRef.hostView);\r\n this.dialogRef.destroy();\r\n this.dialogRef.changeDetectorRef.detectChanges();\r\n }\r\n }\r\n}","import { Injectable } from \"@angular/core\";\r\nimport { from } from \"rxjs\";\r\nimport { patchUserSettings } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class UserSettingsWebService {\r\n userSettings = {};\r\n\r\n patch(data: any) {\r\n this.userSettings = { ...this.userSettings, ...data };\r\n return from(patchUserSettings(data));\r\n }\r\n}","import { z } from \"zod\";\n\nimport { Query, Article as Record } from \"@sinequa/atomic\";\n\nimport { RawMessageContent } from \"./types/message-content.types\";\nimport { MessageImageReference } from \"./types/message-reference.types\";\n\n/**\n * Individual message sent & returned by the ChatGPT API.\n * If this message is an attachment, we attach the minimal\n * information needed to reconstruct this attachment (RawAttachment)\n * as well as the reference id computed at the moment of sending\n * the attachment to the API.\n */\nexport interface RawMessage {\n role: string;\n content: RawMessageContent;\n // Used only by WPS to be removed\n // https://sinequa.atlassian.net/browse/ES-23710\n messageType?: \"CHART\" | \"MARKDOWN\";\n additionalProperties: {\n [key: string]: any;\n };\n}\n\n/**\n * A chat message that has been processed to include the markdown-formatted\n * content for display, as well as detailed attachment data, and optionally\n * a list of the references extracted from that message\n */\nexport interface ChatMessage extends RawMessage {\n additionalProperties: {\n display?: boolean;\n $progress?: ChatProgress[];\n $attachment?: ChatContextAttachment[];\n $suggestedAction?: SuggestedAction[];\n $debug?: DebugMessage[];\n forcedWorkflow?: string;\n forcedWorkflowProperties?: any;\n query?: Query;\n isUserInput?: boolean;\n usageMetrics?: ChatUsageMetrics;\n additionalWorkflowProperties?: any;\n $liked?: boolean;\n $disliked?: boolean;\n [key: string]: any;\n };\n}\n\nexport interface ChatProgress {\n title: string;\n content?: string;\n done?: boolean;\n time?: number;\n}\n\nexport interface RawAttachment {\n /** Type of the attachment */\n type: string;\n /** Record id from which this attachment is taken */\n recordId: string;\n /** Record from which this this attachment is taken */\n record: Record;\n}\n\nexport interface DocumentPart {\n partId: number;\n offset: number;\n length: number;\n text: string;\n images?: string[] | MessageImageReference[];\n}\n\nexport type DocumentPage = {\n url: string;\n mimeType: string;\n name?: string;\n type?: string;\n description?: string;\n length?: number;\n offSet?: number;\n pageNumber?: number;\n remappedLength?: number;\n remappedOffset?: number;\n};\n\nexport interface ChatContextAttachment extends RawAttachment {\n /** Type of the attachment */\n type: \"Context\";\n /** Rank of the attachment in the context message */\n contextId: number;\n /** Parts of the record that the assistant uses to answer */\n parts: DocumentPart[];\n /** Pages of the documents based on the query */\n pages?: DocumentPage[];\n /** The specific id used of the referenced part */\n $partId?: number;\n}\n\n/**\n * Raw response of the chat API\n */\nexport interface RawResponse {\n history: RawMessage[];\n executionTime: string | undefined;\n executionTimeMilliseconds: number | undefined;\n}\n\n/**\n * Enriched response of the chat API\n */\nexport interface ChatResponse extends RawResponse {\n history: ChatMessage[];\n}\n\n/**\n * Response of the ListModels API\n */\nexport interface GllmModelDescription {\n provider: string;\n displayName: string;\n serviceId: string;\n modelId: string;\n enable: boolean;\n maxGenerationSize: number;\n contextWindowSize: number;\n}\n\n/**\n * Response of the ListFunctions API\n */\nexport interface GllmFunction {\n functionName: string;\n description: string;\n enabled: boolean;\n parameters: GllmFunctionParameter[];\n}\n\nexport interface GllmFunctionParameter {\n description: string;\n isRequired: boolean;\n name: string;\n type: string;\n}\n\n/**\n * Minimal representation of a saved chat\n */\nexport interface SavedChat {\n id: string;\n title: string;\n modifiedUTC: string;\n}\n\n/**\n * Data structure saved to reconstruct a saved chat conversation\n */\nexport interface SavedChatHistory extends SavedChat {\n history: ChatMessage[];\n}\n\n// Define the Zod representation for the connectionSettings object\nexport const connectionSettingsSchema = z\n .object({\n connectionErrorMessage: z.string(),\n restEndpoint: z.string().optional(),\n websocketEndpoint: z.string().optional(),\n signalRSkipNegotiation: z.boolean().optional(),\n signalRTransport: z.enum([\n \"WebSockets\",\n \"ServerSentEvents\",\n \"LongPolling\",\n \"None\",\n ]),\n signalRLogLevel: z.enum([\n \"Critical\",\n \"Debug\",\n \"Error\",\n \"Information\",\n \"None\",\n \"Trace\",\n \"Warning\",\n ]),\n signalRServerTimeoutInMilliseconds: z.number().optional(),\n })\n .refine((data) => !!data.restEndpoint || !!data.websocketEndpoint, {\n message:\n \"Based on the provided input() protocol ('REST' or 'WEBSOCKET') to the Chat Component, either 'restEndpoint' or 'websocketEndpoint' property should be provided in the 'globalSettings' of the assistant instance.\",\n });\n// Define the ConnectionSettings interface\nexport type ConnectionSettings = z.infer<typeof connectionSettingsSchema>;\n\n// Define the Zod representation for the serviceSettings object\nconst serviceSettingsSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n});\n// Define the ServiceSettings interface\nexport interface ServiceSettings\n extends z.infer<typeof serviceSettingsSchema> {}\n\n// Define the Zod representation for the additionalServiceSettings object\nconst additionalServiceSettingsSchema = z.object({});\n// Define the AdditionalServiceSettings interface\nexport interface AdditionalServiceSettings\n extends z.infer<typeof additionalServiceSettingsSchema> {}\n\n// Define the Zod representation for the additionalWorkflowProperties object\nconst additionalWorkflowPropertiesSchema = z.object({});\n// Define the additionalWorkflowProperties interface\nexport interface additionalWorkflowProperties\n extends z.infer<typeof additionalWorkflowPropertiesSchema> {}\n\n// Define the Zod representation for the uiSettings object\nconst uiSettingsSchema = z.object({\n display: z.boolean(),\n servicesModels: z.boolean(),\n functions: z.boolean(),\n temperature: z.boolean(),\n top_p: z.boolean(),\n max_tokens: z.boolean(),\n debug: z.boolean(),\n displaySystemPrompt: z.boolean(),\n displayUserPrompt: z.boolean(),\n});\n// Define the UiSettings interface\nexport interface UiSettings extends z.infer<typeof uiSettingsSchema> {}\n\n// Define the Zod representation for the defaultValues object\nconst defaultValuesSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n functions: z.array(\n z.object({\n name: z.string(),\n enabled: z.boolean(),\n })\n ),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n debug: z.boolean(),\n systemPrompt: z.string(),\n userPrompt: z.string(),\n});\n// Define the DefaultValues interface\nexport interface DefaultValues extends z.infer<typeof defaultValuesSchema> {}\n\n// Define the Zod representation for the action object\nconst actionSchema = z.object({\n forcedWorkflow: z.string(), // forcedWorkflow must be a string\n forcedWorkflowProperties: z.record(z.unknown()).optional(), // forcedWorkflowProperties must be an object (Map equivalent)\n});\n\n// Define the Zod representation for the modeSettings object\nconst initializationSchema = z\n .object({\n event: z.enum([\"Query\", \"Prompt\"]),\n forcedWorkflow: z.string().optional(),\n forcedFunction: z.string().optional(),\n displayUserQuery: z.boolean().optional(),\n })\n // ❌ Rule 1: Cannot have both forcedWorkflow and forcedFunction\n .refine(\n (data) =>\n data.event !== \"Query\" || !(data.forcedWorkflow && data.forcedFunction),\n {\n message:\n \"Both 'forcedFunction' and 'forcedWorkflow' properties are set, but they should not.\",\n }\n )\n // ❌ Rule 2: Must have one of forcedWorkflow or forcedFunction when event is 'Query'\n .refine(\n (data) =>\n data.event !== \"Query\" || !!data.forcedWorkflow || !!data.forcedFunction,\n {\n message:\n \"One of 'forcedWorkflow' or 'forcedFunction' must be provided when the initialization's event is 'Query'.\",\n }\n )\n // ❌ Rule 3: Must have displayUserQuery set when event is 'Query'\n .refine(\n (data) =>\n data.event !== \"Query\" ||\n (data.displayUserQuery !== undefined && data.displayUserQuery !== null),\n {\n message:\n \"'displayUserQuery' must be provided when the initialization's event is 'Query'.\",\n }\n );\n\nconst modeSettingsSchema = z.object({\n enabledUserInput: z.boolean(),\n displayUserPrompt: z.boolean(),\n sendUserPrompt: z.boolean(),\n initialization: initializationSchema,\n actions: z.record(actionSchema).optional(),\n});\n// Define the ModeSettings interface\nexport interface ModeSettings extends z.infer<typeof modeSettingsSchema> {}\n\n// Define the Zod representation for the savedChatSettings object\nconst savedChatSettingsSchema = z.object({\n enabled: z.boolean(),\n display: z.boolean(),\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings\n extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the globalSettings object\nconst globalSettingsSchema = z.object({\n searchWarningMessage: z.string(),\n disclaimer: z.string().optional(),\n genericChatErrorMessage: z.string().optional(),\n displayUserQuotaConsumption: z.boolean().optional(),\n displayChatTokensConsumption: z.boolean().optional(),\n});\n\n// Define the Zod representation for the auditSettings object\nconst auditSettingsSchema = z.object({\n issueTypes: z.array(z.string()).optional(),\n logContent: z.boolean(),\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings\n extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the entire ChatConfig object\nexport const chatConfigSchema = z.object({\n connectionSettings: connectionSettingsSchema,\n defaultValues: defaultValuesSchema,\n modeSettings: modeSettingsSchema,\n uiSettings: uiSettingsSchema,\n savedChatSettings: savedChatSettingsSchema,\n globalSettings: globalSettingsSchema,\n auditSettings: auditSettingsSchema,\n additionalServiceSettings: additionalServiceSettingsSchema,\n additionalWorkflowProperties: additionalWorkflowPropertiesSchema,\n});\n// Define the ChatConfig interface\nexport interface ChatConfig extends z.infer<typeof chatConfigSchema> {}\n\nexport interface ChatPayload {\n debug: boolean;\n functions: string[];\n history: ChatMessage[];\n serviceSettings: ServiceSettings;\n appQuery: {\n app: string;\n query: Query | undefined;\n targetUrl?: string;\n accessToken?: string;\n };\n instanceId?: string;\n savedChatId?: string;\n genericChatErrorMessage?: string;\n}\n\nexport type ActionMessage = {\n guid: string;\n displayName?: string;\n displayValue?: string;\n executionTime?: number;\n};\n\nexport interface TextChunksOptions {\n extendMode?: \"None\" | \"Sentence\" | \"Chars\";\n extendScope?: number;\n}\n\nexport interface Quota {\n lastRequest: string;\n promptTokenCount: number;\n completionTokenCount: number;\n periodTokens: number;\n resetHours: number;\n tokenCount: number;\n nextReset: string;\n lastResetUTC: string;\n nextResetUTC: string;\n maxQuotaReached: boolean;\n}\n\nexport interface SuggestedAction {\n content: string;\n type: string;\n}\n\nexport interface InitChat {\n messages: RawMessage[];\n}\n\n/**\n * List of events data that can be emitted by the websocket chat endpoint\n */\nexport type SuggestedActionsEvent = { suggestedActions: SuggestedAction[] };\nexport type QuotaEvent = { quota: Quota };\nexport type MessageEvent = { delta: string; messageId: string };\nexport type ContextMessageEvent = { content: string; additionalProperties: ChatContextAttachment };\nexport type ErrorEvent = string;\nexport type ActionStartEvent = { guid: string; displayName: string };\nexport type ActionResultEvent = { guid: string; displayValue: string };\nexport type ActionStopEvent = { guid: string; executionTime: number };\nexport type HistoryEvent = { history: RawMessage[]; executionTime: string; executionTimeMilliseconds?: number };\nexport type DebugMessageEvent = DebugMessage;\n\n/**\n * Data emitted by the http chat endpoint\n */\nexport type HttpChatResponse = {\n quota: Quota;\n suggestedActions: SuggestedAction[];\n debug: any;\n context: { content: string; additionalProperties: ChatContextAttachment }[];\n actions: ActionMessage[];\n history: RawMessage[];\n executionTime: string;\n executionTimeMilliseconds: number;\n};\n\nexport interface TokenConsumption {\n percentage: number;\n}\n\nexport interface UserTokenConsumption extends TokenConsumption {\n nextResetDate: string;\n}\n\nexport interface ChatUsageMetrics {\n totalTokenCount: number;\n promptTokenCount: number;\n completionTokenCount: number;\n tokenizerType: string;\n}\n\nexport interface KvObject {\n data: {\n key: string;\n value: any; // string | number | boolean | null | undefined | { [key: string]: any };\n };\n type: \"KV\";\n isError: boolean;\n}\n\nexport interface ListObject {\n name: string;\n type: \"LIST\";\n isError: boolean;\n items: (KvObject | ListObject)[];\n expanded: boolean;\n}\n\nexport type DebugMessage = KvObject | ListObject;\n\nexport type MessageHandler<T> = {\n handler: (data: T) => void;\n isGlobalHandler: boolean;\n};\n\n/**\n * Data emitted by the saved chat endpoints\n */\nexport type DeleteSavedChatResponse = {\n deleteCount: number;\n executionTime: string;\n executionTimeMilliseconds: number;\n};\nexport type SavedChatResponse = {\n savedChat: SavedChat;\n executionTime: string;\n executionTimeMilliseconds: number;\n};\n","import { Injectable, LOCALE_ID, inject } from \"@angular/core\";\nimport { TranslocoService } from \"@jsverse/transloco\";\nimport { differenceInDays, differenceInMonths, differenceInYears, endOfYesterday, format, isThisMonth, isThisQuarter, isThisWeek, isThisYear, isToday, isYesterday, parseISO, toDate } from \"date-fns\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nimport { Audit, Query, fetchApp, fetchPrincipal, fetchUserSettings, guid, sha512 } from \"@sinequa/atomic\";\n\nimport { DialogUpdatesComponent } from \"./dialogs/updates.component\";\nimport { AppService } from \"./services/app.service\";\nimport { DialogService } from \"./services/dialog.service\";\nimport { NotificationsService } from \"./services/notification.service\";\nimport { PrincipalService } from \"./services/principal.service\";\nimport { UserSettingsWebService } from \"./services/user-settings.service\";\nimport { ChatConfig, ChatMessage, ChatResponse, ChatUsageMetrics, DeleteSavedChatResponse, GllmFunction, GllmModelDescription, Quota, SavedChat, SavedChatHistory, SavedChatResponse, TokenConsumption, UserTokenConsumption, chatConfigSchema } from \"./types\";\nimport { getAssistantJsonFromCCApp } from \"./utils/assistant-json\";\n\n@Injectable()\nexport abstract class ChatService {\n\n readonly localID = inject(LOCALE_ID, {optional: true});\n\n /** Name of the assistant plugin OR websocket endpoint. */\n REQUEST_URL: string;\n /** Emit true once the initialization of the assistant process is done. */\n initProcess$ = new BehaviorSubject<boolean>(false);\n /** Emit true once the initialization of the assistant config is done. */\n initConfig$ = new BehaviorSubject<boolean>(false);\n /** Emit the global configuration of the assistant. */\n assistantConfig$ = new BehaviorSubject<ChatConfig | undefined>(undefined);\n /** Emit true if the user has been overridden, false otherwise. */\n userOverride$ = new BehaviorSubject<boolean | undefined>(undefined);\n /**\n * Emit true if the fetch of an assistant's response is ongoing (it includes Streaming status of the assistant endpoint AND saving the discussion if save Chat is enabled).\n * This is used to prevent multiple fetches at the same time.\n * Typically, there is no problem chaining fetches, but when forcing a reload after query changes cases, it can't be allowed because it breaks the whole business logic.\n */\n streaming$ = new BehaviorSubject<boolean>(false);\n /** Store the messages history of the current chat. */\n chatHistory: ChatMessage[] | undefined;\n /** List of models available on the server. */\n models: GllmModelDescription[] | undefined;\n /** List of functions available on the server. */\n functions: GllmFunction[] | undefined;\n /** List of saved chats. */\n savedChats$ = new BehaviorSubject<SavedChat[]>([]);\n /** Whether there is an error with saved chats. */\n savedChatsError$ = new BehaviorSubject<boolean>(false);\n /** Emit the saved chat to load. */\n loadSavedChat$ = new BehaviorSubject<SavedChat | undefined>(undefined);\n /** Emit the quota each time the chat is invoked. */\n quota$ = new BehaviorSubject<Quota | undefined>(undefined);\n /** Emit the calculated user's token consumption based on the quota. */\n userTokenConsumption$ = new BehaviorSubject<UserTokenConsumption | undefined>(undefined);\n /** Emit the chat usage metrics each time the generation of the assistant response is completed. */\n chatUsageMetrics$ = new BehaviorSubject<ChatUsageMetrics | undefined>(undefined);\n /** Emit the calculated chat's token consumption based on the chat usage metrics. */\n chatTokenConsumption$ = new BehaviorSubject<TokenConsumption | undefined>(undefined);\n /** Emit true if \"CancelTasks\" is ongoing. */\n stoppingGeneration$ = new BehaviorSubject<boolean>(false);\n /** Instance ID of the chat service defining the assistant instance. */\n private _chatInstanceId: string;\n /** ID of the current **saved chat** discussion which is used to update/get/delete it. */\n private _savedChatId: string | undefined;\n /** Generated GUID for the current non-saved chat discussion used to identify audit events.\n * If the chat is saved, the savedChatId is initialized with the value of this chatId.\n */\n private _chatId: string;\n\n public userSettingsService = inject(UserSettingsWebService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n public modalService = inject(DialogService);\n public principalService = inject(PrincipalService);\n protected readonly transloco = inject(TranslocoService);\n /**\n * Initialize the chat process\n */\n abstract init(): Observable<boolean>;\n\n /**\n * Initialize the REQUEST_URL\n */\n abstract getRequestsUrl(): void;\n\n get assistants(): any {\n if (!this.userSettingsService.userSettings)\n this.userSettingsService.userSettings = {};\n if (!this.userSettingsService.userSettings[\"assistants\"])\n this.userSettingsService.userSettings[\"assistants\"] = {};\n return this.userSettingsService.userSettings[\"assistants\"];\n }\n\n /**\n * Get the instance ID of the chat service\n * @returns The instance ID of the chat service\n */\n get chatInstanceId(): string {\n return this._chatInstanceId;\n }\n\n /**\n * Persist the instance ID of the chat service\n * @param instanceId The instance ID of the chat service\n */\n setChatInstanceId(instanceId: string) {\n this._chatInstanceId = instanceId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to save/get/delete it\n * @returns The ID of the current chat discussion\n */\n get savedChatId(): string | undefined {\n return this._savedChatId;\n }\n\n /**\n * Persist the ID of the current chat discussion which is used to save/get/delete it\n * @param savedChatId The ID of the current chat discussion which is used to save/get/delete it\n */\n setSavedChatId(savedChatId: string | undefined) {\n this._savedChatId = savedChatId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to identify audit events\n * @returns The ID of the current chat discussion\n */\n get chatId(): string {\n return this._chatId;\n }\n\n /**\n * Generate an GUID for the current chat discussion which is used to identify audit events\n * If the discussion is saved, the savedChatId is initialized with the value of this chatId\n * @param chatId if provided, it will be considered as the ID of the current chat discussion which is used to identify audit events\n */\n generateChatId(chatId?: string) {\n this._chatId = chatId || guid();\n }\n\n /**\n * Initialize the chat config by managing ONLY sub-object **defaultValues** configs of the standard app config (defined in the customization json tab ) and the user preferences.\n * To do so, a tracking mechanism is implemented to notify the user about the available updates in the defaultValues object of the standard app config.\n * The rest of the config object coming from \"standard app config\" is used as it is without any override.\n * Thus, the user preferences are used only for the defaultValues object.\n * This provide a centralized way to manage the rest of the config object by admins and ensure a unique common behavior for all users.\n */\n async initChatConfig() {\n // fetch the standard app config to get the defaultValues of the chat config for the given instance\n // Persist the app in the app service\n const capp = await fetchApp();\n this.appService.app = capp;\n\n const settings = await fetchUserSettings<{}>();\n this.userSettingsService.userSettings = settings;\n const key = this.chatInstanceId;\n const userSettingsConfig = this.assistants[key] || {};\n\n const principal = await fetchPrincipal();\n this.principalService.principal = principal;\n\n const standardChatConfig = getAssistantJsonFromCCApp(this.appService.app, key);\n\n try {\n // Validate the whole config object against the schema\n chatConfigSchema.parse(standardChatConfig);\n // If the user preferences do not contain a config's defaultValues object, keep using the standard app config and nothing to store in the user preferences\n if (!userSettingsConfig.defaultValues) {\n this.assistantConfig$.next({...standardChatConfig});\n this.initConfig$.next(true);\n } else { // If the user has its own defaultValues in its userSettings, then we need to check for potential updates made by admins in the meantime and how he wants to manage them\n\n // Retrieve already stored hashes in the user settings if exists\n const appliedDefaultValuesHash = userSettingsConfig.hashes?.[\"applied-defaultValues-hash\"];\n const skippedDefaultValuesHash = userSettingsConfig.hashes?.[\"skipped-defaultValues-hash\"];\n // Create a hash of the current defaultValues of the standardChatConfig\n const currentDefaultValuesHash = await sha512(JSON.stringify(standardChatConfig.defaultValues));\n\n // Implement the tracking mechanism to notify the user about the available updates in the defaultValues object of the standard app config\n const condition = (currentDefaultValuesHash !== appliedDefaultValuesHash) && (currentDefaultValuesHash !== skippedDefaultValuesHash);\n if (condition) {\n this.modalService.open(DialogUpdatesComponent)\n .then(res => {\n if(res === \"dialog-confirm\") {\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash, \"skipped-defaultValues-hash\": undefined };\n // Update the chat config and store its defaultValues in the user preferences\n this.updateChatConfig({...standardChatConfig}, hashes, true);\n this.initConfig$.next(true);\n this.generateAuditEvent(\"ast-configuration.click\", { 'configuration': JSON.stringify({...standardChatConfig}) });\n } else if(res === \"dialog-no\") {\n // Do not notify the user about changes while this skipped version is not updated\n const hashes = { ...userSettingsConfig.hashes, \"skipped-defaultValues-hash\": currentDefaultValuesHash };\n this.updateChatConfig({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues}, hashes, false);\n this.initConfig$.next(true);\n } else {\n // Just pick the version in the user settings, nothing to be updated\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n });\n } else { // No available updates Or updates has been already skipped, then just pick the version in the user settings\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n }\n } catch (error) {\n this.notificationsService.error(`Missing valid configuration for the assistant instance '${key}'. See the browser console messages for details on the missing or incorrect properties.`);\n throw new Error(`Missing valid configuration for the assistant instance '${key}' . \\n ${JSON.stringify(error.issues, null, 2)}`);\n }\n }\n\n /**\n * Update the chat config and store its defaultValues in the user preferences\n * @param config The updated chat config\n * @param hashes The updated hashes to store in the user preferences\n * @param notify Whether to notify the user about the update\n * @param successCallback The callback to execute if the update is successful\n * @param errorCallback The callback to execute if the update fails\n */\n updateChatConfig(config: ChatConfig, hashes?: {\"applied-defaultValues-hash\"?: string, \"skipped-defaultValues-hash\"?: string}, notify = true, successCallback?: () => any, errorCallback?: () => any) {\n this.assistantConfig$.next(config);\n const assistants = Object.assign({}, this.assistants);\n assistants[this.chatInstanceId] = { ...assistants[this.chatInstanceId], defaultValues: config.defaultValues };\n if(hashes) assistants[this.chatInstanceId].hashes = hashes;\n this.userSettingsService.patch({ assistants }).subscribe(\n next => {},\n error => {\n if(notify) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n errorCallback\n ? errorCallback()\n : this.notificationsService.error(this.transloco.translate('chat.saveChatConfig.fail', { value: this.chatInstanceId }));\n }\n console.error(\"Could not patch assistants!\", error);\n },\n () => {\n if(notify) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n successCallback\n ? successCallback()\n : this.notificationsService.success(this.transloco.translate('chat.saveChatConfig.success', { value: this.chatInstanceId }));\n }\n }\n );\n }\n\n /**\n * Overrides the logged in user\n */\n abstract overrideUser(): void;\n\n /**\n * Calls the Fetch API to retrieve a new message given all previous messages\n */\n abstract fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse>\n\n /**\n * Return the list of models available on the server\n */\n abstract listModels(): Observable<GllmModelDescription[] | undefined>;\n\n /**\n * Return the list of functions available on the server AND matching enabled functions in the chat config\n */\n abstract listFunctions(): Observable<GllmFunction[] | undefined>;\n\n /**\n * Stops the assistant answer generation and cancels all the ongoing and pending related tasks\n */\n abstract stopGeneration(): Observable<any>\n\n /**\n * A handler for quota updates each time the chat is invoked.\n * It emits the updated quota to the quota$ subject, emits accordingly the updated user's tokens consumption and notifies the user if the max quota is reached.\n * @param quota The updated quota\n * @param propagateError Whether to propagate the error to the caller\n */\n updateQuota(quota: Quota, propagateError = false) {\n this.quota$.next(quota);\n const nextResetDate = this.formatDateTime(quota.nextResetUTC+\"+00:00\"); // This +00:00 is to ensure dates will be properly converted to local time\n const consumptionPercentage = Math.round((quota.tokenCount * 100 / quota.periodTokens) * 100) / 100;\n this.userTokenConsumption$.next({percentage: consumptionPercentage, nextResetDate});\n if(quota.maxQuotaReached) {\n this.generateAuditEvent('ast-quota.exceeded', {});\n const msg = `Sorry, you have exceeded the allowed quota. Please retry starting from ${nextResetDate}.`;\n this.notificationsService.error(msg);\n if(propagateError) throw new Error(msg);\n }\n }\n\n /**\n * A handler for chat usage metrics each time the generation of the assistant response is completed.\n * It emits the chat usage metrics to the chatUsageMetrics$ subject, emits accordingly the updated chat's tokens consumption\n * @param chatUsageMetrics The chat usage metrics\n */\n updateChatUsageMetrics(chatUsageMetrics: ChatUsageMetrics) {\n this.chatUsageMetrics$.next(chatUsageMetrics);\n const currentModel = this.getModel(this.assistantConfig$.value!.defaultValues.service_id, this.assistantConfig$.value!.defaultValues.model_id);\n const consumptionPercentage = Math.round((chatUsageMetrics.totalTokenCount * 100 / (currentModel!.contextWindowSize - currentModel!.maxGenerationSize)) * 100) / 100;\n this.chatTokenConsumption$.next({percentage: consumptionPercentage});\n }\n\n /**\n * Get the model description for the given (serviceId + modelId)\n * If a model is not found, an error message is returned\n * @param serviceId The serviceId of the model\n * @param modelId The modelId of the model\n * @returns The model description\n */\n getModel(serviceId: string, modelId: string): GllmModelDescription | undefined{\n const model = this.models?.find(m => m.serviceId === serviceId && m.modelId === modelId);\n // Handle obsolete config\n if(!model) {\n this.notificationsService.error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available. Please contact an admin for further information.`);\n throw new Error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available`);\n }\n return model;\n }\n\n /**\n * Fetch the list saved chats belonging to a specific instance of the assistant\n */\n abstract listSavedChat(): void;\n\n /**\n * Return the saved chat with the given id, if exists. Otherwise, return undefined\n * @param id The id of the saved chat\n */\n abstract getSavedChat(id: string): Observable<SavedChatHistory | undefined>;\n\n /**\n * Save a chat with the given messages\n * @param messages The messages to add to the saved chat index\n * @returns The saved chat\n */\n abstract addSavedChat(messages: ChatMessage[]): Observable<SavedChatResponse>;\n\n /**\n * Update a saved chat with the given id.\n * @param id The id of the saved chat\n * @param name The new name of the saved chat, if provided\n * @param messages The messages to update the saved chat history, if provided\n * @returns True if the saved chat has been successfully updated\n */\n abstract updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChatResponse>;\n\n /**\n * Bulk delete of saved chats matching the given ids\n * @param ids List of ids of the saved chats to delete\n * @returns The number of deleted chats\n */\n abstract deleteSavedChat(ids: string[]): Observable<DeleteSavedChatResponse>;\n\n /**\n * Generate an audit event with the given type and details. The generated audit event is sent afterwards via the AuditWebService\n * @param type Audit event type\n * @param details Audit event details\n * @param id Actions (savedChat delete/rename/...) may occur on a specific chat different than the current one stored in this service, so the chat id can be provided\n */\n async generateAuditEvent(type: string, details: Record<string, any>, id?: string) {\n const baseDetails = {\n \"url\": decodeURIComponent(window.location.href),\n \"app\": this.appService.appName,\n \"user-id\": this.principalService.principal?.userId,\n \"instance-id\": this.chatInstanceId,\n \"chat-id\": id || this.chatId,\n \"service-id\": this.assistantConfig$.value!.defaultValues.service_id,\n \"model-id\": this.assistantConfig$.value!.defaultValues.model_id,\n \"is-user-input\": false\n };\n const audit = {\n type,\n detail: {\n ...baseDetails,\n ...details\n }\n }\n const response = await Audit.notify(audit);\n console.log(\"Audit response\", response);\n }\n\n\n\n /**\n * Traverse the array from the end and track the first 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the first visible assistant message among the last group of \"assistant\" messages in the array\n */\n firstVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let firstVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n firstVisibleAssistantMessageIndex = index;\n }\n index--;\n }\n return firstVisibleAssistantMessageIndex;\n }\n\n /**\n * Traverse the array from the end and pick the last 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the last visible assistant message among the last group of \"assistant\" messages in the array\n */\n lastVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let lastVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n lastVisibleAssistantMessageIndex = index;\n break;\n }\n index--;\n }\n return lastVisibleAssistantMessageIndex;\n }\n\n /**\n * Format a date string in UTC to a local date string\n * @param value Date string in UTC to format\n * @returns A formatted local date string\n */\n protected formatDateTime(value: string): string {\n const localDate = toDate(parseISO(value));\n const formatter = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n timeZoneName: 'short'\n });\n return formatter.format(localDate);\n }\n\n /**\n * Takes a text prompt that may contain placeholders for variables\n * and replaces these placeholders if it finds a match in the given\n * context object.\n *\n * @example\n * const p = \"Hello, [[user.name]]! You have [[user.notifications.length]] new notifications.\";\n * const context = {\n * user: {\n * name: \"Alice\",\n * notifications: [\"Message from Bob\", \"Reminder for meeting\"]\n * }\n * };\n * const formattedPrompt = formatPrompt(p, context);\n * console.log(formattedPrompt); // Output: \"Hello, Alice! You have 2 new notifications.\"\n */\n static formatPrompt(prompt: string, context: any) {\n return prompt.replace(\n /\\[\\[(.*?)\\]\\]/g,\n (match, expr) => {\n // Simple dot notation resolver\n const keys = expr.trim().split(\".\");\n let value = context;\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = value[key];\n } else {\n return match;\n }\n }\n return value ?? match;\n }\n );\n }\n\n /**\n * Determines a time-based key for a given date to be used for translations or formatting.\n * The key represents a relative time period such as \"today\", \"yesterday\", \"this week\", etc.\n * If the date does not fall into any predefined relative time period, it returns the year as a string.\n *\n * @param date - The date for which the time key is to be determined.\n * @returns A string representing the time key, which can be used for translation or display purposes.\n */\n getTimeKey(date: Date): string {\n if (isToday(date)) {\n return this.transloco.translate('chat.today');\n } else if (isYesterday(date)) {\n return this.transloco.translate('chat.yesterday');\n } else if (isThisWeek(date)) {\n return this.transloco.translate('chat.thisWeek');\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return this.transloco.translate('chat.lastWeek');\n } else if (isThisMonth(date)) {\n return this.transloco.translate('chat.thisMonth');\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return this.transloco.translate('chat.lastMonth');\n } else if (isThisQuarter(date)) {\n return this.transloco.translate('chat.thisQuarter');\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return this.transloco.translate('chat.lastQuarter');\n } else if (isThisYear(date)) {\n return this.transloco.translate('chat.thisYear');\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return this.transloco.translate('chat.lastYear');\n } else {\n return format(date, 'yyyy');\n }\n }\n\n getCurrentLocaleName() {\n return this.localID || '';\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { AfterViewInit, Component, Input } from \"@angular/core\";\nimport * as Prism from 'prismjs';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { DebugMessage } from \"../types\";\nimport { UIService } from \"../services/ui.service\";\n\n@Component({\n selector: \"sq-debug-message\",\n templateUrl: \"./debug-message.component.html\",\n styleUrls: [\"./debug-message.component.scss\"],\n standalone: true,\n imports: [CommonModule, TranslocoPipe],\n providers: [provideTranslocoScope('chat-debug-message')]\n})\nexport class DebugMessageComponent implements AfterViewInit {\n @Input() data: DebugMessage[] | undefined;\n @Input() level: number = 0; // Track the nesting level\n @Input() parentColor: string = ''; // Track the parent row color\n\n constructor(public ui: UIService) { }\n\n ngAfterViewInit() {\n Prism.highlightAll();\n }\n\n isObject(value: any): boolean {\n return value !== null && typeof value === 'object'\n }\n\n getRowClass(item: DebugMessage, index: number): string {\n if (item.isError) return 'row-error';\n if (this.level === 0) return index % 2 === 0 ? 'row-even' : 'row-odd';\n return this.parentColor;\n }\n\n copyToClipboard(code: any) {\n this.ui.copyToClipboard(JSON.stringify(code, null, 2));\n }\n}\n","<div *ngIf=\"data\" class=\"table-root\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <div *ngIf=\"item.type === 'KV'\" [ngClass]=\"getRowClass(item, i)\" class=\"d-flex w-100 kv-object\">\n <div class=\"kv-key\">{{ item.data.key }}</div>\n <div class=\"kv-value\">\n <ng-container *ngIf=\"isObject(item.data.value); else normalValue\">\n <div class=\"card mb-2\">\n <div class=\"card-header\">\n <button class=\"btn btn-light btn-sm\" (click)=\"copyToClipboard(item.data.value)\"><i class=\"far fa-fw fa-clipboard\"></i> {{ 'chatDebugMessage.copyCode' | transloco }}</button>\n </div>\n <pre class=\"language-json my-0 rounded-0 rounded-bottom\"><code class=\"language-json\">{{ item.data.value | json }}</code></pre>\n </div>\n </ng-container>\n <ng-template #normalValue><div class=\"data-value\">{{ item.data.value }}</div></ng-template>\n </div>\n </div>\n <div *ngIf=\"item.type === 'LIST'\" [ngClass]=\"getRowClass(item, i)\" class=\"d-flex w-100 list-object\">\n <div class=\"list-name w-100\" [class.fw-bold]=\"level === 0\" (click)=\"item.expanded=!item.expanded\">\n <i class=\"fas\" [class.fa-chevron-up]=\"item.expanded\" [class.fa-chevron-down]=\"!item.expanded\"></i>\n {{ item.name }}\n </div>\n <div class=\"list-items w-100\" *ngIf=\"item.expanded\">\n <sq-debug-message [data]=\"item.items\" [level]=\"level + 1\" [parentColor]=\"getRowClass(item, i)\"></sq-debug-message>\n </div>\n </div>\n </ng-container>\n</div>\n","import { Injectable } from '@angular/core';\nimport { catchError, finalize, forkJoin, from, fromEvent, map, merge, Observable, of, shareReplay, switchMap, take, tap, throwError } from 'rxjs';\n\nimport { get, isAuthenticated, post, Query } from \"@sinequa/atomic\";\n\nimport { ChatService } from './chat.service';\nimport { ActionMessage, ChatMessage, ChatPayload, ChatProgress, ChatResponse, DeleteSavedChatResponse, GllmFunction, GllmModelDescription, HttpChatResponse, SavedChat, SavedChatHistory, SavedChatResponse } from './types';\n\n@Injectable()\nexport class RestChatService extends ChatService {\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the chat process after the login is complete.\n * It listens for the 'login-complete' event, initializes necessary URL, and performs parallel requests for models, functions and quota data.\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n\n const allEvent$ = merge(\n fromEvent(document, 'authenticated').pipe(tap(() => console.log(\"authenticated\"))),\n of(isAuthenticated()).pipe(tap(() => console.log(\"isAuthenticated\")))\n );\n\n return allEvent$.pipe(\n tap(() => this.getRequestsUrl()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n // cache and replay the emitted value for subsequent subscribers, ensuring the initialization logic is only executed once even if there are multiple subscribers\n shareReplay(1)\n );\n }\n\n /**\n * Define the GLLM plugin to use for the http requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.restEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.restEndpoint;\n } else {\n throw new Error(`The property 'restEndpoint' must be provided when attempting to use 'REST' in assistant instance`);\n }\n }\n\n override overrideUser(): void {\n const error = new Error('Override user is not supported in REST');\n console.error(error);\n }\n listModels(): Observable<GllmModelDescription[] | undefined> {\n const data = {\n action: \"listmodels\",\n debug: this.assistantConfig$.value!.defaultValues.debug.toString()\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(\n get<{ models: GllmModelDescription[] | undefined }>(`plugin/${this.REQUEST_URL}`, searchParams))\n .pipe(\n map(res => res.models),\n tap(models => this.models = models?.filter(model => !!model.enable)),\n catchError((error) => {\n console.error('Error invoking listmodels:', error);\n return throwError(() => error);\n })\n );\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const data = {\n action: \"listfunctions\",\n debug: this.assistantConfig$.value!.defaultValues.debug.toString()\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(\n get<{ functions: GllmFunction[] | undefined }>(`plugin/${this.REQUEST_URL}`, searchParams))\n .pipe(\n map(res => res.functions),\n tap((functions: GllmFunction[] | undefined) => this.functions = functions?.filter(func => func.enabled && !!this.assistantConfig$.value!.defaultValues.functions.find(fn => fn.name === func.functionName))),\n catchError((error) => {\n console.error('Error invoking listfunctions:', error);\n return throwError(() => error);\n })\n );\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload & { action: \"chat\" } = {\n action: \"chat\",\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n // Request the Chat endpoint\n\n const paramsObject = Object.fromEntries(searchParams.entries());\n\n return from(post<HttpChatResponse>(`plugin/${this.REQUEST_URL}`, paramsObject))\n .pipe(\n tap((res: HttpChatResponse) => this.updateQuota(res.quota, true)),\n map((res: HttpChatResponse) => {\n // Define $progress from the actions property of the response\n let $progress: ChatProgress[] | undefined;\n if (res.actions?.length > 0) {\n const actions: ActionMessage[] = Object.values(res.actions.reduce((acc, item) => {\n acc[item.guid] = { ...(acc[item.guid] || {}), ...item };\n return acc;\n }, {}));\n $progress = actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n }\n // Re-attach the $progress and $attachment of the last response to the last assistant's response in the chat history\n const response = { ...(res.history as Array<ChatMessage>).at(-1) } as ChatMessage;\n if ($progress) response.additionalProperties.$progress = $progress;\n if (res.context) response.additionalProperties.$attachment = res.context.map((ctx) => ctx.additionalProperties);\n if (res.suggestedActions) response.additionalProperties.$suggestedAction = res.suggestedActions;\n // Emit the updated chat usage metrics once the generation of the assistant response is completed\n if (!!response.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(response.additionalProperties.usageMetrics!);\n }\n // Update the chat history with the incoming history property of the res AND the processed response message\n this.chatHistory = res.history;\n this.chatHistory[this.chatHistory.length - 1] = response;\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe();\n }\n // Generate audit event\n const details = {\n 'duration': res.executionTimeMilliseconds || res.executionTime,\n 'role': response.role, // 'assistant'\n 'rank': this.chatHistory.length - 1,\n 'generation-tokencount': response.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': response.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': response.additionalProperties.$attachment?.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => {\n if (!!this.assistantConfig$.value?.auditSettings?.logContent) return { partId, text };\n return { partId }\n }),\n type\n }))\n };\n\n if (!!this.assistantConfig$.value?.auditSettings?.logContent)\n details['text'] = response.content;\n\n this.generateAuditEvent('ast-message', details);\n // Return the result\n return { history: [...messages, response], executionTime: res.executionTime, executionTimeMilliseconds: res.executionTimeMilliseconds };\n }),\n finalize(() => this.streaming$.next(false))\n );\n }\n\n stopGeneration(): Observable<any> {\n const error = new Error('Not supported in REST');\n console.error(error);\n return throwError(() => error);\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n action: \"SavedChatList\",\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n from(get<{ savedChat: SavedChat[] }>(`plugin/${this.REQUEST_URL}`, searchParams))\n .subscribe({\n next: res => {\n this.savedChats$.next(res.savedChat);\n this.savedChatsError$.next(false);\n },\n error: error => {\n console.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n this.savedChatsError$.next(true);\n this.notificationsService.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n }\n });\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChatResponse> {\n const data = {\n action: \"SavedChatAdd\",\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n // Request the Chat endpoint\n const paramsObject = Object.fromEntries(searchParams.entries());\n\n return from(post<SavedChatResponse>(`plugin/${this.REQUEST_URL}`, paramsObject))\n .pipe(\n tap(res => {\n this.generateAuditEvent('ast-saved-chat.add', { duration: res.executionTimeMilliseconds }, res.savedChat.id) // Generate audit event\n this.setSavedChatId(res.savedChat.id); // Persist the savedChatId\n }),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const data = {\n action: \"SavedChatGet\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<{ savedChat: SavedChatHistory, executionTimeMilliseconds: number }>(`plugin/${this.REQUEST_URL}`, searchParams))\n .pipe(\n tap(res => this.generateAuditEvent('ast-saved-chat.load', { duration: res.executionTimeMilliseconds }, res.savedChat.id)),\n map(res => res.savedChat),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChatResponse> {\n const data = {\n action: \"SavedChatUpdate\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if (name) data[\"title\"] = name;\n if (messages) data[\"history\"] = messages;\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n // Request the Chat endpoint\n const paramsObject = Object.fromEntries(searchParams.entries());\n\n return from(post<SavedChatResponse>(`plugin/${this.REQUEST_URL}`, paramsObject))\n .pipe(\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n deleteSavedChat(ids: string[]): Observable<DeleteSavedChatResponse> {\n const data = {\n action: \"SavedChatDelete\",\n instanceId: this.chatInstanceId,\n savedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n // Request the Chat endpoint\n const paramsObject = Object.fromEntries(searchParams.entries());\n\n return from(post<DeleteSavedChatResponse>(`plugin/${this.REQUEST_URL}`, paramsObject))\n .pipe(\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n}\n","import { Injectable } from \"@angular/core\";\r\nimport { Query } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SearchService {\r\n query: Query\r\n}","import { CommonModule } from '@angular/common';\nimport { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';\nimport { Subscription, filter, of, switchMap, tap } from 'rxjs';\nimport { provideTranslocoScope, TranslocoPipe} from '@jsverse/transloco';\n\nimport { isAuthenticated } from '@sinequa/atomic';\n\nimport { ChatService } from '../chat.service';\nimport { InstanceManagerService } from '../instance-manager.service';\nimport { ChatConfig, TokenConsumption, UserTokenConsumption } from '../types';\nimport { TooltipDirective } from '../tooltip/tooltip.directive';\n\n@Component({\n selector: 'sq-token-progress-bar',\n templateUrl: './token-progress-bar.component.html',\n styleUrls: ['./token-progress-bar.component.scss'],\n standalone: true,\n providers: [provideTranslocoScope('token-consumption')],\n imports: [CommonModule, TooltipDirective, TranslocoPipe]\n})\nexport class TokenProgressBarComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n chatService: ChatService;\n config: ChatConfig;\n subscription = new Subscription();\n\n // User token consumption progress bar\n userPercentage?: number;\n userTokensResetDate?: string;\n\n // Current chat token consumption progress bar\n chatPercentage?: number;\n\n public instanceManagerService = inject(InstanceManagerService);\n\n ngOnInit() {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n this.config = this.chatService.assistantConfig$.value!;\n this.onUserTokensConsumption();\n this.onChatTokensConsumption();\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onUserTokensConsumption() {\n this.subscription.add(\n this.chatService.userTokenConsumption$.subscribe(\n (data: UserTokenConsumption | undefined) => {\n if (data) {\n this.userPercentage = data.percentage;\n this.userTokensResetDate = data.nextResetDate;\n }\n }\n )\n );\n }\n\n onChatTokensConsumption() {\n this.subscription.add(\n this.chatService.chatTokenConsumption$.subscribe(\n (data: TokenConsumption | undefined) => {\n if (data) {\n this.chatPercentage = data.percentage;\n }\n }\n )\n );\n }\n\n}\n","<div class=\"bars-container d-flex flex-row gap-2 p-2 me-4\" *ngIf=\"(config?.globalSettings?.displayUserQuotaConsumption && userPercentage !== undefined) || (config?.globalSettings?.displayChatTokensConsumption && chatPercentage !== undefined)\">\n <div *ngIf=\"(config?.globalSettings?.displayUserQuotaConsumption && userPercentage !== undefined)\" class=\"token-progress-bar\" [sqTooltip]=\"'tokenConsumption.userConsumptionTitle' | transloco : { percentage: userPercentage, time: userTokensResetDate }\"\n [style.background]=\"'radial-gradient(closest-side, var(--ast-primary-bg, #F8F8F8) 70%, transparent 75% 100%), conic-gradient(#FF854A ' + userPercentage + '%, #0040BF 0)'\">\n </div>\n <div *ngIf=\"(config?.globalSettings?.displayChatTokensConsumption && chatPercentage !== undefined)\" class=\"token-progress-bar\" [sqTooltip]=\"'tokenConsumption.chatConsumptionTitle' | transloco : { percentage: chatPercentage }\"\n [style.background]=\"'radial-gradient(closest-side, var(--ast-primary-bg, #F8F8F8) 70%, transparent 75% 100%), conic-gradient(#FF854A ' + chatPercentage + '%, #0040BF 0)'\">\n </div>\n</div>\n","import { Injectable, InjectionToken } from \"@angular/core\";\nimport { HubConnectionBuilder, LogLevel, HubConnection, MessageHeaders, HttpTransportType, ITransport } from '@microsoft/signalr';\nimport { globalConfig } from \"@sinequa/atomic\";\n\nexport interface ConnectionOptions {\n withCredentials?: boolean; // if true, the browser automatically includes the authentication cookie in the request headers when establishing the SignalR connection\n headers?: MessageHeaders;\n transport?: HttpTransportType | ITransport; // If transports are provided, use them; otherwise, let SignalR negotiate\n skipNegotiation?: boolean,\n accessTokenFactory?: () => string | Promise<string>;\n}\n\n/** A token that is used to inject the transports allowed to use by hub connection.\n *\n * Expects a {@link HttpTransportType} value.\n*/\nexport const SIGNAL_R_TRANSPORTS = new InjectionToken<HttpTransportType>('SIGNAL_R_TRANSPORTS');\n\n/** A token that is used to inject the log level for the hub connection.\n *\n * Expects a {@link LogLevel} value.\n*/\nexport const SIGNAL_R_LOG_LEVEL = new InjectionToken<LogLevel>('SIGNAL_R_LOG_LEVEL');\n\n/**\n * A service to connect the Sinequa server to the client via SignalR\n */\n@Injectable({\n providedIn: \"root\"\n})\nexport class SignalRWebService {\n\n /**\n * Builds a SignalR connection to the given endpoint\n * @param endpointName Name of the endpoint to connect to\n * @param options Options for the connection. It must overrides the default options\n * @param logLevel The log level for the connection\n * @param automaticReconnect Whether the connection should automatically attempt to reconnect\n * @returns A SignalR connection\n */\n buildConnection(endpointName: string, options: ConnectionOptions, logLevel = LogLevel.Information, automaticReconnect = false): HubConnection {\n const { backendUrl} = globalConfig;\n const url = `${backendUrl}/endpoints/v1/${endpointName}`;\n\n const connectionBuilder = new HubConnectionBuilder()\n .withUrl(url, options)\n .configureLogging(logLevel);\n\n if (automaticReconnect) {\n connectionBuilder.withAutomaticReconnect();\n }\n\n return connectionBuilder.build();\n }\n\n /**\n * Starts a SignalR connection.\n * @param connection A SignalR connection\n */\n async startConnection(connection: HubConnection | undefined): Promise<void> {\n if (!connection) {\n throw new Error(\"Please provide a valid connection to start\");\n }\n try {\n await connection.start();\n console.log(`The SignalR connection has been successfully established! \\n url: ${connection.baseUrl} \\n connectionId: ${connection.connectionId}`);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Stops a SignalR connection.\n * @param connection A SignalR connection\n */\n async stopConnection(connection: HubConnection | undefined): Promise<void> {\n if (!connection) {\n throw new Error(\"Please provide a valid connection to stop\");\n }\n try {\n await connection.stop();\n console.log(`The SignalR connection has been successfully stopped! \\n url: ${connection.baseUrl} \\n connectionId: ${connection.connectionId}`);\n } catch (error) {\n throw error;\n }\n }\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { HttpTransportType, HubConnection, LogLevel, MessageHeaders } from \"@microsoft/signalr\";\nimport { Observable, Subject, catchError, defer, forkJoin, from, fromEvent, map, merge, mergeMap, of, switchMap, take, takeUntil, tap, throwError } from \"rxjs\";\n\nimport { Query, getToken, globalConfig } from \"@sinequa/atomic\";\n\nimport { ChatService } from \"./chat.service\";\nimport { ConnectionOptions, SignalRWebService } from \"./services/signalR.web.service\";\nimport { ActionMessage, ActionResultEvent, ActionStartEvent, ActionStopEvent, ChatContextAttachment, ChatMessage, ChatPayload, ChatProgress, ChatResponse, ContextMessageEvent, DebugMessage, DebugMessageEvent, DeleteSavedChatResponse, ErrorEvent, GllmFunction, GllmModelDescription, HistoryEvent, MessageEvent, MessageHandler, QuotaEvent, SavedChatHistory, SavedChatResponse, SuggestedActionsEvent } from \"./types\";\n\n@Injectable()\nexport class WebSocketChatService extends ChatService {\n\n public connection: HubConnection | undefined;\n\n private _messageHandlers: Map<string, MessageHandler<any>> = new Map();\n private _response: ChatMessage[];\n private _actionMap = new Map<string, ActionMessage>();\n private _progress: ChatProgress[] | undefined = undefined;\n private _executionTime: string;\n private _executionTimeMilliseconds?: number;\n private _attachments: ChatContextAttachment[] = [];\n private _debugMessages: DebugMessage[] = [];\n\n public signalRService = inject(SignalRWebService);\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the assistant process.\n * It includes building and starting a connection, executing parallel requests for models and functions, and handling errors during the process.\n * ⚠️ This method MUST be called ONLY if the user is loggedIn and once when the assistant is initialized.\n *\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n // Ensure all logic is executed when subscribed to the observable\n return defer(() => {\n this.getRequestsUrl();\n\n return from(\n // Build the connection\n this.buildConnection()\n ).pipe(\n tap(() => this.initMessageHandlers()),\n // Start the connection\n switchMap(() => this.startConnection()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n take(1)\n );\n });\n }\n\n /**\n * Define the assistant endpoint to use for the websocket requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.websocketEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.websocketEndpoint;\n } else {\n throw new Error(`The property 'websocketEndpoint' must be provided when attempting to use 'WebSocket' in assistant instance`);\n }\n }\n\n overrideUser(): void {\n const { userOverrideActive, userOverride } = globalConfig;\n if (!(userOverrideActive && userOverride)) {\n this.userOverride$.next(false);\n return;\n }\n\n // Prepare the payload to send to the OverrideUser method\n const data = {\n instanceId: this.chatInstanceId,\n user: userOverride.username,\n domain: userOverride.domain\n }\n\n // Invoke the OverrideUser method and handle errors\n this.connection!.invoke('OverrideUser', data)\n .then((res) => this.userOverride$.next(!!res))\n .catch(error => {\n console.error('Error invoking OverrideUser:', error);\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n });\n }\n\n listModels(): Observable<GllmModelDescription[] | undefined> {\n const modelsSubject$ = new Subject<GllmModelDescription[] | undefined>();\n\n this.connection!.on('ListModels', (res) => {\n this.models = (res.models as GllmModelDescription[] | undefined)?.filter(model => !!model.enable);\n modelsSubject$.next(this.models);\n modelsSubject$.complete()\n });\n\n // Send the request to get the list of models\n this.connection!.invoke('ListModels', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListModels:', error);\n modelsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return modelsSubject$.asObservable();\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const functionsSubject$ = new Subject<GllmFunction[] | undefined>();\n\n this.connection!.on('ListFunctions', (res) => {\n this.functions = (res.functions as GllmFunction[] | undefined)?.filter(func => func.enabled);\n functionsSubject$.next(this.functions);\n functionsSubject$.complete()\n });\n\n // Send the request to get the list of functions\n this.connection!.invoke('ListFunctions', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListFunctions:', error);\n functionsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return functionsSubject$.asObservable();\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload = {\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage ? this.transloco.translate(this.assistantConfig$.value!.globalSettings.genericChatErrorMessage) : \"\"\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n // Initialize the response with an empty assistant message\n this._response = [{ role: \"assistant\", content: \"\", additionalProperties: { display: true } }] // here display: true is needed in order to be able to show the progress\n\n // Create a Subject to signal completion\n const completion$ = new Subject<void>();\n\n // Create observables for each non-global handler in the _messageHandlers map (default and eventual custom ones) once it is triggered by the hub connection\n const observables = Array\n .from(this._messageHandlers.entries())\n .filter(([eventName, eventHandler]) => !eventHandler.isGlobalHandler)\n .map(([eventName, eventHandler]) => fromEvent<any>(this.connection!, eventName).pipe(\n mergeMap((event) => {\n // Wrap the handler in a try-catch block to prevent the entire stream from failing if an error occurs in a single handler\n try {\n // Execute the handler and emit the result\n // NB: here we could use [eventHandler.handler(event)] which behind the scenes mergeMap interprets this array as an observable sequence with one item, which it then emits\n return of(eventHandler.handler(event));\n } catch (error) {\n console.error(`Error in event handler for ${eventName}:`, error);\n // Use throwError to propagate the error downstream\n return throwError(() => new Error(`Error in event handler for ${eventName}: ${error}`));\n }\n })\n ));\n\n // Then merge them into a single observable in order to simulate the streaming behavior\n const combined$ = merge(...observables).pipe(\n map(() => {\n // Define $progress from the _actionMap\n const actions = Array.from(this._actionMap.values());\n this._progress = actions.length > 0\n ? actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n : undefined;\n\n // Always update ONLY the first assistant message of the _response with the new $progress, $attachment and $debug\n // Assuming that the first assistant message is always visible since the hub does not send hidden messages by design\n // So even if the first assistant message is hidden (display: false), the _response[0] will and should contain :\n // - $progress, $attachment and $debug\n // - the content of the first visible assistant message in the workflow\n // This is mandatory in order to match the behavior of consecutive messages and maintain consistency with the chatHistory\n if(!!this._progress || this._attachments.length > 0 || this._debugMessages.length > 0) {\n this._response[0].additionalProperties.$progress = this._progress;\n this._response[0].additionalProperties.$attachment = this._attachments;\n this._response[0].additionalProperties.$debug = this._debugMessages;\n }\n\n // Return the result\n return { history: [...messages, ...this._response], executionTime: this._executionTime, executionTimeMilliseconds: this._executionTimeMilliseconds };\n }),\n takeUntil(completion$), // Complete the observable when completion$ emits\n );\n\n // return a new Observable that emits the result of the combined stream and handles the eventual errors of the invocation of the Chat method\n return new Observable(observer => {\n // Subscribe to combined stream\n combined$.subscribe({\n next: (value) => observer.next(value),\n error: (err) => observer.error(err)\n });\n\n // Invoke the Chat method and handle errors\n this.connection!.invoke('Chat', data)\n .then(() => {\n // If a valid assistant message with (display: true) was found, update it\n // and it should always the case\n const index = this.firstVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$progress = this._progress;\n this.chatHistory![index].additionalProperties.$attachment = this._attachments;\n this.chatHistory![index].additionalProperties.$debug = this._debugMessages;\n }\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory!.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory!).pipe(tap(() => this.listSavedChat())) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe({\n next: () => {},\n error: (error) => {\n this.streaming$.next(false);\n observer.error(error);\n },\n complete: () => {\n this.streaming$.next(false);\n observer.complete();\n }\n });\n } else {\n this.streaming$.next(false);\n observer.complete();\n }\n })\n .catch(error => {\n console.error('Error invoking Chat:', error);\n this.streaming$.next(false);\n // Emit the error to the newly created observable\n observer.error(error);\n // Return a resolved promise to handle the error and prevent unhandled promise rejection\n return Promise.resolve();\n })\n .finally(() => {\n // This block concerns ONLY the completion of the \"Chat\" method invocation.\n // This means the completion of the combined$ stream.\n // It does not take into account the completion of the entire fetch method (the observable returned by fetch) and which depends on the completion of the save chat action if enabled\n this._response = []; // Clear the _response\n this._actionMap.clear(); // Clear the _actionMap\n this._progress = undefined; // Clear the _progress\n this._attachments = []; // Clear the _attachments\n this._debugMessages = []; // Clear the _debugMessages\n this._executionTime = \"\"; // Clear the _executionTime\n this._executionTimeMilliseconds = undefined; // Clear the _executionTimeMilliseconds\n completion$.next(); // Emit a signal to complete the observables\n completion$.complete(); // Complete the subject\n });\n });\n }\n\n stopGeneration(): Observable<boolean> {\n // Start stopping generation by invoking the CancelTasks method\n this.stoppingGeneration$.next(true);\n // Create a Subject to hold the result of the CancelTasks method\n const stopGenerationSubject$ = new Subject<boolean>();\n\n this.connection!.on('CancelTasks', (res) => {\n // When the generation is stopped before streaming any VISIBLE assistant message, this means that $progress, $attachment and $debug properties will be lost.\n // However, the \"ContextMessage\" frames will be persisted in the chatHistory and the assistant may reference them in the next generation.\n // This leads to the problem of referencing undisplayed attachments in the next generation.\n // To solve this problem, we need to persist $progress, $attachment and $debug properties by adding a new assistant message with empty content and these properties.\n if (this._response.length === 1 && this._response[0].content === \"\") {\n this.chatHistory?.push({role: \"assistant\", content: \"\", additionalProperties: {display: true, $progress: this._progress, $attachment: this._attachments, $debug: this._debugMessages}});\n }\n stopGenerationSubject$.next(!!res); // Emit the result of the CancelTasks method\n stopGenerationSubject$.complete(); // Complete the subject\n this.stoppingGeneration$.next(false); // Complete stopping generation\n });\n\n // Invoke the CancelTasks method and handle errors\n this.connection!.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n stopGenerationSubject$.error(new Error(error));\n this.stoppingGeneration$.next(false); // Complete stopping generation\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n });\n\n return stopGenerationSubject$.asObservable();\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n appName: this.appService.appName,\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatList', (res) => {\n this.savedChats$.next(res.savedChats); // emits the result to the savedChats$ subject\n this.savedChatsError$.next(false);\n });\n\n // Invoke the method SavedChatList\n this.connection!.invoke('SavedChatList', data)\n .catch(error => {\n console.error('Error invoking SavedChatList:', error);\n this.savedChatsError$.next(true);\n return Promise.resolve();\n });\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const savedChatSubject$ = new Subject<SavedChatHistory | undefined>();\n\n const data = {\n appName: this.appService.appName,\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatGet', (res) => {\n this.generateAuditEvent('ast-saved-chat.load', { duration: res.executionTimeMilliseconds }, res.savedChat.id)\n savedChatSubject$.next(res.savedChat);\n savedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatGet\n this.connection!.invoke('SavedChatGet', data)\n .catch(error => {\n console.error('Error invoking SavedChatGet:', error);\n savedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return savedChatSubject$.asObservable();\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChatResponse> {\n const addSavedChatSubject$ = new Subject<SavedChatResponse>();\n\n const data = {\n appName: this.appService.appName,\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatAdd', (res) => {\n this.setSavedChatId(res.savedChat.id); // Persist the savedChatId\n this.generateAuditEvent('ast-saved-chat.add', { duration: res.executionTimeMilliseconds }, res.savedChat.id); // Generate audit event\n addSavedChatSubject$.next(res);\n addSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatAdd\n this.connection!.invoke('SavedChatAdd', data)\n .catch(error => {\n console.error('Error invoking SavedChatAdd:', error);\n addSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return addSavedChatSubject$.asObservable();\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChatResponse> {\n const updateSavedChatSubject$ = new Subject<SavedChatResponse>();\n\n const data = {\n appName: this.appService.appName,\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if(name) data[\"title\"] = name;\n if(messages) data[\"history\"] = messages;\n\n this.connection!.on('SavedChatUpdate', (res) => {\n updateSavedChatSubject$.next(res);\n updateSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatUpdate\n this.connection!.invoke('SavedChatUpdate', data)\n .catch(error => {\n console.error('Error invoking SavedChatUpdate:', error);\n updateSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return updateSavedChatSubject$.asObservable();\n }\n\n deleteSavedChat(ids: string[]): Observable<DeleteSavedChatResponse> {\n const deleteSavedChatSubject$ = new Subject<DeleteSavedChatResponse>();\n\n const data = {\n appName: this.appService.appName,\n instanceId: this.chatInstanceId,\n SavedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatDelete', (res) => {\n deleteSavedChatSubject$.next(res);\n deleteSavedChatSubject$.complete();\n });\n\n // Invoke the method SavedChatDelete\n this.connection!.invoke('SavedChatDelete', data)\n .catch(error => {\n console.error('Error invoking SavedChatDelete:', error);\n deleteSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return deleteSavedChatSubject$.asObservable();\n }\n\n /**\n * Initialize out-of-the-box handlers\n * It is a placeholder for non-streaming scenarios, where you invoke a specific hub method, and the server responds with frame message(s)\n */\n initMessageHandlers() {\n this.addMessageHandler(\n \"Error\",\n {\n handler: (error: ErrorEvent) => {\n console.error(error);\n this.notificationsService.error(error);\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Quota\",\n {\n handler: (message: QuotaEvent) => {\n try {\n this.updateQuota(message.quota)\n } catch (error) {\n console.error(error);\n }\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Debug\",\n { handler: () => {},\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"ActionStart\",\n { handler: (action: ActionStartEvent) => this._actionMap.set(action.guid, action),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionResult\",\n {\n handler: (action: ActionResultEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionStop\",\n {\n handler: (action: ActionStopEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ContextMessage\",\n {\n handler: (message: ContextMessageEvent) => {\n this._attachments.push(message.additionalProperties);\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"Message\",\n {\n handler: (message: MessageEvent) => this._response.at(-1)!.content += message.delta ?? \"\",\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"History\",\n {\n handler: (history: HistoryEvent) => {\n // The ChatHistory is updated: it is the current copy concatenated with the new items ONLY (it can have multiple messages: the context messages + the response message)\n // This is mandatory to not lose the previous updates of the chatHistory when the assistant is streaming multiple message steps\n this.chatHistory = [...this.chatHistory!, ...(history.history.slice(this.chatHistory!.length))];\n // Emit the updated chat usage metrics\n if (!!this.chatHistory.at(-1)?.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(this.chatHistory.at(-1)!.additionalProperties.usageMetrics!);\n }\n this._executionTime = history.executionTime;\n this._executionTimeMilliseconds = history.executionTimeMilliseconds;\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"SuggestedActions\",\n {\n handler: (message: SuggestedActionsEvent) => {\n // Since after the \"History\" and \"MessageBreak\" that this event is caught,\n // $suggestedAction needs to be updated directly to the last visible \"assistant\" message in the _response and the chatHistory\n this._response.at(-1)!.additionalProperties.$suggestedAction = (this._response.at(-1)!.additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n const index = this.lastVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$suggestedAction = (this.chatHistory![index].additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n }\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"DebugDisplay\",\n {\n handler: (message: DebugMessageEvent) => this._debugMessages = this._debugMessages.concat(message),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"MessageBreak\",\n {\n handler: () => {\n // Generate audit event\n const details = {\n 'duration': this._executionTimeMilliseconds !== undefined ? this._executionTimeMilliseconds : this._executionTime,\n 'role': this.chatHistory!.at(-1)!.role, // 'assistant'\n 'rank': this.chatHistory!.length - 1,\n 'generation-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': JSON.stringify(this._attachments.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => {\n if (!!this.assistantConfig$.value?.auditSettings?.logContent) return { partId, text };\n return { partId };\n }),\n type\n })))\n };\n\n if (!!this.assistantConfig$.value?.auditSettings?.logContent)\n details['text'] = this.chatHistory!.at(-1)!.content;\n\n this.generateAuditEvent('ast-message', details);\n // Push a new assistant message to the _response array ONLY if the content of the last message is not empty\n if (this._response.at(-1)!.content !== \"\") {\n this._response.push({role: \"assistant\", content: \"\", additionalProperties: {display: true}})\n }\n },\n isGlobalHandler: false\n }\n );\n }\n\n /**\n * Override and register the entire _messageHandlers map by merging the provided map with the default one\n * @param _messageHandlers\n */\n overrideMessageHandlers<T>(_messageHandlers: Map<string, MessageHandler<T>>) {\n // Clear the already registered global chat handlers before merging the new ones\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.unsubscribeMessageHandler(eventName);\n }\n });\n\n // Merge the new event handlers with the existing ones\n this._messageHandlers = new Map([...this._messageHandlers, ..._messageHandlers]);\n\n // Register the global handlers among the merged map\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n });\n }\n\n /**\n * Add a listener for a specific event.\n * If a listener for this same event already exists, it will be overridden.\n * If the listener has \"isGlobalHandler\" set to true, it will be registered to the hub connection.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n addMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n this._messageHandlers.set(eventName, eventHandler);\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n }\n\n /**\n * Dynamically register a listener for a specific event.\n * If a listener for this event already exists, it will be overridden.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n protected registerMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n if (!this.connection) {\n console.log(\"No connection found to register the listener\" + eventName);\n return;\n }\n\n this.connection.on(eventName, (data: T) => {\n eventHandler.handler(data);\n });\n }\n\n /**\n * Remove a listener for a specific event from the _messageHandlers map and unsubscribe from receiving messages for this event from the SignalR hub.\n * @param eventName Name of the event to remove the listener for\n */\n removeMessageHandler(eventName: string) {\n this._messageHandlers.delete(eventName);\n this.unsubscribeMessageHandler(eventName);\n }\n\n /**\n * Unsubscribe from receiving messages for a specific event from the SignalR hub.\n * ALL its related listeners will be removed from hub connection\n * This is needed to prevent accumulating old listeners when overriding the entire _messageHandlers map\n * @param eventName Name of the event\n */\n protected unsubscribeMessageHandler(eventName: string) {\n this.connection!.off(eventName);\n }\n\n /**\n * Build a connection to the signalR websocket and register default listeners to the methods defined in the server hub class\n * @param options The options for the connection. It overrides the default options\n * @param logLevel Define the log level displayed in the console\n * @returns Promise that resolves when the connection is built\n */\n buildConnection(options?: ConnectionOptions): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.REQUEST_URL) {\n reject(new Error(\"No endpoint provided to connect the websocket to\"));\n return;\n }\n const logLevel = this._getLogLevel();\n\n if (this.assistantConfig$.value?.connectionSettings.signalRSkipNegotiation === true)\n options = {...options, skipNegotiation: true};\n\n this.connection = this.signalRService.buildConnection(this.REQUEST_URL, {...this.defaultOptions, ...options}, logLevel, true);\n\n const signalRServerTimeoutInMilliseconds = this.assistantConfig$.value?.connectionSettings.signalRServerTimeoutInMilliseconds;\n if (signalRServerTimeoutInMilliseconds) {\n this.connection.serverTimeoutInMilliseconds = signalRServerTimeoutInMilliseconds;\n }\n\n resolve();\n });\n }\n\n /**\n * Start the connection\n * @returns Promise that resolves when the connection is started\n */\n startConnection(): Promise<void> {\n return this.signalRService.startConnection(this.connection);\n }\n\n /**\n * Stop the connection\n * @returns Promise that resolves when the connection is stopped\n */\n stopConnection(): Promise<void> {\n return this.signalRService.stopConnection(this.connection);\n }\n\n private _getTransports(): HttpTransportType {\n switch (this.assistantConfig$.value?.connectionSettings.signalRTransport) {\n case \"WebSockets\":\n return HttpTransportType.WebSockets;\n case \"ServerSentEvents\":\n return HttpTransportType.ServerSentEvents;\n case \"LongPolling\":\n return HttpTransportType.LongPolling;\n default:\n return HttpTransportType.None;\n }\n }\n\n private _getLogLevel(): LogLevel {\n switch (this.assistantConfig$.value?.connectionSettings.signalRLogLevel) {\n case \"Critical\":\n return LogLevel.Critical; // Log level for diagnostic messages that indicate a failure that will terminate the entire application.\n case \"Debug\":\n return LogLevel.Debug; // Log level for low severity diagnostic messages.\n case \"Error\":\n return LogLevel.Error; // Log level for diagnostic messages that indicate a failure in the current operation.\n case \"Information\":\n return LogLevel.Information; // Log level for informational diagnostic messages.\n case \"None\":\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n case \"Trace\":\n return LogLevel.Trace; // Log level for very low severity diagnostic messages.\n case \"Warning\":\n return LogLevel.Warning; // Log level for diagnostic messages that indicate a non-fatal problem.\n default:\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n }\n }\n\n get defaultOptions(): ConnectionOptions {\n let headers: MessageHeaders = {\n \"sinequa-force-camel-case\": \"true\",\n \"x-language\": this.getCurrentLocaleName(),\n \"ui-language\": this.getCurrentLocaleName(),\n };\n const token = getToken();\n if(token){\n headers = {...headers, \"sinequa-csrf-token\": token};\n }\n\n // For the first GET request sent by signalR to start a WebSocket protocol,\n // as far as we know, signalR only lets us tweak the request with this access token factory\n // so we pass along the Sinequa CSRF token to pass the CSRF check..\n return {\n transport: this._getTransports(),\n withCredentials: true,\n headers,\n skipNegotiation: false,\n accessTokenFactory: () => token || \"\"\n }\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, inject } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { TranslocoPipe, TranslocoService, provideTranslocoScope } from '@jsverse/transloco';\nimport { HubConnection, HubConnectionState } from \"@microsoft/signalr\";\nimport { BehaviorSubject, Subscription, combineLatest, filter, fromEvent, map, merge, of, switchMap, take, tap } from \"rxjs\";\n\nimport { AppGlobalConfig, Article, Query, isAuthenticated, setGlobalConfig } from \"@sinequa/atomic\";\n\nimport { ChatMessageComponent } from \"./chat-message/chat-message.component\";\nimport { ChatService } from \"./chat.service\";\nimport { DebugMessageComponent } from \"./debug-message/debug-message.component\";\nimport { InstanceManagerService } from \"./instance-manager.service\";\nimport { RestChatService } from \"./rest-chat.service\";\nimport { NotificationsService } from \"./services/notification.service\";\nimport { PrincipalService } from \"./services/principal.service\";\nimport { SearchService } from \"./services/search.service\";\nimport { TokenProgressBarComponent } from \"./token-progress-bar/token-progress-bar.component\";\nimport { TooltipDirective } from \"./tooltip/tooltip.directive\";\nimport { ChatConfig, ChatContextAttachment, ChatMessage, DebugMessage, GllmModelDescription, InitChat, MessageHandler, RawMessage, SuggestedAction } from \"./types\";\nimport { RawMessageContent, TextMessageContent } from \"./types/message-content.types\";\nimport { WebSocketChatService } from \"./websocket-chat.service\";\n\n@Component({\n selector: 'sq-chat-v3', // mandatory since @sinequa/components already has the same tag-name \"sq-chat\"\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n providers: [\n RestChatService,\n WebSocketChatService,\n provideTranslocoScope('chat')\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, FormsModule, ChatMessageComponent, TokenProgressBarComponent, DebugMessageComponent, TooltipDirective, TranslocoPipe]\n})\nexport class ChatComponent implements OnInit, OnChanges, OnDestroy {\n\n public websocketService = inject(WebSocketChatService);\n public restService = inject(RestChatService);\n public instanceManagerService = inject(InstanceManagerService);\n public searchService = inject(SearchService);\n public principalService = inject(PrincipalService);\n public cdr = inject(ChangeDetectorRef);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n /** Define the key based on it, the chat service instance will be stored */\n @Input() instanceId: string;\n /** Define the query to use to fetch answers */\n @Input() query: Query = this.searchService.query;\n /** Function that determines whether the chat should be reloaded after the query changes\n * If not provided, the chat will be reloaded by default\n * @param prevQuery The previous query\n * @param newQuery The new query\n * @returns true if the chat should be reloaded, false otherwise\n */\n @Input() queryChangeShouldTriggerReload: (prevQuery: Query, newQuery: Query) => boolean;\n /** Define the protocol to be used for this chat instance*/\n @Input() protocol: 'REST' | 'WEBSOCKET' = \"WEBSOCKET\";\n /** Map of listeners overriding default registered ones*/\n @Input() messageHandlers: Map<string, MessageHandler<any>> = new Map();\n /** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */\n @Input() automaticScrollToLastResponse = false;\n /** When the assistant answer a user question, automatically focus to the chat input */\n @Input() focusAfterResponse = false;\n /** A chat discussion that the component should get initialized with it */\n @Input() chat?: InitChat;\n /** Icon to use for the assistant messages */\n @Input() assistantMessageIcon = 'sq-sinequa';\n /** Icon to use for the user messages */\n @Input() userMessageIcon: string;\n /** Icon to use for the connection error messages */\n @Input() connectionErrorMessageIcon: string;\n /** Icon to use for the search warning messages */\n @Input() searchWarningMessageIcon: string;\n // Add custom additionalWorkflowProperties to the user query message\n @Input() additionalWorkflowProperties: Record<string, any> = {};\n /** Event emitter triggered once the signalR connection is established */\n @Output() connection = new EventEmitter<HubConnection>();\n /** Event emitter triggered each time the assistant updates the current chat */\n /** Event emitter triggered when the chat is loading new content */\n @Output(\"loading\") loading$ = new EventEmitter<boolean>(false);\n /** Emits the assistant configuration used when instantiating the component */\n @Output(\"config\") _config = new EventEmitter<ChatConfig>();\n @Output() data = new EventEmitter<ChatMessage[]>();\n /** Event emitter triggered when the user clicks to open the original document representing the context attachment*/\n @Output() openDocument = new EventEmitter<Article>();\n /** Event emitter triggered when the user clicks to open the preview of a document representing the context attachment */\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n /** Event emitter triggered when the user clicks on a suggested action */\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n /** ViewChild decorators to access the template elements */\n @ViewChild('messageList') messageList?: ElementRef<HTMLUListElement>;\n @ViewChild('questionInput') questionInput?: ElementRef<HTMLTextAreaElement>;\n /** ContentChild decorators allowing the override of the default templates from the parent component */\n @ContentChild('loadingTpl') loadingTpl?: TemplateRef<any>;\n @ContentChild('reportTpl') reportTpl?: TemplateRef<any>;\n @ContentChild('tokenConsumptionTpl') tokenConsumptionTpl?: TemplateRef<any>;\n @ContentChild('debugMessagesTpl') debugMessagesTpl?: TemplateRef<any>;\n\n @Input() appConfig: AppGlobalConfig;\n\n chatService: ChatService;\n config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n isAdminOrDeletedAdmin = false;\n question = '';\n\n private _sub = new Subscription();\n private _dataSubscription: Subscription | undefined;\n\n /** Variables that depend on the type of model in use */\n modelDescription?: GllmModelDescription;\n\n messageToEdit?: number;\n remappedMessageToEdit?: number;\n changes$ = new BehaviorSubject<SimpleChanges | undefined>(undefined);\n currentMessageIndex: number | undefined;\n firstChangesHandled = false;\n isAtBottom = true;\n initializationError = false;\n enabledUserInput = false;\n isConnected = true; // By default, the chat is considered connected\n retrialAttempts: number | undefined;\n // Flag to track whether the 'reconnected' listener is already registered\n private _isReconnectedListenerRegistered = false;\n\n // Issue reporting\n issueTypes?: string[];\n defaultIssueTypes: string[] = [\n 'chat.userInterfaceBug',\n 'chat.incorrectResponse',\n 'chat.incompleteResponse',\n 'chat.technicalIssue',\n 'chat.privacyDataSecurityIssue',\n 'chat.otherIssue'\n ];\n issueType: string = '';\n reportComment?: string;\n messageToReport?: ChatMessage;\n reportRank?: number;\n reportType: 'like' | 'dislike' = 'dislike';\n showReport = false;\n\n // Debug messages\n debugMessages: DebugMessage[] | undefined;\n showDebugMessages = false;\n\n // Last message duration\n lastFetchDuration?: number;\n\n private _previousQuery: Query;\n private _reloadSubscription: Subscription | undefined = undefined;\n\n ngOnInit(): void {\n if (this.appConfig) {\n setGlobalConfig(this.appConfig);\n }\n\n this._sub.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n map(_ => this.chatService.initChatConfig()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig),\n switchMap(_ => this.chatService.init()),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n if (this.chatService instanceof WebSocketChatService) {\n this.connection.emit(this.chatService.connection);\n }\n this.onLoadChat();\n }),\n tap(_ => this.chatService.overrideUser()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.assistantConfig$),\n tap(config => {\n this.isAdminOrDeletedAdmin = this.principalService.principal!.isAdministrator || this.principalService.principal!.isDelegatedAdmin || false;\n this.config = config!;\n this.enabledUserInput = this.config.modeSettings.enabledUserInput;\n this.issueTypes = this.config.auditSettings?.issueTypes?.length ? this.config.auditSettings!.issueTypes : undefined;\n this._config.emit(config);\n try {\n this.updateModelDescription();\n if(!this.firstChangesHandled) {\n this._previousQuery = JSON.parse(JSON.stringify(this.query)); // Initialize the previous query\n this._handleChanges();\n this._addScrollListener();\n this.firstChangesHandled = true;\n }\n } catch (error) {\n this.initializationError = true\n throw error;\n }\n })\n ).subscribe()\n );\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._sub.unsubscribe();\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\n if (this.chatService instanceof WebSocketChatService) {\n this.chatService.stopConnection();\n }\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * Instantiate the chat service based on the provided @input protocol\n * This chat service instance will then be stored in the instanceManagerService with provided @input instanceId as a key\n */\n instantiateChatService(): void {\n switch (this.protocol) {\n case 'REST':\n this.chatService = this.restService;\n break;\n case 'WEBSOCKET':\n this.chatService = this.websocketService;\n break;\n default:\n throw new Error(`Could not found a ChatService implementation corresponding to the provided protocol: '${this.protocol}'`);\n }\n this.chatService.setChatInstanceId(this.instanceId);\n this.instanceManagerService.storeInstance(this.instanceId, this.chatService);\n }\n\n /**\n * Handles the changes in the chat component.\n * If the chat service is a WebSocketChatService, it handles the override of the message handlers if they exist.\n * Initializes the chat with the provided chat messages if they exist, otherwise loads the default chat.\n * If the chat is initialized, the initialization event is \"Query\", the query changes, and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true. Otherwise, the chat should be reloaded by default.\n * It takes into account the ongoing streaming process and the ongoing stopping process to trigger that conditionally define the logic\n * of the reload :\n * - If the chat is streaming, then stop the generation and wait for the fetch to complete before reloading the chat.\n * - If the chat is stopping the generation, then wait for the fetch to complete before reloading the chat.\n */\n private _handleChanges() {\n const changes = this.changes$.value;\n // If the chat service is a WebSocketChatService, handle the override of the message handlers if exists\n if (changes?.messageHandlers && this.messageHandlers && this.chatService instanceof WebSocketChatService) {\n this.chatService.overrideMessageHandlers(this.messageHandlers);\n }\n /**\n * Initialize the chat with the provided chat messages if exists, otherwise load the default chat\n * Once the chat is initialized (firstChangesHandled is true), allow opening the chat with the new provided messages (if exists)\n */\n if (!this.firstChangesHandled || changes?.chat) {\n const openChat = () => {\n if (this.messages$.value) {\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n }\n this.openChat(this.chat!.messages);\n };\n this.chatService.generateChatId();\n if (this.chat) {\n this.chatService.generateAuditEvent('ast-new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value),'chat-init': JSON.stringify(this.chat)});\n openChat();\n } else {\n this.chatService.generateAuditEvent('ast-new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)});\n this.loadDefaultChat();\n }\n }\n /**\n * If the chat is initialized, the initialization event is \"Query\", the query changes and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true\n * Otherwise, the chat should be reloaded by default\n */\n if (this.firstChangesHandled && changes?.query && this.config.modeSettings.initialization.event === 'Query') {\n if (this.queryChangeShouldTriggerReload ? this.queryChangeShouldTriggerReload(this._previousQuery, this.query) : true) {\n if (!!this.chatService.stoppingGeneration$.value) {\n if (!this._reloadSubscription) {\n // Create a subscription to wait for both streaming$ and stoppingGeneration$ to be false\n this._reloadSubscription = combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ])\n .pipe(\n filter(([streaming, stopping]) => !streaming && !stopping), // Wait until both are false\n take(1) // Complete after the first match\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription = undefined;\n });\n }\n } else if (!!this.chatService.streaming$.value) {\n if (!this._reloadSubscription) {\n this._reloadSubscription = this.chatService.stopGeneration()\n .subscribe({\n next: () => {},\n error: () => {\n // Clean up subscription and reset its value\n this._reloadSubscription?.unsubscribe();\n this._reloadSubscription = undefined;\n },\n complete: () => {\n // Wait for the ongoing fetch to complete, then trigger the reload\n this.chatService.streaming$.pipe(\n filter((streaming) => !streaming),\n take(1)\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription!.unsubscribe();\n this._reloadSubscription = undefined;\n });\n }\n });\n }\n } else {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n } else {\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n }\n }\n\n /**\n * Triggers a reload after the query change.\n * This method performs the necessary operations to reload the chat after a query change.\n * It sets the system and user messages, resets the savedChatId, generates a new chatId,\n * generates a new chat audit event, and handles the query mode.\n */\n private _triggerReloadAfterQueryChange() {\n const systemMsg = { role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: { display: false } };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = { role: 'user', content: ChatService.formatPrompt(this.transloco.translate(userPrompt) , { principal: this.principalService.principal }), additionalProperties: { display: this.config.modeSettings.displayUserPrompt } };\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.generateAuditEvent('ast-new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this._handleQueryMode(systemMsg, userMsg);\n }\n\n\n /**\n * Adds a scroll listener to the message list element.\n * The listener is triggered when any of the following events occur:\n * - Loading state changes\n * - Messages change\n * - Streaming state changes\n * - Scroll event occurs on the message list element\n *\n * When the listener is triggered, it updates the `isAtBottom` property.\n */\n private _addScrollListener() {\n this._sub.add(\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(this.messageList!.nativeElement, 'scroll')).subscribe(() => {\n this.isAtBottom = this._toggleScrollButtonVisibility();\n this.cdr.detectChanges();\n })\n );\n }\n\n /**\n * Get the model description based on the defaultValues service_id and model_id\n */\n updateModelDescription() {\n this.modelDescription = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.cdr.detectChanges();\n }\n\n /**\n * Submits a question from the user.\n * If the user is editing a previous message, removes all subsequent messages from the chat history.\n * Triggers the fetch of the answer for the submitted question by calling _fetchAnswer().\n * Clears the input value in the UI.\n * ⚠️ If the chat is streaming or stopping the generation, the operation is not allowed.\n */\n submitQuestion() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (this.question.trim() && this.messages$.value && this.chatService.chatHistory) {\n // When the user submits a question, if the user is editing a previous message, remove all subsequent messages from the chat history\n if (this.messageToEdit !== undefined) {\n // Update the messages in the UI\n this.messages$.next(this.messages$.value.slice(0, this.messageToEdit));\n // Update the raw messages in the chat history which is the clean version used to make the next request\n this.chatService.chatHistory = this.chatService.chatHistory.slice(0, this.remappedMessageToEdit);\n this.messageToEdit = undefined;\n this.remappedMessageToEdit = undefined;\n }\n // Remove the search warning message if exists\n if (this.chatService.chatHistory.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory.pop();\n }\n // Fetch the answer\n this._fetchAnswer(this.question.trim(), this.chatService.chatHistory);\n // Clear the input value in the UI\n this.questionInput!.nativeElement.value = '';\n this.questionInput!.nativeElement.style.height = `auto`;\n }\n }\n\n /**\n * Triggers the fetch of the answer for the given question and updates the conversation.\n * Generates an audit event for the user input.\n *\n * @param question - The question asked by the user.\n * @param conversation - The current conversation messages.\n */\n private _fetchAnswer(question: string, conversation: ChatMessage[]) {\n // merge additionalWorkflowProperties from the chat component and the customization JSON\n const additionalWorkflowProperties = { ...this.config.additionalWorkflowProperties, ...this.additionalWorkflowProperties };\n const userMsg = { role: 'user', content: question, additionalProperties: { display: true, isUserInput: true, additionalWorkflowProperties } };\n const messages = [...conversation, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n this.chatService.generateAuditEvent('ast-message', { ...this._defineMessageAuditDetails(userMsg, messages.length - 1), 'query': JSON.stringify(this.query), 'is-user-input': true, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(additionalWorkflowProperties) });\n }\n\n /**\n * Depending on the connection's state :\n * - If connected => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * - If any other state => a connection error message is displayed in the chat.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param messages The list of messages to invoke the chat endpoint with\n */\n public fetch(messages: ChatMessage[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this._updateConnectionStatus();\n this.cdr.detectChanges();\n\n if (this.isConnected) {\n this.loading$.next(true);\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = this.chatService.fetch(messages, this.query)\n .subscribe({\n next: res => {\n this.lastFetchDuration = res.executionTimeMilliseconds;\n this.updateData(res.history);\n },\n error: () => {\n this._updateConnectionStatus();\n if (!this.isConnected) {\n const message = {\n role: 'connection-error',\n content: ({ type: \"text\", text: this.transloco.translate(this.config.connectionSettings.connectionErrorMessage) } as TextMessageContent),\n additionalProperties: { display: true }\n } as any as ChatMessage;\n this.messages$.next([...messages, message]);\n }\n this.terminateFetch();\n },\n complete: () => {\n // Remove the last message if it's an empty message\n // This is due to the manner in which the chat service handles consecutive messages\n const lastMessage = this.messages$.value?.at(-1);\n if (this.isEmptyAssistantMessage(lastMessage)) {\n this.messages$.next(this.messages$.value?.slice(0, -1));\n }\n this.terminateFetch();\n }\n });\n } else {\n const message = { role: 'connection-error', content: this.transloco.translate(this.config.connectionSettings.connectionErrorMessage), additionalProperties: { display: true } };\n this.messages$.next([...messages, message]);\n }\n\n if (this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * Retry to fetch the messages if the connection issues.\n * - If reconnecting => keep display the connection error message even when clicking on the \"retry\" button and increasing the number of retrial attempts, until the connection is re-established\n * - If disconnected => On click on the \"retry\" button, start the connection process while displaying the connection error message :\n * * If successful => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * * If failed => increase the number of retrial attempts\n */\n retryFetch() {\n if (this.chatService instanceof WebSocketChatService) {\n // A one-time listener for reconnected event\n const onReconnectedHandler = () => {\n // Get the messages without the last one (the connection error message)\n const messages = this.messages$.value!.slice(0, -1);\n // Find the last \"user\" message in the messages list\n let index = messages.length - 1;\n while (index >= 0 && messages[index].role !== 'user') {\n index--;\n }\n // If a user message is found (and it should always be the case), remove all subsequent messages from the chat history\n // Update the messages in the UI\n // and fetch the answer from the assistant\n if (index >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, index + 1));\n const remappedIndex = this._remapIndexInChatHistory(index);\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, remappedIndex + 1);\n this.fetch(this.chatService.chatHistory);\n }\n this.retrialAttempts = undefined; // Reset the number of retrial attempts\n /**\n * To remove the handler for onreconnected() after it's been registered,cannot directly use off() like you would for normal events registered with connection.on().\n * Instead, you need to explicitly remove or reset the handler by assigning it to null or an empty function\n */\n (this.chatService as WebSocketChatService).connection!.onreconnected(() => {});\n // Reset the flag to ensure the handler is registered again when needed\n this._isReconnectedListenerRegistered = false;\n }\n // Depending on the connection's state, take the appropriate action\n switch (this.chatService.connection!.state) {\n case HubConnectionState.Connected:\n // If the connection is re-established in the meantime, fetch the messages\n onReconnectedHandler();\n break;\n case HubConnectionState.Reconnecting:\n // Attach the reconnected listener if not already registered\n if (!this._isReconnectedListenerRegistered) {\n this.chatService.connection!.onreconnected(onReconnectedHandler);\n this._isReconnectedListenerRegistered = true;\n }\n // Increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts + 1 : 1;\n break;\n case HubConnectionState.Disconnected:\n // Start the new connection\n this.chatService.startConnection()\n .then(() => onReconnectedHandler())\n .catch(() => { // If the connection fails, increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts + 1 : 1;\n });\n break;\n default:\n break;\n }\n }\n }\n\n /**\n * Check if the signalR connection is connected.\n * For the REST protocol, the connection is always considered connected (for the moment).\n */\n private _updateConnectionStatus() {\n this.isConnected = (this.chatService instanceof WebSocketChatService) ? this.chatService.connection!.state === HubConnectionState.Connected : true;\n }\n\n /**\n * Update the UI with the new messages\n * @param messages\n */\n updateData(messages: ChatMessage[]) {\n this.messages$.next(messages);\n this.data.emit(messages);\n this.loading$.next(false);\n this.question = '';\n if (this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * @returns true if the chat discussion is scrolled down to the bottom, false otherwise\n */\n private _toggleScrollButtonVisibility(): boolean {\n if (this.messageList?.nativeElement) {\n return Math.round(this.messageList?.nativeElement.scrollHeight - this.messageList?.nativeElement.scrollTop - 1) <= this.messageList?.nativeElement.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n if (this.messageList?.nativeElement) {\n this.messageList.nativeElement.scrollTop = this.messageList.nativeElement.scrollHeight;\n this.cdr.detectChanges();\n }\n }, 10);\n }\n\n /**\n * Start a new chat with the defaultValues settings.\n * The savedChatId in the chat service will be reset, so that the upcoming saved chat operations will be performed on the fresh new chat.\n * If the savedChat feature is enabled, the list of saved chats will be refreshed.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n */\n newChat() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n this.chatService.generateAuditEvent('ast-new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this.loadDefaultChat(); // Start a new chat\n }\n\n /**\n * Attaches the specified document IDs to the assistant.\n * If no document IDs are provided, the operation is not allowed.\n * If the action for attaching a document is not defined at the application customization level, an error is logged.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param ids - An array of document IDs to attach.\n */\n attachToChat(ids: string[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (!ids || ids?.length < 1) {\n return;\n }\n const attachDocAction = this.config.modeSettings.actions?.[\"attachDocAction\"];\n if (!attachDocAction) {\n console.error(`No action is defined for attaching a document to the assistant \"${this.instanceId}\"`);\n return;\n }\n const userMsg = { role: 'user', content: '', additionalProperties: {display: false, isUserInput: false, type: \"Action\", forcedWorkflow: attachDocAction.forcedWorkflow, forcedWorkflowProperties: {...(attachDocAction.forcedWorkflowProperties || {}), ids}, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n // Remove the search warning message if exists\n if (this.chatService.chatHistory!.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory!.pop();\n }\n const messages = [...this.chatService.chatHistory!, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n this.chatService.generateAuditEvent('ast-action.requested', {\n 'detail': 'attachDocAction',\n 'forced-workflow': 'SinequaAddSelectedDocumentsWorkflow',\n 'forced-workflow-properties': JSON.stringify(ids),\n });\n }\n\n /**\n * Start the default chat with the defaultValues settings\n * If the chat is meant to be initialized with event === \"Query\", the corresponding user query message will be added to the chat history\n */\n loadDefaultChat() {\n // Define the default system prompt and user prompt messages\n const systemMsg = { role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: { display: false } };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = { role: 'user', content: ChatService.formatPrompt(this.transloco.translate(userPrompt) , { principal: this.principalService.principal }), additionalProperties: { display: this.config.modeSettings.displayUserPrompt } };\n\n if (this.config.modeSettings.initialization.event === 'Query') {\n this._handleQueryMode(systemMsg, userMsg);\n } else {\n this._handlePromptMode(systemMsg, userMsg);\n }\n }\n\n /**\n * Handles the prompt mode of the chat component.\n * If `sendUserPrompt` is true, it opens the chat with both system and user messages,\n * and generates audit events for both messages.\n * If `sendUserPrompt` is false, it opens the chat with only the system message,\n * and generates an audit event for the system message.\n *\n * @param systemMsg - The system message to be displayed in the chat.\n * @param userMsg - The user message to be displayed in the chat (optional).\n */\n private _handlePromptMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg]);\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(userMsg, 1));\n } else {\n this.openChat([systemMsg]);\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(systemMsg, 0));\n }\n }\n\n /**\n * Handles the query mode by displaying the system message, user message, and user query message.\n * If the provided query text is not empty, then add the user query message to the chat history and invoke the assistant\n * Otherwise, just start a new chat with a warning message inviting the user to perform a full text search to retrieve some results\n * @param systemMsg - The system message to be displayed.\n * @param userMsg - The user message to be displayed.\n */\n private _handleQueryMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (!!this.query.text) {\n const userQueryMsg = { role: 'user', content: this.query.text, additionalProperties: { display: this.config.modeSettings.initialization.displayUserQuery, query: this.query, forcedWorkflow: this.config.modeSettings.initialization.forcedWorkflow, forcedFunction: this.config.modeSettings.initialization.forcedFunction, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties } };\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(userMsg, 1));\n this.chatService.generateAuditEvent('ast-message', { ...this._defineMessageAuditDetails(userQueryMsg, 2), 'query': JSON.stringify(this.query), 'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, 'forced-function': this.config.modeSettings.initialization.forcedFunction, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.additionalWorkflowProperties) });\n } else {\n this.openChat([systemMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('ast-message', { ...this._defineMessageAuditDetails(userQueryMsg, 1), 'query': JSON.stringify(this.query), 'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, 'forced-function': this.config.modeSettings.initialization.forcedFunction, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.additionalWorkflowProperties) });\n }\n } else {\n const warningMsg = { role: 'search-warning', content: this.transloco.translate(this.config.globalSettings.searchWarningMessage), additionalProperties: { display: true } };\n this.openChat([systemMsg, warningMsg]);\n this.chatService.generateAuditEvent('ast-message', this._defineMessageAuditDetails(warningMsg, 0));\n }\n }\n\n private _defineMessageAuditDetails(message: ChatMessage, rank: number): Record<string, any> {\n const details: Record<string, any> = {\n 'duration': this.lastFetchDuration || 0,\n 'role': message.role,\n 'rank': rank\n };\n if (!!this.config.auditSettings?.logContent) {\n details.text = message.content;\n }\n return details;\n }\n\n /**\n * Start/open a new chat with the provided messages and chatId\n * If the last message is from the user, a request to the assistant is made to get an answer\n * If the last message is from the assistant, the conversation is loaded right away\n * @param messages The list of messages of the chat\n * @param savedChatId The id of the saved chat. If provided (ie. an existing discussion in the saved chat index), update the savedChatId in the chat service for the upcoming saved chat operations\n */\n openChat(messages: RawMessage[], savedChatId?: string) {\n if (!messages || !Array.isArray(messages)) {\n console.error('Error occurs while trying to load the discussion. Invalid messages received :', messages);\n return;\n }\n if (savedChatId) {\n this.chatService.setSavedChatId(savedChatId);\n this.chatService.generateChatId(savedChatId);\n }\n this.resetChat();\n this.messages$.next(messages);\n this.chatService.chatHistory = messages;\n const lastMessage = messages.at(-1);\n if (lastMessage && lastMessage.role === 'user') {\n this.fetch(messages); // If the last message if from a user, an answer from the assistant is expected\n }\n else {\n this.updateData(messages); // If the last message if from the assistant, we can load the conversation right away\n this.terminateFetch();\n }\n this._addScrollListener();\n }\n\n /**\n * Reset the chat by clearing the chat history and the UI accordingly\n * The user input will be cleared\n * The fetch subscription will be terminated\n */\n resetChat() {\n if (this.messages$.value) {\n this.messages$.next(undefined); // Reset chat\n }\n this.chatService.chatHistory = undefined; // Reset chat history\n this.question = '';\n this.terminateFetch();\n }\n\n /**\n * Fetch and Load the saved chat from the saved chat index.\n * If the saved chat is found, the chat discussion will be loaded with the provided messages and chatId\n */\n onLoadChat() {\n this.loading$.next(true);\n this._sub.add(\n this.chatService.loadSavedChat$\n .pipe(\n filter(savedChat => !!savedChat),\n switchMap(savedChat => this.chatService.getSavedChat(savedChat!.id)),\n filter(savedChatHistory => !!savedChatHistory),\n tap(savedChatHistory => this.openChat(savedChatHistory!.history, savedChatHistory!.id))\n ).subscribe()\n );\n }\n\n /**\n * Stop the generation of the current assistant's answer.\n * The fetch subscription will be terminated.\n */\n stopGeneration() {\n this.chatService.stopGeneration().subscribe(\n () => this.terminateFetch()\n );\n }\n\n /**\n * Terminate the fetch process by unsubscribing from the data subscription and updating the loading status to false.\n * Additionally, focus on the chat input if the focusAfterResponse flag is set to true.\n */\n terminateFetch() {\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = undefined;\n this.loading$.next(false);\n this.cdr.detectChanges();\n\n if (this.focusAfterResponse) {\n setTimeout(() => {\n this.questionInput?.nativeElement.focus();\n });\n }\n }\n\n /**\n * Copy a previous user message of the chat history to the chat user input.\n * Thus, the user can edit and resubmit the message.\n * Once the edited message is submitted, all subsequent messages starting from @param index will be removed from the history and the UI will be updated accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the user's message to edit\n */\n editMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.messageToEdit = index;\n this.remappedMessageToEdit = this._remapIndexInChatHistory(index);\n\n // Get user message from both legacy and text message type\n const message = this.chatService.chatHistory![this._remapIndexInChatHistory(index)];\n this.question = typeof message.content === 'string' ? message.content : (message.content[0] as TextMessageContent).text;\n\n this.chatService.generateAuditEvent('edit.click', {'rank': this._remapIndexInChatHistory(index)});\n }\n\n /**\n * Copy a previous assistant message of the chat history to the clipboard.\n * @param index The index of the assistant's message to edit\n */\n copyMessage(index: number) {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(index);\n this.chatService.generateAuditEvent('ast-copy.click', { 'rank': idx });\n }\n\n /**\n * Starting from the provided index, remove all subsequent messages from the chat history and the UI accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the assistant's message to regenerate\n */\n regenerateMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n // Update the messages in the UI by removing all subsequent 'assistant' messages starting from the provided index until the first previous 'user' message\n let i = index;\n while (i >= 0 && !((this.messages$.value!)[i].role === 'user' && (this.messages$.value!)[i].additionalProperties.isUserInput === true)) {\n i--;\n }\n // It should always be the case that i > 0\n if (i >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, i + 1));\n // Remap the index of this found first previous 'user' message in the chat history\n const idx = this._remapIndexInChatHistory(i);\n // Define and Update the chat history based on which the assistant will generate a new answer\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, idx + 1);\n // Fetch the answer\n this.fetch(this.chatService.chatHistory);\n this.chatService.generateAuditEvent('ast-regenerate.click', { 'rank': idx });\n }\n }\n\n /**\n * Remaps the index in the chat history.\n * The chat history is a list of messages where some messages can be hidden (display set to false).\n * The index provided as input is the index of the message in the chat history displayed in the UI.\n * This function should be removed once the backend is updated to add the ids of the messages in the chat history\n * @param index - The index to be remapped.\n */\n private _remapIndexInChatHistory(index: number) {\n // a copy of the chat history is created to avoid modifying the original chat history.\n // Additionally, a rank is giving to each message.\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n const history = this.chatService.chatHistory!\n .slice()\n .map((message, idx) => ({ ...message, additionalProperties: { ...message.additionalProperties, rank: idx } }))\n .map((message) => {\n if (message.role === \"user\") {\n return { ...message, additionalProperties: { ...message.additionalProperties, display: true } }\n }\n return message;\n })\n // Count the number of hidden messages (of role different then \"user\") in messages$ before the provided index\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n // This is mandatory to get the correct rank of the message in the chat history\n // Since some hidden messages (like 'system' messages) are not displayed in the UI but have been counted in the provided index\n const numberOfHiddenMessagesInMessages$BeforeIndex = this.messages$.value!\n .slice(0, index)\n .map((message) => {\n if (message.role === \"user\") {\n return { ...message, additionalProperties: { ...message.additionalProperties, display: true } }\n }\n return message;\n })\n .filter(message => !message.additionalProperties.display).length;\n // remove all messages that have display set to false\n // this is mandatory since at the point of time when the assistant answers a question,\n // it might have some hidden messages (for example contextMessages) that are available in the chat history but don't figure in messages$ unless a new question is asked\n const filteredHistory = history.filter(message => message.additionalProperties.display);\n // return the index of the message in the filtered history\n return filteredHistory[index - numberOfHiddenMessagesInMessages$BeforeIndex].additionalProperties.rank;\n }\n\n /**\n * Handles the key up event for 'Backspace' and 'Enter' keys.\n * @param event - The keyboard event.\n */\n onKeyUp(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Backspace':\n this.calculateHeight();\n break;\n case 'Enter':\n if (!event.shiftKey) {\n event.preventDefault();\n this.submitQuestion();\n }\n this.calculateHeight();\n break;\n default:\n break;\n }\n }\n\n /**\n * Calculates and adjusts the height of the question input element based on its content.\n * If the Enter key is pressed without the Shift key, it prevents the default behavior.\n * @param event The keyboard event\n */\n calculateHeight(event?: KeyboardEvent): void {\n if (event?.key === 'Enter' && !event.shiftKey) {\n event?.preventDefault();\n }\n const maxHeight = 170;\n const el = this.questionInput!.nativeElement;\n el.style.maxHeight = `${maxHeight}px`;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n el.style.overflowY = el.scrollHeight >= maxHeight ? 'scroll' : 'hidden';\n }\n\n /**\n * Send a \"like\" event on clicking on the thumb-up icon of an assistant's message\n * @param message The assistant message to like\n * @param rank The rank of the message to like\n */\n onLike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('ast-thumb-up.click', { rank: idx });\n this.reportType = 'like';\n this.messageToReport = message;\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$liked = true;\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$disliked = false;\n this._updateChatHistory();\n }\n\n /**\n * Send a \"dislike\" event on clicking on the thumb-down icon of an assistant's message.\n * It also opens the issue reporting dialog.\n * @param message The assistant message to dislike\n * @param index The rank of the message to dislike\n */\n onDislike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('ast-thumb-down.click', { rank: idx });\n this.reportType = 'dislike';\n this.messageToReport = message;\n this.issueType = '';\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$disliked = true;\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$liked = false;\n this._updateChatHistory();\n }\n\n private _updateChatHistory(): void {\n this.messages$.next(this.chatService.chatHistory);\n if (this.chatService.savedChatId) {\n this.chatService.updateSavedChat(this.chatService.savedChatId, undefined, this.chatService.chatHistory).subscribe();\n }\n this.cdr.detectChanges();\n }\n\n /**\n * Report an issue related to the assistant's message.\n */\n sendReport(): void {\n const details = {\n 'comment': this.reportComment,\n 'rank': this.reportRank,\n };\n\n // hide text in case logContent is not enabled\n if (this.config.auditSettings.logContent)\n details['text'] = this.messageToReport!.content;\n\n if (this.reportType === 'dislike') {\n details['report-type'] = this.issueType;\n this.chatService.generateAuditEvent('ast-negative-report.send', details);\n } else {\n this.chatService.generateAuditEvent('ast-positive-report.send', details);\n }\n this.notificationsService.success(this.transloco.translate('chat.sendReportNotification'));\n this.showReport = false;\n }\n\n /**\n * Close the reporting dialog.\n */\n ignoreReport(): void {\n this.showReport = false;\n }\n\n /**\n * Handle the click on a reference's 'open preview'.\n * @param data\n * @param index rank of the message\n */\n openAttachmentPreview(data: { reference: ChatContextAttachment, partId?: number }, rank: number) {\n this.openPreview.emit(data.reference);\n const idx = this._remapIndexInChatHistory(rank);\n const details = {\n 'doc-id': data.reference.recordId,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n 'rank': idx\n };\n if (!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('ast-attachment.preview.click', details);\n }\n\n /**\n * Handle the click on a reference's 'open original document'.\n * @param data\n */\n openOriginalAttachment(data: { reference: ChatContextAttachment, partId?: number }, rank: number) {\n this.openDocument.emit(data.reference.record);\n const idx = this._remapIndexInChatHistory(rank);\n const details = {\n 'doc-id': data.reference.recordId,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n 'rank': idx\n };\n if (!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('ast-attachment.link.click', details);\n }\n\n /**\n * Handle the click on a suggested action.\n * @param action Suggested action.\n * @param index Rank of the message in the chatHistory related to the suggested action.\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n this.chatService.generateAuditEvent('ast-suggested-action.click', {'text': action.content, 'suggestedAction-type': action.type})\n }\n\n /**\n * It looks for the debug messages available in the current group of \"assistant\" messages.\n * By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n * @param index The rank of the message\n * @returns The debug messages available in the current group of \"assistant\" messages\n */\n getDebugMessages(index: number): DebugMessage[] {\n // If it is not an assistant message, return\n if ((this.messages$.value!)[index].role !== 'assistant') {\n return [];\n }\n // Get the array of messages up to the indicated index\n const array = this.messages$.value!.slice(0, index + 1);\n // If it is an assistant message, look for the debug messages available in the current group of \"assistant\" messages\n // By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n const idx = this.chatService.firstVisibleAssistantMessageIndex(array);\n if (idx > -1) {\n return (this.messages$.value!)[idx].additionalProperties.$debug || [];\n }\n return [];\n }\n\n /**\n * Handle the click on the 'show log info' button of a message.\n * @param index The rank of the message\n */\n showDebug(index: number): void {\n this.debugMessages = this.getDebugMessages(index);\n this.showDebugMessages = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Verify whether the current message is an assistant message and that all following messages are assistant ones\n * Used to keep the \"View progress\" opened even though the assistant is sending additional messages after the current one\n * @param messages the list of current messages\n * @param index the index of the current message\n * @returns if this messages and the following ones (if any) are the last ones\n */\n isAssistantLastMessages(messages: ChatMessage[], index: number): boolean {\n for (let i = index; i < messages.length; i++) {\n if (messages[i].role !== 'assistant') return false;\n }\n return true;\n }\n\n /**\n * Checks if the given message is an empty assistant message.\n * An empty assistant message is defined as a message with the role 'assistant',\n * an empty content, and no additional properties such as attachments, progress,\n * debug information, or suggested actions.\n *\n * @param message - The message to check.\n * @returns `true` if the message is an empty assistant message, `false` otherwise.\n */\n isEmptyAssistantMessage(message: ChatMessage | undefined): boolean {\n if (\n message?.role === 'assistant'\n && (\n // Legacy message type\n (typeof message?.content === 'string' && message?.content === \"\")\n // New message type\n // - Text\n || ((message?.content as RawMessageContent)?.[0] as TextMessageContent)?.text === \"\"\n // TODO: image and video message types https://sinequa.atlassian.net/browse/ES-25940\n )\n && !message?.additionalProperties?.$attachment\n && !message?.additionalProperties?.$progress\n && !message?.additionalProperties?.$debug\n && !message?.additionalProperties?.$suggestedAction\n ) {\n return true;\n }\n return false;\n }\n}\n","<ng-container *ngIf=\"!initializationError\">\n <div *ngIf=\"messages$ | async as messages; else loadingTpl || loadingTplDefault\" class=\"h-100 d-flex flex-column\">\n <!-- Token consumption -->\n <div class=\"ms-1\" *ngIf=\"config?.globalSettings?.displayUserQuotaConsumption || config?.globalSettings?.displayChatTokensConsumption\">\n <ng-container *ngTemplateOutlet=\"tokenConsumptionTpl || defaultTokenConsumptionTpl; context: { $implicit: instanceId }\"></ng-container>\n </div>\n\n <!-- Chat Messages -->\n <ul class=\"d-flex flex-column list-unstyled gap-3 overflow-auto flex-grow-1 pe-2 pb-2\" #messageList>\n <ng-container *ngFor=\"let message of messages; let index = index; let last = last\">\n <!-- Regular messages -->\n <li class=\"list-group-item\"\n *ngIf=\"message.additionalProperties.display && !isEmptyAssistantMessage(message)\"\n [style.--bs-list-group-item-padding-y.rem]=\"'0.6'\"\n [class.opacity-50]=\"messageToEdit && (messageToEdit < (index + 1))\">\n <sq-chat-message\n [class.sq-user-message]=\"message.role === 'user'\"\n [class.last-message]=\"last\"\n [message]=\"message\"\n [conversation]=\"messages\"\n [suggestedActions]=\"last ? message.additionalProperties.$suggestedAction : undefined\"\n [assistantMessageIcon]=\"assistantMessageIcon\"\n [userMessageIcon]=\"userMessageIcon\"\n [connectionErrorMessageIcon]=\"connectionErrorMessageIcon\"\n [searchWarningMessageIcon]=\"searchWarningMessageIcon\"\n [streaming]=\"(chatService.streaming$ | async) && (last || isAssistantLastMessages(messages, index))\"\n [canEdit]=\"(chatService.streaming$ | async) === false && messageToEdit === undefined && message.role === 'user'\"\n [canCopy]=\"((chatService.streaming$ | async) === false || !last) && messageToEdit === undefined && message.role !== 'connection-error' && message.role !== 'search-warning'\"\n [canLike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDislike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDebug]=\"(((chatService.streaming$ | async) === false && last) || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && (getDebugMessages(index).length > 0) && ((isAdminOrDeletedAdmin || (chatService.userOverride$ | async)) && config?.defaultValues.debug)\"\n [canRegenerate]=\"(chatService.streaming$ | async) === false && (last || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && messageToEdit === undefined\"\n (edit)=\"editMessage(index)\"\n (copy)=\"copyMessage(index)\"\n (regenerate)=\"regenerateMessage(index)\"\n (openDocument)=\"openOriginalAttachment($event, index)\"\n (openPreview)=\"openAttachmentPreview($event, index)\"\n (suggestAction)=\"suggestActionClick($event, index)\"\n (like)=\"onLike(message, index)\"\n (dislike)=\"onDislike(message, index)\"\n (debug)=\"showDebug(index)\">\n </sq-chat-message>\n </li>\n </ng-container>\n <!-- Loading spinner -->\n <li *ngIf=\"(loading$ | async) === true\">\n <ng-container *ngTemplateOutlet=\"loadingTpl || loadingTplDefault\"></ng-container>\n </li>\n </ul>\n\n <!-- Reporting a feedback form -->\n <div class=\"issue-report p-3 rounded-lg\" *ngIf=\"showReport\">\n <ng-container *ngTemplateOutlet=\"reportTpl || reportTplDefault; context: { $implicit: messageToReport, rank: reportRank, type: reportType }\"></ng-container>\n </div>\n\n <!-- User text input -->\n @if (!showReport) {\n <div class=\"user-input mt-auto\">\n <div class=\"py-2\">\n <div [hidden]=\"!isConnected\">\n <ng-container *ngIf=\"enabledUserInput\" [ngTemplateOutlet]=\"inputTpl\"></ng-container>\n </div>\n <!-- Retry button -->\n <!-- hidden attribute is in conflict with a css rule display: flex -->\n @if(!isConnected){\n <button class=\"btn mb-4 ast-error ast-btn sq-retry\" (click)=\"retryFetch()\">\n <span>{{ 'chat.tryAgain' | transloco }}</span>\n <span *ngIf=\"retrialAttempts\" class=\"ms-2 attempts\">{{ retrialAttempts }}</span>\n </button>\n }\n <div class=\"text-end small text-muted px-3\" *ngIf=\"!!config?.globalSettings?.disclaimer\">\n {{ config?.globalSettings?.disclaimer | transloco }}\n </div>\n </div>\n </div>\n }\n\n <!-- Floating scroll button -->\n <div *ngIf=\"!isAtBottom && !showReport\" class=\"sq-floating-scroll\" [ngClass]=\"enabledUserInput ? 'sq-floating-scroll--when-user-input' : 'sq-floating-scroll--without-user-input'\">\n <button class=\"btn shadow\" (click)=\"scrollDown()\" aria-label=\"Scroll down\">\n <i class=\"fas fa-angle-double-down\"></i>\n </button>\n </div>\n </div>\n</ng-container>\n\n<!-- NG TEMPLATES-->\n\n<ng-template #loadingTplDefault>\n <div class=\"spinner-grow text-primary d-block mx-auto my-5\" role=\"status\">\n <span class=\"visually-hidden\">{{ 'chat.loading' | transloco }}</span>\n </div>\n</ng-template>\n\n<ng-template #inputTpl>\n <div class=\"px-3 py-1\">\n <div class=\"ast-input-container\">\n <button disabled class=\"btn btn-light\" aria-label=\"search\">\n <i class=\"fas fa-search\"></i>\n </button>\n <textarea #questionInput rows=\"1\"\n type=\"text\" class=\"form-control\"\n [placeholder]=\"'chat.askSomething' | transloco\" autofocus\n [(ngModel)]=\"question\"\n (keyup)=\"onKeyUp($event)\"\n (keydown)=\"calculateHeight($event)\"\n [disabled]=\"(loading$ | async) || (chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\">\n </textarea>\n <div id=\"chat-actions\" class=\"d-flex gap-2\">\n <button\n *ngIf=\"(chatService.streaming$ | async) === false && (loading$ | async) === false && (chatService.stoppingGeneration$ | async) === false\"\n type=\"button\"\n class=\"btn btn-light\"\n aria-label=\"Send message\"\n [sqTooltip]=\"'chat.sendMessage' | transloco\"\n (click)=\"submitQuestion()\">\n <i class=\"fas fa-paper-plane\"></i>\n </button>\n <button\n *ngIf=\"messageToEdit\"\n aria-label=\"Cancel edition\"\n type=\"button\"\n class=\"btn btn-light\"\n [sqTooltip]=\"'chat.cancelEdition' | transloco\"\n (click)=\"messageToEdit = undefined; question = ''\">\n <i class=\"fas fa-undo-alt\"></i>\n </button>\n <span *ngIf=\"(chatService.streaming$ | async) && (chatService.stoppingGeneration$ | async) === false\" class=\"processing\">\n {{ 'chat.generating' | transloco }}<i class=\"fas fa-spinner fa-pulse\"></i>\n </span>\n <span *ngIf=\"(chatService.stoppingGeneration$ | async)\" class=\"processing\">\n {{ 'chat.stopping' | transloco }}<i class=\"fas fa-spinner fa-pulse\"></i>\n </span>\n <button\n *ngIf=\"(chatService.streaming$ | async) && (chatService.stoppingGeneration$ | async) === false\"\n type=\"button\"\n class=\"btn btn-light\"\n aria-label=\"Stop generating\"\n [sqTooltip]=\"'chat.stopGeneration' | transloco\"\n (click)=\"stopGeneration()\">\n <i class=\"fas fa-stop\"></i>\n </button>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #reportTplDefault let-message let-rank=\"rank\" let-type=\"type\">\n <div class=\"px-3\">\n <ng-container *ngIf=\"type === 'dislike'\">\n <h5>{{ 'chat.issueType' | transloco }}</h5>\n <select class=\"form-select mb-4\" [(ngModel)]=\"issueType\">\n <option [value]=\"''\">{{ 'chat.chooseIssueType' | transloco }}</option>\n <option *ngFor=\"let type of (issueTypes ?? defaultIssueTypes)\" [value]=\"type\">{{ type | transloco }}</option>\n </select>\n <h5>{{ 'chat.askUnlikeReasons' | transloco }}</h5>\n </ng-container>\n <ng-container *ngIf=\"type === 'like'\">\n <h5>{{ 'chat.askLikeReasons' | transloco }}</h5>\n </ng-container>\n <textarea class=\"form-control border border-neutral-200\" [(ngModel)]=\"reportComment\" [placeholder]=\"'chat.writeComment' | transloco\"></textarea>\n <div class=\"d-flex flex-row-reverse gap-1 mt-2\">\n <button class=\"btn btn-primary\" [disabled]=\"type === 'dislike' && !issueType\" (click)=\"sendReport()\">{{ 'chat.send' | transloco }}</button>\n <button class=\"btn btn-light\" (click)=\"ignoreReport()\">{{ 'chat.doNotSend' | transloco }}</button>\n </div>\n </div>\n</ng-template>\n\n<ng-template #defaultTokenConsumptionTpl let-instanceId>\n <sq-token-progress-bar\n [instanceId]=\"instanceId\">\n </sq-token-progress-bar>\n</ng-template>\n\n<div class=\"debug-messages\" [class.displayed]=\"showDebugMessages\">\n <button *ngIf=\"showDebugMessages\" class=\"btn btn-light shadow back-btn\" (click)=\"showDebugMessages=false\" aria-label=\"Hide debug messages\">\n <i class=\"fas fa-chevron-right\"></i>\n </button>\n <ng-container *ngTemplateOutlet=\"debugMessagesTpl || defaultDebugMessagesTpl; context: { $implicit: debugMessages }\">\n </ng-container>\n</div>\n\n<ng-template #defaultDebugMessagesTpl let-debugMessages>\n <sq-debug-message [data]=\"debugMessages\"></sq-debug-message>\n</ng-template>\n","import { Component, ElementRef, inject, input, output, signal, viewChild } from \"@angular/core\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { catchError, Subscription, tap, throwError } from \"rxjs\";\r\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\n\r\nimport { ChatService } from \"../chat.service\";\r\nimport { NotificationsService } from \"../services/notification.service\";\r\nimport { SavedChat } from \"../types\";\r\n\r\nexport type SavedChatEdit = SavedChat & { currentTitle: string };\r\n\r\n\r\n@Component({\r\n selector: 'sq-dialog-delete-saved-chat',\r\n standalone: true,\r\n imports: [FormsModule, TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #deleteDialog class=\"rounded-3 z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.deleteSavedDiscussion' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.deleteSavedDiscussionText' | transloco }} \"{{ savedChat().title }}\".</p>\r\n <p>{{ 'chatDialogs.deleteSavedDiscussionConfirm' | transloco }}</p>\r\n\r\n <div class=\"flex justify-end d-flex justify-content-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost btn-light outline-none\" (click)=\"deleteDialog.close()\">{{ 'chatDialogs.cancel' | transloco }}</button>\r\n <button class=\"btn btn-danger\" (click)=\"onDelete($event, savedChat())\">{{ 'chatDialogs.confirm' | transloco }}</button>\r\n </div>\r\n </div>\r\n </dialog>\r\n `\r\n})\r\nexport class DialogDeleteSavedChatComponent {\r\n deleteDialog = viewChild<ElementRef<HTMLDialogElement>>('deleteDialog');\r\n\r\n notificationsService = inject(NotificationsService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n chatService = input.required<ChatService>();\r\n delete = output<SavedChat>();\r\n\r\n savedChat = signal<SavedChatEdit>({ currentTitle: '', title: '' } as SavedChatEdit);\r\n\r\n subscription = new Subscription();\r\n\r\n showModal(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n this.savedChat.set({...savedChat, currentTitle: savedChat.title });\r\n this.deleteDialog()?.nativeElement.showModal();\r\n }\r\n\r\n protected onDelete(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n if (!!this.chatService().streaming$.value || !!this.chatService().stoppingGeneration$.value) {\r\n return;\r\n }\r\n this.subscription.add(\r\n this.chatService().deleteSavedChat([savedChat.id])\r\n .pipe(\r\n tap(res => {\r\n this.notificationsService.success(this.transloco.translate('chatDialogs.deleteSavedDiscussionSuccess', { title: savedChat.title }));\r\n this.delete.emit(savedChat);\r\n this.chatService().listSavedChat();\r\n this.chatService().generateAuditEvent('ast-saved-chat.delete', { duration: res.executionTimeMilliseconds }, savedChat.id);\r\n }),\r\n catchError((error) => {\r\n console.error('Error occurred while deleting the saved chat:', error);\r\n this.notificationsService.error(this.transloco.translate('chatDialogs.deleteSavedDiscussionError', { title: savedChat.title }));\r\n return throwError(() => error);\r\n })\r\n ).subscribe()\r\n );\r\n this.deleteDialog()?.nativeElement.close();\r\n }\r\n\r\n}\r\n","import { Component, ElementRef, inject, input, signal, viewChild } from \"@angular/core\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { catchError, Subscription, tap, throwError } from \"rxjs\";\r\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\n\r\nimport { ChatService } from \"../chat.service\";\r\nimport { NotificationsService } from \"../services/notification.service\";\r\nimport { SavedChat } from \"../types\";\r\n\r\nexport type SavedChatEdit = SavedChat & { currentTitle: string };\r\n\r\n\r\n@Component({\r\n selector: 'sq-dialog-rename-saved-chat',\r\n standalone: true,\r\n imports: [FormsModule, TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #renameDialog class=\"rounded-3 z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.renameSavedDiscussion' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.renameSavedDiscussionText' | transloco }} \"{{ savedChat().currentTitle }}\"</p>\r\n <input\r\n class=\"w-100 rounded h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\r\n type=\"text\" [(ngModel)]=\"savedChat().title\" />\r\n\r\n <div class=\"flex justify-end d-flex justify-content-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost btn-light outline-none\" (click)=\"renameDialog.close()\">{{ 'chatDialogs.cancel' | transloco }}</button>\r\n <button class=\"btn btn-primary\" (click)=\"onRename($event, savedChat())\">{{ 'chatDialogs.rename' | transloco }}</button>\r\n </div>\r\n </div>\r\n</dialog>\r\n `\r\n})\r\nexport class DialogRenameSavedChatComponent {\r\n renameDialog = viewChild<ElementRef<HTMLDialogElement>>('renameDialog');\r\n\r\n notificationsService = inject(NotificationsService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n chatService = input.required<ChatService>();\r\n savedChat = signal<SavedChatEdit>({ currentTitle: '', title: '' } as SavedChatEdit);\r\n\r\n subscription = new Subscription();\r\n\r\n showModal(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n this.savedChat.set({ ...savedChat, currentTitle: savedChat.title });\r\n this.renameDialog()?.nativeElement.showModal();\r\n }\r\n\r\n protected onRename(event: Event, savedChat: SavedChatEdit) {\r\n event.stopPropagation();\r\n if (!!this.chatService().streaming$.value || !!this.chatService().stoppingGeneration$.value || !savedChat.title.trim()) {\r\n return;\r\n }\r\n this.subscription.add(\r\n this.chatService().updateSavedChat(savedChat.id, savedChat.title)\r\n .pipe(\r\n tap(res => {\r\n this.notificationsService.success(this.transloco.translate('chatDialogs.renameSavedDiscussionSuccess', { currentTitle: savedChat.currentTitle, title: savedChat.title }));\r\n this.chatService().listSavedChat();\r\n this.chatService().generateAuditEvent('ast-saved-chat.rename', { 'text': savedChat.title, duration: res.executionTimeMilliseconds }, savedChat.id);\r\n }),\r\n catchError((error) => {\r\n console.error('Error occurred while updating the saved chat:', error);\r\n this.notificationsService.error(this.transloco.translate('chatDialogs.renameSavedDiscussionError', { currentTitle: savedChat.currentTitle }));\r\n return throwError(() => error);\r\n })\r\n ).subscribe()\r\n );\r\n this.renameDialog()?.nativeElement.close();\r\n }\r\n\r\n}\r\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { FormsModule } from '@angular/forms';\nimport { BehaviorSubject, Subscription, combineLatest, filter, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { parseISO, toDate } from \"date-fns\";\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { ChatService } from \"../chat.service\";\nimport { DialogDeleteSavedChatComponent } from \"../dialogs/delete-saved-chat.component\";\nimport { DialogRenameSavedChatComponent } from \"../dialogs/rename-saved-chat.component\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { NotificationsService } from \"../services/notification.service\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { SavedChat } from \"../types\";\n\n\n@Component({\n selector: 'sq-saved-chats-v3',\n templateUrl: 'saved-chats.component.html',\n styleUrls: ['saved-chats.component.scss'],\n standalone: true,\n providers: [provideTranslocoScope('saved-chats', 'chat')],\n imports: [CommonModule, FormsModule, TooltipDirective, DialogRenameSavedChatComponent, DialogDeleteSavedChatComponent, TranslocoPipe]\n})\nexport class SavedChatsComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output() load = new EventEmitter<SavedChat>();\n @Output() delete = new EventEmitter<SavedChat>();\n\n chatService: ChatService;\n subscription = new Subscription();\n groupedSavedChats$ = new BehaviorSubject<{ key: string, value: SavedChat[] }[]>([]);\n\n public instanceManagerService = inject(InstanceManagerService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n this.onListSavedChat();\n this.chatService.listSavedChat();\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onListSavedChat() {\n this.subscription.add(\n combineLatest([\n this.chatService.savedChats$,\n this.transloco.langChanges$\n ]).subscribe(([savedChats]) => {\n this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats));\n })\n );\n }\n\n onLoad(savedChat: SavedChat) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.setSavedChatId(savedChat.id);\n this.chatService.generateChatId(savedChat.id);\n this.chatService.loadSavedChat$.next(savedChat);\n this.chatService.listSavedChat();\n this.load.emit(savedChat);\n }\n\n private _groupSavedChatsByDate(savedChats: SavedChat[]): { key: string, value: SavedChat[] }[] {\n const groupedSavedChats = new Map<string, SavedChat[]>();\n\n savedChats\n .sort((a, b) => parseISO(b.modifiedUTC).getTime() - parseISO(a.modifiedUTC).getTime())\n .forEach(savedChat => {\n const groupKey = this.chatService.getTimeKey(toDate(parseISO(savedChat.modifiedUTC))); // Must convert the UTC date to local date before passing to _getTimeKey\n\n if (!groupedSavedChats.has(groupKey)) {\n groupedSavedChats.set(groupKey, []);\n }\n\n groupedSavedChats.get(groupKey)!.push(savedChat);\n });\n\n return Array.from(groupedSavedChats, ([key, value]) => ({ key, value }));;\n }\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngIf=\"chatService.savedChatsError$ | async\" class=\"alert alert-danger\">\n {{ 'savedChats.error' | transloco }}\n </div>\n <div *ngFor=\"let group of (groupedSavedChats$ | async)\" class=\"saved-chats\">\n <div class=\"saved-chat-date\">{{group.key}}</div>\n <div *ngFor=\"let savedChat of group.value\"\n (click)=\"onLoad(savedChat)\"\n class=\"saved-chat p-2\"\n [class.forbidden]=\"(chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\"\n [class.active]=\"chatService.savedChatId === savedChat.id\">\n <span class=\"title me-1\" [sqTooltip]=\"savedChat.title\">{{savedChat.title}}</span>\n <i class=\"saved-chat-actions fas fa-pen mx-1\" [sqTooltip]=\"'savedChats.rename' | transloco\" (click)=\"renameDialog.showModal($event, savedChat)\"></i>\n <i class=\"saved-chat-actions fas fa-trash ms-1\" [sqTooltip]=\"'savedChats.delete' | transloco\" (click)=\"deleteDialog.showModal($event, savedChat)\"></i>\n </div>\n </div>\n</ng-container>\n\n<sq-dialog-delete-saved-chat [chatService]=\"chatService\" (delete)=\"delete.emit($event)\" #deleteDialog />\n<sq-dialog-rename-saved-chat [chatService]=\"chatService\" #renameDialog />\n","import { CommonModule } from \"@angular/common\";\nimport { Component, input, OnDestroy, OnInit } from \"@angular/core\";\nimport { ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { Subscription } from 'rxjs';\n\nexport type PromptOptions = {\n title?: string,\n message: string,\n messageParams?: any,\n rowCount?: number,\n output?: string,\n validators?: any\n};\n\n@Component({\n selector: \"sq-chat-prompt\",\n template: `\n <dialog [title]=\"title\" #dialog>\n @if(title) {\n <h5 class=\"modal-title\">{{title}}</h5>\n }\n <form name=\"prompt\" novalidate [formGroup]=\"form\">\n <div class=\"mb-3 sq-form-group\">\n <label class=\"form-label\" for=\"input\">{{model().message}}</label>\n @if(!model().rowCount) {\n <input type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"off\">\n }\n @if(!!model().rowCount) {\n <textarea type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"on\" rows=\"{{model().rowCount}}\"></textarea>\n }\n </div>\n </form>\n <section class=\"flex justify-end gap-2 mt-4\">\n <button class=\"btn btn-ghost outline-none w-24\" (click)=\"dialog.close()\">\n Cancel\n </button>\n\n <button class=\"btn btn-primary w-24\">\n OK\n </button>\n </section>\n </dialog>\n `,\n standalone: true,\n imports: [CommonModule, ReactiveFormsModule],\n})\nexport class ChatPrompt implements OnInit, OnDestroy {\n inputControl: UntypedFormControl;\n form: UntypedFormGroup;\n formChanges: Subscription;\n\n model = input<PromptOptions>({} as PromptOptions);\n\n constructor(protected formBuilder: UntypedFormBuilder) {}\n\n ngOnInit() {\n this.inputControl = new UntypedFormControl(this.model().output, this.model().validators || Validators.required);\n this.form = this.formBuilder.group({\n input: this.inputControl\n });\n this.formChanges.add(\n this.form.valueChanges.subscribe(() => this.model().output = this.inputControl.value)\n );\n }\n\n ngOnDestroy() {\n this.formChanges.unsubscribe();\n }\n\n get title(): string {\n return this.model().title ?? \"msg#modal.prompt.title\";\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { ChatService } from '../chat.service';\nimport { BehaviorSubject, catchError, filter, from, map, Observable, take } from 'rxjs';\nimport { deleteDocumentsResponse, IndexingInfos, UploadConfig, UploadedDocuments, UploadEvent } from './documents-upload.model';\nimport { HttpClient, HttpEventType, HttpHeaders, HttpResponse, HttpUploadProgressEvent } from '@angular/common/http';\nimport { AppService } from '../services/app.service';\nimport { getToken, globalConfig, post } from '@sinequa/atomic';\n\n@Injectable()\nexport class DocumentsUploadService {\n\n /** Name of the assistant plugin. */\n public REQUEST_URL: string;\n /** Documents' upload configuration. */\n uploadConfig$ = new BehaviorSubject<UploadConfig | undefined>(undefined);\n public chatService: ChatService;\n\n public appService = inject(AppService);\n public http = inject(HttpClient);\n\n /**\n * Initializes the file upload service with the provided chat service instance.\n *\n * @param chatService - An instance of ChatService. If not provided, an error is thrown.\n * @throws {Error} If the chatService instance is not provided or if there is an error during initialization.\n */\n init(chatService: ChatService | undefined): void {\n if (!chatService) throw new Error('A chatService instance must be provided');\n\n this.chatService = chatService;\n try {\n this.getRequestsUrl();\n this.getUploadConfig();\n } catch (error) {\n throw new Error(error);\n }\n }\n\n /**\n * Fetch the endpoint to use for the file upload related requests\n * @throws {Error} If the property 'restEndpoint' is not provided in the assistant configuration\n */\n getRequestsUrl() {\n if (!!this.chatService.assistantConfig$.value!.connectionSettings.restEndpoint) {\n this.REQUEST_URL = this.chatService.assistantConfig$.value!.connectionSettings.restEndpoint;\n } else {\n throw new Error(`The property 'restEndpoint' must be provided when attempting to use 'REST' in assistant instance`);\n }\n }\n\n /**\n * Retrieves the upload configuration for documents.\n * The response, which contains the upload configuration, is emitted to the `uploadConfig$` observable.\n *\n * @throws {Error} If there is an error invoking the `documentsUploadConfigGet` action.\n */\n public getUploadConfig(): void {\n const data = {\n action: \"documentsUploadConfigGet\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n from(post<UploadConfig>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n take(1),\n catchError((error) => {\n throw new Error(`Error invoking documentsUploadConfigGet: ${error}`);\n })\n ).subscribe((res: UploadConfig) => this.uploadConfig$.next(res));\n }\n\n /**\n * Uploads documents to the server.\n *\n * This method takes a FormData object which should contain all files to be uploaded.\n * Each file should be appended to the FormData object with its original name.\n *\n * For example:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * ```\n *\n * @param formData - The FormData object containing the files to be uploaded.\n * - Each file should be appended to the FormData object with its original name.\n * For example:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * ```\n *\n * @param enableProgress - (Optional) A boolean parameter that controls whether progress reporting is enabled.\n * - Defaults to `true`.\n * - 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.\n * - If `false`, progress events are not reported.\n *\n * @returns An Observable that emits events of type `UploadEvent`:\n * - `UploadProgressEvent`: Emitted during the upload process, containing:\n * - * `type`: \"uploadProgress\" - The type of the event.\n * - * `loaded`: number - The number of bytes uploaded so far.\n * - * `total`: number - The total number of bytes to be uploaded (if available).\n * - * `progress`: number - The percentage of upload progress (calculated as `(loaded / total) * 100`).\n * - `UploadResponseEvent`: Emitted when the upload is complete, containing:\n * - * `type`: \"response\" - The type of the event.\n * - * `body`: `UploadResponse` - The server's response, including:\n * - * - * `statusToken`: string - A token to track the status of the indexing process.\n * - * - * `executionTime`: string - The time taken to execute the upload.\n * - * - * `connectorResponse` (optional): Additional response data from the connector, containing:\n * - * - * - * `collection`: string - The collection name.\n * - * - * - * `action`: string - The action performed.\n * - * - * - * `stats`: object - Statistics about the upload, including:\n * - * - * - * - * `nbDocUpdated`: number - The number of documents updated.\n *\n * @throws {Error} If there is an error invoking the `documentsupload` action.\n *\n * Example usage:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * this.documentsUploadService.uploadDocuments(formData).subscribe(event => {\n * if (event.type === 'uploadProgress') {\n * console.log(`Progress: ${event.progress}%`);\n * } else if (event.type === 'response') {\n * console.log('Upload complete:', event.body);\n * }\n * });\n * ```\n */\n public uploadDocuments(formData: FormData, enableProgress: boolean = true): Observable<UploadEvent> {\n // Add the required \"data\" field as a JSON string\n const data = {\n action: \"documentsupload\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n formData.append('data', JSON.stringify(data));\n\n let headers = new HttpHeaders({ 'Accept': 'application/json' });\n const token = getToken();\n if(token){\n headers = headers.append('sinequa-csrf-token',token);\n }\n const options: any = {\n headers: headers,\n observe: 'events',\n };\n if (enableProgress) options['reportProgress'] = true;\n\n const url = `${globalConfig.backendUrl}/${globalConfig.apiPath}/plugin/${this.REQUEST_URL}`;\n /**\n * Need to use the HttpClient directly to avoid the JSONMethodPluginService's behavior\n * because it is altering the request and thus making it unable to properly set the Content-Type header with the boundary\n */\n return this.http.post<any>(url, formData, options).pipe(\n filter((event): event is HttpUploadProgressEvent | HttpResponse<any> =>\n event.type === HttpEventType.Response || (enableProgress && event.type === HttpEventType.UploadProgress)\n ),\n map((event): UploadEvent => {\n switch (event.type) {\n case HttpEventType.UploadProgress: {\n const { loaded = 0, total = 0 } = event;\n return { type: 'uploadProgress', loaded, total, progress: total > 0 ? Math.round((loaded / total) * 100) : 0 };\n }\n case HttpEventType.Response:\n return { type: 'response', body: event.body };\n default:\n throw new Error(\"Unexpected event type\"); // Should not reach here, but for typescript sake.\n }\n }),\n catchError((error) => {\n throw new Error(`Error invoking documentsupload: ${error}`);\n })\n );\n }\n\n /**\n * Retrieves the indexing status of a predefined uploaded document(s)\n * based on the provided status token returned from the upload process.\n *\n * @param token - The status token used to track the indexing process.\n * @returns An Observable that emits the server response of type `IndexingResponse`.\n * The `IndexingResponse` object contains:\n * - `docs`: array - An array of document status objects, each containing:\n * - * `id`: string - The document ID.\n * - * `fileName`: string - The name of the file.\n * - * `operation`: \"Add\" | \"Update\" - The operation performed on the document.\n * - * `status`: \"Indexing\" | \"Indexed\" | \"Error\" - The status of the document.\n * - * `previousIndexationTime`: string | null - The previous indexation time.\n * - * `currentIndexationTime`: string | null - The current indexation time.\n * - `executionTime`: string - The time taken to retrieve the indexing status.\n * @throws {Error} If there is an error invoking the `documentsUploadStatus` action.\n */\n public getIndexingStatus(token: string): Observable<IndexingInfos> {\n const data = {\n action: \"documentsUploadStatus\",\n appName: this.appService.appName,\n statusToken: token,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<IndexingInfos>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsUploadStatus: ${error}`);\n })\n );\n }\n\n /**\n * Retrieves a list of uploaded documents.\n *\n * @param {string[]} [columns] - Optional array of additional index columns to include for each document.\n * @param {number} [skip] - Optional number of documents to skip for pagination. If set, count also needs to be set. No skip if not set.\n * @param {number} [count] - Optional number of documents to take for pagination (unlimited if not set).\n * @returns {Observable<UploadedDocuments>} An observable that emits the list of uploaded documents.\n * The `UploadedDocuments` object contains:\n * - `docs`: array - An array of objects representing a single document with the following properties:\n * - * `id`: string - A unique identifier for the document.\n * - * `fileName`: string - The name of the file.\n * - * `title`: string - The title of the document.\n * - * `fileExt`: string - The file extension of the document.\n * - * `indexationTime`: string - The time when the document was indexed.\n * - * `size`: number - The size of the document.\n * - * `sizeDisplay`: string - A human-readable representation of the document size.\n * - * `[key: string]`: any - Additional columns asked in the request, value of the column for the document.\n * - `count`: number - The count of documents in the current batch or subset.\n * - `totalCount`: number - The total count of documents available.\n * - `executionTime`: string - The time taken to process the documents.\n * @throws {Error} Throws an error if the request fails.\n */\n public getDocumentsList(columns?: string[], skip?: number, count?: number): Observable<UploadedDocuments> {\n const data = {\n action: \"documentsList\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n if (columns) data[\"columns\"] = columns;\n if (skip) data[\"skip\"] = skip;\n if (count) data[\"count\"] = count;\n\n return from(post<UploadedDocuments>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsList: ${error}`);\n })\n );\n }\n\n /**\n * Deletes the uploaded documents with the specified IDs.\n *\n * @param docIds - An array of document IDs to delete.\n * @returns An observable that emits the server response of type `deleteDocumentsResponse`.\n * The `deleteDocumentsResponse` object contains:\n * - `deletedCount`: number - The number of deleted documents.\n * - `executionTime`: string - The time taken to delete the documents.\n * @throws {Error} If there is an error invoking the `documentsDelete` action.\n */\n public deleteDocuments(docIds: string[]): Observable<deleteDocumentsResponse> {\n const data = {\n action: \"documentsDelete\",\n docIds,\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<deleteDocumentsResponse>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsDelete: ${error}`);\n })\n );\n }\n\n /**\n * Deletes all uploaded documents.\n *\n * @returns An observable that emits the server response of type `deleteDocumentsResponse`.\n * The `deleteDocumentsResponse` object contains:\n * - `deletedCount`: number - The number of deleted documents.\n * - `executionTime`: string - The time taken to delete the documents.\n * @throws {Error} If there is an error invoking the `documentsDeleteAll` action.\n */\n public deleteAllDocuments(): Observable<deleteDocumentsResponse> {\n const data = {\n action: \"documentsDeleteAll\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<deleteDocumentsResponse>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsDeleteAll: ${error}`);\n })\n );\n }\n\n /**\n * Formats the given file size in bytes into a human-readable string.\n *\n * @param bytes - The size of the file in bytes.\n * @returns A string representing the file size in a human-readable format (e.g., \"10.24 KB\", \"1.00 MB\").\n */\n public formatFileSize(bytes: number): string {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return (\n Number.parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + \" \" + sizes[i]\n );\n }\n\n /**\n * Converts the given file size in bytes into megabytes.\n *\n * @param bytes - The size of the file in bytes.\n * @returns The size of the file in megabytes.\n */\n public convertBytesToMB(bytes: number): number {\n return bytes / (1024 * 1024);\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n Component,\n inject,\n Input,\n OnDestroy,\n OnInit,\n ViewChild,\n} from \"@angular/core\";\nimport { NgxFlowModule, FlowDirective, Transfer } from \"@flowjs/ngx-flow\";\nimport { FlowFile } from \"flowjs\";\nimport {\n BehaviorSubject,\n catchError,\n EMPTY,\n filter,\n finalize,\n interval,\n Subscription,\n switchMap,\n takeWhile,\n tap,\n startWith,\n of,\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { ChatConfig } from \"../../types\";\nimport { IndexingInfos, UploadEvent, UploadingInfos } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-upload\",\n templateUrl: \"./document-upload.component.html\",\n styleUrls: [\"./document-upload.component.scss\"],\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, NgxFlowModule, FormatIconComponent, TranslocoPipe]\n})\nexport class DocumentUploadComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n /** Polling interval in milliseconds to update the indexing status of the uploaded documents */\n @Input() pollingInterval : number = 1000;\n // Reference to the flow directive\n @ViewChild(\"flow\", { static: true }) flow!: FlowDirective;\n\n public chatService: ChatService;\n readonly flowConfig: flowjs.FlowOptions = {\n // Disables chunk testing before uploading actual file data. Thus, avoids unnecessary requests and speeds up uploads\n testChunks: false,\n // Allows multiple file uploads simultaneously\n singleFile: false,\n // Allows the same file to be uploaded multiple times\n allowDuplicateUploads: true,\n query: () => {\n return {}; // Empty object to prevent query parameters\n },\n preprocess: (chunk) => chunk.abort() // Prevents the default flow upload of chunks\n };\n public errorAlerts: string[] = [];\n public dragging$ = new BehaviorSubject<boolean>(false);\n public indexing$ = new BehaviorSubject<boolean>(false);\n public indexingInfos$ = new BehaviorSubject<IndexingInfos | undefined>(undefined);\n public uploading$ = new BehaviorSubject<boolean>(false);\n public uploadingInfos$ = new BehaviorSubject<UploadingInfos | undefined>(undefined);\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n\n this._subscription.add(\n this.flow.events$.subscribe((event) => {\n const evt = event as any;\n // Kept it just for reference to show how to access data of different events\n if (event.type === \"filesAdded\") {\n const addedFiles = evt.event[0] as FlowFile[];\n this._onFilesAdded(addedFiles);\n }\n if (event.type === \"filesSubmitted\") {\n this._onFilesSubmitted();\n }\n })\n );\n\n // Override the upload method of the flow directive\n this.flow.upload = this.startUpload.bind(this);\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Handles the submission of files.\n *\n * @remarks\n * This method performs the following checks on the submitted files:\n *\n * 1. Checks if the number of files submitted exceeds the remainingFileCount defined in the constraints.\n * - If the number of files exceeds the allowed count, all files are removed from the flow.\n * - An error message is added to the error alerts.\n *\n * 2. Checks if the total size of the files submitted exceeds the remainingFileSize defined in the constraints.\n * - If the total size exceeds the allowed size, all files are removed from the flow.\n * - An error message is added to the error alerts.\n *\n * 3. Checks if the file extension of the files submitted is not allowed.\n * - If the file extension is not allowed, the file is removed from the flow.\n * - An error message is added to the error alerts.\n */\n private _onFilesSubmitted() {\n // Get all files from the flow\n const files = [...this.flow.flowJs.files];\n // Clear the error alerts\n this.errorAlerts = [];\n const errors: string[] = [];\n\n /**\n * Checks if the number of files submitted exceeds the remainingFileCount defined in the constraints.\n * If the number of files exceeds the allowed count, all files are removed from the flow\n * An error message is added to the error alerts.\n */\n if (files.length > this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileCount) {\n for (const file of files) {\n this.flow.flowJs.removeFile(file);\n }\n errors.push(this.transloco.translate('chatDocumentsUpload.filesNumberLimitExceeded', { max: this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileCount }));\n }\n\n /**\n * Checks if the total size of the files submitted exceeds the remainingFileSize defined in the constraints.\n * If the total size exceeds the allowed size, all files are removed from the flow\n * An error message is added to the error alerts.\n *\n * @remarks\n * The maximum size of the files that can be uploaded is temporary set to the maximum of 128 MB and the remainingFileSizeMB defined in the constraints.\n * Waiting for the plugin to handle this kestrel issue\n */\n else if (this.documentsUploadService.convertBytesToMB(this.flow.flowJs.getSize()) > Math.min(128, this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileSizeMB)) {\n for (const file of files) {\n this.flow.flowJs.removeFile(file);\n }\n errors.push(this.transloco.translate('chatDocumentsUpload.filesSizeLimitExceeded', { max: Math.min(128, this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileSizeMB) }))\n }\n\n /**\n * Checks if the file extension of the files submitted is not allowed.\n * If the file extension is not allowed, the file is removed from the flow\n * An error message is added to the error alerts.\n */\n else {\n for (const file of files) {\n if (!this.documentsUploadService.uploadConfig$.value!.constraints.supportedFileExtensions.includes(`${file.getExtension()}`)) {\n this.flow.flowJs.removeFile(file);\n errors.push(this.transloco.translate('chatDocumentsUpload.fileExtensionUnsupported', { extension: file.getExtension() }));\n }\n }\n }\n\n // Add unique error messages to the error alerts\n this.errorAlerts = [...new Set(errors)];\n }\n\n private _onFilesAdded(files: FlowFile[]) {}\n\n onDragenter() {\n this.dragging$.next(true);\n }\n\n onDragleave(event: DragEvent) {\n if (\n !event.relatedTarget ||\n !(event.relatedTarget as HTMLElement).closest(\".dropzone\")\n ) {\n this.dragging$.next(false);\n }\n }\n\n onDrop() {\n this.dragging$.next(false);\n }\n\n trackTransfer(transfer: Transfer) {\n return transfer.id;\n }\n\n\n /**\n * Initiates the upload process by invoking the `upload` method\n * of the `flow` instance.\n * The `upload` method is overridden in the `ngOnInit` method to match the requirements of the assistant API.\n */\n upload() {\n this.flow.upload();\n }\n\n /**\n * Initiates the file upload process by preparing the form data,\n * setting the uploading flag, and making an API call to upload the files.\n *\n * @remarks\n * - Collects all files from the `flowJs` instance and appends them to a `FormData` object.\n * - Subscribes to the upload process to handle progress updates, completion, and errors.\n * - Triggers tracking the indexing process upon successful upload completion.\n * - Cleans up the `flow` instance after the upload process is finalized.\n */\n private startUpload() {\n const formData = new FormData();\n\n // Add all files with their original names\n this.flow.flowJs.files.forEach((file) => {\n formData.append(file.name, file.file);\n });\n\n // Clear the error alerts\n this.errorAlerts = [];\n // Set the uploading flag to true\n this.uploading$.next(true);\n\n // Make the API call to upload the files\n this._subscription.add(\n this.documentsUploadService.uploadDocuments(formData).pipe(\n tap((event: UploadEvent) => {\n if (event.type === 'uploadProgress') {\n this.uploadingInfos$.next(event as UploadingInfos);\n }\n if (event.type === 'response') {\n this.trackIndexingProcess(event.body.statusToken);\n }\n }),\n catchError((err) => {\n this.uploading$.next(false); // Set the uploading flag to false ONLY in case of an error. Otherwise, keep it true until the start of indexing process in order to prevent flickering of the UI\n this.uploadingInfos$.next(undefined); // Clear the uploading infos\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorUploadingFiles'));\n return EMPTY;\n }),\n finalize(() => {\n // Clear the flow instance after the upload is complete or an error occurs\n this.flow.cancel();\n })\n ).subscribe()\n );\n }\n\n /**\n * Tracks the indexing process for a single documents upload session by polling the API for its status.\n *\n * @param token - A unique token representing the single documents upload session.\n *\n * @remarks\n * - Clears the uploading flags and sets the indexing flag to true before starting the process.\n * - Polls the API every (pollingInterval: default = 1 second) to retrieve the current indexing status.\n * - Updates the `indexingInfos` property with the latest status.\n * - Stops polling when the indexing process is completed or an error occurs.\n * - Cleans up by resetting the indexing flags and clearing the `indexingInfos` property when the process is finalized.\n */\n trackIndexingProcess(token: string) {\n // Clear the uploading flags\n this.uploading$.next(false);\n this.uploadingInfos$.next(undefined);\n // Set the indexing flag to true\n this.indexing$.next(true);\n\n // Combine immediate API call with interval-based polling\n this._subscription.add(\n interval(this.pollingInterval).pipe(\n startWith(0), // Trigger the API call immediately\n switchMap(() => this.documentsUploadService.getIndexingStatus(token)),\n tap((res: IndexingInfos) => this.indexingInfos$.next(res)),\n takeWhile((response: IndexingInfos) => !response.isCompleted, true),\n catchError((err) => {\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorIndexingStatus'));\n return EMPTY;\n }),\n finalize(() => {\n // Clear the indexing flags\n this.indexing$.next(false);\n this.indexingInfos$.next(undefined);\n })\n ).subscribe()\n );\n }\n\n /**\n * Calculates the indexing progress as a percentage of completed documents.\n *\n * @param infos - The indexing information containing the list of documents and their statuses.\n * @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).\n * Returns 0 if the input is invalid or there are no documents.\n */\n getIndexingProgress(infos: IndexingInfos | undefined): number {\n if (!infos || !infos.docs) return 0;\n const completed = infos.docs.filter(doc => doc.status === \"Indexed\" || doc.status === \"Error\").length;\n const total = infos.docs.length;\n return completed/total;\n }\n\n}\n","<ng-container #flow=\"flow\" [flowConfig]=\"flowConfig\"></ng-container>\n<div class=\"file-upload-container\">\n <input\n type=\"file\"\n flowButton\n [flow]=\"flow.flowJs\"\n multiple\n hidden\n #fileInput>\n <div\n flowDrop\n [flow]=\"flow.flowJs\"\n (dragenter)=\"onDragenter()\"\n (dragleave)=\"onDragleave($event)\"\n (drop)=\"onDrop()\"\n (click)=\"fileInput.click()\"\n class=\"dropzone\"\n [ngClass]=\"{'dropzone--active': (dragging$ | async)}\"\n [hidden]=\"(uploading$ | async) || (indexing$ | async)\">\n <ng-container *ngIf=\"!(dragging$ | async); else draggingContent\">\n <i class=\"fas fa-cloud-upload-alt\"></i>\n <span>{{ 'chatDocumentsUpload.dragAndDrop' | transloco }}</span>\n <span class=\"text-orange\">{{ 'chatDocumentsUpload.clickToBrowse' | transloco }}</span>\n </ng-container>\n <ng-template #draggingContent>\n <span>{{ 'chatDocumentsUpload.dropFiles' | transloco }}</span>\n </ng-template>\n </div>\n\n <div *ngIf=\"(uploading$ | async) || (indexing$ | async)\" class=\"dropzone dropzone--active\">\n <ng-container *ngIf=\"(uploading$ | async); else indexingState\">\n <i class=\"fas fa-spinner fa-pulse\"></i>\n <span>\n {{ 'chatDocumentsUpload.uploadingFiles' | transloco: { count: (flow.transfers$ | async)!.transfers.length } }}\n </span>\n <span *ngIf=\"(uploadingInfos$ | async) as uploadingInfos\">{{ uploadingInfos.progress | number:'1.0-0' }}%</span>\n </ng-container>\n <ng-template #indexingState>\n <i class=\"fas fa-spinner fa-pulse\"></i>\n <ng-container *ngIf=\"indexingInfos$ | async as indexingInfo\">\n <span>\n {{ 'chatDocumentsUpload.indexingFiles' | transloco: { count: indexingInfo.docs.length } }}\n </span>\n <span>{{ getIndexingProgress(indexingInfo) * 100 | number:'1.0-0' }}%</span>\n </ng-container>\n </ng-template>\n </div>\n\n <ul *ngIf=\"errorAlerts.length > 0\" class=\"error-list mt-3\">\n <li *ngFor=\"let error of errorAlerts\">\n {{ error }}\n </li>\n </ul>\n\n <div *ngIf=\"((flow.transfers$ | async)?.transfers?.length > 0) && !(uploading$ | async)\" class=\"file-list mt-3\">\n <ul>\n <li *ngFor=\"let transfer of (flow.transfers$ | async)!.transfers; trackBy: trackTransfer\">\n <sq-format-icon [extension]=\"transfer.flowFile.getExtension()\" class=\"me-1\"></sq-format-icon>\n <span [title]=\"transfer.name\">{{ transfer.name }}</span>\n <i class=\"fas fa-trash ms-1\" (click)=\"flow.cancelFile(transfer)\" [title]=\"'chatDocumentsUpload.cancel' | transloco\"></i>\n </li>\n </ul>\n </div>\n\n <div class=\"d-flex mt-2\">\n <button\n type=\"button\"\n class=\"btn btn-light cancel-btn me-2\"\n (click)=\"flow.cancel()\"\n [disabled]=\"!((flow.transfers$ | async)?.transfers?.length > 0) || (uploading$ | async) || (indexing$ | async)\">\n {{ 'chatDocumentsUpload.cancel' | transloco }}\n </button>\n <button\n type=\"button\"\n class=\"upload-btn\"\n (click)=\"upload()\"\n [disabled]=\"!((flow.transfers$ | async)?.transfers?.length > 0) || (uploading$ | async) || (indexing$ | async)\">\n {{ 'chatDocumentsUpload.upload' | transloco }}\n </button>\n </div>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport { Component, inject, Input, OnDestroy, OnInit } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n combineLatest,\n EMPTY,\n filter,\n of,\n Subscription,\n switchMap,\n take,\n tap\n} from \"rxjs\";\nimport {\n parseISO,\n toDate\n} from \"date-fns\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { ChatConfig } from \"../../types\";\nimport { UploadedDocument } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-list\",\n templateUrl: \"./document-list.component.html\",\n styleUrls: [\"./document-list.component.scss\"],\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, FormatIconComponent, TranslocoPipe],\n})\nexport class DocumentListComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n public chatService: ChatService;\n public groupedUploadedDocuments$ = new BehaviorSubject<{ key: string; value: UploadedDocument[]}[]>([]);\n\n public documentToDelete?: UploadedDocument;\n public deletingAll: boolean = false;\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n tap((_) => this.updateUploadedDocumentsList()),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Updates the list of uploaded documents by fetching the latest data from the service.\n * The fetched documents are grouped by date.\n *\n * @returns {void}\n */\n updateUploadedDocumentsList(): void {\n this._subscription.add(\n combineLatest([\n this.documentsUploadService.getDocumentsList(),\n this.transloco.langChanges$\n ]).pipe(\n tap(([uploadedDocuments]) => {\n this.groupedUploadedDocuments$.next(this._groupUploadedDocumentsByDate(uploadedDocuments.docs))\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n deleteDocument(event: Event, doc: UploadedDocument): void {\n event.stopPropagation();\n this.documentToDelete = doc;\n }\n\n /**\n * Handles the deletion of an uploaded document. This method triggers a confirmation modal\n * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request\n * to delete the document and provides feedback to the user upon success or failure.\n *\n * @param event - The event object associated with the delete action, used to stop propagation.\n * @param doc - The document to be deleted, represented as an instance of `UploadedDocument`.\n *\n * @remarks\n * - Displays a confirmation modal with a warning message.\n * - On confirmation, deletes the document.\n * - Shows a success notification upon successful deletion.\n * - Logs and notifies the user of any errors encountered during the deletion process.\n */\n performDeleteDocument(): void {\n this._subscription.add(\n this.documentsUploadService.deleteDocuments([this.documentToDelete!.id])\n .pipe(\n tap(() => {\n this.notificationsService.success(this.transloco.translate('chatDocumentsUpload.deleteDocumentSuccess', { title: this.documentToDelete!.fileName }));\n this.documentToDelete = undefined;\n this.updateUploadedDocumentsList();\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.deleteDocumentError', { title: this.documentToDelete!.fileName }));\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n\n }\n\n deleteAllDocuments(event?: Event): void {\n event?.stopPropagation();\n this.deletingAll = true;\n }\n\n /**\n * Handles the deletion of all uploaded documents. This method triggers a confirmation modal\n * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request\n * to delete the whole list of documents and provides feedback to the user upon success or failure.\n *\n * @param event - (Optional) The event object associated with the delete action, used to stop propagation.\n *\n * @remarks\n * - Displays a confirmation modal with a warning message.\n * - On confirmation, deletes all documents.\n * - Shows a success notification upon successful deletion.\n * - Logs and notifies the user of any errors encountered during the deletion process.\n */\n performDeleteAllDocuments(): void {\n this._subscription.add(\n this.documentsUploadService.deleteAllDocuments()\n .pipe(\n tap(() => {\n this.deletingAll = false;\n this.notificationsService.success(this.transloco.translate('chatDocumentsUpload.deleteAllDocumentsSuccess'));\n this.updateUploadedDocumentsList();\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.deleteAllDocumentsError'));\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n private _groupUploadedDocumentsByDate(docs: UploadedDocument[]): { key: string; value: UploadedDocument[] }[] {\n const groupedUploadedDocuments = new Map<string, UploadedDocument[]>();\n\n docs\n .sort((a, b) => parseISO(b.indexationTime).getTime() - parseISO(a.indexationTime).getTime())\n .forEach(doc => {\n const groupKey = this.chatService.getTimeKey(toDate(parseISO(doc.indexationTime))); // Must convert the UTC date to local date before passing to _getTimeKey\n\n if (!groupedUploadedDocuments.has(groupKey)) {\n groupedUploadedDocuments.set(groupKey, []);\n }\n\n groupedUploadedDocuments.get(groupKey)!.push(doc);\n });\n\n return Array.from(groupedUploadedDocuments, ([key, value]) => ({ key, value }));;\n }\n}\n","<div class=\"alert alert-danger\" *ngIf=\"deletingAll\">\n <span>{{ 'chatDocumentsUpload.deleteAllDocumentsText' | transloco }}</span>\n <div class=\"d-flex gap-2\">\n <button class=\"btn btn-light w-100\" (click)=\"deletingAll=false\">{{ 'chatDocumentsUpload.cancel' | transloco }}</button>\n <button class=\"btn btn-secondary w-100\" (click)=\"performDeleteAllDocuments()\">{{ 'chatDocumentsUpload.confirm' | transloco }}</button>\n </div>\n</div>\n\n<div *ngFor=\"let group of (groupedUploadedDocuments$ | async)\" class=\"uploaded-docs\">\n <span class=\"uploaded-docs-date\">{{group.key}}</span>\n <div *ngFor=\"let doc of group.value\">\n <div class=\"uploaded-doc p-2\">\n <sq-format-icon [extension]=\"doc.fileExt\" class=\"me-1\"></sq-format-icon>\n <span class=\"title me-1\" [title]=\"doc.fileName\">{{doc.fileName}}</span>\n <i class=\"uploaded-doc-actions fas fa-trash ms-1\" [title]=\"'chatDocumentsUpload.delete' | transloco\"\n (click)=\"deleteDocument($event, doc)\"></i>\n </div>\n\n <div class=\"alert alert-warning\" *ngIf=\"documentToDelete && documentToDelete.id === doc.id\">\n <span>\n {{ 'chatDocumentsUpload.deleteDocumentText' | transloco: { title: documentToDelete!.fileName } }}\n </span>\n <div class=\"d-flex gap-2\">\n <button class=\"btn btn-light w-100\" (click)=\"documentToDelete=undefined\">{{ 'chatDocumentsUpload.cancel' | transloco }}</button>\n <button class=\"btn btn-secondary w-100\" (click)=\"performDeleteDocument()\">{{ 'chatDocumentsUpload.confirm' | transloco }}</button>\n </div>\n </div>\n </div>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n EMPTY,\n filter,\n of,\n Subscription,\n switchMap,\n take,\n tap\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { ChatConfig } from \"../../types\";\nimport { UploadedDocument, UploadedDocuments } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-overview\",\n templateUrl: \"./document-overview.component.html\",\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, TranslocoPipe],\n styles: [`\n.overview-text {\n font-style: italic;\n padding: .5rem .8rem;\n}\n `]\n})\nexport class DocumentOverviewComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n @Input() disabledUpload: boolean = true;\n\n @Output() onUpload = new EventEmitter();\n\n public chatService: ChatService;\n public uploadedDocuments$ = new BehaviorSubject<UploadedDocument[]>([]);;\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n tap((_) => this.updateUploadedDocumentsList()),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Updates the list of uploaded documents by fetching the latest data from the service.\n *\n * @returns {void}\n */\n updateUploadedDocumentsList(): void {\n this._subscription.add(\n this.documentsUploadService.getDocumentsList()\n .pipe(\n tap((uploadedDocuments: UploadedDocuments) => {\n this.uploadedDocuments$.next(uploadedDocuments.docs)\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n}\n","<div class=\"d-flex\">\n <span class=\"overview-text flex-grow-1\">\n {{ 'chatDocumentsUpload.uploadedDocuments' | transloco: { count: (uploadedDocuments$ | async)?.length || 0 } }}\n </span>\n <button disabled class=\"btn btn-light\" [title]=\"'chatDocumentsUpload.uploadToSources' | transloco\" (click)=\"onUpload.emit()\" [disabled]=\"disabledUpload\">\n <i class=\"fas fa-cloud-upload-alt\"></i>\n </button>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","getContentNodes","handleLeadingText","handleTrailingText","i1.UIService","i2.PrincipalService","i3","Prism","i2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGG;MAIU,sBAAsB,CAAA;AAHnC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,iBAAiB,GAA6B,IAAI,GAAG,EAAE,CAAC;AA8BjE,KAAA;AA5BC;;;;AAIG;IACH,a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,YAAY,EAAE,aAAa,CAAC,EAAA,QAAA,EAAA,ibAAA,EAAA,MAAA,EAAA,CAAA,yDAAA,CAAA,EAAA,CAAA;8BAU7B,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBACG,cAAc,EAAA,CAAA;sBAAtB,KAAK;gBAEI,QAAQ,EAAA,CAAA;sBAAjB,MAAM;;;AE1CT;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sinequa-assistant-chat.mjs","sources":["../../../projects/assistant/chat/instance-manager.service.ts","../../../projects/assistant/chat/services/app.service.ts","../../../projects/assistant/chat/services/principal.service.ts","../../../projects/assistant/chat/utils/assistant-json.ts","../../../projects/assistant/chat/chat-settings-v3/chat-settings-v3.component.ts","../../../projects/assistant/chat/chat-settings-v3/chat-settings-v3.component.html","../../../projects/assistant/chat/charts/chart/chart.component.ts","../../../projects/assistant/chat/charts/chart/chart.component.html","../../../projects/assistant/chat/format-icon/icons.ts","../../../projects/assistant/chat/format-icon/format-icon.component.ts","../../../projects/assistant/chat/format-icon/format-icon.component.html","../../../projects/assistant/chat/tooltip/tooltip.component.ts","../../../projects/assistant/chat/tooltip/tooltip.directive.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.html","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.html","../../../projects/assistant/chat/pipes/message-content.pipe.ts","../../../projects/assistant/chat/references/inline-image-reference.ts","../../../projects/assistant/chat/references/inline-page-reference.ts","../../../projects/assistant/chat/unified-plugins/embedded-image-reference.plugin.ts","../../../projects/assistant/chat/unified-plugins/embedded-page-reference.plugin.ts","../../../projects/assistant/chat/services/notification.service.ts","../../../projects/assistant/chat/services/ui.service.ts","../../../projects/assistant/chat/chat-message/chat-message.component.ts","../../../projects/assistant/chat/chat-message/chat-message.component.html","../../../projects/assistant/chat/services/user-settings.service.ts","../../../projects/assistant/chat/utils/utils.service.ts","../../../projects/assistant/chat/saved-chats/saved-chats.service.ts","../../../projects/assistant/chat/services/signalR.web.service.ts","../../../projects/assistant/chat/services/signalR-connection.service.ts","../../../projects/assistant/chat/dialogs/updates.component.ts","../../../projects/assistant/chat/services/dialog.service.ts","../../../projects/assistant/chat/types.ts","../../../projects/assistant/chat/services/assistant-configuration.service.ts","../../../projects/assistant/chat/services/assistant-metadata.service.ts","../../../projects/assistant/chat/services/assistant-tokens-tracking.service.ts","../../../projects/assistant/chat/services/assistant-ws-frames.service.ts","../../../projects/assistant/chat/debug-message/debug-message.service.ts","../../../projects/assistant/chat/chat.service.ts","../../../projects/assistant/chat/debug-message/debug-message-details/debug-message-details.component.ts","../../../projects/assistant/chat/debug-message/debug-message-details/debug-message-details.component.html","../../../projects/assistant/chat/debug-message/debug-message.component.ts","../../../projects/assistant/chat/debug-message/debug-message.component.html","../../../projects/assistant/chat/services/search.service.ts","../../../projects/assistant/chat/token-progress-bar/token-progress-bar.component.ts","../../../projects/assistant/chat/token-progress-bar/token-progress-bar.component.html","../../../projects/assistant/chat/chat.component.ts","../../../projects/assistant/chat/chat.component.html","../../../projects/assistant/chat/dialogs/delete-saved-chat.component.ts","../../../projects/assistant/chat/dialogs/rename-saved-chat.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.html","../../../projects/assistant/chat/prompt.component.ts","../../../projects/assistant/chat/documents-upload/documents-upload.service.ts","../../../projects/assistant/chat/documents-upload/document-upload/document-upload.component.ts","../../../projects/assistant/chat/documents-upload/document-upload/document-upload.component.html","../../../projects/assistant/chat/documents-upload/document-list/document-list.component.ts","../../../projects/assistant/chat/documents-upload/document-list/document-list.component.html","../../../projects/assistant/chat/documents-upload/document-overview/document-overview.component.ts","../../../projects/assistant/chat/documents-upload/document-overview/document-overview.component.html","../../../projects/assistant/chat/sinequa-assistant-chat.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { ChatService } from './chat.service';\n\n/**\n * A service to create and manage instances of ChatService dynamically based on the provided component references and the implementation type (http or websocket)\n * All chat-related components should share the same instance of this InstanceManagerService, which in turn provides the appropriate instance of ChatService\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class InstanceManagerService {\n private _serviceInstances: Map<string, ChatService> = new Map();\n\n /**\n * Store the instance of ChatService in the map\n * @param key key differentiator between components used to store their corresponding ChatService instance\n * @param service The ChatService instance\n */\n storeInstance(key: string, service: ChatService): void {\n this._serviceInstances.set(key, service);\n }\n\n /**\n * @param key key differentiator between components based on which the corresponding ChatService instance is fetched\n * @returns The instance of the service corresponding to the instance of the component\n */\n getInstance(key: string): ChatService {\n if (!this.checkInstance(key)) {\n throw new Error(`No assistant instance found for the given key : '${key}'`);\n }\n return this._serviceInstances.get(key)!;\n }\n\n /**\n *\n * @param key key differentiator between components based on which the check for an existent ChatService instance is performed\n * @returns True if a ChatService instance has been already instantiated for the given key. Otherwise, false.\n */\n checkInstance(key: string): boolean {\n return this._serviceInstances.has(key);\n }\n}\n","import { Injectable } from \"@angular/core\";\r\nimport { CCApp } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AppService {\r\n app: CCApp = {} as CCApp;\r\n get appName() {\r\n return this?.app?.name || \"\";\r\n }\r\n}","import { Injectable } from \"@angular/core\";\r\nimport { Principal } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class PrincipalService {\r\n principal: Principal = {} as Principal;\r\n}\r\n","import { CCApp } from \"@sinequa/atomic\";\n\nexport function getAssistantJsonFromCCApp(ccApp: CCApp, configId: string): any {\n const customJSONs = ccApp?.customJSONs;\n\n if (!!customJSONs) {\n const assistantsJson = ccApp.customJSONs.find(\n (json) => json.name === \"assistants\"\n );\n\n // try to fetch from sideJson\n if (!!assistantsJson) return assistantsJson?.data?.[configId];\n }\n\n // fallback to the main json\n return ccApp?.data?.assistants?.[configId];\n}\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { Subscription, filter, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated, sha512 } from \"@sinequa/atomic\";\n\nimport { ChatService } from \"../chat.service\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { ChatConfig, GllmModelDescription } from \"../types\";\n\nimport { AppService } from \"../services/app.service\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { getAssistantJsonFromCCApp } from \"../utils/assistant-json\";\n\n@Component({\n selector: 'sq-chat-settings-v3',\n templateUrl: './chat-settings-v3.component.html',\n styleUrls: [\"./chat-settings-v3.component.scss\"],\n standalone: true,\n imports: [CommonModule, FormsModule, TranslocoPipe],\n providers: [provideTranslocoScope('chat-settings')]\n})\nexport class ChatSettingsV3Component implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output(\"update\") _update = new EventEmitter<ChatConfig>();\n @Output(\"cancel\") _cancel = new EventEmitter<ChatConfig>();\n\n chatService: ChatService;\n config: ChatConfig;\n subscription = new Subscription();\n selectedModel: GllmModelDescription | undefined;\n functions: {name: string, enabled: boolean}[] = [];\n isAdmin = false;\n showDebugToggle = false;\n\n public instanceManagerService = inject(InstanceManagerService);\n public principalService = inject(PrincipalService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig)\n ).subscribe(_ => {\n this.isAdmin = this.principalService.principal!.isAdministrator;\n // Init config with a copy of the original chat config, so that it won't be modified by the user until he clicks on save\n this.config = JSON.parse(JSON.stringify(this.chatService.assistantConfig$.value));\n // Show debug toggle whether the user is an admin or a delegated admin with the debug mode enabled in the uiSettings\n this.showDebugToggle = (\n this.isAdmin || !!this.chatService.userOverride$.value || (this.principalService.principal!.isDelegatedAdmin && this.config.uiSettings.debug)\n ) ?? false;\n this.selectedModel = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.initFunctionsList();\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n get hasPrompts(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.displaySystemPrompt\n || !!this.config.uiSettings.displayUserPrompt;\n }\n\n get hasAdvancedParameters(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n get hasModel(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.servicesModels\n || !!this.config.uiSettings.functions\n || !!this.config.uiSettings.debug\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onChatModelChange(selectedModel: GllmModelDescription) {\n // Update properties based on the selected model\n this.config.defaultValues.service_id = selectedModel.serviceId;\n this.config.defaultValues.model_id = selectedModel.modelId;\n }\n\n getFunctionDescription(name: string): string {\n return this.chatService.functions?.find(fn => fn.functionName === name)?.description || \"\";\n }\n\n toggleFunctionsSelection(name: string) {\n // Update the enabled property of the function\n const index = this.config.defaultValues.functions.findIndex(func => func.name === name);\n this.config.defaultValues.functions[index].enabled = this.functions[index].enabled;\n }\n\n private initFunctionsList(): void {\n this.functions = this.config.defaultValues.functions.filter(func => !!this.chatService.functions?.find(fn => fn.functionName === func.name));\n }\n\n /**\n * Save the new chat config in the chat service and the user preferences\n * If the user has never modified the default values, we need to save the hash of the standard default values, as defined by the admin, in order to properly track changes afterwards.\n */\n async save() {\n const userSettingsConfig = this.chatService.assistants[this.instanceId] || {};\n if (!userSettingsConfig.defaultValues) { // At this point, it is the very first time the user makes changes to the default values\n const standardChatConfig = getAssistantJsonFromCCApp(this.appService.app, this.instanceId);\n const currentDefaultValuesHash = await sha512(JSON.stringify(standardChatConfig.defaultValues));\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash };\n this.chatService.updateChatConfig(this.config, hashes);\n } else {\n this.chatService.updateChatConfig(this.config);\n }\n this.chatService.generateAuditEvent(\"ast-configuration.click\", { 'configuration': JSON.stringify(this.config) });\n this._update.emit(this.config);\n }\n\n /**\n * Cancel the current changes\n */\n cancel() {\n this._cancel.emit(this.chatService.assistantConfig$.value);\n }\n}\n","<div class=\"sq-chat-settings\" *ngIf=\"isAdmin || config.uiSettings.display\">\n <div class=\"settings-panel p-2 small\" *ngIf=\"config\">\n\n <h5 *ngIf=\"hasModel\">{{ 'chatSettings.model' | transloco }}</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.servicesModels\">\n <label for=\"gllmModel\" class=\"form-label\">{{ 'chatSettings.model' | transloco }}</label>\n <select class=\"form-select\" id=\"gllmModel\" [(ngModel)]=\"selectedModel\" (ngModelChange)=\"onChatModelChange($event)\">\n <option *ngFor=\"let model of chatService.models\" [ngValue]=\"model\">{{model.name}}</option>\n </select>\n </div>\n\n <div class=\"mb-4\" *ngIf=\"isAdmin || config.uiSettings.functions\">\n <label for=\"gllmFunctions\" class=\"form-label\">{{ 'chatSettings.functions' | transloco }}</label>\n <div id=\"gllmFunctions\" *ngFor=\"let func of functions\" class=\"multi-option form-check form-switch\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" [id]=\"func.name\" [(ngModel)]=\"func.enabled\"\n (ngModelChange)=\"toggleFunctionsSelection(func.name)\">\n <label class=\"form-label\" [for]=\"func.name\" [title]=\"getFunctionDescription(func.name)\">{{ func.name }}</label>\n </div>\n </div>\n\n <div class=\"form-check form-switch mb-2\" *ngIf=\"showDebugToggle\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"debug\" [(ngModel)]=\"config.defaultValues.debug\">\n <label class=\"form-check-label\" for=\"debug\">{{ 'chatSettings.debug' | transloco }}</label>\n </div>\n\n <details *ngIf=\"hasAdvancedParameters\">\n <summary>{{ 'chatSettings.advancedParameters' | transloco }}</summary>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.temperature\">\n <label for=\"temperature\" class=\"form-label\">{{ 'chatSettings.temperature' | transloco }}: {{config.defaultValues.temperature}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"2\" step=\"0.1\" id=\"temperature\"\n [(ngModel)]=\"config.defaultValues.temperature\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.top_p\">\n <label for=\"top-p\" class=\"form-label\">{{ 'chatSettings.topP' | transloco }}: {{config.defaultValues.top_p}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"1\" step=\"0.05\" id=\"top-p\"\n [(ngModel)]=\"config.defaultValues.top_p\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.max_tokens\">\n <label for=\"max-tokens\" class=\"form-label\">{{ 'chatSettings.MaxGeneratedTokens' | transloco }}:\n {{config.defaultValues.max_tokens}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"1\" max=\"2048\" step=\"1\" id=\"max-tokens\"\n [(ngModel)]=\"config.defaultValues.max_tokens\">\n </div>\n </details>\n\n <hr>\n\n <h5 *ngIf=\"hasPrompts\">{{ 'chatSettings.Prompts' | transloco }}</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displaySystemPrompt\">\n <label for=\"initialSystemPrompt\" class=\"form-label\">{{ 'chatSettings.systemPrompt' | transloco }}</label>\n <textarea class=\"form-control\" id=\"initialSystemPrompt\" [(ngModel)]=\"config.defaultValues.systemPrompt\"></textarea>\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displayUserPrompt\">\n <label for=\"initialUserPrompt\" class=\"form-label\">{{ 'chatSettings.initialUserPrompt' | transloco }}</label>\n <textarea class=\"form-control\" id=\"initialUserPrompt\" [(ngModel)]=\"config.defaultValues.userPrompt\"></textarea>\n </div>\n\n </div>\n\n <div class=\"buttons-panel d-flex justify-content-end\">\n <button class=\"btn btn-light me-1\" (click)=\"cancel()\">{{ 'chatSettings.cancel' | transloco }}</button>\n <button class=\"btn btn-primary\" *ngIf=\"config\" (click)=\"save()\">{{ 'chatSettings.save' | transloco }}</button>\n </div>\n\n</div>\n","import { OnChanges, Component, Input, SimpleChanges } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Chart, registerables } from 'chart.js'\n\nChart.register(...registerables);\n\n@Component({\n selector: 'sq-assistant-chart',\n standalone: true,\n imports: [CommonModule],\n templateUrl: './chart.component.html',\n styleUrls: ['./chart.component.css']\n})\nexport class ChartComponent implements OnChanges {\n @Input() rawChartData: string;\n\n public chart: Chart;\n private debounceTimer: any;\n\n constructor() { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['rawChartData']) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = setTimeout(() => this.initializeChart(), 300);\n }\n }\n\n private initializeChart() {\n Chart.getChart('chart-canvas')?.destroy();\n\n const canvasElement = document.getElementById('chart-canvas');\n\n if(canvasElement){\n try{\n const chartInput = this.rawChartData.match(/<chartjs>({[\\s\\S]*?)<\\/chartjs>/)?.[1]?.trim().replace(/'/g, '\"') as string;\n const chartConfig = JSON.parse(chartInput);\n\n this.chart = new Chart('chart-canvas', chartConfig);\n\n } catch (error) {\n console.error('Invalid chart configuration, check the assistant configuration: ', error);\n }\n\n }\n else {\n console.error('Chart Canvas is not found');\n }\n }\n}\n","<div class=\"chart-container\">\n <canvas id=\"chart-canvas\">{{ chart }}</canvas>\n</div>\n","export interface IconFormat {\n icon: string;\n color?: string;\n}\n\nexport const defaultFormatIcons: Record<string, IconFormat> = {\n \"extractslocations\": { icon: \"far fa-file-alt\" },\n \"matchlocations\": { icon: \"far fa-flag\" },\n \"geo\": { icon: \"fas fa-map-marker-alt\" },\n \"person\": { icon: \"fas fa-user\" },\n \"company\": { icon: \"fas fa-building\" },\n \"title\": { icon: \"fas fa-tag\" },\n \"modified\": { icon: \"far fa-calendar-alt\" },\n \"size\": { icon: \"fas fa-weight-hanging\" },\n \"treepath\": { icon: \"fas fa-folder-open\" },\n \"filename\": { icon: \"far fa-file-alt\" },\n \"authors\": { icon: \"fas fa-user-edit\" },\n \"accesslists\": { icon: \"fas fa-lock\" },\n \"doctype\": { icon: \"far fa-file\" },\n \"documentlanguages\": { icon: \"fas fa-globe-americas\" },\n \"globalrelevance\": { icon: \"far fa-star\" },\n \"indexationtime\": { icon: \"fas fa-search\" },\n \"concepts\": { icon: \"far fa-comment-dots\" },\n \"keywords\": { icon: \"fas fa-tags\" },\n \"matchingpartnames\": { icon: \"fas fa-align-left\" },\n \"msgfrom\": { icon: \"fas fa-envelope\" },\n \"msgto\": { icon: \"fas fa-envelope-open-text\" },\n\n \"file\": { icon: \"far fa-file\" },\n \"htm\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"html\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"xhtm\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"xhtml\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"mht\": { icon: \"fas fa-globe-europe\", color: '#4545bf' },\n \"doc\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"docx\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"docm\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dot\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dotx\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"dotm\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"rtf\": { icon: \"far fa-file-word\", color: '#3f3fca' },\n \"odt\": { icon: \"far fa-file-word\", color: 'grey' },\n \"ott\": { icon: \"far fa-file-word\", color: 'grey' },\n \"gdoc\": { icon: \"far fa-file-word\", color: 'blue' },\n \"xls\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlsx\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlt\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xltx\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xlsm\": { icon: \"far fa-file-excel\", color: 'green' },\n \"xltm\": { icon: \"far fa-file-excel\", color: 'green' },\n \"gsheet\": { icon: \"far fa-file-excel\", color: 'darkgreen' },\n \"ods\": { icon: \"far fa-file-excel\", color: 'lightgreen' },\n \"ots\": { icon: \"far fa-file-excel\", color: 'lightgreen' },\n \"ppt\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pptm2\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pps\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"ppsx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"ppsm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"pot\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"potx\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"potm\": { icon: \"far fa-file-powerpoint\", color: '#e64b30' },\n \"odp\": { icon: \"far fa-file-powerpoint\", color: 'red' },\n \"otp\": { icon: \"far fa-file-powerpoint\", color: 'red' },\n \"gslides\": { icon: \"far fa-file-powerpoint\", color: 'orange' },\n \"pdf\": { icon: \"far fa-file-pdf\", color: '#ec2e2e' },\n \"jpg\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"jpeg\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"bmp\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"tiff\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"tif\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"gif\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"png\": { icon: \"far fa-file-image\", color: '#4545bf' },\n \"mp4\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"flv\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"swf\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mts\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"divx\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"wmv\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"avi\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mov\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mpg\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mpeg\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"asf\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"rm\": { icon: \"far fa-file-video\", color: '#4545bf' },\n \"mp3\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"wav\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"ogg\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"wma\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"aac\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"m3u\": { icon: \"far fa-file-audio\", color: 'lightblue' },\n \"txt\": { icon: \"far fa-file-alt\", color: '#202020' },\n \"text\": { icon: \"far fa-file-alt\", color: '#202020' },\n \"xml\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"cs\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"java\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"cpp\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"c\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"h\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"hpp\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"js\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"ts\": { icon: \"far fa-file-code\", color: '#4545bf' },\n \"zip\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"7zip\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"7z\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"rar\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"gz\": { icon: \"far fa-file-archive\", color: 'yellow' },\n \"notes\": { icon: \"fas fa-file-invoice\", color: 'orange' },\n \"quickr\": { icon: \"fas fa-file-invoice\", color: 'orange' },\n \"email\": { icon: \"far fa-envelope\", color: 'black' },\n \"mail\": { icon: \"far fa-envelope\", color: 'black' },\n \"msg\": { icon: \"far fa-envelope\", color: 'black' },\n \"mdb\": { icon: \"far fa-database\", color: 'purple' },\n \"odb\": { icon: \"far fa-database\", color: 'darkred' },\n \"otb\": { icon: \"far fa-database\", color: 'darkred' },\n \"xsn\": { icon: \"fas fa-file-excel\", color: 'purple' },\n \"gform\": { icon: \"fas fa-file-excel\", color: 'purple' },\n \"one\": { icon: \"far fa-book\", color: 'purple' },\n \"odf\": { icon: \"fas fa-file-medical-alt\", color: 'grey' },\n \"otf\": { icon: \"fas fa-file-medical-alt\", color: 'grey' },\n \"vsdx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vtx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vdx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vssx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vstx\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsdm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vssm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vstm\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vdw\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vsd\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vss\": { icon: \"far fa-object-group\", color: 'purple' },\n \"vst\": { icon: \"far fa-object-group\", color: 'purple' },\n \"odg\": { icon: \"far fa-object-group\", color: 'orange' },\n \"otg\": { icon: \"far fa-object-group\", color: 'orange' },\n \"gdraw\": { icon: \"far fa-object-group\", color: 'red' },\n \"pub\": { icon: \"far fa-object-group\", color: 'darkgreen' },\n \"ldap\": { icon: \"far fa-users\", color: 'brown' },\n \"ad\": { icon: \"far fa-users\", color: 'brown' },\n \"mmp\": { icon: \"fas fa-file-medical\", color: 'grey' },\n \"mppx\": { icon: \"fas fa-file-medical\", color: 'grey' },\n}","import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';\nimport { defaultFormatIcons } from './icons';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'sq-format-icon',\n templateUrl: './format-icon.component.html',\n encapsulation: ViewEncapsulation.None,\n standalone: true,\n imports: [CommonModule]\n})\nexport class FormatIconComponent implements OnChanges {\n\n @Input() extension: string;\n\n private _formatIcons = defaultFormatIcons;\n \n icon: string;\n\n ngOnChanges() {\n const icon = this.extension ? this._formatIcons[this.extension] : undefined;\n this.icon = icon?.icon || this._formatIcons.file.icon;\n }\n\n}\n","<span *ngIf=\"icon\" class=\"{{icon}}\"></span>","import { Component, ChangeDetectionStrategy, TemplateRef } from '@angular/core';\r\nimport { animate, style, transition, trigger } from '@angular/animations';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\n\r\n/**\r\n * Internal component that wraps the tooltip's content\r\n */\r\n@Component({\r\n selector: 'sqx-tooltip',\r\n standalone: true,\r\n styleUrls: ['./tooltip.component.scss'],\r\n imports: [NgTemplateOutlet],\r\n template: `\r\n <ng-container *ngTemplateOutlet=\"template || defaultTpl; context: {$implicit: data}\"></ng-container>\r\n <ng-template #defaultTpl let-data>\r\n <div class=\"sq-tooltip {{tooltipClass}}\" @tooltip [innerHTML]=\"data\"></div>\r\n </ng-template>`,\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n animations: [\r\n trigger('tooltip', [\r\n transition(':enter', [\r\n style({ opacity: 0 }),\r\n animate(300, style({ opacity: 1 })),\r\n ]),\r\n transition(':leave', [\r\n animate(300, style({ opacity: 0 })),\r\n ]),\r\n ]),\r\n ],\r\n})\r\nexport class TooltipComponent<T=string> {\r\n data?: T;\r\n template?: TemplateRef<any>;\r\n tooltipClass?: string;\r\n}\r\n","import {\r\n Directive,\r\n ElementRef,\r\n HostBinding,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n TemplateRef\r\n} from \"@angular/core\";\r\nimport {\r\n ConnectedPosition,\r\n Overlay,\r\n OverlayPositionBuilder,\r\n OverlayRef\r\n} from \"@angular/cdk/overlay\";\r\nimport { ComponentPortal } from \"@angular/cdk/portal\";\r\nimport { TooltipComponent } from \"./tooltip.component\";\r\n\r\nimport { Observable, of, Subscription, delay } from \"rxjs\";\r\n\r\nexport type Placement = \"top\" | \"bottom\" | \"right\" | \"left\";\r\n/**\r\n * Directive that attaches a tooltip to the host element\r\n *\r\n * @example\r\n * <div sqTooltip=\"This is a tooltip's text\"></div>\r\n *\r\n * @example\r\n * // A template can be passed to the directive instead of a string. Here 'tooltip' is a template reference\r\n * <div sqTooltip=\"tooltip\"></div>\r\n *\r\n * <ng-template #tooltip>\r\n * <h2>Title</h2>\r\n * <p>{{ \"this is a comment\" | uppercase }}</p>\r\n * <h3>Other text</h3>\r\n * </ng-template>\r\n *\r\n * @example\r\n * //HTML can be used directly (not recommanded)\r\n * <div sqTooltip=\"<h1>Title</h1><br><p>This is a comment</p>\"></div>\r\n */\r\n@Directive({\r\n selector: \"[sqTooltip]\",\r\n standalone: true\r\n})\r\nexport class TooltipDirective<TooltipData=undefined, TooltipDisplay=string> implements OnDestroy {\r\n /**\r\n * Defining a property called textOrTemplate that can be a string, a function that\r\n * returns an Observable of a string or undefined, or a TemplateRef.\r\n */\r\n @Input(\"sqTooltip\") value?: TooltipDisplay | ((data?: TooltipData) => Observable<TooltipDisplay | undefined> | undefined);\r\n @Input(\"sqTooltipData\") data?: TooltipData;\r\n @Input(\"sqTooltipTemplate\") template?: TemplateRef<any>;\r\n\r\n /**\r\n * Setting the default value of the placement property to `bottom`\r\n */\r\n @Input() placement: Placement = \"bottom\";\r\n /**\r\n * List of fallback placement if *Placement* defined can't be applyied\r\n */\r\n @Input() fallbackPlacements: Placement[] = [];\r\n\r\n /**\r\n * Delay in millisecond before showing/hiding the tooltip.\r\n *\r\n * Default value is 300ms\r\n */\r\n @Input() delay = 300;\r\n /**\r\n * If the tooltip should stay opened on hover\r\n */\r\n @Input() hoverableTooltip = false;\r\n /**\r\n * Custom class for the tooltip\r\n */\r\n @Input() tooltipClass?: string;\r\n\r\n /**\r\n * Applies the \"has-tooltip\" class to its host when displayed\r\n */\r\n @HostBinding('class.has-tooltip') hasTooltip = false;\r\n\r\n private overlayRef: OverlayRef;\r\n private subscription?: Subscription;\r\n private clearTimeout?: any;\r\n static activeTooltip?: TooltipDirective<any, any>;\r\n\r\n constructor(\r\n private overlay: Overlay,\r\n private overlayPositionBuilder: OverlayPositionBuilder,\r\n private elementRef: ElementRef\r\n ) { }\r\n\r\n ngOnDestroy() {\r\n // do not forget to clear timeout function\r\n this.clear();\r\n }\r\n\r\n @HostListener(\"mouseenter\")\r\n show() {\r\n // The tooltip is already showing: just cancel the hiding\r\n if (this.clearTimeout) {\r\n this.cancelHide();\r\n return;\r\n }\r\n\r\n this.clear();\r\n\r\n if (!this.value) return;\r\n\r\n const obs = typeof this.value === 'function'\r\n ? (this.value as (data?: TooltipData) => Observable<TooltipDisplay | undefined> | undefined)(this.data)\r\n : of(this.value).pipe(delay(this.delay));\r\n\r\n this.subscription = obs?.subscribe(data => {\r\n\r\n // return when value is empty\r\n if (!data || (typeof data === 'string' && !data.trim())) return;\r\n\r\n this.clear();\r\n\r\n TooltipDirective.activeTooltip?.clear();\r\n TooltipDirective.activeTooltip = this;\r\n\r\n // set the tooltip's position strategy\r\n const positionStrategy = this.overlayPositionBuilder\r\n .flexibleConnectedTo(this.elementRef)\r\n .withPositions([this.position(), ...this.fallbackPositions()]);\r\n\r\n const scrollStrategy = this.overlay.scrollStrategies.close();\r\n this.overlayRef = this.overlay.create({ positionStrategy, scrollStrategy });\r\n\r\n // instance of the tooltip's component\r\n const tooltipRef = this.overlayRef.attach(new ComponentPortal(TooltipComponent<TooltipDisplay>));\r\n\r\n tooltipRef.instance.data = data;\r\n\r\n if (this.template) {\r\n tooltipRef.instance.template = this.template;\r\n }\r\n if (this.tooltipClass) {\r\n tooltipRef.instance.tooltipClass = this.tooltipClass;\r\n }\r\n\r\n if (this.hoverableTooltip) {\r\n this.overlayRef.overlayElement.addEventListener(\"mouseenter\", () => this.cancelHide());\r\n this.overlayRef.overlayElement.addEventListener('mouseleave', () => this.hide());\r\n }\r\n\r\n this.hasTooltip = true;\r\n });\r\n }\r\n\r\n @HostListener(\"mousedown\")\r\n mouseClick() {\r\n this.clear();\r\n }\r\n\r\n @HostListener(\"mouseleave\")\r\n hide() {\r\n if (!this.clearTimeout) {\r\n this.clearTimeout = setTimeout(() => this.clear(), this.hoverableTooltip ? this.delay : 10);\r\n }\r\n }\r\n\r\n cancelHide() {\r\n if (this.clearTimeout) {\r\n clearTimeout(this.clearTimeout);\r\n this.clearTimeout = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Clear timeout function and detach overlayRef\r\n */\r\n clear() {\r\n this.subscription?.unsubscribe();\r\n this.cancelHide();\r\n this.overlayRef?.detach();\r\n this.hasTooltip = false;\r\n }\r\n\r\n position(placement = this.placement): ConnectedPosition {\r\n switch (placement) {\r\n case \"bottom\":\r\n return {\r\n originX: \"center\",\r\n originY: \"bottom\",\r\n overlayX: \"center\",\r\n overlayY: \"top\",\r\n offsetY: 2\r\n };\r\n case \"right\":\r\n return {\r\n originX: \"end\",\r\n originY: \"center\",\r\n overlayX: \"start\",\r\n overlayY: \"center\",\r\n offsetX: 2\r\n };\r\n case \"left\":\r\n return {\r\n originX: \"start\",\r\n originY: \"center\",\r\n overlayX: \"end\",\r\n overlayY: \"center\",\r\n offsetX: -2\r\n };\r\n default:\r\n return {\r\n originX: \"center\",\r\n originY: \"top\",\r\n overlayX: \"center\",\r\n overlayY: \"bottom\",\r\n offsetY: -2\r\n };\r\n }\r\n }\r\n\r\n fallbackPositions(): ConnectedPosition[] {\r\n return Array.from(this.fallbackPlacements).map(p => this.position(p));\r\n }\r\n\r\n}\r\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from '../format-icon/format-icon.component';\nimport { ChatContextAttachment, DocumentPart } from '../types';\nimport { TooltipDirective } from '../tooltip/tooltip.directive';\n\n@Component({\n selector: 'sq-chat-reference',\n templateUrl: './chat-reference.component.html',\n styleUrls: ['./chat-reference.component.scss'],\n standalone: true,\n imports: [CommonModule, FormatIconComponent, TooltipDirective, TranslocoPipe],\n providers: [provideTranslocoScope('chat-reference')],\n})\nexport class ChatReferenceComponent {\n\n @Input() reference: string;\n @Input() attachment: ChatContextAttachment;\n @Input() partId?: number;\n\n @Output() openDocument = new EventEmitter<ChatContextAttachment>();\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n\n get parts(): DocumentPart[] {\n if (!this.attachment) return [];\n return this.attachment.parts.filter(part => (!this.partId || part.partId === this.partId) && !!part.text);\n }\n\n expandAttachment() {\n if (this.partId) return;\n this.attachment['$expanded'] = !this.attachment['$expanded'];\n }\n}\n","<div [class.reference-tooltip]=\"!!partId\">\n <div class=\"reference-data\" [class.expanded]=\"attachment['$expanded'] || !!partId\" (click)=\"expandAttachment()\">\n <span class=\"reference me-1\">{{reference}}</span>\n <sq-format-icon [extension]=\"attachment.record.fileext\"></sq-format-icon>\n <a [id]=\"'attachment-'+attachment.recordId\">\n {{attachment.record.title}}\n </a>\n <i class=\"fas fa-eye\" (click)=\"$event.stopPropagation(); openPreview.emit(attachment)\" [sqTooltip]=\"!partId ? ('chatReference.previewDocument' | transloco) : ''\"></i>\n <i class=\"fas fa-arrow-up-right-from-square\" *ngIf=\"attachment.record.url1 || attachment.record.originalUrl\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment)\" [sqTooltip]=\"!partId ? ('chatReference.openDocument' | transloco) : ''\">\n </i>\n </div>\n <div class=\"reference-passages\" *ngIf=\"!!partId || (attachment['$expanded']) && parts.length\">\n <div class=\"reference-passage\" *ngFor=\"let part of parts\">\n <span class=\"reference me-1\">{{reference}}.{{part.partId}}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n </div>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport SafeColor from 'safecolor'\n\n@Component({\n selector: 'sq-initials-avatar',\n templateUrl: './initials-avatar.component.html',\n styleUrls: ['./initials-avatar.component.scss'],\n standalone: true,\n imports: [CommonModule]\n})\nexport class InitialsAvatarComponent {\n\n @Input() fullName: string = '';\n @Input() size: number = 1.5; // in rem\n\n /**\n * Gives initials of a name and a safe color background to use,\n * assuming text color will be white\n * @param fullName full name to evaluate intials for\n * @param split string to use has splitter for `fullName`\n * @returns an `object` containing initials and color\n */\n getInitialsAndColorFromFullName(fullName: string, split: string = ' '): { initials: string; color: string } {\n return { initials: this.getInitialsFromFullName(fullName, split), color: this.getColorFromName(fullName) };\n }\n\n /**\n * Gives initials of a name, ie:\n * ```\n * getInitialForFullName('John Snow') => 'JS'\n * getInitialForFullName('Geralt of Rivia', ' of ') => 'GR'\n * ```\n * @param fullName full name to evaluate intial for\n * @param split string to use has splitter\n * @returns string containg the first letter of splitted name\n */\n getInitialsFromFullName(fullName: string, split: string = ' '): string {\n if (!fullName) return '';\n\n const names = fullName.split(split);\n return names[0][0] + (names[1]?.[0] ?? '');\n }\n\n /**\n * Gets a random color using text as seed\n * @param text string to use for color generation\n * @returns string formatted like `rgb(xxx, xxx, xxx)`\n */\n getColorFromName(text: string): string {\n const safeColor = new SafeColor({\n color: [255, 255, 255],\n contrast: 4.5\n });\n\n return safeColor.random(text);\n }\n\n}\n","<span class=\"sq-initials-avatar\" *ngIf=\"getInitialsAndColorFromFullName(fullName) as meta\"\n [ngStyle]=\"{ 'background-color': meta.color }\" [style.height.rem]=\"size\" [style.width.rem]=\"size\"\n [style.line-height.rem]=\"size\" [style.font-size.rem]=\"size/2\">\n {{ meta.initials | uppercase }}\n</span>","import { Pipe, PipeTransform } from \"@angular/core\";\nimport { MessageContent, RawMessageContent, TextMessageContent } from \"../types/message-content.types\";\n\n/**\n * Pipe to extract the content of a message\n * Main role is to support how to render each type of message directly from the template\n * \n * @param messageContent The message content to extract\n * \n * @returns The content of the message\n */\n@Pipe({\n name: \"messageContent\",\n standalone: true,\n})\nexport class MessageContentPipe implements PipeTransform {\n transform(messageContent: RawMessageContent): string {\n if (typeof messageContent === \"string\") return messageContent;\n\n if (!Array.isArray(messageContent)) {\n if (!!messageContent['type'] && messageContent['type'] === \"text\") return (messageContent as TextMessageContent).text;\n\n throw new Error(\n \"Invalid message format, should be an Array of element, got content as\" +\n typeof messageContent\n );\n }\n \n const content = messageContent[0] as MessageContent;\n\n if (content.type === \"text\") return (content as TextMessageContent).text;\n\n console.error(\"Invalid message format, type of message not supported\" + typeof content.type);\n\n return '';\n }\n}\n","import { Component, ElementRef, input, output, viewChild } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from \"../format-icon/format-icon.component\";\nimport { RawAttachment } from \"../types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\n\n@Component({\n selector: \"InlineImageReference\",\n standalone: true,\n providers: [provideTranslocoScope('chat-references')],\n imports: [FormatIconComponent, TranslocoPipe],\n template: `\n <header>\n <span class=\"reference\">{{ id().split('.')[0] }}</span>\n\n <sq-format-icon [extension]=\"ref().article?.fileext\" />\n\n <p>{{ ref().article?.title ?? ('chatReferences.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReferences.openDocumentPreview' | transloco\" (click)=\"previewClicked()\">\n <i class=\"fas fa-eye\"></i>\n </a>\n\n @if (ref().article?.url1 || ref().article?.originalUrl) {\n <a role=\"button\" [title]=\"'chatReferences.openDocument' | transloco\" (click)=\"documentClicked()\">\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </a>\n }\n </header>\n\n @if (ref().url) {\n <div style=\"display: flex; align-items: start; gap: 0.25rem\">\n <span class=\"reference\">Img-{{ id() }}</span>\n\n <img [src]=\"ref().url\" (click)=\"modalClicked()\" [alt]=\"ref().description\" />\n </div>\n }\n\n <dialog #modal>\n <button class=\"close\" (click)=\"modalTpl()?.nativeElement?.close()\">\n <i class=\"fas fa-xmark\"></i>\n </button>\n\n <img [src]=\"ref().url\" [alt]=\"ref().description\"/>\n </dialog>\n `,\n styleUrls: [\"./inline-reference.scss\"],\n})\nexport class InlineImageReferenceComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openDocument = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openModal = output<void>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n previewClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openPreview.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n documentClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openDocument.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","import { Component, ElementRef, input, output, viewChild } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { FormatIconComponent } from \"../format-icon/format-icon.component\";\nimport { RawAttachment } from \"../types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\n\n@Component({\n selector: \"InlinePageReference\",\n standalone: true,\n providers: [provideTranslocoScope('references')],\n imports: [FormatIconComponent, TranslocoPipe],\n template: `\n <header>\n <span class=\"reference\">{{ id().split(\".\")[0] }}</span>\n\n <sq-format-icon [extension]=\"ref().article?.fileext\" />\n\n <p>{{ ref().article?.title ?? ('chatReferences.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReferences.openDocumentPreview' | transloco\" (click)=\"previewClicked()\">\n <i class=\"fas fa-eye\"></i>\n </a>\n\n @if (ref().article?.url1 || ref().article?.originalUrl) {\n <a role=\"button\" [title]=\"'chatReferences.openDocument' | transloco\" (click)=\"documentClicked()\">\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </a>\n }\n </header>\n\n @if (ref().url) {\n <div style=\"display: flex; align-items: start; gap: 0.25rem\">\n <span class=\"reference\">Page-{{ id() }}</span>\n\n <img [src]=\"ref().url\" (click)=\"modalClicked()\" [alt]=\"ref().description\" />\n </div>\n }\n\n <dialog #modal>\n <button class=\"close\" (click)=\"modalTpl()?.nativeElement?.close()\">\n <i class=\"fas fa-xmark\"></i>\n </button>\n\n <img [src]=\"ref().url\" [alt]=\"ref().description\" />\n </dialog>\n `,\n styleUrls: [\"./inline-reference.scss\"],\n})\nexport class InlinePageReferenceComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openDocument = output<\n Omit<RawAttachment, \"type\"> & { $partId: string }\n >();\n readonly openModal = output<void>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n previewClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openPreview.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n documentClicked() {\n if (!this.ref() || !this.ref().article || !this.ref().articleId) return;\n\n this.openDocument.emit({\n record: this.ref().article!,\n recordId: this.ref().articleId!,\n $partId: this.id().split(\".\")[1],\n });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","import { Content, Parent, Text } from \"mdast\";\nimport { Node } from \"unist\";\nimport { CONTINUE, visit } from \"unist-util-visit\";\n\nexport const EMBEDDED_IMAGE_NAME = \"embedded-image-reference\";\nconst EMBEDDED_IMAGE_REGEX = /\\[(Img-([0-9]+(?:\\.[0-9]+){2}))\\]/g;\n\nexport default function embeddedImageReferencePlugin(tree: Node) {\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n const refs = Array.from(node.value.matchAll(EMBEDDED_IMAGE_REGEX));\n\n if (refs.length === 0) return CONTINUE;\n\n const nodes = getContentNodes(node, refs);\n\n if (nodes.length === 0) return CONTINUE;\n\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length;\n });\n\n return tree;\n}\n\n/** Transform node text content into a set of node */ \nfunction getContentNodes(node: Text, refs: RegExpExecArray[]): Content[] {\n let nodes = refs.reduce((acc, ref) => {\n handleLeadingText(acc, node, ref);\n\n acc.push({\n type: EMBEDDED_IMAGE_NAME,\n value: ref[2],\n end: ref.index + ref[0].length,\n } as any as Content & { end: number });\n\n return acc;\n }, [] as (Content & { end: number })[]) as Content[];\n\n handleTrailingText(node, refs, nodes);\n\n return nodes;\n}\n\n/** Compute last block ending for leading text */\nfunction handleLeadingText(\n acc: (Content & { end: number })[],\n node: Text,\n ref: RegExpExecArray\n): Content[] {\n const lastEnd = acc.at(-1)?.end ?? 0;\n const leadingText = node.value.substring(lastEnd, ref.index);\n\n if (leadingText !== \"\") {\n acc.push({\n type: \"text\",\n value: leadingText,\n end: ref.index,\n } as Content & { end: number });\n }\n\n return acc;\n}\n\n/** Compute last block ending for trailing text */\nfunction handleTrailingText(\n node: Text,\n refs: RegExpExecArray[],\n nodes: Content[]\n): void {\n const lastEnd = refs.at(-1)?.index ?? 0;\n const trailingText = node.value.substring(\n lastEnd + (refs.at(-1)?.[0].length ?? 0)\n );\n\n if (trailingText !== \"\") {\n nodes.push({\n type: \"text\",\n value: trailingText,\n end: node.value.length,\n } as Content & { end: number });\n }\n}\n","import { Content, Parent, Text } from \"mdast\";\nimport { Node } from \"unist\";\nimport { CONTINUE, visit } from \"unist-util-visit\";\n\nexport const EMBEDDED_PAGE_NAME = \"embedded-page-reference\";\nconst EMBEDDED_PAGE_REGEX = /\\[(Page-(\\d+\\.\\d+))\\]/g;\n\nexport default function embeddedPageReferencePlugin(tree: Node) {\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n const refs = Array.from(node.value.matchAll(EMBEDDED_PAGE_REGEX));\n\n if (refs.length === 0) return CONTINUE;\n\n const nodes = getContentNodes(node, refs);\n\n if (nodes.length === 0) return CONTINUE;\n\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length;\n });\n\n return tree;\n}\n\n/** Transform node text content into a set of node */ \nfunction getContentNodes(node: Text, refs: RegExpExecArray[]): Content[] {\n let nodes = refs.reduce((acc, ref) => {\n handleLeadingText(acc, node, ref);\n\n acc.push({\n type: EMBEDDED_PAGE_NAME,\n value: ref[2],\n boundingBox: ref[3],\n end: ref.index + ref[0].length,\n } as any as Content & { end: number });\n\n return acc;\n }, [] as (Content & { end: number })[]) as Content[];\n\n handleTrailingText(node, refs, nodes);\n\n return nodes;\n}\n\n/** Compute last block ending for leading text */\nfunction handleLeadingText(\n acc: (Content & { end: number })[],\n node: Text,\n ref: RegExpExecArray\n): Content[] {\n const lastEnd = acc.at(-1)?.end ?? 0;\n const leadingText = node.value.substring(lastEnd, ref.index);\n\n if (leadingText !== \"\") {\n acc.push({\n type: \"text\",\n value: leadingText,\n end: ref.index,\n } as Content & { end: number });\n }\n\n return acc;\n}\n\n/** Compute last block ending for trailing text */\nfunction handleTrailingText(\n node: Text,\n refs: RegExpExecArray[],\n nodes: Content[]\n): void {\n const lastEnd = refs.at(-1)?.index ?? 0;\n const trailingText = node.value.substring(\n lastEnd + (refs.at(-1)?.[0].length ?? 0)\n );\n\n if (trailingText !== \"\") {\n nodes.push({\n type: \"text\",\n value: trailingText,\n end: node.value.length,\n } as Content & { end: number });\n }\n}\n","import { Injectable } from \"@angular/core\";\r\n\r\nexport type NotificationType = \"success\" | \"warning\" | \"error\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class NotificationsService {\r\n success(message: string, title?: string) {\r\n this.dispatchEvent(\"success\", message, title);\r\n }\r\n\r\n warning(message: string, title?: string) {\r\n this.dispatchEvent(\"warning\", message, title);\r\n }\r\n\r\n error(message: string, title?: string) {\r\n this.dispatchEvent(\"error\", message, title);\r\n }\r\n\r\n private dispatchEvent(type: NotificationType, message: string, title?: string) {\r\n dispatchEvent(new CustomEvent(\"notification\", { detail: { type, title, message } }));\r\n }\r\n}\r\n","import { Clipboard } from \"@angular/cdk/clipboard\";\nimport { inject, Injectable } from \"@angular/core\";\nimport { TranslocoService } from \"@jsverse/transloco\";\n\nimport { NotificationsService } from \"./notification.service\";\n\n@Injectable({\n providedIn: \"root\",\n})\nexport class UIService {\n notificationsService = inject(NotificationsService);\n clipboard: Clipboard = inject(Clipboard);\n private readonly transloco = inject(TranslocoService);\n\n copyToClipboard(data: string, maxLength = 30) {\n if (!navigator?.clipboard) {\n // Note: CDK seems to struggle with large chunks of text\n this.copyToClipboardCdk(data, maxLength);\n } else {\n // Navigator built-in clipboard management\n navigator.clipboard.writeText(data).then(\n () => {\n this.notifySuccess(data, maxLength);\n },\n (err) => {\n this.notificationsService.warning(\n this.transloco.translate(\"chat.clipboard.fail\")\n );\n }\n );\n }\n }\n\n copyToClipboardCdk(data: string, maxLength = 30) {\n const pending = this.clipboard.beginCopy(data);\n let remainingAttempts = 3;\n const attempt = () => {\n const result = pending.copy();\n if (!result && --remainingAttempts) {\n setTimeout(attempt);\n } else {\n // Remember to destroy when you're done!\n pending.destroy();\n if (result) this.notifySuccess(data, maxLength);\n else\n this.notificationsService.warning(\n this.transloco.translate(\"chat.clipboard.fail\")\n );\n }\n };\n attempt();\n }\n\n notifySuccess(message: string, maxLength = 30) {\n const value =\n message.length > maxLength\n ? message.slice(0, maxLength) + \"...\"\n : message;\n const translated =\n this.transloco.translate(\"chat.clipboard.success\", { value });\n this.notificationsService.success(translated);\n }\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\nimport { Content, Parent, Text } from \"mdast\";\nimport { RemarkModule } from \"ngx-remark\";\nimport \"prismjs-components-importer/esm\";\nimport \"prismjs/plugins/autoloader/prism-autoloader\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkParse from \"remark-parse\";\nimport { Processor, unified } from \"unified\";\nimport { Node } from \"unist\";\nimport { CONTINUE, EXIT, visit } from \"unist-util-visit\";\n\nimport { ChartComponent } from \"../charts/chart/chart.component\";\nimport { ChatReferenceComponent } from \"../chat-reference/chat-reference.component\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { MessageContentPipe } from \"../pipes/message-content.pipe\";\nimport { InlineImageReferenceComponent } from \"../references/inline-image-reference\";\nimport { InlinePageReferenceComponent } from \"../references/inline-page-reference\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { UIService } from \"../services/ui.service\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { ChatContextAttachment, ChatMessage, SuggestedAction } from \"../types\";\nimport { TextMessageContent } from \"../types/message-content.types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\nimport embeddedImageReferencePlugin from \"../unified-plugins/embedded-image-reference.plugin\";\nimport embeddedPageReferencePlugin from \"../unified-plugins/embedded-page-reference.plugin\";\n\ndeclare module Prism {\n function highlightAllUnder(el: HTMLElement): void;\n}\n\n@Component({\n selector: \"sq-chat-message\",\n templateUrl: \"./chat-message.component.html\",\n styleUrls: [\"./chat-message.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n TooltipDirective,\n RemarkModule,\n InitialsAvatarComponent,\n ChatReferenceComponent,\n ChartComponent,\n MessageContentPipe,\n InlineImageReferenceComponent,\n InlinePageReferenceComponent,\n TranslocoPipe\n ],\n providers: [provideTranslocoScope('chat-message')],\n})\nexport class ChatMessageComponent implements OnChanges, AfterViewInit {\n @Input() message: ChatMessage;\n @Input() conversation: ChatMessage[];\n @Input() suggestedActions: SuggestedAction[] | undefined;\n @Input() assistantMessageIcon: string;\n @Input() userMessageIcon: string;\n @Input() connectionErrorMessageIcon: string;\n @Input() searchWarningMessageIcon: string;\n @Input() streaming: boolean;\n @Input() canEdit: boolean = false;\n @Input() canRegenerate: boolean = false;\n @Input() canCopy: boolean = false;\n @Input() canDebug: boolean = false;\n @Input() canLike: boolean = false;\n @Input() canDislike: boolean = false;\n @Output() openDocument = new EventEmitter<{\n reference: ChatContextAttachment;\n partId?: number;\n }>();\n @Output() openPreview = new EventEmitter<{\n reference: ChatContextAttachment;\n partId?: number;\n }>();\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n @Output() edit = new EventEmitter<ChatMessage>();\n @Output() copy = new EventEmitter<ChatMessage>();\n @Output() regenerate = new EventEmitter<ChatMessage>();\n @Output() like = new EventEmitter();\n @Output() dislike = new EventEmitter();\n @Output() debug = new EventEmitter<ChatMessage>();\n\n processor: Processor;\n\n references: string[] = [];\n referenceMap = new Map<string, ChatContextAttachment>();\n imageReferencesMap = new Map<string, MessageImageReference>();\n pageReferencesMap = new Map<string, MessageImageReference>();\n showReferences: boolean = true;\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n constructor(\n public ui: UIService,\n public principalService: PrincipalService,\n public cdr: ChangeDetectorRef,\n public el: ElementRef\n ) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.streaming) {\n this.collapseProgress = !this.streaming;\n }\n\n if (this.message?.role === \"assistant\") {\n this.references = [];\n this.referenceMap.clear();\n for (let m of this.conversation) {\n if (\n m.additionalProperties.$attachment &&\n m.additionalProperties.$attachment.length > 0\n ) {\n for (const attachment of m.additionalProperties.$attachment) {\n // skip empty attachment\n if (!attachment) continue;\n\n this.referenceMap.set(\"\" + attachment.contextId, {\n ...attachment,\n $partId: attachment.parts?.[0]?.partId,\n });\n if (!!attachment.parts && attachment.parts.length > 0) {\n for (let i = 0; i < attachment.parts.length; i++) {\n const refId = `${attachment.contextId}.${attachment.parts[i].partId}`;\n this.referenceMap.set(refId, {\n ...attachment,\n $partId: attachment.parts?.[i]?.partId,\n });\n }\n }\n }\n }\n\n this.processMessageType(m);\n }\n\n this.processor = unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(() => this.referencePlugin)\n .use(() => embeddedImageReferencePlugin)\n .use(() => embeddedPageReferencePlugin);\n\n if (this.streaming) {\n this.processor = this.processor.use(() => this.placeholderPlugin);\n }\n }\n }\n\n ngAfterViewInit(): void {\n Prism?.highlightAllUnder?.(this.el.nativeElement);\n }\n\n getEmbeddedImageReference(ref: string): MessageImageReference | undefined {\n const [doc, part, image] = ref.split(\".\");\n const images = this.referenceMap.get(doc)?.parts?.[+part - 1]?.images;\n\n if (!images || images.length === 0 || typeof images[0] !== \"object\")\n return undefined;\n\n const messageImageReference: MessageImageReference = Object.assign(\n {\n article: this.referenceMap.get(doc)?.record,\n articleId: this.referenceMap.get(doc)?.recordId,\n },\n images[+image - 1]\n );\n\n // save reference in map for reference list\n if (!this.imageReferencesMap.has(ref))\n this.imageReferencesMap.set(ref, messageImageReference);\n\n return messageImageReference;\n }\n\n getEmbeddedPageReference(ref: string): MessageImageReference | undefined {\n const [doc, page] = ref.split(\".\");\n const pageRef = this.referenceMap.get(doc)?.pages?.find(x => x.pageNumber === +page);\n \n if (!pageRef || typeof pageRef !== \"object\") return undefined;\n\n const messagePageReference: MessageImageReference = Object.assign(\n {\n article: this.referenceMap.get(doc)?.record,\n articleId: this.referenceMap.get(doc)?.recordId,\n },\n pageRef\n );\n\n // save reference in map for reference list\n if (!this.pageReferencesMap.has(ref))\n this.pageReferencesMap.set(ref, messagePageReference);\n\n return messagePageReference;\n }\n\n get name(): string {\n return !this.principalService.principal\n ? \"\"\n : (this.principalService.principal[\"fullName\"] as string) ||\n this.principalService.principal.name;\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n processMessageType(message: ChatMessage) {\n // Process message type when spec is done\n // nop for new message types\n if (typeof message.content !== \"string\") return;\n\n // Legacy message type\n if (message.content.startsWith(\"<chartjs>\")) {\n message.messageType = \"CHART\";\n } else {\n message.messageType = \"MARKDOWN\";\n }\n }\n\n /**\n * This Unified plugin looks a text nodes and replaces any reference in the\n * form [1], [2.3], etc. with custom nodes of type \"chat-reference\".\n */\n referencePlugin = (tree: Node) => {\n const references = new Set<number>();\n\n // Visit all text nodes\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n let text = node.value;\n\n text = this.reformatReferences(text);\n const matches = this.getReferenceMatches(text);\n\n // Quit if no references were found\n if (matches.length === 0) {\n return CONTINUE;\n }\n\n const nodes: (Content & { end: number })[] = [];\n\n for (const match of matches) {\n const refId = match[1].trim();\n const [ref] = refId.split(\".\");\n // We find a valid reference in the text\n if (!isNaN(+ref)) {\n references.add(+ref); // Add it to the set of used references\n\n // If needed, insert a text node before the reference\n const current = nodes.at(-1) ?? { end: 0 };\n if (match.index! > current.end) {\n nodes.push({\n type: \"text\",\n value: text.substring(current.end, match.index!),\n end: match.index!,\n });\n }\n\n // Add a custom reference node\n nodes.push({\n type: \"chat-reference\",\n refId,\n end: match.index! + match[0].length,\n } as any);\n }\n }\n\n // Quit if no references were found\n if (nodes.length === 0) {\n return CONTINUE;\n }\n\n if (nodes.at(-1)!.end < text.length) {\n nodes.push({\n type: \"text\",\n value: text.substring(nodes.at(-1)!.end, text.length),\n end: text.length,\n });\n }\n\n // Delete the current text node from the parent and replace it with the new nodes\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length; // Visit the next node after the inserted ones\n });\n\n if (references.size > 0) {\n this.references = Array.from(references.values())\n .sort((a, b) => a - b)\n .map((r) => \"\" + r);\n this.cdr.detectChanges();\n }\n\n return tree;\n };\n\n placeholderPlugin = (tree: Node) => {\n visit(\n tree,\n \"text\",\n (node: Text, index: number, parent: Parent) => {\n parent.children.push({ type: \"streaming-placeholder\" } as any);\n return EXIT;\n },\n true\n );\n\n return tree;\n };\n\n getLinkText(node: any): string {\n if (node.text) {\n return node.text; // Return directly if text is provided in node.text ([Example link](https://example.com))\n } else if (node.children && node.children.length > 0) {\n // Recursively search for text content in child nodes\n for (const child of node.children) {\n if (child.type === \"text\" && child.value) {\n return child.value; // Return the value of the first text node found ([**Emphasized Link Text**](https://example.com))\n } else if (child.children && child.children.length > 0) {\n const textContent = this.getLinkText(child); // Recursively search child nodes ([](https://example.com))\n if (textContent) {\n return textContent; // Return text content if found\n }\n }\n }\n }\n return \"link\"; // Return empty string if no text content is found\n }\n\n /**\n * Reformat [ids: 12.2, 42.5] to [12.2][42.5]\n */\n reformatReferences(content: string) {\n return content.replace(\n /\\[(?:ids?:?\\s*)?(?:documents?:?\\s*)?(\\s*(?:,?\\s*\\d+(?:\\.\\d+)?(?:\\.part)?\\s*)+)\\]/g,\n (str, match: string) =>\n `[${match\n .replace(/\\.part/g, \"\")\n .split(\",\")\n .join(\"] [\")}]`\n );\n }\n\n /**\n * Match all references in a given message\n */\n getReferenceMatches(content: string) {\n return Array.from(content.matchAll(/\\[(\\s*\\d+(?:\\.\\d+)?\\s*)\\]/g));\n }\n\n private _copyToClipboard(content: string) {\n this.ui.copyToClipboard(content);\n }\n\n copyMessage(message: ChatMessage) {\n let content: string = \"\";\n\n if (typeof message.content === \"string\")\n content = message.content;\n else if (Array.isArray(message.content))\n content = (message.content[0] as TextMessageContent).text;\n else {\n console.error(\"Unsupported message content type\", typeof message.content);\n return;\n }\n \n content = content.replaceAll(/\\s+\\[.+?\\]/g, \"\");\n\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n copyCode(code: string) {\n this._copyToClipboard(code);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment, partId?: number) {\n this.openPreview.emit({ reference: attachment, partId });\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment, partId?: number) {\n this.openDocument.emit({ reference: attachment, partId });\n this.hideTooltip();\n }\n\n hideTooltip(): void {\n this.hiddenTooltip = true;\n setTimeout(() => {\n this.hiddenTooltip = false;\n });\n }\n}\n","<!-- Message icon -->\n<span class=\"message-icon\" [title]=\"message?.role\">\n <i class=\"d-block\" [style.width.px]=\"iconSize\" *ngIf=\"!message\"></i>\n <ng-container [ngSwitch]=\"message?.role\">\n <!-- For 'assistant' -->\n <i *ngSwitchCase=\"'assistant'\" [ngClass]=\"assistantMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n\n <!-- For 'user' -->\n <ng-container *ngSwitchCase=\"'user'\">\n <i *ngIf=\"!!userMessageIcon; else initialsAvatar\" [ngClass]=\"userMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #initialsAvatar>\n <sq-initials-avatar [fullName]=\"name\"></sq-initials-avatar>\n </ng-template>\n </ng-container>\n\n <!-- For 'connection-error' -->\n <ng-container *ngSwitchCase=\"'connection-error'\">\n <i *ngIf=\"!!connectionErrorMessageIcon; else defaultErrorIcon\" [ngClass]=\"connectionErrorMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #defaultErrorIcon>\n <svg [style.--sq-size.px]=\"iconSize\" class=\"connection-error\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\">\n <path fill=\"currentColor\" d=\"M17.1 292c-12.9-22.3-12.9-49.7 0-72L105.4 67.1c12.9-22.3 36.6-36 62.4-36l176.6 0c25.7 0 49.5 13.7 62.4 36L494.9 220c12.9 22.3 12.9 49.7 0 72L406.6 444.9c-12.9 22.3-36.6 36-62.4 36l-176.6 0c-25.7 0-49.5-13.7-62.4-36L17.1 292zM256 128c-13.3 0-24 10.7-24 24l0 112c0 13.3 10.7 24 24 24s24-10.7 24-24l0-112c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z\"/>\n </svg>\n </ng-template>\n </ng-container>\n\n <!-- For 'search-warning' -->\n <ng-container *ngSwitchCase=\"'search-warning'\">\n <i *ngIf=\"!!searchWarningMessageIcon; else defaultWarningIcon\" [ngClass]=\"searchWarningMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <ng-template #defaultWarningIcon>\n <svg [style.--sq-size.px]=\"iconSize\" class=\"search-warning\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\">\n <path fill=\"currentColor\" d=\"M272 384c9.6-31.9 29.5-59.1 49.2-86.2c0 0 0 0 0 0c5.2-7.1 10.4-14.2 15.4-21.4c19.8-28.5 31.4-63 31.4-100.3C368 78.8 289.2 0 192 0S16 78.8 16 176c0 37.3 11.6 71.9 31.4 100.3c5 7.2 10.2 14.3 15.4 21.4c0 0 0 0 0 0c19.8 27.1 39.7 54.4 49.2 86.2l160 0zM192 512c44.2 0 80-35.8 80-80l0-16-160 0 0 16c0 44.2 35.8 80 80 80zm0-448c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM160 288a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z\"/>\n </svg>\n </ng-template>\n </ng-container>\n </ng-container>\n</span>\n\n<!-- Message body -->\n<div class=\"flex-grow-1 position-relative relative\" style=\"min-width: 0;\" [ngClass]=\"'message-'+message.role\">\n\n <!-- Progress steps -->\n <div *ngIf=\"message.additionalProperties.$progress as progress\" class=\"small ms-3 mb-2\">\n <details role=\"button\" class=\"select-none\" [open]=\"!collapseProgress\">\n <summary class=\"text-muted\">\n {{ 'chatMessage.viewProgress' | transloco }}\n </summary>\n <ul class=\"list-unstyled\">\n <li *ngFor=\"let step of progress\">\n <i class=\"fas fa-fw fa-check text-success\" *ngIf=\"step.done\"></i>\n <i class=\"fas fa-spinner fa-pulse step-ongoing\" *ngIf=\"!step.done && streaming\"></i>\n <i class=\"fa-solid fa-ban step-error\" *ngIf=\"!step.done && !streaming\"></i>\n <span class=\"ms-2 fw-bold\">{{step.title}}</span>\n <span *ngIf=\"step.content\" [innerHTML]=\"': ' + step.content\"></span>\n </li>\n </ul>\n </details>\n </div>\n\n <!-- Message content -->\n <div class=\"message-content\" *ngIf=\"message.content\">\n\n <!-- Custom rendering for WPS, to be remove with https://sinequa.atlassian.net/browse/ES-23710 -->\n <div *ngIf=\"message?.role === 'assistant' && message.messageType === 'CHART'\">\n <sq-assistant-chart [rawChartData]=\"message.content\"></sq-assistant-chart>\n </div>\n\n <!-- This section is responsible for customizing the template nodes used in the application.\n Template nodes are predefined structures that serve as blueprints for creating/customizing dynamic content -->\n <remark *ngIf=\"(message?.role === 'assistant' && message.messageType !== 'CHART') || message?.role === 'connection-error' || message?.role === 'search-warning'\" [markdown]=\"message.content | messageContent\" [processor]=\"processor\">\n\n <!-- Chat reference (badge with file and part number) -->\n <ng-template remarkTemplate=\"chat-reference\" let-ref>\n @let attachment = referenceMap.get(ref.refId);\n @if (attachment) {\n <a\n class=\"reference\"\n role=\"button\"\n [sqTooltip]=\"attachment\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n (click)=\"openAttachmentPreview(attachment, ref.refId)\"\n >\n {{ref.refId}}\n </a>\n }\n @else {\n <ng-template #staticRefTpl>\n <span class=\"reference\">{{ ref.refId }}</span>\n </ng-template>\n }\n </ng-template>\n\n <!-- Embedded reference image -->\n <ng-template remarkTemplate=\"embedded-image-reference\" let-ref>\n @let refObj = getEmbeddedImageReference(ref.value);\n @if (refObj && refObj.url) {\n <span\n [ngClass]=\"{ 'reference': true, 'has-bounding-box': ref.boundingBox }\"\n [sqTooltip]=\"{ obj: refObj, id: ref.value }\"\n [sqTooltipTemplate]=\"imageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Img-{{ ref.value }}\n </span>\n }\n </ng-template>\n\n <!-- Embedded reference page -->\n <ng-template remarkTemplate=\"embedded-page-reference\" let-ref>\n @let refObj = getEmbeddedPageReference(ref.value);\n @if (refObj && refObj.url) {\n <span\n [ngClass]=\"{ 'reference': true, 'has-bounding-box': ref.boundingBox }\"\n [sqTooltip]=\"{ obj: refObj, id: ref.value }\"\n [sqTooltipTemplate]=\"pageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Page-{{ ref.value }}\n </span>\n }\n </ng-template>\n\n <!-- Blinking cursor -->\n <ng-template remarkTemplate=\"streaming-placeholder\">\n <span class=\"placeholder-glow\" *ngIf=\"streaming\">\n <span class=\"placeholder ms-1\"></span>\n </span>\n </ng-template>\n\n <ng-template remarkTemplate=\"code\" let-node>\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-between align-items-center\">\n <span>{{node.lang}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"copyCode(node.value)\"><i class=\"far fa-fw fa-clipboard\"></i> {{ 'chatMessage.copyCode' | transloco }}</button>\n </div>\n <pre class=\"language-{{node.lang}} my-0 rounded-0 rounded-bottom\"><code class=\"language-{{node.lang}}\">{{node.value}}</code></pre>\n </div>\n </ng-template>\n\n <ng-template remarkTemplate=\"link\" let-node>\n <a [href]=\"node.url\" target=\"_blank\" rel=\"noopener noreferrer\">{{getLinkText(node)}}</a>\n </ng-template>\n\n </remark>\n\n <p *ngIf=\"message?.role === 'user'\">{{ message.content | messageContent }}</p>\n\n <!-- List of reference, if any -->\n @if (references?.length > 0 || imageReferencesMap?.size > 0 || pageReferencesMap?.size > 0) {\n <div class=\"references\">\n <details role=\"button\" class=\"select-none\" [open]=\"!showReferences\">\n <summary class=\"references-title\">{{ 'chatMessage.references' | transloco }}</summary>\n <ul>\n @for (reference of references; track $index) {\n <li *ngIf=\"referenceMap.get(reference) as attachment\" class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n }\n @for (imageReference of imageReferencesMap.entries(); track $index) {\n <li style=\"list-style-type: none;\">\n <InlineImageReference\n [id]=\"imageReference[0]\"\n [ref]=\"imageReference[1]\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </li>\n }\n @for (pageReference of pageReferencesMap.entries(); track $index) {\n <li style=\"list-style-type: none;\">\n <InlinePageReference\n [id]=\"pageReference[0]\"\n [ref]=\"pageReference[1]\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </li>\n }\n </ul>\n </details>\n </div>\n }\n </div>\n\n <!-- Edit / Regenerate floating actions -->\n <div class=\"sq-chat-message-actions\" *ngIf=\"message\">\n <!-- Common action buttons for \"user\" & \"assistant\" message -->\n <button class=\"btn btn-sm\" *ngIf=\"canCopy\" [sqTooltip]=\"'chatMessage.copyText' | transloco\" (click)=\"copyMessage(message)\">\n <i class=\"far fa-clipboard\"></i>\n </button>\n <!-- Action buttons for \"user\" message -->\n <button class=\"btn btn-sm\" *ngIf=\"canEdit\" [sqTooltip]=\"'chatMessage.editMessage' | transloco\" (click)=\"edit.emit(message)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <!-- Action buttons for \"assistant\" message -->\n <button class=\"btn btn-sm\" [class.bounce]=\"message.additionalProperties.$liked\" *ngIf=\"canLike\" [sqTooltip]=\"'chatMessage.likeAnswer' | transloco\" (click)=\"like.emit()\">\n <i *ngIf=\"!message.additionalProperties.$liked\" class=\"far fa-thumbs-up \"></i>\n <i *ngIf=\"message.additionalProperties.$liked\" class=\"fas fa-thumbs-up\"></i>\n </button>\n <button class=\"btn btn-sm\" [class.bounce]=\"message.additionalProperties.$disliked\" *ngIf=\"canDislike\" [sqTooltip]=\"'chatMessage.reportIssue' | transloco\" (click)=\"dislike.emit()\">\n <i *ngIf=\"!message.additionalProperties.$disliked\" class=\"far fa-thumbs-down \"></i>\n <i *ngIf=\"message.additionalProperties.$disliked\" class=\"fas fa-thumbs-down\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canRegenerate\" [sqTooltip]=\"'chatMessage.regenerateResponse' | transloco\" (click)=\"regenerate.emit(message)\">\n <i class=\"fas fa-sync-alt\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canDebug\" [sqTooltip]=\"'chatMessage.showLogInformation' | transloco\" (click)=\"debug.emit(message);\">\n <i class=\"far fa-list-alt\"></i>\n </button>\n </div>\n\n <!-- List of suggested actions, if any -->\n <div *ngIf=\"suggestedActions\" class=\"mt-2 message-suggestion\">\n <div class=\"suggested-action\" *ngFor=\"let suggestedAction of suggestedActions\" (click)=\"suggestAction.emit(suggestedAction)\">\n <div class=\"message-icon\" [style.width.px]=\"iconSize\"></div>\n <div class=\"message-content\">\n <p><i class=\"fas fa-clipboard-question\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n <ng-template #imageTooltipTpl let-ref>\n <InlineImageReference\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </ng-template>\n\n <ng-template #pageTooltipTpl let-ref>\n <InlinePageReference\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event, $event.$partId)\"\n (openModal)=\"hideTooltip()\"\n />\n </ng-template>\n\n <ng-template #tooltipTpl let-ref>\n <sq-chat-reference\n *ngIf=\"!hiddenTooltip\"\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"openAttachmentPreview($event, ref.$partId)\"\n (openDocument)=\"openOriginalAttachment($event, ref.$partId)\">\n </sq-chat-reference>\n </ng-template>\n\n</div>\n","import { Injectable } from \"@angular/core\";\r\nimport { from } from \"rxjs\";\r\nimport { patchUserSettings } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class UserSettingsWebService {\r\n userSettings = {};\r\n\r\n patch(data: any) {\r\n this.userSettings = { ...this.userSettings, ...data };\r\n return from(patchUserSettings(data));\r\n }\r\n}","import { Injectable, LOCALE_ID, inject } from \"@angular/core\";\nimport { TranslocoService } from \"@jsverse/transloco\";\nimport {\n differenceInDays,\n differenceInMonths,\n differenceInYears,\n endOfYesterday,\n format,\n isThisMonth,\n isThisQuarter,\n isThisWeek,\n isThisYear,\n isToday,\n isYesterday,\n parseISO,\n toDate\n} from \"date-fns\";\nimport { ChatMessage } from \"../types\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssistantUtils {\n\n readonly localID = inject(LOCALE_ID, {optional: true});\n protected readonly transloco = inject(TranslocoService);\n\n /**\n * Retrieves the rank (1-based index) of a message within a chat history array based on its message ID.\n * If the message is not found, returns -1.\n *\n * @param array - An array of `ChatMessage` objects or `undefined`. Represents the chat history.\n * @param messageId - The unique identifier of the message to locate.\n * @returns The 1-based index of the message in the array, or -1 if the message is not found.\n */\n getMessageRankInChatHistory(array: ChatMessage[]| undefined, messageId: string): number {\n const index = array?.findIndex(m => m.additionalProperties.messageId === messageId) ?? -1;\n return index === -1 ? -1 : index + 1;\n }\n\n /**\n * Traverse the array from the end and track the first 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the first visible assistant message among the last group of \"assistant\" messages in the array\n */\n firstVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let firstVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n firstVisibleAssistantMessageIndex = index;\n }\n index--;\n }\n return firstVisibleAssistantMessageIndex;\n }\n\n /**\n * Traverse the array from the end and pick the last 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the last visible assistant message among the last group of \"assistant\" messages in the array\n */\n lastVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let lastVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n lastVisibleAssistantMessageIndex = index;\n break;\n }\n index--;\n }\n return lastVisibleAssistantMessageIndex;\n }\n\n /**\n * Format a date string in UTC to a local date string\n * @param value Date string in UTC to format\n * @returns A formatted local date string\n */\n formatDateTime(value: string): string {\n const localDate = toDate(parseISO(value));\n const formatter = new Intl.DateTimeFormat(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n timeZoneName: 'short'\n });\n return formatter.format(localDate);\n }\n\n /**\n * Takes a text prompt that may contain placeholders for variables\n * and replaces these placeholders if it finds a match in the given\n * context object.\n *\n * @example\n * const p = \"Hello, [[user.name]]! You have [[user.notifications.length]] new notifications.\";\n * const context = {\n * user: {\n * name: \"Alice\",\n * notifications: [\"Message from Bob\", \"Reminder for meeting\"]\n * }\n * };\n * const formattedPrompt = formatPrompt(p, context);\n * console.log(formattedPrompt); // Output: \"Hello, Alice! You have 2 new notifications.\"\n */\n static formatPrompt(prompt: string, context: any): string {\n return prompt.replace(\n /\\[\\[(.*?)\\]\\]/g,\n (match, expr) => {\n // Simple dot notation resolver\n const keys = expr.trim().split(\".\");\n let value = context;\n for (const key of keys) {\n if (value && typeof value === \"object\" && key in value) {\n value = value[key];\n } else {\n return match;\n }\n }\n return value ?? match;\n }\n );\n }\n\n /**\n * Determines a time-based key for a given date to be used for translations or formatting.\n * The key represents a relative time period such as \"today\", \"yesterday\", \"this week\", etc.\n * If the date does not fall into any predefined relative time period, it returns the year as a string.\n *\n * @param date - The date for which the time key is to be determined.\n * @returns A string representing the time key, which can be used for translation or display purposes.\n */\n getTimeKey(date: Date): string {\n if (isToday(date)) {\n return this.transloco.translate('chat.today');\n } else if (isYesterday(date)) {\n return this.transloco.translate('chat.yesterday');\n } else if (isThisWeek(date)) {\n return this.transloco.translate('chat.thisWeek');\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return this.transloco.translate('chat.lastWeek');\n } else if (isThisMonth(date)) {\n return this.transloco.translate('chat.thisMonth');\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return this.transloco.translate('chat.lastMonth');\n } else if (isThisQuarter(date)) {\n return this.transloco.translate('chat.thisQuarter');\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return this.transloco.translate('chat.lastQuarter');\n } else if (isThisYear(date)) {\n return this.transloco.translate('chat.thisYear');\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return this.transloco.translate('chat.lastYear');\n } else {\n return format(date, 'yyyy');\n }\n }\n\n /**\n * Get the current locale name.\n * @returns The current locale name or an empty string if not available.\n */\n getCurrentLocaleName(): string {\n return this.localID || '';\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, from, throwError } from 'rxjs';\nimport { tap, catchError, map } from 'rxjs/operators';\nimport { get, post } from '@sinequa/atomic';\n\nimport {\n ChatMessage,\n SavedChat,\n SavedChatHistory,\n SavedChatResponse,\n DeleteSavedChatResponse\n} from '../types';\n\nexport interface SavedChatsOperationConfig {\n getAppName: () => string;\n getInstanceId: () => string;\n getRestUrl: () => string;\n getDebugFlag: () => boolean;\n isSavedChatsEnabled: () => boolean;\n\n setSavedChatsErrorStatus: (hasError: boolean) => void;\n updateSavedChatsList: (chats: SavedChat[]) => void;\n generateAuditEvent: (type: string, details: Record<string, any>, id?: string) => Promise<void>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SavedChatsService {\n private operationConfig: SavedChatsOperationConfig | undefined;\n\n constructor() {}\n\n public init(config: SavedChatsOperationConfig): void {\n if (this.operationConfig) {\n console.warn('SavedChatsService already initialized.');\n return;\n }\n this.operationConfig = config;\n }\n\n private ensureInitialized(): void {\n if (!this.operationConfig) {\n throw new Error('SavedChatsService not initialized. Call init() first.');\n }\n }\n\n public listChats(): void {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data = {\n action: \"SavedChatList\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n debug: config.getDebugFlag()\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = String(value);\n return acc;\n }, {} as Record<string, string>));\n\n from(get<{ savedChats: SavedChat[] }>(`plugin/${config.getRestUrl()}`, searchParams)).pipe(\n tap(res => {\n config.updateSavedChatsList(res.savedChats);\n config.setSavedChatsErrorStatus(false);\n }),\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatList API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n config.setSavedChatsErrorStatus(true);\n return throwError(() => error);\n })\n ).subscribe();\n }\n\n public getChatById(id: string): Observable<SavedChatHistory | undefined> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n return throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data = {\n action: \"SavedChatGet\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n chatId: id,\n debug: config.getDebugFlag()\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = String(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<{ savedChat: SavedChatHistory, executionTimeMilliseconds: number }>(`plugin/${config.getRestUrl()}`, searchParams)).pipe(\n tap(res => {\n config.generateAuditEvent('ast-saved-chat.load', { duration: res.executionTimeMilliseconds }, res.savedChat.id);\n }),\n map(res => res.savedChat),\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatGet API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n return throwError(() => error);\n })\n );\n }\n\n public addChat(id: string, messages: ChatMessage[]): Observable<SavedChatResponse> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n return throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data = {\n action: \"SavedChatAdd\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n chatId: id,\n history: messages,\n debug: config.getDebugFlag()\n };\n\n return from(post<SavedChatResponse>(`plugin/${config.getRestUrl()}`, data)).pipe(\n tap(res => {\n config.generateAuditEvent('ast-saved-chat.add', { duration: res.executionTimeMilliseconds }, res.savedChat.id);\n }),\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatAdd API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n return throwError(() => error);\n })\n );\n }\n\n public updateChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChatResponse> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n return throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data: any = {\n action: \"SavedChatUpdate\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n chatId: id,\n debug: config.getDebugFlag()\n };\n\n if (name) data[\"title\"] = name;\n if (messages) data[\"history\"] = messages;\n\n return from(post<SavedChatResponse>(`plugin/${config.getRestUrl()}`, data)).pipe(\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatUpdate API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n return throwError(() => error);\n })\n );\n }\n\n public deleteChat(ids: string[]): Observable<DeleteSavedChatResponse> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n return throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data = {\n action: \"SavedChatDelete\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n chatIds: ids,\n debug: config.getDebugFlag()\n };\n\n return from(post<DeleteSavedChatResponse>(`plugin/${config.getRestUrl()}`, data)).pipe(\n catchError((error) => {\n return throwError(() => error);\n })\n );\n }\n\n public isExistingChat(id: string): Observable<boolean> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!config.isSavedChatsEnabled()) {\n return throwError(() => new Error(\"Operations on saved chats are disabled\"));\n }\n\n const data = {\n action: \"SavedChatExist\",\n appName: config.getAppName(),\n instanceId: config.getInstanceId(),\n chatId: id,\n debug: config.getDebugFlag()\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = String(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<{ exists: boolean, executionTime: string, executionTimeMilliseconds: number }>(`plugin/${config.getRestUrl()}`, searchParams)).pipe(\n map(res => res.exists),\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatExist API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n return throwError(() => error);\n })\n );\n }\n}\n","import { Injectable, InjectionToken } from \"@angular/core\";\nimport { HubConnectionBuilder, LogLevel, HubConnection, MessageHeaders, HttpTransportType, ITransport } from '@microsoft/signalr';\nimport { globalConfig } from \"@sinequa/atomic\";\n\nexport interface ConnectionOptions {\n withCredentials?: boolean; // if true, the browser automatically includes the authentication cookie in the request headers when establishing the SignalR connection\n headers?: MessageHeaders;\n transport?: HttpTransportType | ITransport; // If transports are provided, use them; otherwise, let SignalR negotiate\n skipNegotiation?: boolean,\n accessTokenFactory?: () => string | Promise<string>;\n}\n\n/** A token that is used to inject the transports allowed to use by hub connection.\n *\n * Expects a {@link HttpTransportType} value.\n*/\nexport const SIGNAL_R_TRANSPORTS = new InjectionToken<HttpTransportType>('SIGNAL_R_TRANSPORTS');\n\n/** A token that is used to inject the log level for the hub connection.\n *\n * Expects a {@link LogLevel} value.\n*/\nexport const SIGNAL_R_LOG_LEVEL = new InjectionToken<LogLevel>('SIGNAL_R_LOG_LEVEL');\n\n/**\n * A service to connect the Sinequa server to the client via SignalR\n */\n@Injectable({\n providedIn: \"root\"\n})\nexport class SignalRWebService {\n\n /**\n * Builds a SignalR connection to the given endpoint\n * @param endpointName Name of the endpoint to connect to\n * @param options Options for the connection. It must overrides the default options\n * @param logLevel The log level for the connection\n * @param automaticReconnect Whether the connection should automatically attempt to reconnect\n * @returns A SignalR connection\n */\n buildConnection(endpointName: string, options: ConnectionOptions, logLevel = LogLevel.Information, automaticReconnect = false): HubConnection {\n const { backendUrl} = globalConfig;\n const url = `${backendUrl}/endpoints/v1/${endpointName}`;\n\n const connectionBuilder = new HubConnectionBuilder()\n .withUrl(url, options)\n .configureLogging(logLevel);\n\n if (automaticReconnect) {\n connectionBuilder.withAutomaticReconnect();\n }\n\n return connectionBuilder.build();\n }\n\n /**\n * Starts a SignalR connection.\n * @param connection A SignalR connection\n */\n async startConnection(connection: HubConnection | undefined): Promise<void> {\n if (!connection) {\n throw new Error(\"Please provide a valid connection to start\");\n }\n try {\n await connection.start();\n console.log(`The SignalR connection has been successfully established! \\n url: ${connection.baseUrl} \\n connectionId: ${connection.connectionId}`);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Stops a SignalR connection.\n * @param connection A SignalR connection\n */\n async stopConnection(connection: HubConnection | undefined): Promise<void> {\n if (!connection) {\n throw new Error(\"Please provide a valid connection to stop\");\n }\n try {\n await connection.stop();\n console.log(`The SignalR connection has been successfully stopped! \\n url: ${connection.baseUrl} \\n connectionId: ${connection.connectionId}`);\n } catch (error) {\n throw error;\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HubConnection, HttpTransportType, LogLevel, MessageHeaders } from '@microsoft/signalr';\nimport { getToken } from '@sinequa/atomic';\nimport { AssistantUtils } from '../utils/utils.service';\nimport { SignalRWebService, ConnectionOptions } from './signalR.web.service';\nimport { ChatConfig } from '../types';\n\nexport interface SignalRConnectionOperationConfig {\n getWsRequestUrl: () => string;\n getAssistantConfigValue: () => ChatConfig | undefined;\n getHubConnection: () => HubConnection | undefined;\n setHubConnection: (connection: HubConnection | undefined) => void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SignalRConnectionService {\n private operationConfig: SignalRConnectionOperationConfig | undefined;\n private signalRWebService = inject(SignalRWebService);\n private assistantUtils = inject(AssistantUtils);\n\n public init(config: SignalRConnectionOperationConfig): void {\n if (this.operationConfig) {\n console.warn('SignalRConnectionService already initialized.');\n return;\n }\n this.operationConfig = config;\n }\n\n private ensureInitialized(): void {\n if (!this.operationConfig) {\n throw new Error('SignalRConnectionService not initialized. Call init() first.');\n }\n }\n\n private _getLogLevel(): LogLevel {\n this.ensureInitialized();\n const assistantConfig = this.operationConfig!.getAssistantConfigValue();\n switch (assistantConfig?.connectionSettings.signalRLogLevel) {\n case \"Critical\": return LogLevel.Critical;\n case \"Debug\": return LogLevel.Debug;\n case \"Error\": return LogLevel.Error;\n case \"Information\": return LogLevel.Information;\n case \"None\": return LogLevel.None;\n case \"Trace\": return LogLevel.Trace;\n case \"Warning\": return LogLevel.Warning;\n default: return LogLevel.None;\n }\n }\n\n private _getTransports(): HttpTransportType {\n this.ensureInitialized();\n const assistantConfig = this.operationConfig!.getAssistantConfigValue();\n switch (assistantConfig?.connectionSettings.signalRTransport) {\n case \"WebSockets\": return HttpTransportType.WebSockets;\n case \"ServerSentEvents\": return HttpTransportType.ServerSentEvents;\n case \"LongPolling\": return HttpTransportType.LongPolling;\n default: return HttpTransportType.None;\n }\n }\n\n private getDefaultOptions(): ConnectionOptions {\n this.ensureInitialized();\n let headers: MessageHeaders = {\n \"sinequa-force-camel-case\": \"true\",\n \"x-language\": this.assistantUtils.getCurrentLocaleName(),\n \"ui-language\": this.assistantUtils.getCurrentLocaleName(),\n };\n const token = getToken();\n if (token) {\n headers = { ...headers, \"sinequa-csrf-token\": token };\n }\n\n return {\n transport: this._getTransports(),\n withCredentials: true,\n headers,\n skipNegotiation: false,\n accessTokenFactory: () => token || \"\"\n };\n }\n\n public buildConnection(options?: ConnectionOptions): Promise<void> {\n this.ensureInitialized();\n return new Promise<void>((resolve, reject) => {\n const wsRequestUrl = this.operationConfig!.getWsRequestUrl();\n if (!wsRequestUrl) {\n reject(new Error(\"No endpoint provided to connect the websocket to\"));\n return;\n }\n const assistantConfig = this.operationConfig!.getAssistantConfigValue();\n const logLevel = this._getLogLevel();\n const defaultOpts = this.getDefaultOptions();\n if (assistantConfig?.connectionSettings.signalRSkipNegotiation === true) {\n options = {...options, skipNegotiation: true};\n }\n const connection = this.signalRWebService.buildConnection(wsRequestUrl, { ...defaultOpts, ...options }, logLevel, true);\n\n const signalRServerTimeoutInMilliseconds = assistantConfig?.connectionSettings.signalRServerTimeoutInMilliseconds;\n if (signalRServerTimeoutInMilliseconds && connection) {\n connection.serverTimeoutInMilliseconds = signalRServerTimeoutInMilliseconds;\n }\n this.operationConfig!.setHubConnection(connection);\n resolve();\n });\n }\n\n public startConnection(): Promise<void> {\n this.ensureInitialized();\n const connection = this.operationConfig!.getHubConnection();\n return this.signalRWebService.startConnection(connection);\n }\n\n public stopConnection(): Promise<void> {\n this.ensureInitialized();\n const connection = this.operationConfig!.getHubConnection();\n return this.signalRWebService.stopConnection(connection);\n }\n}\n","import { Component, computed, ElementRef, output, viewChild } from \"@angular/core\";\r\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\r\n\r\nimport { DialogEvent } from \"../services/dialog.service\";\r\n\r\n@Component({\r\n selector: 'sq-dialog-updates',\r\n standalone: true,\r\n imports: [TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #dialog class=\"z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.availableUpdates' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.availableUpdatesText' | transloco }}</p>\r\n <div class=\"flex justify-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost outline-none w-24\" (click)=\"seeNoMore()\">{{ 'chatDialogs.seeNoMore' | transloco }}</button>\r\n <button class=\"btn btn-secondary\" (click)=\"remindMeLater()\">{{ 'chatDialogs.remindMeLater' | transloco }}</button>\r\n <button class=\"btn btn-primary w-24\" (click)=\"update()\">{{ 'chatDialogs.update' | transloco }}</button>\r\n </div>\r\n </div>\r\n </dialog>\r\n `,\r\n styles: [`\r\n .flex {\r\n display: flex;\r\n }\r\n .flex-col {\r\n flex-direction: column;\r\n }\r\n .justify-end {\r\n justify-content: end;\r\n }\r\n `]\r\n})\r\nexport class DialogUpdatesComponent {\r\n protected dialogRef = viewChild('dialog', { read: ElementRef<HTMLDialogElement> });\r\n protected dialog = computed(() => this.dialogRef()?.nativeElement as HTMLDialogElement);\r\n\r\n closed = output<DialogEvent>();\r\n\r\n open() {\r\n this.dialog().showModal();\r\n }\r\n\r\n close(eventType: DialogEvent = \"dialog-close\") {\r\n this.dialog().close();\r\n this.closed.emit(eventType);\r\n // dispatch a javascript event\r\n document.dispatchEvent(new Event(eventType));\r\n }\r\n\r\n seeNoMore() {\r\n this.close(\"dialog-no\");\r\n }\r\n\r\n remindMeLater() {\r\n this.close();\r\n }\r\n\r\n update() {\r\n this.close(\"dialog-confirm\");\r\n }\r\n}\r\n","import {\r\n ApplicationRef,\r\n ComponentRef,\r\n createComponent,\r\n Injectable,\r\n Type,\r\n} from '@angular/core';\r\n\r\n\r\nexport type DialogEvent = 'dialog-close' | 'dialog-cancel' | 'dialog-confirm' | 'dialog-no' | 'dialog-yes';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class DialogService {\r\n protected dialogRef?: ComponentRef<any>;\r\n\r\n constructor(private appRef: ApplicationRef) {}\r\n\r\n open<T>(componentType: Type<T>): Promise<DialogEvent> {\r\n this.removeDialog();\r\n\r\n this.dialogRef = createComponent(componentType, {\r\n environmentInjector: this.appRef.injector,\r\n });\r\n\r\n document.body.appendChild(this.dialogRef.location.nativeElement);\r\n this.appRef.attachView(this.dialogRef.hostView);\r\n\r\n this.dialogRef.instance.open();\r\n\r\n return new Promise((resolve) => {\r\n const subscription = this.dialogRef?.instance.closed.subscribe((e: DialogEvent) => {\r\n this.removeDialog();\r\n resolve(e);\r\n subscription.unsubscribe();\r\n })\r\n });\r\n }\r\n\r\n protected removeDialog() {\r\n // remove previous dialog if exists\r\n if (this.dialogRef) {\r\n this.appRef.detachView(this.dialogRef.hostView);\r\n this.dialogRef.destroy();\r\n this.dialogRef.changeDetectorRef.detectChanges();\r\n }\r\n }\r\n}","import { z } from \"zod\";\n\nimport { Query, Article as Record } from \"@sinequa/atomic\";\n\nimport { RawMessageContent } from \"./types/message-content.types\";\nimport { MessageImageReference } from \"./types/message-reference.types\";\n\n/**\n * Individual message sent & returned by the ChatGPT API.\n * If this message is an attachment, we attach the minimal\n * information needed to reconstruct this attachment (RawAttachment)\n * as well as the reference id computed at the moment of sending\n * the attachment to the API.\n */\nexport interface RawMessage {\n role: string;\n content: RawMessageContent;\n // Used only by WPS to be removed\n // https://sinequa.atlassian.net/browse/ES-23710\n messageType?: \"CHART\" | \"MARKDOWN\";\n additionalProperties: {\n [key: string]: any;\n };\n}\n\n/**\n * A chat message that has been processed to include the markdown-formatted\n * content for display, as well as detailed attachment data, and optionally\n * a list of the references extracted from that message\n */\nexport interface ChatMessage extends RawMessage {\n additionalProperties: {\n messageId: string;\n display?: boolean;\n $progress?: ChatProgress[];\n $attachment?: ChatContextAttachment[];\n $suggestedAction?: SuggestedAction[];\n $debug?: DebugMessage[];\n forcedWorkflow?: string;\n forcedWorkflowProperties?: any;\n query?: Query;\n isUserInput?: boolean;\n usageMetrics?: ChatUsageMetrics;\n additionalWorkflowProperties?: any;\n $liked?: boolean;\n $disliked?: boolean;\n [key: string]: any;\n };\n}\n\nexport interface ChatProgress {\n title: string;\n content?: string;\n done?: boolean;\n time?: number;\n}\n\nexport interface RawAttachment {\n /** Type of the attachment */\n type: string;\n /** Record id from which this attachment is taken */\n recordId: string;\n /** Record from which this this attachment is taken */\n record: Record;\n}\n\nexport interface DocumentPart {\n partId: number;\n offset: number;\n length: number;\n text: string;\n images?: string[] | MessageImageReference[];\n}\n\nexport type DocumentPage = {\n url: string;\n mimeType: string;\n name?: string;\n type?: string;\n description?: string;\n length?: number;\n offSet?: number;\n pageNumber?: number;\n remappedLength?: number;\n remappedOffset?: number;\n};\n\nexport interface ChatContextAttachment extends RawAttachment {\n /** Type of the attachment */\n type: \"Context\";\n /** Rank of the attachment in the context message */\n contextId: number;\n /** Parts of the record that the assistant uses to answer */\n parts: DocumentPart[];\n /** Pages of the documents based on the query */\n pages?: DocumentPage[];\n /** The specific id used of the referenced part */\n $partId?: number;\n}\n\n/**\n * Raw response of the chat API\n */\nexport interface RawResponse {\n history: RawMessage[];\n executionTime: string | undefined;\n executionTimeMilliseconds: number | undefined;\n}\n\n/**\n * Enriched response of the chat API\n */\nexport interface ChatResponse extends RawResponse {\n history: ChatMessage[];\n}\n\n/**\n * Response of the ListModels API\n */\nexport interface GllmModelDescription {\n provider: string;\n displayName: string;\n serviceId: string;\n modelId: string;\n enable: boolean;\n maxGenerationSize: number;\n contextWindowSize: number;\n}\n\n/**\n * Response of the ListFunctions API\n */\nexport interface GllmFunction {\n functionName: string;\n description: string;\n enabled: boolean;\n parameters: GllmFunctionParameter[];\n}\n\nexport interface GllmFunctionParameter {\n description: string;\n isRequired: boolean;\n name: string;\n type: string;\n}\n\n/**\n * Minimal representation of a saved chat\n */\nexport interface SavedChat {\n id: string;\n title: string;\n modifiedUTC: string;\n}\n\n/**\n * Data structure saved to reconstruct a saved chat conversation\n */\nexport interface SavedChatHistory extends SavedChat {\n history: ChatMessage[];\n}\n\n// Define the Zod representation for the connectionSettings object\nexport const connectionSettingsSchema = z\n .object({\n connectionErrorMessage: z.string(),\n restEndpoint: z.string().optional(),\n websocketEndpoint: z.string().optional(),\n signalRSkipNegotiation: z.boolean().optional(),\n signalRTransport: z.enum([\n \"WebSockets\",\n \"ServerSentEvents\",\n \"LongPolling\",\n \"None\",\n ]),\n signalRLogLevel: z.enum([\n \"Critical\",\n \"Debug\",\n \"Error\",\n \"Information\",\n \"None\",\n \"Trace\",\n \"Warning\",\n ]),\n signalRServerTimeoutInMilliseconds: z.number().optional(),\n })\n .refine((data) => !!data.restEndpoint || !!data.websocketEndpoint, {\n message:\n \"Based on the provided input() protocol ('REST' or 'WEBSOCKET') to the Chat Component, either 'restEndpoint' or 'websocketEndpoint' property should be provided in the 'globalSettings' of the assistant instance.\",\n });\n// Define the ConnectionSettings interface\nexport type ConnectionSettings = z.infer<typeof connectionSettingsSchema>;\n\n// Define the Zod representation for the serviceSettings object\nconst serviceSettingsSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n});\n// Define the ServiceSettings interface\nexport interface ServiceSettings\n extends z.infer<typeof serviceSettingsSchema> {}\n\n// Define the Zod representation for the additionalServiceSettings object\nconst additionalServiceSettingsSchema = z.object({});\n// Define the AdditionalServiceSettings interface\nexport interface AdditionalServiceSettings\n extends z.infer<typeof additionalServiceSettingsSchema> {}\n\n// Define the Zod representation for the additionalWorkflowProperties object\nconst additionalWorkflowPropertiesSchema = z.object({});\n// Define the additionalWorkflowProperties interface\nexport interface additionalWorkflowProperties\n extends z.infer<typeof additionalWorkflowPropertiesSchema> {}\n\n// Define the Zod representation for the uiSettings object\nconst uiSettingsSchema = z.object({\n display: z.boolean(),\n servicesModels: z.boolean(),\n functions: z.boolean(),\n temperature: z.boolean(),\n top_p: z.boolean(),\n max_tokens: z.boolean(),\n debug: z.boolean(),\n displaySystemPrompt: z.boolean(),\n displayUserPrompt: z.boolean(),\n});\n// Define the UiSettings interface\nexport interface UiSettings extends z.infer<typeof uiSettingsSchema> {}\n\n// Define the Zod representation for the defaultValues object\nconst defaultValuesSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n functions: z.array(\n z.object({\n name: z.string(),\n enabled: z.boolean(),\n })\n ),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n debug: z.boolean(),\n systemPrompt: z.string(),\n userPrompt: z.string(),\n});\n// Define the DefaultValues interface\nexport interface DefaultValues extends z.infer<typeof defaultValuesSchema> {}\n\n// Define the Zod representation for the action object\nconst actionSchema = z.object({\n forcedWorkflow: z.string(), // forcedWorkflow must be a string\n forcedWorkflowProperties: z.record(z.unknown()).optional(), // forcedWorkflowProperties must be an object (Map equivalent)\n});\n\n// Define the Zod representation for the modeSettings object\nconst initializationSchema = z\n .object({\n event: z.enum([\"Query\", \"Prompt\"]),\n forcedWorkflow: z.string().optional(),\n forcedFunction: z.string().optional(),\n displayUserQuery: z.boolean().optional(),\n })\n // ❌ Rule 1: Cannot have both forcedWorkflow and forcedFunction\n .refine(\n (data) =>\n data.event !== \"Query\" || !(data.forcedWorkflow && data.forcedFunction),\n {\n message:\n \"Both 'forcedFunction' and 'forcedWorkflow' properties are set, but they should not.\",\n }\n )\n // ❌ Rule 2: Must have one of forcedWorkflow or forcedFunction when event is 'Query'\n .refine(\n (data) =>\n data.event !== \"Query\" || !!data.forcedWorkflow || !!data.forcedFunction,\n {\n message:\n \"One of 'forcedWorkflow' or 'forcedFunction' must be provided when the initialization's event is 'Query'.\",\n }\n )\n // ❌ Rule 3: Must have displayUserQuery set when event is 'Query'\n .refine(\n (data) =>\n data.event !== \"Query\" ||\n (data.displayUserQuery !== undefined && data.displayUserQuery !== null),\n {\n message:\n \"'displayUserQuery' must be provided when the initialization's event is 'Query'.\",\n }\n );\n\nconst modeSettingsSchema = z.object({\n enabledUserInput: z.boolean(),\n displayUserPrompt: z.boolean(),\n sendUserPrompt: z.boolean(),\n initialization: initializationSchema,\n actions: z.record(actionSchema).optional(),\n});\n// Define the ModeSettings interface\nexport interface ModeSettings extends z.infer<typeof modeSettingsSchema> {}\n\n// Define the Zod representation for the savedChatSettings object\nconst savedChatSettingsSchema = z.object({\n enabled: z.boolean(),\n display: z.boolean(),\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings\n extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the globalSettings object\nconst globalSettingsSchema = z.object({\n searchWarningMessage: z.string(),\n disclaimer: z.string().optional(),\n genericChatErrorMessage: z.string().optional(),\n displayUserQuotaConsumption: z.boolean().optional(),\n displayChatTokensConsumption: z.boolean().optional(),\n});\n\n// Define the Zod representation for the auditSettings object\nconst auditSettingsSchema = z.object({\n issueTypes: z.array(z.string()).optional(),\n logContent: z.boolean(),\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings\n extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the entire ChatConfig object\nexport const chatConfigSchema = z.object({\n connectionSettings: connectionSettingsSchema,\n defaultValues: defaultValuesSchema,\n modeSettings: modeSettingsSchema,\n uiSettings: uiSettingsSchema,\n savedChatSettings: savedChatSettingsSchema,\n globalSettings: globalSettingsSchema,\n auditSettings: auditSettingsSchema,\n additionalServiceSettings: additionalServiceSettingsSchema,\n additionalWorkflowProperties: additionalWorkflowPropertiesSchema,\n});\n// Define the ChatConfig interface\nexport interface ChatConfig extends z.infer<typeof chatConfigSchema> {}\n\nexport interface ChatPayload {\n debug: boolean;\n functions: string[];\n history: ChatMessage[];\n serviceSettings: ServiceSettings;\n appQuery: {\n app: string;\n query: Query | undefined;\n targetUrl?: string;\n accessToken?: string;\n };\n instanceId: string;\n chatId: string;\n genericChatErrorMessage?: string;\n}\n\nexport type ActionMessage = {\n guid: string;\n displayName?: string;\n displayValue?: string;\n executionTime?: number;\n};\n\nexport interface TextChunksOptions {\n extendMode?: \"None\" | \"Sentence\" | \"Chars\";\n extendScope?: number;\n}\n\nexport interface Quota {\n lastRequest: string;\n promptTokenCount: number;\n completionTokenCount: number;\n periodTokens: number;\n resetHours: number;\n tokenCount: number;\n nextReset: string;\n lastResetUTC: string;\n nextResetUTC: string;\n maxQuotaReached: boolean;\n}\n\nexport interface SuggestedAction {\n content: string;\n type: string;\n}\n\nexport interface InitChat {\n messages: RawMessage[];\n}\n\n/**\n * List of events data that can be emitted by the websocket chat endpoint\n */\nexport type SuggestedActionsEvent = { suggestedActions: SuggestedAction[] };\nexport type QuotaEvent = { quota: Quota };\nexport type MessageEvent = { delta: string; messageId: string };\nexport type ContextMessageEvent = { content: string; additionalProperties: ChatContextAttachment };\nexport type ErrorEvent = string;\nexport type ActionStartEvent = { guid: string; displayName: string };\nexport type ActionResultEvent = { guid: string; displayValue: string };\nexport type ActionStopEvent = { guid: string; executionTime: number };\nexport type HistoryEvent = { history: RawMessage[]; executionTime: string; executionTimeMilliseconds?: number };\nexport type DebugMessageEvent = DebugMessage;\n\n/**\n * Data emitted by the http chat endpoint\n */\nexport type HttpChatResponse = {\n quota: Quota;\n suggestedActions: SuggestedAction[];\n debug: any;\n context: { content: string; additionalProperties: ChatContextAttachment }[];\n actions: ActionMessage[];\n history: RawMessage[];\n executionTime: string;\n executionTimeMilliseconds: number;\n};\n\nexport interface TokenConsumption {\n percentage: number;\n}\n\nexport interface UserTokenConsumption extends TokenConsumption {\n nextResetDate: string;\n}\n\nexport interface ChatUsageMetrics {\n totalTokenCount: number;\n promptTokenCount: number;\n completionTokenCount: number;\n tokenizerType: string;\n}\n\nexport interface KvObject {\n data: {\n key: string;\n value: any; // string | number | boolean | null | undefined | { [key: string]: any };\n };\n type: \"KV\";\n isError: boolean;\n}\n\nexport interface ListObject {\n name: string;\n type: \"LIST\";\n isError: boolean;\n items: (KvObject | ListObject)[];\n expanded: boolean;\n}\n\nexport type DebugMessage = {\n title: string;\n chatId: string;\n executionId: string;\n debugMessageId: string;\n $expanded?: boolean;\n $loading?: boolean;\n $details?: ListObject[];\n}\n\nexport type MessageHandler<T> = {\n handler: (data: T) => void;\n isGlobalHandler: boolean;\n};\n\n/**\n * Data emitted by the saved chat endpoints\n */\nexport type DeleteSavedChatResponse = {\n deleteCount: number;\n executionTime: string;\n executionTimeMilliseconds: number;\n};\nexport type SavedChatResponse = {\n savedChat: SavedChat;\n executionTime: string;\n executionTimeMilliseconds: number;\n};\n","import { Injectable, inject } from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport {\n fetchApp,\n fetchPrincipal,\n fetchUserSettings,\n sha512,\n} from '@sinequa/atomic';\n\nimport { DialogUpdatesComponent } from '../dialogs/updates.component';\nimport { AppService } from './app.service';\nimport { DialogService } from './dialog.service';\nimport { NotificationsService } from './notification.service';\nimport { PrincipalService } from './principal.service';\nimport { UserSettingsWebService } from './user-settings.service';\nimport { ChatConfig, chatConfigSchema } from '../types';\nimport { getAssistantJsonFromCCApp } from '../utils/assistant-json';\n\nexport interface AssistantConfigurationOperationContext {\n getChatInstanceId: () => string;\n getChatId: () => string;\n getAssistantConfigValue: () => ChatConfig | undefined;\n\n setAssistantConfig: (config: ChatConfig | undefined) => void;\n setWSRequestsUrl: (url: string) => void;\n setRESTRequestsUrl: (url: string) => void;\n setInitConfigStatus: (status: boolean) => void;\n generateAuditEvent: (type: string, details: Record<string, any>, id?: string) => Promise<void>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssistantConfigurationService {\n private context: AssistantConfigurationOperationContext | undefined;\n\n private appService = inject(AppService);\n private userSettingsService = inject(UserSettingsWebService);\n private principalService = inject(PrincipalService);\n private modalService = inject(DialogService);\n private notificationsService = inject(NotificationsService);\n private transloco = inject(TranslocoService);\n\n constructor() {}\n\n public init(context: AssistantConfigurationOperationContext): void {\n if (this.context) {\n console.warn('AssistantConfigurationService already initialized.');\n return;\n }\n this.context = context;\n }\n\n private ensureInitialized(): void {\n if (!this.context) {\n throw new Error('AssistantConfigurationService not initialized. Call init() first.');\n }\n }\n\n public getAssistantsSetting(): any {\n if (!this.userSettingsService.userSettings) {\n this.userSettingsService.userSettings = {};\n }\n if (!this.userSettingsService.userSettings[\"assistants\"]) {\n this.userSettingsService.userSettings[\"assistants\"] = {};\n }\n return this.userSettingsService.userSettings[\"assistants\"];\n }\n\n public async initChatConfig(): Promise<void> {\n this.ensureInitialized();\n const context = this.context!;\n\n // fetch the standard app config to get the defaultValues of the chat config for the given instance\n // Persist the app in the app service\n const capp = await fetchApp();\n this.appService.app = capp;\n\n const settings = await fetchUserSettings<{}>();\n this.userSettingsService.userSettings = settings;\n const key = context.getChatInstanceId();\n const userSettingsConfig = this.getAssistantsSetting()[key] || {};\n\n const principal = await fetchPrincipal();\n this.principalService.principal = principal;\n\n const standardChatConfig = getAssistantJsonFromCCApp(this.appService.app, key);\n\n try {\n // Validate the whole config object against the schema\n chatConfigSchema.parse(standardChatConfig);\n // If the user preferences do not contain a config's defaultValues object, keep using the standard app config and nothing to store in the user preferences\n if (!userSettingsConfig.defaultValues) {\n context.setAssistantConfig({ ...standardChatConfig });\n context.setInitConfigStatus(true);\n } else {// If the user has its own defaultValues in its userSettings, then we need to check for potential updates made by admins in the meantime and how he wants to manage them\n\n // Retrieve already stored hashes in the user settings if exists\n const appliedDefaultValuesHash = userSettingsConfig.hashes?.[\"applied-defaultValues-hash\"];\n const skippedDefaultValuesHash = userSettingsConfig.hashes?.[\"skipped-defaultValues-hash\"];\n // Create a hash of the current defaultValues of the standardChatConfig\n const currentDefaultValuesHash = await sha512(JSON.stringify(standardChatConfig.defaultValues));\n\n // Implement the tracking mechanism to notify the user about the available updates in the defaultValues object of the standard app config\n const condition = (currentDefaultValuesHash !== appliedDefaultValuesHash) && (currentDefaultValuesHash !== skippedDefaultValuesHash);\n if (condition) {\n this.modalService.open(DialogUpdatesComponent)\n .then(res => {\n if (res === \"dialog-confirm\") {\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash, \"skipped-defaultValues-hash\": undefined };\n // Update the chat config and store its defaultValues in the user preferences\n this.updateChatConfig({ ...standardChatConfig }, hashes, true);\n context.setInitConfigStatus(true);\n context.generateAuditEvent(\"ast-configuration.click\", { 'configuration': JSON.stringify({ ...standardChatConfig }) });\n } else if (res === \"dialog-no\") {\n // Do not notify the user about changes while this skipped version is not updated\n const hashes = { ...userSettingsConfig.hashes, \"skipped-defaultValues-hash\": currentDefaultValuesHash };\n this.updateChatConfig({ ...standardChatConfig, defaultValues: userSettingsConfig.defaultValues }, hashes, false);\n context.setInitConfigStatus(true);\n } else {\n // Just pick the version in the user settings, nothing to be updated\n context.setAssistantConfig({ ...standardChatConfig, defaultValues: userSettingsConfig.defaultValues });\n context.setInitConfigStatus(true);\n }\n });\n } else {\n // No available updates Or updates has been already skipped, then just pick the version in the user settings\n context.setAssistantConfig({ ...standardChatConfig, defaultValues: userSettingsConfig.defaultValues });\n context.setInitConfigStatus(true);\n }\n }\n } catch (error) {\n this.notificationsService.error(`Missing valid configuration for the assistant instance '${key}'. See the browser console messages for details on the missing or incorrect properties.`);\n // Ensure error is properly typed for accessing 'issues'\n const issues = (error instanceof Error && 'issues' in error) ? (error as any).issues : undefined;\n throw new Error(`Missing valid configuration for the assistant instance '${key}' . \\n ${JSON.stringify(issues, null, 2)}`);\n }\n }\n\n public updateChatConfig(\n config: ChatConfig,\n hashes?: { \"applied-defaultValues-hash\"?: string, \"skipped-defaultValues-hash\"?: string },\n notify = true,\n successCallback?: () => any,\n errorCallback?: () => any\n ): void {\n this.ensureInitialized();\n const context = this.context!;\n\n context.setAssistantConfig(config);\n\n const assistants = Object.assign({}, this.getAssistantsSetting());\n const chatInstanceId = context.getChatInstanceId();\n assistants[chatInstanceId] = { ...assistants[chatInstanceId], defaultValues: config.defaultValues };\n if (hashes) assistants[chatInstanceId].hashes = hashes;\n\n this.userSettingsService.patch({ assistants }).subscribe(\n () => {\n if (notify) {\n if (successCallback) {\n successCallback();\n } else {\n this.notificationsService.success(this.transloco.translate('chat.saveChatConfig.success', { value: chatInstanceId }));\n }\n }\n },\n error => {\n if (notify) {\n if (errorCallback) {\n errorCallback();\n } else {\n this.notificationsService.error(this.transloco.translate('chat.saveChatConfig.fail', { value: chatInstanceId }));\n }\n }\n console.error(\"Could not patch assistants!\", error);\n }\n );\n }\n\n public getWSRequestsUrl() {\n this.ensureInitialized();\n const context = this.context!;\n const url = context.getAssistantConfigValue()?.connectionSettings.websocketEndpoint;\n if (url) {\n context.setWSRequestsUrl(url);\n } else {\n throw new Error(`The property 'websocketEndpoint' must be provided`);\n }\n }\n\n public getRESTRequestsUrl() {\n this.ensureInitialized();\n const context = this.context!;\n const url = context.getAssistantConfigValue()?.connectionSettings.restEndpoint;\n if (url) {\n context.setRESTRequestsUrl(url);\n } else {\n throw new Error(`The property 'restEndpoint' must be provided`);\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, throwError, from } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\nimport { get } from '@sinequa/atomic';\n\nimport { ChatConfig, GllmModelDescription, GllmFunction } from '../types';\n\nexport interface AssistantMetadataOperationContext {\n getRestUrl: () => string;\n getAssistantConfigValue: () => ChatConfig | undefined;\n setModels: (models: GllmModelDescription[] | undefined) => void;\n setFunctions: (functions: GllmFunction[] | undefined) => void;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssistantMetadataService {\n private context: AssistantMetadataOperationContext | undefined;\n\n public init(context: AssistantMetadataOperationContext): void {\n if (this.context) {\n console.warn('AssistantMetadataService already initialized.');\n return;\n }\n this.context = context;\n }\n\n private ensureInitialized(): void {\n if (!this.context) {\n throw new Error('AssistantMetadataService not initialized. Call init() first.');\n }\n }\n\n listModels(): Observable<GllmModelDescription[] | undefined> {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfigValue();\n\n const data = {\n action: \"listmodels\",\n debug: assistantConfig!.defaultValues.debug.toString()\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<{ models: GllmModelDescription[] | undefined }>(`plugin/${context.getRestUrl()}`, searchParams))\n .pipe(\n map(res => res?.models),\n tap(models => context.setModels(models?.filter(model => !!model.enable))),\n catchError((error) => {\n console.error('Error invoking listmodels:', error);\n return throwError(() => error);\n })\n );\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfigValue();\n\n const data = {\n action: \"listfunctions\",\n debug: assistantConfig!.defaultValues.debug.toString()\n };\n\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = typeof value === 'string' ? value : JSON.stringify(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<{ functions: GllmFunction[] | undefined }>(`plugin/${context.getRestUrl()}`, searchParams))\n .pipe(\n map(res => res?.functions),\n tap((functions: GllmFunction[] | undefined) => {\n const enabledConfigFunctions = assistantConfig!.defaultValues.functions;\n context.setFunctions(functions?.filter(func => func.enabled && !!enabledConfigFunctions.find(fn => fn.name === func.functionName)));\n }),\n catchError((error) => {\n console.error('Error invoking listfunctions:', error);\n return throwError(() => error);\n })\n );\n }\n}\n","import { Injectable, inject } from '@angular/core';\n\nimport {\n ChatConfig,\n ChatUsageMetrics,\n GllmModelDescription,\n Quota,\n TokenConsumption,\n UserTokenConsumption\n} from '../types';\nimport { AssistantUtils } from '../utils/utils.service';\nimport { NotificationsService } from './notification.service';\n\nexport interface AssistantTokensTrackingOperationContext {\n getAssistantConfigValue: () => ChatConfig | undefined;\n setQuota: (quota: Quota | undefined) => void;\n setUserTokenConsumption: (consumption: UserTokenConsumption | undefined) => void;\n setChatUsageMetrics: (metrics: ChatUsageMetrics | undefined) => void;\n setChatTokenConsumption: (consumption: TokenConsumption | undefined) => void;\n generateAuditEvent: (type: string, details: Record<string, any>, id?: string) => Promise<void>;\n getModel: (serviceId: string, modelId: string) => GllmModelDescription | undefined;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AssistantTokensTrackingService {\n private context: AssistantTokensTrackingOperationContext | undefined;\n private assistantUtils = inject(AssistantUtils);\n private notificationsService = inject(NotificationsService);\n\n constructor() {}\n\n public init(context: AssistantTokensTrackingOperationContext): void {\n if (this.context) {\n console.warn('AssistantTokensTrackingService already initialized.');\n return;\n }\n this.context = context;\n }\n\n private ensureInitialized(): void {\n if (!this.context) {\n throw new Error('AssistantTokensTrackingService not initialized. Call init() first.');\n }\n }\n\n public updateQuota(quota: Quota, propagateError = false): void {\n this.ensureInitialized();\n const context = this.context!;\n\n context.setQuota(quota);\n const nextResetDate = this.assistantUtils.formatDateTime(quota.nextResetUTC + \"+00:00\");\n const consumptionPercentage = Math.round((quota.tokenCount * 100 / quota.periodTokens) * 100) / 100;\n context.setUserTokenConsumption({ percentage: consumptionPercentage, nextResetDate });\n\n if (quota.maxQuotaReached) {\n context.generateAuditEvent('ast-quota.exceeded', {});\n const msg = `Sorry, you have exceeded the allowed quota. Please retry starting from ${nextResetDate}.`;\n this.notificationsService.error(msg);\n if (propagateError) throw new Error(msg);\n }\n }\n\n public updateChatUsageMetrics(chatUsageMetrics: ChatUsageMetrics): void {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfigValue();\n\n context.setChatUsageMetrics(chatUsageMetrics);\n const currentModel = context.getModel(assistantConfig!.defaultValues.service_id, assistantConfig!.defaultValues.model_id);\n\n if (currentModel) {\n const consumptionPercentage = Math.round((chatUsageMetrics.totalTokenCount * 100 / (currentModel.contextWindowSize - currentModel.maxGenerationSize)) * 100) / 100;\n context.setChatTokenConsumption({ percentage: consumptionPercentage });\n }\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HubConnection } from '@microsoft/signalr';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { Observable, Subject, fromEvent, merge, of, throwError } from 'rxjs';\nimport { map, mergeMap, takeUntil, tap, take, switchMap, finalize } from 'rxjs/operators';\n\nimport { guid, Query } from \"@sinequa/atomic\";\n\nimport {\n ActionMessage,\n ActionResultEvent,\n ActionStartEvent,\n ActionStopEvent,\n ChatConfig,\n ChatContextAttachment,\n ChatMessage,\n ChatPayload,\n ChatProgress,\n ChatResponse,\n ChatUsageMetrics,\n ContextMessageEvent,\n DebugMessage,\n DebugMessageEvent,\n ErrorEvent,\n HistoryEvent,\n MessageHandler,\n MessageEvent,\n Quota,\n QuotaEvent,\n SavedChatResponse,\n SuggestedActionsEvent\n} from '../types';\n\nimport { AppService } from './app.service';\nimport { AssistantUtils } from '../utils/utils.service';\nimport { NotificationsService } from './notification.service';\nimport { MessageContent, TextMessageContent } from '../types/message-content.types';\n\nexport interface AssistantWsFramesContext {\n getAssistantConfig: () => ChatConfig | undefined;\n getChatInstanceId: () => string;\n getChatId: () => string;\n getHubConnection: () => HubConnection | undefined;\n getChatHistory: () => ChatMessage[] | undefined;\n\n setStreamingStatus: (isStreaming: boolean) => void;\n setChatHistory: (history: ChatMessage[] | undefined) => void;\n setStoppingGenerationStatus: (isStopping: boolean) => void;\n setSavedChatsErrorStatus: (hasError: boolean) => void;\n\n updateQuota: (quota: Quota, propagateError?: boolean) => void;\n updateChatUsageMetrics: (metrics: ChatUsageMetrics) => void;\n generateAuditEvent: (type: string, details: Record<string, any>, id?: string) => Promise<void>;\n addSavedChat: (id: string, messages: ChatMessage[]) => Observable<SavedChatResponse>;\n updateSavedChat: (id: string, name?: string, messages?: ChatMessage[]) => Observable<SavedChatResponse>;\n listSavedChat: () => void;\n isExistingSavedChat: (id: string) => Observable<boolean>;\n}\n\n@Injectable()\nexport class AssistantWsFramesService {\n private context: AssistantWsFramesContext | undefined;\n\n private appService = inject(AppService);\n private transloco = inject(TranslocoService);\n private assistantUtils = inject(AssistantUtils);\n private notificationsService = inject(NotificationsService);\n\n private _messageHandlers: Map<string, MessageHandler<any>> = new Map();\n private _response: ChatMessage[];\n private _actionMap = new Map<string, ActionMessage>();\n private _progress: ChatProgress[] | undefined = undefined;\n private _executionTime: string;\n private _executionTimeMilliseconds?: number;\n private _attachments: ChatContextAttachment[] = [];\n private _debugMessages: DebugMessage[] = [];\n\n public init(context: AssistantWsFramesContext): void {\n if (this.context) {\n console.warn('AssistantWsFramesService already initialized.');\n return;\n }\n this.context = context;\n }\n\n private ensureInitialized(): void {\n if (!this.context) {\n throw new Error('AssistantWsFramesService not initialized. Call init() first.');\n }\n }\n\n public fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfig()!;\n\n // Start streaming by invoking the Chat method\n context.setStreamingStatus(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload = {\n history: messages,\n functions: assistantConfig.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: assistantConfig.defaultValues.debug,\n serviceSettings: {\n service_id: assistantConfig.defaultValues.service_id,\n model_id: assistantConfig.defaultValues.model_id,\n top_p: assistantConfig.defaultValues.top_p,\n temperature: assistantConfig.defaultValues.temperature,\n max_tokens: assistantConfig.defaultValues.max_tokens,\n ...assistantConfig.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n instanceId: context.getChatInstanceId(),\n chatId: context.getChatId(),\n genericChatErrorMessage: assistantConfig.globalSettings.genericChatErrorMessage ? this.transloco.translate(assistantConfig.globalSettings.genericChatErrorMessage) : \"\"\n };\n\n // Initialize the response with an empty assistant message\n // here display: true is needed in order to be able to show the progress\n // here messageId is needed but it is temporary and will be replaced by the correct messageId generated by the assistant when the message starts streaming\n this._response = [{ role: \"assistant\", content: \"\", additionalProperties: { display: true, messageId: guid() } }];\n\n // Create a Subject to signal completion\n const completion$ = new Subject<void>();\n\n // Create observables for each non-global handler in the _messageHandlers map (default and eventual custom ones) once it is triggered by the hub connection\n const observables = Array\n .from(this._messageHandlers.entries())\n .filter(([eventName, eventHandler]) => !eventHandler.isGlobalHandler)\n .map(([eventName, eventHandler]) => fromEvent<any>(context.getHubConnection()!, eventName).pipe(\n mergeMap((event) => {\n // Wrap the handler in a try-catch block to prevent the entire stream from failing if an error occurs in a single handler\n try {\n // Execute the handler and emit the result\n // NB: here we could use [eventHandler.handler(event)] which behind the scenes mergeMap interprets this array as an observable sequence with one item, which it then emits\n return of(eventHandler.handler(event));\n } catch (error) {\n console.error(`Error in event handler for ${eventName}:`, error);\n // Use throwError to propagate the error downstream\n return throwError(() => new Error(`Error in event handler for ${eventName}: ${error}`));\n }\n })\n ));\n\n // Then merge them into a single observable in order to simulate the streaming behavior\n const combined$ = merge(...observables).pipe(\n map(() => {\n // Define $progress from the _actionMap\n const actions = Array.from(this._actionMap.values());\n this._progress = actions.length > 0\n ? actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n : undefined;\n\n // Always update ONLY the first assistant message of the _response with the new $progress, $attachment and $debug\n // Assuming that the first assistant message is always visible since the hub does not send hidden messages by design\n // So even if the first assistant message is hidden (display: false), the _response[0] will and should contain :\n // - $progress, $attachment and $debug\n // - the content of the first visible assistant message in the workflow\n // This is mandatory in order to match the behavior of consecutive messages and maintain consistency with the chatHistory\n if(!!this._progress || this._attachments.length > 0 || this._debugMessages.length > 0) {\n this._response[0].additionalProperties.$progress = this._progress;\n this._response[0].additionalProperties.$attachment = this._attachments;\n this._response[0].additionalProperties.$debug = this._debugMessages;\n }\n // Return the result\n return { history: [...messages, ...this._response], executionTime: this._executionTime, executionTimeMilliseconds: this._executionTimeMilliseconds };\n }),\n // Complete the observable when completion$ emits\n takeUntil(completion$),\n );\n\n // return a new Observable that emits the result of the combined stream and handles the eventual errors of the invocation of the Chat method\n return new Observable(observer => {\n // Subscribe to combined stream\n combined$.subscribe({\n next: (value) => observer.next(value),\n error: (err) => observer.error(err)\n });\n\n // Invoke the Chat method and handle errors\n context.getHubConnection()!.invoke('Chat', data)\n .then(() => {\n const chatHistory = context.getChatHistory()!;\n // If a valid assistant message with (display: true) was found, update it\n // and it should always the case\n const index = this.assistantUtils.firstVisibleAssistantMessageIndex(chatHistory);\n if (index !== -1) {\n chatHistory[index].additionalProperties.$progress = this._progress;\n chatHistory[index].additionalProperties.$attachment = this._attachments;\n chatHistory[index].additionalProperties.$debug = this._debugMessages;\n context.setChatHistory(chatHistory);\n }\n\n // Save/update the chat if savedChat enabled\n if (assistantConfig.savedChatSettings.enabled && context.getChatHistory()!.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n context.isExistingSavedChat(context.getChatId()).pipe(\n take(1),\n switchMap((exists) =>\n exists\n ? context.updateSavedChat(context.getChatId(), undefined, context.getChatHistory()!)\n : context.addSavedChat(context.getChatId(), context.getChatHistory()!).pipe(\n tap(() => context.listSavedChat())\n )\n ),\n finalize(() => context.setStreamingStatus(false))\n ).subscribe({\n next: () => {},\n error: (error) => observer.error(error),\n complete: () => observer.complete()\n });\n } else {\n context.setStreamingStatus(false);\n observer.complete();\n }\n })\n .catch(error => {\n console.error('Error invoking Chat:', error);\n context.setStreamingStatus(false);\n // Emit the error to the newly created observable\n observer.error(error);\n // Return a resolved promise to handle the error and prevent unhandled promise rejection\n return Promise.resolve();\n })\n .finally(() => {\n // This block concerns ONLY the completion of the \"Chat\" method invocation.\n // This means the completion of the combined$ stream.\n // It does not take into account the completion of the entire fetch method (the observable returned by fetch) and which depends on the completion of the save chat action if enabled\n this._response = []; // Clear the _response\n this._actionMap.clear(); // Clear the _actionMap\n this._progress = undefined; // Clear the _progress\n this._attachments = []; // Clear the _attachments\n this._debugMessages = []; // Clear the _debugMessages\n this._executionTime = \"\"; // Clear the _executionTime\n this._executionTimeMilliseconds = undefined; // Clear the _executionTimeMilliseconds\n completion$.next(); // Emit a signal to complete the observables\n completion$.complete(); // Complete the subject\n });\n });\n }\n\n public initMessageHandlers(): void {\n this.ensureInitialized();\n const context = this.context!;\n\n this.addMessageHandler(\"Error\", {\n handler: (error: ErrorEvent) => {\n if (error.indexOf('SavedChatList') !== -1) {\n context.setSavedChatsErrorStatus(true);\n }\n console.error(error);\n this.notificationsService.error(error);\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\"Quota\", {\n handler: (message: QuotaEvent) => {\n try {\n context.updateQuota(message.quota);\n } catch (error) {\n console.error(error);\n }\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\"Debug\", { handler: () => {}, isGlobalHandler: true });\n this.addMessageHandler(\"ActionStart\", {\n handler: (action: ActionStartEvent) => this._actionMap.set(action.guid, action),\n isGlobalHandler: false\n });\n this.addMessageHandler(\"ActionResult\", {\n handler: (action: ActionResultEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n });\n this.addMessageHandler(\"ActionStop\", {\n handler: (action: ActionStopEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n });\n this.addMessageHandler(\"ContextMessage\", {\n handler: (message: ContextMessageEvent) => { this._attachments.push(message.additionalProperties); },\n isGlobalHandler: false\n });\n this.addMessageHandler(\"Message\", {\n handler: (message: MessageEvent) => {\n this._response.at(-1)!.content += message.delta ?? \"\";\n this._response.at(-1)!.additionalProperties.messageId = message.messageId;\n },\n isGlobalHandler: false\n });\n this.addMessageHandler(\"History\", {\n handler: (history: HistoryEvent) => {\n // The ChatHistory is updated: it is the current copy concatenated with the new items ONLY (it can have multiple messages: the context messages + the response message)\n // This is mandatory to not lose the previous updates of the chatHistory when the assistant is streaming multiple message steps\n const currentChatHistory = (context.getChatHistory() || []) as ChatMessage[];\n const newHistory = [...currentChatHistory, ...(history.history.slice(currentChatHistory.length))] as ChatMessage[];\n context.setChatHistory(newHistory);\n\n // Emit the updated chat usage metrics\n const lastMessage = newHistory.at(-1);\n if (lastMessage?.additionalProperties.usageMetrics) {\n context.updateChatUsageMetrics(lastMessage.additionalProperties.usageMetrics);\n }\n this._executionTime = history.executionTime;\n this._executionTimeMilliseconds = history.executionTimeMilliseconds;\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\"SuggestedActions\", {\n handler: (message: SuggestedActionsEvent) => {\n // Since after the \"History\" and \"MessageBreak\" that this event is caught,\n // $suggestedAction needs to be updated directly to the last visible \"assistant\" message in the _response and the chatHistory\n this._response.at(-1)!.additionalProperties.$suggestedAction = (this._response.at(-1)!.additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n const chatHistory = context.getChatHistory()!;\n const index = this.assistantUtils.lastVisibleAssistantMessageIndex(chatHistory);\n if (index !== -1) {\n chatHistory[index].additionalProperties.$suggestedAction = (chatHistory[index].additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n context.setChatHistory(chatHistory);\n }\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\"DebugDisplay\", {\n handler: (message: DebugMessageEvent) => this._debugMessages = this._debugMessages.concat(message),\n isGlobalHandler: false\n });\n this.addMessageHandler(\"MessageBreak\", {\n handler: () => {\n // Systematically happens right after the \"History\" event\n // This is the moment when the assistant message is fully streamed\n const assistantConfig = context.getAssistantConfig();\n const chatHistory = context.getChatHistory();\n if (!assistantConfig || !chatHistory || !chatHistory.length) return;\n\n const lastChatMessage = chatHistory.at(-1)!;\n\n const details = {\n 'duration': this._executionTimeMilliseconds !== undefined ? this._executionTimeMilliseconds : this._executionTime,\n 'role': lastChatMessage.role,\n 'rank': chatHistory.length,\n 'message-id': lastChatMessage.additionalProperties.messageId,\n 'generation-tokencount': lastChatMessage.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': lastChatMessage.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': JSON.stringify(this._attachments.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => {\n if (!!assistantConfig.auditSettings?.logContent) return { partId, text };\n return { partId };\n }),\n type\n })))\n };\n if (!!assistantConfig.auditSettings?.logContent) {\n if (typeof lastChatMessage.content === 'string') {\n (details as any)['text'] = lastChatMessage.content;\n } else if (Array.isArray(lastChatMessage.content)) {\n (details as any)['text'] = (lastChatMessage.content.find((msg) => msg.type === \"text\") as TextMessageContent).text\n }\n }\n context.generateAuditEvent('ast-message.message', details);\n // Push a new assistant message to the _response array ONLY if the content of the last message is not empty\n if (this._response.at(-1)!.content !== \"\") {\n this._response.push({role: \"assistant\", content: \"\", additionalProperties: {display: true, messageId: guid()}});\n }\n },\n isGlobalHandler: false\n }\n );\n }\n\n public overrideMessageHandlers<T>(_messageHandlers: Map<string, MessageHandler<T>>): void {\n this.ensureInitialized();\n // Clear the already registered global chat handlers before merging the new ones\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.unsubscribeMessageHandler(eventName);\n }\n });\n // Merge the new event handlers with the existing ones\n this._messageHandlers = new Map([...this._messageHandlers, ..._messageHandlers]);\n // Register the global handlers among the merged map\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n });\n }\n\n public addMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>): void {\n this.ensureInitialized();\n this._messageHandlers.set(eventName, eventHandler);\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n }\n\n public registerMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>): void {\n this.ensureInitialized();\n const connection = this.context!.getHubConnection();\n if (!connection) {\n console.log(\"No connection found to register the listener\" + eventName);\n return;\n }\n connection.on(eventName, (data: T) => {\n eventHandler.handler(data);\n });\n }\n\n public removeMessageHandler(eventName: string): void {\n this.ensureInitialized();\n this._messageHandlers.delete(eventName);\n this.unsubscribeMessageHandler(eventName);\n }\n\n public unsubscribeMessageHandler(eventName: string): void {\n this.ensureInitialized();\n const connection = this.context!.getHubConnection();\n connection?.off(eventName);\n }\n\n public stopGeneration(): Observable<boolean> {\n this.ensureInitialized();\n const context = this.context!;\n const connection = context.getHubConnection()!;\n\n // Start stopping generation by invoking the CancelTasks method\n context.setStoppingGenerationStatus(true);\n // Create a Subject to hold the result of the CancelTasks method\n const stopGenerationSubject$ = new Subject<boolean>();\n\n connection.on('CancelTasks', (res) => {\n // When the generation is stopped before streaming any VISIBLE assistant message, this means that $progress, $attachment and $debug properties will be lost.\n // However, the \"ContextMessage\" frames will be persisted in the chatHistory and the assistant may reference them in the next generation.\n // This leads to the problem of referencing undisplayed attachments in the next generation.\n // To solve this problem, we need to persist $progress, $attachment and $debug properties by adding a new assistant message with empty content and these properties.\n // In the other hand, this leads to the problem of having many empty assistant messages in the chat history, if a stop generation happens multiple times in a row with no content generated yet.\n // To solve this problem mentioned in the ticket ES-27024, we need to allow such operation ONLY if the last assistant message's content in the chat history is not empty.\n const chatHistory = context.getChatHistory();\n const isLastChatHistoryMessageAssistantContentEmpty = chatHistory?.length\n && chatHistory.at(-1)?.role === \"assistant\"\n && (chatHistory.at(-1)?.content === \"\"\n ||\n ((chatHistory.at(-1)?.content as MessageContent[])?.find((msg) => msg.type === \"text\") as TextMessageContent)?.text === \"\"\n );\n if (this._response && this._response.length === 1 && this._response[0].content === \"\" && !isLastChatHistoryMessageAssistantContentEmpty) {\n const newChatHistory = chatHistory ? [...chatHistory] : [];\n newChatHistory.push({role: \"assistant\", content: \"\", additionalProperties: {display: true, messageId: guid(), $progress: this._progress, $attachment: this._attachments, $debug: this._debugMessages}});\n context.setChatHistory(newChatHistory);\n }\n // Emit the result of the CancelTasks method\n stopGenerationSubject$.next(!!res);\n // Complete the subject\n stopGenerationSubject$.complete();\n // Complete stopping generation\n context.setStoppingGenerationStatus(false);\n });\n\n // Invoke the CancelTasks method and handle errors\n connection.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n stopGenerationSubject$.error(new Error(error as string));\n context.setStoppingGenerationStatus(false);\n return Promise.resolve();\n });\n\n return stopGenerationSubject$.asObservable();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\nimport { get } from '@sinequa/atomic';\n\nimport {\n DebugMessage,\n ListObject\n} from '../types';\n\nexport interface DebugMessageOperationConfig {\n getRestUrl: () => string;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DebugMessageService {\n private operationConfig: DebugMessageOperationConfig | undefined;\n\n constructor() {}\n\n public init(config: DebugMessageOperationConfig): void {\n if (this.operationConfig) {\n console.warn('DebugMessageService already initialized.');\n return;\n }\n this.operationConfig = config;\n }\n\n private ensureInitialized(): void {\n if (!this.operationConfig) {\n throw new Error('DebugMessageService not initialized. Call init() first.');\n }\n }\n\n public getDebugMessage(message: DebugMessage): Observable<ListObject | undefined> {\n this.ensureInitialized();\n const config = this.operationConfig!;\n\n if (!message || !message.chatId || !message.debugMessageId || !message.executionId) {\n return throwError(() => new Error(\"Invalid message provided for debug retrieval.\"));\n }\n\n const { chatId, debugMessageId, executionId } = message;\n const data = {\n action: \"debugMessageList\",\n chatId,\n debugMessageId,\n executionId\n };\n const searchParams = new URLSearchParams(Object.entries(data).reduce((acc, [key, value]) => {\n acc[key] = String(value);\n return acc;\n }, {} as Record<string, string>));\n\n return from(get<any>(`plugin/${config.getRestUrl()}`, searchParams)).pipe(\n map(res => res?.debugMessages[0]?.content),\n catchError((error) => {\n const errorMsg = 'Error occurred while calling the debugMessageList API: ' + error.error?.errorMessage;\n console.error('DebugMessageService: ' + errorMsg);\n return throwError(() => error);\n })\n );\n }\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { TranslocoService } from \"@jsverse/transloco\";\nimport {\n BehaviorSubject,\n catchError,\n defer,\n filter,\n forkJoin,\n from,\n map,\n Observable,\n switchMap,\n take,\n tap,\n throwError\n} from \"rxjs\";\nimport { HubConnection } from \"@microsoft/signalr\";\nimport {\n Audit,\n Query,\n guid,\n globalConfig\n} from \"@sinequa/atomic\";\n\nimport { AppService } from \"./services/app.service\";\nimport { NotificationsService } from \"./services/notification.service\";\nimport { PrincipalService } from \"./services/principal.service\";\nimport { UserSettingsWebService } from \"./services/user-settings.service\";\nimport {\n ChatConfig,\n ChatMessage,\n ChatResponse,\n ChatUsageMetrics,\n DebugMessage,\n DeleteSavedChatResponse,\n GllmFunction,\n GllmModelDescription,\n KvObject,\n ListObject,\n MessageHandler,\n Quota,\n SavedChat,\n SavedChatHistory,\n SavedChatResponse,\n TokenConsumption,\n UserTokenConsumption\n} from \"./types\";\nimport { ConnectionOptions } from \"./services/signalR.web.service\";\nimport { AssistantUtils } from \"./utils/utils.service\";\nimport { SavedChatsService, SavedChatsOperationConfig } from \"./saved-chats/saved-chats.service\";\nimport { SignalRConnectionService, SignalRConnectionOperationConfig } from \"./services/signalR-connection.service\";\nimport { AssistantConfigurationService, AssistantConfigurationOperationContext } from \"./services/assistant-configuration.service\";\nimport { AssistantMetadataService, AssistantMetadataOperationContext } from \"./services/assistant-metadata.service\";\nimport { AssistantTokensTrackingService, AssistantTokensTrackingOperationContext } from \"./services/assistant-tokens-tracking.service\";\nimport { AssistantWsFramesService, AssistantWsFramesContext } from \"./services/assistant-ws-frames.service\"; // Added\nimport { DebugMessageOperationConfig, DebugMessageService } from \"./debug-message/debug-message.service\";\n\n@Injectable()\nexport class ChatService {\n\n /** Name of the assistant websocket endpoint. */\n WS_REQUEST_URL: string;\n /** Name of the assistant REST endpoint. */\n REST_REQUEST_URL: string;\n /** SignalR connection instance */\n public connection: HubConnection | undefined;\n /** Emit true once the initialization of the assistant process is done. */\n initProcess$ = new BehaviorSubject<boolean>(false);\n /** Emit true once the initialization of the assistant config is done. */\n initConfig$ = new BehaviorSubject<boolean>(false);\n /** Emit the global configuration of the assistant. */\n assistantConfig$ = new BehaviorSubject<ChatConfig | undefined>(undefined);\n /** Emit true if the user has been overridden, false otherwise. */\n userOverride$ = new BehaviorSubject<boolean | undefined>(undefined);\n /**\n * Emit true if the fetch of an assistant's response is ongoing (it includes Streaming status of the assistant endpoint AND saving the discussion if save Chat is enabled).\n * This is used to prevent multiple fetches at the same time.\n * Typically, there is no problem chaining fetches, but when forcing a reload after query changes cases, it can't be allowed because it breaks the whole business logic.\n */\n streaming$ = new BehaviorSubject<boolean>(false);\n /** Store the messages history of the current chat. */\n chatHistory: ChatMessage[] | undefined;\n /** List of models available on the server. */\n models: GllmModelDescription[] | undefined;\n /** List of functions available on the server. */\n functions: GllmFunction[] | undefined;\n /** List of saved chats. */\n savedChats$ = new BehaviorSubject<SavedChat[]>([]);\n /** Whether there is an error with saved chats. */\n savedChatsError$ = new BehaviorSubject<boolean>(false);\n /** Emit the saved chat to load. */\n loadSavedChat$ = new BehaviorSubject<SavedChat | undefined>(undefined);\n /** Emit the quota each time the chat is invoked. */\n quota$ = new BehaviorSubject<Quota | undefined>(undefined);\n /** Emit the calculated user's token consumption based on the quota. */\n userTokenConsumption$ = new BehaviorSubject<UserTokenConsumption | undefined>(undefined);\n /** Emit the chat usage metrics each time the generation of the assistant response is completed. */\n chatUsageMetrics$ = new BehaviorSubject<ChatUsageMetrics | undefined>(undefined);\n /** Emit the calculated chat's token consumption based on the chat usage metrics. */\n chatTokenConsumption$ = new BehaviorSubject<TokenConsumption | undefined>(undefined);\n /** Emit true if \"CancelTasks\" is ongoing. */\n stoppingGeneration$ = new BehaviorSubject<boolean>(false);\n /** Instance ID of the chat service defining the assistant instance. */\n private _chatInstanceId: string;\n /** Generated GUID for the current chat discussion used to save/get/delete it and identify audit events. */\n private _chatId: string;\n\n public userSettingsService = inject(UserSettingsWebService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n public principalService = inject(PrincipalService);\n public assistantUtils = inject(AssistantUtils);\n private savedChatsService = inject(SavedChatsService);\n private signalRConnectionService = inject(SignalRConnectionService);\n private assistantConfigurationService = inject(AssistantConfigurationService);\n private assistantMetadataService = inject(AssistantMetadataService);\n private assistantTokensTrackingService = inject(AssistantTokensTrackingService);\n private debugMessageService = inject(DebugMessageService);\n // Inject the AssistantWsFramesService using 'new' to ensure a separate local instance for each ChatService instance\n private assistantWsFramesService = new(AssistantWsFramesService);\n protected readonly transloco = inject(TranslocoService);\n\n /**\n * Initialize the assistant process.\n * It includes building and starting a connection, executing parallel requests for models and functions, and handling errors during the process.\n * ⚠️ This method MUST be called ONLY if the user is loggedIn and once when the assistant is initialized.\n *\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n // Ensure all logic is executed when subscribed to the observable\n return defer(() => {\n this._initAssistantConfigurationService();\n return from(this.initChatConfig());\n }).pipe(\n // Wait for the configuration to be initialized\n switchMap(() => this.initConfig$.pipe(filter(Boolean), take(1))),\n tap(() => {\n this.getWSRequestsUrl();\n this.getRESTRequestsUrl();\n this._initAssistantMetadataService();\n this._initAssistantTokensTrackingService();\n this._initSavedChatsService();\n this._initDebugMessageService();\n this._initSignalRConnectionService();\n }),\n // Build and start the SignalR connection\n switchMap(() => this.buildConnection()),\n tap(() => {\n // Initialize AssistantWsFramesService here, now that 'this.connection' is set\n this._initAssistantWsFramesService();\n this.initMessageHandlers();\n }),\n // Start the connection\n switchMap(() => this.startConnection()),\n // Fetch metadata in parallel\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n take(1)\n );\n }\n\n /**\n * Define the endpoint to use for the websocket requests\n * It can be overridden by the app config\n */\n getWSRequestsUrl() {\n this.assistantConfigurationService.getWSRequestsUrl();\n }\n\n /**\n * Define the endpoint to use for the http requests\n * It can be overridden by the app config\n */\n getRESTRequestsUrl() {\n this.assistantConfigurationService.getRESTRequestsUrl();\n }\n\n /**\n * Initializes the SavedChatsService with the necessary configuration.\n *\n * This method sets up the `SavedChatsService` by providing it with a configuration object\n * (`SavedChatsOperationConfig`) that includes various callbacks and properties required\n * for its operation. The initialization will only proceed if both `assistantConfig$` and\n * `REST_REQUEST_URL` are available.\n *\n * The configuration object includes:\n * - Application name retrieval.\n * - Instance ID retrieval.\n * - REST API URL retrieval.\n * - Debug flag retrieval.\n * - Chat ID for new saves.\n * - Saved chats enablement check.\n * - Methods for setting a saved chat ID, updating the saved chats list, and generating audit events.\n *\n * If the required dependencies are not ready, an error is logged to the console.\n *\n * @private\n */\n private _initSavedChatsService() {\n if (this.assistantConfig$.value && this.REST_REQUEST_URL) {\n const savedChatsOpConfig: SavedChatsOperationConfig = {\n getAppName: () => this.appService.appName,\n getInstanceId: () => this.chatInstanceId,\n getRestUrl: () => this.REST_REQUEST_URL,\n getDebugFlag: () => this.assistantConfig$.value!.defaultValues.debug,\n isSavedChatsEnabled: () => !!this.assistantConfig$.value?.savedChatSettings.enabled,\n setSavedChatsErrorStatus: (hasError) => this.savedChatsError$.next(hasError),\n updateSavedChatsList: (chats) => this.savedChats$.next(chats),\n generateAuditEvent: (type, details, id) => this.generateAuditEvent(type, details, id),\n };\n this.savedChatsService.init(savedChatsOpConfig);\n } else {\n // This case should ideally not happen if init order is correct\n console.error(\"Cannot initialize SavedChatsService: assistantConfig or REST_REQUEST_URL not ready.\");\n }\n }\n\n /**\n * Initializes the SignalR connection service with the necessary configuration.\n *\n * This method ensures that the SignalR connection service is properly set up\n * by providing it with the required configuration values, such as the WebSocket\n * request URL and assistant configuration. It also manages the SignalR hub connection\n * instance.\n *\n * Preconditions:\n * - `assistantConfig$.value` must be available.\n * - `WS_REQUEST_URL` must be defined.\n *\n * If these preconditions are not met, an error is logged to the console.\n *\n * @private\n */\n private _initSignalRConnectionService() {\n if (this.assistantConfig$.value && this.WS_REQUEST_URL) {\n const signalROpConfig: SignalRConnectionOperationConfig = {\n getWsRequestUrl: () => this.WS_REQUEST_URL,\n getAssistantConfigValue: () => this.assistantConfig$.value,\n getHubConnection: () => this.connection, // Using getHubConnection as per user's file\n setHubConnection: (conn) => { this.connection = conn; }\n };\n this.signalRConnectionService.init(signalROpConfig);\n } else {\n // This case should ideally not happen if init order is correct\n console.error(\"Cannot initialize SignalRConnectionService: assistantConfig or WS_REQUEST_URL not ready.\");\n }\n }\n\n /**\n * Initializes the Assistant Configuration Service with the necessary operation context.\n * This method sets up the configuration context by providing various utility functions\n * and state management mechanisms required for the assistant's configuration operations.\n *\n * The operation context includes:\n * - Methods to retrieve chat instance and chat IDs.\n * - Methods to get and set assistant configuration values.\n * - Methods to set WebSocket and REST request URLs.\n * - Methods to update the initialization configuration status.\n * - A method to generate audit events for tracking operations.\n *\n * @private\n */\n private _initAssistantConfigurationService() {\n const configOpContext: AssistantConfigurationOperationContext = {\n getChatInstanceId: () => this.chatInstanceId,\n getChatId: () => this.chatId,\n getAssistantConfigValue: () => this.assistantConfig$.value,\n setWSRequestsUrl: (url) => this.WS_REQUEST_URL = url,\n setRESTRequestsUrl: (url) => this.REST_REQUEST_URL = url,\n setAssistantConfig: (config) => this.assistantConfig$.next(config),\n setInitConfigStatus: (status) => this.initConfig$.next(status),\n generateAuditEvent: (type, details, id) => this.generateAuditEvent(type, details, id)\n };\n this.assistantConfigurationService.init(configOpContext);\n }\n\n /**\n * Initializes the AssistantMetadataService with the necessary operation context.\n *\n * This method checks if the `assistantConfig$` value and `REST_REQUEST_URL` are available.\n * If both are ready, it creates an `AssistantMetadataOperationContext` object and\n * initializes the `assistantMetadataService` with it. The operation context provides\n * methods to retrieve the REST URL, assistant configuration, and to set models and functions.\n *\n * If the required values are not ready, an error is logged to the console.\n *\n * @private\n */\n private _initAssistantMetadataService() {\n if (this.assistantConfig$.value && this.REST_REQUEST_URL) {\n const metadataOpContext: AssistantMetadataOperationContext = {\n getRestUrl: () => this.REST_REQUEST_URL,\n getAssistantConfigValue: () => this.assistantConfig$.value,\n setModels: (models) => { this.models = models; },\n setFunctions: (functions) => { this.functions = functions; }\n };\n this.assistantMetadataService.init(metadataOpContext);\n } else {\n console.error(\"Cannot initialize AssistantMetadataService: assistantConfig or REST_REQUEST_URL not ready.\");\n }\n }\n\n /**\n * Initializes the Assistant Tokens Tracking Service with the necessary operation context.\n * This method sets up the service by providing it with functions to manage quotas,\n * token consumption, usage metrics, and audit events, as well as access to assistant configuration\n * and model retrieval.\n *\n * The initialization will only proceed if the assistant configuration is available.\n * If the configuration is not ready, an error message is logged to the console.\n *\n * @private\n */\n private _initAssistantTokensTrackingService() {\n if (this.assistantConfig$.value) {\n const tokensOpContext: AssistantTokensTrackingOperationContext = {\n getAssistantConfigValue: () => this.assistantConfig$.value,\n setQuota: (quota) => this.quota$.next(quota),\n setUserTokenConsumption: (consumption) => this.userTokenConsumption$.next(consumption),\n setChatUsageMetrics: (metrics) => this.chatUsageMetrics$.next(metrics),\n setChatTokenConsumption: (consumption) => this.chatTokenConsumption$.next(consumption),\n generateAuditEvent: (type, details, id) => this.generateAuditEvent(type, details, id),\n getModel: (serviceId, modelId) => this.getModel(serviceId, modelId)\n };\n this.assistantTokensTrackingService.init(tokensOpContext);\n } else {\n console.error(\"Cannot initialize AssistantTokensTrackingService: assistantConfig not ready.\");\n }\n }\n\n /**\n * Initializes the Assistant WebSocket Frames Service with the necessary operation context.\n * This method sets up the required dependencies and configuration for the service to function properly.\n * It ensures that the assistant configuration and connection are available before initializing the service.\n *\n * The operation context provides various utility functions and state management methods, including:\n * - Accessing the assistant configuration, chat instance ID, saved chat ID, and chat history.\n * - Managing streaming and stopping generation statuses.\n * - Updating quota and chat usage metrics.\n * - Generating audit events.\n * - Managing saved chats (adding, updating, and listing).\n *\n * If the required dependencies (`assistantConfig$` and `connection`) are not ready, an error is logged.\n *\n * @private\n */\n private _initAssistantWsFramesService() {\n if (this.assistantConfig$.value && this.connection) {\n const wsFramesOpContext: AssistantWsFramesContext = {\n getAssistantConfig: () => this.assistantConfig$.value,\n getChatInstanceId: () => this.chatInstanceId,\n getChatId: () => this.chatId,\n getHubConnection: () => this.connection,\n getChatHistory: () => this.chatHistory,\n setStreamingStatus: (isStreaming) => this.streaming$.next(isStreaming),\n setChatHistory: (history) => { this.chatHistory = history; },\n setStoppingGenerationStatus: (isStopping) => this.stoppingGeneration$.next(isStopping),\n setSavedChatsErrorStatus: (hasError) => this.savedChatsError$.next(hasError),\n updateQuota: (quota, propagateError) => this.updateQuota(quota, propagateError),\n updateChatUsageMetrics: (metrics) => this.updateChatUsageMetrics(metrics),\n generateAuditEvent: (type, details, id) => this.generateAuditEvent(type, details, id),\n addSavedChat: (id, messages) => this.addSavedChat(id, messages),\n updateSavedChat: (id, name, messages) => this.updateSavedChat(id, name, messages),\n listSavedChat: () => this.listSavedChat(),\n isExistingSavedChat: (id) => this.isExistingSavedChat(id)\n };\n this.assistantWsFramesService.init(wsFramesOpContext);\n } else {\n console.error(\"Cannot initialize AssistantWsFramesService: core dependencies not ready.\");\n }\n }\n\n private _initDebugMessageService() {\n if (this.assistantConfig$.value && this.REST_REQUEST_URL) {\n const debugMessageOpContext: DebugMessageOperationConfig = {\n getRestUrl: () => this.REST_REQUEST_URL\n };\n this.debugMessageService.init(debugMessageOpContext);\n } else {\n console.error(\"Cannot initialize DebugMessageService: assistantConfig or REST_REQUEST_URL not ready.\");\n }\n }\n\n get assistants(): any {\n return this.assistantConfigurationService.getAssistantsSetting();\n }\n\n /**\n * Get the instance ID of the chat service\n * @returns The instance ID of the chat service\n */\n get chatInstanceId(): string {\n return this._chatInstanceId;\n }\n\n /**\n * Persist the instance ID of the chat service\n * @param instanceId The instance ID of the chat service\n */\n setChatInstanceId(instanceId: string) {\n this._chatInstanceId = instanceId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to save/get/delete the discussion and identify audit events\n * @returns The ID of the current chat discussion\n */\n get chatId(): string {\n return this._chatId;\n }\n\n /**\n * Generate an GUID for the current chat discussion which is used to save/get/delete it and identify audit events\n * @param chatId if provided, it will be considered as the ID of the current chat discussion which is used to identify audit events\n */\n generateChatId(chatId?: string) {\n this._chatId = chatId || guid();\n }\n\n /**\n * Initialize the chat config by managing ONLY sub-object **defaultValues** configs of the standard app config (defined in the customization json tab ) and the user preferences.\n * To do so, a tracking mechanism is implemented to notify the user about the available updates in the defaultValues object of the standard app config.\n * The rest of the config object coming from \"standard app config\" is used as it is without any override.\n * Thus, the user preferences are used only for the defaultValues object.\n * This provide a centralized way to manage the rest of the config object by admins and ensure a unique common behavior for all users.\n */\n async initChatConfig(): Promise<void> {\n this.assistantConfigurationService.initChatConfig();\n }\n\n /**\n * Update the chat config and store its defaultValues in the user preferences\n * @param config The updated chat config\n * @param hashes The updated hashes to store in the user preferences\n * @param notify Whether to notify the user about the update\n * @param successCallback The callback to execute if the update is successful\n * @param errorCallback The callback to execute if the update fails\n */\n updateChatConfig(\n config: ChatConfig,\n hashes?: { \"applied-defaultValues-hash\"?: string; \"skipped-defaultValues-hash\"?: string },\n notify = true,\n successCallback?: () => any,\n errorCallback?: () => any\n ): void {\n this.assistantConfigurationService.updateChatConfig(config, hashes, notify, successCallback, errorCallback);\n }\n\n /**\n * Overrides the logged in user\n */\n overrideUser(): void {\n const { userOverrideActive, userOverride } = globalConfig;\n if (!(userOverrideActive && userOverride)) {\n this.userOverride$.next(false);\n return;\n }\n\n // Prepare the payload to send to the OverrideUser method\n const data = {\n instanceId: this.chatInstanceId,\n user: userOverride.username,\n domain: userOverride.domain\n }\n\n // Invoke the OverrideUser method and handle errors\n this.connection!.invoke('OverrideUser', data)\n .then((res) => this.userOverride$.next(!!res))\n .catch(error => {\n console.error('Error invoking OverrideUser:', error);\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n });\n }\n\n /**\n * Calls the Fetch API to retrieve a new message given all previous messages\n */\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n return this.assistantWsFramesService.fetch(messages, query);\n }\n\n /**\n * Return the list of models available on the server\n */\n listModels(): Observable<GllmModelDescription[] | undefined> {\n return this.assistantMetadataService.listModels();\n }\n\n /**\n * Return the list of functions available on the server AND matching enabled functions in the chat config\n */\n listFunctions(): Observable<GllmFunction[] | undefined> {\n return this.assistantMetadataService.listFunctions();\n }\n\n /**\n * Stops the assistant answer generation and cancels all the ongoing and pending related tasks\n */\n stopGeneration(): Observable<boolean> {\n return this.assistantWsFramesService.stopGeneration();\n }\n\n /**\n * A handler for quota updates each time the chat is invoked.\n * It emits the updated quota to the quota$ subject, emits accordingly the updated user's tokens consumption and notifies the user if the max quota is reached.\n * @param quota The updated quota\n * @param propagateError Whether to propagate the error to the caller\n */\n updateQuota(quota: Quota, propagateError = false): void {\n this.assistantTokensTrackingService.updateQuota(quota, propagateError);\n }\n\n /**\n * A handler for chat usage metrics each time the generation of the assistant response is completed.\n * It emits the chat usage metrics to the chatUsageMetrics$ subject, emits accordingly the updated chat's tokens consumption\n * @param chatUsageMetrics The chat usage metrics\n */\n updateChatUsageMetrics(chatUsageMetrics: ChatUsageMetrics): void {\n this.assistantTokensTrackingService.updateChatUsageMetrics(chatUsageMetrics);\n }\n\n /**\n * Get the model description for the given (serviceId + modelId)\n * If a model is not found, an error message is returned\n * @param serviceId The serviceId of the model\n * @param modelId The modelId of the model\n * @returns The model description\n */\n getModel(serviceId: string, modelId: string): GllmModelDescription | undefined{\n const model = this.models?.find(m => m.serviceId === serviceId && m.modelId === modelId);\n // Handle obsolete config\n if(!model) {\n this.notificationsService.error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available. Please contact an admin for further information.`);\n throw new Error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available`);\n }\n return model;\n }\n\n /**\n * Fetch the list saved chats belonging to a specific instance of the assistant\n */\n listSavedChat(): void {\n this.savedChatsService.listChats();\n }\n\n /**\n * Return the saved chat with the given id, if exists. Otherwise, return undefined\n * @param id The id of the saved chat\n */\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n return this.savedChatsService.getChatById(id);\n }\n\n /**\n * Check if a saved chat with the given id already exists\n * @param id The id of the saved chat\n * @returns True if the saved chat exists, false otherwise\n */\n isExistingSavedChat(id: string): Observable<boolean> {\n return this.savedChatsService.isExistingChat(id);\n }\n\n /**\n * Save a chat with the given messages\n * @param messages The messages to add to the saved chat index\n * @returns The saved chat\n */\n addSavedChat(id: string, messages: ChatMessage[]): Observable<SavedChatResponse> {\n return this.savedChatsService.addChat(id, messages);\n }\n\n /**\n * Update a saved chat with the given id.\n * @param id The id of the saved chat\n * @param name The new name of the saved chat, if provided\n * @param messages The messages to update the saved chat history, if provided\n * @returns True if the saved chat has been successfully updated\n */\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChatResponse> {\n return this.savedChatsService.updateChat(id, name, messages);\n }\n\n /**\n * Bulk delete of saved chats matching the given ids\n * @param ids List of ids of the saved chats to delete\n * @returns The number of deleted chats\n */\n deleteSavedChat(ids: string[]): Observable<DeleteSavedChatResponse> {\n return this.savedChatsService.deleteChat(ids);\n }\n\n public getDebugMessage(message: DebugMessage): Observable<KvObject | ListObject | undefined> {\n return this.debugMessageService.getDebugMessage(message);\n }\n\n /**\n * Initialize out-of-the-box handlers\n * It is a placeholder for non-streaming scenarios, where you invoke a specific hub method, and the server responds with frame message(s)\n */\n initMessageHandlers(): void {\n this.assistantWsFramesService.initMessageHandlers();\n }\n\n /**\n * Override and register the entire _messageHandlers map by merging the provided map with the default one\n * @param _messageHandlers\n */\n overrideMessageHandlers<T>(_messageHandlers: Map<string, MessageHandler<T>>): void {\n this.assistantWsFramesService.overrideMessageHandlers(_messageHandlers);\n }\n\n /**\n * Add a listener for a specific event.\n * If a listener for this same event already exists, it will be overridden.\n * If the listener has \"isGlobalHandler\" set to true, it will be registered to the hub connection.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n addMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>): void {\n this.assistantWsFramesService.addMessageHandler(eventName, eventHandler);\n }\n\n /**\n * Remove a listener for a specific event from the _messageHandlers map and unsubscribe from receiving messages for this event from the SignalR hub.\n * @param eventName Name of the event to remove the listener for\n */\n removeMessageHandler(eventName: string): void {\n this.assistantWsFramesService.removeMessageHandler(eventName);\n }\n\n /**\n * Build a connection to the signalR websocket and register default listeners to the methods defined in the server hub class\n * @param options The options for the connection. It overrides the default options\n * @param logLevel Define the log level displayed in the console\n * @returns Promise that resolves when the connection is built\n */\n buildConnection(options?: ConnectionOptions): Promise<void> {\n return this.signalRConnectionService.buildConnection(options);\n }\n\n /**\n * Start the connection\n * @returns Promise that resolves when the connection is started\n */\n startConnection(): Promise<void> {\n return this.signalRConnectionService.startConnection();\n }\n\n /**\n * Stop the connection\n * @returns Promise that resolves when the connection is stopped\n */\n stopConnection(): Promise<void> {\n return this.signalRConnectionService.stopConnection();\n }\n\n /**\n * Generate an audit event with the given type and details. The generated audit event is sent afterwards via the AuditWebService\n * @param type Audit event type\n * @param details Audit event details\n * @param id Actions (savedChat delete/rename/...) may occur on a specific chat different than the current one stored in this service, so the chat id can be provided\n */\n async generateAuditEvent(type: string, details: Record<string, any>, id?: string) {\n const baseDetails = {\n \"url\": decodeURIComponent(window.location.href),\n \"app\": this.appService.appName,\n \"user-id\": this.principalService.principal?.userId,\n \"instance-id\": this.chatInstanceId,\n \"chat-id\": id || this.chatId,\n \"service-id\": this.assistantConfig$.value!.defaultValues.service_id,\n \"model-id\": this.assistantConfig$.value!.defaultValues.model_id\n };\n\n if (type === \"ast-message.message\") {\n baseDetails[\"is-user-input\"] = false;\n }\n\n const audit = {\n type,\n detail: {\n ...baseDetails,\n ...details\n }\n }\n await Audit.notify(audit);\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport { AfterViewInit, Component, Input } from \"@angular/core\";\nimport * as Prism from 'prismjs';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { KvObject, ListObject } from \"../../types\";\nimport { UIService } from \"../../services/ui.service\";\nimport { DebugMessageService } from \"../debug-message.service\";\n\n@Component({\n selector: \"sq-debug-message-details\",\n templateUrl: \"./debug-message-details.component.html\",\n styleUrls: [\"./debug-message-details.component.scss\"],\n standalone: true,\n imports: [CommonModule, TranslocoPipe],\n providers: [provideTranslocoScope('chat-debug-message')]\n})\nexport class DebugMessageDetailsComponent implements AfterViewInit {\n @Input() data: (KvObject | ListObject)[] | undefined;\n @Input() level: number = 0; // Track the nesting level\n @Input() parentColor: string = ''; // Track the parent row color\n\n constructor(\n public ui: UIService,\n public debugMessageService: DebugMessageService\n ) { }\n\n ngAfterViewInit() {\n Prism.highlightAll();\n }\n\n isObject(value: any): boolean {\n return value !== null && typeof value === 'object'\n }\n\n getRowClass(item: KvObject | ListObject): string {\n if(item.isError) return 'row-error';\n return this.parentColor;\n }\n\n copyToClipboard(code: any) {\n this.ui.copyToClipboard(JSON.stringify(code, null, 2));\n }\n}\n","<ng-container *ngFor=\"let item of data; let i = index\">\n <div *ngIf=\"item.type === 'KV'\" [ngClass]=\"getRowClass(item)\" class=\"d-flex w-100 kv-object\">\n <div class=\"kv-key\">{{ item.data.key }}</div>\n <div class=\"kv-value\">\n <ng-container *ngIf=\"isObject(item.data.value); else normalValue\">\n <div class=\"card mb-2\">\n <div class=\"card-header\">\n <button class=\"btn btn-light btn-sm\" (click)=\"copyToClipboard(item.data.value)\"><i class=\"far fa-fw fa-clipboard\"></i> {{ 'chatDebugMessage.copyCode' | transloco }}</button>\n </div>\n <pre class=\"language-json my-0 rounded-0 rounded-bottom\"><code class=\"language-json\">{{ item.data.value | json }}</code></pre>\n </div>\n </ng-container>\n <ng-template #normalValue><div class=\"data-value\">{{ item.data.value }}</div></ng-template>\n </div>\n </div>\n <div *ngIf=\"item.type === 'LIST'\" [ngClass]=\"getRowClass(item)\" class=\"d-flex w-100 list-object\">\n <div class=\"list-name w-100\" (click)=\"item.expanded=!item.expanded\" *ngIf=\"level > 0\"> <!--remove first level toggle since always it is a LIST object that matches the name of the parent, otherwise, 2 similar title's div duplicated-->\n <i class=\"fas\" [class.fa-chevron-up]=\"item.expanded\" [class.fa-chevron-down]=\"!item.expanded\"></i>\n {{ item.name }}\n </div>\n <div class=\"list-items w-100\" *ngIf=\"item.expanded\">\n <sq-debug-message-details [data]=\"item.items\" [level]=\"level + 1\" [parentColor]=\"getRowClass(item)\"></sq-debug-message-details>\n </div>\n </div>\n</ng-container>\n","import { CommonModule } from \"@angular/common\";\nimport { ChangeDetectorRef, Component, Input } from \"@angular/core\";\n\nimport { DebugMessage, ListObject } from \"../types\";\nimport { DebugMessageService } from \"./debug-message.service\";\nimport { finalize, tap } from \"rxjs\";\n\nimport { DebugMessageDetailsComponent } from \"./debug-message-details/debug-message-details.component\";\n\n@Component({\n selector: \"sq-debug-message\",\n templateUrl: \"./debug-message.component.html\",\n styleUrls: [\"./debug-message.component.scss\"],\n standalone: true,\n imports: [CommonModule, DebugMessageDetailsComponent]\n})\nexport class DebugMessageComponent {\n @Input() data: DebugMessage[] | undefined;\n\n constructor(\n public debugMessageService: DebugMessageService,\n public cdr: ChangeDetectorRef\n ) { }\n\n getRowClass(index: number): string {\n return index % 2 === 0 ? 'row-even' : 'row-odd';\n }\n\n toggleExpand(item: DebugMessage) {\n item.$expanded = !item.$expanded;\n if (item.$expanded && !item.$details) {\n item.$loading = true;\n this.debugMessageService.getDebugMessage(item).pipe(\n tap((details: ListObject | undefined) => {\n if (details) {\n details.expanded = true; // Ensure the 1st level of details is marked as expanded\n item.$details = [details]; // Wrap in an array to match the expected type\n }\n }),\n finalize(\n () => {\n item.$loading = false;\n this.cdr.detectChanges();\n }\n )\n ).subscribe();\n }\n }\n}\n","<div *ngIf=\"data\" class=\"table-root\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <div [ngClass]=\"getRowClass(i)\" class=\"d-flex w-100 list-object\">\n <div class=\"list-name w-100 fw-bold\" (click)=\"toggleExpand(item)\">\n <i class=\"fas\" [class.fa-chevron-up]=\"item.$expanded\" [class.fa-chevron-down]=\"!item.$expanded\"></i>\n {{ item.title }}\n </div>\n <div class=\"list-items w-100\" *ngIf=\"item.$expanded\">\n <div *ngIf=\"item.$loading\">Loading...</div>\n <sq-debug-message-details *ngIf=\"item.$details\" [data]=\"item.$details\" [parentColor]=\"getRowClass(i)\"></sq-debug-message-details>\n </div>\n </div>\n </ng-container>\n</div>\n","import { Injectable } from \"@angular/core\";\r\nimport { Query } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SearchService {\r\n query: Query\r\n}","import { CommonModule } from '@angular/common';\nimport { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';\nimport { Subscription, filter, of, switchMap, tap } from 'rxjs';\nimport { provideTranslocoScope, TranslocoPipe} from '@jsverse/transloco';\n\nimport { isAuthenticated } from '@sinequa/atomic';\n\nimport { ChatService } from '../chat.service';\nimport { InstanceManagerService } from '../instance-manager.service';\nimport { ChatConfig, TokenConsumption, UserTokenConsumption } from '../types';\nimport { TooltipDirective } from '../tooltip/tooltip.directive';\n\n@Component({\n selector: 'sq-token-progress-bar',\n templateUrl: './token-progress-bar.component.html',\n styleUrls: ['./token-progress-bar.component.scss'],\n standalone: true,\n providers: [provideTranslocoScope('token-consumption')],\n imports: [CommonModule, TooltipDirective, TranslocoPipe]\n})\nexport class TokenProgressBarComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n chatService: ChatService;\n config: ChatConfig;\n subscription = new Subscription();\n\n // User token consumption progress bar\n userPercentage?: number;\n userTokensResetDate?: string;\n\n // Current chat token consumption progress bar\n chatPercentage?: number;\n\n public instanceManagerService = inject(InstanceManagerService);\n\n ngOnInit() {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n this.config = this.chatService.assistantConfig$.value!;\n this.onUserTokensConsumption();\n this.onChatTokensConsumption();\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onUserTokensConsumption() {\n this.subscription.add(\n this.chatService.userTokenConsumption$.subscribe(\n (data: UserTokenConsumption | undefined) => {\n if (data) {\n this.userPercentage = data.percentage;\n this.userTokensResetDate = data.nextResetDate;\n }\n }\n )\n );\n }\n\n onChatTokensConsumption() {\n this.subscription.add(\n this.chatService.chatTokenConsumption$.subscribe(\n (data: TokenConsumption | undefined) => {\n if (data) {\n this.chatPercentage = data.percentage;\n }\n }\n )\n );\n }\n\n}\n","<div class=\"bars-container d-flex flex-row gap-2 p-2 me-4\" *ngIf=\"(config?.globalSettings?.displayUserQuotaConsumption && userPercentage !== undefined) || (config?.globalSettings?.displayChatTokensConsumption && chatPercentage !== undefined)\">\n <div *ngIf=\"(config?.globalSettings?.displayUserQuotaConsumption && userPercentage !== undefined)\" class=\"token-progress-bar\" [sqTooltip]=\"'tokenConsumption.userConsumptionTitle' | transloco : { percentage: userPercentage, time: userTokensResetDate }\"\n [style.background]=\"'radial-gradient(closest-side, var(--ast-primary-bg, #F8F8F8) 70%, transparent 75% 100%), conic-gradient(#FF854A ' + userPercentage + '%, #0040BF 0)'\">\n </div>\n <div *ngIf=\"(config?.globalSettings?.displayChatTokensConsumption && chatPercentage !== undefined)\" class=\"token-progress-bar\" [sqTooltip]=\"'tokenConsumption.chatConsumptionTitle' | transloco : { percentage: chatPercentage }\"\n [style.background]=\"'radial-gradient(closest-side, var(--ast-primary-bg, #F8F8F8) 70%, transparent 75% 100%), conic-gradient(#FF854A ' + chatPercentage + '%, #0040BF 0)'\">\n </div>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, inject } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\nimport { TranslocoPipe, TranslocoService, provideTranslocoScope } from '@jsverse/transloco';\nimport { HubConnection, HubConnectionState } from \"@microsoft/signalr\";\nimport { BehaviorSubject, Subscription, combineLatest, filter, fromEvent, merge, of, switchMap, take, tap } from \"rxjs\";\n\nimport { AppGlobalConfig, Article, Query, guid, isAuthenticated, setGlobalConfig } from \"@sinequa/atomic\";\n\nimport { ChatMessageComponent } from \"./chat-message/chat-message.component\";\nimport { ChatService } from \"./chat.service\";\nimport { AssistantUtils } from \"./utils/utils.service\";\nimport { DebugMessageComponent } from \"./debug-message/debug-message.component\";\nimport { InstanceManagerService } from \"./instance-manager.service\";\nimport { NotificationsService } from \"./services/notification.service\";\nimport { PrincipalService } from \"./services/principal.service\";\nimport { SearchService } from \"./services/search.service\";\nimport { TokenProgressBarComponent } from \"./token-progress-bar/token-progress-bar.component\";\nimport { TooltipDirective } from \"./tooltip/tooltip.directive\";\nimport { ChatConfig, ChatContextAttachment, ChatMessage, DebugMessage, GllmModelDescription, InitChat, MessageHandler, RawMessage, SuggestedAction } from \"./types\";\nimport { RawMessageContent, TextMessageContent } from \"./types/message-content.types\";\n\n@Component({\n selector: 'sq-chat-v3', // mandatory since @sinequa/components already has the same tag-name \"sq-chat\"\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n providers: [\n ChatService,\n provideTranslocoScope('chat')\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, FormsModule, ChatMessageComponent, TokenProgressBarComponent, DebugMessageComponent, TooltipDirective, TranslocoPipe]\n})\nexport class ChatComponent implements OnInit, OnChanges, OnDestroy {\n\n public chatService = inject(ChatService);\n public instanceManagerService = inject(InstanceManagerService);\n public searchService = inject(SearchService);\n public principalService = inject(PrincipalService);\n public cdr = inject(ChangeDetectorRef);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n private readonly assistantUtils = inject(AssistantUtils);\n\n /** Define the key based on it, the chat service instance will be stored */\n @Input() instanceId: string;\n /** Define the query to use to fetch answers */\n @Input() query: Query = this.searchService.query;\n /** Function that determines whether the chat should be reloaded after the query changes\n * If not provided, the chat will be reloaded by default\n * @param prevQuery The previous query\n * @param newQuery The new query\n * @returns true if the chat should be reloaded, false otherwise\n */\n @Input() queryChangeShouldTriggerReload: (prevQuery: Query, newQuery: Query) => boolean;\n /** Map of listeners overriding default registered ones*/\n @Input() messageHandlers: Map<string, MessageHandler<any>> = new Map();\n /** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */\n @Input() automaticScrollToLastResponse = false;\n /** When the assistant answer a user question, automatically focus to the chat input */\n @Input() focusAfterResponse = false;\n /** A chat discussion that the component should get initialized with it */\n @Input() chat?: InitChat;\n /** Icon to use for the assistant messages */\n @Input() assistantMessageIcon = 'sq-sinequa';\n /** Icon to use for the user messages */\n @Input() userMessageIcon: string;\n /** Icon to use for the connection error messages */\n @Input() connectionErrorMessageIcon: string;\n /** Icon to use for the search warning messages */\n @Input() searchWarningMessageIcon: string;\n // Add custom additionalWorkflowProperties to the user query message\n @Input() additionalWorkflowProperties: Record<string, any> = {};\n /** Event emitter triggered once the signalR connection is established */\n @Output() connection = new EventEmitter<HubConnection>();\n /** Event emitter triggered each time the assistant updates the current chat */\n /** Event emitter triggered when the chat is loading new content */\n @Output(\"loading\") loading$ = new EventEmitter<boolean>(false);\n /** Emits the assistant configuration used when instantiating the component */\n @Output(\"config\") _config = new EventEmitter<ChatConfig>();\n @Output() data = new EventEmitter<ChatMessage[]>();\n /** Event emitter triggered when the user clicks to open the original document representing the context attachment*/\n @Output() openDocument = new EventEmitter<Article>();\n /** Event emitter triggered when the user clicks to open the preview of a document representing the context attachment */\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n /** Event emitter triggered when the user clicks on a suggested action */\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n /** ViewChild decorators to access the template elements */\n @ViewChild('messageList') messageList?: ElementRef<HTMLUListElement>;\n @ViewChild('questionInput') questionInput?: ElementRef<HTMLTextAreaElement>;\n /** ContentChild decorators allowing the override of the default templates from the parent component */\n @ContentChild('loadingTpl') loadingTpl?: TemplateRef<any>;\n @ContentChild('reportTpl') reportTpl?: TemplateRef<any>;\n @ContentChild('tokenConsumptionTpl') tokenConsumptionTpl?: TemplateRef<any>;\n @ContentChild('debugMessagesTpl') debugMessagesTpl?: TemplateRef<any>;\n\n @Input() appConfig: AppGlobalConfig;\n\n config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n isAdminOrDeletedAdmin = false;\n question = '';\n\n private _sub = new Subscription();\n private _dataSubscription: Subscription | undefined;\n\n /** Variables that depend on the type of model in use */\n modelDescription?: GllmModelDescription;\n\n indexMessageToEdit?: number;\n rankMessageToEdit?: number;\n changes$ = new BehaviorSubject<SimpleChanges | undefined>(undefined);\n currentMessageIndex: number | undefined;\n firstChangesHandled = false;\n isAtBottom = true;\n initializationError = false;\n enabledUserInput = false;\n isConnected = true; // By default, the chat is considered connected\n retrialAttempts: number | undefined;\n // Flag to track whether the 'reconnected' listener is already registered\n private _isReconnectedListenerRegistered = false;\n\n // Issue reporting\n issueTypes?: string[];\n defaultIssueTypes: string[] = [\n 'chat.userInterfaceBug',\n 'chat.incorrectResponse',\n 'chat.incompleteResponse',\n 'chat.technicalIssue',\n 'chat.privacyDataSecurityIssue',\n 'chat.otherIssue'\n ];\n issueType: string = '';\n reportComment?: string;\n messageToReport?: ChatMessage;\n reportRank?: number;\n reportType: 'like' | 'dislike' = 'dislike';\n showReport = false;\n\n // Debug messages\n debugMessages: DebugMessage[] | undefined;\n showDebugMessages = false;\n\n private _previousQuery: Query;\n private _reloadSubscription: Subscription | undefined = undefined;\n\n ngOnInit(): void {\n if (this.appConfig) {\n setGlobalConfig(this.appConfig);\n }\n\n this._sub.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.init()),\n switchMap(_ => this.chatService.initProcess$.pipe(filter(Boolean))),\n tap(_ => {\n this.connection.emit(this.chatService.connection);\n this.onLoadChat();\n }),\n tap(_ => this.chatService.overrideUser()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.assistantConfig$),\n tap(config => {\n this.isAdminOrDeletedAdmin = this.principalService.principal!.isAdministrator || this.principalService.principal!.isDelegatedAdmin || false;\n this.config = config!;\n this.enabledUserInput = this.config.modeSettings.enabledUserInput;\n this.issueTypes = this.config.auditSettings?.issueTypes?.length ? this.config.auditSettings!.issueTypes : undefined;\n this._config.emit(config);\n try {\n this.updateModelDescription();\n if(!this.firstChangesHandled) {\n this._previousQuery = JSON.parse(JSON.stringify(this.query)); // Initialize the previous query\n this._handleChanges();\n this._addScrollListener();\n this.firstChangesHandled = true;\n }\n } catch (error) {\n this.initializationError = true\n throw error;\n }\n })\n ).subscribe()\n );\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._sub.unsubscribe();\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\n this.chatService.stopConnection();\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * This chat service instance is stored in the instanceManagerService with provided @input instanceId as a key\n */\n instantiateChatService(): void {\n this.chatService.setChatInstanceId(this.instanceId);\n this.instanceManagerService.storeInstance(this.instanceId, this.chatService);\n }\n\n /**\n * Handles the changes in the chat component.\n * If the chat service is a WebSocketChatService, it handles the override of the message handlers if they exist.\n * Initializes the chat with the provided chat messages if they exist, otherwise loads the default chat.\n * If the chat is initialized, the initialization event is \"Query\", the query changes, and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true. Otherwise, the chat should be reloaded by default.\n * It takes into account the ongoing streaming process and the ongoing stopping process to trigger that conditionally define the logic\n * of the reload :\n * - If the chat is streaming, then stop the generation and wait for the fetch to complete before reloading the chat.\n * - If the chat is stopping the generation, then wait for the fetch to complete before reloading the chat.\n */\n private _handleChanges() {\n const changes = this.changes$.value;\n // If the chat service is a WebSocketChatService, handle the override of the message handlers if exists\n if (changes?.messageHandlers && this.messageHandlers) {\n this.chatService.overrideMessageHandlers(this.messageHandlers);\n }\n /**\n * Initialize the chat with the provided chat messages if exists, otherwise load the default chat\n * Once the chat is initialized (firstChangesHandled is true), allow opening the chat with the new provided messages (if exists)\n */\n if (!this.firstChangesHandled || changes?.chat) {\n const openChat = () => {\n if (this.messages$.value && this.config.savedChatSettings?.enabled) {\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n }\n this.openChat(this.chat!.messages);\n };\n this.chatService.generateChatId();\n if (this.chat) {\n this.chatService.generateAuditEvent('ast-chat.new', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value),'chat-init': JSON.stringify(this.chat)});\n openChat();\n } else {\n this.chatService.generateAuditEvent('ast-chat.new', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)});\n this.loadDefaultChat();\n }\n }\n /**\n * If the chat is initialized, the initialization event is \"Query\", the query changes and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true\n * Otherwise, the chat should be reloaded by default\n */\n if (this.firstChangesHandled && changes?.query && this.config.modeSettings.initialization.event === 'Query') {\n if (this.queryChangeShouldTriggerReload ? this.queryChangeShouldTriggerReload(this._previousQuery, this.query) : true) {\n if (!!this.chatService.stoppingGeneration$.value) {\n if (!this._reloadSubscription) {\n // Create a subscription to wait for both streaming$ and stoppingGeneration$ to be false\n this._reloadSubscription = combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ])\n .pipe(\n filter(([streaming, stopping]) => !streaming && !stopping), // Wait until both are false\n take(1) // Complete after the first match\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription = undefined;\n });\n }\n } else if (!!this.chatService.streaming$.value) {\n if (!this._reloadSubscription) {\n this._reloadSubscription = this.chatService.stopGeneration()\n .subscribe({\n next: () => {},\n error: () => {\n // Clean up subscription and reset its value\n this._reloadSubscription?.unsubscribe();\n this._reloadSubscription = undefined;\n },\n complete: () => {\n // Wait for the ongoing fetch to complete, then trigger the reload\n this.chatService.streaming$.pipe(\n filter((streaming) => !streaming),\n take(1)\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription!.unsubscribe();\n this._reloadSubscription = undefined;\n });\n }\n });\n }\n } else {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n } else {\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n }\n }\n\n /**\n * Triggers a reload after the query change.\n * This method performs the necessary operations to reload the chat after a query change.\n * It sets the system and user messages, resets the savedChatId, generates a new chatId,\n * generates a new chat audit event, and handles the query mode.\n */\n private _triggerReloadAfterQueryChange() {\n const systemMsg = { role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: { display: false, messageId: guid() } };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = { role: 'user', content: AssistantUtils.formatPrompt(this.transloco.translate(userPrompt) , { principal: this.principalService.principal }), additionalProperties: { display: this.config.modeSettings.displayUserPrompt, messageId: guid() } };\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.generateAuditEvent('ast-chat.new', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this._handleQueryMode(systemMsg, userMsg);\n }\n\n /**\n * Adds a scroll listener to the message list element.\n * The listener is triggered when any of the following events occur:\n * - Loading state changes\n * - Messages change\n * - Streaming state changes\n * - Scroll event occurs on the message list element\n *\n * When the listener is triggered, it updates the `isAtBottom` property.\n */\n private _addScrollListener() {\n this._sub.add(\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(this.messageList!.nativeElement, 'scroll')).subscribe(() => {\n this.isAtBottom = this._toggleScrollButtonVisibility();\n this.cdr.detectChanges();\n })\n );\n }\n\n /**\n * Get the model description based on the defaultValues service_id and model_id\n */\n updateModelDescription() {\n this.modelDescription = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.cdr.detectChanges();\n }\n\n /**\n * Submits a question from the user.\n * If the user is editing a previous message, removes all subsequent messages from the chat history.\n * Triggers the fetch of the answer for the submitted question by calling _fetchAnswer().\n * Clears the input value in the UI.\n * ⚠️ If the chat is streaming or stopping the generation, the operation is not allowed.\n */\n submitQuestion() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (this.question.trim() && this.messages$.value && this.chatService.chatHistory) {\n // When the user submits a question, if the user is editing a previous message, remove all subsequent messages from the chat history\n if (this.indexMessageToEdit !== undefined) {\n // Update the messages in the UI\n this.messages$.next(this.messages$.value.slice(0, this.indexMessageToEdit));\n // Update the raw messages in the chat history which is the clean version used to make the next request\n this.chatService.chatHistory = this.chatService.chatHistory.slice(0, this.rankMessageToEdit);\n this.indexMessageToEdit = undefined;\n this.rankMessageToEdit = undefined;\n }\n // Remove the search warning message if exists\n if (this.chatService.chatHistory.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory.pop();\n }\n // Fetch the answer\n this._fetchAnswer(this.question.trim(), this.chatService.chatHistory);\n // Clear the input value in the UI\n this.questionInput!.nativeElement.value = '';\n this.questionInput!.nativeElement.style.height = `auto`;\n }\n }\n\n /**\n * Triggers the fetch of the answer for the given question and updates the conversation.\n * Generates an audit event for the user input.\n *\n * @param question - The question asked by the user.\n * @param conversation - The current conversation messages.\n */\n private _fetchAnswer(question: string, conversation: ChatMessage[]) {\n // merge additionalWorkflowProperties from the chat component and the customization JSON\n const additionalWorkflowProperties = { ...this.config.additionalWorkflowProperties, ...this.additionalWorkflowProperties };\n const userMsg = { role: 'user', content: question, additionalProperties: { display: true, messageId: guid(), isUserInput: true, additionalWorkflowProperties } };\n const messages = [...conversation, userMsg];\n this.messages$.next(messages); // Update the messages in the UI with the new user message\n this.chatService.chatHistory = messages; // Update the chat history with the new user message\n this.fetch(messages);\n this.chatService.generateAuditEvent('ast-message.message', { ...this._defineMessageAuditDetails(userMsg), 'query': JSON.stringify(this.query), 'is-user-input': true, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(additionalWorkflowProperties) });\n }\n\n /**\n * Depending on the connection's state :\n * - If connected => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * - If any other state => a connection error message is displayed in the chat.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param messages The list of messages to invoke the chat endpoint with\n */\n public fetch(messages: ChatMessage[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this._updateConnectionStatus();\n this.cdr.detectChanges();\n\n if (this.isConnected) {\n this.loading$.next(true);\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = this.chatService.fetch(messages, this.query)\n .subscribe({\n next: res => this.updateData(res.history),\n error: () => {\n this._updateConnectionStatus();\n if (!this.isConnected) {\n const message = {\n role: 'connection-error',\n content: ({ type: \"text\", text: this.transloco.translate(this.config.connectionSettings.connectionErrorMessage) } as TextMessageContent),\n additionalProperties: { display: true, messageId: guid() }\n } as any as ChatMessage;\n this.messages$.next([...messages, message]);\n }\n this.terminateFetch();\n },\n complete: () => {\n // Remove the last message if it's an empty message\n // This is due to the manner in which the chat service handles consecutive messages\n const lastMessage = this.messages$.value?.at(-1);\n if (this.isEmptyAssistantMessage(lastMessage)) {\n this.messages$.next(this.messages$.value?.slice(0, -1));\n }\n this.terminateFetch();\n }\n });\n } else {\n const message = { role: 'connection-error', content: this.transloco.translate(this.config.connectionSettings.connectionErrorMessage), additionalProperties: { display: true, messageId: guid() } };\n this.messages$.next([...messages, message]);\n }\n\n if (this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * Retry to fetch the messages if the connection issues.\n * - If reconnecting => keep display the connection error message even when clicking on the \"retry\" button and increasing the number of retrial attempts, until the connection is re-established\n * - If disconnected => On click on the \"retry\" button, start the connection process while displaying the connection error message :\n * * If successful => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * * If failed => increase the number of retrial attempts\n */\n retryFetch() {\n // A one-time listener for reconnected event\n const onReconnectedHandler = () => {\n // Get the messages without the last one (the connection error message)\n const messages = this.messages$.value!.slice(0, -1);\n // Find the last \"user\" message in the messages list\n let index = messages.length - 1;\n while (index >= 0 && messages[index].role !== 'user') {\n index--;\n }\n // If a user message is found (and it should always be the case), remove all subsequent messages from the chat history\n // Update the messages in the UI\n // and fetch the answer from the assistant\n if (index >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, index + 1));\n const remappedIndex = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory, messages[index].additionalProperties.messageId);\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, remappedIndex + 1);\n this.fetch(this.chatService.chatHistory);\n }\n this.retrialAttempts = undefined; // Reset the number of retrial attempts\n /**\n * To remove the handler for onreconnected() after it's been registered,cannot directly use off() like you would for normal events registered with connection.on().\n * Instead, you need to explicitly remove or reset the handler by assigning it to null or an empty function\n */\n this.chatService.connection!.onreconnected(() => {});\n // Reset the flag to ensure the handler is registered again when needed\n this._isReconnectedListenerRegistered = false;\n }\n // Depending on the connection's state, take the appropriate action\n switch (this.chatService.connection!.state) {\n case HubConnectionState.Connected:\n // If the connection is re-established in the meantime, fetch the messages\n onReconnectedHandler();\n break;\n case HubConnectionState.Reconnecting:\n // Attach the reconnected listener if not already registered\n if (!this._isReconnectedListenerRegistered) {\n this.chatService.connection!.onreconnected(onReconnectedHandler);\n this._isReconnectedListenerRegistered = true;\n }\n // Increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts + 1 : 1;\n break;\n case HubConnectionState.Disconnected:\n // Start the new connection\n this.chatService.startConnection()\n .then(() => onReconnectedHandler())\n .catch(() => { // If the connection fails, increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts + 1 : 1;\n });\n break;\n default:\n break;\n }\n }\n\n /**\n * Check if the signalR connection is connected.\n * For the REST protocol, the connection is always considered connected (for the moment).\n */\n private _updateConnectionStatus() {\n this.isConnected = this.chatService.connection!.state === HubConnectionState.Connected;\n }\n\n /**\n * Update the UI with the new messages\n * @param messages\n */\n updateData(messages: ChatMessage[]) {\n this.messages$.next(messages);\n this.data.emit(messages);\n this.loading$.next(false);\n this.question = '';\n if (this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * @returns true if the chat discussion is scrolled down to the bottom, false otherwise\n */\n private _toggleScrollButtonVisibility(): boolean {\n if (this.messageList?.nativeElement) {\n return Math.round(this.messageList?.nativeElement.scrollHeight - this.messageList?.nativeElement.scrollTop - 1) <= this.messageList?.nativeElement.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n if (this.messageList?.nativeElement) {\n this.messageList.nativeElement.scrollTop = this.messageList.nativeElement.scrollHeight;\n this.cdr.detectChanges();\n }\n }, 10);\n }\n\n /**\n * Start a new chat with the defaultValues settings.\n * The savedChatId in the chat service will be reset, so that the upcoming saved chat operations will be performed on the fresh new chat.\n * If the savedChat feature is enabled, the list of saved chats will be refreshed.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n */\n newChat() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.generateChatId(); // Generate a new chatId\n if (this.config.savedChatSettings?.enabled) {\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n }\n this.chatService.generateAuditEvent('ast-chat.new', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this.loadDefaultChat(); // Start a new chat\n }\n\n /**\n * Attaches the specified document IDs to the assistant.\n * If no document IDs are provided, the operation is not allowed.\n * If the action for attaching a document is not defined at the application customization level, an error is logged.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param ids - An array of document IDs to attach.\n */\n attachToChat(ids: string[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (!ids || ids?.length < 1) {\n return;\n }\n const attachDocAction = this.config.modeSettings.actions?.[\"attachDocAction\"];\n if (!attachDocAction) {\n console.error(`No action is defined for attaching a document to the assistant \"${this.instanceId}\"`);\n return;\n }\n const userMsg = { role: 'user', content: '', additionalProperties: {display: false, messageId: guid(), isUserInput: false, type: \"Action\", forcedWorkflow: attachDocAction.forcedWorkflow, forcedWorkflowProperties: {...(attachDocAction.forcedWorkflowProperties || {}), ids}, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n // Remove the search warning message if exists\n if (this.chatService.chatHistory!.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory!.pop();\n }\n const messages = [...this.chatService.chatHistory!, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n this.chatService.generateAuditEvent('ast-action.requested', {\n 'detail': 'attachDocAction',\n 'forced-workflow': 'SinequaAddSelectedDocumentsWorkflow',\n 'forced-workflow-properties': JSON.stringify(ids),\n });\n }\n\n /**\n * Start the default chat with the defaultValues settings\n * If the chat is meant to be initialized with event === \"Query\", the corresponding user query message will be added to the chat history\n */\n loadDefaultChat() {\n // Define the default system prompt and user prompt messages\n const systemMsg = { role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: { display: false, messageId: guid() } };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = { role: 'user', content: AssistantUtils.formatPrompt(this.transloco.translate(userPrompt) , { principal: this.principalService.principal }), additionalProperties: { display: this.config.modeSettings.displayUserPrompt, messageId: guid() } };\n\n if (this.config.modeSettings.initialization.event === 'Query') {\n this._handleQueryMode(systemMsg, userMsg);\n } else {\n this._handlePromptMode(systemMsg, userMsg);\n }\n }\n\n /**\n * Handles the prompt mode of the chat component.\n * If `sendUserPrompt` is true, it opens the chat with both system and user messages,\n * and generates audit events for both messages.\n * If `sendUserPrompt` is false, it opens the chat with only the system message,\n * and generates an audit event for the system message.\n *\n * @param systemMsg - The system message to be displayed in the chat.\n * @param userMsg - The user message to be displayed in the chat (optional).\n */\n private _handlePromptMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg]);\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(systemMsg));\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(userMsg));\n } else {\n this.openChat([systemMsg]);\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(systemMsg));\n }\n }\n\n /**\n * Handles the query mode by displaying the system message, user message, and user query message.\n * If the provided query text is not empty, then add the user query message to the chat history and invoke the assistant\n * Otherwise, just start a new chat with a warning message inviting the user to perform a full text search to retrieve some results\n * @param systemMsg - The system message to be displayed.\n * @param userMsg - The user message to be displayed.\n */\n private _handleQueryMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (!!this.query.text) {\n const userQueryMsg = { role: 'user', content: this.query.text, additionalProperties: { display: this.config.modeSettings.initialization.displayUserQuery, messageId: guid(), query: this.query, forcedWorkflow: this.config.modeSettings.initialization.forcedWorkflow, forcedFunction: this.config.modeSettings.initialization.forcedFunction, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties } };\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(systemMsg));\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(userMsg));\n this.chatService.generateAuditEvent('ast-message.message', { ...this._defineMessageAuditDetails(userQueryMsg), 'query': JSON.stringify(this.query), 'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, 'forced-function': this.config.modeSettings.initialization.forcedFunction, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.additionalWorkflowProperties) });\n } else {\n this.openChat([systemMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(systemMsg));\n this.chatService.generateAuditEvent('ast-message.message', { ...this._defineMessageAuditDetails(userQueryMsg), 'query': JSON.stringify(this.query), 'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, 'forced-function': this.config.modeSettings.initialization.forcedFunction, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.additionalWorkflowProperties) });\n }\n } else {\n const warningMsg = { role: 'search-warning', content: this.transloco.translate(this.config.globalSettings.searchWarningMessage), additionalProperties: { display: true, messageId: guid() } };\n this.openChat([systemMsg, warningMsg]);\n this.chatService.generateAuditEvent('ast-message.message', this._defineMessageAuditDetails(warningMsg));\n }\n }\n\n private _defineMessageAuditDetails(message: ChatMessage): Record<string, any> {\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n const details: Record<string, any> = {\n 'duration': 0,\n 'role': message.role,\n 'rank': rank,\n 'message-id': message.additionalProperties.messageId\n };\n if (!!this.config.auditSettings?.logContent) {\n if (typeof message.content === 'string') {\n details.text = message.content;\n } else if (Array.isArray(message.content)) {\n details.text = (message.content.find((msg) => msg.type === \"text\") as TextMessageContent).text\n }\n }\n return details;\n }\n\n /**\n * Start/open a new chat with the provided messages and chatId\n * If the last message is from the user, a request to the assistant is made to get an answer\n * If the last message is from the assistant, the conversation is loaded right away\n * @param messages The list of messages of the chat\n * @param chatId The id of the discussion. If provided (ie. an existing discussion in the saved chat index), update the chatId in the chat service for the upcoming saved chat operations\n */\n openChat(messages: RawMessage[], chatId?: string) {\n if (!messages || !Array.isArray(messages)) {\n console.error('Error occurs while trying to load the discussion. Invalid messages received :', messages);\n return;\n }\n if (chatId) {\n this.chatService.generateChatId(chatId);\n }\n // Ensure each message has a unique messageId\n // This is necessary specially in case the assistant is started with a predefined history Or an old saved chat\n const messagesWithIds: ChatMessage[] = messages.map((msg) => {\n msg.additionalProperties.messageId ??= guid();\n return msg as ChatMessage;\n });\n\n this.resetChat();\n this.messages$.next(messagesWithIds);\n this.chatService.chatHistory = messagesWithIds;\n const lastMessage = messages.at(-1);\n if (lastMessage && lastMessage.role === 'user') {\n this.fetch(messagesWithIds); // If the last message if from a user, an answer from the assistant is expected\n }\n else {\n this.updateData(messagesWithIds); // If the last message if from the assistant, we can load the conversation right away\n this.terminateFetch();\n }\n this._addScrollListener();\n }\n\n /**\n * Reset the chat by clearing the chat history and the UI accordingly\n * The user input will be cleared\n * The fetch subscription will be terminated\n */\n resetChat() {\n if (this.messages$.value) {\n this.messages$.next(undefined); // Reset chat\n }\n this.chatService.chatHistory = undefined; // Reset chat history\n this.question = '';\n this.terminateFetch();\n }\n\n /**\n * Fetch and Load the saved chat from the saved chat index.\n * If the saved chat is found, the chat discussion will be loaded with the provided messages and chatId\n */\n onLoadChat() {\n this.loading$.next(true);\n this._sub.add(\n this.chatService.loadSavedChat$\n .pipe(\n filter(savedChat => !!savedChat),\n switchMap(savedChat => this.chatService.getSavedChat(savedChat!.id)),\n filter(savedChatHistory => !!savedChatHistory),\n tap(savedChatHistory => this.openChat(savedChatHistory!.history, savedChatHistory!.id))\n ).subscribe()\n );\n }\n\n /**\n * Stop the generation of the current assistant's answer.\n * The fetch subscription will be terminated.\n */\n stopGeneration() {\n this.chatService.stopGeneration().subscribe(\n () => {\n // Remove the last message if it's an empty message\n // This is due to the manner in which the chat service handles consecutive messages\n const lastMessage = this.messages$.value?.at(-1);\n if (this.isEmptyAssistantMessage(lastMessage)) {\n this.messages$.next(this.messages$.value?.slice(0, -1));\n }\n this.terminateFetch();\n }\n );\n }\n\n /**\n * Terminate the fetch process by unsubscribing from the data subscription and updating the loading status to false.\n * Additionally, focus on the chat input if the focusAfterResponse flag is set to true.\n */\n terminateFetch() {\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = undefined;\n this.loading$.next(false);\n this.cdr.detectChanges();\n\n if (this.focusAfterResponse) {\n setTimeout(() => {\n this.questionInput?.nativeElement.focus();\n });\n }\n }\n\n /**\n * Copy a previous user message of the chat history to the chat user input.\n * Thus, the user can edit and resubmit the message.\n * Once the edited message is submitted, all subsequent messages starting from @param index will be removed from the history and the UI will be updated accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param message The user's message to edit\n * @param index The index of the user's message to edit\n * @returns void\n */\n editMessage(message: ChatMessage, index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.indexMessageToEdit = index;\n this.rankMessageToEdit = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n\n // Get user message from both legacy and text message type\n this.question = typeof message.content === 'string' ? message.content : (message.content[0] as TextMessageContent).text;\n\n this.chatService.generateAuditEvent('ast-edit.click', {'rank': this.rankMessageToEdit, 'message-id': message.additionalProperties.messageId});\n }\n\n /**\n * Copy a previous assistant message of the chat history to the clipboard.\n * @param message The message to copy\n * @param index The index of the message to copy\n * @returns void\n */\n copyMessage(message: ChatMessage, index: number) {\n // Remap the index in the chat history\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n this.chatService.generateAuditEvent('ast-copy.click', { 'rank': rank, 'message-id': message.additionalProperties.messageId });\n }\n\n /**\n * Starting from the provided index, remove all subsequent messages from the chat history and the UI accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param message The assistant's message to regenerate\n * @param index The index of the assistant's message to regenerate\n */\n regenerateMessage(message: ChatMessage, index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n // Update the messages in the UI by removing all subsequent 'assistant' messages starting from the provided index until the first previous 'user' message\n let i = index;\n while (i >= 0 && !((this.messages$.value!)[i].role === 'user' && (this.messages$.value!)[i].additionalProperties.isUserInput === true)) {\n i--;\n }\n // It should always be the case that i > 0\n if (i >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, i + 1));\n // Rank of this found first previous 'user' message in the chat history\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n // Define and Update the chat history based on which the assistant will generate a new answer\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, rank);\n // Fetch the answer\n this.fetch(this.chatService.chatHistory);\n this.chatService.generateAuditEvent('ast-regenerate.click', { 'rank': rank, 'message-id': message.additionalProperties.messageId });\n }\n }\n\n /**\n * Handles the key up event for 'Backspace' and 'Enter' keys.\n * @param event - The keyboard event.\n */\n onKeyUp(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Backspace':\n this.calculateHeight();\n break;\n case 'Enter':\n if (!event.shiftKey) {\n event.preventDefault();\n this.submitQuestion();\n }\n this.calculateHeight();\n break;\n default:\n break;\n }\n }\n\n /**\n * Calculates and adjusts the height of the question input element based on its content.\n * If the Enter key is pressed without the Shift key, it prevents the default behavior.\n * @param event The keyboard event\n */\n calculateHeight(event?: KeyboardEvent): void {\n if (event?.key === 'Enter' && !event.shiftKey) {\n event?.preventDefault();\n }\n const maxHeight = 170;\n const el = this.questionInput!.nativeElement;\n el.style.maxHeight = `${maxHeight}px`;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n el.style.overflowY = el.scrollHeight >= maxHeight ? 'scroll' : 'hidden';\n }\n\n /**\n * Send a \"like\" event on clicking on the thumb-up icon of an assistant's message\n * @param message The assistant message to like\n * @param index The index of the message to like\n */\n onLike(message: ChatMessage, index: number): void {\n // Remap the index in the chat history\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n this.chatService.generateAuditEvent('ast-thumb-up.click', { 'rank': rank, 'message-id': message.additionalProperties.messageId });\n this.reportType = 'like';\n this.messageToReport = message;\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![rank-1].additionalProperties.$liked = true;\n this.chatService.chatHistory![rank-1].additionalProperties.$disliked = false;\n this._updateChatHistory();\n }\n\n /**\n * Send a \"dislike\" event on clicking on the thumb-down icon of an assistant's message.\n * It also opens the issue reporting dialog.\n * @param message The assistant message to dislike\n * @param index The rank of the message to dislike\n */\n onDislike(message: ChatMessage, index: number): void {\n // Remap the index in the chat history\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n this.chatService.generateAuditEvent('ast-thumb-down.click', { 'rank': rank, 'message-id': message.additionalProperties.messageId });\n this.reportType = 'dislike';\n this.messageToReport = message;\n this.issueType = '';\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![rank-1].additionalProperties.$disliked = true;\n this.chatService.chatHistory![rank-1].additionalProperties.$liked = false;\n this._updateChatHistory();\n }\n\n private _updateChatHistory(): void {\n this.messages$.next(this.chatService.chatHistory);\n if (this.config.savedChatSettings.enabled) {\n this.chatService.updateSavedChat(this.chatService.chatId, undefined, this.chatService.chatHistory).subscribe();\n }\n this.cdr.detectChanges();\n }\n\n /**\n * Report an issue related to the assistant's message.\n */\n sendReport(): void {\n const details = {\n 'comment': this.reportComment,\n 'rank': this.reportRank\n };\n\n //check if the message to report is defined. It should always be the case\n if (this.messageToReport) {\n details['message-id'] = this.messageToReport.additionalProperties.messageId;\n }\n\n // hide text in case logContent is not enabled\n if (this.config.auditSettings.logContent)\n details['text'] = this.messageToReport!.content;\n\n if (this.reportType === 'dislike') {\n details['report-type'] = this.issueType;\n this.chatService.generateAuditEvent('ast-negative-report.send', details);\n } else {\n this.chatService.generateAuditEvent('ast-positive-report.send', details);\n }\n this.notificationsService.success(this.transloco.translate('chat.sendReportNotification'));\n this.showReport = false;\n }\n\n /**\n * Close the reporting dialog.\n */\n ignoreReport(): void {\n this.showReport = false;\n }\n\n /**\n * Handle the click on a reference's 'open preview'.\n * @param data\n * @param message the message containing the reference\n * @param index index of the message containing the reference\n * @returns void\n */\n openAttachmentPreview(data: { reference: ChatContextAttachment, partId?: number }, message: ChatMessage, index: number) {\n this.openPreview.emit(data.reference);\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n const details = {\n 'doc-id': data.reference.recordId,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n 'rank': rank,\n 'message-id': message.additionalProperties.messageId\n };\n if (!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('ast-attachment.preview.click', details);\n }\n\n /**\n * Handle the click on a reference's 'open original document'.\n * @param data\n * @param message the message containing the reference\n * @param index index of the message containing the reference\n * @returns void\n */\n openOriginalAttachment(data: { reference: ChatContextAttachment, partId?: number }, message: ChatMessage, index: number) {\n this.openDocument.emit(data.reference.record);\n const rank = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, message.additionalProperties.messageId);\n const details = {\n 'doc-id': data.reference.recordId,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n 'rank': rank,\n 'message-id': message.additionalProperties.messageId\n };\n if (!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('ast-attachment.link.click', details);\n }\n\n /**\n * Handle the click on a suggested action.\n * @param action Suggested action.\n * @param index Rank of the message in the chatHistory related to the suggested action.\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n this.chatService.generateAuditEvent('ast-suggested-action.click', {'text': action.content, 'suggestedAction-type': action.type})\n }\n\n /**\n * It looks for the debug messages available in the current group of \"assistant\" messages.\n * By design, the debug messages are only available in the first visible message among the group of \"assistant\" messages.\n * @param message The message containing the debug information\n * @param index The index of the message\n * @returns The debug messages available in the current group of \"assistant\" messages\n */\n getDebugMessages(message: ChatMessage, index: number): DebugMessage[] {\n // If it is not an assistant message, return an empty array\n if (message.role !== 'assistant') {\n return [];\n }\n // Get the array of messages up to the indicated index\n const array = this.messages$.value!.slice(0, index + 1);\n // If it is an assistant message, look for the debug messages available in the current group of \"assistant\" messages\n // By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n const idx = this.assistantUtils.firstVisibleAssistantMessageIndex(array);\n if (idx > -1) {\n return (this.messages$.value!)[idx].additionalProperties.$debug || [];\n }\n return [];\n }\n\n /**\n * Handle the click on the 'show log info' button of a message.\n * @param message The message containing the debug information\n * @param index The index of the message\n */\n showDebug(message: ChatMessage, index: number): void {\n this.debugMessages = this.getDebugMessages(message, index);\n this.showDebugMessages = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Verify whether the current message is an assistant message and that all following messages are assistant ones\n * Used to keep the \"View progress\" opened even though the assistant is sending additional messages after the current one\n * @param messages the list of current messages\n * @param index the index of the current message\n * @returns if this messages and the following ones (if any) are the last ones\n */\n isAssistantLastMessages(messages: ChatMessage[], index: number): boolean {\n for (let i = index; i < messages.length; i++) {\n if (messages[i].role !== 'assistant') return false;\n }\n return true;\n }\n\n /**\n * Checks if the given message is an empty assistant message.\n * An empty assistant message is defined as a message with the role 'assistant',\n * an empty content, and no additional properties such as attachments, progress,\n * debug information, or suggested actions.\n *\n * @param message - The message to check.\n * @returns `true` if the message is an empty assistant message, `false` otherwise.\n */\n isEmptyAssistantMessage(message: ChatMessage | undefined): boolean {\n if (\n message?.role === 'assistant'\n && (\n // Legacy message type\n (typeof message?.content === 'string' && message?.content === \"\")\n // New message type\n // - Text\n || ((message?.content as RawMessageContent)?.[0] as TextMessageContent)?.text === \"\"\n // TODO: image and video message types https://sinequa.atlassian.net/browse/ES-25940\n )\n && !message?.additionalProperties?.$attachment\n && !message?.additionalProperties?.$progress\n && !message?.additionalProperties?.$debug\n && !message?.additionalProperties?.$suggestedAction\n ) {\n return true;\n }\n return false;\n }\n}\n","<ng-container *ngIf=\"!initializationError\">\n <div *ngIf=\"messages$ | async as messages; else loadingTpl || loadingTplDefault\" class=\"h-100 d-flex flex-column\">\n <!-- Token consumption -->\n <div class=\"ms-1\" *ngIf=\"config?.globalSettings?.displayUserQuotaConsumption || config?.globalSettings?.displayChatTokensConsumption\">\n <ng-container *ngTemplateOutlet=\"tokenConsumptionTpl || defaultTokenConsumptionTpl; context: { $implicit: instanceId }\"></ng-container>\n </div>\n\n <!-- Chat Messages -->\n <ul class=\"d-flex flex-column list-unstyled gap-3 overflow-auto flex-grow-1 pe-2 pb-2\" #messageList>\n <ng-container *ngFor=\"let message of messages; let index = index; let last = last\">\n <!-- Regular messages -->\n <li class=\"list-group-item\"\n *ngIf=\"message.additionalProperties.display && !isEmptyAssistantMessage(message)\"\n [style.--bs-list-group-item-padding-y.rem]=\"'0.6'\"\n [class.opacity-50]=\"indexMessageToEdit && (indexMessageToEdit < (index + 1))\">\n <sq-chat-message\n [class.sq-user-message]=\"message.role === 'user'\"\n [class.last-message]=\"last\"\n [message]=\"message\"\n [conversation]=\"messages\"\n [suggestedActions]=\"last ? message.additionalProperties.$suggestedAction : undefined\"\n [assistantMessageIcon]=\"assistantMessageIcon\"\n [userMessageIcon]=\"userMessageIcon\"\n [connectionErrorMessageIcon]=\"connectionErrorMessageIcon\"\n [searchWarningMessageIcon]=\"searchWarningMessageIcon\"\n [streaming]=\"(chatService.streaming$ | async) && (last || isAssistantLastMessages(messages, index))\"\n [canEdit]=\"(chatService.streaming$ | async) === false && indexMessageToEdit === undefined && message.role === 'user'\"\n [canCopy]=\"((chatService.streaming$ | async) === false || !last) && indexMessageToEdit === undefined && message.role !== 'connection-error' && message.role !== 'search-warning'\"\n [canLike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDislike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDebug]=\"(((chatService.streaming$ | async) === false && last) || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && (getDebugMessages(message, index).length > 0) && ((isAdminOrDeletedAdmin || (chatService.userOverride$ | async)) && config?.defaultValues.debug)\"\n [canRegenerate]=\"(chatService.streaming$ | async) === false && (last || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && indexMessageToEdit === undefined\"\n (edit)=\"editMessage(message, index)\"\n (copy)=\"copyMessage(message, index)\"\n (regenerate)=\"regenerateMessage(message, index)\"\n (openDocument)=\"openOriginalAttachment($event, message, index)\"\n (openPreview)=\"openAttachmentPreview($event, message, index)\"\n (suggestAction)=\"suggestActionClick($event, index)\"\n (like)=\"onLike(message, index)\"\n (dislike)=\"onDislike(message, index)\"\n (debug)=\"showDebug(message, index)\">\n </sq-chat-message>\n </li>\n </ng-container>\n <!-- Loading spinner -->\n <li *ngIf=\"(loading$ | async) === true\">\n <ng-container *ngTemplateOutlet=\"loadingTpl || loadingTplDefault\"></ng-container>\n </li>\n </ul>\n\n <!-- Reporting a feedback form -->\n <div class=\"issue-report p-3 rounded-lg\" *ngIf=\"showReport\">\n <ng-container *ngTemplateOutlet=\"reportTpl || reportTplDefault; context: { $implicit: messageToReport, rank: reportRank, type: reportType }\"></ng-container>\n </div>\n\n <!-- User text input -->\n @if (!showReport) {\n <div class=\"user-input mt-auto\">\n <div class=\"py-2\">\n <div [hidden]=\"!isConnected\">\n <ng-container *ngIf=\"enabledUserInput\" [ngTemplateOutlet]=\"inputTpl\"></ng-container>\n </div>\n <!-- Retry button -->\n <!-- hidden attribute is in conflict with a css rule display: flex -->\n @if(!isConnected){\n <button class=\"btn mb-4 ast-error ast-btn sq-retry\" (click)=\"retryFetch()\">\n <span>{{ 'chat.tryAgain' | transloco }}</span>\n <span *ngIf=\"retrialAttempts\" class=\"ms-2 attempts\">{{ retrialAttempts }}</span>\n </button>\n }\n <div class=\"text-end small text-muted px-3\" *ngIf=\"!!config?.globalSettings?.disclaimer\">\n {{ config?.globalSettings?.disclaimer | transloco }}\n </div>\n </div>\n </div>\n }\n\n <!-- Floating scroll button -->\n <div *ngIf=\"!isAtBottom && !showReport\" class=\"sq-floating-scroll\" [ngClass]=\"enabledUserInput ? 'sq-floating-scroll--when-user-input' : 'sq-floating-scroll--without-user-input'\">\n <button class=\"btn shadow\" (click)=\"scrollDown()\" aria-label=\"Scroll down\">\n <i class=\"fas fa-angle-double-down\"></i>\n </button>\n </div>\n </div>\n</ng-container>\n\n<!-- NG TEMPLATES-->\n\n<ng-template #loadingTplDefault>\n <div class=\"spinner-grow text-primary d-block mx-auto my-5\" role=\"status\">\n <span class=\"visually-hidden\">{{ 'chat.loading' | transloco }}</span>\n </div>\n</ng-template>\n\n<ng-template #inputTpl>\n <div class=\"px-3 py-1\">\n <div class=\"ast-input-container\">\n <button disabled class=\"btn btn-light\" aria-label=\"search\">\n <i class=\"fas fa-search\"></i>\n </button>\n <textarea #questionInput rows=\"1\"\n type=\"text\" class=\"form-control\"\n [placeholder]=\"'chat.askSomething' | transloco\" autofocus\n [(ngModel)]=\"question\"\n (keyup)=\"onKeyUp($event)\"\n (keydown)=\"calculateHeight($event)\"\n [disabled]=\"(loading$ | async) || (chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\">\n </textarea>\n <div id=\"chat-actions\" class=\"d-flex gap-2\">\n <button\n *ngIf=\"(chatService.streaming$ | async) === false && (loading$ | async) === false && (chatService.stoppingGeneration$ | async) === false\"\n type=\"button\"\n class=\"btn btn-light\"\n aria-label=\"Send message\"\n [sqTooltip]=\"'chat.sendMessage' | transloco\"\n (click)=\"submitQuestion()\">\n <i class=\"fas fa-paper-plane\"></i>\n </button>\n <button\n *ngIf=\"indexMessageToEdit\"\n aria-label=\"Cancel edition\"\n type=\"button\"\n class=\"btn btn-light\"\n [sqTooltip]=\"'chat.cancelEdition' | transloco\"\n (click)=\"indexMessageToEdit = undefined; question = ''\">\n <i class=\"fas fa-undo-alt\"></i>\n </button>\n <span *ngIf=\"(chatService.streaming$ | async) && (chatService.stoppingGeneration$ | async) === false\" class=\"processing\">\n {{ 'chat.generating' | transloco }}<i class=\"fas fa-spinner fa-pulse\"></i>\n </span>\n <span *ngIf=\"(chatService.stoppingGeneration$ | async)\" class=\"processing\">\n {{ 'chat.stopping' | transloco }}<i class=\"fas fa-spinner fa-pulse\"></i>\n </span>\n <button\n *ngIf=\"(chatService.streaming$ | async) && (chatService.stoppingGeneration$ | async) === false\"\n type=\"button\"\n class=\"btn btn-light\"\n aria-label=\"Stop generating\"\n [sqTooltip]=\"'chat.stopGeneration' | transloco\"\n (click)=\"stopGeneration()\">\n <i class=\"fas fa-stop\"></i>\n </button>\n </div>\n </div>\n </div>\n</ng-template>\n\n<ng-template #reportTplDefault let-message let-rank=\"rank\" let-type=\"type\">\n <div class=\"px-3\">\n <ng-container *ngIf=\"type === 'dislike'\">\n <h5>{{ 'chat.issueType' | transloco }}</h5>\n <select class=\"form-select mb-4\" [(ngModel)]=\"issueType\">\n <option [value]=\"''\">{{ 'chat.chooseIssueType' | transloco }}</option>\n <option *ngFor=\"let type of (issueTypes ?? defaultIssueTypes)\" [value]=\"type\">{{ type | transloco }}</option>\n </select>\n <h5>{{ 'chat.askUnlikeReasons' | transloco }}</h5>\n </ng-container>\n <ng-container *ngIf=\"type === 'like'\">\n <h5>{{ 'chat.askLikeReasons' | transloco }}</h5>\n </ng-container>\n <textarea class=\"form-control border border-neutral-200\" [(ngModel)]=\"reportComment\" [placeholder]=\"'chat.writeComment' | transloco\"></textarea>\n <div class=\"d-flex flex-row-reverse gap-1 mt-2\">\n <button class=\"btn btn-primary\" [disabled]=\"type === 'dislike' && !issueType\" (click)=\"sendReport()\">{{ 'chat.send' | transloco }}</button>\n <button class=\"btn btn-light\" (click)=\"ignoreReport()\">{{ 'chat.doNotSend' | transloco }}</button>\n </div>\n </div>\n</ng-template>\n\n<ng-template #defaultTokenConsumptionTpl let-instanceId>\n <sq-token-progress-bar\n [instanceId]=\"instanceId\">\n </sq-token-progress-bar>\n</ng-template>\n\n<div class=\"debug-messages\" [class.displayed]=\"showDebugMessages\">\n <button *ngIf=\"showDebugMessages\" class=\"btn btn-light shadow back-btn\" (click)=\"showDebugMessages=false\" aria-label=\"Hide debug messages\">\n <i class=\"fas fa-chevron-right\"></i>\n </button>\n <ng-container *ngTemplateOutlet=\"debugMessagesTpl || defaultDebugMessagesTpl; context: { $implicit: debugMessages }\">\n </ng-container>\n</div>\n\n<ng-template #defaultDebugMessagesTpl let-debugMessages>\n <sq-debug-message [data]=\"debugMessages\"></sq-debug-message>\n</ng-template>\n","import { Component, ElementRef, inject, input, output, signal, viewChild } from \"@angular/core\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { catchError, Subscription, tap, throwError } from \"rxjs\";\r\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\n\r\nimport { ChatService } from \"../chat.service\";\r\nimport { NotificationsService } from \"../services/notification.service\";\r\nimport { SavedChat } from \"../types\";\r\n\r\nexport type SavedChatEdit = SavedChat & { currentTitle: string };\r\n\r\n\r\n@Component({\r\n selector: 'sq-dialog-delete-saved-chat',\r\n standalone: true,\r\n imports: [FormsModule, TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #deleteDialog class=\"rounded-3 z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.deleteSavedDiscussion' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.deleteSavedDiscussionText' | transloco }} \"{{ savedChat().title }}\".</p>\r\n <p>{{ 'chatDialogs.deleteSavedDiscussionConfirm' | transloco }}</p>\r\n\r\n <div class=\"flex justify-end d-flex justify-content-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost btn-light outline-none\" (click)=\"deleteDialog.close()\">{{ 'chatDialogs.cancel' | transloco }}</button>\r\n <button class=\"btn btn-danger\" (click)=\"onDelete($event, savedChat())\">{{ 'chatDialogs.confirm' | transloco }}</button>\r\n </div>\r\n </div>\r\n </dialog>\r\n `\r\n})\r\nexport class DialogDeleteSavedChatComponent {\r\n deleteDialog = viewChild<ElementRef<HTMLDialogElement>>('deleteDialog');\r\n\r\n notificationsService = inject(NotificationsService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n chatService = input.required<ChatService>();\r\n delete = output<SavedChat>();\r\n\r\n savedChat = signal<SavedChatEdit>({ currentTitle: '', title: '' } as SavedChatEdit);\r\n\r\n subscription = new Subscription();\r\n\r\n showModal(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n this.savedChat.set({...savedChat, currentTitle: savedChat.title });\r\n this.deleteDialog()?.nativeElement.showModal();\r\n }\r\n\r\n protected onDelete(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n if (!!this.chatService().streaming$.value || !!this.chatService().stoppingGeneration$.value) {\r\n return;\r\n }\r\n this.subscription.add(\r\n this.chatService().deleteSavedChat([savedChat.id])\r\n .pipe(\r\n tap(res => {\r\n this.notificationsService.success(this.transloco.translate('chatDialogs.deleteSavedDiscussionSuccess', { title: savedChat.title }));\r\n this.delete.emit(savedChat);\r\n this.chatService().listSavedChat();\r\n this.chatService().generateAuditEvent('ast-saved-chat.delete', { duration: res.executionTimeMilliseconds }, savedChat.id);\r\n }),\r\n catchError((error) => {\r\n console.error('Error occurred while deleting the saved chat:', error);\r\n this.notificationsService.error(this.transloco.translate('chatDialogs.deleteSavedDiscussionError', { title: savedChat.title }));\r\n return throwError(() => error);\r\n })\r\n ).subscribe()\r\n );\r\n this.deleteDialog()?.nativeElement.close();\r\n }\r\n\r\n}\r\n","import { Component, ElementRef, inject, input, signal, viewChild } from \"@angular/core\";\r\nimport { FormsModule } from \"@angular/forms\";\r\nimport { catchError, Subscription, tap, throwError } from \"rxjs\";\r\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\n\r\nimport { ChatService } from \"../chat.service\";\r\nimport { NotificationsService } from \"../services/notification.service\";\r\nimport { SavedChat } from \"../types\";\r\n\r\nexport type SavedChatEdit = SavedChat & { currentTitle: string };\r\n\r\n\r\n@Component({\r\n selector: 'sq-dialog-rename-saved-chat',\r\n standalone: true,\r\n imports: [FormsModule, TranslocoPipe],\r\n providers: [provideTranslocoScope('chat-dialogs')],\r\n template: `\r\n <dialog popover #renameDialog class=\"rounded-3 z-backdrop w-full max-w-md p-4 rounded-lg border border-neutral-200 shadow-2xl\">\r\n <div class=\"flex flex-col gap-4\">\r\n <h1 class=\"text-xl font-bold\">{{ 'chatDialogs.renameSavedDiscussion' | transloco }}</h1>\r\n <hr class=\"border-t\">\r\n <p>{{ 'chatDialogs.renameSavedDiscussionText' | transloco }} \"{{ savedChat().currentTitle }}\"</p>\r\n <input\r\n class=\"w-100 rounded h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50\"\r\n type=\"text\" [(ngModel)]=\"savedChat().title\" />\r\n\r\n <div class=\"flex justify-end d-flex justify-content-end gap-2 mt-4\">\r\n <button class=\"btn btn-ghost btn-light outline-none\" (click)=\"renameDialog.close()\">{{ 'chatDialogs.cancel' | transloco }}</button>\r\n <button class=\"btn btn-primary\" (click)=\"onRename($event, savedChat())\">{{ 'chatDialogs.rename' | transloco }}</button>\r\n </div>\r\n </div>\r\n</dialog>\r\n `\r\n})\r\nexport class DialogRenameSavedChatComponent {\r\n renameDialog = viewChild<ElementRef<HTMLDialogElement>>('renameDialog');\r\n\r\n notificationsService = inject(NotificationsService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n chatService = input.required<ChatService>();\r\n savedChat = signal<SavedChatEdit>({ currentTitle: '', title: '' } as SavedChatEdit);\r\n\r\n subscription = new Subscription();\r\n\r\n showModal(event: Event, savedChat: SavedChat) {\r\n event.stopPropagation();\r\n this.savedChat.set({ ...savedChat, currentTitle: savedChat.title });\r\n this.renameDialog()?.nativeElement.showModal();\r\n }\r\n\r\n protected onRename(event: Event, savedChat: SavedChatEdit) {\r\n event.stopPropagation();\r\n const title = savedChat.title.trim();\r\n if (!!this.chatService().streaming$.value || !!this.chatService().stoppingGeneration$.value || !title) {\r\n return;\r\n }\r\n this.subscription.add(\r\n this.chatService().updateSavedChat(savedChat.id, title)\r\n .pipe(\r\n tap(res => {\r\n this.notificationsService.success(this.transloco.translate('chatDialogs.renameSavedDiscussionSuccess', { currentTitle: savedChat.currentTitle, title: title }));\r\n this.chatService().listSavedChat();\r\n this.chatService().generateAuditEvent('ast-saved-chat.rename', { 'text': title, duration: res.executionTimeMilliseconds }, savedChat.id);\r\n }),\r\n catchError((error) => {\r\n console.error('Error occurred while updating the saved chat:', error);\r\n this.notificationsService.error(this.transloco.translate('chatDialogs.renameSavedDiscussionError', { currentTitle: savedChat.currentTitle }));\r\n return throwError(() => error);\r\n })\r\n ).subscribe()\r\n );\r\n this.renameDialog()?.nativeElement.close();\r\n }\r\n\r\n}\r\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { FormsModule } from '@angular/forms';\nimport { BehaviorSubject, Subscription, combineLatest, filter, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { parseISO, toDate } from \"date-fns\";\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { ChatService } from \"../chat.service\";\nimport { AssistantUtils } from \"../utils/utils.service\";\nimport { DialogDeleteSavedChatComponent } from \"../dialogs/delete-saved-chat.component\";\nimport { DialogRenameSavedChatComponent } from \"../dialogs/rename-saved-chat.component\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { NotificationsService } from \"../services/notification.service\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { SavedChat } from \"../types\";\n\n\n@Component({\n selector: 'sq-saved-chats-v3',\n templateUrl: 'saved-chats.component.html',\n styleUrls: ['saved-chats.component.scss'],\n standalone: true,\n providers: [provideTranslocoScope('saved-chats', 'chat')],\n imports: [CommonModule, FormsModule, TooltipDirective, DialogRenameSavedChatComponent, DialogDeleteSavedChatComponent, TranslocoPipe]\n})\nexport class SavedChatsComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output() load = new EventEmitter<SavedChat>();\n @Output() delete = new EventEmitter<SavedChat>();\n\n chatService: ChatService;\n subscription = new Subscription();\n groupedSavedChats$ = new BehaviorSubject<{ key: string, value: SavedChat[] }[]>([]);\n\n public instanceManagerService = inject(InstanceManagerService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n private readonly assistantUtils = inject(AssistantUtils);\n\n ngOnInit(): void {\n this.subscription.add(\n of(isAuthenticated()).pipe(\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n this.onListSavedChat();\n if (!!this.chatService.assistantConfig$.value!.savedChatSettings?.enabled) {\n this.chatService.listSavedChat();\n }\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onListSavedChat() {\n this.subscription.add(\n combineLatest([\n this.chatService.savedChats$,\n this.transloco.langChanges$\n ]).pipe(\n filter(([savedChats]) => !!savedChats)\n ).subscribe(([savedChats]) => this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats)))\n );\n }\n\n onLoad(savedChat: SavedChat) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.generateChatId(savedChat.id);\n this.chatService.loadSavedChat$.next(savedChat);\n this.chatService.listSavedChat(); // assuming saved chats operations are certainly enabled at this level\n this.load.emit(savedChat);\n }\n\n private _groupSavedChatsByDate(savedChats: SavedChat[]): { key: string, value: SavedChat[] }[] {\n const groupedSavedChats = new Map<string, SavedChat[]>();\n\n savedChats\n .sort((a, b) => parseISO(b.modifiedUTC).getTime() - parseISO(a.modifiedUTC).getTime())\n .forEach(savedChat => {\n const groupKey = this.assistantUtils.getTimeKey(toDate(parseISO(savedChat.modifiedUTC))); // Must convert the UTC date to local date before passing to _getTimeKey\n\n if (!groupedSavedChats.has(groupKey)) {\n groupedSavedChats.set(groupKey, []);\n }\n\n groupedSavedChats.get(groupKey)!.push(savedChat);\n });\n\n return Array.from(groupedSavedChats, ([key, value]) => ({ key, value }));;\n }\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngIf=\"chatService.savedChatsError$ | async\" class=\"alert alert-danger\">\n {{ 'savedChats.listError' | transloco }}\n </div>\n <div *ngFor=\"let group of (groupedSavedChats$ | async)\" class=\"saved-chats\">\n <div class=\"saved-chat-date\">{{group.key}}</div>\n <div *ngFor=\"let savedChat of group.value\"\n (click)=\"onLoad(savedChat)\"\n class=\"saved-chat p-2\"\n [class.forbidden]=\"(chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\"\n [class.active]=\"chatService.chatId === savedChat.id\">\n <span class=\"title me-1\" [sqTooltip]=\"savedChat.title\">{{savedChat.title}}</span>\n <i class=\"saved-chat-actions fas fa-pen mx-1\" [sqTooltip]=\"'savedChats.rename' | transloco\" (click)=\"renameDialog.showModal($event, savedChat)\"></i>\n <i class=\"saved-chat-actions fas fa-trash ms-1\" [sqTooltip]=\"'savedChats.delete' | transloco\" (click)=\"deleteDialog.showModal($event, savedChat)\"></i>\n </div>\n </div>\n</ng-container>\n\n<sq-dialog-delete-saved-chat [chatService]=\"chatService\" (delete)=\"delete.emit($event)\" #deleteDialog />\n<sq-dialog-rename-saved-chat [chatService]=\"chatService\" #renameDialog />\n","import { CommonModule } from \"@angular/common\";\nimport { Component, input, OnDestroy, OnInit } from \"@angular/core\";\nimport { ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { Subscription } from 'rxjs';\n\nexport type PromptOptions = {\n title?: string,\n message: string,\n messageParams?: any,\n rowCount?: number,\n output?: string,\n validators?: any\n};\n\n@Component({\n selector: \"sq-chat-prompt\",\n template: `\n <dialog [title]=\"title\" #dialog>\n @if(title) {\n <h5 class=\"modal-title\">{{title}}</h5>\n }\n <form name=\"prompt\" novalidate [formGroup]=\"form\">\n <div class=\"mb-3 sq-form-group\">\n <label class=\"form-label\" for=\"input\">{{model().message}}</label>\n @if(!model().rowCount) {\n <input type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"off\">\n }\n @if(!!model().rowCount) {\n <textarea type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"on\" rows=\"{{model().rowCount}}\"></textarea>\n }\n </div>\n </form>\n <section class=\"flex justify-end gap-2 mt-4\">\n <button class=\"btn btn-ghost outline-none w-24\" (click)=\"dialog.close()\">\n Cancel\n </button>\n\n <button class=\"btn btn-primary w-24\">\n OK\n </button>\n </section>\n </dialog>\n `,\n standalone: true,\n imports: [CommonModule, ReactiveFormsModule],\n})\nexport class ChatPrompt implements OnInit, OnDestroy {\n inputControl: UntypedFormControl;\n form: UntypedFormGroup;\n formChanges: Subscription;\n\n model = input<PromptOptions>({} as PromptOptions);\n\n constructor(protected formBuilder: UntypedFormBuilder) {}\n\n ngOnInit() {\n this.inputControl = new UntypedFormControl(this.model().output, this.model().validators || Validators.required);\n this.form = this.formBuilder.group({\n input: this.inputControl\n });\n this.formChanges.add(\n this.form.valueChanges.subscribe(() => this.model().output = this.inputControl.value)\n );\n }\n\n ngOnDestroy() {\n this.formChanges.unsubscribe();\n }\n\n get title(): string {\n return this.model().title ?? \"msg#modal.prompt.title\";\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { ChatService } from '../chat.service';\nimport { BehaviorSubject, catchError, filter, from, map, Observable, take } from 'rxjs';\nimport { deleteDocumentsResponse, IndexingInfos, UploadConfig, UploadedDocuments, UploadEvent } from './documents-upload.model';\nimport { HttpClient, HttpEventType, HttpHeaders, HttpResponse, HttpUploadProgressEvent } from '@angular/common/http';\nimport { AppService } from '../services/app.service';\nimport { getToken, globalConfig, post } from '@sinequa/atomic';\n\n@Injectable()\nexport class DocumentsUploadService {\n\n /** Name of the assistant plugin. */\n public REQUEST_URL: string;\n /** Documents' upload configuration. */\n uploadConfig$ = new BehaviorSubject<UploadConfig | undefined>(undefined);\n public chatService: ChatService;\n\n public appService = inject(AppService);\n public http = inject(HttpClient);\n\n /**\n * Initializes the file upload service with the provided chat service instance.\n *\n * @param chatService - An instance of ChatService. If not provided, an error is thrown.\n * @throws {Error} If the chatService instance is not provided or if there is an error during initialization.\n */\n init(chatService: ChatService | undefined): void {\n if (!chatService) throw new Error('A chatService instance must be provided');\n\n this.chatService = chatService;\n try {\n this.getRequestsUrl();\n this.getUploadConfig();\n } catch (error) {\n throw new Error(error);\n }\n }\n\n /**\n * Fetch the endpoint to use for the file upload related requests\n * @throws {Error} If the property 'restEndpoint' is not provided in the assistant configuration\n */\n getRequestsUrl() {\n if (!!this.chatService.assistantConfig$.value!.connectionSettings.restEndpoint) {\n this.REQUEST_URL = this.chatService.assistantConfig$.value!.connectionSettings.restEndpoint;\n } else {\n throw new Error(`The property 'restEndpoint' must be provided when attempting to use 'REST' in assistant instance`);\n }\n }\n\n /**\n * Retrieves the upload configuration for documents.\n * The response, which contains the upload configuration, is emitted to the `uploadConfig$` observable.\n *\n * @throws {Error} If there is an error invoking the `documentsUploadConfigGet` action.\n */\n public getUploadConfig(): void {\n const data = {\n action: \"documentsUploadConfigGet\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n from(post<UploadConfig>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n take(1),\n catchError((error) => {\n throw new Error(`Error invoking documentsUploadConfigGet: ${error}`);\n })\n ).subscribe((res: UploadConfig) => this.uploadConfig$.next(res));\n }\n\n /**\n * Uploads documents to the server.\n *\n * This method takes a FormData object which should contain all files to be uploaded.\n * Each file should be appended to the FormData object with its original name.\n *\n * For example:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * ```\n *\n * @param formData - The FormData object containing the files to be uploaded.\n * - Each file should be appended to the FormData object with its original name.\n * For example:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * ```\n *\n * @param enableProgress - (Optional) A boolean parameter that controls whether progress reporting is enabled.\n * - Defaults to `true`.\n * - 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.\n * - If `false`, progress events are not reported.\n *\n * @returns An Observable that emits events of type `UploadEvent`:\n * - `UploadProgressEvent`: Emitted during the upload process, containing:\n * - * `type`: \"uploadProgress\" - The type of the event.\n * - * `loaded`: number - The number of bytes uploaded so far.\n * - * `total`: number - The total number of bytes to be uploaded (if available).\n * - * `progress`: number - The percentage of upload progress (calculated as `(loaded / total) * 100`).\n * - `UploadResponseEvent`: Emitted when the upload is complete, containing:\n * - * `type`: \"response\" - The type of the event.\n * - * `body`: `UploadResponse` - The server's response, including:\n * - * - * `statusToken`: string - A token to track the status of the indexing process.\n * - * - * `executionTime`: string - The time taken to execute the upload.\n * - * - * `connectorResponse` (optional): Additional response data from the connector, containing:\n * - * - * - * `collection`: string - The collection name.\n * - * - * - * `action`: string - The action performed.\n * - * - * - * `stats`: object - Statistics about the upload, including:\n * - * - * - * - * `nbDocUpdated`: number - The number of documents updated.\n *\n * @throws {Error} If there is an error invoking the `documentsupload` action.\n *\n * Example usage:\n * ```typescript\n * const formData = new FormData();\n * formData.append(file.name, file.file);\n * this.documentsUploadService.uploadDocuments(formData).subscribe(event => {\n * if (event.type === 'uploadProgress') {\n * console.log(`Progress: ${event.progress}%`);\n * } else if (event.type === 'response') {\n * console.log('Upload complete:', event.body);\n * }\n * });\n * ```\n */\n public uploadDocuments(formData: FormData, enableProgress: boolean = true): Observable<UploadEvent> {\n // Add the required \"data\" field as a JSON string\n const data = {\n action: \"documentsupload\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n formData.append('data', JSON.stringify(data));\n\n let headers = new HttpHeaders({ 'Accept': 'application/json' });\n const token = getToken();\n if(token){\n headers = headers.append('sinequa-csrf-token',token);\n }\n const options: any = {\n headers: headers,\n observe: 'events',\n };\n if (enableProgress) options['reportProgress'] = true;\n\n const url = `${globalConfig.backendUrl}/${globalConfig.apiPath}/plugin/${this.REQUEST_URL}`;\n /**\n * Need to use the HttpClient directly to avoid the JSONMethodPluginService's behavior\n * because it is altering the request and thus making it unable to properly set the Content-Type header with the boundary\n */\n return this.http.post<any>(url, formData, options).pipe(\n filter((event): event is HttpUploadProgressEvent | HttpResponse<any> =>\n event.type === HttpEventType.Response || (enableProgress && event.type === HttpEventType.UploadProgress)\n ),\n map((event): UploadEvent => {\n switch (event.type) {\n case HttpEventType.UploadProgress: {\n const { loaded = 0, total = 0 } = event;\n return { type: 'uploadProgress', loaded, total, progress: total > 0 ? Math.round((loaded / total) * 100) : 0 };\n }\n case HttpEventType.Response:\n return { type: 'response', body: event.body };\n default:\n throw new Error(\"Unexpected event type\"); // Should not reach here, but for typescript sake.\n }\n }),\n catchError((error) => {\n throw new Error(`Error invoking documentsupload: ${error}`);\n })\n );\n }\n\n /**\n * Retrieves the indexing status of a predefined uploaded document(s)\n * based on the provided status token returned from the upload process.\n *\n * @param token - The status token used to track the indexing process.\n * @returns An Observable that emits the server response of type `IndexingResponse`.\n * The `IndexingResponse` object contains:\n * - `docs`: array - An array of document status objects, each containing:\n * - * `id`: string - The document ID.\n * - * `fileName`: string - The name of the file.\n * - * `operation`: \"Add\" | \"Update\" - The operation performed on the document.\n * - * `status`: \"Indexing\" | \"Indexed\" | \"Error\" - The status of the document.\n * - * `previousIndexationTime`: string | null - The previous indexation time.\n * - * `currentIndexationTime`: string | null - The current indexation time.\n * - `executionTime`: string - The time taken to retrieve the indexing status.\n * @throws {Error} If there is an error invoking the `documentsUploadStatus` action.\n */\n public getIndexingStatus(token: string): Observable<IndexingInfos> {\n const data = {\n action: \"documentsUploadStatus\",\n appName: this.appService.appName,\n statusToken: token,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<IndexingInfos>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsUploadStatus: ${error}`);\n })\n );\n }\n\n /**\n * Retrieves a list of uploaded documents.\n *\n * @param {string[]} [columns] - Optional array of additional index columns to include for each document.\n * @param {number} [skip] - Optional number of documents to skip for pagination. If set, count also needs to be set. No skip if not set.\n * @param {number} [count] - Optional number of documents to take for pagination (unlimited if not set).\n * @returns {Observable<UploadedDocuments>} An observable that emits the list of uploaded documents.\n * The `UploadedDocuments` object contains:\n * - `docs`: array - An array of objects representing a single document with the following properties:\n * - * `id`: string - A unique identifier for the document.\n * - * `fileName`: string - The name of the file.\n * - * `title`: string - The title of the document.\n * - * `fileExt`: string - The file extension of the document.\n * - * `indexationTime`: string - The time when the document was indexed.\n * - * `size`: number - The size of the document.\n * - * `sizeDisplay`: string - A human-readable representation of the document size.\n * - * `[key: string]`: any - Additional columns asked in the request, value of the column for the document.\n * - `count`: number - The count of documents in the current batch or subset.\n * - `totalCount`: number - The total count of documents available.\n * - `executionTime`: string - The time taken to process the documents.\n * @throws {Error} Throws an error if the request fails.\n */\n public getDocumentsList(columns?: string[], skip?: number, count?: number): Observable<UploadedDocuments> {\n const data = {\n action: \"documentsList\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n if (columns) data[\"columns\"] = columns;\n if (skip) data[\"skip\"] = skip;\n if (count) data[\"count\"] = count;\n\n return from(post<UploadedDocuments>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsList: ${error}`);\n })\n );\n }\n\n /**\n * Deletes the uploaded documents with the specified IDs.\n *\n * @param docIds - An array of document IDs to delete.\n * @returns An observable that emits the server response of type `deleteDocumentsResponse`.\n * The `deleteDocumentsResponse` object contains:\n * - `deletedCount`: number - The number of deleted documents.\n * - `executionTime`: string - The time taken to delete the documents.\n * @throws {Error} If there is an error invoking the `documentsDelete` action.\n */\n public deleteDocuments(docIds: string[]): Observable<deleteDocumentsResponse> {\n const data = {\n action: \"documentsDelete\",\n docIds,\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<deleteDocumentsResponse>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsDelete: ${error}`);\n })\n );\n }\n\n /**\n * Deletes all uploaded documents.\n *\n * @returns An observable that emits the server response of type `deleteDocumentsResponse`.\n * The `deleteDocumentsResponse` object contains:\n * - `deletedCount`: number - The number of deleted documents.\n * - `executionTime`: string - The time taken to delete the documents.\n * @throws {Error} If there is an error invoking the `documentsDeleteAll` action.\n */\n public deleteAllDocuments(): Observable<deleteDocumentsResponse> {\n const data = {\n action: \"documentsDeleteAll\",\n appName: this.appService.appName,\n debug: this.chatService.assistantConfig$.value!.defaultValues.debug\n };\n\n return from(post<deleteDocumentsResponse>(`plugin/${this.REQUEST_URL}`, data)).pipe(\n catchError((error) => {\n throw new Error(`Error invoking documentsDeleteAll: ${error}`);\n })\n );\n }\n\n /**\n * Formats the given file size in bytes into a human-readable string.\n *\n * @param bytes - The size of the file in bytes.\n * @returns A string representing the file size in a human-readable format (e.g., \"10.24 KB\", \"1.00 MB\").\n */\n public formatFileSize(bytes: number): string {\n if (bytes === 0) return \"0 Bytes\";\n const k = 1024;\n const sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return (\n Number.parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + \" \" + sizes[i]\n );\n }\n\n /**\n * Converts the given file size in bytes into megabytes.\n *\n * @param bytes - The size of the file in bytes.\n * @returns The size of the file in megabytes.\n */\n public convertBytesToMB(bytes: number): number {\n return bytes / (1024 * 1024);\n }\n\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n Component,\n inject,\n Input,\n OnDestroy,\n OnInit,\n ViewChild,\n} from \"@angular/core\";\nimport { NgxFlowModule, FlowDirective, Transfer } from \"@flowjs/ngx-flow\";\nimport { FlowFile } from \"flowjs\";\nimport {\n BehaviorSubject,\n catchError,\n EMPTY,\n filter,\n finalize,\n interval,\n Subscription,\n switchMap,\n takeWhile,\n tap,\n startWith,\n of,\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { ChatConfig } from \"../../types\";\nimport { IndexingInfos, UploadEvent, UploadingInfos } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-upload\",\n templateUrl: \"./document-upload.component.html\",\n styleUrls: [\"./document-upload.component.scss\"],\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, NgxFlowModule, FormatIconComponent, TranslocoPipe]\n})\nexport class DocumentUploadComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n /** Polling interval in milliseconds to update the indexing status of the uploaded documents */\n @Input() pollingInterval : number = 1000;\n // Reference to the flow directive\n @ViewChild(\"flow\", { static: true }) flow!: FlowDirective;\n\n public chatService: ChatService;\n readonly flowConfig: flowjs.FlowOptions = {\n // Disables chunk testing before uploading actual file data. Thus, avoids unnecessary requests and speeds up uploads\n testChunks: false,\n // Allows multiple file uploads simultaneously\n singleFile: false,\n // Allows the same file to be uploaded multiple times\n allowDuplicateUploads: true,\n query: () => {\n return {}; // Empty object to prevent query parameters\n },\n preprocess: (chunk) => chunk.abort() // Prevents the default flow upload of chunks\n };\n public errorAlerts: string[] = [];\n public dragging$ = new BehaviorSubject<boolean>(false);\n public indexing$ = new BehaviorSubject<boolean>(false);\n public indexingInfos$ = new BehaviorSubject<IndexingInfos | undefined>(undefined);\n public uploading$ = new BehaviorSubject<boolean>(false);\n public uploadingInfos$ = new BehaviorSubject<UploadingInfos | undefined>(undefined);\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n\n this._subscription.add(\n this.flow.events$.subscribe((event) => {\n const evt = event as any;\n // Kept it just for reference to show how to access data of different events\n if (event.type === \"filesAdded\") {\n const addedFiles = evt.event[0] as FlowFile[];\n this._onFilesAdded(addedFiles);\n }\n if (event.type === \"filesSubmitted\") {\n this._onFilesSubmitted();\n }\n })\n );\n\n // Override the upload method of the flow directive\n this.flow.upload = this.startUpload.bind(this);\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Handles the submission of files.\n *\n * @remarks\n * This method performs the following checks on the submitted files:\n *\n * 1. Checks if the number of files submitted exceeds the remainingFileCount defined in the constraints.\n * - If the number of files exceeds the allowed count, all files are removed from the flow.\n * - An error message is added to the error alerts.\n *\n * 2. Checks if the total size of the files submitted exceeds the remainingFileSize defined in the constraints.\n * - If the total size exceeds the allowed size, all files are removed from the flow.\n * - An error message is added to the error alerts.\n *\n * 3. Checks if the file extension of the files submitted is not allowed.\n * - If the file extension is not allowed, the file is removed from the flow.\n * - An error message is added to the error alerts.\n */\n private _onFilesSubmitted() {\n // Get all files from the flow\n const files = [...this.flow.flowJs.files];\n // Clear the error alerts\n this.errorAlerts = [];\n const errors: string[] = [];\n\n /**\n * Checks if the number of files submitted exceeds the remainingFileCount defined in the constraints.\n * If the number of files exceeds the allowed count, all files are removed from the flow\n * An error message is added to the error alerts.\n */\n if (files.length > this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileCount) {\n for (const file of files) {\n this.flow.flowJs.removeFile(file);\n }\n errors.push(this.transloco.translate('chatDocumentsUpload.filesNumberLimitExceeded', { max: this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileCount }));\n }\n\n /**\n * Checks if the total size of the files submitted exceeds the remainingFileSize defined in the constraints.\n * If the total size exceeds the allowed size, all files are removed from the flow\n * An error message is added to the error alerts.\n *\n * @remarks\n * The maximum size of the files that can be uploaded is temporary set to the maximum of 128 MB and the remainingFileSizeMB defined in the constraints.\n * Waiting for the plugin to handle this kestrel issue\n */\n else if (this.documentsUploadService.convertBytesToMB(this.flow.flowJs.getSize()) > Math.min(128, this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileSizeMB)) {\n for (const file of files) {\n this.flow.flowJs.removeFile(file);\n }\n errors.push(this.transloco.translate('chatDocumentsUpload.filesSizeLimitExceeded', { max: Math.min(128, this.documentsUploadService.uploadConfig$.value!.constraints.remainingFileSizeMB) }))\n }\n\n /**\n * Checks if the file extension of the files submitted is not allowed.\n * If the file extension is not allowed, the file is removed from the flow\n * An error message is added to the error alerts.\n */\n else {\n for (const file of files) {\n if (!this.documentsUploadService.uploadConfig$.value!.constraints.supportedFileExtensions.includes(`${file.getExtension()}`)) {\n this.flow.flowJs.removeFile(file);\n errors.push(this.transloco.translate('chatDocumentsUpload.fileExtensionUnsupported', { extension: file.getExtension() }));\n }\n }\n }\n\n // Add unique error messages to the error alerts\n this.errorAlerts = [...new Set(errors)];\n }\n\n private _onFilesAdded(files: FlowFile[]) {}\n\n onDragenter() {\n this.dragging$.next(true);\n }\n\n onDragleave(event: DragEvent) {\n if (\n !event.relatedTarget ||\n !(event.relatedTarget as HTMLElement).closest(\".dropzone\")\n ) {\n this.dragging$.next(false);\n }\n }\n\n onDrop() {\n this.dragging$.next(false);\n }\n\n trackTransfer(transfer: Transfer) {\n return transfer.id;\n }\n\n\n /**\n * Initiates the upload process by invoking the `upload` method\n * of the `flow` instance.\n * The `upload` method is overridden in the `ngOnInit` method to match the requirements of the assistant API.\n */\n upload() {\n this.flow.upload();\n }\n\n /**\n * Initiates the file upload process by preparing the form data,\n * setting the uploading flag, and making an API call to upload the files.\n *\n * @remarks\n * - Collects all files from the `flowJs` instance and appends them to a `FormData` object.\n * - Subscribes to the upload process to handle progress updates, completion, and errors.\n * - Triggers tracking the indexing process upon successful upload completion.\n * - Cleans up the `flow` instance after the upload process is finalized.\n */\n private startUpload() {\n const formData = new FormData();\n\n // Add all files with their original names\n this.flow.flowJs.files.forEach((file) => {\n formData.append(file.name, file.file);\n });\n\n // Clear the error alerts\n this.errorAlerts = [];\n // Set the uploading flag to true\n this.uploading$.next(true);\n\n // Make the API call to upload the files\n this._subscription.add(\n this.documentsUploadService.uploadDocuments(formData).pipe(\n tap((event: UploadEvent) => {\n if (event.type === 'uploadProgress') {\n this.uploadingInfos$.next(event as UploadingInfos);\n }\n if (event.type === 'response') {\n this.trackIndexingProcess(event.body.statusToken);\n }\n }),\n catchError((err) => {\n this.uploading$.next(false); // Set the uploading flag to false ONLY in case of an error. Otherwise, keep it true until the start of indexing process in order to prevent flickering of the UI\n this.uploadingInfos$.next(undefined); // Clear the uploading infos\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorUploadingFiles'));\n return EMPTY;\n }),\n finalize(() => {\n // Clear the flow instance after the upload is complete or an error occurs\n this.flow.cancel();\n })\n ).subscribe()\n );\n }\n\n /**\n * Tracks the indexing process for a single documents upload session by polling the API for its status.\n *\n * @param token - A unique token representing the single documents upload session.\n *\n * @remarks\n * - Clears the uploading flags and sets the indexing flag to true before starting the process.\n * - Polls the API every (pollingInterval: default = 1 second) to retrieve the current indexing status.\n * - Updates the `indexingInfos` property with the latest status.\n * - Stops polling when the indexing process is completed or an error occurs.\n * - Cleans up by resetting the indexing flags and clearing the `indexingInfos` property when the process is finalized.\n */\n trackIndexingProcess(token: string) {\n // Clear the uploading flags\n this.uploading$.next(false);\n this.uploadingInfos$.next(undefined);\n // Set the indexing flag to true\n this.indexing$.next(true);\n\n // Combine immediate API call with interval-based polling\n this._subscription.add(\n interval(this.pollingInterval).pipe(\n startWith(0), // Trigger the API call immediately\n switchMap(() => this.documentsUploadService.getIndexingStatus(token)),\n tap((res: IndexingInfos) => this.indexingInfos$.next(res)),\n takeWhile((response: IndexingInfos) => !response.isCompleted, true),\n catchError((err) => {\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorIndexingStatus'));\n return EMPTY;\n }),\n finalize(() => {\n // Clear the indexing flags\n this.indexing$.next(false);\n this.indexingInfos$.next(undefined);\n })\n ).subscribe()\n );\n }\n\n /**\n * Calculates the indexing progress as a percentage of completed documents.\n *\n * @param infos - The indexing information containing the list of documents and their statuses.\n * @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).\n * Returns 0 if the input is invalid or there are no documents.\n */\n getIndexingProgress(infos: IndexingInfos | undefined): number {\n if (!infos || !infos.docs) return 0;\n const completed = infos.docs.filter(doc => doc.status === \"Indexed\" || doc.status === \"Error\").length;\n const total = infos.docs.length;\n return completed/total;\n }\n\n}\n","<ng-container #flow=\"flow\" [flowConfig]=\"flowConfig\"></ng-container>\n<div class=\"file-upload-container\">\n <input\n type=\"file\"\n flowButton\n [flow]=\"flow.flowJs\"\n multiple\n hidden\n #fileInput>\n <div\n flowDrop\n [flow]=\"flow.flowJs\"\n (dragenter)=\"onDragenter()\"\n (dragleave)=\"onDragleave($event)\"\n (drop)=\"onDrop()\"\n (click)=\"fileInput.click()\"\n class=\"dropzone\"\n [ngClass]=\"{'dropzone--active': (dragging$ | async)}\"\n [hidden]=\"(uploading$ | async) || (indexing$ | async)\">\n <ng-container *ngIf=\"!(dragging$ | async); else draggingContent\">\n <i class=\"fas fa-cloud-upload-alt\"></i>\n <span>{{ 'chatDocumentsUpload.dragAndDrop' | transloco }}</span>\n <span class=\"text-orange\">{{ 'chatDocumentsUpload.clickToBrowse' | transloco }}</span>\n </ng-container>\n <ng-template #draggingContent>\n <span>{{ 'chatDocumentsUpload.dropFiles' | transloco }}</span>\n </ng-template>\n </div>\n\n <div *ngIf=\"(uploading$ | async) || (indexing$ | async)\" class=\"dropzone dropzone--active\">\n <ng-container *ngIf=\"(uploading$ | async); else indexingState\">\n <i class=\"fas fa-spinner fa-pulse\"></i>\n <span>\n {{ 'chatDocumentsUpload.uploadingFiles' | transloco: { count: (flow.transfers$ | async)!.transfers.length } }}\n </span>\n <span *ngIf=\"(uploadingInfos$ | async) as uploadingInfos\">{{ uploadingInfos.progress | number:'1.0-0' }}%</span>\n </ng-container>\n <ng-template #indexingState>\n <i class=\"fas fa-spinner fa-pulse\"></i>\n <ng-container *ngIf=\"indexingInfos$ | async as indexingInfo\">\n <span>\n {{ 'chatDocumentsUpload.indexingFiles' | transloco: { count: indexingInfo.docs.length } }}\n </span>\n <span>{{ getIndexingProgress(indexingInfo) * 100 | number:'1.0-0' }}%</span>\n </ng-container>\n </ng-template>\n </div>\n\n <ul *ngIf=\"errorAlerts.length > 0\" class=\"error-list mt-3\">\n <li *ngFor=\"let error of errorAlerts\">\n {{ error }}\n </li>\n </ul>\n\n <div *ngIf=\"((flow.transfers$ | async)?.transfers?.length > 0) && !(uploading$ | async)\" class=\"file-list mt-3\">\n <ul>\n <li *ngFor=\"let transfer of (flow.transfers$ | async)!.transfers; trackBy: trackTransfer\">\n <sq-format-icon [extension]=\"transfer.flowFile.getExtension()\" class=\"me-1\"></sq-format-icon>\n <span [title]=\"transfer.name\">{{ transfer.name }}</span>\n <i class=\"fas fa-trash ms-1\" (click)=\"flow.cancelFile(transfer)\" [title]=\"'chatDocumentsUpload.cancel' | transloco\"></i>\n </li>\n </ul>\n </div>\n\n <div class=\"d-flex mt-2\">\n <button\n type=\"button\"\n class=\"btn btn-light cancel-btn me-2\"\n (click)=\"flow.cancel()\"\n [disabled]=\"!((flow.transfers$ | async)?.transfers?.length > 0) || (uploading$ | async) || (indexing$ | async)\">\n {{ 'chatDocumentsUpload.cancel' | transloco }}\n </button>\n <button\n type=\"button\"\n class=\"upload-btn\"\n (click)=\"upload()\"\n [disabled]=\"!((flow.transfers$ | async)?.transfers?.length > 0) || (uploading$ | async) || (indexing$ | async)\">\n {{ 'chatDocumentsUpload.upload' | transloco }}\n </button>\n </div>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport { Component, inject, Input, OnDestroy, OnInit } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n combineLatest,\n EMPTY,\n filter,\n of,\n Subscription,\n switchMap,\n take,\n tap\n} from \"rxjs\";\nimport {\n parseISO,\n toDate\n} from \"date-fns\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { AssistantUtils } from \"../../utils/utils.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { ChatConfig } from \"../../types\";\nimport { UploadedDocument } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-list\",\n templateUrl: \"./document-list.component.html\",\n styleUrls: [\"./document-list.component.scss\"],\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, FormatIconComponent, TranslocoPipe],\n})\nexport class DocumentListComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n public chatService: ChatService;\n public groupedUploadedDocuments$ = new BehaviorSubject<{ key: string; value: UploadedDocument[]}[]>([]);\n\n public documentToDelete?: UploadedDocument;\n public deletingAll: boolean = false;\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n private readonly assistantUtils = inject(AssistantUtils);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n tap((_) => this.updateUploadedDocumentsList()),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Updates the list of uploaded documents by fetching the latest data from the service.\n * The fetched documents are grouped by date.\n *\n * @returns {void}\n */\n updateUploadedDocumentsList(): void {\n this._subscription.add(\n combineLatest([\n this.documentsUploadService.getDocumentsList(),\n this.transloco.langChanges$\n ]).pipe(\n tap(([uploadedDocuments]) => {\n this.groupedUploadedDocuments$.next(this._groupUploadedDocumentsByDate(uploadedDocuments.docs))\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n deleteDocument(event: Event, doc: UploadedDocument): void {\n event.stopPropagation();\n this.documentToDelete = doc;\n }\n\n /**\n * Handles the deletion of an uploaded document. This method triggers a confirmation modal\n * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request\n * to delete the document and provides feedback to the user upon success or failure.\n *\n * @param event - The event object associated with the delete action, used to stop propagation.\n * @param doc - The document to be deleted, represented as an instance of `UploadedDocument`.\n *\n * @remarks\n * - Displays a confirmation modal with a warning message.\n * - On confirmation, deletes the document.\n * - Shows a success notification upon successful deletion.\n * - Logs and notifies the user of any errors encountered during the deletion process.\n */\n performDeleteDocument(): void {\n this._subscription.add(\n this.documentsUploadService.deleteDocuments([this.documentToDelete!.id])\n .pipe(\n tap(() => {\n this.notificationsService.success(this.transloco.translate('chatDocumentsUpload.deleteDocumentSuccess', { title: this.documentToDelete!.fileName }));\n this.documentToDelete = undefined;\n this.updateUploadedDocumentsList();\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.deleteDocumentError', { title: this.documentToDelete!.fileName }));\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n\n }\n\n deleteAllDocuments(event?: Event): void {\n event?.stopPropagation();\n this.deletingAll = true;\n }\n\n /**\n * Handles the deletion of all uploaded documents. This method triggers a confirmation modal\n * to ensure the user wants to proceed with the deletion. If confirmed, it sends a request\n * to delete the whole list of documents and provides feedback to the user upon success or failure.\n *\n * @param event - (Optional) The event object associated with the delete action, used to stop propagation.\n *\n * @remarks\n * - Displays a confirmation modal with a warning message.\n * - On confirmation, deletes all documents.\n * - Shows a success notification upon successful deletion.\n * - Logs and notifies the user of any errors encountered during the deletion process.\n */\n performDeleteAllDocuments(): void {\n this._subscription.add(\n this.documentsUploadService.deleteAllDocuments()\n .pipe(\n tap(() => {\n this.deletingAll = false;\n this.notificationsService.success(this.transloco.translate('chatDocumentsUpload.deleteAllDocumentsSuccess'));\n this.updateUploadedDocumentsList();\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.deleteAllDocumentsError'));\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n private _groupUploadedDocumentsByDate(docs: UploadedDocument[]): { key: string; value: UploadedDocument[] }[] {\n const groupedUploadedDocuments = new Map<string, UploadedDocument[]>();\n\n docs\n .sort((a, b) => parseISO(b.indexationTime).getTime() - parseISO(a.indexationTime).getTime())\n .forEach(doc => {\n const groupKey = this.assistantUtils.getTimeKey(toDate(parseISO(doc.indexationTime))); // Must convert the UTC date to local date before passing to _getTimeKey\n\n if (!groupedUploadedDocuments.has(groupKey)) {\n groupedUploadedDocuments.set(groupKey, []);\n }\n\n groupedUploadedDocuments.get(groupKey)!.push(doc);\n });\n\n return Array.from(groupedUploadedDocuments, ([key, value]) => ({ key, value }));;\n }\n}\n","<div class=\"alert alert-danger\" *ngIf=\"deletingAll\">\n <span>{{ 'chatDocumentsUpload.deleteAllDocumentsText' | transloco }}</span>\n <div class=\"d-flex gap-2\">\n <button class=\"btn btn-light w-100\" (click)=\"deletingAll=false\">{{ 'chatDocumentsUpload.cancel' | transloco }}</button>\n <button class=\"btn btn-secondary w-100\" (click)=\"performDeleteAllDocuments()\">{{ 'chatDocumentsUpload.confirm' | transloco }}</button>\n </div>\n</div>\n\n<div *ngFor=\"let group of (groupedUploadedDocuments$ | async)\" class=\"uploaded-docs\">\n <span class=\"uploaded-docs-date\">{{group.key}}</span>\n <div *ngFor=\"let doc of group.value\">\n <div class=\"uploaded-doc p-2\">\n <sq-format-icon [extension]=\"doc.fileExt\" class=\"me-1\"></sq-format-icon>\n <span class=\"title me-1\" [title]=\"doc.fileName\">{{doc.fileName}}</span>\n <i class=\"uploaded-doc-actions fas fa-trash ms-1\" [title]=\"'chatDocumentsUpload.delete' | transloco\"\n (click)=\"deleteDocument($event, doc)\"></i>\n </div>\n\n <div class=\"alert alert-warning\" *ngIf=\"documentToDelete && documentToDelete.id === doc.id\">\n <span>\n {{ 'chatDocumentsUpload.deleteDocumentText' | transloco: { title: documentToDelete!.fileName } }}\n </span>\n <div class=\"d-flex gap-2\">\n <button class=\"btn btn-light w-100\" (click)=\"documentToDelete=undefined\">{{ 'chatDocumentsUpload.cancel' | transloco }}</button>\n <button class=\"btn btn-secondary w-100\" (click)=\"performDeleteDocument()\">{{ 'chatDocumentsUpload.confirm' | transloco }}</button>\n </div>\n </div>\n </div>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n EMPTY,\n filter,\n of,\n Subscription,\n switchMap,\n take,\n tap\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { InstanceManagerService } from \"../../instance-manager.service\";\nimport { ChatService } from \"../../chat.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { ChatConfig } from \"../../types\";\nimport { UploadedDocument, UploadedDocuments } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\n\n@Component({\n selector: \"sq-document-overview\",\n templateUrl: \"./document-overview.component.html\",\n standalone: true,\n providers: [DocumentsUploadService, provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, TranslocoPipe],\n styles: [`\n.overview-text {\n font-style: italic;\n padding: .5rem .8rem;\n}\n `]\n})\nexport class DocumentOverviewComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n @Input() disabledUpload: boolean = true;\n\n @Output() onUpload = new EventEmitter();\n\n public chatService: ChatService;\n public uploadedDocuments$ = new BehaviorSubject<UploadedDocument[]>([]);;\n\n private _subscription = new Subscription();\n\n public instanceManagerService = inject(InstanceManagerService);\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n tap((_) => this.instantiateChatService()),\n switchMap((_) => this.chatService.assistantConfig$),\n filter((config: ChatConfig | undefined) => !!config),\n tap((_) => this.documentsUploadService.init(this.chatService)),\n tap((_) => this.updateUploadedDocumentsList()),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\n )\n .subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this._subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n /**\n * Updates the list of uploaded documents by fetching the latest data from the service.\n *\n * @returns {void}\n */\n updateUploadedDocumentsList(): void {\n this._subscription.add(\n this.documentsUploadService.getDocumentsList()\n .pipe(\n tap((uploadedDocuments: UploadedDocuments) => {\n this.uploadedDocuments$.next(uploadedDocuments.docs)\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n }),\n take(1)\n )\n .subscribe()\n );\n }\n\n}\n","<div class=\"d-flex\">\n <span class=\"overview-text flex-grow-1\">\n {{ 'chatDocumentsUpload.uploadedDocuments' | transloco: { count: (uploadedDocuments$ | async)?.length || 0 } }}\n </span>\n <button disabled class=\"btn btn-light\" [title]=\"'chatDocumentsUpload.uploadToSources' | transloco\" (click)=\"onUpload.emit()\" [disabled]=\"disabledUpload\">\n <i class=\"fas fa-cloud-upload-alt\"></i>\n </button>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","getContentNodes","handleLeadingText","handleTrailingText","i1.UIService","i2.PrincipalService","i3","tap","switchMap","take","map","catchError","Prism","i2.DebugMessageService","finalize","i1.DebugMessageService","i2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGG;MAIU,sBAAsB,CAAA;AAHnC,IA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