@sinequa/assistant 3.10.11 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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/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/markdown-it/markdown-it.config.ts","../../../projects/assistant/chat/smart-renderer/smart-renderer.ts","../../../projects/assistant/chat/tooltip/tooltip.component.ts","../../../projects/assistant/chat/tooltip/tooltip.directive.ts","../../../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/references/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/references/chat-reference/chat-reference.component.html","../../../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/version.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/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/references/chat-reference-image/chat-reference-image.component.ts","../../../projects/assistant/chat/references/chat-reference-image/chat-reference-image.component.html","../../../projects/assistant/chat/references/chat-reference-page/chat-reference-page.component.ts","../../../projects/assistant/chat/references/chat-reference-page/chat-reference-page.component.html","../../../projects/assistant/chat/custom-elements/custom-elements.config.ts","../../../projects/assistant/chat/custom-elements/custom-elements.service.ts","../../../projects/assistant/chat/custom-elements/components/document-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/page-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/image-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/code-block.component.ts","../../../projects/assistant/chat/custom-elements/components/table-tools.component.ts","../../../projects/assistant/chat/custom-elements/components/chart-plot.component.ts","../../../projects/assistant/chat/markdown-it/plugins/code-block.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/image-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/link.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/page-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/document-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/table-tools.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/chartJs.plugin.ts","../../../projects/assistant/chat/fetch-patcher/app-injector.ts","../../../projects/assistant/chat/fetch-patcher/global-error-handler.service.ts","../../../projects/assistant/chat/fetch-patcher/fetch-patcher.ts","../../../projects/assistant/chat/fetch-patcher/handle-unauthorized-logic.ts","../../../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, fetchApp } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AppService {\r\n app: CCApp | undefined = undefined;\r\n\r\n async init(): Promise<void> {\r\n if (!this.app) {\r\n try {\r\n this.app = await fetchApp();\r\n } catch (error) {\r\n console.error('Error fetching app:', error);\r\n }\r\n }\r\n }\r\n\r\n get appName() {\r\n return this?.app?.name || \"\";\r\n }\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.initProcess$.pipe(filter(Boolean))),\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 this.config?.defaultValues.temperature !== undefined\n || this.config?.defaultValues.top_p !== undefined\n || this.config?.defaultValues.max_tokens !== undefined\n );\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) && config?.defaultValues.temperature !== undefined\">\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) && config?.defaultValues.top_p !== undefined\">\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) && config?.defaultValues.max_tokens !== undefined\">\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","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 { InjectionToken } from '@angular/core';\nimport type MarkdownIt from 'markdown-it';\n\nexport type MarkdownItPlugin = (md: MarkdownIt, ...params: any[]) => void;\n\nexport const ASSISTANT_MARKDOWN_IT_PLUGINS = new InjectionToken<MarkdownItPlugin[]>(\n 'ASSISTANT_MARKDOWN_IT_PLUGINS',\n {\n providedIn: 'root',\n factory: () => [], // default to empty array\n }\n);\n","import { Component, effect, inject, input, Pipe, signal } from \"@angular/core\";\nimport { DomSanitizer } from \"@angular/platform-browser\";\nimport markdownit from \"markdown-it\";\nimport * as Prism from \"prismjs\";\nimport \"prismjs-components-importer/esm\";\nimport \"prismjs/plugins/autoloader/prism-autoloader\";\n\nimport { ASSISTANT_MARKDOWN_IT_PLUGINS } from \"../markdown-it/markdown-it.config\";\n\nconst GROUPING_REGEX = /^<!--[\\s\\S]*?-->|^<[a-z0-9][\\w-]*(?:\\s+[^>]*)?\\/>|^<([a-z0-9][\\w-]*)(?:\\s+[^>]*)?>[\\s\\S]*?<\\/\\1>/gim;\n\n@Pipe({\n name: \"safeHtml\",\n standalone: true,\n})\nexport class SafeHtmlPipe {\n constructor(private sanitizer: DomSanitizer) {}\n\n transform(html) {\n return this.sanitizer.bypassSecurityTrustHtml(html);\n }\n}\n\n@Component({\n selector: \"SmartRenderer\",\n template: `\n <div [innerHTML]=\"safe() | safeHtml\"></div>\n <div [innerHTML]=\"processing() | safeHtml\"></div>\n `,\n imports: [SafeHtmlPipe],\n standalone: true,\n})\nexport class SmartRendererComponent {\n // Entire message content with the delta\n readonly message = input<string>(\"\");\n readonly context = input<any | null>(null);\n\n readonly safe = signal<string>(\"\");\n readonly processing = signal<string>(\"\");\n\n // High order last slice index, ie. where next message() should be truncated\n // to avoid re-rendering the same content.\n private lastSliceIndex = 0;\n // Local slice index to keep track of the current message's content\n private localSliceIndex = 0;\n // Injected markdown-it plugins\n private readonly _markdownItPlugins = inject(ASSISTANT_MARKDOWN_IT_PLUGINS);\n\n constructor() {\n effect(() => this.messageUpdated(), { allowSignalWrites: true });\n }\n\n private createMarkdownItInstance() {\n const md = new markdownit({\n html: true,\n linkify: true,\n highlight: function (code, lang) {\n if (lang && Prism.languages[lang]) {\n try {\n const highlightedCode = Prism.highlight(\n code,\n Prism.languages[lang],\n lang\n );\n // By returning a string that starts with <pre>, we are telling markdown-it that we handled the wrapping.\n return `<pre class=\"language-${lang}\"><code class=\"language-${lang}\">${highlightedCode}</code></pre>`;\n } catch (__) {\n // if prism fails, fall back to no highlighting\n }\n }\n\n // if no lang, or prism fails, just escape the code for safety\n return `<pre class=\"language-code\"><code class=\"language-code\">${markdownit().utils.escapeHtml(\n code\n )}</code></pre>`;\n },\n });\n\n // Apply all injected plugins dynamically\n this._markdownItPlugins.forEach(plugin => md.use(plugin));\n\n return md;\n }\n\n messageUpdated() {\n // render delta from last sliced message\n const md = this.createMarkdownItInstance();\n const html = md.render(this.message(), this.context())\n ?.slice(this.lastSliceIndex);\n\n // split the html into blocks of first level tags\n const blocks = html.match(GROUPING_REGEX);\n\n // no blocks, nothing to process\n if (!blocks || blocks.length === 0) return;\n\n if (blocks.length > 2) {\n this.localSliceIndex = html.lastIndexOf(blocks.at(-2) || \"\");\n this.lastSliceIndex += this.localSliceIndex;\n\n this.safe.update((v) => v + html.slice(0, this.localSliceIndex));\n this.processing.set(html.slice(this.localSliceIndex));\n } else {\n this.processing.set(blocks.slice(0, 2).join(\"\"));\n }\n }\n}\n","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 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 {\r\n Directive,\r\n ElementRef,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n TemplateRef\r\n} from \"@angular/core\";\r\nimport { TooltipComponent } from \"./tooltip.component\";\r\n\r\nimport { delay, Observable, of, Subscription } 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 host: {\r\n 'class.has-tooltip': 'hasTooltip'\r\n }\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 (Angular 20 host directive syntax)\r\n */\r\n 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","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 { CommonModule } from \"@angular/common\";\nimport {\n Component,\n computed,\n ElementRef,\n input,\n output,\n signal,\n viewChild\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from \"@jsverse/transloco\";\n\nimport { FormatIconComponent } from \"../../format-icon/format-icon.component\";\nimport { ChatContextAttachment, DocumentPart } from \"../../types\";\n\n@Component({\n selector: \"sq-chat-reference\",\n templateUrl: \"./chat-reference.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n standalone: true,\n styles: [`\n :host {\n display: block;\n &.expanded,\n &:hover {\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n }\n `],\n imports: [\n CommonModule,\n FormatIconComponent,\n TranslocoPipe,\n ],\n providers: [provideTranslocoScope('chat-reference')],\n})\nexport class ChatReferenceComponent {\n readonly reference = input.required<string>();\n readonly attachment = input.required<ChatContextAttachment>();\n readonly partId = input<number | undefined>(undefined);\n readonly referenceMap = input<Map<string, ChatContextAttachment> | undefined>(\n undefined\n );\n readonly images = input<string[]>([]);\n readonly pages = input<string[]>([]);\n\n readonly openDocument = output<ChatContextAttachment>();\n readonly openPreview = output<ChatContextAttachment>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n readonly modalRef = signal<any>({});\n\n readonly groupedImagesIds = computed(() => {\n // Suppose images() returns an array like ['1.1.1', '1.1.2', '1.1.3']\n const groups: Record<string, number[]> = {};\n for (const id of this.images()) {\n const parts = id.split(\".\").map(Number);\n if (parts.length < 3) continue;\n const groupKey = parts[1].toString();\n if (!groups[groupKey]) groups[groupKey] = [];\n groups[groupKey].push(parts[2]);\n }\n return groups;\n });\n readonly groupedPagesIds = computed(() => {\n // Suppose images() returns an array like ['1.1', '1.2', '1.3']\n const groups: Record<string, number[]> = {};\n for (const id of this.pages()) {\n const parts = id.split(\".\").map(Number);\n const groupKey = parts[0].toString();\n if (!groups[groupKey]) groups[groupKey] = [];\n groups[groupKey].push(parts[1]);\n }\n\n return groups;\n });\n\n get parts(): DocumentPart[] {\n if (!this.attachment()) return [];\n return this.attachment().parts.filter(\n (part) => (!this.partId() || part.partId === this.partId()) && !!part.text\n );\n }\n\n findImage = (arr: any[], number: number): any | undefined =>\n arr.find((p) => p.imageNumber === number);\n\n findPage = (arr: any[], number: number): any | undefined =>\n arr.find((p) => p.pageNumber === number);\n\n expandAttachment() {\n if (this.partId()) return;\n this.attachment()[\"$expanded\"] = !this.attachment()[\"$expanded\"];\n }\n\n modalClicked(ref: any) {\n this.modalRef.set(ref);\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","<div [class.reference-tooltip]=\"!!partId()\">\n <div\n class=\"reference-data\"\n [class.expanded]=\"attachment()['$expanded'] || !!partId()\"\n (click)=\"expandAttachment()\"\n >\n <span class=\"reference me-1\">{{ reference() }}</span>\n\n <sq-format-icon [extension]=\"attachment().record.fileext\"></sq-format-icon>\n\n <span class=\"title\" [id]=\"'attachment-' + attachment().recordId\">\n {{ attachment().record.title }}\n </span>\n\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); openPreview.emit(attachment())\"\n [title]=\"'chatReference.previewDocument' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-eye\"></i>\n </button>\n\n\n @if (attachment().record.url1 || attachment().record.originalUrl) {\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment())\"\n [title]=\"'chatReference.openDocument' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </button>\n }\n </div>\n\n @if (!!partId() || (attachment()['$expanded'] && parts.length)) {\n <div class=\"reference-passages\">\n @for (part of parts; track $index) {\n <div class=\"reference-passage\">\n <span class=\"reference me-1\">{{ reference() }}.{{ part.partId }}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n\n @for (imageId of groupedImagesIds()[part.partId!]; track $index) {\n @let ref = part?.images?.[imageId - 1];\n @if (ref?.url) {\n <div\n class=\"gap-1 ms-2 my-2 items-start\"\n style=\"display: flex; align-items: start\"\n >\n <span class=\"reference\" style=\"flex-shrink: 0;\">\n {{ \"Img-\" + reference() + \".\" + part.partId + \".\" + imageId }}\n </span>\n\n <img\n [src]=\"ref.url\"\n [alt]=\"ref.description\"\n (click)=\"modalClicked(ref)\"\n />\n </div>\n }\n }\n }\n\n @for (pageId of groupedPagesIds()[reference()]; track $index) {\n @let ref = findPage(referenceMap()?.get(reference())?.pages, pageId);\n @if (ref?.url) {\n <div\n class=\"gap-1 ms-2 my-2 items-start\"\n style=\"display: flex; align-items: start\"\n >\n <span class=\"reference\" style=\"flex-shrink: 0;\">{{ \"Page-\" + reference() + \".\" + pageId }}</span>\n\n <img\n [src]=\"ref.url\"\n [alt]=\"ref.description\"\n (click)=\"modalClicked(ref)\"\n />\n </div>\n }\n }\n </div>\n }\n</div>\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]=\"modalRef().url\" [alt]=\"modalRef().description\" />\n</dialog>\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 ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n ElementRef,\n EventEmitter,\n input,\n Input,\n OnChanges,\n Output,\n signal,\n SimpleChanges\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { ChartComponent } from \"../charts/chart/chart.component\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { MessageContentPipe } from \"../pipes/message-content.pipe\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { UIService } from \"../services/ui.service\";\nimport { SmartRendererComponent } from \"../smart-renderer/smart-renderer\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { ChatContextAttachment, ChatMessage, DocumentPart, SuggestedAction } from \"../types\";\nimport { TextMessageContent } from \"../types/message-content.types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\nimport { ChatReferenceComponent } from \"../references/chat-reference/chat-reference.component\";\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 InitialsAvatarComponent,\n ChatReferenceComponent,\n ChartComponent,\n MessageContentPipe,\n TranslocoPipe,\n SmartRendererComponent\n ],\n providers: [provideTranslocoScope('chat-message')],\n})\nexport class ChatMessageComponent implements OnChanges {\n id = input<string>();\n\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 @Input() collapseReferences: boolean = true;\n @Output() openDocument = new EventEmitter<{ reference: ChatContextAttachment }>();\n @Output() openPreview = new EventEmitter<{ reference: ChatContextAttachment }>();\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 // signal based set of references to avoid duplicates\n refs = signal<number[]>([]);\n references = computed(() =>\n this.refs().slice().sort((a, b) => a - b).map((r) => \"\" + r)\n );\n referenceMap = new Map<string, ChatContextAttachment>();\n imageReferencesMap = new Map<string, MessageImageReference>();\n pageReferencesMap = new Map<string, MessageImageReference>();\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n // used by the template\n Array = Array;\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.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 }\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 parts: [this.referenceMap.get(doc)?.parts?.[+part - 1]] as DocumentPart[], // since it is not possible to locate the image by itself, we use the part in which it is contained\n $partId: 1 // Always 1 for image references since parts array contains only one element referencing the part containing the image\n },\n images[+image - 1]\n );\n\n // save reference in map for reference list\n if (!this.imageReferencesMap.has(ref)) 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 parts: [{\n offset: pageRef.offSet!,\n length: pageRef.length!\n }], // parts here is an array with a single part representing the page reference\n $partId: 1 // Always 1 for page references since parts array contains only one element referencing the page\n },\n pageRef\n );\n\n // save reference in map for reference list\n if (!this.pageReferencesMap.has(ref)) 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 * Processes a reference string by validating and adding it to the set of references if applicable.\n *\n * - Ignores empty or falsy references.\n * - Ignores references that are not numeric.\n * - Ignores references that already exist in the set.\n * - Converts the reference to a number and adds it to the set of references.\n *\n * @param ref - The reference string to process.\n */\n processReferences(ref: string) {\n if (!ref) return;\n if (isNaN(+ref)) return;\n const refNum = +ref;\n if (this.refs().includes(refNum)) return;\n this.refs.update(arr => [...arr, refNum]);\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*\\[[^\\]]*]\\s*/g, \"\");\n\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment) {\n this.openPreview.emit({ reference: attachment });\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment) {\n this.openDocument.emit({ reference: attachment });\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\n\n @if(message?.role === 'assistant' && message.messageType !== 'CHART') {\n <SmartRenderer\n [message]=\"message.content | messageContent\"\n [context]=\"{\n getEmbeddedPageReference: getEmbeddedPageReference.bind(this),\n getEmbeddedImageReference: getEmbeddedImageReference.bind(this),\n referencesMap: referenceMap,\n references: processReferences.bind(this),\n rank: id()\n }\">\n </SmartRenderer>\n }\n\n <p *ngIf=\"message?.role === 'user' || message?.role === 'search-warning' || message?.role === 'connection-error'\">{{ message.content | messageContent }}</p>\n\n <!-- List of reference, if any -->\n @let referencesArray = references();\n @if (referencesArray?.length > 0 || imageReferencesMap?.size > 0 || pageReferencesMap?.size > 0) {\n <div class=\"references\">\n <details role=\"button\" class=\"select-none\" [open]=\"!collapseReferences\">\n <summary class=\"references-title\">{{ 'chatMessage.references' | transloco }}</summary>\n <ul>\n @for (reference of referencesArray; track $index) {\n @let attachment = referenceMap.get(reference);\n <!-- Only display the reference when the key is a integer not a decimal -->\n @if(attachment) {\n <li class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment?.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n [referenceMap]=\"referenceMap\"\n [images]=\"Array.from(imageReferencesMap.keys())\"\n [pages]=\"Array.from(pageReferencesMap.keys())\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n }\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 {{suggestedAction.type === 'Submit' ? 'fa-paper-plane' : 'fa-comment-medical'}} me-1\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n</div>\n","import { Injectable } from \"@angular/core\";\r\nimport { patchUserSettings } from \"@sinequa/atomic\";\r\nimport { from } from \"rxjs\";\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).catch((error) => {\r\n console.error('Error patching user settings:', error);\r\n throw error;\r\n }));\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 'chat.today';\n } else if (isYesterday(date)) {\n return 'chat.yesterday';\n } else if (isThisWeek(date)) {\n return 'chat.thisWeek';\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return 'chat.lastWeek';\n } else if (isThisMonth(date)) {\n return 'chat.thisMonth';\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return 'chat.lastMonth';\n } else if (isThisQuarter(date)) {\n return 'chat.thisQuarter';\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return 'chat.lastQuarter';\n } else if (isThisYear(date)) {\n return 'chat.thisYear';\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return '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 { inject, Injectable } from '@angular/core';\nimport { get, post } from '@sinequa/atomic';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\n\nimport {\n ChatMessage,\n DeleteSavedChatResponse,\n SavedChat,\n SavedChatHistory,\n SavedChatResponse\n} from '../types';\nimport { NotificationsService } from '../services/notification.service';\nimport { TranslocoService } from '@jsverse/transloco';\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()\nexport class SavedChatsService {\n private operationConfig: SavedChatsOperationConfig | undefined;\n\n private readonly notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n constructor() {}\n\n public init(config: SavedChatsOperationConfig): void {\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 async listChats(): Promise<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 try {\n const res = await get<{ savedChats: SavedChat[] }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)\n config.updateSavedChatsList(res.savedChats);\n config.setSavedChatsErrorStatus(false);\n } catch (error) {\n const errorMsg = 'Error occurred while calling the SavedChatList API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n config.setSavedChatsErrorStatus(true);\n\n throw error;\n }\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 }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)).pipe(\n tap(res => {\n config.generateAuditEvent('ast-saved-chat.load', { duration: res.executionTimeMilliseconds }, id);\n if (!res.savedChat) {\n this.notificationsService.error(this.transloco.translate('savedChats.loadFail'));\n }\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>(`api/v1/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>(`api/v1/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>(`api/v1/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(\n get<{ exists: boolean, executionTime: string, executionTimeMilliseconds: number }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)\n .then(res => res.exists)\n .catch((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatExist API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n throw error;\n })\n );\n }\n}\n","import { Injectable } 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/**\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 } 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()\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 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 $expanded?: boolean;\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 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// 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().optional(),\n top_p: z.number().optional(),\n max_tokens: z.number().optional(),\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().optional(),\n top_p: z.number().optional(),\n max_tokens: z.number().optional(),\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.string(), 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(z.string(), 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 queryWebserviceForSearch: z.string().optional()\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 collapseReferences: z.boolean().optional(),\n automaticScroll: 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/** */\n\nexport type PluginVersion = {\n pluginVersion: string;\n major: number;\n minor: number;\n build: number;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport {\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()\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 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 // Ensure the app service is initialized\n await this.appService.init();\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 // According tothe ticket ES-27809, this value is hardcoded and could not be changed\n const url = \"SinequaAssistantREST\";\n context.setRESTRequestsUrl(url);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { get } from '@sinequa/atomic';\nimport { from, Observable, throwError } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\n\nimport { ChatConfig, GllmFunction, GllmModelDescription, PluginVersion } 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()\nexport class AssistantMetadataService {\n private context: AssistantMetadataOperationContext | undefined;\n\n public init(context: AssistantMetadataOperationContext): void {\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 }>(`api/v1/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 }>(`api/v1/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 getPluginVersion(): Observable<PluginVersion | undefined> {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfigValue();\n\n const data = {\n action: \"pluginversion\",\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<PluginVersion | undefined>(`api/v1/plugin/${context.getRestUrl()}`, searchParams))\n .pipe(\n catchError((error) => {\n console.error('Error invoking pluginversion:', error);\n return throwError(() => error);\n })\n );\n }\n\n getSinequaESVersion(): Observable<string | undefined> {\n return from(get<{ serverVersion: string | undefined }>(`api/v2/version`))\n .pipe(\n map(response => response?.serverVersion),\n catchError((error) => {\n console.error('Error fetching Sinequa ES version:', 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()\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 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 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 ...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 if (assistantConfig.defaultValues.temperature !== undefined) data.serviceSettings.temperature = assistantConfig.defaultValues.temperature;\n if (assistantConfig.defaultValues.top_p !== undefined) data.serviceSettings.top_p = assistantConfig.defaultValues.top_p;\n if (assistantConfig.defaultValues.max_tokens !== undefined) data.serviceSettings.max_tokens = assistantConfig.defaultValues.max_tokens;\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 // Use a named handler so it can be removed after firing, preventing listener accumulation across multiple stop operations\n const cancelHandler = (res: any) => {\n connection.off('CancelTasks', cancelHandler);\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 connection.on('CancelTasks', cancelHandler);\n\n // Invoke the CancelTasks method and handle errors\n connection.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n connection.off('CancelTasks', cancelHandler);\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 { get } from '@sinequa/atomic';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\nimport {\n DebugMessage,\n ListObject\n} from '../types';\n\nexport interface DebugMessageOperationConfig {\n getRestUrl: () => string;\n}\n\n@Injectable()\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>(`api/v1/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 throw error;\n })\n );\n }\n}\n","// Auto-generated\nexport const LIB_VERSION = '3.10.11';\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 PluginVersion,\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\";\nimport { DebugMessageOperationConfig, DebugMessageService } from \"./debug-message/debug-message.service\";\nimport { LIB_VERSION } from \"./version\";\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 // Inject the SignalRConnectionService using 'new' to ensure a separate local instance for each ChatService instance\n private signalRConnectionService = new SignalRConnectionService();\n private assistantConfigurationService = inject(AssistantConfigurationService);\n private assistantMetadataService = new 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 switchMap(() => {\n this.getWSRequestsUrl();\n this.getRESTRequestsUrl();\n this._initAssistantMetadataService();\n this._initAssistantTokensTrackingService();\n this._initSavedChatsService();\n this._initDebugMessageService();\n this._initSignalRConnectionService();\n return this.checkVersionAlignment();\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 !== undefined && functions !== undefined && !!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 * Retrieves the plugin version information.\n * @returns An Observable of PluginVersion or undefined.\n */\n getPluginVersion(): Observable<PluginVersion | undefined> {\n return this.assistantMetadataService.getPluginVersion();\n }\n\n /**\n * Retrieves the Sinequa Enterprise Search version.\n * @returns The Sinequa Enterprise Search version as a string, or undefined if not available.\n */\n getSinequaESVersion(): Observable<string | undefined> {\n return this.assistantMetadataService.getSinequaESVersion();\n }\n /**\n * Checks and logs the version alignment between the Angular library, plugin, and Sinequa ES.\n * It fetches the plugin and Sinequa ES versions in parallel and logs the information to the console.\n */\n checkVersionAlignment(): Observable<any> {\n return forkJoin([\n this.getSinequaESVersion(),\n this.getPluginVersion()\n ]).pipe(\n tap(([esVersion, pluginVersion]) => {\n const infoMessage = `[INFO] - Assistant instance [${this.chatInstanceId}]: Angular Library [${LIB_VERSION}] Plugin [${pluginVersion?.pluginVersion}] Build [${esVersion}]`;\n console.log(\n \"%cℹ️ \" + infoMessage,\n \"background: #E0F8F8; color: #222; border: 1px solid #222; padding: 2px 6px; border-radius: 4px; font-weight: 500;\",\n );\n if (pluginVersion?.pluginVersion !== LIB_VERSION) {\n const warningMessage = `[WARN] - Assistant instance [${this.chatInstanceId}]: Version mismatch between the Angular library [${LIB_VERSION}] and Plugin [${pluginVersion?.pluginVersion}].\\n💡 [HELP] Please ensure both are on the same version to avoid potential issues.`;\n console.log(\n \"%c⚠️ \" + warningMessage,\n \"background: #FFF4E5; color: #222; border: 1px solid #222; padding: 2px 6px; border-radius: 4px; font-weight: 500;\",\n );\n }\n })\n );\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 { Component, Input } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\nimport * as Prism from 'prismjs';\n\nimport { UIService } from \"../../services/ui.service\";\nimport { KvObject, ListObject } from \"../../types\";\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 {\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, DestroyRef, 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\";\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 { 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\";\nimport { AssistantUtils } from \"./utils/utils.service\";\nimport { AssistantConfigurationService } from \"./services/assistant-configuration.service\";\nimport { AssistantTokensTrackingService } from \"./services/assistant-tokens-tracking.service\";\nimport { SavedChatsService } from \"./saved-chats/saved-chats.service\";\nimport { DebugMessageService } from \"./debug-message/debug-message.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 ChatService,\n AssistantConfigurationService,\n AssistantTokensTrackingService,\n SavedChatsService,\n DebugMessageService,\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 private destroyRef = inject(DestroyRef);\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 /** Used by assistant web component to pass properly init the global config */\n @Input() appConfig: AppGlobalConfig;\n /** Whether the chat component is displayed in a collapsed state */\n @Input() collapsed: boolean = false;\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('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 config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n isAdminOrDeletedAdmin = false;\n question = '';\n\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 constructor() {\n this.destroyRef.onDestroy(async () => {\n console.log(`Destroying ChatComponent: ${this.instanceId} \\n along with ChatService: ${this.chatService.chatInstanceId} \\n and stopping connection: ${this.chatService.connection?.connectionId}`);\n if (this.chatService.connection && this.chatService.connection.state !== HubConnectionState.Disconnected && this.chatService.connection.state !== HubConnectionState.Disconnecting) {\n try {\n await this.chatService.stopConnection()\n } catch (error) {\n console.error(`Error during the destruction of ChatComponent: ${this.instanceId}`, error);\n }\n }\n });\n }\n\n ngOnInit(): void {\n if (this.appConfig) {\n setGlobalConfig(this.appConfig);\n }\n\n of(isAuthenticated()).pipe(\n takeUntilDestroyed(this.destroyRef),\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 // Example of listening to custom events from the web element and handling them in the Angular component\n addEventListener('onOpenPreview', (event: any) => {\n this.openPreview.emit(event.detail.reference);\n });\n addEventListener('onOpenDocument', (event: any) => {\n this.openDocument.emit(event.detail.reference.record);\n });\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (changes.collapsed) {\n setTimeout(() => {\n this._addScrollListener();\n });\n }\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\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!.unsubscribe();\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 const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (!messageList) {\n return;\n }\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(messageList!, 'scroll'))\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n setTimeout(() => {\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 && this.rankMessageToEdit !== 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-1);\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.scrollDown(); // Scroll down to the bottom of the chat to see the new user message and the incoming assistant answer\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 || this.config.globalSettings.automaticScroll) {\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 || this.config.globalSettings.automaticScroll) {\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 const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (messageList) {\n return Math.round(messageList.scrollHeight - messageList.scrollTop - 1) <= messageList.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (messageList) {\n messageList.scrollTop = messageList.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 const date = (new Date()).toLocaleString('en-US', { weekday: 'long', month: 'long', day: '2-digit', year: 'numeric' });\n // Define the default system prompt and user prompt messages\n const systemMsg = {\n role: 'system',\n content: AssistantUtils.formatPrompt(\n this.transloco.translate(this.config.defaultValues.systemPrompt),\n { principal: this.principalService.principal, date }\n ),\n additionalProperties: { display: false, messageId: guid() }\n };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = {\n role: 'user',\n content: AssistantUtils.formatPrompt(\n this.transloco.translate(userPrompt),\n { principal: this.principalService.principal, date }\n ),\n additionalProperties: { display: this.config.modeSettings.displayUserPrompt, messageId: guid() }\n };\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.chatService.loadSavedChat$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\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 * 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 rankFirstPreviousUserMessage = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, this.messages$.value![i].additionalProperties.messageId);\n // Rank of the assistant's message on which the user clicked to regenerate\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, rankFirstPreviousUserMessage);\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 index of the message containing the suggested action.\n * @returns void\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n\n const details = {\n 'text': action.content,\n 'suggestedAction-type': action.type\n };\n this.chatService.generateAuditEvent('ast-suggested-action.click', details);\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 [id]=\"'messageList-' + instanceId\">\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 [id]=\"message.additionalProperties.messageId\"\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 [collapseReferences]=\"!!config?.globalSettings.collapseReferences\"\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) !== true && (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, Observable, Subject, Subscription, catchError, combineLatest, debounceTime, distinctUntilChanged, filter, from, map, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { parseISO, toDate } from \"date-fns\";\n\nimport { Article, fetchQuery, isAuthenticated, Query } 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\";\nimport { SavedChatsService } from \"./saved-chats.service\";\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: [SavedChatsService, 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 queryWebserviceForSearch?: string;\n private searchQuery: Query;\n private searchText: string;\n private searchText$ = new Subject<string>();\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 this.queryWebserviceForSearch = this.chatService.assistantConfig$.value!.savedChatSettings?.queryWebserviceForSearch;\n }\n if (!!this.queryWebserviceForSearch) {\n this.searchQuery = { name: this.queryWebserviceForSearch };\n }\n })\n ).subscribe()\n );\n\n this.subscription.add(\n this.searchText$\n .pipe(\n debounceTime(2000),\n distinctUntilChanged(),\n switchMap(searchText => {\n this.searchText = searchText;\n if (!searchText) {\n return of(this.chatService.savedChats$.value || []);\n }\n this.searchQuery.text = searchText;\n return this.searchSavedChats();\n }),\n tap(savedChats =>\n this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats))\n )\n )\n .subscribe()\n );\n\n\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n onSearch(event: Event): void {\n this.searchText$.next((event.target as HTMLInputElement).value);\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]) => {\n if (!this.queryWebserviceForSearch || !this.searchText) {\n this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats))\n } else {\n this.searchSavedChats().subscribe(savedChats => this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats)));\n }\n })\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 private searchSavedChats(): Observable<SavedChat[]> {\n return from(fetchQuery(this.searchQuery)).pipe(\n map(res => res.records.map((a: Article) => ({\n id: a.id.split('|')[1], // removing the app name in front of the ID causing issues to fetch the saved chat\n title: a.title,\n modifiedUTC: a.modified\n }))),\n catchError(() => of(this.chatService.savedChats$.value || []))\n )\n }\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngIf=\"!!queryWebserviceForSearch\" class=\"sticky-top\">\n <input type=\"search\" class=\"form-control\" [placeholder]=\"'savedChats.searchPlaceholder' | transloco\" (keyup)=\"onSearch($event)\" (search)=\"onSearch($event)\" />\n </div>\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 | transloco}}</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 <button\n type=\"button\"\n (click)=\"renameDialog.showModal($event, savedChat)\"\n [sqTooltip]=\"'savedChats.rename' | transloco\"\n class=\"mx-1 bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-pen saved-chat-actions\"></i>\n </button>\n <button\n type=\"button\"\n (click)=\"deleteDialog.showModal($event, savedChat)\"\n [sqTooltip]=\"'savedChats.delete' | transloco\"\n class=\"ms-1 bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-trash saved-chat-actions\"></i>\n </button>\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 { HttpClient, HttpEventType, HttpHeaders, HttpResponse, HttpUploadProgressEvent } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { getToken, globalConfig, post } from '@sinequa/atomic';\nimport { BehaviorSubject, catchError, filter, from, map, Observable, take, tap } from 'rxjs';\nimport { AppService } from '../services/app.service';\nimport { deleteDocumentsResponse, IndexingInfos, UploadConfig, UploadedDocument, UploadedDocuments, UploadEvent } from './documents-upload.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DocumentsUploadService {\n\n public readonly REQUEST_URL = \"api/v1/plugin/SinequaAssistantREST\";\n /** Documents upload configuration. */\n public uploadConfig$ = new BehaviorSubject<UploadConfig | undefined>(undefined);\n\n /** Emit the list of indexed documents */\n public uploadedDocuments$ = new BehaviorSubject<UploadedDocument[] | undefined>([]);\n\n public appService = inject(AppService);\n public http = inject(HttpClient);\n\n /**\n * Initializes the file upload service.\n */\n init(): void {\n if (this.uploadConfig$.value === undefined) {\n try {\n this.getUploadConfig();\n } catch (error) {\n throw new Error(error);\n }\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 };\n\n from(post<UploadConfig>(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 };\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}/${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 };\n\n return from(post<IndexingInfos>(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 };\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>(this.REQUEST_URL, data)).pipe(\n tap((res: UploadedDocuments) => this.uploadedDocuments$.next(res.docs)),\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 };\n\n return from(post<deleteDocumentsResponse>(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 };\n\n return from(post<deleteDocumentsResponse>(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 finalize,\n interval,\n Subscription,\n switchMap,\n takeWhile,\n tap,\n startWith,\n of,\n take,\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { IndexingInfos, UploadEvent, UploadingInfos } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.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: [provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, NgxFlowModule, FormatIconComponent, TranslocoPipe]\n})\nexport class DocumentUploadComponent implements OnInit, OnDestroy {\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 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 documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n switchMap((_) => this.appService.init()),\n tap((_) => this.documentsUploadService.init()),\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 /**\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), // Use takeWhileInclusive() pattern to ensure that the last value where isCompleted === true is also included.\n catchError((err) => {\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorIndexingStatus'));\n return EMPTY;\n }),\n finalize(() => {\n // Refresh the list of uploaded documents at the end of indexing\n this.documentsUploadService.getDocumentsList().pipe(take(1)).subscribe();\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 class=\"me-1\" [title]=\"transfer.name\">{{ transfer.name }}</span>\n <button\n type=\"button\"\n (click)=\"flow.cancelFile(transfer)\"\n [title]=\"'chatDocumentsUpload.cancel' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-trash\"></i>\n </button>\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, OnDestroy, OnInit } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n combineLatest,\n EMPTY,\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 { AssistantUtils } from \"../../utils/utils.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { UploadedDocument } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.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: [provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, FormatIconComponent, TranslocoPipe],\n})\nexport class DocumentListComponent implements OnInit, OnDestroy {\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 documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\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 switchMap((_) => this.appService.init()),\n tap((_) => {\n this.onUpdateUploadedDocumentsList();\n this.documentsUploadService.getDocumentsList();\n }),\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 /**\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 onUpdateUploadedDocumentsList(): void {\n this._subscription.add(\n combineLatest([\n this.documentsUploadService.uploadedDocuments$,\n this.transloco.langChanges$\n ]).pipe(\n tap(([uploadedDocuments]) => {\n this.groupedUploadedDocuments$.next(this._groupUploadedDocumentsByDate(uploadedDocuments))\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\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 }),\n switchMap(() => this.documentsUploadService.getDocumentsList()),\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 }),\n switchMap(() => this.documentsUploadService.getDocumentsList()),\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[] | undefined): { key: string; value: UploadedDocument[] }[] {\n if (!docs || docs.length === 0) {\n return [];\n }\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 | transloco}}</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 <button\n type=\"button\"\n (click)=\"deleteDocument($event, doc)\"\n [title]=\"'chatDocumentsUpload.delete' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"uploaded-doc-actions fas fa-trash ms-1\"></i>\n </button>\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 catchError,\n EMPTY,\n of,\n Subscription,\n switchMap,\n tap\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.service\";\n\n@Component({\n selector: \"sq-document-overview\",\n templateUrl: \"./document-overview.component.html\",\n standalone: true,\n providers: [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 @Input() disabledUpload: boolean = true;\n\n @Output() onUpload = new EventEmitter();\n\n private _subscription = new Subscription();\n\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n switchMap((_) => this.appService.init()),\n tap((_) => this.documentsUploadService.init()),\n switchMap((_) => this.documentsUploadService.getDocumentsList()),\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}\n","<div class=\"d-flex\">\n <span class=\"overview-text flex-grow-1\">\n {{ 'chatDocumentsUpload.uploadedDocuments' | transloco: { count: (documentsUploadService.uploadedDocuments$ | async)?.length || 0 } }}\n </span>\n <button 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","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 { DocumentPart, RawAttachment } from \"../../types\";\nimport { MessageImageReference } from \"../../types/message-reference.types\";\n\n@Component({\n selector: \"ChatReferenceImage\",\n standalone: true,\n providers: [provideTranslocoScope('chat-reference')],\n imports: [FormatIconComponent, TranslocoPipe],\n templateUrl: \"./chat-reference-image.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n styles: [`\n :host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n padding: 0.5rem;\n background-color: blue;\n box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);\n font-size: 0.875rem;\n\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n`]\n})\nexport class ChatReferenceImageComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: number, parts: DocumentPart[] }\n >();\n readonly openDocument = output<Omit<RawAttachment, \"type\">>();\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 parts: this.ref().parts!,\n $partId: this.ref().$partId!\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 });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\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 ?? ('chatReference.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReference.previewDocument' | 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]=\"'chatReference.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","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 { DocumentPart, RawAttachment } from \"../../types\";\nimport { MessageImageReference } from \"../../types/message-reference.types\";\n\n@Component({\n selector: \"ChatReferencePage\",\n standalone: true,\n providers: [provideTranslocoScope('chat-reference')],\n imports: [FormatIconComponent, TranslocoPipe],\n templateUrl: \"./chat-reference-page.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n styles: [`\n :host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n padding: 0.5rem;\n background-color: blue;\n box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);\n font-size: 0.875rem;\n\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n`]\n})\nexport class ChatReferencePageComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: number, parts: DocumentPart[] }\n >();\n readonly openDocument = output<Omit<RawAttachment, \"type\">>();\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 parts: this.ref().parts!,\n $partId: this.ref().$partId!\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 });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\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 ?? ('chatReference.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReference.previewDocument' | 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]=\"'chatReference.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","import { InjectionToken, Type } from '@angular/core';\n\nexport const ASSISTANT_CUSTOM_ELEMENTS = new InjectionToken<Record<string, Type<unknown>>>(\n 'ASSISTANT_CUSTOM_ELEMENTS',\n {\n providedIn: 'root',\n factory: () => ({}), // default to empty object\n }\n);\n","import { inject, Injectable, Injector } from \"@angular/core\";\nimport { createCustomElement } from \"@angular/elements\";\n\nimport { ASSISTANT_CUSTOM_ELEMENTS } from \"./custom-elements.config\";\n\n/**\n * Service to register custom elements in the Angular application.\n * This service is used to define custom elements that can be used in the application.\n * It is called through APP_INITIALIZER to ensure that custom elements are registered before the application starts.\n */\n\n@Injectable({ providedIn: \"root\" })\nexport class CustomElementsService {\n private _injector = inject(Injector);\n private readonly _customElements = inject(ASSISTANT_CUSTOM_ELEMENTS);\n\n setupCustomElements() {\n Object.entries(this._customElements).forEach(([tagName, component]) => {\n if (!customElements.get(tagName)) {\n const element = createCustomElement(component, {\n injector: this._injector,\n });\n customElements.define(tagName, element);\n }\n });\n }\n}\n\nexport function initializeCustomElements(customElementsService: CustomElementsService) {\n return () => customElementsService.setupCustomElements();\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport { ChatReferenceComponent } from \"../../references/chat-reference/chat-reference.component\";\n\n@Component({\n selector: \"document-reference\",\n imports: [TooltipDirective, ChatReferenceComponent],\n template: `\n <a\n class=\"reference\"\n role=\"button\"\n [sqTooltip]=\"ref\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n (click)=\"onOpenPreview(ref)\"\n >{{ id }}</a>\n\n <!-- tooltip template -->\n <ng-template #tooltipTpl>\n <sq-chat-reference\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n ></sq-chat-reference>\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class DocumentReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref:ChatContextAttachment = {} as ChatContextAttachment;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport type { MessageImageReference } from \"../../types/message-reference.types\";\nimport { ChatReferencePageComponent } from \"../../references/chat-reference-page/chat-reference-page.component\";\n\n@Component({\n selector: \"page-reference\",\n imports: [TooltipDirective, ChatReferencePageComponent],\n template: `\n <span\n class=\"reference\"\n [sqTooltip]=\"{ obj: ref, id }\"\n [sqTooltipTemplate]=\"pageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Page-{{ id }}\n </span>\n <ng-template #pageTooltipTpl let-ref>\n <ChatReferencePage\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n />\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class PageReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref: MessageImageReference = {} as MessageImageReference;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport type { MessageImageReference } from \"../../types/message-reference.types\";\nimport { ChatReferenceImageComponent } from \"../../references/chat-reference-image/chat-reference-image.component\";\n\n@Component({\n selector: \"image-reference\",\n imports: [TooltipDirective, ChatReferenceImageComponent],\n template: `\n <span\n class=\"reference\"\n [sqTooltip]=\"{ obj: ref, id }\"\n [sqTooltipTemplate]=\"imageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Img-{{ this.id }}\n </span>\n <ng-template #imageTooltipTpl let-ref>\n <ChatReferenceImage\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n />\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class ImageReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref: MessageImageReference = {} as MessageImageReference;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, ElementRef, inject, Input, signal } from \"@angular/core\";\n\n@Component({\n selector: \"code-block\",\n template: `\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-end align-items-center\">\n <span class=\"me-auto\">{{ langname || 'code'}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"handleClick($event)\" title=\"Copy to clipboard\">\n @if(copying()){\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z\" fill=\"currentColor\"></path></svg>\n } @else {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\" fill=\"currentColor\"></path></svg>\n }\n </button>\n </div>\n <ng-content></ng-content>\n </div>\n `,\n standalone: true,\n })\n export class CodeBlockComponent {\n @Input() langname = \"\";\n\n el = inject(ElementRef);\n copying = signal(false);\n\n handleClick(event: Event) {\n event.stopPropagation();\n // get the code content\n const codeEl = this.el.nativeElement.querySelector(\"code\");\n const code = codeEl ? codeEl.textContent : \"\";\n // this.encodeCode = encodeURIComponent(code);\n this.copyCodeToClipboard(code || \"\");\n }\n\n copyCodeToClipboard(code: string): void {\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard\n .writeText(code)\n .then(() => {\n // Provide visual feedback to the user\n this.copying.set(true);\n setTimeout(() => {\n this.copying.set(false);\n }, 2000);\n })\n .catch((err) => {\n console.error(\"Failed to copy text: \", err);\n });\n } else {\n // Fallback for older browsers\n const textarea = document.createElement(\"textarea\");\n textarea.value = code;\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n try {\n document.execCommand(\"copy\");\n // Provide visual feedback to the user\n this.copying.set(true);\n setTimeout(() => {\n this.copying.set(false);\n }, 2000);\n } catch (err) {\n console.error(\"Fallback: Oops, unable to copy\", err);\n }\n document.body.removeChild(textarea);\n }\n }\n }\n","import { Component, ElementRef, inject, signal } from '@angular/core';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { TooltipDirective } from '../../tooltip/tooltip.directive';\n\n@Component({\n selector: 'table-tools',\n standalone: true,\n template: `\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-end align-items-center\">\n <button class=\"btn btn-light btn-sm\" (click)=\"copyAsCSV()\" [sqTooltip]=\"copied() ? ('customElements.copied' | transloco) : ('customElements.copyAsCSV' | transloco)\">\n @if(!copied()) {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\" fill=\"currentColor\"></path></svg>\n } @else {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z\" fill=\"currentColor\"></path></svg>\n }\n </button>\n <button class=\"btn btn-light btn-sm\" (click)=\"downloadAsCSV()\" [sqTooltip]=\"'customElements.downloadAsCSV' | transloco\">\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z\" fill=\"currentColor\"></path></svg>\n </button>\n </div>\n <ng-content></ng-content>\n </div>\n `,\n providers: [provideTranslocoScope('custom-elements')],\n imports: [TooltipDirective, TranslocoPipe],\n})\nexport class TableToolsComponent {\n private readonly host = inject(ElementRef<HTMLElement>);\n\n copied = signal(false);\n\n get table(): HTMLTableElement | null {\n return this.host.nativeElement.querySelector('table');\n }\n\n copyAsCSV() {\n const csv = this.extractCSV();\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard\n .writeText(csv)\n .then(() => {\n this.copied.set(true);\n setTimeout(() => this.copied.set(false), 2000);\n })\n .catch((err) => {\n console.error(\"Failed to copy table: \", err);\n });\n } else {\n // Fallback for older browsers\n const textarea = document.createElement(\"textarea\");\n textarea.value = csv;\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n try {\n document.execCommand(\"copy\");\n this.copied.set(true);\n setTimeout(() => this.copied.set(false), 2000);\n } catch (err) {\n console.error(\"Fallback: Oops, unable to copy table: \", err);\n }\n document.body.removeChild(textarea);\n }\n }\n\n downloadAsCSV() {\n const csv = this.extractCSV();\n // ✅ Add UTF-8 BOM to fix character encoding in Excel and Windows\n const BOM = '\\uFEFF';\n const blob = new Blob([BOM + csv], { type: 'text/csv;charset=utf-8;' });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n link.download = `AI-generated-table-${timestamp}.csv`;\n link.click();\n }\n\n private extractCSV(): string {\n const table = this.table;\n if (!table) return '';\n const rows = Array.from(table.rows).map(row =>\n Array.from(row.cells)\n .map(cell => `\"${cell.textContent?.trim() ?? ''}\"`)\n .join(',')\n );\n return rows.join('\\n');\n }\n}\n","import {\n AfterViewInit,\n Component,\n DestroyRef,\n ElementRef,\n ViewChild,\n inject,\n} from '@angular/core';\nimport { Chart, ChartConfiguration } from 'chart.js';\n\n@Component({\n selector: 'chart-plot',\n standalone: true,\n template: `\n <canvas #chartPlot></canvas>\n <div style=\"display:none\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class ChartPlotComponent implements AfterViewInit {\n\n @ViewChild('chartPlot', { static: true }) chartPlotRef!: ElementRef<HTMLCanvasElement>;\n\n private destroyRef = inject(DestroyRef);\n private chart?: Chart;\n\n constructor() {\n // Cleanup on destroy\n this.destroyRef.onDestroy(() => {\n this.chart?.destroy();\n });\n }\n\n ngAfterViewInit() {\n const config = this.parseChartJsConfig();\n if (!config) return;\n\n // ✅ Render chart directly into canvas\n this.chart = new Chart(this.chartPlotRef.nativeElement, config);\n\n }\n\n private parseChartJsConfig(): ChartConfiguration | null {\n const rawConfig = this.getChartJsConfig();\n if (!rawConfig) return null;\n\n try {\n return JSON.parse(rawConfig);\n } catch (e) {\n return null;\n }\n }\n\n private getChartJsConfig(): string {\n return this.chartPlotRef.nativeElement.parentElement?.textContent?.trim() ?? '';\n }\n}\n","import type MarkdownIt from \"markdown-it\";\n\nexport function markdownItCodeBlockPlugin(md: MarkdownIt) {\n const defaultFenceRenderer = md.renderer.rules.fence!;\n\n md.renderer.rules.fence = (tokens, idx, options, env, self) => {\n const token = tokens[idx];\n const info = token.info ? md.utils.unescapeAll(token.info).trim() : '';\n const langName = info.split(/(\\s+)/g)[0];\n const defaultRendered = defaultFenceRenderer(tokens, idx, options, env, self);\n\n // We add a wrapper and a copy button.\n // The button will have an attribute `[copy-to-clipboard]` which can be handled by an Angular directive\n // to implement the copy functionality. The code to be copied is projected into the component.\n return `<code-block langname=\"${langName}\">${defaultRendered}</code-block>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\nimport Token from 'markdown-it/lib/token.mjs';\n/**\n * A markdown-it plugin to convert [Img-x.y.z], where x, y and z are numbers, into a <image-reference id=\"x.y.z\">Img-x.y.z</image-reference> HTML tag.\n *\n * For example, when attachment x is found in the referencesMap and which contains the image z of the part y, [Img-x.y.z] will be converted to <image-reference id=\"x.y.z\">Img-x.y.z</image-reference>.\n * If the attachment x, the part y or the image z is not found, it will remain as plain text [Img-x.y.z] in a span tag : <span>[Img-x.y.z]</span>\n */\n\nexport const EMBEDDED_IMAGE_NAME = \"embedded-image-reference\";\nconst EMBEDDED_IMAGE_REGEX = /\\[(Img-([0-9]+(?:\\.[0-9]+){2}))\\]/g;\n\nexport function markdownItImageReferencePlugin(md: MarkdownIt) {\n md.core.ruler.after(\"inline\", EMBEDDED_IMAGE_NAME, (state) => {\n const getEmbeddedImageReference = state?.env?.getEmbeddedImageReference;\n state.tokens.forEach((blockToken) => {\n if (blockToken.type !== \"inline\" || !blockToken.children) return;\n\n const newChildren: Token[] = [];\n\n blockToken.children.forEach((token) => {\n if (token.type !== \"text\") {\n newChildren.push(token);\n return;\n }\n\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n const text = token.content;\n\n EMBEDDED_IMAGE_REGEX.lastIndex = 0; // Reset regex state\n while ((match = EMBEDDED_IMAGE_REGEX.exec(text)) !== null) {\n // Add leading text\n if (match.index > lastIndex) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex, match.index);\n newChildren.push(t);\n }\n\n // Add embedded image reference token\n const refToken = new state.Token(EMBEDDED_IMAGE_NAME, \"\", 0);\n refToken.content = match[2]; // e.g., \"1.2.3\"\n refToken.meta = { full: match[1] }; // e.g., \"Img-1.2.3\"\n refToken.attrs = [];\n if (getEmbeddedImageReference) {\n const attachment = getEmbeddedImageReference(match[2]);\n if (attachment) {\n refToken.attrs.push(['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]);\n }\n }\n newChildren.push(refToken);\n\n lastIndex = match.index + match[0].length;\n }\n\n // Add trailing text\n if (lastIndex < text.length) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex);\n newChildren.push(t);\n }\n });\n\n blockToken.children = newChildren;\n });\n });\n\n // Optional: renderer for the custom token\n md.renderer.rules[EMBEDDED_IMAGE_NAME] = (tokens, idx) => {\n const imgId = tokens[idx].content;\n const attrs = tokens[idx].attrs || [];\n const attachment = attrs[0];\n if (!attachment) {\n return `<span>[Img-${imgId}]</span>`;\n }\n return `<image-reference id=\"${imgId}\" attachment=\"${attachment[1]}\" class=\"embedded-image-ref\">Img-${imgId}</image-reference>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\n\n/**\n * This plugin overrides the default link renderer to add `target=\"_blank\"` and `rel=\"noopener noreferrer\"` to all links.\n */\nexport function markdownItLinkPlugin(md: MarkdownIt) {\n const defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n md.renderer.rules.link_open = function(tokens, idx, options, env, self) {\n tokens[idx].attrPush(['target', '_blank']);\n tokens[idx].attrPush(['rel', 'noopener noreferrer']);\n\n // pass token to default renderer.\n return defaultRender(tokens, idx, options, env, self);\n };\n}\n","import type MarkdownIt from \"markdown-it\";\nimport Token from 'markdown-it/lib/token.mjs';\n/**\n * A markdown-it plugin to convert [Page-x.n], where x and n are numbers, into a <page-reference id=\"x.n\">Page-x.n</page-reference> HTML tag.\n *\n * For example, when attachment x is found in the referencesMap and which contains the page n, [Page-x.n] will be converted to <page-reference id=\"x.n\">Page-x.n</page-reference>.\n * If the attachment x or the page n is not found, it will remain as plain text [Page-x.n] in a span tag : <span>[Page-x.n]</span>\n */\n\nexport const EMBEDDED_PAGE_NAME = \"embedded-page-reference\";\nconst EMBEDDED_PAGE_REGEX = /\\[(Page-(\\d+\\.\\d+))\\]/g;\n\nexport function markdownItPageReferencePlugin(md: MarkdownIt) {\n md.core.ruler.after(\"inline\", EMBEDDED_PAGE_NAME, (state) => {\n const getEmbeddedPageReference = state?.env?.getEmbeddedPageReference;\n state.tokens.forEach((blockToken) => {\n if (blockToken.type !== \"inline\" || !blockToken.children) return;\n\n const newChildren: Token[] = [];\n\n blockToken.children.forEach((token) => {\n if (token.type !== \"text\") {\n newChildren.push(token);\n return;\n }\n\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n const text = token.content;\n\n EMBEDDED_PAGE_REGEX.lastIndex = 0; // Reset regex state\n while ((match = EMBEDDED_PAGE_REGEX.exec(text)) !== null) {\n // Add leading text\n if (match.index > lastIndex) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex, match.index);\n newChildren.push(t);\n }\n\n // Add embedded page reference token\n const refToken = new state.Token(EMBEDDED_PAGE_NAME, \"\", 0);\n refToken.content = match[2]; // e.g., \"1.2\"\n refToken.meta = { full: match[1] }; // e.g., \"Page-1.2\"\n refToken.attrs = [];\n if (getEmbeddedPageReference) {\n const attachment = getEmbeddedPageReference(match[2]);\n if (attachment) {\n refToken.attrs.push(['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]);\n }\n }\n newChildren.push(refToken);\n\n lastIndex = match.index + match[0].length;\n }\n\n // Add trailing text\n if (lastIndex < text.length) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex);\n newChildren.push(t);\n }\n });\n\n blockToken.children = newChildren;\n });\n });\n\n // Optional: renderer for the custom token\n md.renderer.rules[EMBEDDED_PAGE_NAME] = (tokens, idx) => {\n const page = tokens[idx].content;\n const attrs = tokens[idx].attrs || [];\n const attachment = attrs[0];\n if (!attachment) {\n return `<span>[Page-${page}]</span>`;\n }\n return `<page-reference id=\"${page}\" attachment=\"${attachment[1]}\" class=\"embedded-page-ref\">Page-${page}</page-reference>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\n/**\n * A markdown-it plugin to convert [n] where n is a number into a <document-reference id=\"n\">n</document-reference> HTML tag.\n *\n * For example, when attachment 123 is found in the referencesMap, [123] will be converted to <document-reference id=\"123\">123</document-reference>.\n * If the attachment is not found, it will remain as plain text [123] in a span tag : <span>[123]</span>\n */\nexport function markdownItDocumentReferencePlugin(md: MarkdownIt) {\n function referenceifyNumber(state, silent) {\n const referencesMap = state.env.referencesMap || new Map();\n const char = state.src.charCodeAt(state.pos);\n\n // Check if the current character is '['\n if (char !== 0x5B /* [ */) {\n return false;\n }\n\n const start = state.pos + 1;\n let end = -1;\n\n // Find the closing ']'\n for (let i = start; i < state.src.length; i++) {\n if (state.src.charCodeAt(i) === 0x5D /* ] */) {\n end = i;\n break;\n }\n }\n\n if (end === -1 || end === start) {\n return false;\n }\n\n const content = state.src.slice(start, end);\n\n // Match if content is a number or number.number (optionally allow whitespace)\n if (!/^\\s*\\d+(?:\\.\\d+)?\\s*$/.test(content.trim())) {\n return false;\n }\n\n if (!silent) {\n const n = content.trim();\n\n // Open <reference>\n const attachment = referencesMap.get(n);\n if(attachment){\n // add attachment if found in the references map from env (set in the component)\n state.env.references(n.split('.')[0]);\n const tokenOpen = state.push('reference_open', 'document-reference', 1);\n // base64 encode the attachment if needed\n if (typeof attachment === 'object') {\n tokenOpen.attrs = [\n ['id', n],\n ['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]\n ];\n }\n\n // Text content\n const tokenText = state.push('text', '', 0);\n tokenText.content = n;\n\n // Close </reference>\n state.push('reference_close', 'document-reference', -1);\n } else {\n // If no attachment found, just create a span text node\n state.push('reference_open', 'span', 1);\n const tokenText = state.push('text', '', 0);\n tokenText.content = `[${n}]`;\n state.push('reference_close', 'span', -1);\n }\n }\n\n state.pos = end + 1;\n return true;\n }\n\n md.inline.ruler.after('text', 'referenceify_number', referenceifyNumber);\n}\n","import type MarkdownIt from \"markdown-it\";\n\nexport function markdownItTableToolsPlugin(md: MarkdownIt) {\n const defaultRender = md.renderer.rules.table_open || ((tokens, idx, options, env, self) =>\n self.renderToken(tokens, idx, options));\n\n md.renderer.rules.table_open = (tokens, idx, options, env, self) => {\n // Wrap the table with the custom element\n return `<table-tools>` + defaultRender(tokens, idx, options, env, self);\n };\n\n const defaultClose = md.renderer.rules.table_close || ((tokens, idx, options, env, self) =>\n self.renderToken(tokens, idx, options));\n\n md.renderer.rules.table_close = (tokens, idx, options, env, self) => {\n return defaultClose(tokens, idx, options, env, self) + `</table-tools>`;\n };\n}\n","import MarkdownIt from 'markdown-it';\n\n/**\n * Markdown-it plugin to replace ```chartjs fenced blocks\n * with <chart-plot> custom elements.\n */\nexport function markdownItChartJsPlugin(md: MarkdownIt) {\n const defaultFence = md.renderer.rules.fence!;\n\n md.renderer.rules.fence = (tokens, idx, options, env, self) => {\n const token = tokens[idx];\n\n // Only process fenced blocks labeled 'chartjs'\n if (token.info.trim() !== 'chartjs') {\n return defaultFence(tokens, idx, options, env, self);\n }\n\n const content = token.content.trim();\n console.log('chartjs content:', content);\n\n return `<chart-plot>${content}</chart-plot>`;\n };\n}\n","// src/app/core/app-injector.ts\r\n\r\nimport { Injector } from '@angular/core';\r\n\r\n/**\r\n * Static variable to hold the root Angular Injector.\r\n * This is necessary to retrieve services outside of Angular's dependency injection context.\r\n */\r\nlet appInjector: Injector;\r\n\r\n/**\r\n * Function to set the global Injector reference.\r\n */\r\nexport function setAppInjector(injector: Injector): void {\r\n appInjector = injector;\r\n}\r\n\r\n/**\r\n * Function to retrieve the global Injector reference.\r\n */\r\nexport function getAppInjector(): Injector {\r\n return appInjector;\r\n}","import { inject, Injectable, InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Injection Token for the specific function to execute on a 401 Unauthorized error.\r\n */\r\nexport const ASSISTANT_UNAUTHORIZED_ACTION_TOKEN = new InjectionToken<() => void>(\r\n 'Function to execute on 401 unauthorized'\r\n);\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class GlobalErrorHandlerService {\r\n private unauthorizedAction = inject(ASSISTANT_UNAUTHORIZED_ACTION_TOKEN, { optional: true });\r\n\r\n /** Prevents infinite unauthorized attempts */\r\n private _authAttempted = false;\r\n\r\n /** Tracks if a re-authentication process is currently in progress */\r\n private _reauthInProgress = false;\r\n\r\n private authEventListener: ((event: Event) => void) | null = null;\r\n\r\n constructor() {\r\n this.setupAuthEventListener();\r\n }\r\n\r\n /**\r\n * Sets up a global listener for the `authenticated` event.\r\n * When re-authentication succeeds (authenticated === true),\r\n * reset the auth lock so another 401 can trigger again later.\r\n */\r\n private setupAuthEventListener(): void {\r\n this.authEventListener = (event: Event) => {\r\n const detail = (event as CustomEvent<{ authenticated: boolean }>).detail;\r\n if (detail?.authenticated) {\r\n console.info('[GLOBAL HANDLER] Authentication succeeded. Resetting 401 lock.');\r\n this._authAttempted = false;\r\n }\r\n };\r\n\r\n window.addEventListener('authenticated', this.authEventListener);\r\n }\r\n\r\n /**\r\n * Main entry point to handle fetch or HTTP errors globally.\r\n */\r\n handleFetchError(url: string, status: number, statusText: string): void {\r\n console.error(`[GLOBAL HANDLER] Status: ${status} on ${url}. ${statusText}`);\r\n\r\n if (status === 401) {\r\n this.handleUnauthorized();\r\n } else if (status >= 500) {\r\n console.warn('[GLOBAL HANDLER] Server error (5xx). Please try again later.');\r\n }\r\n }\r\n\r\n /**\r\n * Handles 401 errors by triggering re-authentication only once\r\n * until authentication is restored (via the DOM event).\r\n */\r\n private async handleUnauthorized(): Promise<void> {\r\n if (this._authAttempted) {\r\n console.warn('[GLOBAL HANDLER] 401 received, but auth already attempted. Ignoring new attempt.');\r\n return;\r\n }\r\n\r\n if (this._reauthInProgress) {\r\n console.warn('[GLOBAL HANDLER] Re-authentication already in progress. Ignoring multiple network calls that might hit 401 simultaneously. only the first triggers the handler');\r\n return;\r\n }\r\n\r\n if (!this.unauthorizedAction) {\r\n console.warn('[GLOBAL HANDLER] Unauthorized (401). No action defined.');\r\n return;\r\n }\r\n\r\n this._authAttempted = true;\r\n this._reauthInProgress = true;\r\n\r\n console.log('[GLOBAL HANDLER] Unauthorized (401). Triggering the handler...');\r\n\r\n try {\r\n await Promise.resolve(this.unauthorizedAction());\r\n } catch (error) {\r\n console.error('[GLOBAL HANDLER] Error during unauthorizedAction:', error);\r\n } finally {\r\n this._reauthInProgress = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clean up global event listener when Angular destroys this service.\r\n */\r\n ngOnDestroy(): void {\r\n if (this.authEventListener) {\r\n window.removeEventListener('authenticated', this.authEventListener);\r\n this.authEventListener = null;\r\n }\r\n }\r\n}\r\n","// src/app/core/fetch-patcher.ts\r\n\r\nimport { getAppInjector } from './app-injector';\r\nimport { GlobalErrorHandlerService } from './global-error-handler.service';\r\nimport { Injector } from '@angular/core';\r\n\r\n/**\r\n * Initializes a global fetch interceptor that patches the native window.fetch function.\r\n *\r\n * This function replaces the browser's native fetch with a custom implementation that:\r\n * - Preserves all original fetch functionality and behavior\r\n * - Intercepts HTTP responses that are not successful (!response.ok)\r\n * - Automatically handles errors through the GlobalErrorHandlerService when available\r\n * - Logs network errors to the console for debugging purposes\r\n *\r\n * The interceptor uses Angular's dependency injection system to retrieve the\r\n * GlobalErrorHandlerService and delegate error handling to it. If the injector\r\n * is not available, the function gracefully continues without error handling.\r\n *\r\n * @remarks\r\n * - This function should be called once during application initialization\r\n * - The original fetch function is preserved and all requests are forwarded to it\r\n * - Non-ok responses are still returned to the caller after error handling\r\n * - Network errors (connection failures, etc.) are logged and re-thrown\r\n *\r\n * @example\r\n * ```typescript\r\n * // Call during app initialization\r\n * initializeFetchInterceptor();\r\n *\r\n * // All subsequent fetch calls will be automatically intercepted\r\n * fetch('/api/data').then(response => {\r\n * // Error handling already occurred if response was not ok\r\n * });\r\n * ```\r\n */\r\nexport function initializeFetchInterceptor(): void {\r\n const originalFetch = window.fetch;\r\n\r\n window.fetch = async function (...args: any): Promise<Response> {\r\n const url = args[0] instanceof Request ? args[0].url : args[0];\r\n\r\n try {\r\n // @ts-ignore\r\n const response = await originalFetch.apply(this, args as any);\r\n\r\n if (!response.ok) {\r\n // --- THE BRIDGE ---\r\n const injector: Injector = getAppInjector();\r\n if (injector) {\r\n // Retrieve the service instance using the injector\r\n const errorHandler = injector.get(GlobalErrorHandlerService);\r\n\r\n // Call the service method with the error details\r\n errorHandler.handleFetchError(url, response.status, response.statusText);\r\n }\r\n // ------------------\r\n\r\n return response;\r\n }\r\n\r\n return response;\r\n\r\n } catch (error: any) {\r\n // Handle network errors here (if needed)\r\n console.error(`[FETCH PATCHER] Network Error for ${url}:`, error);\r\n throw error;\r\n }\r\n } as typeof window.fetch;\r\n}","/**\r\n * Handles unauthorized HTTP responses (401) by clearing session data and reloading the page.\r\n *\r\n * This function is triggered when a 401 Unauthorized response is detected during API calls.\r\n * It performs cleanup operations by removing stored credentials from session storage\r\n * and forces a page reload to redirect the user to the login flow.\r\n *\r\n * @remarks\r\n * This function directly manipulates the browser's session storage and window location,\r\n * making it suitable for client-side applications only.\r\n *\r\n */\r\nexport const handleUnauthorizedLogic = (): void => {\r\n console.log(\"[TOKEN LOGIC] 401 Unauthorized detected. Executing function from Token.\");\r\n\r\n // // Custom logic: Clear session data and force a page reload\r\n sessionStorage.removeItem('sinequa-credentials')\r\n window.location.reload();\r\n};","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i1.UIService","i2.PrincipalService","i3","tap","switchMap","take","map","catchError","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5D,oBAAA,YAAY,CAAC,gBAAgB,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC;gBAC1E;;AAGA,gBAAA,OAAO,QAAQ;YACjB;AAEA,YAAA,OAAO,QAAQ;QAEjB;QAAE,OAAO,KAAU,EAAE;;YAEnB,OAAO,CAAC,KAAK,CAAC,CAAA,kCAAA,EAAqC,GAAG,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;AACjE,YAAA,MAAM,KAAK;QACb;AACF,IAAA,CAAwB;AAC1B;;ACrEA;;;;;;;;;;;AAWG;AACI,MAAM,uBAAuB,GAAG,MAAW;AAChD,IAAA,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC;;AAGtF,IAAA,cAAc,CAAC,UAAU,CAAC,qBAAqB,CAAC;AAChD,IAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;AAC1B;;AClBA;;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/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/markdown-it/markdown-it.config.ts","../../../projects/assistant/chat/smart-renderer/smart-renderer.ts","../../../projects/assistant/chat/tooltip/tooltip.component.ts","../../../projects/assistant/chat/tooltip/tooltip.directive.ts","../../../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/references/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/references/chat-reference/chat-reference.component.html","../../../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/version.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/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/references/chat-reference-image/chat-reference-image.component.ts","../../../projects/assistant/chat/references/chat-reference-image/chat-reference-image.component.html","../../../projects/assistant/chat/references/chat-reference-page/chat-reference-page.component.ts","../../../projects/assistant/chat/references/chat-reference-page/chat-reference-page.component.html","../../../projects/assistant/chat/custom-elements/custom-elements.config.ts","../../../projects/assistant/chat/custom-elements/custom-elements.service.ts","../../../projects/assistant/chat/custom-elements/components/document-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/page-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/image-reference.component.ts","../../../projects/assistant/chat/custom-elements/components/code-block.component.ts","../../../projects/assistant/chat/custom-elements/components/table-tools.component.ts","../../../projects/assistant/chat/custom-elements/components/chart-plot.component.ts","../../../projects/assistant/chat/markdown-it/plugins/code-block.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/image-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/link.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/page-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/document-reference.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/table-tools.plugin.ts","../../../projects/assistant/chat/markdown-it/plugins/chartJs.plugin.ts","../../../projects/assistant/chat/fetch-patcher/app-injector.ts","../../../projects/assistant/chat/fetch-patcher/global-error-handler.service.ts","../../../projects/assistant/chat/fetch-patcher/fetch-patcher.ts","../../../projects/assistant/chat/fetch-patcher/handle-unauthorized-logic.ts","../../../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, fetchApp } from \"@sinequa/atomic\";\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AppService {\r\n app: CCApp | undefined = undefined;\r\n\r\n async init(): Promise<void> {\r\n if (!this.app) {\r\n try {\r\n this.app = await fetchApp();\r\n } catch (error) {\r\n console.error('Error fetching app:', error);\r\n }\r\n }\r\n }\r\n\r\n get appName() {\r\n return this?.app?.name || \"\";\r\n }\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.initProcess$.pipe(filter(Boolean))),\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 this.config?.defaultValues.temperature !== undefined\n || this.config?.defaultValues.top_p !== undefined\n || this.config?.defaultValues.max_tokens !== undefined\n );\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) && config?.defaultValues.temperature !== undefined\">\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) && config?.defaultValues.top_p !== undefined\">\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) && config?.defaultValues.max_tokens !== undefined\">\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","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 { InjectionToken } from '@angular/core';\nimport type MarkdownIt from 'markdown-it';\n\nexport type MarkdownItPlugin = (md: MarkdownIt, ...params: any[]) => void;\n\nexport const ASSISTANT_MARKDOWN_IT_PLUGINS = new InjectionToken<MarkdownItPlugin[]>(\n 'ASSISTANT_MARKDOWN_IT_PLUGINS',\n {\n providedIn: 'root',\n factory: () => [], // default to empty array\n }\n);\n","import { Component, effect, inject, input, Pipe, signal } from \"@angular/core\";\nimport { DomSanitizer } from \"@angular/platform-browser\";\nimport markdownit from \"markdown-it\";\nimport * as Prism from \"prismjs\";\nimport \"prismjs-components-importer/esm\";\nimport \"prismjs/plugins/autoloader/prism-autoloader\";\n\nimport { ASSISTANT_MARKDOWN_IT_PLUGINS } from \"../markdown-it/markdown-it.config\";\n\nconst GROUPING_REGEX = /^<!--[\\s\\S]*?-->|^<[a-z0-9][\\w-]*(?:\\s+[^>]*)?\\/>|^<([a-z0-9][\\w-]*)(?:\\s+[^>]*)?>[\\s\\S]*?<\\/\\1>/gim;\n\n@Pipe({\n name: \"safeHtml\",\n standalone: true,\n})\nexport class SafeHtmlPipe {\n constructor(private sanitizer: DomSanitizer) {}\n\n transform(html) {\n return this.sanitizer.bypassSecurityTrustHtml(html);\n }\n}\n\n@Component({\n selector: \"SmartRenderer\",\n template: `\n <div [innerHTML]=\"safe() | safeHtml\"></div>\n <div [innerHTML]=\"processing() | safeHtml\"></div>\n `,\n imports: [SafeHtmlPipe],\n standalone: true,\n})\nexport class SmartRendererComponent {\n // Entire message content with the delta\n readonly message = input<string>(\"\");\n readonly context = input<any | null>(null);\n\n readonly safe = signal<string>(\"\");\n readonly processing = signal<string>(\"\");\n\n // High order last slice index, ie. where next message() should be truncated\n // to avoid re-rendering the same content.\n private lastSliceIndex = 0;\n // Local slice index to keep track of the current message's content\n private localSliceIndex = 0;\n // Injected markdown-it plugins\n private readonly _markdownItPlugins = inject(ASSISTANT_MARKDOWN_IT_PLUGINS);\n\n constructor() {\n effect(() => this.messageUpdated(), { allowSignalWrites: true });\n }\n\n private createMarkdownItInstance() {\n const md = new markdownit({\n html: true,\n linkify: true,\n highlight: function (code, lang) {\n if (lang && Prism.languages[lang]) {\n try {\n const highlightedCode = Prism.highlight(\n code,\n Prism.languages[lang],\n lang\n );\n // By returning a string that starts with <pre>, we are telling markdown-it that we handled the wrapping.\n return `<pre class=\"language-${lang}\"><code class=\"language-${lang}\">${highlightedCode}</code></pre>`;\n } catch (__) {\n // if prism fails, fall back to no highlighting\n }\n }\n\n // if no lang, or prism fails, just escape the code for safety\n return `<pre class=\"language-code\"><code class=\"language-code\">${markdownit().utils.escapeHtml(\n code\n )}</code></pre>`;\n },\n });\n\n // Apply all injected plugins dynamically\n this._markdownItPlugins.forEach(plugin => md.use(plugin));\n\n return md;\n }\n\n messageUpdated() {\n // render delta from last sliced message\n const md = this.createMarkdownItInstance();\n const html = md.render(this.message(), this.context())\n ?.slice(this.lastSliceIndex);\n\n // split the html into blocks of first level tags\n const blocks = html.match(GROUPING_REGEX);\n\n // no blocks, nothing to process\n if (!blocks || blocks.length === 0) return;\n\n if (blocks.length > 2) {\n this.localSliceIndex = html.lastIndexOf(blocks.at(-2) || \"\");\n this.lastSliceIndex += this.localSliceIndex;\n\n this.safe.update((v) => v + html.slice(0, this.localSliceIndex));\n this.processing.set(html.slice(this.localSliceIndex));\n } else {\n this.processing.set(blocks.slice(0, 2).join(\"\"));\n }\n }\n}\n","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 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 {\r\n Directive,\r\n ElementRef,\r\n HostListener,\r\n Input,\r\n OnDestroy,\r\n TemplateRef\r\n} from \"@angular/core\";\r\nimport { TooltipComponent } from \"./tooltip.component\";\r\n\r\nimport { delay, Observable, of, Subscription } 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 host: {\r\n 'class.has-tooltip': 'hasTooltip'\r\n }\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 (Angular 20 host directive syntax)\r\n */\r\n 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","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 { CommonModule } from \"@angular/common\";\nimport {\n Component,\n computed,\n ElementRef,\n input,\n output,\n signal,\n viewChild\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from \"@jsverse/transloco\";\n\nimport { FormatIconComponent } from \"../../format-icon/format-icon.component\";\nimport { ChatContextAttachment, DocumentPart } from \"../../types\";\n\n@Component({\n selector: \"sq-chat-reference\",\n templateUrl: \"./chat-reference.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n standalone: true,\n styles: [`\n :host {\n display: block;\n &.expanded,\n &:hover {\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n }\n `],\n imports: [\n CommonModule,\n FormatIconComponent,\n TranslocoPipe,\n ],\n providers: [provideTranslocoScope('chat-reference')],\n})\nexport class ChatReferenceComponent {\n readonly reference = input.required<string>();\n readonly attachment = input.required<ChatContextAttachment>();\n readonly partId = input<number | undefined>(undefined);\n readonly referenceMap = input<Map<string, ChatContextAttachment> | undefined>(\n undefined\n );\n readonly images = input<string[]>([]);\n readonly pages = input<string[]>([]);\n\n readonly openDocument = output<ChatContextAttachment>();\n readonly openPreview = output<ChatContextAttachment>();\n\n readonly modalTpl = viewChild<ElementRef<HTMLDialogElement>>(\"modal\");\n\n readonly modalRef = signal<any>({});\n\n readonly groupedImagesIds = computed(() => {\n // Suppose images() returns an array like ['1.1.1', '1.1.2', '1.1.3']\n const groups: Record<string, number[]> = {};\n for (const id of this.images()) {\n const parts = id.split(\".\").map(Number);\n if (parts.length < 3) continue;\n const groupKey = parts[1].toString();\n if (!groups[groupKey]) groups[groupKey] = [];\n groups[groupKey].push(parts[2]);\n }\n return groups;\n });\n readonly groupedPagesIds = computed(() => {\n // Suppose images() returns an array like ['1.1', '1.2', '1.3']\n const groups: Record<string, number[]> = {};\n for (const id of this.pages()) {\n const parts = id.split(\".\").map(Number);\n const groupKey = parts[0].toString();\n if (!groups[groupKey]) groups[groupKey] = [];\n groups[groupKey].push(parts[1]);\n }\n\n return groups;\n });\n\n get parts(): DocumentPart[] {\n if (!this.attachment()) return [];\n return this.attachment().parts.filter(\n (part) => (!this.partId() || part.partId === this.partId()) && !!part.text\n );\n }\n\n findImage = (arr: any[], number: number): any | undefined =>\n arr.find((p) => p.imageNumber === number);\n\n findPage = (arr: any[], number: number): any | undefined =>\n arr.find((p) => p.pageNumber === number);\n\n expandAttachment() {\n if (this.partId()) return;\n this.attachment()[\"$expanded\"] = !this.attachment()[\"$expanded\"];\n }\n\n modalClicked(ref: any) {\n this.modalRef.set(ref);\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\n","<div [class.reference-tooltip]=\"!!partId()\">\n <div\n class=\"reference-data\"\n [class.expanded]=\"attachment()['$expanded'] || !!partId()\"\n (click)=\"expandAttachment()\"\n >\n <span class=\"reference me-1\">{{ reference() }}</span>\n\n <sq-format-icon [extension]=\"attachment().record.fileext\"></sq-format-icon>\n\n <span class=\"title\" [id]=\"'attachment-' + attachment().recordId\">\n {{ attachment().record.title }}\n </span>\n\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); openPreview.emit(attachment())\"\n [title]=\"'chatReference.previewDocument' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-eye\"></i>\n </button>\n\n\n @if (attachment().record.url1 || attachment().record.originalUrl) {\n <button\n type=\"button\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment())\"\n [title]=\"'chatReference.openDocument' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-arrow-up-right-from-square\"></i>\n </button>\n }\n </div>\n\n @if (!!partId() || (attachment()['$expanded'] && parts.length)) {\n <div class=\"reference-passages\">\n @for (part of parts; track $index) {\n <div class=\"reference-passage\">\n <span class=\"reference me-1\">{{ reference() }}.{{ part.partId }}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n\n @for (imageId of groupedImagesIds()[part.partId!]; track $index) {\n @let ref = part?.images?.[imageId - 1];\n @if (ref?.url) {\n <div\n class=\"gap-1 ms-2 my-2 items-start\"\n style=\"display: flex; align-items: start\"\n >\n <span class=\"reference\" style=\"flex-shrink: 0;\">\n {{ \"Img-\" + reference() + \".\" + part.partId + \".\" + imageId }}\n </span>\n\n <img\n [src]=\"ref.url\"\n [alt]=\"ref.description\"\n (click)=\"modalClicked(ref)\"\n />\n </div>\n }\n }\n }\n\n @for (pageId of groupedPagesIds()[reference()]; track $index) {\n @let ref = findPage(referenceMap()?.get(reference())?.pages, pageId);\n @if (ref?.url) {\n <div\n class=\"gap-1 ms-2 my-2 items-start\"\n style=\"display: flex; align-items: start\"\n >\n <span class=\"reference\" style=\"flex-shrink: 0;\">{{ \"Page-\" + reference() + \".\" + pageId }}</span>\n\n <img\n [src]=\"ref.url\"\n [alt]=\"ref.description\"\n (click)=\"modalClicked(ref)\"\n />\n </div>\n }\n }\n </div>\n }\n</div>\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]=\"modalRef().url\" [alt]=\"modalRef().description\" />\n</dialog>\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 ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n ElementRef,\n EventEmitter,\n input,\n Input,\n OnChanges,\n Output,\n signal,\n SimpleChanges\n} from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { ChartComponent } from \"../charts/chart/chart.component\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { MessageContentPipe } from \"../pipes/message-content.pipe\";\nimport { PrincipalService } from \"../services/principal.service\";\nimport { UIService } from \"../services/ui.service\";\nimport { SmartRendererComponent } from \"../smart-renderer/smart-renderer\";\nimport { TooltipDirective } from \"../tooltip/tooltip.directive\";\nimport { ChatContextAttachment, ChatMessage, DocumentPart, SuggestedAction } from \"../types\";\nimport { TextMessageContent } from \"../types/message-content.types\";\nimport { MessageImageReference } from \"../types/message-reference.types\";\nimport { ChatReferenceComponent } from \"../references/chat-reference/chat-reference.component\";\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 InitialsAvatarComponent,\n ChatReferenceComponent,\n ChartComponent,\n MessageContentPipe,\n TranslocoPipe,\n SmartRendererComponent\n ],\n providers: [provideTranslocoScope('chat-message')],\n})\nexport class ChatMessageComponent implements OnChanges {\n id = input<string>();\n\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 @Input() collapseReferences: boolean = true;\n @Output() openDocument = new EventEmitter<{ reference: ChatContextAttachment }>();\n @Output() openPreview = new EventEmitter<{ reference: ChatContextAttachment }>();\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 // signal based set of references to avoid duplicates\n refs = signal<number[]>([]);\n references = computed(() =>\n this.refs().slice().sort((a, b) => a - b).map((r) => \"\" + r)\n );\n referenceMap = new Map<string, ChatContextAttachment>();\n imageReferencesMap = new Map<string, MessageImageReference>();\n pageReferencesMap = new Map<string, MessageImageReference>();\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n // used by the template\n Array = Array;\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.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 }\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 parts: [this.referenceMap.get(doc)?.parts?.[+part - 1]] as DocumentPart[], // since it is not possible to locate the image by itself, we use the part in which it is contained\n $partId: 1 // Always 1 for image references since parts array contains only one element referencing the part containing the image\n },\n images[+image - 1]\n );\n\n // save reference in map for reference list\n if (!this.imageReferencesMap.has(ref)) 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 parts: [{\n offset: pageRef.offSet!,\n length: pageRef.length!\n }], // parts here is an array with a single part representing the page reference\n $partId: 1 // Always 1 for page references since parts array contains only one element referencing the page\n },\n pageRef\n );\n\n // save reference in map for reference list\n if (!this.pageReferencesMap.has(ref)) 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 * Processes a reference string by validating and adding it to the set of references if applicable.\n *\n * - Ignores empty or falsy references.\n * - Ignores references that are not numeric.\n * - Ignores references that already exist in the set.\n * - Converts the reference to a number and adds it to the set of references.\n *\n * @param ref - The reference string to process.\n */\n processReferences(ref: string) {\n if (!ref) return;\n if (isNaN(+ref)) return;\n const refNum = +ref;\n if (this.refs().includes(refNum)) return;\n this.refs.update(arr => [...arr, refNum]);\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*\\[[^\\]]*]\\s*/g, \"\");\n\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment) {\n this.openPreview.emit({ reference: attachment });\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment) {\n this.openDocument.emit({ reference: attachment });\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\n\n @if(message?.role === 'assistant' && message.messageType !== 'CHART') {\n <SmartRenderer\n [message]=\"message.content | messageContent\"\n [context]=\"{\n getEmbeddedPageReference: getEmbeddedPageReference.bind(this),\n getEmbeddedImageReference: getEmbeddedImageReference.bind(this),\n referencesMap: referenceMap,\n references: processReferences.bind(this),\n rank: id()\n }\">\n </SmartRenderer>\n }\n\n <p *ngIf=\"message?.role === 'user' || message?.role === 'search-warning' || message?.role === 'connection-error'\">{{ message.content | messageContent }}</p>\n\n <!-- List of reference, if any -->\n @let referencesArray = references();\n @if (referencesArray?.length > 0 || imageReferencesMap?.size > 0 || pageReferencesMap?.size > 0) {\n <div class=\"references\">\n <details role=\"button\" class=\"select-none\" [open]=\"!collapseReferences\">\n <summary class=\"references-title\">{{ 'chatMessage.references' | transloco }}</summary>\n <ul>\n @for (reference of referencesArray; track $index) {\n @let attachment = referenceMap.get(reference);\n <!-- Only display the reference when the key is a integer not a decimal -->\n @if(attachment) {\n <li class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment?.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n [referenceMap]=\"referenceMap\"\n [images]=\"Array.from(imageReferencesMap.keys())\"\n [pages]=\"Array.from(pageReferencesMap.keys())\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n }\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 {{suggestedAction.type === 'Submit' ? 'fa-paper-plane' : 'fa-comment-medical'}} me-1\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n</div>\n","import { Injectable } from \"@angular/core\";\r\nimport { patchUserSettings } from \"@sinequa/atomic\";\r\nimport { from } from \"rxjs\";\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).catch((error) => {\r\n console.error('Error patching user settings:', error);\r\n throw error;\r\n }));\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 'chat.today';\n } else if (isYesterday(date)) {\n return 'chat.yesterday';\n } else if (isThisWeek(date)) {\n return 'chat.thisWeek';\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return 'chat.lastWeek';\n } else if (isThisMonth(date)) {\n return 'chat.thisMonth';\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return 'chat.lastMonth';\n } else if (isThisQuarter(date)) {\n return 'chat.thisQuarter';\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return 'chat.lastQuarter';\n } else if (isThisYear(date)) {\n return 'chat.thisYear';\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return '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 { inject, Injectable } from '@angular/core';\nimport { get, post } from '@sinequa/atomic';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\n\nimport {\n ChatMessage,\n DeleteSavedChatResponse,\n SavedChat,\n SavedChatHistory,\n SavedChatResponse\n} from '../types';\nimport { NotificationsService } from '../services/notification.service';\nimport { TranslocoService } from '@jsverse/transloco';\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()\nexport class SavedChatsService {\n private operationConfig: SavedChatsOperationConfig | undefined;\n\n private readonly notificationsService = inject(NotificationsService);\n private readonly transloco = inject(TranslocoService);\n\n constructor() {}\n\n public init(config: SavedChatsOperationConfig): void {\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 async listChats(): Promise<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 try {\n const res = await get<{ savedChats: SavedChat[] }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)\n config.updateSavedChatsList(res.savedChats);\n config.setSavedChatsErrorStatus(false);\n } catch (error) {\n const errorMsg = 'Error occurred while calling the SavedChatList API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n config.setSavedChatsErrorStatus(true);\n\n throw error;\n }\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 }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)).pipe(\n tap(res => {\n config.generateAuditEvent('ast-saved-chat.load', { duration: res.executionTimeMilliseconds }, id);\n if (!res.savedChat) {\n this.notificationsService.error(this.transloco.translate('savedChats.loadFail'));\n }\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>(`api/v1/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>(`api/v1/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>(`api/v1/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(\n get<{ exists: boolean, executionTime: string, executionTimeMilliseconds: number }>(`api/v1/plugin/${config.getRestUrl()}`, searchParams)\n .then(res => res.exists)\n .catch((error) => {\n const errorMsg = 'Error occurred while calling the SavedChatExist API: ' + error.error?.errorMessage;\n console.error('SavedChatsService: ' + errorMsg);\n throw error;\n })\n );\n }\n}\n","import { Injectable } 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/**\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 } 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()\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 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 $expanded?: boolean;\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 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// 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().optional(),\n top_p: z.number().optional(),\n max_tokens: z.number().optional(),\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().optional(),\n top_p: z.number().optional(),\n max_tokens: z.number().optional(),\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.string(), 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(z.string(), 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 queryWebserviceForSearch: z.string().optional()\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 collapseReferences: z.boolean().optional(),\n automaticScroll: 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/** */\n\nexport type PluginVersion = {\n pluginVersion: string;\n major: number;\n minor: number;\n build: number;\n}\n","import { Injectable, inject } from '@angular/core';\nimport { TranslocoService } from '@jsverse/transloco';\nimport {\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()\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 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 // Ensure the app service is initialized\n await this.appService.init();\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 // According tothe ticket ES-27809, this value is hardcoded and could not be changed\n const url = \"SinequaAssistantREST\";\n context.setRESTRequestsUrl(url);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { get } from '@sinequa/atomic';\nimport { from, Observable, throwError } from 'rxjs';\nimport { catchError, map, tap } from 'rxjs/operators';\n\nimport { ChatConfig, GllmFunction, GllmModelDescription, PluginVersion } 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()\nexport class AssistantMetadataService {\n private context: AssistantMetadataOperationContext | undefined;\n\n public init(context: AssistantMetadataOperationContext): void {\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 }>(`api/v1/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 }>(`api/v1/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 getPluginVersion(): Observable<PluginVersion | undefined> {\n this.ensureInitialized();\n const context = this.context!;\n const assistantConfig = context.getAssistantConfigValue();\n\n const data = {\n action: \"pluginversion\",\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<PluginVersion | undefined>(`api/v1/plugin/${context.getRestUrl()}`, searchParams))\n .pipe(\n catchError((error) => {\n console.error('Error invoking pluginversion:', error);\n return throwError(() => error);\n })\n );\n }\n\n getSinequaESVersion(): Observable<string | undefined> {\n return from(get<{ serverVersion: string | undefined }>(`api/v2/version`))\n .pipe(\n map(response => response?.serverVersion),\n catchError((error) => {\n console.error('Error fetching Sinequa ES version:', 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()\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 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 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 ...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 if (assistantConfig.defaultValues.temperature !== undefined) data.serviceSettings.temperature = assistantConfig.defaultValues.temperature;\n if (assistantConfig.defaultValues.top_p !== undefined) data.serviceSettings.top_p = assistantConfig.defaultValues.top_p;\n if (assistantConfig.defaultValues.max_tokens !== undefined) data.serviceSettings.max_tokens = assistantConfig.defaultValues.max_tokens;\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 // Use a named handler so it can be removed after firing, preventing listener accumulation across multiple stop operations\n const cancelHandler = (res: any) => {\n connection.off('CancelTasks', cancelHandler);\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 connection.on('CancelTasks', cancelHandler);\n\n // Invoke the CancelTasks method and handle errors\n connection.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n connection.off('CancelTasks', cancelHandler);\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 { get } from '@sinequa/atomic';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, map } from 'rxjs/operators';\n\nimport {\n DebugMessage,\n ListObject\n} from '../types';\n\nexport interface DebugMessageOperationConfig {\n getRestUrl: () => string;\n}\n\n@Injectable()\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>(`api/v1/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 throw error;\n })\n );\n }\n}\n","// Auto-generated\nexport const LIB_VERSION = '4.0.0';\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 PluginVersion,\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\";\nimport { DebugMessageOperationConfig, DebugMessageService } from \"./debug-message/debug-message.service\";\nimport { LIB_VERSION } from \"./version\";\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 // Inject the SignalRConnectionService using 'new' to ensure a separate local instance for each ChatService instance\n private signalRConnectionService = new SignalRConnectionService();\n private assistantConfigurationService = inject(AssistantConfigurationService);\n private assistantMetadataService = new 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 switchMap(() => {\n this.getWSRequestsUrl();\n this.getRESTRequestsUrl();\n this._initAssistantMetadataService();\n this._initAssistantTokensTrackingService();\n this._initSavedChatsService();\n this._initDebugMessageService();\n this._initSignalRConnectionService();\n return this.checkVersionAlignment();\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 !== undefined && functions !== undefined && !!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 * Retrieves the plugin version information.\n * @returns An Observable of PluginVersion or undefined.\n */\n getPluginVersion(): Observable<PluginVersion | undefined> {\n return this.assistantMetadataService.getPluginVersion();\n }\n\n /**\n * Retrieves the Sinequa Enterprise Search version.\n * @returns The Sinequa Enterprise Search version as a string, or undefined if not available.\n */\n getSinequaESVersion(): Observable<string | undefined> {\n return this.assistantMetadataService.getSinequaESVersion();\n }\n /**\n * Checks and logs the version alignment between the Angular library, plugin, and Sinequa ES.\n * It fetches the plugin and Sinequa ES versions in parallel and logs the information to the console.\n */\n checkVersionAlignment(): Observable<any> {\n return forkJoin([\n this.getSinequaESVersion(),\n this.getPluginVersion()\n ]).pipe(\n tap(([esVersion, pluginVersion]) => {\n const infoMessage = `[INFO] - Assistant instance [${this.chatInstanceId}]: Angular Library [${LIB_VERSION}] Plugin [${pluginVersion?.pluginVersion}] Build [${esVersion}]`;\n console.log(\n \"%cℹ️ \" + infoMessage,\n \"background: #E0F8F8; color: #222; border: 1px solid #222; padding: 2px 6px; border-radius: 4px; font-weight: 500;\",\n );\n if (pluginVersion?.pluginVersion !== LIB_VERSION) {\n const warningMessage = `[WARN] - Assistant instance [${this.chatInstanceId}]: Version mismatch between the Angular library [${LIB_VERSION}] and Plugin [${pluginVersion?.pluginVersion}].\\n💡 [HELP] Please ensure both are on the same version to avoid potential issues.`;\n console.log(\n \"%c⚠️ \" + warningMessage,\n \"background: #FFF4E5; color: #222; border: 1px solid #222; padding: 2px 6px; border-radius: 4px; font-weight: 500;\",\n );\n }\n })\n );\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 { Component, Input } from \"@angular/core\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\nimport * as Prism from 'prismjs';\n\nimport { UIService } from \"../../services/ui.service\";\nimport { KvObject, ListObject } from \"../../types\";\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 {\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, DestroyRef, 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\";\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 { 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\";\nimport { AssistantUtils } from \"./utils/utils.service\";\nimport { AssistantConfigurationService } from \"./services/assistant-configuration.service\";\nimport { AssistantTokensTrackingService } from \"./services/assistant-tokens-tracking.service\";\nimport { SavedChatsService } from \"./saved-chats/saved-chats.service\";\nimport { DebugMessageService } from \"./debug-message/debug-message.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 ChatService,\n AssistantConfigurationService,\n AssistantTokensTrackingService,\n SavedChatsService,\n DebugMessageService,\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 private destroyRef = inject(DestroyRef);\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 /** Used by assistant web component to pass properly init the global config */\n @Input() appConfig: AppGlobalConfig;\n /** Whether the chat component is displayed in a collapsed state */\n @Input() collapsed: boolean = false;\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('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 config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n isAdminOrDeletedAdmin = false;\n question = '';\n\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 constructor() {\n this.destroyRef.onDestroy(async () => {\n console.log(`Destroying ChatComponent: ${this.instanceId} \\n along with ChatService: ${this.chatService.chatInstanceId} \\n and stopping connection: ${this.chatService.connection?.connectionId}`);\n if (this.chatService.connection && this.chatService.connection.state !== HubConnectionState.Disconnected && this.chatService.connection.state !== HubConnectionState.Disconnecting) {\n try {\n await this.chatService.stopConnection()\n } catch (error) {\n console.error(`Error during the destruction of ChatComponent: ${this.instanceId}`, error);\n }\n }\n });\n }\n\n ngOnInit(): void {\n if (this.appConfig) {\n setGlobalConfig(this.appConfig);\n }\n\n of(isAuthenticated()).pipe(\n takeUntilDestroyed(this.destroyRef),\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 // Example of listening to custom events from the web element and handling them in the Angular component\n addEventListener('onOpenPreview', (event: any) => {\n this.openPreview.emit(event.detail.reference);\n });\n addEventListener('onOpenDocument', (event: any) => {\n this.openDocument.emit(event.detail.reference.record);\n });\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (changes.collapsed) {\n setTimeout(() => {\n this._addScrollListener();\n });\n }\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\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!.unsubscribe();\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 const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (!messageList) {\n return;\n }\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(messageList!, 'scroll'))\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n setTimeout(() => {\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 && this.rankMessageToEdit !== 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-1);\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.scrollDown(); // Scroll down to the bottom of the chat to see the new user message and the incoming assistant answer\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 || this.config.globalSettings.automaticScroll) {\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 || this.config.globalSettings.automaticScroll) {\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 const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (messageList) {\n return Math.round(messageList.scrollHeight - messageList.scrollTop - 1) <= messageList.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n const messageList = document.getElementById(`messageList-${this.instanceId}`);\n if (messageList) {\n messageList.scrollTop = messageList.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 const date = (new Date()).toLocaleString('en-US', { weekday: 'long', month: 'long', day: '2-digit', year: 'numeric' });\n // Define the default system prompt and user prompt messages\n const systemMsg = {\n role: 'system',\n content: AssistantUtils.formatPrompt(\n this.transloco.translate(this.config.defaultValues.systemPrompt),\n { principal: this.principalService.principal, date }\n ),\n additionalProperties: { display: false, messageId: guid() }\n };\n // backward compatibility with old configuration files\n const userPrompt = this.config.defaultValues.userPrompt.replace(/\\{\\{(.*?)\\}\\}/g, '[[$1]]');\n const userMsg = {\n role: 'user',\n content: AssistantUtils.formatPrompt(\n this.transloco.translate(userPrompt),\n { principal: this.principalService.principal, date }\n ),\n additionalProperties: { display: this.config.modeSettings.displayUserPrompt, messageId: guid() }\n };\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.chatService.loadSavedChat$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\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 * 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 rankFirstPreviousUserMessage = this.assistantUtils.getMessageRankInChatHistory(this.chatService.chatHistory!, this.messages$.value![i].additionalProperties.messageId);\n // Rank of the assistant's message on which the user clicked to regenerate\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, rankFirstPreviousUserMessage);\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 index of the message containing the suggested action.\n * @returns void\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n\n const details = {\n 'text': action.content,\n 'suggestedAction-type': action.type\n };\n this.chatService.generateAuditEvent('ast-suggested-action.click', details);\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 [id]=\"'messageList-' + instanceId\">\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 [id]=\"message.additionalProperties.messageId\"\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 [collapseReferences]=\"!!config?.globalSettings.collapseReferences\"\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) !== true && (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, Observable, Subject, Subscription, catchError, combineLatest, debounceTime, distinctUntilChanged, filter, from, map, of, switchMap, tap } from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { parseISO, toDate } from \"date-fns\";\n\nimport { Article, fetchQuery, isAuthenticated, Query } 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\";\nimport { SavedChatsService } from \"./saved-chats.service\";\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: [SavedChatsService, 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 queryWebserviceForSearch?: string;\n private searchQuery: Query;\n private searchText: string;\n private searchText$ = new Subject<string>();\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 this.queryWebserviceForSearch = this.chatService.assistantConfig$.value!.savedChatSettings?.queryWebserviceForSearch;\n }\n if (!!this.queryWebserviceForSearch) {\n this.searchQuery = { name: this.queryWebserviceForSearch };\n }\n })\n ).subscribe()\n );\n\n this.subscription.add(\n this.searchText$\n .pipe(\n debounceTime(2000),\n distinctUntilChanged(),\n switchMap(searchText => {\n this.searchText = searchText;\n if (!searchText) {\n return of(this.chatService.savedChats$.value || []);\n }\n this.searchQuery.text = searchText;\n return this.searchSavedChats();\n }),\n tap(savedChats =>\n this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats))\n )\n )\n .subscribe()\n );\n\n\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n onSearch(event: Event): void {\n this.searchText$.next((event.target as HTMLInputElement).value);\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]) => {\n if (!this.queryWebserviceForSearch || !this.searchText) {\n this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats))\n } else {\n this.searchSavedChats().subscribe(savedChats => this.groupedSavedChats$.next(this._groupSavedChatsByDate(savedChats)));\n }\n })\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 private searchSavedChats(): Observable<SavedChat[]> {\n return from(fetchQuery(this.searchQuery)).pipe(\n map(res => res.records.map((a: Article) => ({\n id: a.id.split('|')[1], // removing the app name in front of the ID causing issues to fetch the saved chat\n title: a.title,\n modifiedUTC: a.modified\n }))),\n catchError(() => of(this.chatService.savedChats$.value || []))\n )\n }\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngIf=\"!!queryWebserviceForSearch\" class=\"sticky-top\">\n <input type=\"search\" class=\"form-control\" [placeholder]=\"'savedChats.searchPlaceholder' | transloco\" (keyup)=\"onSearch($event)\" (search)=\"onSearch($event)\" />\n </div>\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 | transloco}}</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 <button\n type=\"button\"\n (click)=\"renameDialog.showModal($event, savedChat)\"\n [sqTooltip]=\"'savedChats.rename' | transloco\"\n class=\"mx-1 bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-pen saved-chat-actions\"></i>\n </button>\n <button\n type=\"button\"\n (click)=\"deleteDialog.showModal($event, savedChat)\"\n [sqTooltip]=\"'savedChats.delete' | transloco\"\n class=\"ms-1 bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-trash saved-chat-actions\"></i>\n </button>\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 { HttpClient, HttpEventType, HttpHeaders, HttpResponse, HttpUploadProgressEvent } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { getToken, globalConfig, post } from '@sinequa/atomic';\nimport { BehaviorSubject, catchError, filter, from, map, Observable, take, tap } from 'rxjs';\nimport { AppService } from '../services/app.service';\nimport { deleteDocumentsResponse, IndexingInfos, UploadConfig, UploadedDocument, UploadedDocuments, UploadEvent } from './documents-upload.model';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DocumentsUploadService {\n\n public readonly REQUEST_URL = \"api/v1/plugin/SinequaAssistantREST\";\n /** Documents upload configuration. */\n public uploadConfig$ = new BehaviorSubject<UploadConfig | undefined>(undefined);\n\n /** Emit the list of indexed documents */\n public uploadedDocuments$ = new BehaviorSubject<UploadedDocument[] | undefined>([]);\n\n public appService = inject(AppService);\n public http = inject(HttpClient);\n\n /**\n * Initializes the file upload service.\n */\n init(): void {\n if (this.uploadConfig$.value === undefined) {\n try {\n this.getUploadConfig();\n } catch (error) {\n throw new Error(error);\n }\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 };\n\n from(post<UploadConfig>(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 };\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}/${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 };\n\n return from(post<IndexingInfos>(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 };\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>(this.REQUEST_URL, data)).pipe(\n tap((res: UploadedDocuments) => this.uploadedDocuments$.next(res.docs)),\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 };\n\n return from(post<deleteDocumentsResponse>(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 };\n\n return from(post<deleteDocumentsResponse>(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 finalize,\n interval,\n Subscription,\n switchMap,\n takeWhile,\n tap,\n startWith,\n of,\n take,\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe, TranslocoService } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { IndexingInfos, UploadEvent, UploadingInfos } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.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: [provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, NgxFlowModule, FormatIconComponent, TranslocoPipe]\n})\nexport class DocumentUploadComponent implements OnInit, OnDestroy {\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 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 documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n private readonly transloco = inject(TranslocoService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n switchMap((_) => this.appService.init()),\n tap((_) => this.documentsUploadService.init()),\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 /**\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), // Use takeWhileInclusive() pattern to ensure that the last value where isCompleted === true is also included.\n catchError((err) => {\n console.error(err);\n this.notificationsService.error(this.transloco.translate('chatDocumentsUpload.errorIndexingStatus'));\n return EMPTY;\n }),\n finalize(() => {\n // Refresh the list of uploaded documents at the end of indexing\n this.documentsUploadService.getDocumentsList().pipe(take(1)).subscribe();\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 class=\"me-1\" [title]=\"transfer.name\">{{ transfer.name }}</span>\n <button\n type=\"button\"\n (click)=\"flow.cancelFile(transfer)\"\n [title]=\"'chatDocumentsUpload.cancel' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"fas fa-trash\"></i>\n </button>\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, OnDestroy, OnInit } from \"@angular/core\";\nimport {\n BehaviorSubject,\n catchError,\n combineLatest,\n EMPTY,\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 { AssistantUtils } from \"../../utils/utils.service\";\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { FormatIconComponent } from '../../format-icon/format-icon.component';\nimport { UploadedDocument } from \"../documents-upload.model\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.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: [provideTranslocoScope('chat-documents-upload')],\n imports: [CommonModule, FormatIconComponent, TranslocoPipe],\n})\nexport class DocumentListComponent implements OnInit, OnDestroy {\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 documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\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 switchMap((_) => this.appService.init()),\n tap((_) => {\n this.onUpdateUploadedDocumentsList();\n this.documentsUploadService.getDocumentsList();\n }),\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 /**\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 onUpdateUploadedDocumentsList(): void {\n this._subscription.add(\n combineLatest([\n this.documentsUploadService.uploadedDocuments$,\n this.transloco.langChanges$\n ]).pipe(\n tap(([uploadedDocuments]) => {\n this.groupedUploadedDocuments$.next(this._groupUploadedDocumentsByDate(uploadedDocuments))\n }),\n catchError((error) => {\n console.error(error);\n this.notificationsService.error(error);\n return EMPTY;\n })\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 }),\n switchMap(() => this.documentsUploadService.getDocumentsList()),\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 }),\n switchMap(() => this.documentsUploadService.getDocumentsList()),\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[] | undefined): { key: string; value: UploadedDocument[] }[] {\n if (!docs || docs.length === 0) {\n return [];\n }\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 | transloco}}</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 <button\n type=\"button\"\n (click)=\"deleteDocument($event, doc)\"\n [title]=\"'chatDocumentsUpload.delete' | transloco\"\n class=\"bg-transparent border-0 p-0 m-0 cursor-pointer text-inherit leading-none inline-flex items-center justify-center\"\n >\n <i class=\"uploaded-doc-actions fas fa-trash ms-1\"></i>\n </button>\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 catchError,\n EMPTY,\n of,\n Subscription,\n switchMap,\n tap\n} from \"rxjs\";\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { isAuthenticated } from \"@sinequa/atomic\";\n\nimport { DocumentsUploadService } from \"../documents-upload.service\";\nimport { NotificationsService } from \"../../services/notification.service\";\nimport { AppService } from \"../../services/app.service\";\n\n@Component({\n selector: \"sq-document-overview\",\n templateUrl: \"./document-overview.component.html\",\n standalone: true,\n providers: [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 @Input() disabledUpload: boolean = true;\n\n @Output() onUpload = new EventEmitter();\n\n private _subscription = new Subscription();\n\n public documentsUploadService = inject(DocumentsUploadService);\n public notificationsService = inject(NotificationsService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this._subscription.add(\n of(isAuthenticated()).pipe(\n switchMap((_) => this.appService.init()),\n tap((_) => this.documentsUploadService.init()),\n switchMap((_) => this.documentsUploadService.getDocumentsList()),\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}\n","<div class=\"d-flex\">\n <span class=\"overview-text flex-grow-1\">\n {{ 'chatDocumentsUpload.uploadedDocuments' | transloco: { count: (documentsUploadService.uploadedDocuments$ | async)?.length || 0 } }}\n </span>\n <button 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","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 { DocumentPart, RawAttachment } from \"../../types\";\nimport { MessageImageReference } from \"../../types/message-reference.types\";\n\n@Component({\n selector: \"ChatReferenceImage\",\n standalone: true,\n providers: [provideTranslocoScope('chat-reference')],\n imports: [FormatIconComponent, TranslocoPipe],\n templateUrl: \"./chat-reference-image.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n styles: [`\n :host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n padding: 0.5rem;\n background-color: blue;\n box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);\n font-size: 0.875rem;\n\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n`]\n})\nexport class ChatReferenceImageComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: number, parts: DocumentPart[] }\n >();\n readonly openDocument = output<Omit<RawAttachment, \"type\">>();\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 parts: this.ref().parts!,\n $partId: this.ref().$partId!\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 });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\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 ?? ('chatReference.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReference.previewDocument' | 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]=\"'chatReference.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","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 { DocumentPart, RawAttachment } from \"../../types\";\nimport { MessageImageReference } from \"../../types/message-reference.types\";\n\n@Component({\n selector: \"ChatReferencePage\",\n standalone: true,\n providers: [provideTranslocoScope('chat-reference')],\n imports: [FormatIconComponent, TranslocoPipe],\n templateUrl: \"./chat-reference-page.component.html\",\n styleUrls: [\"../chat-reference.scss\"],\n styles: [`\n :host {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n padding: 0.5rem;\n background-color: blue;\n box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);\n font-size: 0.875rem;\n\n background-color: var(--ast-reference-expanded-hover-bg, white);\n }\n`]\n})\nexport class ChatReferencePageComponent {\n readonly id = input.required<string>();\n readonly ref = input.required<MessageImageReference>();\n\n readonly openPreview = output<\n Omit<RawAttachment, \"type\"> & { $partId: number, parts: DocumentPart[] }\n >();\n readonly openDocument = output<Omit<RawAttachment, \"type\">>();\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 parts: this.ref().parts!,\n $partId: this.ref().$partId!\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 });\n }\n\n modalClicked() {\n this.modalTpl()?.nativeElement?.showModal();\n }\n}\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 ?? ('chatReference.untitledImage' | transloco) }}</p>\n\n <a role=\"button\" [title]=\"'chatReference.previewDocument' | 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]=\"'chatReference.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","import { InjectionToken, Type } from '@angular/core';\n\nexport const ASSISTANT_CUSTOM_ELEMENTS = new InjectionToken<Record<string, Type<unknown>>>(\n 'ASSISTANT_CUSTOM_ELEMENTS',\n {\n providedIn: 'root',\n factory: () => ({}), // default to empty object\n }\n);\n","import { inject, Injectable, Injector } from \"@angular/core\";\nimport { createCustomElement } from \"@angular/elements\";\n\nimport { ASSISTANT_CUSTOM_ELEMENTS } from \"./custom-elements.config\";\n\n/**\n * Service to register custom elements in the Angular application.\n * This service is used to define custom elements that can be used in the application.\n * It is called through APP_INITIALIZER to ensure that custom elements are registered before the application starts.\n */\n\n@Injectable({ providedIn: \"root\" })\nexport class CustomElementsService {\n private _injector = inject(Injector);\n private readonly _customElements = inject(ASSISTANT_CUSTOM_ELEMENTS);\n\n setupCustomElements() {\n Object.entries(this._customElements).forEach(([tagName, component]) => {\n if (!customElements.get(tagName)) {\n const element = createCustomElement(component, {\n injector: this._injector,\n });\n customElements.define(tagName, element);\n }\n });\n }\n}\n\nexport function initializeCustomElements(customElementsService: CustomElementsService) {\n return () => customElementsService.setupCustomElements();\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport { ChatReferenceComponent } from \"../../references/chat-reference/chat-reference.component\";\n\n@Component({\n selector: \"document-reference\",\n imports: [TooltipDirective, ChatReferenceComponent],\n template: `\n <a\n class=\"reference\"\n role=\"button\"\n [sqTooltip]=\"ref\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n (click)=\"onOpenPreview(ref)\"\n >{{ id }}</a>\n\n <!-- tooltip template -->\n <ng-template #tooltipTpl>\n <sq-chat-reference\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n ></sq-chat-reference>\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class DocumentReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref:ChatContextAttachment = {} as ChatContextAttachment;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport type { MessageImageReference } from \"../../types/message-reference.types\";\nimport { ChatReferencePageComponent } from \"../../references/chat-reference-page/chat-reference-page.component\";\n\n@Component({\n selector: \"page-reference\",\n imports: [TooltipDirective, ChatReferencePageComponent],\n template: `\n <span\n class=\"reference\"\n [sqTooltip]=\"{ obj: ref, id }\"\n [sqTooltipTemplate]=\"pageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Page-{{ id }}\n </span>\n <ng-template #pageTooltipTpl let-ref>\n <ChatReferencePage\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n />\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class PageReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref: MessageImageReference = {} as MessageImageReference;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, Input, OnChanges } from \"@angular/core\";\nimport { TooltipDirective } from \"../../tooltip/tooltip.directive\";\nimport { ChatContextAttachment } from \"../../types\";\nimport type { MessageImageReference } from \"../../types/message-reference.types\";\nimport { ChatReferenceImageComponent } from \"../../references/chat-reference-image/chat-reference-image.component\";\n\n@Component({\n selector: \"image-reference\",\n imports: [TooltipDirective, ChatReferenceImageComponent],\n template: `\n <span\n class=\"reference\"\n [sqTooltip]=\"{ obj: ref, id }\"\n [sqTooltipTemplate]=\"imageTooltipTpl\"\n [hoverableTooltip]=\"true\"\n >\n Img-{{ this.id }}\n </span>\n <ng-template #imageTooltipTpl let-ref>\n <ChatReferenceImage\n style=\"max-width: 30vw;\"\n [id]=\"ref.id\"\n [ref]=\"ref.obj\"\n (openPreview)=\"onOpenPreview($event)\"\n (openDocument)=\"onOpenDocument($event)\"\n />\n </ng-template>\n `,\n standalone: true,\n styles: `\n div { border: 1px solid #ccc; padding: 8px;border-radius: 4px; display: flex; gap: 8px; flex-direction: column; }\n `,\n})\nexport class ImageReferenceComponent implements OnChanges {\n // je suis obligé d'utiliser les décorateurs @Input() car Angular ne supporte pas les inputs (signal) dans les web elements en Angular v18\n @Input() id;\n @Input() attachment;\n\n ref: MessageImageReference = {} as MessageImageReference;\n\n ngOnChanges() {\n if (!this.attachment) return;\n try {\n const obj = JSON.parse(decodeURIComponent(atob(this.attachment)));\n this.ref = obj;\n } catch (error) {\n console.error(\"Error parsing attachment\", error, this.attachment);\n }\n }\n\n onOpenPreview(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenPreview\", {\n detail: { reference: attachment }\n })\n );\n }\n\n onOpenDocument(attachment: ChatContextAttachment) {\n // Émettre un événement personnalisé pour le web element using the service\n dispatchEvent(\n new CustomEvent(\"onOpenDocument\", {\n detail: { reference: attachment }\n })\n );\n }\n}\n","import { Component, ElementRef, inject, Input, signal } from \"@angular/core\";\n\n@Component({\n selector: \"code-block\",\n template: `\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-end align-items-center\">\n <span class=\"me-auto\">{{ langname || 'code'}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"handleClick($event)\" title=\"Copy to clipboard\">\n @if(copying()){\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z\" fill=\"currentColor\"></path></svg>\n } @else {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\" fill=\"currentColor\"></path></svg>\n }\n </button>\n </div>\n <ng-content></ng-content>\n </div>\n `,\n standalone: true,\n })\n export class CodeBlockComponent {\n @Input() langname = \"\";\n\n el = inject(ElementRef);\n copying = signal(false);\n\n handleClick(event: Event) {\n event.stopPropagation();\n // get the code content\n const codeEl = this.el.nativeElement.querySelector(\"code\");\n const code = codeEl ? codeEl.textContent : \"\";\n // this.encodeCode = encodeURIComponent(code);\n this.copyCodeToClipboard(code || \"\");\n }\n\n copyCodeToClipboard(code: string): void {\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard\n .writeText(code)\n .then(() => {\n // Provide visual feedback to the user\n this.copying.set(true);\n setTimeout(() => {\n this.copying.set(false);\n }, 2000);\n })\n .catch((err) => {\n console.error(\"Failed to copy text: \", err);\n });\n } else {\n // Fallback for older browsers\n const textarea = document.createElement(\"textarea\");\n textarea.value = code;\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n try {\n document.execCommand(\"copy\");\n // Provide visual feedback to the user\n this.copying.set(true);\n setTimeout(() => {\n this.copying.set(false);\n }, 2000);\n } catch (err) {\n console.error(\"Fallback: Oops, unable to copy\", err);\n }\n document.body.removeChild(textarea);\n }\n }\n }\n","import { Component, ElementRef, inject, signal } from '@angular/core';\nimport { provideTranslocoScope, TranslocoPipe } from '@jsverse/transloco';\n\nimport { TooltipDirective } from '../../tooltip/tooltip.directive';\n\n@Component({\n selector: 'table-tools',\n standalone: true,\n template: `\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-end align-items-center\">\n <button class=\"btn btn-light btn-sm\" (click)=\"copyAsCSV()\" [sqTooltip]=\"copied() ? ('customElements.copied' | transloco) : ('customElements.copyAsCSV' | transloco)\">\n @if(!copied()) {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z\" fill=\"currentColor\"></path></svg>\n } @else {\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" aria-hidden=\"true\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z\" fill=\"currentColor\"></path></svg>\n }\n </button>\n <button class=\"btn btn-light btn-sm\" (click)=\"downloadAsCSV()\" [sqTooltip]=\"'customElements.downloadAsCSV' | transloco\">\n <svg data-testid=\"geist-icon\" height=\"16\" stroke-linejoin=\"round\" viewBox=\"0 0 16 16\" width=\"16\" style=\"color: currentcolor;\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z\" fill=\"currentColor\"></path></svg>\n </button>\n </div>\n <ng-content></ng-content>\n </div>\n `,\n providers: [provideTranslocoScope('custom-elements')],\n imports: [TooltipDirective, TranslocoPipe],\n})\nexport class TableToolsComponent {\n private readonly host = inject(ElementRef<HTMLElement>);\n\n copied = signal(false);\n\n get table(): HTMLTableElement | null {\n return this.host.nativeElement.querySelector('table');\n }\n\n copyAsCSV() {\n const csv = this.extractCSV();\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard\n .writeText(csv)\n .then(() => {\n this.copied.set(true);\n setTimeout(() => this.copied.set(false), 2000);\n })\n .catch((err) => {\n console.error(\"Failed to copy table: \", err);\n });\n } else {\n // Fallback for older browsers\n const textarea = document.createElement(\"textarea\");\n textarea.value = csv;\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\n textarea.style.opacity = \"0\";\n document.body.appendChild(textarea);\n textarea.focus();\n textarea.select();\n try {\n document.execCommand(\"copy\");\n this.copied.set(true);\n setTimeout(() => this.copied.set(false), 2000);\n } catch (err) {\n console.error(\"Fallback: Oops, unable to copy table: \", err);\n }\n document.body.removeChild(textarea);\n }\n }\n\n downloadAsCSV() {\n const csv = this.extractCSV();\n // ✅ Add UTF-8 BOM to fix character encoding in Excel and Windows\n const BOM = '\\uFEFF';\n const blob = new Blob([BOM + csv], { type: 'text/csv;charset=utf-8;' });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n link.download = `AI-generated-table-${timestamp}.csv`;\n link.click();\n }\n\n private extractCSV(): string {\n const table = this.table;\n if (!table) return '';\n const rows = Array.from(table.rows).map(row =>\n Array.from(row.cells)\n .map(cell => `\"${cell.textContent?.trim() ?? ''}\"`)\n .join(',')\n );\n return rows.join('\\n');\n }\n}\n","import {\n AfterViewInit,\n Component,\n DestroyRef,\n ElementRef,\n ViewChild,\n inject,\n} from '@angular/core';\nimport { Chart, ChartConfiguration } from 'chart.js';\n\n@Component({\n selector: 'chart-plot',\n standalone: true,\n template: `\n <canvas #chartPlot></canvas>\n <div style=\"display:none\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class ChartPlotComponent implements AfterViewInit {\n\n @ViewChild('chartPlot', { static: true }) chartPlotRef!: ElementRef<HTMLCanvasElement>;\n\n private destroyRef = inject(DestroyRef);\n private chart?: Chart;\n\n constructor() {\n // Cleanup on destroy\n this.destroyRef.onDestroy(() => {\n this.chart?.destroy();\n });\n }\n\n ngAfterViewInit() {\n const config = this.parseChartJsConfig();\n if (!config) return;\n\n // ✅ Render chart directly into canvas\n this.chart = new Chart(this.chartPlotRef.nativeElement, config);\n\n }\n\n private parseChartJsConfig(): ChartConfiguration | null {\n const rawConfig = this.getChartJsConfig();\n if (!rawConfig) return null;\n\n try {\n return JSON.parse(rawConfig);\n } catch (e) {\n return null;\n }\n }\n\n private getChartJsConfig(): string {\n return this.chartPlotRef.nativeElement.parentElement?.textContent?.trim() ?? '';\n }\n}\n","import type MarkdownIt from \"markdown-it\";\n\nexport function markdownItCodeBlockPlugin(md: MarkdownIt) {\n const defaultFenceRenderer = md.renderer.rules.fence!;\n\n md.renderer.rules.fence = (tokens, idx, options, env, self) => {\n const token = tokens[idx];\n const info = token.info ? md.utils.unescapeAll(token.info).trim() : '';\n const langName = info.split(/(\\s+)/g)[0];\n const defaultRendered = defaultFenceRenderer(tokens, idx, options, env, self);\n\n // We add a wrapper and a copy button.\n // The button will have an attribute `[copy-to-clipboard]` which can be handled by an Angular directive\n // to implement the copy functionality. The code to be copied is projected into the component.\n return `<code-block langname=\"${langName}\">${defaultRendered}</code-block>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\nimport Token from 'markdown-it/lib/token.mjs';\n/**\n * A markdown-it plugin to convert [Img-x.y.z], where x, y and z are numbers, into a <image-reference id=\"x.y.z\">Img-x.y.z</image-reference> HTML tag.\n *\n * For example, when attachment x is found in the referencesMap and which contains the image z of the part y, [Img-x.y.z] will be converted to <image-reference id=\"x.y.z\">Img-x.y.z</image-reference>.\n * If the attachment x, the part y or the image z is not found, it will remain as plain text [Img-x.y.z] in a span tag : <span>[Img-x.y.z]</span>\n */\n\nexport const EMBEDDED_IMAGE_NAME = \"embedded-image-reference\";\nconst EMBEDDED_IMAGE_REGEX = /\\[(Img-([0-9]+(?:\\.[0-9]+){2}))\\]/g;\n\nexport function markdownItImageReferencePlugin(md: MarkdownIt) {\n md.core.ruler.after(\"inline\", EMBEDDED_IMAGE_NAME, (state) => {\n const getEmbeddedImageReference = state?.env?.getEmbeddedImageReference;\n state.tokens.forEach((blockToken) => {\n if (blockToken.type !== \"inline\" || !blockToken.children) return;\n\n const newChildren: Token[] = [];\n\n blockToken.children.forEach((token) => {\n if (token.type !== \"text\") {\n newChildren.push(token);\n return;\n }\n\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n const text = token.content;\n\n EMBEDDED_IMAGE_REGEX.lastIndex = 0; // Reset regex state\n while ((match = EMBEDDED_IMAGE_REGEX.exec(text)) !== null) {\n // Add leading text\n if (match.index > lastIndex) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex, match.index);\n newChildren.push(t);\n }\n\n // Add embedded image reference token\n const refToken = new state.Token(EMBEDDED_IMAGE_NAME, \"\", 0);\n refToken.content = match[2]; // e.g., \"1.2.3\"\n refToken.meta = { full: match[1] }; // e.g., \"Img-1.2.3\"\n refToken.attrs = [];\n if (getEmbeddedImageReference) {\n const attachment = getEmbeddedImageReference(match[2]);\n if (attachment) {\n refToken.attrs.push(['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]);\n }\n }\n newChildren.push(refToken);\n\n lastIndex = match.index + match[0].length;\n }\n\n // Add trailing text\n if (lastIndex < text.length) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex);\n newChildren.push(t);\n }\n });\n\n blockToken.children = newChildren;\n });\n });\n\n // Optional: renderer for the custom token\n md.renderer.rules[EMBEDDED_IMAGE_NAME] = (tokens, idx) => {\n const imgId = tokens[idx].content;\n const attrs = tokens[idx].attrs || [];\n const attachment = attrs[0];\n if (!attachment) {\n return `<span>[Img-${imgId}]</span>`;\n }\n return `<image-reference id=\"${imgId}\" attachment=\"${attachment[1]}\" class=\"embedded-image-ref\">Img-${imgId}</image-reference>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\n\n/**\n * This plugin overrides the default link renderer to add `target=\"_blank\"` and `rel=\"noopener noreferrer\"` to all links.\n */\nexport function markdownItLinkPlugin(md: MarkdownIt) {\n const defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n md.renderer.rules.link_open = function(tokens, idx, options, env, self) {\n tokens[idx].attrPush(['target', '_blank']);\n tokens[idx].attrPush(['rel', 'noopener noreferrer']);\n\n // pass token to default renderer.\n return defaultRender(tokens, idx, options, env, self);\n };\n}\n","import type MarkdownIt from \"markdown-it\";\nimport Token from 'markdown-it/lib/token.mjs';\n/**\n * A markdown-it plugin to convert [Page-x.n], where x and n are numbers, into a <page-reference id=\"x.n\">Page-x.n</page-reference> HTML tag.\n *\n * For example, when attachment x is found in the referencesMap and which contains the page n, [Page-x.n] will be converted to <page-reference id=\"x.n\">Page-x.n</page-reference>.\n * If the attachment x or the page n is not found, it will remain as plain text [Page-x.n] in a span tag : <span>[Page-x.n]</span>\n */\n\nexport const EMBEDDED_PAGE_NAME = \"embedded-page-reference\";\nconst EMBEDDED_PAGE_REGEX = /\\[(Page-(\\d+\\.\\d+))\\]/g;\n\nexport function markdownItPageReferencePlugin(md: MarkdownIt) {\n md.core.ruler.after(\"inline\", EMBEDDED_PAGE_NAME, (state) => {\n const getEmbeddedPageReference = state?.env?.getEmbeddedPageReference;\n state.tokens.forEach((blockToken) => {\n if (blockToken.type !== \"inline\" || !blockToken.children) return;\n\n const newChildren: Token[] = [];\n\n blockToken.children.forEach((token) => {\n if (token.type !== \"text\") {\n newChildren.push(token);\n return;\n }\n\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n const text = token.content;\n\n EMBEDDED_PAGE_REGEX.lastIndex = 0; // Reset regex state\n while ((match = EMBEDDED_PAGE_REGEX.exec(text)) !== null) {\n // Add leading text\n if (match.index > lastIndex) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex, match.index);\n newChildren.push(t);\n }\n\n // Add embedded page reference token\n const refToken = new state.Token(EMBEDDED_PAGE_NAME, \"\", 0);\n refToken.content = match[2]; // e.g., \"1.2\"\n refToken.meta = { full: match[1] }; // e.g., \"Page-1.2\"\n refToken.attrs = [];\n if (getEmbeddedPageReference) {\n const attachment = getEmbeddedPageReference(match[2]);\n if (attachment) {\n refToken.attrs.push(['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]);\n }\n }\n newChildren.push(refToken);\n\n lastIndex = match.index + match[0].length;\n }\n\n // Add trailing text\n if (lastIndex < text.length) {\n const t = new state.Token(\"text\", \"\", 0);\n t.content = text.slice(lastIndex);\n newChildren.push(t);\n }\n });\n\n blockToken.children = newChildren;\n });\n });\n\n // Optional: renderer for the custom token\n md.renderer.rules[EMBEDDED_PAGE_NAME] = (tokens, idx) => {\n const page = tokens[idx].content;\n const attrs = tokens[idx].attrs || [];\n const attachment = attrs[0];\n if (!attachment) {\n return `<span>[Page-${page}]</span>`;\n }\n return `<page-reference id=\"${page}\" attachment=\"${attachment[1]}\" class=\"embedded-page-ref\">Page-${page}</page-reference>`;\n };\n}\n","import type MarkdownIt from \"markdown-it\";\n/**\n * A markdown-it plugin to convert [n] where n is a number into a <document-reference id=\"n\">n</document-reference> HTML tag.\n *\n * For example, when attachment 123 is found in the referencesMap, [123] will be converted to <document-reference id=\"123\">123</document-reference>.\n * If the attachment is not found, it will remain as plain text [123] in a span tag : <span>[123]</span>\n */\nexport function markdownItDocumentReferencePlugin(md: MarkdownIt) {\n function referenceifyNumber(state, silent) {\n const referencesMap = state.env.referencesMap || new Map();\n const char = state.src.charCodeAt(state.pos);\n\n // Check if the current character is '['\n if (char !== 0x5B /* [ */) {\n return false;\n }\n\n const start = state.pos + 1;\n let end = -1;\n\n // Find the closing ']'\n for (let i = start; i < state.src.length; i++) {\n if (state.src.charCodeAt(i) === 0x5D /* ] */) {\n end = i;\n break;\n }\n }\n\n if (end === -1 || end === start) {\n return false;\n }\n\n const content = state.src.slice(start, end);\n\n // Match if content is a number or number.number (optionally allow whitespace)\n if (!/^\\s*\\d+(?:\\.\\d+)?\\s*$/.test(content.trim())) {\n return false;\n }\n\n if (!silent) {\n const n = content.trim();\n\n // Open <reference>\n const attachment = referencesMap.get(n);\n if(attachment){\n // add attachment if found in the references map from env (set in the component)\n state.env.references(n.split('.')[0]);\n const tokenOpen = state.push('reference_open', 'document-reference', 1);\n // base64 encode the attachment if needed\n if (typeof attachment === 'object') {\n tokenOpen.attrs = [\n ['id', n],\n ['attachment', btoa(encodeURIComponent(JSON.stringify(attachment)))]\n ];\n }\n\n // Text content\n const tokenText = state.push('text', '', 0);\n tokenText.content = n;\n\n // Close </reference>\n state.push('reference_close', 'document-reference', -1);\n } else {\n // If no attachment found, just create a span text node\n state.push('reference_open', 'span', 1);\n const tokenText = state.push('text', '', 0);\n tokenText.content = `[${n}]`;\n state.push('reference_close', 'span', -1);\n }\n }\n\n state.pos = end + 1;\n return true;\n }\n\n md.inline.ruler.after('text', 'referenceify_number', referenceifyNumber);\n}\n","import type MarkdownIt from \"markdown-it\";\n\nexport function markdownItTableToolsPlugin(md: MarkdownIt) {\n const defaultRender = md.renderer.rules.table_open || ((tokens, idx, options, env, self) =>\n self.renderToken(tokens, idx, options));\n\n md.renderer.rules.table_open = (tokens, idx, options, env, self) => {\n // Wrap the table with the custom element\n return `<table-tools>` + defaultRender(tokens, idx, options, env, self);\n };\n\n const defaultClose = md.renderer.rules.table_close || ((tokens, idx, options, env, self) =>\n self.renderToken(tokens, idx, options));\n\n md.renderer.rules.table_close = (tokens, idx, options, env, self) => {\n return defaultClose(tokens, idx, options, env, self) + `</table-tools>`;\n };\n}\n","import MarkdownIt from 'markdown-it';\n\n/**\n * Markdown-it plugin to replace ```chartjs fenced blocks\n * with <chart-plot> custom elements.\n */\nexport function markdownItChartJsPlugin(md: MarkdownIt) {\n const defaultFence = md.renderer.rules.fence!;\n\n md.renderer.rules.fence = (tokens, idx, options, env, self) => {\n const token = tokens[idx];\n\n // Only process fenced blocks labeled 'chartjs'\n if (token.info.trim() !== 'chartjs') {\n return defaultFence(tokens, idx, options, env, self);\n }\n\n const content = token.content.trim();\n console.log('chartjs content:', content);\n\n return `<chart-plot>${content}</chart-plot>`;\n };\n}\n","// src/app/core/app-injector.ts\r\n\r\nimport { Injector } from '@angular/core';\r\n\r\n/**\r\n * Static variable to hold the root Angular Injector.\r\n * This is necessary to retrieve services outside of Angular's dependency injection context.\r\n */\r\nlet appInjector: Injector;\r\n\r\n/**\r\n * Function to set the global Injector reference.\r\n */\r\nexport function setAppInjector(injector: Injector): void {\r\n appInjector = injector;\r\n}\r\n\r\n/**\r\n * Function to retrieve the global Injector reference.\r\n */\r\nexport function getAppInjector(): Injector {\r\n return appInjector;\r\n}","import { inject, Injectable, InjectionToken } from '@angular/core';\r\n\r\n/**\r\n * Injection Token for the specific function to execute on a 401 Unauthorized error.\r\n */\r\nexport const ASSISTANT_UNAUTHORIZED_ACTION_TOKEN = new InjectionToken<() => void>(\r\n 'Function to execute on 401 unauthorized'\r\n);\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class GlobalErrorHandlerService {\r\n private unauthorizedAction = inject(ASSISTANT_UNAUTHORIZED_ACTION_TOKEN, { optional: true });\r\n\r\n /** Prevents infinite unauthorized attempts */\r\n private _authAttempted = false;\r\n\r\n /** Tracks if a re-authentication process is currently in progress */\r\n private _reauthInProgress = false;\r\n\r\n private authEventListener: ((event: Event) => void) | null = null;\r\n\r\n constructor() {\r\n this.setupAuthEventListener();\r\n }\r\n\r\n /**\r\n * Sets up a global listener for the `authenticated` event.\r\n * When re-authentication succeeds (authenticated === true),\r\n * reset the auth lock so another 401 can trigger again later.\r\n */\r\n private setupAuthEventListener(): void {\r\n this.authEventListener = (event: Event) => {\r\n const detail = (event as CustomEvent<{ authenticated: boolean }>).detail;\r\n if (detail?.authenticated) {\r\n console.info('[GLOBAL HANDLER] Authentication succeeded. Resetting 401 lock.');\r\n this._authAttempted = false;\r\n }\r\n };\r\n\r\n window.addEventListener('authenticated', this.authEventListener);\r\n }\r\n\r\n /**\r\n * Main entry point to handle fetch or HTTP errors globally.\r\n */\r\n handleFetchError(url: string, status: number, statusText: string): void {\r\n console.error(`[GLOBAL HANDLER] Status: ${status} on ${url}. ${statusText}`);\r\n\r\n if (status === 401) {\r\n this.handleUnauthorized();\r\n } else if (status >= 500) {\r\n console.warn('[GLOBAL HANDLER] Server error (5xx). Please try again later.');\r\n }\r\n }\r\n\r\n /**\r\n * Handles 401 errors by triggering re-authentication only once\r\n * until authentication is restored (via the DOM event).\r\n */\r\n private async handleUnauthorized(): Promise<void> {\r\n if (this._authAttempted) {\r\n console.warn('[GLOBAL HANDLER] 401 received, but auth already attempted. Ignoring new attempt.');\r\n return;\r\n }\r\n\r\n if (this._reauthInProgress) {\r\n console.warn('[GLOBAL HANDLER] Re-authentication already in progress. Ignoring multiple network calls that might hit 401 simultaneously. only the first triggers the handler');\r\n return;\r\n }\r\n\r\n if (!this.unauthorizedAction) {\r\n console.warn('[GLOBAL HANDLER] Unauthorized (401). No action defined.');\r\n return;\r\n }\r\n\r\n this._authAttempted = true;\r\n this._reauthInProgress = true;\r\n\r\n console.log('[GLOBAL HANDLER] Unauthorized (401). Triggering the handler...');\r\n\r\n try {\r\n await Promise.resolve(this.unauthorizedAction());\r\n } catch (error) {\r\n console.error('[GLOBAL HANDLER] Error during unauthorizedAction:', error);\r\n } finally {\r\n this._reauthInProgress = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clean up global event listener when Angular destroys this service.\r\n */\r\n ngOnDestroy(): void {\r\n if (this.authEventListener) {\r\n window.removeEventListener('authenticated', this.authEventListener);\r\n this.authEventListener = null;\r\n }\r\n }\r\n}\r\n","// src/app/core/fetch-patcher.ts\r\n\r\nimport { getAppInjector } from './app-injector';\r\nimport { GlobalErrorHandlerService } from './global-error-handler.service';\r\nimport { Injector } from '@angular/core';\r\n\r\n/**\r\n * Initializes a global fetch interceptor that patches the native window.fetch function.\r\n *\r\n * This function replaces the browser's native fetch with a custom implementation that:\r\n * - Preserves all original fetch functionality and behavior\r\n * - Intercepts HTTP responses that are not successful (!response.ok)\r\n * - Automatically handles errors through the GlobalErrorHandlerService when available\r\n * - Logs network errors to the console for debugging purposes\r\n *\r\n * The interceptor uses Angular's dependency injection system to retrieve the\r\n * GlobalErrorHandlerService and delegate error handling to it. If the injector\r\n * is not available, the function gracefully continues without error handling.\r\n *\r\n * @remarks\r\n * - This function should be called once during application initialization\r\n * - The original fetch function is preserved and all requests are forwarded to it\r\n * - Non-ok responses are still returned to the caller after error handling\r\n * - Network errors (connection failures, etc.) are logged and re-thrown\r\n *\r\n * @example\r\n * ```typescript\r\n * // Call during app initialization\r\n * initializeFetchInterceptor();\r\n *\r\n * // All subsequent fetch calls will be automatically intercepted\r\n * fetch('/api/data').then(response => {\r\n * // Error handling already occurred if response was not ok\r\n * });\r\n * ```\r\n */\r\nexport function initializeFetchInterceptor(): void {\r\n const originalFetch = window.fetch;\r\n\r\n window.fetch = async function (...args: any): Promise<Response> {\r\n const url = args[0] instanceof Request ? args[0].url : args[0];\r\n\r\n try {\r\n // @ts-ignore\r\n const response = await originalFetch.apply(this, args as any);\r\n\r\n if (!response.ok) {\r\n // --- THE BRIDGE ---\r\n const injector: Injector = getAppInjector();\r\n if (injector) {\r\n // Retrieve the service instance using the injector\r\n const errorHandler = injector.get(GlobalErrorHandlerService);\r\n\r\n // Call the service method with the error details\r\n errorHandler.handleFetchError(url, response.status, response.statusText);\r\n }\r\n // ------------------\r\n\r\n return response;\r\n }\r\n\r\n return response;\r\n\r\n } catch (error: any) {\r\n // Handle network errors here (if needed)\r\n console.error(`[FETCH PATCHER] Network Error for ${url}:`, error);\r\n throw error;\r\n }\r\n } as typeof window.fetch;\r\n}","/**\r\n * Handles unauthorized HTTP responses (401) by clearing session data and reloading the page.\r\n *\r\n * This function is triggered when a 401 Unauthorized response is detected during API calls.\r\n * It performs cleanup operations by removing stored credentials from session storage\r\n * and forces a page reload to redirect the user to the login flow.\r\n *\r\n * @remarks\r\n * This function directly manipulates the browser's session storage and window location,\r\n * making it suitable for client-side applications only.\r\n *\r\n */\r\nexport const handleUnauthorizedLogic = (): void => {\r\n console.log(\"[TOKEN LOGIC] 401 Unauthorized detected. Executing function from Token.\");\r\n\r\n // // Custom logic: Clear session data and force a page reload\r\n sessionStorage.removeItem('sinequa-credentials')\r\n window.location.reload();\r\n};","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i1.UIService","i2.PrincipalService","i3","tap","switchMap","take","map","catchError","i2.DebugMessageService","finalize","i1.DebugMessageService","i2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGG;MAIU,sBAAsB,CAAA;AACzB,IAAA,iBAAiB,GAA6B,IAAI,GAAG,EAAE;AAE/D;;;;AAIG;IACH,aAAa,CAAC,GAAW,EAAE,OAAoB,EAAA;QAC7C,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;IAC1C;AAEA;;;AAGG;AACH,IAAA,WAAW,CAAC,GAAW,EAAA;QACrB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;AAC5B,YAAA,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,CAAA,CAAA,CAAG,CAAC;QAC7E;QACA,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAE;IACzC;AAEA;;;;AAIG;AACH,IAAA,aAAa,CAAC,GAAW,EAAA;QACvB,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC;IACxC;wGA9BW,sBAAsB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,C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