@sinequa/assistant 3.7.2 → 3.7.4
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/chat-settings-v3/chat-settings-v3.component.ts","../../../projects/assistant/chat/chat-settings-v3/chat-settings-v3.component.html","../../../projects/assistant/chat/types.ts","../../../projects/assistant/chat/chat.service.ts","../../../projects/assistant/chat/websocket-chat.service.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.html","../../../projects/assistant/chat/format-icon/icons.ts","../../../projects/assistant/chat/format-icon/format-icon.component.ts","../../../projects/assistant/chat/format-icon/format-icon.component.html","../../../projects/assistant/chat/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.html","../../../projects/assistant/chat/charts/chart/chart.component.ts","../../../projects/assistant/chat/charts/chart/chart.component.html","../../../projects/assistant/chat/chat-message/chat-message.component.ts","../../../projects/assistant/chat/chat-message/chat-message.component.html","../../../projects/assistant/chat/rest-chat.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/debug-message/debug-message.component.ts","../../../projects/assistant/chat/debug-message/debug-message.component.html","../../../projects/assistant/chat/chat.component.ts","../../../projects/assistant/chat/chat.component.html","../../../projects/assistant/chat/saved-chats/saved-chats.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.html","../../../projects/assistant/chat/messages/en.ts","../../../projects/assistant/chat/messages/fr.ts","../../../projects/assistant/chat/messages/de.ts","../../../projects/assistant/chat/messages/index.ts","../../../projects/assistant/chat/prompt.component.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 { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { ChatService } from \"../chat.service\";\nimport { ChatConfig, GllmModelDescription } from \"../types\";\nimport { Subscription, filter, switchMap, tap } from \"rxjs\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { Utils } from \"@sinequa/core/base\";\nimport { AppService } from \"@sinequa/core/app-utils\";\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]\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\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n public principalService = inject(PrincipalWebService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig)\n ).subscribe(_ => {\n this.isAdmin = this.principalService.principal!.isAdministrator;\n // Init config with a copy of the original chat config, so that it won't be modified by the user until he clicks on save\n this.config = JSON.parse(JSON.stringify(this.chatService.assistantConfig$.value));\n this.selectedModel = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.initFunctionsList();\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n get hasPrompts(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.displaySystemPrompt\n || !!this.config.uiSettings.displayUserPrompt;\n }\n\n get hasAdvancedParameters(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n get hasModel(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.servicesModels\n || !!this.config.uiSettings.functions\n || !!this.config.uiSettings.debug\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onChatModelChange(selectedModel: GllmModelDescription) {\n // Update properties based on the selected model\n this.config.defaultValues.service_id = selectedModel.serviceId;\n this.config.defaultValues.model_id = selectedModel.modelId;\n }\n\n getFunctionDescription(name: string): string {\n return this.chatService.functions?.find(fn => fn.functionName === name)?.description || \"\";\n }\n\n toggleFunctionsSelection(name: string) {\n // Update the enabled property of the function\n const index = this.config.defaultValues.functions.findIndex(func => func.name === name);\n this.config.defaultValues.functions[index].enabled = this.functions[index].enabled;\n }\n\n private initFunctionsList(): void {\n this.functions = this.config.defaultValues.functions.filter(func => !!this.chatService.functions?.find(fn => fn.functionName === func.name));\n }\n\n /**\n * Save the new chat config in the chat service and the user preferences\n * If the user has never modified the default values, we need to save the hash of the standard default values, as defined by the admin, in order to properly track changes afterwards.\n */\n 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 = this.appService.app?.data?.assistants?.[this.instanceId];\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": Utils.sha512(JSON.stringify(standardChatConfig.defaultValues)) };\n this.chatService.updateChatConfig(this.config, hashes);\n } else {\n this.chatService.updateChatConfig(this.config);\n }\n this.chatService.generateAuditEvent(\"configuration.edit\", { '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 card-body small\" *ngIf=\"config\">\n\n <h5 *ngIf=\"hasModel\">Model</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.servicesModels\">\n <label for=\"gllmModel\" class=\"form-label\">Model</label>\n <select class=\"form-select\" id=\"gllmModel\" [(ngModel)]=\"selectedModel\" (ngModelChange)=\"onChatModelChange($event)\">\n <option *ngFor=\"let model of chatService.models\" [ngValue]=\"model\">{{model.displayName}}</option>\n </select>\n </div>\n\n <div class=\"mb-4\" *ngIf=\"isAdmin || config.uiSettings.functions\">\n <label for=\"gllmFunctions\" class=\"form-label\">Functions</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-check-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=\"isAdmin || config.uiSettings.debug\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"debug\" [(ngModel)]=\"config.defaultValues.debug\">\n <label class=\"form-check-label\" for=\"debug\">Debug</label>\n </div>\n\n <details *ngIf=\"hasAdvancedParameters\">\n <summary>Advanced parameters</summary>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.temperature\">\n <label for=\"temperature\" class=\"form-label\">Temperature: {{config.defaultValues.temperature}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"2\" step=\"0.1\" id=\"temperature\"\n [(ngModel)]=\"config.defaultValues.temperature\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.top_p\">\n <label for=\"top-p\" class=\"form-label\">Top P: {{config.defaultValues.top_p}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"1\" step=\"0.05\" id=\"top-p\"\n [(ngModel)]=\"config.defaultValues.top_p\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.max_tokens\">\n <label for=\"max-tokens\" class=\"form-label\">Max generated tokens per answer:\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\">Prompts</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displaySystemPrompt\">\n <label for=\"initialSystemPrompt\" class=\"form-label\">System prompt (hidden)</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\">Initial user prompt</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()\">Cancel</button>\n <button class=\"btn btn-primary\" *ngIf=\"config\" (click)=\"save()\">Save</button>\n </div>\n\n</div>\n","import { z } from 'zod';\nimport { Record } from \"@sinequa/core/web-services\";\nimport { Query } from '@sinequa/core/app-utils';\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: string;\n messageType?: 'CHART' | 'MARKDOWN'\n additionalProperties: {\n [key: string]: any\n };\n}\n\n/**\n * A chat message that has been processed to include the markdown-formatted\n * content for display, as well as detailed attachment data, and optionally\n * a list of the references extracted from that message\n */\nexport interface ChatMessage extends RawMessage {\n additionalProperties: {\n display?: boolean;\n $progress?: ChatProgress[];\n $attachment?: ChatContextAttachment[];\n $suggestedAction?: SuggestedAction[];\n $debug?: DebugMessage[];\n forcedWorkflow?: string;\n forcedWorkflowProperties?: any;\n query?: Query;\n isUserInput?: boolean;\n usageMetrics?: ChatUsageMetrics;\n additionalWorkflowProperties?: any;\n $liked?: boolean;\n $disliked?: boolean;\n [key: string]: any;\n };\n}\n\nexport interface ChatProgress {\n title: string;\n content?: string;\n done?: boolean;\n time?: number;\n}\n\nexport interface RawAttachment {\n /** Type of the attachment */\n type: string;\n /** Record id from which this attachment is taken */\n recordId: string;\n /** Record from which this this attachment is taken */\n record: Record;\n}\n\nexport interface DocumentPart {\n partId: number;\n offset: number;\n length: number;\n text: string;\n}\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 /** The specific id used of the referenced part */\n $partId?: number;\n}\n\n/**\n * Raw response of the chat API\n */\nexport interface RawResponse {\n history: RawMessage[];\n executionTime: string | undefined;\n}\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.object({\n connectionErrorMessage: z.string(),\n restEndpoint: z.string().optional(),\n websocketEndpoint: z.string().optional(),\n signalRTransport: z.enum([\"WebSockets\", \"ServerSentEvents\", \"LongPolling\", \"None\"]),\n signalRLogLevel: z.enum([\"Critical\", \"Debug\", \"Error\", \"Information\", \"None\", \"Trace\", \"Warning\"]),\n signalRServerTimeoutInMilliseconds: z.number().optional()\n}).refine(data => (!!data.restEndpoint || !!data.websocketEndpoint), {\n message: \"Based on the provided input() protocol ('REST' or 'WEBSOCKET') to the Chat Component, either 'restEndpoint' or 'websocketEndpoint' property should be provided in the 'globalSettings' of the assistant instance.\",\n});\n// Define the ConnectionSettings interface\nexport type ConnectionSettings = z.infer<typeof connectionSettingsSchema>;\n\n// Define the Zod representation for the serviceSettings object\nconst serviceSettingsSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number()\n});\n// Define the ServiceSettings interface\nexport interface ServiceSettings 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 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 extends z.infer<typeof additionalWorkflowPropertiesSchema> {}\n\n// Define the Zod representation for the uiSettings object\nconst uiSettingsSchema = z.object({\n display: z.boolean(),\n servicesModels: z.boolean(),\n functions: z.boolean(),\n temperature: z.boolean(),\n top_p: z.boolean(),\n max_tokens: z.boolean(),\n debug: z.boolean(),\n displaySystemPrompt: z.boolean(),\n displayUserPrompt: z.boolean()\n});\n// Define the UiSettings interface\nexport interface UiSettings extends z.infer<typeof uiSettingsSchema> {}\n\n// Define the Zod representation for the defaultValues object\nconst defaultValuesSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n functions: z.array(\n z.object({\n name: z.string(),\n enabled: z.boolean()\n })\n ),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n debug: z.boolean(),\n systemPrompt: z.string(),\n userPrompt: z.string()\n});\n// Define the DefaultValues interface\nexport interface DefaultValues extends z.infer<typeof defaultValuesSchema> {}\n\n// Define the Zod representation for the action object\nconst actionSchema = z.object({\n forcedWorkflow: z.string(), // forcedWorkflow must be a string\n forcedWorkflowProperties: z.record(z.unknown()).optional() // forcedWorkflowProperties must be an object (Map equivalent)\n});\n\n// Define the Zod representation for the modeSettings object\nconst initializationSchema = z.object({\n event: z.enum(['Query', 'Prompt']),\n forcedWorkflow: z.string().optional(), // Optional for event 'Prompt'\n displayUserQuery: z.boolean().optional() // Optional for event 'Prompt'\n}).refine(data => ((data.event === \"Query\") ? (!!data.forcedWorkflow && data.displayUserQuery !== undefined && data.displayUserQuery !== null) : true), {\n message: \"The 'forcedWorkflow' and 'displayUserQuery' properties must be provided when the initialization's event is 'Query'.\",\n})\nconst modeSettingsSchema = z.object({\n enabledUserInput: z.boolean(),\n displayUserPrompt: z.boolean(),\n sendUserPrompt: z.boolean(),\n initialization: initializationSchema,\n actions: z.record(actionSchema).optional()\n});\n// Define the ModeSettings interface\nexport interface ModeSettings extends z.infer<typeof modeSettingsSchema> {}\n\n// Define the Zod representation for the savedChatSettings object\nconst savedChatSettingsSchema = z.object({\n enabled: z.boolean(),\n display: z.boolean()\n})\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the globalSettings object\nconst globalSettingsSchema = z.object({\n searchWarningMessage: z.string(),\n disclaimer: z.string().optional(),\n genericChatErrorMessage: z.string().optional(),\n displayUserQuotaConsumption: z.boolean().optional(),\n displayChatTokensConsumption: z.boolean().optional()\n})\n\n// Define the Zod representation for the auditSettings object\nconst auditSettingsSchema = z.object({\n issueTypes: z.array(z.string()).optional()\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings 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.optional(),\n additionalServiceSettings: additionalServiceSettingsSchema,\n additionalWorkflowProperties: additionalWorkflowPropertiesSchema\n});\n// Define the ChatConfig interface\nexport interface ChatConfig extends z.infer<typeof chatConfigSchema> {}\n\nexport interface ChatPayload {\n debug: boolean;\n functions: string[];\n history: ChatMessage[];\n serviceSettings: ServiceSettings;\n appQuery: {\n app: string;\n query: Query | undefined;\n targetUrl?: string;\n accessToken?: string;\n };\n instanceId?: string;\n savedChatId?: string;\n genericChatErrorMessage?: string;\n}\n\nexport type ActionMessage = {\n guid: string;\n displayName?: string\n displayValue?: string;\n executionTime?: number;\n}\n\nexport interface TextChunksOptions {\n extendMode?: 'None' | 'Sentence' | 'Chars';\n extendScope?: number;\n}\n\nexport interface Quota {\n lastRequest: string;\n promptTokenCount: number;\n completionTokenCount: number;\n periodTokens: number;\n resetHours: number;\n tokenCount: number;\n nextReset: string;\n lastResetUTC: string;\n nextResetUTC: string;\n maxQuotaReached: boolean;\n}\n\nexport interface SuggestedAction {\n content: string;\n type: string;\n}\n\nexport interface InitChat {\n messages: RawMessage[];\n}\n\n/**\n * List of events data that can be emitted by the websocket chat endpoint\n */\nexport type SuggestedActionsEvent = { suggestedActions: SuggestedAction[] };\nexport type QuotaEvent = { quota: Quota };\nexport type MessageEvent = string;\nexport type ContextMessageEvent = { content: string; metadata: 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 };\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}\n\nexport interface TokenConsumption {\n percentage: number;\n}\n\nexport interface UserTokenConsumption extends TokenConsumption {\n nextResetDate: string;\n}\n\nexport interface ChatUsageMetrics {\n totalTokenCount: number;\n promptTokenCount: number;\n completionTokenCount: number;\n tokenizerType: string\n}\n\nexport interface KvObject {\n data: {\n key: string;\n value: any; // string | number | boolean | null | undefined | { [key: string]: any };\n };\n type: 'KV';\n isError: boolean;\n}\n\nexport interface ListObject {\n name: string;\n type: 'LIST';\n isError: boolean;\n items: (KvObject | ListObject)[];\n expanded: boolean;\n}\n\nexport type DebugMessage = KvObject | ListObject;\n\n\nexport type MessageHandler<T> = {\n handler: (data: T) => void;\n isGlobalHandler: boolean;\n};\n","import { Injectable, inject } from \"@angular/core\";\nimport { UserPreferences } from \"@sinequa/components/user-settings\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\nimport { AuditWebService, UserSettingsWebService, PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\nimport { ChatConfig, ChatMessage, ChatResponse, ChatUsageMetrics, GllmFunction, GllmModelDescription, Quota, SavedChat, SavedChatHistory, TokenConsumption, UserTokenConsumption, chatConfigSchema } from \"./types\";\nimport { AppService, Query } from \"@sinequa/core/app-utils\";\nimport { IntlService } from \"@sinequa/core/intl\";\nimport get from \"lodash/get\";\nimport { Utils } from \"@sinequa/core/base\";\nimport { ConfirmType, ModalButton, ModalResult, ModalService } from \"@sinequa/core/modal\";\nimport { parseISO, toDate } from \"date-fns\";\n\n@Injectable()\nexport abstract class ChatService {\n /** Name of the assistant plugin OR websocket endpoint. */\n REQUEST_URL: string;\n /** Emit true once the initialization of the assistant process is done. */\n initProcess$ = new BehaviorSubject<boolean>(false);\n /** Emit true once the initialization of the assistant config is done. */\n initConfig$ = new BehaviorSubject<boolean>(false);\n /** Emit the global configuration of the assistant. */\n assistantConfig$ = new BehaviorSubject<ChatConfig | undefined>(undefined);\n /** Emit true if the user has been overridden, false otherwise. */\n userOverride$ = new BehaviorSubject<boolean | undefined>(undefined);\n /**\n * Emit true if the fetch of an assistant's response is ongoing (it includes Streaming status of the assistant endpoint AND saving the discussion if save Chat is enabled).\n * This is used to prevent multiple fetches at the same time.\n * Typically, there is no problem chaining fetches, but when forcing a reload after query changes cases, it can't be allowed because it breaks the whole business logic.\n */\n streaming$ = new BehaviorSubject<boolean>(false);\n /** Store the messages history of the current chat. */\n chatHistory: ChatMessage[] | undefined;\n /** List of models available on the server. */\n models: GllmModelDescription[] | undefined;\n /** List of functions available on the server. */\n functions: GllmFunction[] | undefined;\n /** List of saved chats. */\n savedChats$ = new BehaviorSubject<SavedChat[]>([]);\n /** Emit the saved chat to load. */\n loadSavedChat$ = new BehaviorSubject<SavedChat | undefined>(undefined);\n /** Emit the quota each time the chat is invoked. */\n quota$ = new BehaviorSubject<Quota | undefined>(undefined);\n /** Emit the calculated user's token consumption based on the quota. */\n userTokenConsumption$ = new BehaviorSubject<UserTokenConsumption | undefined>(undefined);\n /** Emit the chat usage metrics each time the generation of the assistant response is completed. */\n chatUsageMetrics$ = new BehaviorSubject<ChatUsageMetrics | undefined>(undefined);\n /** Emit the calculated chat's token consumption based on the chat usage metrics. */\n chatTokenConsumption$ = new BehaviorSubject<TokenConsumption | undefined>(undefined);\n /** Emit true if \"CancelTasks\" is ongoing. */\n stoppingGeneration$ = new BehaviorSubject<boolean>(false);\n /** Instance ID of the chat service defining the assistant instance. */\n private _chatInstanceId: string;\n /** ID of the current **saved chat** discussion which is used to update/get/delete it. */\n private _savedChatId: string | undefined;\n /** Generated GUID for the current non-saved chat discussion used to identify audit events.\n * If the chat is saved, the savedChatId is initialized with the value of this chatId.\n */\n private _chatId: string;\n\n public userSettingsService = inject(UserSettingsWebService);\n public notificationsService = inject(NotificationsService);\n public auditService = inject(AuditWebService);\n public prefs = inject(UserPreferences);\n public loginService = inject(LoginService);\n public appService = inject(AppService);\n public intlService = inject(IntlService);\n public modalService = inject(ModalService);\n public principalService = inject(PrincipalWebService);\n /**\n * Initialize the chat process\n */\n abstract init(): Observable<boolean>;\n\n /**\n * Initialize the REQUEST_URL\n */\n abstract getRequestsUrl(): void;\n\n get assistants(): any {\n if (!this.userSettingsService.userSettings)\n this.userSettingsService.userSettings = {};\n if (!this.userSettingsService.userSettings[\"assistants\"])\n this.userSettingsService.userSettings[\"assistants\"] = {};\n return this.userSettingsService.userSettings[\"assistants\"];\n }\n\n /**\n * Get the instance ID of the chat service\n * @returns The instance ID of the chat service\n */\n get chatInstanceId(): string {\n return this._chatInstanceId;\n }\n\n /**\n * Persist the instance ID of the chat service\n * @param instanceId The instance ID of the chat service\n */\n setChatInstanceId(instanceId: string) {\n this._chatInstanceId = instanceId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to save/get/delete it\n * @returns The ID of the current chat discussion\n */\n get savedChatId(): string | undefined {\n return this._savedChatId;\n }\n\n /**\n * Persist the ID of the current chat discussion which is used to save/get/delete it\n * @param savedChatId The ID of the current chat discussion which is used to save/get/delete it\n */\n setSavedChatId(savedChatId: string | undefined) {\n this._savedChatId = savedChatId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to identify audit events\n * @returns The ID of the current chat discussion\n */\n get chatId(): string {\n return this._chatId;\n }\n\n /**\n * Generate an GUID for the current chat discussion which is used to identify audit events\n * If the discussion is saved, the savedChatId is initialized with the value of this chatId\n * @param chatId if provided, it will be considered as the ID of the current chat discussion which is used to identify audit events\n */\n generateChatId(chatId?: string) {\n this._chatId = chatId || Utils.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 initChatConfig() {\n const key = this.chatInstanceId;\n const userSettingsConfig = this.assistants[key] || {};\n const standardChatConfig = this.appService.app?.data?.assistants?.[key];\n\n try {\n // Validate the whole config object against the schema\n chatConfigSchema.parse(standardChatConfig);\n // If the user preferences do not contain a config's defaultValues object, keep using the standard app config and nothing to store in the user preferences\n if (!userSettingsConfig.defaultValues) {\n this.assistantConfig$.next({...standardChatConfig});\n this.initConfig$.next(true);\n } else { // If the user has its own defaultValues in its userSettings, then we need to check for potential updates made by admins in the meantime and how he wants to manage them\n\n // Retrieve already stored hashes in the user settings if exists\n const appliedDefaultValuesHash = userSettingsConfig.hashes?.[\"applied-defaultValues-hash\"];\n const skippedDefaultValuesHash = userSettingsConfig.hashes?.[\"skipped-defaultValues-hash\"];\n // Create a hash of the current defaultValues of the standardChatConfig\n const currentDefaultValuesHash = Utils.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\n .confirm({\n title: \"Available updates !\",\n message: \"Changes have been made to the default configuration. Do you want to update your own version ?\",\n buttons: [\n new ModalButton({result: ModalResult.No, text: \"See no more\"}),\n new ModalButton({result: ModalResult.Ignore, text: \"Remind me later\"}),\n new ModalButton({result: ModalResult.OK, text: \"Update\", primary: true})\n ],\n confirmType: ConfirmType.Warning\n }).then(res => {\n if(res === ModalResult.OK) {\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash, \"skipped-defaultValues-hash\": undefined };\n // Update the chat config and store its defaultValues in the user preferences\n this.updateChatConfig({...standardChatConfig}, hashes, true);\n this.initConfig$.next(true);\n this.generateAuditEvent(\"configuration.edit\", { 'configuration': JSON.stringify({...standardChatConfig}) });\n } else if(res === ModalResult.No) {\n // Do not notify the user about changes while this skipped version is not updated\n const hashes = { ...userSettingsConfig.hashes, \"skipped-defaultValues-hash\": currentDefaultValuesHash };\n this.updateChatConfig({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues}, hashes, false);\n this.initConfig$.next(true);\n } else {\n // Just pick the version in the user settings, nothing to be updated\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n });\n } else { // No available updates Or updates has been already skipped, then just pick the version in the user settings\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n }\n } catch (error) {\n this.notificationsService.error(`Missing valid configuration for the assistant instance '${key}'. See the browser console messages for details on the missing or incorrect properties.`);\n throw new Error(`Missing valid configuration for the assistant instance '${key}' . \\n ${JSON.stringify(error.issues, null, 2)}`);\n }\n }\n\n /**\n * Update the chat config and store its defaultValues in the user preferences\n * @param config The updated chat config\n * @param hashes The updated hashes to store in the user preferences\n * @param notify Whether to notify the user about the update\n * @param successCallback The callback to execute if the update is successful\n * @param errorCallback The callback to execute if the update fails\n */\n updateChatConfig(config: ChatConfig, hashes?: {\"applied-defaultValues-hash\"?: string, \"skipped-defaultValues-hash\"?: string}, notify = true, successCallback?: () => any, errorCallback?: () => any) {\n this.assistantConfig$.next(config);\n const assistants = Object.assign({}, this.assistants);\n assistants[this.chatInstanceId] = { ...assistants[this.chatInstanceId], defaultValues: config.defaultValues };\n if(hashes) assistants[this.chatInstanceId].hashes = hashes;\n this.userSettingsService.patch({ assistants }).subscribe(\n next => {},\n error => {\n if(notify) {\n errorCallback ? errorCallback() : this.notificationsService.error(`The update of the assistant instance '${this.chatInstanceId}' configuration failed`);\n }\n console.error(\"Could not patch assistants!\", error);\n },\n () => {\n if(notify) {\n successCallback ? successCallback() : this.notificationsService.success(`The assistant instance '${this.chatInstanceId}' configuration has been successfully updated`);\n }\n }\n );\n }\n\n /**\n * Overrides the logged in user\n */\n abstract overrideUser(): void;\n\n /**\n * Calls the Fetch API to retrieve a new message given all previous messages\n */\n abstract fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse>\n\n /**\n * Return the list of models available on the server\n */\n abstract listModels(): Observable<GllmModelDescription[] | undefined>;\n\n /**\n * Return the list of functions available on the server AND matching enabled functions in the chat config\n */\n abstract listFunctions(): Observable<GllmFunction[] | undefined>;\n\n /**\n * Stops the assistant answer generation and cancels all the ongoing and pending related tasks\n */\n abstract stopGeneration(): Observable<any>\n\n /**\n * A handler for quota updates each time the chat is invoked.\n * It emits the updated quota to the quota$ subject, emits accordingly the updated user's tokens consumption and notifies the user if the max quota is reached.\n * @param quota The updated quota\n * @param propagateError Whether to propagate the error to the caller\n */\n updateQuota(quota: Quota, propagateError = false) {\n this.quota$.next(quota);\n const nextResetDate = this.formatDateTime(quota.nextResetUTC+\"+00:00\"); // This +00:00 is to ensure dates will be properly converted to local time\n const consumptionPercentage = Math.round((quota.tokenCount * 100 / quota.periodTokens) * 100) / 100;\n this.userTokenConsumption$.next({percentage: consumptionPercentage, nextResetDate});\n if(quota.maxQuotaReached) {\n this.generateAuditEvent('quota.exceeded', {});\n const msg = `Sorry, you have exceeded the allowed quota. Please retry starting from ${nextResetDate}.`;\n this.notificationsService.error(msg);\n if(propagateError) throw new Error(msg);\n }\n }\n\n /**\n * A handler for chat usage metrics each time the generation of the assistant response is completed.\n * It emits the chat usage metrics to the chatUsageMetrics$ subject, emits accordingly the updated chat's tokens consumption\n * @param chatUsageMetrics The chat usage metrics\n */\n updateChatUsageMetrics(chatUsageMetrics: ChatUsageMetrics) {\n this.chatUsageMetrics$.next(chatUsageMetrics);\n const currentModel = this.getModel(this.assistantConfig$.value!.defaultValues.service_id, this.assistantConfig$.value!.defaultValues.model_id);\n const consumptionPercentage = Math.round((chatUsageMetrics.totalTokenCount * 100 / (currentModel!.contextWindowSize - currentModel!.maxGenerationSize)) * 100) / 100;\n this.chatTokenConsumption$.next({percentage: consumptionPercentage});\n }\n\n /**\n * Get the model description for the given (serviceId + modelId)\n * If a model is not found, an error message is returned\n * @param serviceId The serviceId of the model\n * @param modelId The modelId of the model\n * @returns The model description\n */\n getModel(serviceId: string, modelId: string): GllmModelDescription | undefined{\n let model = this.models?.find(m => m.serviceId === serviceId && m.modelId === modelId);\n // Handle obsolete config\n if(!model) {\n this.notificationsService.error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available. Please contact an admin for further information.`);\n throw new Error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available`);\n }\n return model;\n }\n\n /**\n * Fetch the list saved chats belonging to a specific instance of the assistant\n */\n abstract listSavedChat(): void;\n\n /**\n * Return the saved chat with the given id, if exists. Otherwise, return undefined\n * @param id The id of the saved chat\n */\n abstract getSavedChat(id: string): Observable<SavedChatHistory | undefined>;\n\n /**\n * Save a chat with the given messages\n * @param messages The messages to add to the saved chat index\n * @returns The saved chat\n */\n abstract addSavedChat(messages: ChatMessage[]): Observable<SavedChat>;\n\n /**\n * Update a saved chat with the given id.\n * @param id The id of the saved chat\n * @param name The new name of the saved chat, if provided\n * @param messages The messages to update the saved chat history, if provided\n * @returns True if the saved chat has been successfully updated\n */\n abstract updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat>;\n\n /**\n * Bulk delete of saved chats matching the given ids\n * @param ids List of ids of the saved chats to delete\n * @returns The number of deleted chats\n */\n abstract deleteSavedChat(ids: string[]): Observable<number>;\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 generateAuditEvent(type: string, details: Record<string, any>, id?: string): void {\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 const audit = {\n type,\n detail: {\n ...baseDetails,\n ...details\n }\n }\n this.auditService.notify(audit);\n }\n\n\n\n /**\n * Traverse the array from the end and track the first 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the first visible assistant message among the last group of \"assistant\" messages in the array\n */\n firstVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let firstVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n firstVisibleAssistantMessageIndex = index;\n }\n index--;\n }\n return firstVisibleAssistantMessageIndex;\n }\n\n /**\n * Traverse the array from the end and pick the last 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the last visible assistant message among the last group of \"assistant\" messages in the array\n */\n lastVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let lastVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n lastVisibleAssistantMessageIndex = index;\n break;\n }\n index--;\n }\n return lastVisibleAssistantMessageIndex;\n }\n\n /**\n * Format a date string in UTC to a local date string\n * @param value Date string in UTC to format\n * @returns A formatted local date string\n */\n protected formatDateTime(value: string): string {\n const localDate = toDate(parseISO(value));\n return this.intlService[\"formatTime\"](localDate, {day: \"numeric\", month: \"short\", year: \"numeric\", timeZoneName: 'short'});\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 static formatPrompt(prompt: string, context: any) {\n return prompt.replace(\n /{{(.*?)}}/g,\n (match, expr) => get(context, expr) ?? match\n );\n }\n\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { AuthenticationService } from \"@sinequa/core/login\";\nimport { ConnectionOptions, SignalRWebService } from \"@sinequa/core/web-services\";\nimport { Query } from \"@sinequa/core/app-utils\";\nimport { HttpTransportType, HubConnection, LogLevel, MessageHeaders } from \"@microsoft/signalr\";\nimport { ActionMessage, ActionResultEvent, ActionStartEvent, ActionStopEvent, MessageEvent, ChatMessage, ChatPayload, ChatResponse, GllmFunction, GllmModelDescription, MessageHandler, HistoryEvent, ErrorEvent, QuotaEvent, ChatContextAttachment, ContextMessageEvent, SavedChatHistory, SavedChat, ChatProgress, SuggestedActionsEvent, DebugMessageEvent, DebugMessage } from \"./types\";\nimport { ChatService } from \"./chat.service\";\nimport { merge, fromEvent, Observable, Subject, catchError, defer, from, forkJoin, map, switchMap, tap, throwError, takeUntil, take, mergeMap, of } from \"rxjs\";\n\n@Injectable()\nexport class WebSocketChatService extends ChatService {\n\n public connection: HubConnection | undefined;\n\n private _messageHandlers: Map<string, MessageHandler<any>> = new Map();\n private _response: ChatMessage[];\n private _actionMap = new Map<string, ActionMessage>();\n private _progress: ChatProgress[] | undefined = undefined;\n private _executionTime: string;\n private _attachments: ChatContextAttachment[] = [];\n private _debugMessages: DebugMessage[] = [];\n\n public signalRService = inject(SignalRWebService);\n public authenticationService = inject(AuthenticationService);\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the assistant process.\n * It includes building and starting a connection, executing parallel requests for models and functions, and handling errors during the process.\n * ⚠️ This method MUST be called ONLY if the user is loggedIn and once when the assistant is initialized.\n *\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n // Ensure all logic is executed when subscribed to the observable\n return defer(() => {\n this.getRequestsUrl();\n\n return from(\n // Build the connection\n this.buildConnection()\n ).pipe(\n tap(() => this.initMessageHandlers()),\n // Start the connection\n switchMap(() => this.startConnection()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n take(1)\n );\n });\n }\n\n /**\n * Define the assistant endpoint to use for the websocket requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.websocketEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.websocketEndpoint;\n } else {\n throw new Error(`The property 'websocketEndpoint' must be provided when attempting to use 'WebSocket' in assistant instance`);\n }\n }\n\n overrideUser(): void {\n if (!(this.authenticationService.userOverrideActive && this.authenticationService.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: this.authenticationService.userOverride.userName,\n domain: this.authenticationService.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 listModels(): Observable<GllmModelDescription[] | undefined> {\n const modelsSubject$ = new Subject<GllmModelDescription[] | undefined>();\n\n this.connection!.on('ListModels', (res) => {\n this.models = (res.models as GllmModelDescription[] | undefined)?.filter(model => !!model.enable);\n modelsSubject$.next(this.models);\n modelsSubject$.complete()\n });\n\n // Send the request to get the list of models\n this.connection!.invoke('ListModels', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListModels:', error);\n modelsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return modelsSubject$.asObservable();\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const functionsSubject$ = new Subject<GllmFunction[] | undefined>();\n\n this.connection!.on('ListFunctions', (res) => {\n this.functions = (res.functions as GllmFunction[] | undefined)?.filter(func => func.enabled);\n functionsSubject$.next(this.functions);\n functionsSubject$.complete()\n });\n\n // Send the request to get the list of functions\n this.connection!.invoke('ListFunctions', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListFunctions:', error);\n functionsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return functionsSubject$.asObservable();\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload = {\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n // Initialize the response with an empty assistant message\n this._response = [{role: \"assistant\", content: \"\", additionalProperties: {display: true}}] // here display: true is needed in order to be able to show the progress\n\n // Create a Subject to signal completion\n const completion$ = new Subject<void>();\n\n // Create observables for each non-global handler in the _messageHandlers map (default and eventual custom ones) once it is triggered by the hub connection\n const observables = Array\n .from(this._messageHandlers.entries())\n .filter(([eventName, eventHandler]) => !eventHandler.isGlobalHandler)\n .map(([eventName, eventHandler]) => {\n return fromEvent<any>(this.connection!, eventName).pipe(\n mergeMap((event) => {\n // Wrap the handler in a try-catch block to prevent the entire stream from failing if an error occurs in a single handler\n try {\n // Execute the handler and emit the result\n // NB: here we could use [eventHandler.handler(event)] which behind the scenes mergeMap interprets this array as an observable sequence with one item, which it then emits\n return of(eventHandler.handler(event));\n } catch (error) {\n console.error(`Error in event handler for ${eventName}:`, error);\n // Use throwError to propagate the error downstream\n return throwError(() => new Error(`Error in event handler for ${eventName}: ${error}`));\n }\n })\n );\n });\n\n // Then merge them into a single observable in order to simulate the streaming behavior\n const combined$ = merge(...observables).pipe(\n map(() => {\n // Define $progress from the _actionMap\n const actions = Array.from(this._actionMap.values());\n this._progress = actions.length > 0\n ? actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n : undefined;\n\n // Always update ONLY the first assistant message of the _response with the new $progress, $attachment and $debug\n // Assuming that the first assistant message is always visible since the hub does not send hidden messages by design\n // So even if the first assistant message is hidden (display: false), the _response[0] will and should contain :\n // - $progress, $attachment and $debug\n // - the content of the first visible assistant message in the workflow\n // This is mandatory in order to match the behavior of consecutive messages and maintain consistency with the chatHistory\n if(!!this._progress || this._attachments.length > 0 || this._debugMessages.length > 0) {\n this._response[0].additionalProperties.$progress = this._progress;\n this._response[0].additionalProperties.$attachment = this._attachments;\n this._response[0].additionalProperties.$debug = this._debugMessages;\n }\n\n // Return the result\n return { history: [...messages, ...this._response], executionTime: this._executionTime };\n }),\n takeUntil(completion$), // Complete the observable when completion$ emits\n );\n\n // return a new Observable that emits the result of the combined stream and handles the eventual errors of the invocation of the Chat method\n return new Observable(observer => {\n // Subscribe to combined stream\n combined$.subscribe({\n next: (value) => observer.next(value),\n error: (err) => observer.error(err)\n });\n\n // Invoke the Chat method and handle errors\n this.connection!.invoke('Chat', data)\n .then(() => {\n // If a valid assistant message with (display: true) was found, update it\n // and it should always the case\n const index = this.firstVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$progress = this._progress;\n this.chatHistory![index].additionalProperties.$attachment = this._attachments;\n this.chatHistory![index].additionalProperties.$debug = this._debugMessages;\n }\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory!.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory!).pipe(tap(() => this.listSavedChat())) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe({\n next: () => {},\n error: (error) => {\n this.streaming$.next(false);\n observer.error(error);\n },\n complete: () => {\n this.streaming$.next(false);\n observer.complete();\n }\n });\n } else {\n this.streaming$.next(false);\n observer.complete();\n }\n })\n .catch(error => {\n console.error('Error invoking Chat:', error);\n this.streaming$.next(false);\n // Emit the error to the newly created observable\n observer.error(error);\n // Return a resolved promise to handle the error and prevent unhandled promise rejection\n return Promise.resolve();\n })\n .finally(() => {\n // This block concerns ONLY the completion of the \"Chat\" method invocation.\n // This means the completion of the combined$ stream.\n // It does not take into account the completion of the entire fetch method (the observable returned by fetch) and which depends on the completion of the save chat action if enabled\n this._response = []; // Clear the _response\n this._actionMap.clear(); // Clear the _actionMap\n this._progress = undefined; // Clear the _progress\n this._attachments = []; // Clear the _attachments\n this._debugMessages = []; // Clear the _debugMessages\n this._executionTime = \"\"; // Clear the _executionTime\n completion$.next(); // Emit a signal to complete the observables\n completion$.complete(); // Complete the subject\n });\n });\n }\n\n stopGeneration(): Observable<boolean> {\n // Start stopping generation by invoking the CancelTasks method\n this.stoppingGeneration$.next(true);\n // Create a Subject to hold the result of the CancelTasks method\n const stopGenerationSubject$ = new Subject<boolean>();\n\n this.connection!.on('CancelTasks', (res) => {\n // When the generation is stopped before streaming any VISIBLE assistant message, this means that $progress, $attachment and $debug properties will be lost.\n // However, the \"ContextMessage\" frames will be persisted in the chatHistory and the assistant may reference them in the next generation.\n // This leads to the problem of referencing undisplayed attachments in the next generation.\n // To solve this problem, we need to persist $progress, $attachment and $debug properties by adding a new assistant message with empty content and these properties.\n if (this._response.length === 1 && this._response[0].content === \"\") {\n this.chatHistory?.push({role: \"assistant\", content: \"\", additionalProperties: {display: true, $progress: this._progress, $attachment: this._attachments, $debug: this._debugMessages}});\n }\n stopGenerationSubject$.next(!!res); // Emit the result of the CancelTasks method\n stopGenerationSubject$.complete(); // Complete the subject\n this.stoppingGeneration$.next(false); // Complete stopping generation\n });\n\n // Invoke the CancelTasks method and handle errors\n this.connection!.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n stopGenerationSubject$.error(new Error(error));\n this.stoppingGeneration$.next(false); // Complete stopping generation\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n });\n\n return stopGenerationSubject$.asObservable();\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatList', (res) => {\n this.savedChats$.next(res.savedChats); // emits the result to the savedChats$ subject\n });\n\n // Invoke the method SavedChatList\n this.connection!.invoke('SavedChatList', data)\n .catch(error => {\n console.error('Error invoking SavedChatList:', error);\n return Promise.resolve();\n });\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const savedChatSubject$ = new Subject<SavedChatHistory | undefined>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatGet', (res) => {\n savedChatSubject$.next(res.savedChat);\n savedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatGet\n this.connection!.invoke('SavedChatGet', data)\n .catch(error => {\n console.error('Error invoking SavedChatGet:', error);\n savedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return savedChatSubject$.asObservable();\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChat> {\n const addSavedChatSubject$ = new Subject<SavedChat>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatAdd', (res) => {\n this.setSavedChatId(res.savedChat.id); // Persist the savedChatId\n this.generateAuditEvent('saved-chat.add', {}, res.savedChat.id); // Generate audit event\n addSavedChatSubject$.next(res.savedChat);\n addSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatAdd\n this.connection!.invoke('SavedChatAdd', data)\n .catch(error => {\n console.error('Error invoking SavedChatAdd:', error);\n addSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return addSavedChatSubject$.asObservable();\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat> {\n const updateSavedChatSubject$ = new Subject<SavedChat>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if(name) data[\"title\"] = name;\n if(messages) data[\"history\"] = messages;\n\n this.connection!.on('SavedChatUpdate', (res) => {\n updateSavedChatSubject$.next(res.savedChat);\n updateSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatUpdate\n this.connection!.invoke('SavedChatUpdate', data)\n .catch(error => {\n console.error('Error invoking SavedChatUpdate:', error);\n updateSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return updateSavedChatSubject$.asObservable();\n }\n\n deleteSavedChat(ids: string[]): Observable<number> {\n const deleteSavedChatSubject$ = new Subject<number>();\n\n const data = {\n instanceId: this.chatInstanceId,\n SavedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatDelete', (res) => {\n deleteSavedChatSubject$.next(res.deleteCount);\n deleteSavedChatSubject$.complete();\n });\n\n // Invoke the method SavedChatDelete\n this.connection!.invoke('SavedChatDelete', data)\n .catch(error => {\n console.error('Error invoking SavedChatDelete:', error);\n deleteSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return deleteSavedChatSubject$.asObservable();\n }\n\n /**\n * Initialize out-of-the-box handlers\n * It is a placeholder for non-streaming scenarios, where you invoke a specific hub method, and the server responds with frame message(s)\n */\n initMessageHandlers() {\n this.addMessageHandler(\n \"Error\",\n {\n handler: (error: ErrorEvent) => {\n console.error(error);\n this.notificationsService.error(error);\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Quota\",\n {\n handler: (message: QuotaEvent) => {\n try {\n this.updateQuota(message.quota)\n } catch (error) {\n console.error(error);\n }\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Debug\",\n { handler: () => {},\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"ActionStart\",\n { handler: (action: ActionStartEvent) => this._actionMap.set(action.guid, action),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionResult\",\n {\n handler: (action: ActionResultEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionStop\",\n {\n handler: (action: ActionStopEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ContextMessage\",\n {\n handler: (message: ContextMessageEvent) => this._attachments.push(message.metadata),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"Message\",\n {\n handler: (message: MessageEvent) => this._response.at(-1)!.content += message ?? \"\",\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"History\",\n {\n handler: (history: HistoryEvent) => {\n // The ChatHistory is updated: it is the current copy concatenated with the new items ONLY (it can have multiple messages: the context messages + the response message)\n // This is mandatory to not lose the previous updates of the chatHistory when the assistant is streaming multiple message steps\n this.chatHistory = [...this.chatHistory!, ...(history.history.slice(this.chatHistory!.length))];\n // Emit the updated chat usage metrics\n if (!!this.chatHistory.at(-1)?.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(this.chatHistory.at(-1)!.additionalProperties.usageMetrics!);\n }\n this._executionTime = history.executionTime;\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"SuggestedActions\",\n {\n handler: (message: SuggestedActionsEvent) => {\n // Since after the \"History\" and \"MessageBreak\" that this event is caught,\n // $suggestedAction needs to be updated directly to the last visible \"assistant\" message in the _response and the chatHistory\n this._response.at(-1)!.additionalProperties.$suggestedAction = (this._response.at(-1)!.additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n const index = this.lastVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$suggestedAction = (this.chatHistory![index].additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n }\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"DebugDisplay\",\n {\n handler: (message: DebugMessageEvent) => this._debugMessages = this._debugMessages.concat(message),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"MessageBreak\",\n {\n handler: () => {\n // Generate audit event\n const details = {\n 'duration': this._executionTime,\n 'text': this.chatHistory!.at(-1)!.content,\n 'role': this.chatHistory!.at(-1)!.role, // 'assistant'\n 'rank': this.chatHistory!.length - 1,\n 'generation-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': JSON.stringify(this._attachments.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => ({ partId, text })),\n type\n })))\n };\n this.generateAuditEvent('message', details);\n // Push a new assistant message to the _response array ONLY if the content of the last message is not empty\n if (this._response.at(-1)!.content !== \"\") {\n this._response.push({role: \"assistant\", content: \"\", additionalProperties: {display: true}})\n }\n },\n isGlobalHandler: false\n }\n );\n }\n\n /**\n * Override and register the entire _messageHandlers map by merging the provided map with the default one\n * @param _messageHandlers\n */\n overrideMessageHandlers<T>(_messageHandlers: Map<string, MessageHandler<T>>) {\n // Clear the already registered global chat handlers before merging the new ones\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.unsubscribeMessageHandler(eventName);\n }\n });\n\n // Merge the new event handlers with the existing ones\n this._messageHandlers = new Map([...this._messageHandlers, ..._messageHandlers]);\n\n // Register the global handlers among the merged map\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n });\n }\n\n /**\n * Add a listener for a specific event.\n * If a listener for this same event already exists, it will be overridden.\n * If the listener has \"isGlobalHandler\" set to true, it will be registered to the hub connection.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n addMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n this._messageHandlers.set(eventName, eventHandler);\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n }\n\n /**\n * Dynamically register a listener for a specific event.\n * If a listener for this event already exists, it will be overridden.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n protected registerMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n if (!this.connection) {\n console.log(\"No connection found to register the listener\" + eventName);\n return;\n }\n\n this.connection.on(eventName, (data: T) => {\n eventHandler.handler(data);\n });\n }\n\n /**\n * Remove a listener for a specific event from the _messageHandlers map and unsubscribe from receiving messages for this event from the SignalR hub.\n * @param eventName Name of the event to remove the listener for\n */\n removeMessageHandler(eventName: string) {\n this._messageHandlers.delete(eventName);\n this.unsubscribeMessageHandler(eventName);\n }\n\n /**\n * Unsubscribe from receiving messages for a specific event from the SignalR hub.\n * ALL its related listeners will be removed from hub connection\n * This is needed to prevent accumulating old listeners when overriding the entire _messageHandlers map\n * @param eventName Name of the event\n */\n protected unsubscribeMessageHandler(eventName: string) {\n this.connection!.off(eventName);\n }\n\n /**\n * Build a connection to the signalR websocket and register default listeners to the methods defined in the server hub class\n * @param options The options for the connection. It overrides the default options\n * @param logLevel Define the log level displayed in the console\n * @returns Promise that resolves when the connection is built\n */\n buildConnection(options?: ConnectionOptions): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.REQUEST_URL) {\n reject(new Error(\"No endpoint provided to connect the websocket to\"));\n return;\n }\n const logLevel = this._getLogLevel();\n this.connection = this.signalRService.buildConnection(this.REQUEST_URL, {...this.defaultOptions, ...options}, logLevel, true);\n\n const signalRServerTimeoutInMilliseconds = this.assistantConfig$.value?.connectionSettings.signalRServerTimeoutInMilliseconds;\n if (signalRServerTimeoutInMilliseconds) {\n this.connection.serverTimeoutInMilliseconds = signalRServerTimeoutInMilliseconds;\n }\n\n resolve();\n });\n }\n\n /**\n * Start the connection\n * @returns Promise that resolves when the connection is started\n */\n startConnection(): Promise<void> {\n return this.signalRService.startConnection(this.connection);\n }\n\n /**\n * Stop the connection\n * @returns Promise that resolves when the connection is stopped\n */\n stopConnection(): Promise<void> {\n return this.signalRService.stopConnection(this.connection);\n }\n\n private _getTransports(): HttpTransportType {\n switch (this.assistantConfig$.value?.connectionSettings.signalRTransport) {\n case \"WebSockets\":\n return HttpTransportType.WebSockets;\n case \"ServerSentEvents\":\n return HttpTransportType.ServerSentEvents;\n case \"LongPolling\":\n return HttpTransportType.LongPolling;\n default:\n return HttpTransportType.None;\n }\n }\n\n private _getLogLevel(): LogLevel {\n switch (this.assistantConfig$.value?.connectionSettings.signalRLogLevel) {\n case \"Critical\":\n return LogLevel.Critical; // Log level for diagnostic messages that indicate a failure that will terminate the entire application.\n case \"Debug\":\n return LogLevel.Debug; // Log level for low severity diagnostic messages.\n case \"Error\":\n return LogLevel.Error; // Log level for diagnostic messages that indicate a failure in the current operation.\n case \"Information\":\n return LogLevel.Information; // Log level for informational diagnostic messages.\n case \"None\":\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n case \"Trace\":\n return LogLevel.Trace; // Log level for very low severity diagnostic messages.\n case \"Warning\":\n return LogLevel.Warning; // Log level for diagnostic messages that indicate a non-fatal problem.\n default:\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n }\n }\n\n get defaultOptions(): ConnectionOptions {\n let headers: MessageHeaders = {\n \"sinequa-force-camel-case\": \"true\",\n \"x-language\": this.intlService.currentLocale.name,\n \"ui-language\": this.intlService.currentLocale.name,\n };\n if (this.authenticationService.processedCredentials) {\n headers = {...headers, \"sinequa-csrf-token\": this.authenticationService.processedCredentials.data.csrfToken};\n };\n // For the first GET request sent by signalR to start a WebSocket protocol,\n // as far as we know, signalR only lets us tweak the request with this access token factory\n // so we pass along the Sinequa CSRF token to pass the CSRF check..\n return {\n transport: this._getTransports(),\n withCredentials: true,\n headers,\n accessTokenFactory: () => this.authenticationService.processedCredentials?.data?.csrfToken || \"\"\n }\n }\n}\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>","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 { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { UtilsModule } from '@sinequa/components/utils';\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.component.scss'],\n standalone: true,\n imports: [CommonModule, UtilsModule, FormatIconComponent]\n})\nexport class ChatReferenceComponent {\n\n @Input() reference: string;\n @Input() attachment: ChatContextAttachment;\n @Input() partId?: number;\n\n @Output() openDocument = new EventEmitter<ChatContextAttachment>();\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n\n get parts(): DocumentPart[] {\n if (!this.attachment) return [];\n return this.attachment.parts.filter(part => (!this.partId || part.partId === this.partId) && !!part.text);\n }\n\n expandAttachment() {\n if (this.partId) return;\n this.attachment['$expanded'] = !this.attachment['$expanded'];\n }\n}\n","<div [class.reference-tooltip]=\"!!partId\">\n <div class=\"reference-data\" [class.expanded]=\"attachment['$expanded'] || !!partId\" (click)=\"expandAttachment()\">\n <span class=\"reference me-1\">{{reference}}</span>\n <sq-format-icon [extension]=\"attachment.record.fileext\"></sq-format-icon>\n <a [id]=\"'attachment-'+attachment.recordId\">\n {{attachment.record.title}}\n </a>\n <i class=\"fas fa-eye\" (click)=\"$event.stopPropagation(); openPreview.emit(attachment)\" [sqTooltip]=\"!partId ? 'Preview document' : ''\"></i>\n <i class=\"fas fa-arrow-up-right-from-square\" *ngIf=\"attachment.record.url1 || attachment.record.originalUrl\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment)\" [sqTooltip]=\"!partId ? 'Open document' : ''\">\n </i>\n </div>\n <div class=\"reference-passages\" *ngIf=\"!!partId || (attachment['$expanded']) && parts.length\">\n <div class=\"reference-passage\" *ngFor=\"let part of parts\">\n <span class=\"reference me-1\">{{reference}}.{{part.partId}}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n </div>\n</div>\n","import { 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 let chartInput = this.rawChartData.match(/<chartjs>({[\\s\\S]*?)<\\/chartjs>/)?.[1]?.trim().replace(/'/g, '\"') as string;\n let 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 { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ChangeDetectorRef, AfterViewInit, ElementRef } from \"@angular/core\";\nimport { PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { SearchService } from \"@sinequa/components/search\";\nimport { ChatContextAttachment, ChatMessage, SuggestedAction } from \"../types\";\n\nimport { unified, Processor } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { visit, CONTINUE, EXIT } from \"unist-util-visit\";\nimport { Text, Parent, Content } from \"mdast\";\nimport { Node } from \"unist\";\nimport { UIService, UtilsModule } from \"@sinequa/components/utils\";\nimport remarkGfm from \"remark-gfm\";\nimport { CommonModule } from \"@angular/common\";\nimport { CollapseModule } from \"@sinequa/components/collapse\";\nimport { RemarkModule } from \"ngx-remark\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { ChatReferenceComponent } from \"../chat-reference/chat-reference.component\";\n\nimport \"prismjs-components-importer/esm\";\nimport 'prismjs/plugins/autoloader/prism-autoloader';\nimport { ChartComponent } from \"../charts/chart/chart.component\";\n\ndeclare module Prism {\n function highlightAllUnder(el: HTMLElement): void;\n}\n\n@Component({\n selector: \"sq-chat-message\",\n templateUrl: \"./chat-message.component.html\",\n styleUrls: [\"./chat-message.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, UtilsModule, CollapseModule, RemarkModule,\n InitialsAvatarComponent, ChatReferenceComponent, ChartComponent]\n})\nexport class ChatMessageComponent implements OnChanges, AfterViewInit {\n @Input() message: ChatMessage;\n @Input() conversation: ChatMessage[];\n @Input() suggestedActions: SuggestedAction[] | undefined;\n @Input() assistantMessageIcon: string;\n @Input() userMessageIcon: string;\n @Input() connectionErrorMessageIcon: string;\n @Input() searchWarningMessageIcon: string;\n @Input() streaming: boolean;\n @Input() canEdit: boolean = false;\n @Input() canRegenerate: boolean = false;\n @Input() canCopy: boolean = false;\n @Input() canDebug: boolean = false;\n @Input() canLike: boolean = false;\n @Input() canDislike: boolean = false;\n @Output() openDocument = new EventEmitter<{reference: ChatContextAttachment, partId?: number}>();\n @Output() openPreview = new EventEmitter<{reference: ChatContextAttachment, partId?: number}>();\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n @Output() edit = new EventEmitter<ChatMessage>();\n @Output() copy = new EventEmitter<ChatMessage>();\n @Output() regenerate = new EventEmitter<ChatMessage>();\n @Output() like = new EventEmitter();\n @Output() dislike = new EventEmitter();\n @Output() debug = new EventEmitter<ChatMessage>();\n\n processor: Processor;\n\n references: string[] = [];\n referenceMap = new Map<string, ChatContextAttachment>();\n showReferences: boolean = true;\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n constructor(\n public searchService: SearchService,\n public ui: UIService,\n public principalService: PrincipalWebService,\n public cdr: ChangeDetectorRef,\n public el: ElementRef\n ) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.streaming) {\n this.collapseProgress = !this.streaming;\n }\n\n if (this.message?.role === \"assistant\") {\n this.references = [];\n this.referenceMap.clear();\n for (let m of this.conversation) {\n if (m.additionalProperties.$attachment) {\n for (const attachment of m.additionalProperties.$attachment) {\n this.referenceMap.set('' + attachment.contextId, { ...attachment, $partId: attachment.parts?.[0]?.partId });\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, { ...attachment, $partId: attachment.parts?.[i]?.partId });\n }\n }\n }\n }\n\n if(m.content.startsWith(\"<chartjs>\")){\n m.messageType = \"CHART\";\n }\n else{\n m.messageType = \"MARKDOWN\";\n }\n }\n\n this.processor = unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(() => this.referencePlugin);\n\n if (this.streaming) {\n this.processor = this.processor.use(() => this.placeholderPlugin);\n }\n }\n }\n\n ngAfterViewInit(): void {\n Prism?.highlightAllUnder?.(this.el.nativeElement);\n }\n\n get name(): string {\n return !this.principalService.principal ? ''\n : this.principalService.principal['fullName'] as string || this.principalService.principal.name;\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * This Unified plugin looks a text nodes and replaces any reference in the\n * form [1], [2.3], etc. with custom nodes of type \"chat-reference\".\n */\n referencePlugin = (tree: Node) => {\n\n const references = new Set<number>();\n\n // Visit all text nodes\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n let text = node.value;\n\n text = this.reformatReferences(text);\n const matches = this.getReferenceMatches(text);\n\n // Quit if no references were found\n if (matches.length === 0) {\n return CONTINUE;\n }\n\n const nodes: (Content & { end: number })[] = [];\n\n for (let match of matches) {\n const refId = match[1].trim();\n const [ref] = refId.split(\".\");\n // We find a valid reference in the text\n if (!isNaN(+ref)) {\n references.add(+ref); // Add it to the set of used references\n\n // If needed, insert a text node before the reference\n const current = nodes.at(-1) ?? { end: 0 };\n if (match.index! > current.end) {\n nodes.push({ type: \"text\", value: text.substring(current.end, match.index!), end: match.index! });\n }\n\n // Add a custom reference node\n nodes.push({ type: \"chat-reference\", refId, end: match.index! + match[0].length } as any);\n }\n }\n\n // Quit if no references were found\n if (nodes.length === 0) {\n return CONTINUE;\n }\n\n if (nodes.at(-1)!.end < text.length) {\n nodes.push({ type: \"text\", value: text.substring(nodes.at(-1)!.end, text.length), end: text.length });\n }\n\n // Delete the current text node from the parent and replace it with the new nodes\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length; // Visit the next node after the inserted ones\n });\n\n if (references.size > 0) {\n this.references = Array.from(references.values())\n .sort((a, b) => a - b)\n .map(r => '' + r);\n this.cdr.detectChanges();\n }\n\n return tree;\n }\n\n placeholderPlugin = (tree: Node) => {\n\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n parent.children.push({ type: \"streaming-placeholder\" } as any);\n return EXIT;\n }, true);\n\n return tree;\n }\n\n getLinkText(node: any): string {\n if (node.text) {\n return node.text; // Return directly if text is provided in node.text ([Example link](https://example.com))\n } else if (node.children && node.children.length > 0) {\n // Recursively search for text content in child nodes\n for (const child of node.children) {\n if (child.type === 'text' && child.value) {\n return child.value; // Return the value of the first text node found ([**Emphasized Link Text**](https://example.com))\n } else if (child.children && child.children.length > 0) {\n const textContent = this.getLinkText(child); // Recursively search child nodes ([](https://example.com))\n if (textContent) {\n return textContent; // Return text content if found\n }\n }\n }\n }\n return 'link'; // Return empty string if no text content is found\n }\n\n /**\n * Reformat [ids: 12.2, 42.5] to [12.2][42.5]\n */\n reformatReferences(content: string) {\n return content.replace(/\\[(?:ids?:?\\s*)?(?:documents?:?\\s*)?(\\s*(?:,?\\s*\\d+(?:\\.\\d+)?(?:\\.part)?\\s*)+)\\]/g,\n (str, match: string) => `[${match.replace(/\\.part/g, \"\").split(',').join(\"] [\")}]`\n );\n }\n\n /**\n * Match all references in a given message\n */\n getReferenceMatches(content: string) {\n return Array.from(content.matchAll(/\\[(\\s*\\d+(?:\\.\\d+)?\\s*)\\]/g));\n }\n\n private _copyToClipboard(content: string) {\n this.ui.copyToClipboard(content);\n\n }\n\n copyMessage(message: ChatMessage) {\n const content = message.content.replaceAll(/\\s+\\[.+?\\]/g, \"\")\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n copyCode(code: string) {\n this._copyToClipboard(code);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment, partId?: number) {\n this.openPreview.emit({reference: attachment, partId});\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment, partId?: number) {\n this.openDocument.emit({reference: attachment, partId});\n this.hideTooltip();\n }\n\n hideTooltip(): void {\n this.hiddenTooltip = true;\n setTimeout(() => {\n this.hiddenTooltip = false;\n });\n }\n}\n","<!-- Message icon -->\n<span class=\"message-icon\" [title]=\"message?.role\">\n <i class=\"d-block\" [style.width.px]=\"iconSize\" *ngIf=\"!message\"></i>\n <ng-container [ngSwitch]=\"message?.role\">\n <!-- For 'assistant' -->\n <i *ngSwitchCase=\"'assistant'\" [ngClass]=\"assistantMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <!-- 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 <!-- 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 <!-- 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\n</span>\n\n<!-- Message body -->\n<div class=\"flex-grow-1\" 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 <a href=\"#\" (click)=\"collapseProgress = !collapseProgress; false\" class=\"text-muted\">\n View progress\n <i class=\"fas fa-chevron-{{collapseProgress? 'right' : 'down'}}\"></i>\n </a>\n <sq-collapse [collapsed]=\"collapseProgress\">\n <ng-template>\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 </ng-template>\n </sq-collapse>\n </div>\n\n <!-- Message content -->\n <div class=\"message-content\" *ngIf=\"message.content\">\n\n <div *ngIf=\"message?.role === 'assistant' && message.messageType === 'CHART'\">\n <sq-assistant-chart [rawChartData]=\"message.content\"></sq-assistant-chart>\n </div>\n\n <!-- This section is responsible for customizing the template nodes used in the application.\n Template nodes are predefined structures that serve as blueprints for creating/customizing dynamic content -->\n <remark *ngIf=\"(message?.role === 'assistant' && message.messageType === 'MARKDOWN') || message?.role === 'connection-error' || message?.role === 'search-warning'\" [markdown]=\"message.content\" [processor]=\"processor\">\n\n <ng-template remarkTemplate=\"chat-reference\" let-ref>\n\n <a *ngIf=\"referenceMap.get(ref.refId) as attachment; else staticRefTpl\"\n class=\"reference\"\n [sqTooltip]=\"attachment\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n >{{ref.refId}}\n </a>\n\n <ng-template #staticRefTpl>\n <span class=\"reference\">{{ref.refId}}</span>\n </ng-template>\n\n </ng-template>\n\n <ng-template remarkTemplate=\"streaming-placeholder\">\n <span class=\"placeholder-glow\" *ngIf=\"streaming\">\n <span class=\"placeholder ms-1\"></span>\n </span>\n </ng-template>\n\n <ng-template remarkTemplate=\"code\" let-node>\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-between align-items-center\">\n <span>{{node.lang}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"copyCode(node.value)\"><i class=\"far fa-fw fa-clipboard\"></i> Copy code</button>\n </div>\n <pre class=\"language-{{node.lang}} my-0 rounded-0 rounded-bottom\"><code class=\"language-{{node.lang}}\">{{node.value}}</code></pre>\n </div>\n </ng-template>\n\n <ng-template remarkTemplate=\"link\" let-node>\n <a [href]=\"node.url\" target=\"_blank\" rel=\"noopener noreferrer\">{{getLinkText(node)}}</a>\n </ng-template>\n\n </remark>\n\n <p *ngIf=\"message?.role === 'user'\">{{message.content}}</p>\n\n <!-- List of reference, if any -->\n <div *ngIf=\"references?.length\" class=\"references\">\n <span class=\"references-title\">References</span> <i class=\"fas references-collapse\" [class.fa-chevron-down]=\"showReferences\" [class.fa-chevron-right]=\"!showReferences\" (click)=\"showReferences=!showReferences\"></i>\n <sq-collapse [collapsed]=\"!showReferences\">\n <ng-template>\n <ul>\n <ng-container *ngFor=\"let reference of references\">\n <li *ngIf=\"referenceMap.get(reference) as attachment\" class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n </ng-container>\n </ul>\n </ng-template>\n </sq-collapse>\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=\"Copy text\" (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=\"Edit message\" (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 === true\" *ngIf=\"canLike\" sqTooltip=\"Like the answer\" (click)=\"like.emit()\">\n <i class=\"fa-thumbs-up {{message.additionalProperties.$liked === true ? 'fas' : 'far'}}\"></i>\n </button>\n <button class=\"btn btn-sm bounce\" [class.bounce]=\"message.additionalProperties.$disliked === true\" *ngIf=\"canDislike\" sqTooltip=\"Report an issue\" (click)=\"dislike.emit()\">\n <i class=\"fa-thumbs-down {{message.additionalProperties.$disliked === true ? 'fas' : 'far'}}\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canRegenerate\" sqTooltip=\"Regenerate message\" (click)=\"regenerate.emit(message)\">\n <i class=\"fas fa-sync-alt\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canDebug\" sqTooltip=\"Show Log Information\" (click)=\"debug.emit(message);\">\n <i class=\"far fa-list-alt\"></i>\n </button>\n </div>\n\n <!-- List of suggested actions, if any -->\n <div *ngIf=\"suggestedActions\" class=\"mt-2 message-suggestion\">\n <div class=\"suggested-action\" *ngFor=\"let suggestedAction of suggestedActions\" (click)=\"suggestAction.emit(suggestedAction)\">\n <div class=\"message-icon\" [style.width.px]=\"iconSize\"></div>\n <div class=\"message-content\">\n <p><i class=\"fas fa-clipboard-question\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n <ng-template #tooltipTpl let-ref>\n <sq-chat-reference\n *ngIf=\"!hiddenTooltip\"\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"openAttachmentPreview($event, ref.$partId)\"\n (openDocument)=\"openOriginalAttachment($event, ref.$partId)\">\n </sq-chat-reference>\n </ng-template>\n\n</div>\n","import { Injectable, inject } from '@angular/core';\nimport { ChatService } from './chat.service';\nimport { Observable, catchError, filter, finalize, forkJoin, map, shareReplay, switchMap, take, tap, throwError } from 'rxjs';\nimport { ActionMessage, ChatMessage, ChatPayload, ChatProgress, ChatResponse, GllmFunction, GllmModelDescription, HttpChatResponse, SavedChat, SavedChatHistory } from './types';\nimport { JsonMethodPluginService } from '@sinequa/core/web-services';\nimport { Query } from \"@sinequa/core/app-utils\";\n\n@Injectable()\nexport class RestChatService extends ChatService {\n\n public jsonMethodWebService = inject(JsonMethodPluginService);\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the chat process after the login is complete.\n * It listens for the 'login-complete' event, initializes necessary URL, and performs parallel requests for models, functions and quota data.\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n return this.loginService.events.pipe(\n filter((e) => e.type === 'login-complete'),\n tap(() => this.getRequestsUrl()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n // cache and replay the emitted value for subsequent subscribers, ensuring the initialization logic is only executed once even if there are multiple subscribers\n shareReplay(1)\n );\n }\n\n /**\n * Define the GLLM plugin to use for the http requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.restEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.restEndpoint;\n } else {\n throw new Error(`The property 'restEndpoint' must be provided when attempting to use 'REST' in assistant instance`);\n }\n }\n\n override overrideUser(): void {\n const error = new Error('Override user is not supported in REST');\n console.error(error);\n }\n\n listModels(): Observable<GllmModelDescription[] | undefined> {\n const data = {\n action: \"listmodels\",\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.models),\n tap(models => this.models = models?.filter(model => !!model.enable)),\n catchError((error) => {\n console.error('Error invoking listmodels:', error);\n return throwError(() => error);\n })\n );\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const data = {\n action: \"listfunctions\",\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.functions),\n tap((functions: GllmFunction[] | undefined) => this.functions = functions?.filter(func => func.enabled && !!this.assistantConfig$.value!.defaultValues.functions.find(fn => fn.name === func.functionName))),\n catchError((error) => {\n console.error('Error invoking listfunctions:', error);\n return throwError(() => error);\n })\n );\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload & {action: \"chat\"} = {\n action: \"chat\",\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n // Request the Chat endpoint\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n tap((res: HttpChatResponse) => this.updateQuota(res.quota, true)),\n map((res: HttpChatResponse) => {\n // Define $progress from the actions property of the response\n let $progress: ChatProgress[] | undefined;\n if( res.actions?.length > 0) {\n const actions: ActionMessage[] = Object.values(res.actions.reduce((acc, item) => {\n acc[item.guid] = { ...(acc[item.guid] || {}), ...item };\n return acc;\n }, {}));\n $progress = actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n }\n // Re-attach the $progress and $attachment of the last response to the last assistant's response in the chat history\n const response = {...(res.history as Array<ChatMessage>).at(-1)} as ChatMessage;\n if($progress) response.additionalProperties.$progress = $progress;\n if(res.context) response.additionalProperties.$attachment = res.context.map((ctx) => ctx.additionalProperties);\n if(res.suggestedActions) response.additionalProperties.$suggestedAction = res.suggestedActions;\n // Emit the updated chat usage metrics once the generation of the assistant response is completed\n if (!!response.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(response.additionalProperties.usageMetrics!);\n }\n // Update the chat history with the incoming history property of the res AND the processed response message\n this.chatHistory = res.history;\n this.chatHistory[this.chatHistory.length - 1] = response;\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe();\n }\n // Generate audit event\n const details = {\n 'duration': res.executionTime,\n 'text': response.content,\n 'role': response.role, // 'assistant'\n 'rank': this.chatHistory.length - 1,\n 'generation-tokencount': response.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': response.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': response.additionalProperties.$attachment?.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => ({ partId, text })),\n type\n }))\n };\n this.generateAuditEvent('message', details);\n // Return the result\n return { history: [...messages, response], executionTime: res.executionTime };\n }),\n finalize(() => this.streaming$.next(false))\n );\n }\n\n stopGeneration(): Observable<any> {\n const error = new Error('Not supported in REST');\n console.error(error);\n return throwError(() => error);\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n action: \"SavedChatList\",\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n this.jsonMethodWebService.get(this.REQUEST_URL, data).subscribe(\n res => this.savedChats$.next(res.savedChats),\n error => {\n console.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n }\n );\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChat> {\n const data = {\n action: \"SavedChatAdd\",\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n tap((savedChat: SavedChat) => {\n this.setSavedChatId(savedChat.id); // Persist the savedChatId\n this.generateAuditEvent('saved-chat.add', {}, savedChat.id); // Generate audit event\n }),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const data = {\n action: \"SavedChatGet\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat> {\n const data = {\n action: \"SavedChatUpdate\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if(name) data[\"title\"] = name;\n if(messages) data[\"history\"] = messages;\n\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n deleteSavedChat(ids: string[]): Observable<number> {\n const data = {\n action: \"SavedChatDelete\",\n instanceId: this.chatInstanceId,\n savedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.deletedCount),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n}\n","import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';\nimport { Subscription, filter, switchMap, tap } from 'rxjs';\nimport { CommonModule } from '@angular/common';\nimport { ChatConfig, TokenConsumption, UserTokenConsumption } from '../types';\nimport { LoginService } from '@sinequa/core/login';\nimport { InstanceManagerService } from '../instance-manager.service';\nimport { ChatService } from '../chat.service';\nimport { UtilsModule } from '@sinequa/components/utils';\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 imports: [CommonModule, UtilsModule]\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 userTitle?: string;\n\n // Current chat token consumption progress bar\n chatPercentage?: number;\n chatTitle?: string;\n\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n\n ngOnInit() {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\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.userTitle = `Max generation allowed: ${this.userPercentage}% consumed. Resets at ${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 this.chatTitle = `Max length of conversation: ${this.chatPercentage}% reached.`;\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]=\"userTitle\"\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]=\"chatTitle\"\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 { AfterViewInit, Component, Input } from \"@angular/core\";\nimport { DebugMessage } from \"../types\";\nimport { Utils } from \"@sinequa/core/base\";\nimport * as Prism from 'prismjs';\nimport { UIService } from \"@sinequa/components/utils\";\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]\n})\nexport class DebugMessageComponent implements AfterViewInit {\n @Input() data: DebugMessage[] | undefined;\n @Input() level: number = 0; // Track the nesting level\n @Input() parentColor: string = ''; // Track the parent row color\n\n constructor(public ui: UIService) { }\n\n ngAfterViewInit() {\n Prism.highlightAll();\n }\n\n isObject(value: any): boolean {\n return Utils.isObject(value);\n }\n\n getRowClass(item: DebugMessage, index: number): string {\n if (item.isError) return 'row-error';\n if (this.level === 0) return index % 2 === 0 ? 'row-even' : 'row-odd';\n return this.parentColor;\n }\n\n copyToClipboard(code: any) {\n this.ui.copyToClipboard(JSON.stringify(code, null, 2));\n }\n}\n","<div *ngIf=\"data\" class=\"table-root\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <div *ngIf=\"item.type === 'KV'\" [ngClass]=\"getRowClass(item, i)\" class=\"table-row 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> Copy code</button>\n </div>\n <pre class=\"language-json my-0 rounded-0 rounded-bottom\"><code class=\"language-json\">{{ item.data.value | json }}</code></pre>\n </div>\n </ng-container>\n <ng-template #normalValue><div class=\"data-value\">{{ item.data.value }}</div></ng-template>\n </div>\n </div>\n <div *ngIf=\"item.type === 'LIST'\" [ngClass]=\"getRowClass(item, i)\" class=\"table-row list-object\">\n <div class=\"list-name w-100\" [class.fw-bold]=\"level === 0\" (click)=\"item.expanded=!item.expanded\">\n <i class=\"fas\" [class.fa-chevron-up]=\"item.expanded\" [class.fa-chevron-down]=\"!item.expanded\"></i>\n {{ item.name }}\n </div>\n <div class=\"list-items w-100\" *ngIf=\"item.expanded\">\n <sq-debug-message [data]=\"item.items\" [level]=\"level + 1\" [parentColor]=\"getRowClass(item, i)\"></sq-debug-message>\n </div>\n </div>\n </ng-container>\n</div>\n","import { inject, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef, ViewChild } from \"@angular/core\";\nimport { Action } from \"@sinequa/components/action\";\nimport { AbstractFacet } from \"@sinequa/components/facet\";\nimport { SearchService } from \"@sinequa/components/search\";\nimport { AppService, Query } from \"@sinequa/core/app-utils\";\nimport { PrincipalWebService, Record as Article } from \"@sinequa/core/web-services\";\nimport { BehaviorSubject, Subscription, combineLatest, filter, fromEvent, map, merge, switchMap, take, tap } from \"rxjs\";\nimport { ChatService } from \"./chat.service\";\nimport { ChatContextAttachment, ChatConfig, ChatMessage, GllmModelDescription, MessageHandler, RawMessage, SuggestedAction, InitChat, DebugMessage } from \"./types\";\nimport { InstanceManagerService } from \"./instance-manager.service\";\nimport { WebSocketChatService } from \"./websocket-chat.service\";\nimport { ChatMessageComponent } from \"./chat-message/chat-message.component\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { RestChatService } from \"./rest-chat.service\";\nimport { TokenProgressBarComponent } from \"./token-progress-bar/token-progress-bar.component\";\nimport { DebugMessageComponent } from \"./debug-message/debug-message.component\";\nimport { HubConnection, HubConnectionState } from \"@microsoft/signalr\";\nimport { UtilsModule } from \"@sinequa/components/utils\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\n\n@Component({\n selector: 'sq-chat-v3', // mandatory since @sinequa/components already has the same tag-name \"sq-chat\"\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n providers: [\n RestChatService,\n WebSocketChatService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, FormsModule, ChatMessageComponent, TokenProgressBarComponent, DebugMessageComponent, UtilsModule]\n})\nexport class ChatComponent extends AbstractFacet implements OnInit, OnChanges, OnDestroy {\n\n public loginService = inject(LoginService);\n public websocketService = inject(WebSocketChatService);\n public restService = inject(RestChatService);\n public instanceManagerService = inject(InstanceManagerService);\n public searchService = inject(SearchService);\n public principalService = inject(PrincipalWebService);\n public cdr = inject(ChangeDetectorRef);\n public appService = inject(AppService);\n public notificationsService = inject(NotificationsService);\n\n /** Define the key based on it, the chat service instance will be stored */\n @Input() instanceId: string;\n /** Define the query to use to fetch answers */\n @Input() query: Query = this.searchService.query;\n /** Function that determines whether the chat should be reloaded after the query changes\n * If not provided, the chat will be reloaded by default\n * @param prevQuery The previous query\n * @param newQuery The new query\n * @returns true if the chat should be reloaded, false otherwise\n */\n @Input() queryChangeShouldTriggerReload: (prevQuery: Query, newQuery: Query) => boolean;\n /** Define the protocol to be used for this chat instance*/\n @Input() protocol: 'REST' | 'WEBSOCKET' = \"WEBSOCKET\";\n /** Map of listeners overriding default registered ones*/\n @Input() messageHandlers: Map<string, MessageHandler<any>> = new Map();\n /** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */\n @Input() automaticScrollToLastResponse = false;\n /** When the assistant answer a user question, automatically focus to the chat input */\n @Input() focusAfterResponse = false;\n /** A chat discussion that the component should get initialized with it */\n @Input() chat?: InitChat;\n /** Icon to use for the assistant messages */\n @Input() assistantMessageIcon = 'sq-sinequa';\n /** Icon to use for the user messages */\n @Input() userMessageIcon: string;\n /** Icon to use for the connection error messages */\n @Input() connectionErrorMessageIcon: string;\n /** Icon to use for the search warning messages */\n @Input() searchWarningMessageIcon: string;\n /** Event emitter triggered once the signalR connection is established */\n @Output() connection = new EventEmitter<HubConnection>();\n /** Event emitter triggered each time the assistant updates the current chat */\n /** Event emitter triggered when the chat is loading new content */\n @Output(\"loading\") loading$ = new EventEmitter<boolean>(false);\n /** Emits the assistant configuration used when instantiating the component */\n @Output(\"config\") _config = new EventEmitter<ChatConfig>();\n @Output() data = new EventEmitter<ChatMessage[]>();\n /** Event emitter triggered when the user clicks to open the original document representing the context attachment*/\n @Output() openDocument = new EventEmitter<Article>();\n /** Event emitter triggered when the user clicks to open the preview of a document representing the context attachment */\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n /** Event emitter triggered when the user clicks on a suggested action */\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n /** ViewChild decorators to access the template elements */\n @ViewChild('messageList') messageList?: ElementRef<HTMLUListElement>;\n @ViewChild('questionInput') questionInput?: ElementRef<HTMLTextAreaElement>;\n /** ContentChild decorators allowing the override of the default templates from the parent component */\n @ContentChild('loadingTpl') loadingTpl?: TemplateRef<any>;\n @ContentChild('reportTpl') reportTpl?: TemplateRef<any>;\n @ContentChild('tokenConsumptionTpl') tokenConsumptionTpl?: TemplateRef<any>;\n @ContentChild('debugMessagesTpl') debugMessagesTpl?: TemplateRef<any>;\n\n chatService: ChatService;\n config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n\n question = '';\n\n _actions: Action[] = [];\n private _resetChatAction = new Action({\n icon: 'fas fa-sync',\n title: \"Reset assistant\",\n action: () => this.newChat()\n });\n\n private _sub = new Subscription();\n private _dataSubscription: Subscription | undefined;\n\n /** Variables that depend on the type of model in use */\n modelDescription?: GllmModelDescription;\n\n messageToEdit?: number;\n remappedMessageToEdit?: number;\n changes$ = new BehaviorSubject<SimpleChanges | undefined>(undefined);\n currentMessageIndex: number | undefined;\n firstChangesHandled = false;\n isAtBottom = true;\n initializationError = false;\n enabledUserInput = false;\n isConnected = true; // By default, the chat is considered connected\n retrialAttempts: number | undefined;\n // Flag to track whether the 'reconnected' listener is already registered\n private _isReconnectedListenerRegistered = false;\n\n // Issue reporting\n issueTypes?: string[];\n defaultIssueTypes: string[] = [\n 'User Interface bug',\n 'Incorrect or misleading response',\n 'Incomplete response',\n 'Technical issue',\n 'Privacy/data security issue',\n 'Other'\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 super();\n this._actions.push(this._resetChatAction);\n }\n\n ngOnInit(): void {\n this._sub.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n map(_ => this.chatService.initChatConfig()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig),\n switchMap(_ => this.chatService.init()),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n if (this.chatService instanceof WebSocketChatService) {\n this.connection.emit(this.chatService.connection);\n }\n this.onLoadChat();\n }),\n tap(_ => this.chatService.overrideUser()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.assistantConfig$),\n tap(config => {\n this.config = config!;\n this.enabledUserInput = this.config.modeSettings.enabledUserInput;\n this.issueTypes = this.config.auditSettings?.issueTypes?.length ? this.config.auditSettings!.issueTypes : undefined;\n this._config.emit(config);\n try {\n this.updateModelDescription();\n if(!this.firstChangesHandled) {\n this._previousQuery = JSON.parse(JSON.stringify(this.query)); // Initialize the previous query\n this._handleChanges();\n this._addScrollListener();\n this.firstChangesHandled = true;\n }\n } catch (error) {\n this.initializationError = true\n throw error;\n }\n })\n ).subscribe()\n );\n\n this._sub.add(\n combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ]).pipe(\n map(([streaming, stoppingGeneration]) => !!(streaming || stoppingGeneration))\n ).subscribe((result) => {\n this._resetChatAction.disabled = result;\n })\n );\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._sub.unsubscribe();\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\n if (this.chatService instanceof WebSocketChatService) {\n this.chatService.stopConnection();\n }\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * Instantiate the chat service based on the provided @input protocol\n * This chat service instance will then be stored in the instanceManagerService with provided @input instanceId as a key\n */\n instantiateChatService(): void {\n switch (this.protocol) {\n case 'REST':\n this.chatService = this.restService;\n break;\n case 'WEBSOCKET':\n this.chatService = this.websocketService;\n break;\n default:\n throw new Error(`Could not found a ChatService implementation corresponding to the provided protocol: '${this.protocol}'`);\n }\n this.chatService.setChatInstanceId(this.instanceId);\n this.instanceManagerService.storeInstance(this.instanceId, this.chatService);\n }\n\n override get actions() { return this._actions; }\n\n\n /**\n * Handles the changes in the chat component.\n * If the chat service is a WebSocketChatService, it handles the override of the message handlers if they exist.\n * Initializes the chat with the provided chat messages if they exist, otherwise loads the default chat.\n * If the chat is initialized, the initialization event is \"Query\", the query changes, and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true. Otherwise, the chat should be reloaded by default.\n * It takes into account the ongoing streaming process and the ongoing stopping process to trigger that conditionally define the logic\n * of the reload :\n * - If the chat is streaming, then stop the generation and wait for the fetch to complete before reloading the chat.\n * - If the chat is stopping the generation, then wait for the fetch to complete before reloading the chat.\n */\n private _handleChanges() {\n const changes = this.changes$.value;\n // If the chat service is a WebSocketChatService, handle the override of the message handlers if exists\n if (changes?.messageHandlers && this.messageHandlers && this.chatService instanceof WebSocketChatService) {\n this.chatService.overrideMessageHandlers(this.messageHandlers);\n }\n /**\n * Initialize the chat with the provided chat messages if exists, otherwise load the default chat\n * Once the chat is initialized (firstChangesHandled is true), allow opening the chat with the new provided messages (if exists)\n */\n if (!this.firstChangesHandled || changes?.chat) {\n const openChat = () => {\n if (this.messages$.value) {\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n }\n this.openChat(this.chat!.messages);\n };\n this.chatService.generateChatId();\n if (this.chat) {\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value),'chat-init': JSON.stringify(this.chat)});\n openChat();\n } else {\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)});\n this.loadDefaultChat();\n }\n }\n /**\n * If the chat is initialized, the initialization event is \"Query\", the query changes and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true\n * Otherwise, the chat should be reloaded by default\n */\n if (this.firstChangesHandled && changes?.query && this.config.modeSettings.initialization.event === 'Query') {\n if (this.queryChangeShouldTriggerReload ? this.queryChangeShouldTriggerReload(this._previousQuery, this.query) : true) {\n if (!!this.chatService.stoppingGeneration$.value) {\n if (!this._reloadSubscription) {\n // Create a subscription to wait for both streaming$ and stoppingGeneration$ to be false\n this._reloadSubscription = combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ])\n .pipe(\n filter(([streaming, stopping]) => !streaming && !stopping), // Wait until both are false\n take(1) // Complete after the first match\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription = undefined;\n });\n }\n } else if (!!this.chatService.streaming$.value) {\n if (!this._reloadSubscription) {\n this._reloadSubscription = this.chatService.stopGeneration()\n .subscribe({\n next: () => {},\n error: () => {\n // Clean up subscription and reset its value\n this._reloadSubscription?.unsubscribe();\n this._reloadSubscription = undefined;\n },\n complete: () => {\n // Wait for the ongoing fetch to complete, then trigger the reload\n this.chatService.streaming$.pipe(\n filter((streaming) => !streaming),\n take(1)\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription!.unsubscribe();\n this._reloadSubscription = undefined;\n });\n }\n });\n }\n } else {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n } else {\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n }\n }\n\n /**\n * Triggers a reload after the query change.\n * This method performs the necessary operations to reload the chat after a query change.\n * It sets the system and user messages, resets the savedChatId, generates a new chatId,\n * generates a new chat audit event, and handles the query mode.\n */\n private _triggerReloadAfterQueryChange() {\n const systemMsg = {role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: {display: false}};\n const userMsg = {role: 'user', content: ChatService.formatPrompt(this.config.defaultValues.userPrompt, {principal: this.principalService.principal}), additionalProperties: {display: this.config.modeSettings.displayUserPrompt}};\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this._handleQueryMode(systemMsg, userMsg);\n }\n\n\n /**\n * Adds a scroll listener to the message list element.\n * The listener is triggered when any of the following events occur:\n * - Loading state changes\n * - Messages change\n * - Streaming state changes\n * - Scroll event occurs on the message list element\n *\n * When the listener is triggered, it updates the `isAtBottom` property.\n */\n private _addScrollListener() {\n this._sub.add(\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(this.messageList!.nativeElement, 'scroll')).subscribe(() => {\n this.isAtBottom = this._toggleScrollButtonVisibility();\n this.cdr.detectChanges();\n })\n );\n }\n\n /**\n * Get the model description based on the defaultValues service_id and model_id\n */\n updateModelDescription() {\n this.modelDescription = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.cdr.detectChanges();\n }\n\n /**\n * Submits a question from the user.\n * If the user is editing a previous message, removes all subsequent messages from the chat history.\n * Triggers the fetch of the answer for the submitted question by calling _fetchAnswer().\n * Clears the input value in the UI.\n * ⚠️ If the chat is streaming or stopping the generation, the operation is not allowed.\n */\n submitQuestion() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if(this.question.trim() && this.messages$.value && this.chatService.chatHistory) {\n // When the user submits a question, if the user is editing a previous message, remove all subsequent messages from the chat history\n if (this.messageToEdit !== undefined) {\n // Update the messages in the UI\n this.messages$.next(this.messages$.value.slice(0, this.messageToEdit));\n // Update the raw messages in the chat history which is the clean version used to make the next request\n this.chatService.chatHistory = this.chatService.chatHistory.slice(0, this.remappedMessageToEdit);\n this.messageToEdit = undefined;\n this.remappedMessageToEdit = undefined;\n }\n // Remove the search warning message if exists\n if (this.chatService.chatHistory.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory.pop();\n }\n // Fetch the answer\n this._fetchAnswer(this.question.trim(), this.chatService.chatHistory);\n // Clear the input value in the UI\n this.questionInput!.nativeElement.value = '';\n this.questionInput!.nativeElement.style.height = `auto`;\n }\n }\n\n /**\n * Triggers the fetch of the answer for the given question and updates the conversation.\n * Generates an audit event for the user input.\n *\n * @param question - The question asked by the user.\n * @param conversation - The current conversation messages.\n */\n private _fetchAnswer(question: string, conversation: ChatMessage[]) {\n const userMsg = {role: 'user', content: question, additionalProperties: {display: true, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n const messages = [...conversation, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userMsg, messages.length - 1), 'query': JSON.stringify(this.query), 'is-user-input': true, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.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 = {role: 'connection-error', content: this.config.connectionSettings.connectionErrorMessage, additionalProperties: {display: true}};\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.config.connectionSettings.connectionErrorMessage, additionalProperties: {display: true}};\n this.messages$.next([...messages, message]);\n }\n\n if(this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * Retry to fetch the messages if the connection issues.\n * - If reconnecting => keep display the connection error message even when clicking on the \"retry\" button and increasing the number of retrial attempts, until the connection is re-established\n * - If disconnected => On click on the \"retry\" button, start the connection process while displaying the connection error message :\n * * If successful => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * * If failed => increase the number of retrial attempts\n */\n retryFetch() {\n if(this.chatService instanceof WebSocketChatService) {\n // A one-time listener for reconnected event\n const onReconnectedHandler = () => {\n // Get the messages without the last one (the connection error message)\n const messages = this.messages$.value!.slice(0, -1);\n // Find the last \"user\" message in the messages list\n let index = messages.length - 1;\n while (index >= 0 && messages[index].role !== 'user') {\n index--;\n }\n // If a user message is found (and it should always be the case), remove all subsequent messages from the chat history\n // Update the messages in the UI\n // and fetch the answer from the assistant\n if (index >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, index+1));\n const remappedIndex = this._remapIndexInChatHistory(index);\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, remappedIndex+1);\n this.fetch(this.chatService.chatHistory);\n }\n this.retrialAttempts = undefined; // Reset the number of retrial attempts\n /**\n * To remove the handler for onreconnected() after it's been registered,cannot directly use off() like you would for normal events registered with connection.on().\n * Instead, you need to explicitly remove or reset the handler by assigning it to null or an empty function\n */\n (this.chatService as WebSocketChatService).connection!.onreconnected(() => {});\n // Reset the flag to ensure the handler is registered again when needed\n this._isReconnectedListenerRegistered = false;\n }\n // Depending on the connection's state, take the appropriate action\n switch (this.chatService.connection!.state) {\n case HubConnectionState.Connected:\n // If the connection is re-established in the meantime, fetch the messages\n onReconnectedHandler();\n break;\n case HubConnectionState.Reconnecting:\n // Attach the reconnected listener if not already registered\n if (!this._isReconnectedListenerRegistered) {\n this.chatService.connection!.onreconnected(onReconnectedHandler);\n this._isReconnectedListenerRegistered = true;\n }\n // Increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts+1 : 1;\n break;\n case HubConnectionState.Disconnected:\n // Start the new connection\n this.chatService.startConnection()\n .then(() => onReconnectedHandler())\n .catch(() => { // If the connection fails, increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts+1 : 1;\n });\n break;\n default:\n break;\n }\n }\n }\n\n /**\n * Check if the signalR connection is connected.\n * For the REST protocol, the connection is always considered connected (for the moment).\n */\n private _updateConnectionStatus() {\n this.isConnected = (this.chatService instanceof WebSocketChatService) ? this.chatService.connection!.state === HubConnectionState.Connected : true;\n }\n\n /**\n * Update the UI with the new messages\n * @param messages\n */\n updateData(messages: ChatMessage[]) {\n this.messages$.next(messages);\n this.data.emit(messages);\n this.loading$.next(false);\n this.question = '';\n if(this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * @returns true if the chat discussion is scrolled down to the bottom, false otherwise\n */\n private _toggleScrollButtonVisibility(): boolean {\n if(this.messageList?.nativeElement) {\n return Math.round(this.messageList?.nativeElement.scrollHeight - this.messageList?.nativeElement.scrollTop - 1) <= this.messageList?.nativeElement.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n if(this.messageList?.nativeElement) {\n this.messageList.nativeElement.scrollTop = this.messageList.nativeElement.scrollHeight;\n this.cdr.detectChanges();\n }\n }, 10);\n }\n\n /**\n * Start a new chat with the defaultValues settings.\n * The savedChatId in the chat service will be reset, so that the upcoming saved chat operations will be performed on the fresh new chat.\n * If the savedChat feature is enabled, the list of saved chats will be refreshed.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n */\n newChat() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this.loadDefaultChat(); // Start a new chat\n }\n\n /**\n * Attaches the specified document IDs to the assistant.\n * If no document IDs are provided, the operation is not allowed.\n * If the action for attaching a document is not defined at the application customization level, an error is logged.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param ids - An array of document IDs to attach.\n */\n attachToChat(ids: string[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (!ids || ids?.length < 1) {\n return;\n }\n const attachDocAction = this.config.modeSettings.actions?.[\"attachDocAction\"];\n if (!attachDocAction) {\n console.error(`No action is defined for attaching a document to the assistant \"${this.instanceId}\"`);\n return;\n }\n const userMsg = { role: 'user', content: '', additionalProperties: {display: false, isUserInput: false, type: \"Action\", forcedWorkflow: attachDocAction.forcedWorkflow, forcedWorkflowProperties: {...(attachDocAction.forcedWorkflowProperties || {}), ids}, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n const messages = [...this.chatService.chatHistory!, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n }\n\n /**\n * Start the default chat with the defaultValues settings\n * If the chat is meant to be initialized with event === \"Query\", the corresponding user query message will be added to the chat history\n */\n loadDefaultChat() {\n // Define the default system prompt and user prompt messages\n const systemMsg = {role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: {display: false}};\n const userMsg = {role: 'user', content: ChatService.formatPrompt(this.config.defaultValues.userPrompt, {principal: this.principalService.principal}), additionalProperties: {display: this.config.modeSettings.displayUserPrompt}};\n\n if (this.config.modeSettings.initialization.event === 'Query') {\n this._handleQueryMode(systemMsg, userMsg);\n } else {\n this._handlePromptMode(systemMsg, userMsg);\n }\n }\n\n /**\n * Handles the prompt mode of the chat component.\n * If `sendUserPrompt` is true, it opens the chat with both system and user messages,\n * and generates audit events for both messages.\n * If `sendUserPrompt` is false, it opens the chat with only the system message,\n * and generates an audit event for the system message.\n *\n * @param systemMsg - The system message to be displayed in the chat.\n * @param userMsg - The user message to be displayed in the chat (optional).\n */\n private _handlePromptMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(userMsg, 1));\n } else {\n this.openChat([systemMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n }\n }\n\n /**\n * Handles the query mode by displaying the system message, user message, and user query message.\n * If the provided query text is not empty, then add the user query message to the chat history and invoke the assistant\n * Otherwise, just start a new chat with a warning message inviting the user to perform a full text search to retrieve some results\n * @param systemMsg - The system message to be displayed.\n * @param userMsg - The user message to be displayed.\n */\n private _handleQueryMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (!!this.query.text) {\n const userQueryMsg = {role: 'user', content: this.query.text, additionalProperties: {display: this.config.modeSettings.initialization.displayUserQuery, query: this.query, forcedWorkflow: this.config.modeSettings.initialization.forcedWorkflow, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(userMsg, 1));\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userQueryMsg, 2), 'query': JSON.stringify(this.query) ,'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, '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('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userQueryMsg, 1), 'query': JSON.stringify(this.query) ,'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, '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.config.globalSettings.searchWarningMessage, additionalProperties: {display: true}};\n this.openChat([systemMsg, warningMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(warningMsg, 0));\n }\n }\n\n private _defineMessageAuditDetails(message: ChatMessage, rank: number): Record<string, any> {\n return {\n 'duration': 0,\n 'text': message.content,\n 'role': message.role,\n 'rank': rank\n };\n }\n\n /**\n * Start/open a new chat with the provided messages and chatId\n * If the last message is from the user, a request to the assistant is made to get an answer\n * If the last message is from the assistant, the conversation is loaded right away\n * @param messages The list of messages of the chat\n * @param savedChatId The id of the saved chat. If provided (ie. an existing discussion in the saved chat index), update the savedChatId in the chat service for the upcoming saved chat operations\n */\n openChat(messages: RawMessage[], savedChatId?: string) {\n if (!messages || !Array.isArray(messages)) {\n console.error('Error occurs while trying to load the discussion. Invalid messages received :', messages);\n return;\n }\n if (savedChatId) {\n this.chatService.setSavedChatId(savedChatId);\n this.chatService.generateChatId(savedChatId);\n }\n this.resetChat();\n this.messages$.next(messages);\n this.chatService.chatHistory = messages;\n const lastMessage = messages.at(-1);\n if(lastMessage && lastMessage.role === 'user') {\n this.fetch(messages); // If the last message if from a user, an answer from the assistant is expected\n }\n else {\n this.updateData(messages); // If the last message if from the assistant, we can load the conversation right away\n this.terminateFetch();\n }\n this._addScrollListener();\n }\n\n /**\n * Reset the chat by clearing the chat history and the UI accordingly\n * The user input will be cleared\n * The fetch subscription will be terminated\n */\n resetChat() {\n if(this.messages$.value) {\n this.messages$.next(undefined); // Reset chat\n }\n this.chatService.chatHistory = undefined; // Reset chat history\n this.question = '';\n this.terminateFetch();\n }\n\n /**\n * Fetch and Load the saved chat from the saved chat index.\n * If the saved chat is found, the chat discussion will be loaded with the provided messages and chatId\n */\n onLoadChat() {\n this.loading$.next(true);\n this._sub.add(\n this.chatService.loadSavedChat$\n .pipe(\n filter(savedChat => !!savedChat),\n switchMap(savedChat => this.chatService.getSavedChat(savedChat!.id)),\n filter(savedChatHistory => !!savedChatHistory),\n tap(savedChatHistory => this.openChat(savedChatHistory!.history, savedChatHistory!.id))\n ).subscribe()\n );\n }\n\n /**\n * Stop the generation of the current assistant's answer.\n * The fetch subscription will be terminated.\n */\n stopGeneration() {\n this.chatService.stopGeneration().subscribe(\n () => this.terminateFetch()\n );\n }\n\n /**\n * Terminate the fetch process by unsubscribing from the data subscription and updating the loading status to false.\n * Additionally, focus on the chat input if the focusAfterResponse flag is set to true.\n */\n terminateFetch() {\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = undefined;\n this.loading$.next(false);\n this.cdr.detectChanges();\n\n if (this.focusAfterResponse) {\n setTimeout(() => {\n this.questionInput?.nativeElement.focus();\n });\n }\n }\n\n /**\n * Copy a previous user message of the chat history to the chat user input.\n * Thus, the user can edit and resubmit the message.\n * Once the edited message is submitted, all subsequent messages starting from @param index will be removed from the history and the UI will be updated accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the user's message to edit\n */\n editMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.messageToEdit = index;\n this.remappedMessageToEdit = this._remapIndexInChatHistory(index);\n this.question = this.chatService.chatHistory![this._remapIndexInChatHistory(index)].content;\n this.chatService.generateAuditEvent('edit.click', {'rank': this._remapIndexInChatHistory(index)});\n }\n\n /**\n * Copy a previous assistant message of the chat history to the clipboard.\n * @param index The index of the assistant's message to edit\n */\n copyMessage(index: number) {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(index);\n this.chatService.generateAuditEvent('copy.click', {'rank': idx});\n }\n\n /**\n * Starting from the provided index, remove all subsequent messages from the chat history and the UI accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the assistant's message to regenerate\n */\n regenerateMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n // Update the messages in the UI by removing all subsequent 'assistant' messages starting from the provided index until the first previous 'user' message\n let i = index;\n while (i >= 0 && (this.messages$.value!)[i].role !== 'user') {\n i--;\n }\n // It should always be the case that i > 0\n if (i >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, i+1));\n // Remap the index of this found first previous 'user' message in the chat history\n const idx = this._remapIndexInChatHistory(i);\n // Define and Update the chat history based on which the assistant will generate a new answer\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, idx+1);\n // Fetch the answer\n this.fetch(this.chatService.chatHistory);\n this.chatService.generateAuditEvent('regenerate.click', {'rank': idx});\n }\n }\n\n /**\n * Remaps the index in the chat history.\n * The chat history is a list of messages where some messages can be hidden (display set to false).\n * The index provided as input is the index of the message in the chat history displayed in the UI.\n * This function should be removed once the backend is updated to add the ids of the messages in the chat history\n * @param index - The index to be remapped.\n */\n private _remapIndexInChatHistory(index: number) {\n // a copy of the chat history is created to avoid modifying the original chat history.\n // Additionally, a rank is giving to each message.\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n const history = this.chatService.chatHistory!\n .slice()\n .map((message, idx) => ({...message, additionalProperties: {...message.additionalProperties, rank: idx}}))\n .map((message) => {\n if (message.role === \"user\") {\n return {...message, additionalProperties: {...message.additionalProperties, display: true}}\n }\n return message;\n })\n // Count the number of hidden messages (of role different then \"user\") in messages$ before the provided index\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n // This is mandatory to get the correct rank of the message in the chat history\n // Since some hidden messages (like 'system' messages) are not displayed in the UI but have been counted in the provided index\n const numberOfHiddenMessagesInMessages$BeforeIndex = this.messages$.value!\n .slice(0, index)\n .map((message) => {\n if (message.role === \"user\") {\n return {...message, additionalProperties: {...message.additionalProperties, display: true}}\n }\n return message;\n })\n .filter(message => !message.additionalProperties.display).length;\n // remove all messages that have display set to false\n // this is mandatory since at the point of time when the assistant answers a question,\n // it might have some hidden messages (for example contextMessages) that are available in the chat history but don't figure in messages$ unless a new question is asked\n const filteredHistory = history.filter(message => message.additionalProperties.display);\n // return the index of the message in the filtered history\n return filteredHistory[index - numberOfHiddenMessagesInMessages$BeforeIndex].additionalProperties.rank;\n }\n\n /**\n * Handles the key up event for 'Backspace' and 'Enter' keys.\n * @param event - The keyboard event.\n */\n onKeyUp(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Backspace':\n this.calculateHeight();\n break;\n case 'Enter':\n if (!event.shiftKey) {\n event.preventDefault();\n this.submitQuestion();\n }\n this.calculateHeight();\n break;\n default:\n break;\n }\n }\n\n /**\n * Calculates and adjusts the height of the question input element based on its content.\n * If the Enter key is pressed without the Shift key, it prevents the default behavior.\n * @param event The keyboard event\n */\n calculateHeight(event?: KeyboardEvent): void {\n if (event?.key === 'Enter' && !event.shiftKey) {\n event?.preventDefault();\n }\n const maxHeight = 170;\n const el = this.questionInput!.nativeElement;\n el.style.maxHeight = `${maxHeight}px`;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n el.style.overflowY = el.scrollHeight >= maxHeight ? 'scroll' : 'hidden';\n }\n\n /**\n * Send a \"like\" event on clicking on the thumb-up icon of an assistant's message\n * @param message The assistant message to like\n * @param rank The rank of the message to like\n */\n onLike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('thumb-up.click', {rank: idx});\n this.reportType = 'like';\n this.messageToReport = message;\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$liked = true;\n this._updateChatHistory();\n }\n\n /**\n * Send a \"dislike\" event on clicking on the thumb-down icon of an assistant's message.\n * It also opens the issue reporting dialog.\n * @param message The assistant message to dislike\n * @param index The rank of the message to dislike\n */\n onDislike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('thumb-down.click', {rank: idx});\n this.reportType = 'dislike';\n this.messageToReport = message;\n this.issueType = '';\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$disliked = true;\n this._updateChatHistory();\n }\n\n private _updateChatHistory(): void {\n this.messages$.next(this.chatService.chatHistory);\n if (this.chatService.savedChatId) {\n this.chatService.updateSavedChat(this.chatService.savedChatId, undefined, this.chatService.chatHistory).subscribe();\n }\n }\n\n /**\n * Report an issue related to the assistant's message.\n */\n sendReport(): void {\n const details = {\n 'comment': this.reportComment,\n 'text': this.messageToReport!.content,\n 'rank': this.reportRank,\n };\n if (this.reportType === 'dislike') {\n details['report-type'] = this.issueType;\n this.chatService.generateAuditEvent('negative-report.send', details);\n } else {\n this.chatService.generateAuditEvent('positive-report.send', details);\n }\n this.notificationsService.success('Your report has been successfully sent');\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 */\n openAttachmentPreview(data: {reference: ChatContextAttachment, partId?: number}) {\n this.openPreview.emit(data.reference);\n const details = {\n 'doc-id': data.reference.recordId,\n 'title': data.reference.record.title,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n };\n if(!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('attachment.preview.click', details);\n }\n\n /**\n * Handle the click on a reference's 'open original document'.\n * @param data\n */\n openOriginalAttachment(data: {reference: ChatContextAttachment, partId?: number}) {\n this.openDocument.emit(data.reference.record);\n const details = {\n 'doc-id': data.reference.recordId,\n 'title': data.reference.record.title,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n };\n if(!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('attachment.link.click', details);\n }\n\n /**\n * Handle the click on a suggested action.\n * @param action Suggested action.\n * @param index Rank of the message in the chatHistory related to the suggested action.\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n this.chatService.generateAuditEvent('suggestedAction.click', {'text': action.content, 'suggestedAction-type': action.type})\n }\n\n /**\n * It looks for the debug messages available in the current group of \"assistant\" messages.\n * By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n * @param index The rank of the message\n * @returns The debug messages available in the current group of \"assistant\" messages\n */\n getDebugMessages(index: number): DebugMessage[] {\n // If it is not an assistant message, return\n if ((this.messages$.value!)[index].role !== 'assistant') {\n return [];\n }\n // Get the array of messages up to the indicated index\n const array = this.messages$.value!.slice(0, index + 1);\n // If it is an assistant message, look for the debug messages available in the current group of \"assistant\" messages\n // By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n const idx = this.chatService.firstVisibleAssistantMessageIndex(array);\n if (idx > -1) {\n return (this.messages$.value!)[idx].additionalProperties.$debug || [];\n }\n return [];\n }\n\n /**\n * Handle the click on the 'show log info' button of a message.\n * @param index The rank of the message\n */\n showDebug(index: number): void {\n this.debugMessages = this.getDebugMessages(index);\n this.showDebugMessages = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Verify whether the current message is an assistant message and that all following messages are assistant ones\n * Used to keep the \"View progress\" opened even though the assistant is sending additional messages after the current one\n * @param messages the list of current messages\n * @param index the index of the current message\n * @returns if this messages and the following ones (if any) are the last ones\n */\n isAssistantLastMessages(messages: ChatMessage[], index: number): boolean {\n for (let i = index; i < messages.length; i++) {\n if (messages[i].role !== 'assistant') return false;\n }\n return true;\n }\n\n /**\n * Checks if the given message is an empty assistant message.\n * An empty assistant message is defined as a message with the role 'assistant',\n * an empty content, and no additional properties such as attachments, progress,\n * debug information, or suggested actions.\n *\n * @param message - The message to check.\n * @returns `true` if the message is an empty assistant message, `false` otherwise.\n */\n isEmptyAssistantMessage(message: ChatMessage | undefined): boolean {\n if (message?.role === 'assistant'\n && message?.content === \"\"\n && !message?.additionalProperties?.$attachment\n && !message?.additionalProperties?.$progress\n && !message?.additionalProperties?.$debug\n && !message?.additionalProperties?.$suggestedAction) {\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=\"list-group list-group-flush overflow-auto flex-grow-1 pe-2 pb-2\" #messageList>\n <ng-container *ngFor=\"let message of messages; let index = index; let last = last\">\n <!-- Regular messages -->\n <li class=\"list-group-item\"\n *ngIf=\"message.additionalProperties.display && !isEmptyAssistantMessage(message)\"\n [style.--bs-list-group-item-padding-y.rem]=\"'0.6'\"\n [class.opacity-50]=\"messageToEdit && (messageToEdit < (index + 1))\">\n <sq-chat-message\n [class.sq-user-message]=\"message.role === 'user'\"\n [class.last-message]=\"last\"\n [message]=\"message\"\n [conversation]=\"messages\"\n [suggestedActions]=\"last ? message.additionalProperties.$suggestedAction : undefined\"\n [assistantMessageIcon]=\"assistantMessageIcon\"\n [userMessageIcon]=\"userMessageIcon\"\n [connectionErrorMessageIcon]=\"connectionErrorMessageIcon\"\n [searchWarningMessageIcon]=\"searchWarningMessageIcon\"\n [streaming]=\"(chatService.streaming$ | async) && (last || isAssistantLastMessages(messages, index))\"\n [canEdit]=\"(chatService.streaming$ | async) === false && messageToEdit === undefined && message.role === 'user'\"\n [canCopy]=\"((chatService.streaming$ | async) === false || !last) && messageToEdit === undefined && message.role !== 'connection-error' && message.role !== 'search-warning'\"\n [canLike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDislike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDebug]=\"(((chatService.streaming$ | async) === false && last) || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && isAdmin && (getDebugMessages(index).length > 0) && config?.defaultValues.debug\"\n [canRegenerate]=\"(chatService.streaming$ | async) === false && (last || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && messageToEdit === undefined\"\n (edit)=\"editMessage(index)\"\n (copy)=\"copyMessage(index)\"\n (regenerate)=\"regenerateMessage(index)\"\n (openDocument)=\"openOriginalAttachment($event)\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (suggestAction)=\"suggestActionClick($event, index)\"\n (like)=\"onLike(message, index)\"\n (dislike)=\"onDislike(message, index)\"\n (debug)=\"showDebug(index)\">\n </sq-chat-message>\n </li>\n </ng-container>\n <!-- Loading spinner -->\n <li class=\"list-group-item\" *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 pt-3 pb-2\" *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 <div class=\"user-input mt-auto\" *ngIf=\"!showReport\">\n <div class=\"py-2\">\n <div [hidden]=\"!isConnected\">\n <ng-container *ngIf=\"enabledUserInput\" [ngTemplateOutlet]=\"inputTpl\"></ng-container>\n </div>\n <!-- Retry button -->\n <button [hidden]=\"isConnected\" class=\"btn mb-4 ast-error ast-btn sq-retry\" (click)=\"retryFetch()\">\n <span>Try again</span>\n <span *ngIf=\"retrialAttempts\" class=\"ms-2 attempts\">{{ retrialAttempts }}</span>\n </button>\n <div class=\"text-end small text-muted px-3\" *ngIf=\"!!config?.globalSettings?.disclaimer\">\n {{ config?.globalSettings?.disclaimer }}\n </div>\n </div>\n </div>\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()\">\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\">Loading...</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\">\n <i class=\"fas fa-search\"></i>\n </button>\n <textarea #questionInput rows=\"1\"\n type=\"text\" class=\"form-control\"\n placeholder=\"Ask something\" 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 <button\n *ngIf=\"!(chatService.streaming$ | async) && !(loading$ | async) && !(chatService.stoppingGeneration$ | async)\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Send message\"\n (click)=\"submitQuestion()\">\n <i class=\"fas fa-paper-plane\"></i>\n </button>\n <button\n *ngIf=\"messageToEdit\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Cancel edition\"\n (click)=\"messageToEdit = undefined; question = ''\">\n <i class=\"fas fa-undo-alt\"></i>\n </button>\n <span *ngIf=\"(chatService.streaming$ | async) && !(chatService.stoppingGeneration$ | async)\" class=\"processing ms-2\">\n Generating <i class=\"ms-1 fas fa-spinner fa-pulse\"></i>\n </span>\n <span *ngIf=\"(chatService.stoppingGeneration$ | async)\" class=\"processing ms-2\">\n Stopping <i class=\"ms-1 fas fa-spinner fa-pulse\"></i>\n </span>\n <button\n *ngIf=\"(chatService.streaming$ | async) && !(chatService.stoppingGeneration$ | async)\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Stop generating\"\n (click)=\"stopGeneration()\">\n <i class=\"fas fa-stop\"></i>\n </button>\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>Issue type</h5>\n <select class=\"form-select mb-4\" [(ngModel)]=\"issueType\">\n <option [value]=\"''\">Choose an issue type</option>\n <option *ngFor=\"let type of (issueTypes ?? defaultIssueTypes)\">{{type}}</option>\n </select>\n <h5>What was unsatisfying about this response? (optional)</h5>\n </ng-container>\n <ng-container *ngIf=\"type === 'like'\">\n <h5>Why did you like this answer? (optional)</h5>\n </ng-container>\n <textarea class=\"form-control\" [(ngModel)]=\"reportComment\" placeholder=\"Write your comment\"></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()\">Send</button>\n <button class=\"btn btn-light\" (click)=\"ignoreReport()\">Do not send report</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\">\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, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { Validators } from '@angular/forms';\nimport { Subscription, catchError, filter, switchMap, tap, throwError, BehaviorSubject } from \"rxjs\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { ConfirmType, ModalButton, ModalResult, ModalService, PromptOptions, ModalModule } from \"@sinequa/core/modal\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\nimport { UtilsModule } from \"@sinequa/components/utils\";\nimport { format, parseISO, isToday, isYesterday, isThisWeek, isThisMonth, isThisQuarter, isThisYear, endOfYesterday, differenceInDays, differenceInMonths, differenceInYears, toDate } from 'date-fns';\nimport { ChatService } from \"../chat.service\";\nimport { SavedChat } from \"../types\";\nimport { InstanceManagerService } from \"../instance-manager.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 imports: [CommonModule, ModalModule, UtilsModule]\n})\nexport class SavedChatsComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output() load = new EventEmitter<SavedChat>();\n @Output() delete = new EventEmitter<SavedChat>();\n\n chatService: ChatService;\n subscription = new Subscription();\n groupedSavedChats$ = new BehaviorSubject<{ key: string; value: SavedChat[]}[]>([]);\n\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n public modalService = inject(ModalService);\n public notificationsService = inject(NotificationsService);\n\n ngOnInit(): void {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.userOverride$),\n tap(_ => {\n this.onListSavedChat();\n this.chatService.listSavedChat();\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onListSavedChat() {\n this.subscription.add(\n this.chatService.savedChats$.subscribe(\n (savedChats: SavedChat[]) => {\n 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.setSavedChatId(savedChat.id);\n this.chatService.generateChatId(savedChat.id);\n this.chatService.loadSavedChat$.next(savedChat);\n this.chatService.generateAuditEvent('saved-chat.load', {}, savedChat.id);\n this.chatService.listSavedChat();\n this.load.emit(savedChat);\n }\n\n onRename(event: Event, savedChat: SavedChat) {\n event.stopPropagation();\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n const model: PromptOptions = {\n title: 'Rename saved discussion',\n message: `Please enter a new name for the discussion \"${savedChat.title}\".`,\n buttons: [\n new ModalButton({result: ModalResult.Cancel}),\n new ModalButton({result: ModalResult.OK, text: \"Rename\", primary: true})\n ],\n output: savedChat.title,\n validators: [Validators.required]\n };\n\n this.modalService.prompt(model).then(res => {\n if(res === ModalResult.OK) {\n this.subscription.add(\n this.chatService.updateSavedChat(savedChat.id, model.output)\n .pipe(\n tap(() => {\n this.notificationsService.success(`The saved discussion \"${savedChat.title}\" has been successfully renamed to \"${model.output}\".`);\n this.chatService.listSavedChat();\n }),\n catchError((error) => {\n console.error('Error occurred while updating the saved chat:', error);\n this.notificationsService.error(`Error occurred while updating the saved discussion \"${savedChat.title}\"`);\n return throwError(() => error);\n })\n ).subscribe()\n );\n this.chatService.generateAuditEvent('saved-chat.rename', {'text': model.output}, savedChat.id);\n }\n });\n }\n\n onDelete(event: Event, savedChat: SavedChat) {\n event.stopPropagation();\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.modalService\n .confirm({\n title: \"Delete saved discussion\",\n message: `You are about to delete the discussion \"${savedChat.title}\". Do you want to continue?`,\n buttons: [\n new ModalButton({result: ModalResult.Cancel}),\n new ModalButton({result: ModalResult.OK, text: \"Confirm\", primary: true})\n ],\n confirmType: ConfirmType.Warning\n }).then(res => {\n if(res === ModalResult.OK) {\n this.subscription.add(\n this.chatService.deleteSavedChat([savedChat.id])\n .pipe(\n tap(() => {\n this.notificationsService.success(`The saved discussion \"${savedChat.title}\" has been successfully deleted.`);\n this.delete.emit(savedChat);\n this.chatService.listSavedChat();\n }),\n catchError((error) => {\n console.error('Error occurred while deleting the saved chat:', error);\n this.notificationsService.error(`Error occurred while deleting the saved discussion \"${savedChat.title}\"`);\n return throwError(() => error);\n })\n ).subscribe()\n );\n this.chatService.generateAuditEvent('saved-chat.delete', {}, savedChat.id);\n }\n });\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._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 _getTimeKey(date: Date): string {\n if (isToday(date)) {\n return 'Today';\n } else if (isYesterday(date)) {\n return 'Yesterday';\n } else if (isThisWeek(date)) {\n return 'This week';\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return 'Last week';\n } else if (isThisMonth(date)) {\n return 'This month';\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return 'Last month';\n } else if (isThisQuarter(date)) {\n return 'This quarter';\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return 'Last quarter';\n } else if (isThisYear(date)) {\n return 'This year';\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return 'Last year';\n } else {\n return format(date, 'yyyy');\n }\n }\n\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngFor=\"let group of (groupedSavedChats$ | async)\" class=\"saved-chats\">\n <div class=\"saved-chat-date\">{{group.key}}</div>\n <div *ngFor=\"let savedChat of group.value\"\n (click)=\"onLoad(savedChat)\"\n class=\"saved-chat p-2\"\n [class.forbidden]=\"(chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\"\n [class.active]=\"chatService.savedChatId === savedChat.id\">\n <span class=\"title me-1\">{{savedChat.title}}</span>\n <i class=\"saved-chat-actions fas fa-pen mx-1\" [sqTooltip]=\"'Rename'\"\n (click)=\"onRename($event, savedChat)\"></i>\n <i class=\"saved-chat-actions fas fa-trash ms-1\" [sqTooltip]=\"'Delete'\"\n (click)=\"onDelete($event, savedChat)\"></i>\n </div>\n </div>\n</ng-container>\n","export default {\n \"assistant\": {}\n}\n","export default {\n \"assistant\": {}\n}\n","export default {\n \"assistant\": {}\n}\n","import { Utils } from '@sinequa/core/base';\nimport _enAssistant from './en';\nimport _frAssistant from './fr';\nimport _deAssistant from './de';\n\nconst enAssistant = Utils.merge({}, _enAssistant);\nconst frAssistant = Utils.merge({}, _frAssistant);\nconst deAssistant = Utils.merge({}, _deAssistant);\n\nexport { enAssistant, frAssistant, deAssistant };\n","import { Component, Inject, OnDestroy, OnInit } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { UntypedFormControl, UntypedFormBuilder, Validators, UntypedFormGroup } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { MODAL_MODEL, PromptOptions, ModalRef, ModalButton, ModalResult } from \"@sinequa/core/modal\";\nimport { Utils } from '@sinequa/core/base';\nimport { BsModalModule } from \"@sinequa/components/modal\";\nimport { ValidationModule } from \"@sinequa/core/validation\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\nimport { IntlModule } from \"@sinequa/core/intl\";\n\n@Component({\n selector: \"sq-chat-prompt\",\n template: `\n <form name=\"prompt\" novalidate [formGroup]=\"form\">\n <sq-modal [title]=\"title\" [buttons]=\"buttons\">\n <div class=\"mb-3 sq-form-group\">\n <label class=\"form-label\" for=\"input\">{{model.message | sqMessage:model.messageParams}}</label>\n <input [sqValidation]=\"form\" type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"off\" sqAutofocus *ngIf=\"!model.rowCount\">\n <textarea [sqValidation]=\"form\" type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"on\" rows=\"{{model.rowCount}}\" sqAutofocus *ngIf=\"!!model.rowCount\">\n </textarea>\n </div>\n </sq-modal>\n </form>\n `,\n standalone: true,\n imports: [CommonModule, BsModalModule, ValidationModule, ReactiveFormsModule, IntlModule],\n})\nexport class ChatPrompt implements OnInit, OnDestroy {\n inputControl: UntypedFormControl;\n form: UntypedFormGroup;\n formChanges: Subscription;\n defaultButtons: ModalButton[];\n\n constructor(\n @Inject(MODAL_MODEL) public model: PromptOptions,\n protected modalRef: ModalRef,\n protected formBuilder: UntypedFormBuilder) {\n this.defaultButtons = [\n new ModalButton({\n result: ModalResult.OK,\n primary: true,\n validation: this.form\n }),\n new ModalButton({\n result: ModalResult.Cancel\n })\n ];\n }\n\n ngOnInit() {\n this.inputControl = new UntypedFormControl(this.model.output, this.model.validators || Validators.required);\n this.form = this.formBuilder.group({\n input: this.inputControl\n });\n this.formChanges = Utils.subscribe(this.form.valueChanges,\n (value) => {\n this.model.output = this.inputControl.value;\n });\n }\n\n ngOnDestroy() {\n this.formChanges.unsubscribe();\n }\n\n get title(): string {\n return this.model.title ? this.model.title : \"msg#modal.prompt.title\";\n }\n\n get buttons(): ModalButton[] {\n return (this.model.buttons && this.model.buttons.length > 0) ? this.model.buttons : this.defaultButtons;\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2","Prism","i3","i5","i6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGG;MAIU,sBAAsB,CAAA;AAHnC,IAAA,WAAA,GAAA;AAIU,QAAA,IAAA,CAAA,iBAAiB,GAA6B,IAAI,GAAG,EAAE,CAAC;AA8BjE,KAAA;AA5BC;;;;AAIG;IACH,aAAa,CAAC,GAAW,EAAE,OAAoB,EAAA;QAC7C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AACD,oBAAA,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,UAAU,CAAC;AAC5F,iBAAA,CAAA;;0BAQQ,MAAM;2BAAC,WAAW,CAAA;;;ACnC3B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sinequa-assistant-chat.mjs","sources":["../../../projects/assistant/chat/instance-manager.service.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/types.ts","../../../projects/assistant/chat/chat.service.ts","../../../projects/assistant/chat/websocket-chat.service.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.ts","../../../projects/assistant/chat/initials-avatar/initials-avatar.component.html","../../../projects/assistant/chat/format-icon/icons.ts","../../../projects/assistant/chat/format-icon/format-icon.component.ts","../../../projects/assistant/chat/format-icon/format-icon.component.html","../../../projects/assistant/chat/chat-reference/chat-reference.component.ts","../../../projects/assistant/chat/chat-reference/chat-reference.component.html","../../../projects/assistant/chat/charts/chart/chart.component.ts","../../../projects/assistant/chat/charts/chart/chart.component.html","../../../projects/assistant/chat/chat-message/chat-message.component.ts","../../../projects/assistant/chat/chat-message/chat-message.component.html","../../../projects/assistant/chat/rest-chat.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/debug-message/debug-message.component.ts","../../../projects/assistant/chat/debug-message/debug-message.component.html","../../../projects/assistant/chat/chat.component.ts","../../../projects/assistant/chat/chat.component.html","../../../projects/assistant/chat/saved-chats/saved-chats.component.ts","../../../projects/assistant/chat/saved-chats/saved-chats.component.html","../../../projects/assistant/chat/messages/en.ts","../../../projects/assistant/chat/messages/fr.ts","../../../projects/assistant/chat/messages/de.ts","../../../projects/assistant/chat/messages/index.ts","../../../projects/assistant/chat/prompt.component.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 { Component, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { ChatService } from \"../chat.service\";\nimport { ChatConfig, GllmModelDescription } from \"../types\";\nimport { Subscription, filter, switchMap, tap } from \"rxjs\";\nimport { InstanceManagerService } from \"../instance-manager.service\";\nimport { PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { Utils } from \"@sinequa/core/base\";\nimport { AppService } from \"@sinequa/core/app-utils\";\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]\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\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n public principalService = inject(PrincipalWebService);\n public appService = inject(AppService);\n\n ngOnInit(): void {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig)\n ).subscribe(_ => {\n this.isAdmin = this.principalService.principal!.isAdministrator;\n // Init config with a copy of the original chat config, so that it won't be modified by the user until he clicks on save\n this.config = JSON.parse(JSON.stringify(this.chatService.assistantConfig$.value));\n this.selectedModel = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.initFunctionsList();\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n get hasPrompts(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.displaySystemPrompt\n || !!this.config.uiSettings.displayUserPrompt;\n }\n\n get hasAdvancedParameters(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n get hasModel(): boolean {\n return this.isAdmin\n || !!this.config.uiSettings.servicesModels\n || !!this.config.uiSettings.functions\n || !!this.config.uiSettings.debug\n || !!this.config.uiSettings.temperature\n || !!this.config.uiSettings.top_p\n || !!this.config.uiSettings.max_tokens;\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onChatModelChange(selectedModel: GllmModelDescription) {\n // Update properties based on the selected model\n this.config.defaultValues.service_id = selectedModel.serviceId;\n this.config.defaultValues.model_id = selectedModel.modelId;\n }\n\n getFunctionDescription(name: string): string {\n return this.chatService.functions?.find(fn => fn.functionName === name)?.description || \"\";\n }\n\n toggleFunctionsSelection(name: string) {\n // Update the enabled property of the function\n const index = this.config.defaultValues.functions.findIndex(func => func.name === name);\n this.config.defaultValues.functions[index].enabled = this.functions[index].enabled;\n }\n\n private initFunctionsList(): void {\n this.functions = this.config.defaultValues.functions.filter(func => !!this.chatService.functions?.find(fn => fn.functionName === func.name));\n }\n\n /**\n * Save the new chat config in the chat service and the user preferences\n * If the user has never modified the default values, we need to save the hash of the standard default values, as defined by the admin, in order to properly track changes afterwards.\n */\n 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 = this.appService.app?.data?.assistants?.[this.instanceId];\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": Utils.sha512(JSON.stringify(standardChatConfig.defaultValues)) };\n this.chatService.updateChatConfig(this.config, hashes);\n } else {\n this.chatService.updateChatConfig(this.config);\n }\n this.chatService.generateAuditEvent(\"configuration.edit\", { '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 card-body small\" *ngIf=\"config\">\n\n <h5 *ngIf=\"hasModel\">Model</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.servicesModels\">\n <label for=\"gllmModel\" class=\"form-label\">Model</label>\n <select class=\"form-select\" id=\"gllmModel\" [(ngModel)]=\"selectedModel\" (ngModelChange)=\"onChatModelChange($event)\">\n <option *ngFor=\"let model of chatService.models\" [ngValue]=\"model\">{{model.displayName}}</option>\n </select>\n </div>\n\n <div class=\"mb-4\" *ngIf=\"isAdmin || config.uiSettings.functions\">\n <label for=\"gllmFunctions\" class=\"form-label\">Functions</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-check-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=\"isAdmin || config.uiSettings.debug\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" id=\"debug\" [(ngModel)]=\"config.defaultValues.debug\">\n <label class=\"form-check-label\" for=\"debug\">Debug</label>\n </div>\n\n <details *ngIf=\"hasAdvancedParameters\">\n <summary>Advanced parameters</summary>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.temperature\">\n <label for=\"temperature\" class=\"form-label\">Temperature: {{config.defaultValues.temperature}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"2\" step=\"0.1\" id=\"temperature\"\n [(ngModel)]=\"config.defaultValues.temperature\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.top_p\">\n <label for=\"top-p\" class=\"form-label\">Top P: {{config.defaultValues.top_p}}</label>\n <input type=\"range\" class=\"form-range form-range-sm\" min=\"0\" max=\"1\" step=\"0.05\" id=\"top-p\"\n [(ngModel)]=\"config.defaultValues.top_p\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.max_tokens\">\n <label for=\"max-tokens\" class=\"form-label\">Max generated tokens per answer:\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\">Prompts</h5>\n <div class=\"mb-2\" *ngIf=\"isAdmin || config.uiSettings.displaySystemPrompt\">\n <label for=\"initialSystemPrompt\" class=\"form-label\">System prompt (hidden)</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\">Initial user prompt</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()\">Cancel</button>\n <button class=\"btn btn-primary\" *ngIf=\"config\" (click)=\"save()\">Save</button>\n </div>\n\n</div>\n","import { z } from 'zod';\nimport { Record } from \"@sinequa/core/web-services\";\nimport { Query } from '@sinequa/core/app-utils';\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: string;\n messageType?: 'CHART' | 'MARKDOWN'\n additionalProperties: {\n [key: string]: any\n };\n}\n\n/**\n * A chat message that has been processed to include the markdown-formatted\n * content for display, as well as detailed attachment data, and optionally\n * a list of the references extracted from that message\n */\nexport interface ChatMessage extends RawMessage {\n additionalProperties: {\n display?: boolean;\n $progress?: ChatProgress[];\n $attachment?: ChatContextAttachment[];\n $suggestedAction?: SuggestedAction[];\n $debug?: DebugMessage[];\n forcedWorkflow?: string;\n forcedWorkflowProperties?: any;\n query?: Query;\n isUserInput?: boolean;\n usageMetrics?: ChatUsageMetrics;\n additionalWorkflowProperties?: any;\n $liked?: boolean;\n $disliked?: boolean;\n [key: string]: any;\n };\n}\n\nexport interface ChatProgress {\n title: string;\n content?: string;\n done?: boolean;\n time?: number;\n}\n\nexport interface RawAttachment {\n /** Type of the attachment */\n type: string;\n /** Record id from which this attachment is taken */\n recordId: string;\n /** Record from which this this attachment is taken */\n record: Record;\n}\n\nexport interface DocumentPart {\n partId: number;\n offset: number;\n length: number;\n text: string;\n}\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 /** The specific id used of the referenced part */\n $partId?: number;\n}\n\n/**\n * Raw response of the chat API\n */\nexport interface RawResponse {\n history: RawMessage[];\n executionTime: string | undefined;\n}\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.object({\n connectionErrorMessage: z.string(),\n restEndpoint: z.string().optional(),\n websocketEndpoint: z.string().optional(),\n signalRTransport: z.enum([\"WebSockets\", \"ServerSentEvents\", \"LongPolling\", \"None\"]),\n signalRLogLevel: z.enum([\"Critical\", \"Debug\", \"Error\", \"Information\", \"None\", \"Trace\", \"Warning\"]),\n signalRServerTimeoutInMilliseconds: z.number().optional()\n}).refine(data => (!!data.restEndpoint || !!data.websocketEndpoint), {\n message: \"Based on the provided input() protocol ('REST' or 'WEBSOCKET') to the Chat Component, either 'restEndpoint' or 'websocketEndpoint' property should be provided in the 'globalSettings' of the assistant instance.\",\n});\n// Define the ConnectionSettings interface\nexport type ConnectionSettings = z.infer<typeof connectionSettingsSchema>;\n\n// Define the Zod representation for the serviceSettings object\nconst serviceSettingsSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number()\n});\n// Define the ServiceSettings interface\nexport interface ServiceSettings 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 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 extends z.infer<typeof additionalWorkflowPropertiesSchema> {}\n\n// Define the Zod representation for the uiSettings object\nconst uiSettingsSchema = z.object({\n display: z.boolean(),\n servicesModels: z.boolean(),\n functions: z.boolean(),\n temperature: z.boolean(),\n top_p: z.boolean(),\n max_tokens: z.boolean(),\n debug: z.boolean(),\n displaySystemPrompt: z.boolean(),\n displayUserPrompt: z.boolean()\n});\n// Define the UiSettings interface\nexport interface UiSettings extends z.infer<typeof uiSettingsSchema> {}\n\n// Define the Zod representation for the defaultValues object\nconst defaultValuesSchema = z.object({\n service_id: z.string(),\n model_id: z.string(),\n functions: z.array(\n z.object({\n name: z.string(),\n enabled: z.boolean()\n })\n ),\n temperature: z.number(),\n top_p: z.number(),\n max_tokens: z.number(),\n debug: z.boolean(),\n systemPrompt: z.string(),\n userPrompt: z.string()\n});\n// Define the DefaultValues interface\nexport interface DefaultValues extends z.infer<typeof defaultValuesSchema> {}\n\n// Define the Zod representation for the action object\nconst actionSchema = z.object({\n forcedWorkflow: z.string(), // forcedWorkflow must be a string\n forcedWorkflowProperties: z.record(z.unknown()).optional() // forcedWorkflowProperties must be an object (Map equivalent)\n});\n\n// Define the Zod representation for the modeSettings object\nconst initializationSchema = z.object({\n event: z.enum(['Query', 'Prompt']),\n forcedWorkflow: z.string().optional(), // Optional for event 'Prompt'\n displayUserQuery: z.boolean().optional() // Optional for event 'Prompt'\n}).refine(data => ((data.event === \"Query\") ? (!!data.forcedWorkflow && data.displayUserQuery !== undefined && data.displayUserQuery !== null) : true), {\n message: \"The 'forcedWorkflow' and 'displayUserQuery' properties must be provided when the initialization's event is 'Query'.\",\n})\nconst modeSettingsSchema = z.object({\n enabledUserInput: z.boolean(),\n displayUserPrompt: z.boolean(),\n sendUserPrompt: z.boolean(),\n initialization: initializationSchema,\n actions: z.record(actionSchema).optional()\n});\n// Define the ModeSettings interface\nexport interface ModeSettings extends z.infer<typeof modeSettingsSchema> {}\n\n// Define the Zod representation for the savedChatSettings object\nconst savedChatSettingsSchema = z.object({\n enabled: z.boolean(),\n display: z.boolean()\n})\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings extends z.infer<typeof savedChatSettingsSchema> {}\n\n// Define the Zod representation for the globalSettings object\nconst globalSettingsSchema = z.object({\n searchWarningMessage: z.string(),\n disclaimer: z.string().optional(),\n genericChatErrorMessage: z.string().optional(),\n displayUserQuotaConsumption: z.boolean().optional(),\n displayChatTokensConsumption: z.boolean().optional()\n})\n\n// Define the Zod representation for the auditSettings object\nconst auditSettingsSchema = z.object({\n issueTypes: z.array(z.string()).optional()\n});\n// Define the SavedChatSettings interface\nexport interface SavedChatSettings 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.optional(),\n additionalServiceSettings: additionalServiceSettingsSchema,\n additionalWorkflowProperties: additionalWorkflowPropertiesSchema\n});\n// Define the ChatConfig interface\nexport interface ChatConfig extends z.infer<typeof chatConfigSchema> {}\n\nexport interface ChatPayload {\n debug: boolean;\n functions: string[];\n history: ChatMessage[];\n serviceSettings: ServiceSettings;\n appQuery: {\n app: string;\n query: Query | undefined;\n targetUrl?: string;\n accessToken?: string;\n };\n instanceId?: string;\n savedChatId?: string;\n genericChatErrorMessage?: string;\n}\n\nexport type ActionMessage = {\n guid: string;\n displayName?: string\n displayValue?: string;\n executionTime?: number;\n}\n\nexport interface TextChunksOptions {\n extendMode?: 'None' | 'Sentence' | 'Chars';\n extendScope?: number;\n}\n\nexport interface Quota {\n lastRequest: string;\n promptTokenCount: number;\n completionTokenCount: number;\n periodTokens: number;\n resetHours: number;\n tokenCount: number;\n nextReset: string;\n lastResetUTC: string;\n nextResetUTC: string;\n maxQuotaReached: boolean;\n}\n\nexport interface SuggestedAction {\n content: string;\n type: string;\n}\n\nexport interface InitChat {\n messages: RawMessage[];\n}\n\n/**\n * List of events data that can be emitted by the websocket chat endpoint\n */\nexport type SuggestedActionsEvent = { suggestedActions: SuggestedAction[] };\nexport type QuotaEvent = { quota: Quota };\nexport type MessageEvent = string;\nexport type ContextMessageEvent = { content: string; metadata: 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 };\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}\n\nexport interface TokenConsumption {\n percentage: number;\n}\n\nexport interface UserTokenConsumption extends TokenConsumption {\n nextResetDate: string;\n}\n\nexport interface ChatUsageMetrics {\n totalTokenCount: number;\n promptTokenCount: number;\n completionTokenCount: number;\n tokenizerType: string\n}\n\nexport interface KvObject {\n data: {\n key: string;\n value: any; // string | number | boolean | null | undefined | { [key: string]: any };\n };\n type: 'KV';\n isError: boolean;\n}\n\nexport interface ListObject {\n name: string;\n type: 'LIST';\n isError: boolean;\n items: (KvObject | ListObject)[];\n expanded: boolean;\n}\n\nexport type DebugMessage = KvObject | ListObject;\n\n\nexport type MessageHandler<T> = {\n handler: (data: T) => void;\n isGlobalHandler: boolean;\n};\n","import { Injectable, inject } from \"@angular/core\";\nimport { UserPreferences } from \"@sinequa/components/user-settings\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\nimport { AuditWebService, UserSettingsWebService, PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\nimport { ChatConfig, ChatMessage, ChatResponse, ChatUsageMetrics, GllmFunction, GllmModelDescription, Quota, SavedChat, SavedChatHistory, TokenConsumption, UserTokenConsumption, chatConfigSchema } from \"./types\";\nimport { AppService, Query } from \"@sinequa/core/app-utils\";\nimport { IntlService } from \"@sinequa/core/intl\";\nimport get from \"lodash/get\";\nimport { Utils } from \"@sinequa/core/base\";\nimport { ConfirmType, ModalButton, ModalResult, ModalService } from \"@sinequa/core/modal\";\nimport { parseISO, toDate } from \"date-fns\";\n\n@Injectable()\nexport abstract class ChatService {\n /** Name of the assistant plugin OR websocket endpoint. */\n REQUEST_URL: string;\n /** Emit true once the initialization of the assistant process is done. */\n initProcess$ = new BehaviorSubject<boolean>(false);\n /** Emit true once the initialization of the assistant config is done. */\n initConfig$ = new BehaviorSubject<boolean>(false);\n /** Emit the global configuration of the assistant. */\n assistantConfig$ = new BehaviorSubject<ChatConfig | undefined>(undefined);\n /** Emit true if the user has been overridden, false otherwise. */\n userOverride$ = new BehaviorSubject<boolean | undefined>(undefined);\n /**\n * Emit true if the fetch of an assistant's response is ongoing (it includes Streaming status of the assistant endpoint AND saving the discussion if save Chat is enabled).\n * This is used to prevent multiple fetches at the same time.\n * Typically, there is no problem chaining fetches, but when forcing a reload after query changes cases, it can't be allowed because it breaks the whole business logic.\n */\n streaming$ = new BehaviorSubject<boolean>(false);\n /** Store the messages history of the current chat. */\n chatHistory: ChatMessage[] | undefined;\n /** List of models available on the server. */\n models: GllmModelDescription[] | undefined;\n /** List of functions available on the server. */\n functions: GllmFunction[] | undefined;\n /** List of saved chats. */\n savedChats$ = new BehaviorSubject<SavedChat[]>([]);\n /** Emit the saved chat to load. */\n loadSavedChat$ = new BehaviorSubject<SavedChat | undefined>(undefined);\n /** Emit the quota each time the chat is invoked. */\n quota$ = new BehaviorSubject<Quota | undefined>(undefined);\n /** Emit the calculated user's token consumption based on the quota. */\n userTokenConsumption$ = new BehaviorSubject<UserTokenConsumption | undefined>(undefined);\n /** Emit the chat usage metrics each time the generation of the assistant response is completed. */\n chatUsageMetrics$ = new BehaviorSubject<ChatUsageMetrics | undefined>(undefined);\n /** Emit the calculated chat's token consumption based on the chat usage metrics. */\n chatTokenConsumption$ = new BehaviorSubject<TokenConsumption | undefined>(undefined);\n /** Emit true if \"CancelTasks\" is ongoing. */\n stoppingGeneration$ = new BehaviorSubject<boolean>(false);\n /** Instance ID of the chat service defining the assistant instance. */\n private _chatInstanceId: string;\n /** ID of the current **saved chat** discussion which is used to update/get/delete it. */\n private _savedChatId: string | undefined;\n /** Generated GUID for the current non-saved chat discussion used to identify audit events.\n * If the chat is saved, the savedChatId is initialized with the value of this chatId.\n */\n private _chatId: string;\n\n public userSettingsService = inject(UserSettingsWebService);\n public notificationsService = inject(NotificationsService);\n public auditService = inject(AuditWebService);\n public prefs = inject(UserPreferences);\n public loginService = inject(LoginService);\n public appService = inject(AppService);\n public intlService = inject(IntlService);\n public modalService = inject(ModalService);\n public principalService = inject(PrincipalWebService);\n /**\n * Initialize the chat process\n */\n abstract init(): Observable<boolean>;\n\n /**\n * Initialize the REQUEST_URL\n */\n abstract getRequestsUrl(): void;\n\n get assistants(): any {\n if (!this.userSettingsService.userSettings)\n this.userSettingsService.userSettings = {};\n if (!this.userSettingsService.userSettings[\"assistants\"])\n this.userSettingsService.userSettings[\"assistants\"] = {};\n return this.userSettingsService.userSettings[\"assistants\"];\n }\n\n /**\n * Get the instance ID of the chat service\n * @returns The instance ID of the chat service\n */\n get chatInstanceId(): string {\n return this._chatInstanceId;\n }\n\n /**\n * Persist the instance ID of the chat service\n * @param instanceId The instance ID of the chat service\n */\n setChatInstanceId(instanceId: string) {\n this._chatInstanceId = instanceId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to save/get/delete it\n * @returns The ID of the current chat discussion\n */\n get savedChatId(): string | undefined {\n return this._savedChatId;\n }\n\n /**\n * Persist the ID of the current chat discussion which is used to save/get/delete it\n * @param savedChatId The ID of the current chat discussion which is used to save/get/delete it\n */\n setSavedChatId(savedChatId: string | undefined) {\n this._savedChatId = savedChatId;\n }\n\n /**\n * Get the ID of the current chat discussion which is used to identify audit events\n * @returns The ID of the current chat discussion\n */\n get chatId(): string {\n return this._chatId;\n }\n\n /**\n * Generate an GUID for the current chat discussion which is used to identify audit events\n * If the discussion is saved, the savedChatId is initialized with the value of this chatId\n * @param chatId if provided, it will be considered as the ID of the current chat discussion which is used to identify audit events\n */\n generateChatId(chatId?: string) {\n this._chatId = chatId || Utils.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 initChatConfig() {\n const key = this.chatInstanceId;\n const userSettingsConfig = this.assistants[key] || {};\n const standardChatConfig = this.appService.app?.data?.assistants?.[key];\n\n try {\n // Validate the whole config object against the schema\n chatConfigSchema.parse(standardChatConfig);\n // If the user preferences do not contain a config's defaultValues object, keep using the standard app config and nothing to store in the user preferences\n if (!userSettingsConfig.defaultValues) {\n this.assistantConfig$.next({...standardChatConfig});\n this.initConfig$.next(true);\n } else { // If the user has its own defaultValues in its userSettings, then we need to check for potential updates made by admins in the meantime and how he wants to manage them\n\n // Retrieve already stored hashes in the user settings if exists\n const appliedDefaultValuesHash = userSettingsConfig.hashes?.[\"applied-defaultValues-hash\"];\n const skippedDefaultValuesHash = userSettingsConfig.hashes?.[\"skipped-defaultValues-hash\"];\n // Create a hash of the current defaultValues of the standardChatConfig\n const currentDefaultValuesHash = Utils.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\n .confirm({\n title: \"Available updates !\",\n message: \"Changes have been made to the default configuration. Do you want to update your own version ?\",\n buttons: [\n new ModalButton({result: ModalResult.No, text: \"See no more\"}),\n new ModalButton({result: ModalResult.Ignore, text: \"Remind me later\"}),\n new ModalButton({result: ModalResult.OK, text: \"Update\", primary: true})\n ],\n confirmType: ConfirmType.Warning\n }).then(res => {\n if(res === ModalResult.OK) {\n const hashes = { ...userSettingsConfig.hashes, \"applied-defaultValues-hash\": currentDefaultValuesHash, \"skipped-defaultValues-hash\": undefined };\n // Update the chat config and store its defaultValues in the user preferences\n this.updateChatConfig({...standardChatConfig}, hashes, true);\n this.initConfig$.next(true);\n this.generateAuditEvent(\"configuration.edit\", { 'configuration': JSON.stringify({...standardChatConfig}) });\n } else if(res === ModalResult.No) {\n // Do not notify the user about changes while this skipped version is not updated\n const hashes = { ...userSettingsConfig.hashes, \"skipped-defaultValues-hash\": currentDefaultValuesHash };\n this.updateChatConfig({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues}, hashes, false);\n this.initConfig$.next(true);\n } else {\n // Just pick the version in the user settings, nothing to be updated\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n });\n } else { // No available updates Or updates has been already skipped, then just pick the version in the user settings\n this.assistantConfig$.next({...standardChatConfig, defaultValues: userSettingsConfig.defaultValues});\n this.initConfig$.next(true);\n }\n }\n } catch (error) {\n this.notificationsService.error(`Missing valid configuration for the assistant instance '${key}'. See the browser console messages for details on the missing or incorrect properties.`);\n throw new Error(`Missing valid configuration for the assistant instance '${key}' . \\n ${JSON.stringify(error.issues, null, 2)}`);\n }\n }\n\n /**\n * Update the chat config and store its defaultValues in the user preferences\n * @param config The updated chat config\n * @param hashes The updated hashes to store in the user preferences\n * @param notify Whether to notify the user about the update\n * @param successCallback The callback to execute if the update is successful\n * @param errorCallback The callback to execute if the update fails\n */\n updateChatConfig(config: ChatConfig, hashes?: {\"applied-defaultValues-hash\"?: string, \"skipped-defaultValues-hash\"?: string}, notify = true, successCallback?: () => any, errorCallback?: () => any) {\n this.assistantConfig$.next(config);\n const assistants = Object.assign({}, this.assistants);\n assistants[this.chatInstanceId] = { ...assistants[this.chatInstanceId], defaultValues: config.defaultValues };\n if(hashes) assistants[this.chatInstanceId].hashes = hashes;\n this.userSettingsService.patch({ assistants }).subscribe(\n next => {},\n error => {\n if(notify) {\n errorCallback ? errorCallback() : this.notificationsService.error(`The update of the assistant instance '${this.chatInstanceId}' configuration failed`);\n }\n console.error(\"Could not patch assistants!\", error);\n },\n () => {\n if(notify) {\n successCallback ? successCallback() : this.notificationsService.success(`The assistant instance '${this.chatInstanceId}' configuration has been successfully updated`);\n }\n }\n );\n }\n\n /**\n * Overrides the logged in user\n */\n abstract overrideUser(): void;\n\n /**\n * Calls the Fetch API to retrieve a new message given all previous messages\n */\n abstract fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse>\n\n /**\n * Return the list of models available on the server\n */\n abstract listModels(): Observable<GllmModelDescription[] | undefined>;\n\n /**\n * Return the list of functions available on the server AND matching enabled functions in the chat config\n */\n abstract listFunctions(): Observable<GllmFunction[] | undefined>;\n\n /**\n * Stops the assistant answer generation and cancels all the ongoing and pending related tasks\n */\n abstract stopGeneration(): Observable<any>\n\n /**\n * A handler for quota updates each time the chat is invoked.\n * It emits the updated quota to the quota$ subject, emits accordingly the updated user's tokens consumption and notifies the user if the max quota is reached.\n * @param quota The updated quota\n * @param propagateError Whether to propagate the error to the caller\n */\n updateQuota(quota: Quota, propagateError = false) {\n this.quota$.next(quota);\n const nextResetDate = this.formatDateTime(quota.nextResetUTC+\"+00:00\"); // This +00:00 is to ensure dates will be properly converted to local time\n const consumptionPercentage = Math.round((quota.tokenCount * 100 / quota.periodTokens) * 100) / 100;\n this.userTokenConsumption$.next({percentage: consumptionPercentage, nextResetDate});\n if(quota.maxQuotaReached) {\n this.generateAuditEvent('quota.exceeded', {});\n const msg = `Sorry, you have exceeded the allowed quota. Please retry starting from ${nextResetDate}.`;\n this.notificationsService.error(msg);\n if(propagateError) throw new Error(msg);\n }\n }\n\n /**\n * A handler for chat usage metrics each time the generation of the assistant response is completed.\n * It emits the chat usage metrics to the chatUsageMetrics$ subject, emits accordingly the updated chat's tokens consumption\n * @param chatUsageMetrics The chat usage metrics\n */\n updateChatUsageMetrics(chatUsageMetrics: ChatUsageMetrics) {\n this.chatUsageMetrics$.next(chatUsageMetrics);\n const currentModel = this.getModel(this.assistantConfig$.value!.defaultValues.service_id, this.assistantConfig$.value!.defaultValues.model_id);\n const consumptionPercentage = Math.round((chatUsageMetrics.totalTokenCount * 100 / (currentModel!.contextWindowSize - currentModel!.maxGenerationSize)) * 100) / 100;\n this.chatTokenConsumption$.next({percentage: consumptionPercentage});\n }\n\n /**\n * Get the model description for the given (serviceId + modelId)\n * If a model is not found, an error message is returned\n * @param serviceId The serviceId of the model\n * @param modelId The modelId of the model\n * @returns The model description\n */\n getModel(serviceId: string, modelId: string): GllmModelDescription | undefined{\n let model = this.models?.find(m => m.serviceId === serviceId && m.modelId === modelId);\n // Handle obsolete config\n if(!model) {\n this.notificationsService.error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available. Please contact an admin for further information.`);\n throw new Error(`FATAL ERROR : The model (serviceId = '${serviceId}', modelId = '${modelId}') is no longer available`);\n }\n return model;\n }\n\n /**\n * Fetch the list saved chats belonging to a specific instance of the assistant\n */\n abstract listSavedChat(): void;\n\n /**\n * Return the saved chat with the given id, if exists. Otherwise, return undefined\n * @param id The id of the saved chat\n */\n abstract getSavedChat(id: string): Observable<SavedChatHistory | undefined>;\n\n /**\n * Save a chat with the given messages\n * @param messages The messages to add to the saved chat index\n * @returns The saved chat\n */\n abstract addSavedChat(messages: ChatMessage[]): Observable<SavedChat>;\n\n /**\n * Update a saved chat with the given id.\n * @param id The id of the saved chat\n * @param name The new name of the saved chat, if provided\n * @param messages The messages to update the saved chat history, if provided\n * @returns True if the saved chat has been successfully updated\n */\n abstract updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat>;\n\n /**\n * Bulk delete of saved chats matching the given ids\n * @param ids List of ids of the saved chats to delete\n * @returns The number of deleted chats\n */\n abstract deleteSavedChat(ids: string[]): Observable<number>;\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 generateAuditEvent(type: string, details: Record<string, any>, id?: string): void {\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 const audit = {\n type,\n detail: {\n ...baseDetails,\n ...details\n }\n }\n this.auditService.notify(audit);\n }\n\n\n\n /**\n * Traverse the array from the end and track the first 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the first visible assistant message among the last group of \"assistant\" messages in the array\n */\n firstVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let firstVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n firstVisibleAssistantMessageIndex = index;\n }\n index--;\n }\n return firstVisibleAssistantMessageIndex;\n }\n\n /**\n * Traverse the array from the end and pick the last 'assistant' message among the last group of \"assistant\" messages where display is true\n * @param array The array of ChatMessage to traverse\n * @returns The index of the last visible assistant message among the last group of \"assistant\" messages in the array\n */\n lastVisibleAssistantMessageIndex(array: ChatMessage[]| undefined): number {\n if (!array) {\n return -1;\n }\n let index = array.length - 1;\n let lastVisibleAssistantMessageIndex = -1;\n while (index >= 0 && array[index].role === 'assistant') {\n if (array[index].additionalProperties.display === true) {\n lastVisibleAssistantMessageIndex = index;\n break;\n }\n index--;\n }\n return lastVisibleAssistantMessageIndex;\n }\n\n /**\n * Format a date string in UTC to a local date string\n * @param value Date string in UTC to format\n * @returns A formatted local date string\n */\n protected formatDateTime(value: string): string {\n const localDate = toDate(parseISO(value));\n return this.intlService[\"formatTime\"](localDate, {day: \"numeric\", month: \"short\", year: \"numeric\", timeZoneName: 'short'});\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 static formatPrompt(prompt: string, context: any) {\n return prompt.replace(\n /{{(.*?)}}/g,\n (match, expr) => get(context, expr) ?? match\n );\n }\n\n}\n","import { Injectable, inject } from \"@angular/core\";\nimport { AuthenticationService } from \"@sinequa/core/login\";\nimport { ConnectionOptions, SignalRWebService } from \"@sinequa/core/web-services\";\nimport { Query } from \"@sinequa/core/app-utils\";\nimport { HttpTransportType, HubConnection, LogLevel, MessageHeaders } from \"@microsoft/signalr\";\nimport { ActionMessage, ActionResultEvent, ActionStartEvent, ActionStopEvent, MessageEvent, ChatMessage, ChatPayload, ChatResponse, GllmFunction, GllmModelDescription, MessageHandler, HistoryEvent, ErrorEvent, QuotaEvent, ChatContextAttachment, ContextMessageEvent, SavedChatHistory, SavedChat, ChatProgress, SuggestedActionsEvent, DebugMessageEvent, DebugMessage } from \"./types\";\nimport { ChatService } from \"./chat.service\";\nimport { merge, fromEvent, Observable, Subject, catchError, defer, from, forkJoin, map, switchMap, tap, throwError, takeUntil, take, mergeMap, of } from \"rxjs\";\n\n@Injectable()\nexport class WebSocketChatService extends ChatService {\n\n public connection: HubConnection | undefined;\n\n private _messageHandlers: Map<string, MessageHandler<any>> = new Map();\n private _response: ChatMessage[];\n private _actionMap = new Map<string, ActionMessage>();\n private _progress: ChatProgress[] | undefined = undefined;\n private _executionTime: string;\n private _attachments: ChatContextAttachment[] = [];\n private _debugMessages: DebugMessage[] = [];\n\n public signalRService = inject(SignalRWebService);\n public authenticationService = inject(AuthenticationService);\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the assistant process.\n * It includes building and starting a connection, executing parallel requests for models and functions, and handling errors during the process.\n * ⚠️ This method MUST be called ONLY if the user is loggedIn and once when the assistant is initialized.\n *\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n // Ensure all logic is executed when subscribed to the observable\n return defer(() => {\n this.getRequestsUrl();\n\n return from(\n // Build the connection\n this.buildConnection()\n ).pipe(\n tap(() => this.initMessageHandlers()),\n // Start the connection\n switchMap(() => this.startConnection()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n take(1)\n );\n });\n }\n\n /**\n * Define the assistant endpoint to use for the websocket requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.websocketEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.websocketEndpoint;\n } else {\n throw new Error(`The property 'websocketEndpoint' must be provided when attempting to use 'WebSocket' in assistant instance`);\n }\n }\n\n overrideUser(): void {\n if (!(this.authenticationService.userOverrideActive && this.authenticationService.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: this.authenticationService.userOverride.userName,\n domain: this.authenticationService.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 listModels(): Observable<GllmModelDescription[] | undefined> {\n const modelsSubject$ = new Subject<GllmModelDescription[] | undefined>();\n\n this.connection!.on('ListModels', (res) => {\n this.models = (res.models as GllmModelDescription[] | undefined)?.filter(model => !!model.enable);\n modelsSubject$.next(this.models);\n modelsSubject$.complete()\n });\n\n // Send the request to get the list of models\n this.connection!.invoke('ListModels', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListModels:', error);\n modelsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return modelsSubject$.asObservable();\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const functionsSubject$ = new Subject<GllmFunction[] | undefined>();\n\n this.connection!.on('ListFunctions', (res) => {\n this.functions = (res.functions as GllmFunction[] | undefined)?.filter(func => func.enabled);\n functionsSubject$.next(this.functions);\n functionsSubject$.complete()\n });\n\n // Send the request to get the list of functions\n this.connection!.invoke('ListFunctions', { debug: this.assistantConfig$.value!.defaultValues.debug })\n .catch(error => {\n console.error('Error invoking ListFunctions:', error);\n functionsSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return functionsSubject$.asObservable();\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload = {\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n // Initialize the response with an empty assistant message\n this._response = [{role: \"assistant\", content: \"\", additionalProperties: {display: true}}] // here display: true is needed in order to be able to show the progress\n\n // Create a Subject to signal completion\n const completion$ = new Subject<void>();\n\n // Create observables for each non-global handler in the _messageHandlers map (default and eventual custom ones) once it is triggered by the hub connection\n const observables = Array\n .from(this._messageHandlers.entries())\n .filter(([eventName, eventHandler]) => !eventHandler.isGlobalHandler)\n .map(([eventName, eventHandler]) => {\n return fromEvent<any>(this.connection!, eventName).pipe(\n mergeMap((event) => {\n // Wrap the handler in a try-catch block to prevent the entire stream from failing if an error occurs in a single handler\n try {\n // Execute the handler and emit the result\n // NB: here we could use [eventHandler.handler(event)] which behind the scenes mergeMap interprets this array as an observable sequence with one item, which it then emits\n return of(eventHandler.handler(event));\n } catch (error) {\n console.error(`Error in event handler for ${eventName}:`, error);\n // Use throwError to propagate the error downstream\n return throwError(() => new Error(`Error in event handler for ${eventName}: ${error}`));\n }\n })\n );\n });\n\n // Then merge them into a single observable in order to simulate the streaming behavior\n const combined$ = merge(...observables).pipe(\n map(() => {\n // Define $progress from the _actionMap\n const actions = Array.from(this._actionMap.values());\n this._progress = actions.length > 0\n ? actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n : undefined;\n\n // Always update ONLY the first assistant message of the _response with the new $progress, $attachment and $debug\n // Assuming that the first assistant message is always visible since the hub does not send hidden messages by design\n // So even if the first assistant message is hidden (display: false), the _response[0] will and should contain :\n // - $progress, $attachment and $debug\n // - the content of the first visible assistant message in the workflow\n // This is mandatory in order to match the behavior of consecutive messages and maintain consistency with the chatHistory\n if(!!this._progress || this._attachments.length > 0 || this._debugMessages.length > 0) {\n this._response[0].additionalProperties.$progress = this._progress;\n this._response[0].additionalProperties.$attachment = this._attachments;\n this._response[0].additionalProperties.$debug = this._debugMessages;\n }\n\n // Return the result\n return { history: [...messages, ...this._response], executionTime: this._executionTime };\n }),\n takeUntil(completion$), // Complete the observable when completion$ emits\n );\n\n // return a new Observable that emits the result of the combined stream and handles the eventual errors of the invocation of the Chat method\n return new Observable(observer => {\n // Subscribe to combined stream\n combined$.subscribe({\n next: (value) => observer.next(value),\n error: (err) => observer.error(err)\n });\n\n // Invoke the Chat method and handle errors\n this.connection!.invoke('Chat', data)\n .then(() => {\n // If a valid assistant message with (display: true) was found, update it\n // and it should always the case\n const index = this.firstVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$progress = this._progress;\n this.chatHistory![index].additionalProperties.$attachment = this._attachments;\n this.chatHistory![index].additionalProperties.$debug = this._debugMessages;\n }\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory!.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory!).pipe(tap(() => this.listSavedChat())) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe({\n next: () => {},\n error: (error) => {\n this.streaming$.next(false);\n observer.error(error);\n },\n complete: () => {\n this.streaming$.next(false);\n observer.complete();\n }\n });\n } else {\n this.streaming$.next(false);\n observer.complete();\n }\n })\n .catch(error => {\n console.error('Error invoking Chat:', error);\n this.streaming$.next(false);\n // Emit the error to the newly created observable\n observer.error(error);\n // Return a resolved promise to handle the error and prevent unhandled promise rejection\n return Promise.resolve();\n })\n .finally(() => {\n // This block concerns ONLY the completion of the \"Chat\" method invocation.\n // This means the completion of the combined$ stream.\n // It does not take into account the completion of the entire fetch method (the observable returned by fetch) and which depends on the completion of the save chat action if enabled\n this._response = []; // Clear the _response\n this._actionMap.clear(); // Clear the _actionMap\n this._progress = undefined; // Clear the _progress\n this._attachments = []; // Clear the _attachments\n this._debugMessages = []; // Clear the _debugMessages\n this._executionTime = \"\"; // Clear the _executionTime\n completion$.next(); // Emit a signal to complete the observables\n completion$.complete(); // Complete the subject\n });\n });\n }\n\n stopGeneration(): Observable<boolean> {\n // Start stopping generation by invoking the CancelTasks method\n this.stoppingGeneration$.next(true);\n // Create a Subject to hold the result of the CancelTasks method\n const stopGenerationSubject$ = new Subject<boolean>();\n\n this.connection!.on('CancelTasks', (res) => {\n // When the generation is stopped before streaming any VISIBLE assistant message, this means that $progress, $attachment and $debug properties will be lost.\n // However, the \"ContextMessage\" frames will be persisted in the chatHistory and the assistant may reference them in the next generation.\n // This leads to the problem of referencing undisplayed attachments in the next generation.\n // To solve this problem, we need to persist $progress, $attachment and $debug properties by adding a new assistant message with empty content and these properties.\n if (this._response.length === 1 && this._response[0].content === \"\") {\n this.chatHistory?.push({role: \"assistant\", content: \"\", additionalProperties: {display: true, $progress: this._progress, $attachment: this._attachments, $debug: this._debugMessages}});\n }\n stopGenerationSubject$.next(!!res); // Emit the result of the CancelTasks method\n stopGenerationSubject$.complete(); // Complete the subject\n this.stoppingGeneration$.next(false); // Complete stopping generation\n });\n\n // Invoke the CancelTasks method and handle errors\n this.connection!.invoke('CancelTasks')\n .catch(error => {\n console.error('Error invoking CancelTasks:', error);\n stopGenerationSubject$.error(new Error(error));\n this.stoppingGeneration$.next(false); // Complete stopping generation\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n });\n\n return stopGenerationSubject$.asObservable();\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatList', (res) => {\n this.savedChats$.next(res.savedChats); // emits the result to the savedChats$ subject\n });\n\n // Invoke the method SavedChatList\n this.connection!.invoke('SavedChatList', data)\n .catch(error => {\n console.error('Error invoking SavedChatList:', error);\n return Promise.resolve();\n });\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const savedChatSubject$ = new Subject<SavedChatHistory | undefined>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatGet', (res) => {\n savedChatSubject$.next(res.savedChat);\n savedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatGet\n this.connection!.invoke('SavedChatGet', data)\n .catch(error => {\n console.error('Error invoking SavedChatGet:', error);\n savedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return savedChatSubject$.asObservable();\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChat> {\n const addSavedChatSubject$ = new Subject<SavedChat>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatAdd', (res) => {\n this.setSavedChatId(res.savedChat.id); // Persist the savedChatId\n this.generateAuditEvent('saved-chat.add', {}, res.savedChat.id); // Generate audit event\n addSavedChatSubject$.next(res.savedChat);\n addSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatAdd\n this.connection!.invoke('SavedChatAdd', data)\n .catch(error => {\n console.error('Error invoking SavedChatAdd:', error);\n addSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return addSavedChatSubject$.asObservable();\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat> {\n const updateSavedChatSubject$ = new Subject<SavedChat>();\n\n const data = {\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if(name) data[\"title\"] = name;\n if(messages) data[\"history\"] = messages;\n\n this.connection!.on('SavedChatUpdate', (res) => {\n updateSavedChatSubject$.next(res.savedChat);\n updateSavedChatSubject$.complete()\n });\n\n // Invoke the method SavedChatUpdate\n this.connection!.invoke('SavedChatUpdate', data)\n .catch(error => {\n console.error('Error invoking SavedChatUpdate:', error);\n updateSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return updateSavedChatSubject$.asObservable();\n }\n\n deleteSavedChat(ids: string[]): Observable<number> {\n const deleteSavedChatSubject$ = new Subject<number>();\n\n const data = {\n instanceId: this.chatInstanceId,\n SavedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n this.connection!.on('SavedChatDelete', (res) => {\n deleteSavedChatSubject$.next(res.deleteCount);\n deleteSavedChatSubject$.complete();\n });\n\n // Invoke the method SavedChatDelete\n this.connection!.invoke('SavedChatDelete', data)\n .catch(error => {\n console.error('Error invoking SavedChatDelete:', error);\n deleteSavedChatSubject$.error(new Error(error));\n return Promise.resolve(); // Return a resolved promise to handle the error and prevent unhandled promise rejection when no further error handling exists downstream\n })\n\n return deleteSavedChatSubject$.asObservable();\n }\n\n /**\n * Initialize out-of-the-box handlers\n * It is a placeholder for non-streaming scenarios, where you invoke a specific hub method, and the server responds with frame message(s)\n */\n initMessageHandlers() {\n this.addMessageHandler(\n \"Error\",\n {\n handler: (error: ErrorEvent) => {\n console.error(error);\n this.notificationsService.error(error);\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Quota\",\n {\n handler: (message: QuotaEvent) => {\n try {\n this.updateQuota(message.quota)\n } catch (error) {\n console.error(error);\n }\n },\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"Debug\",\n { handler: () => {},\n isGlobalHandler: true\n }\n );\n this.addMessageHandler(\n \"ActionStart\",\n { handler: (action: ActionStartEvent) => this._actionMap.set(action.guid, action),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionResult\",\n {\n handler: (action: ActionResultEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ActionStop\",\n {\n handler: (action: ActionStopEvent) => this._actionMap.set(action.guid, { ...this._actionMap.get(action.guid), ...action }),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"ContextMessage\",\n {\n handler: (message: ContextMessageEvent) => this._attachments.push(message.metadata),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"Message\",\n {\n handler: (message: MessageEvent) => this._response.at(-1)!.content += message ?? \"\",\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"History\",\n {\n handler: (history: HistoryEvent) => {\n // The ChatHistory is updated: it is the current copy concatenated with the new items ONLY (it can have multiple messages: the context messages + the response message)\n // This is mandatory to not lose the previous updates of the chatHistory when the assistant is streaming multiple message steps\n this.chatHistory = [...this.chatHistory!, ...(history.history.slice(this.chatHistory!.length))];\n // Emit the updated chat usage metrics\n if (!!this.chatHistory.at(-1)?.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(this.chatHistory.at(-1)!.additionalProperties.usageMetrics!);\n }\n this._executionTime = history.executionTime;\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"SuggestedActions\",\n {\n handler: (message: SuggestedActionsEvent) => {\n // Since after the \"History\" and \"MessageBreak\" that this event is caught,\n // $suggestedAction needs to be updated directly to the last visible \"assistant\" message in the _response and the chatHistory\n this._response.at(-1)!.additionalProperties.$suggestedAction = (this._response.at(-1)!.additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n const index = this.lastVisibleAssistantMessageIndex(this.chatHistory);\n if (index !== -1) {\n this.chatHistory![index].additionalProperties.$suggestedAction = (this.chatHistory![index].additionalProperties.$suggestedAction || []).concat(message.suggestedActions);\n }\n },\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"DebugDisplay\",\n {\n handler: (message: DebugMessageEvent) => this._debugMessages = this._debugMessages.concat(message),\n isGlobalHandler: false\n }\n );\n this.addMessageHandler(\n \"MessageBreak\",\n {\n handler: () => {\n // Generate audit event\n const details = {\n 'duration': this._executionTime,\n 'text': this.chatHistory!.at(-1)!.content,\n 'role': this.chatHistory!.at(-1)!.role, // 'assistant'\n 'rank': this.chatHistory!.length - 1,\n 'generation-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': this.chatHistory!.at(-1)!.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': JSON.stringify(this._attachments.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => ({ partId, text })),\n type\n })))\n };\n this.generateAuditEvent('message', details);\n // Push a new assistant message to the _response array ONLY if the content of the last message is not empty\n if (this._response.at(-1)!.content !== \"\") {\n this._response.push({role: \"assistant\", content: \"\", additionalProperties: {display: true}})\n }\n },\n isGlobalHandler: false\n }\n );\n }\n\n /**\n * Override and register the entire _messageHandlers map by merging the provided map with the default one\n * @param _messageHandlers\n */\n overrideMessageHandlers<T>(_messageHandlers: Map<string, MessageHandler<T>>) {\n // Clear the already registered global chat handlers before merging the new ones\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.unsubscribeMessageHandler(eventName);\n }\n });\n\n // Merge the new event handlers with the existing ones\n this._messageHandlers = new Map([...this._messageHandlers, ..._messageHandlers]);\n\n // Register the global handlers among the merged map\n this._messageHandlers.forEach((eventHandler, eventName) => {\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n });\n }\n\n /**\n * Add a listener for a specific event.\n * If a listener for this same event already exists, it will be overridden.\n * If the listener has \"isGlobalHandler\" set to true, it will be registered to the hub connection.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n addMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n this._messageHandlers.set(eventName, eventHandler);\n if(eventHandler.isGlobalHandler) {\n this.registerMessageHandler(eventName, eventHandler);\n }\n }\n\n /**\n * Dynamically register a listener for a specific event.\n * If a listener for this event already exists, it will be overridden.\n * @param eventName Name of the event to register a listener for\n * @param eventHandler The handler to be called when the event is received\n */\n protected registerMessageHandler<T>(eventName: string, eventHandler: MessageHandler<T>) {\n if (!this.connection) {\n console.log(\"No connection found to register the listener\" + eventName);\n return;\n }\n\n this.connection.on(eventName, (data: T) => {\n eventHandler.handler(data);\n });\n }\n\n /**\n * Remove a listener for a specific event from the _messageHandlers map and unsubscribe from receiving messages for this event from the SignalR hub.\n * @param eventName Name of the event to remove the listener for\n */\n removeMessageHandler(eventName: string) {\n this._messageHandlers.delete(eventName);\n this.unsubscribeMessageHandler(eventName);\n }\n\n /**\n * Unsubscribe from receiving messages for a specific event from the SignalR hub.\n * ALL its related listeners will be removed from hub connection\n * This is needed to prevent accumulating old listeners when overriding the entire _messageHandlers map\n * @param eventName Name of the event\n */\n protected unsubscribeMessageHandler(eventName: string) {\n this.connection!.off(eventName);\n }\n\n /**\n * Build a connection to the signalR websocket and register default listeners to the methods defined in the server hub class\n * @param options The options for the connection. It overrides the default options\n * @param logLevel Define the log level displayed in the console\n * @returns Promise that resolves when the connection is built\n */\n buildConnection(options?: ConnectionOptions): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (!this.REQUEST_URL) {\n reject(new Error(\"No endpoint provided to connect the websocket to\"));\n return;\n }\n const logLevel = this._getLogLevel();\n this.connection = this.signalRService.buildConnection(this.REQUEST_URL, {...this.defaultOptions, ...options}, logLevel, true);\n\n const signalRServerTimeoutInMilliseconds = this.assistantConfig$.value?.connectionSettings.signalRServerTimeoutInMilliseconds;\n if (signalRServerTimeoutInMilliseconds) {\n this.connection.serverTimeoutInMilliseconds = signalRServerTimeoutInMilliseconds;\n }\n\n resolve();\n });\n }\n\n /**\n * Start the connection\n * @returns Promise that resolves when the connection is started\n */\n startConnection(): Promise<void> {\n return this.signalRService.startConnection(this.connection);\n }\n\n /**\n * Stop the connection\n * @returns Promise that resolves when the connection is stopped\n */\n stopConnection(): Promise<void> {\n return this.signalRService.stopConnection(this.connection);\n }\n\n private _getTransports(): HttpTransportType {\n switch (this.assistantConfig$.value?.connectionSettings.signalRTransport) {\n case \"WebSockets\":\n return HttpTransportType.WebSockets;\n case \"ServerSentEvents\":\n return HttpTransportType.ServerSentEvents;\n case \"LongPolling\":\n return HttpTransportType.LongPolling;\n default:\n return HttpTransportType.None;\n }\n }\n\n private _getLogLevel(): LogLevel {\n switch (this.assistantConfig$.value?.connectionSettings.signalRLogLevel) {\n case \"Critical\":\n return LogLevel.Critical; // Log level for diagnostic messages that indicate a failure that will terminate the entire application.\n case \"Debug\":\n return LogLevel.Debug; // Log level for low severity diagnostic messages.\n case \"Error\":\n return LogLevel.Error; // Log level for diagnostic messages that indicate a failure in the current operation.\n case \"Information\":\n return LogLevel.Information; // Log level for informational diagnostic messages.\n case \"None\":\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n case \"Trace\":\n return LogLevel.Trace; // Log level for very low severity diagnostic messages.\n case \"Warning\":\n return LogLevel.Warning; // Log level for diagnostic messages that indicate a non-fatal problem.\n default:\n return LogLevel.None; // The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted.\n }\n }\n\n get defaultOptions(): ConnectionOptions {\n let headers: MessageHeaders = {\n \"sinequa-force-camel-case\": \"true\",\n \"x-language\": this.intlService.currentLocale.name,\n \"ui-language\": this.intlService.currentLocale.name,\n };\n if (this.authenticationService.processedCredentials) {\n headers = {...headers, \"sinequa-csrf-token\": this.authenticationService.processedCredentials.data.csrfToken};\n };\n // For the first GET request sent by signalR to start a WebSocket protocol,\n // as far as we know, signalR only lets us tweak the request with this access token factory\n // so we pass along the Sinequa CSRF token to pass the CSRF check..\n return {\n transport: this._getTransports(),\n withCredentials: true,\n headers,\n accessTokenFactory: () => this.authenticationService.processedCredentials?.data?.csrfToken || \"\"\n }\n }\n}\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>","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 { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { UtilsModule } from '@sinequa/components/utils';\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.component.scss'],\n standalone: true,\n imports: [CommonModule, UtilsModule, FormatIconComponent]\n})\nexport class ChatReferenceComponent {\n\n @Input() reference: string;\n @Input() attachment: ChatContextAttachment;\n @Input() partId?: number;\n\n @Output() openDocument = new EventEmitter<ChatContextAttachment>();\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n\n get parts(): DocumentPart[] {\n if (!this.attachment) return [];\n return this.attachment.parts.filter(part => (!this.partId || part.partId === this.partId) && !!part.text);\n }\n\n expandAttachment() {\n if (this.partId) return;\n this.attachment['$expanded'] = !this.attachment['$expanded'];\n }\n}\n","<div [class.reference-tooltip]=\"!!partId\">\n <div class=\"reference-data\" [class.expanded]=\"attachment['$expanded'] || !!partId\" (click)=\"expandAttachment()\">\n <span class=\"reference me-1\">{{reference}}</span>\n <sq-format-icon [extension]=\"attachment.record.fileext\"></sq-format-icon>\n <a [id]=\"'attachment-'+attachment.recordId\">\n {{attachment.record.title}}\n </a>\n <i class=\"fas fa-eye\" (click)=\"$event.stopPropagation(); openPreview.emit(attachment)\" [sqTooltip]=\"!partId ? 'Preview document' : ''\"></i>\n <i class=\"fas fa-arrow-up-right-from-square\" *ngIf=\"attachment.record.url1 || attachment.record.originalUrl\"\n (click)=\"$event.stopPropagation(); openDocument.emit(attachment)\" [sqTooltip]=\"!partId ? 'Open document' : ''\">\n </i>\n </div>\n <div class=\"reference-passages\" *ngIf=\"!!partId || (attachment['$expanded']) && parts.length\">\n <div class=\"reference-passage\" *ngFor=\"let part of parts\">\n <span class=\"reference me-1\">{{reference}}.{{part.partId}}</span>\n <span class=\"w-100 pe-2\" [innerHTML]=\"part.text\"></span>\n </div>\n </div>\n</div>\n","import { 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 let chartInput = this.rawChartData.match(/<chartjs>({[\\s\\S]*?)<\\/chartjs>/)?.[1]?.trim().replace(/'/g, '\"') as string;\n let 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 { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ChangeDetectorRef, AfterViewInit, ElementRef } from \"@angular/core\";\nimport { PrincipalWebService } from \"@sinequa/core/web-services\";\nimport { SearchService } from \"@sinequa/components/search\";\nimport { ChatContextAttachment, ChatMessage, SuggestedAction } from \"../types\";\n\nimport { unified, Processor } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { visit, CONTINUE, EXIT } from \"unist-util-visit\";\nimport { Text, Parent, Content } from \"mdast\";\nimport { Node } from \"unist\";\nimport { UIService, UtilsModule } from \"@sinequa/components/utils\";\nimport remarkGfm from \"remark-gfm\";\nimport { CommonModule } from \"@angular/common\";\nimport { CollapseModule } from \"@sinequa/components/collapse\";\nimport { RemarkModule } from \"ngx-remark\";\nimport { InitialsAvatarComponent } from \"../initials-avatar/initials-avatar.component\";\nimport { ChatReferenceComponent } from \"../chat-reference/chat-reference.component\";\n\nimport \"prismjs-components-importer/esm\";\nimport 'prismjs/plugins/autoloader/prism-autoloader';\nimport { ChartComponent } from \"../charts/chart/chart.component\";\n\ndeclare module Prism {\n function highlightAllUnder(el: HTMLElement): void;\n}\n\n@Component({\n selector: \"sq-chat-message\",\n templateUrl: \"./chat-message.component.html\",\n styleUrls: [\"./chat-message.component.scss\"],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, UtilsModule, CollapseModule, RemarkModule,\n InitialsAvatarComponent, ChatReferenceComponent, ChartComponent]\n})\nexport class ChatMessageComponent implements OnChanges, AfterViewInit {\n @Input() message: ChatMessage;\n @Input() conversation: ChatMessage[];\n @Input() suggestedActions: SuggestedAction[] | undefined;\n @Input() assistantMessageIcon: string;\n @Input() userMessageIcon: string;\n @Input() connectionErrorMessageIcon: string;\n @Input() searchWarningMessageIcon: string;\n @Input() streaming: boolean;\n @Input() canEdit: boolean = false;\n @Input() canRegenerate: boolean = false;\n @Input() canCopy: boolean = false;\n @Input() canDebug: boolean = false;\n @Input() canLike: boolean = false;\n @Input() canDislike: boolean = false;\n @Output() openDocument = new EventEmitter<{reference: ChatContextAttachment, partId?: number}>();\n @Output() openPreview = new EventEmitter<{reference: ChatContextAttachment, partId?: number}>();\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n @Output() edit = new EventEmitter<ChatMessage>();\n @Output() copy = new EventEmitter<ChatMessage>();\n @Output() regenerate = new EventEmitter<ChatMessage>();\n @Output() like = new EventEmitter();\n @Output() dislike = new EventEmitter();\n @Output() debug = new EventEmitter<ChatMessage>();\n\n processor: Processor;\n\n references: string[] = [];\n referenceMap = new Map<string, ChatContextAttachment>();\n showReferences: boolean = true;\n collapseProgress: boolean;\n iconSize = 24;\n\n hiddenTooltip: boolean = false;\n\n constructor(\n public searchService: SearchService,\n public ui: UIService,\n public principalService: PrincipalWebService,\n public cdr: ChangeDetectorRef,\n public el: ElementRef\n ) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.streaming) {\n this.collapseProgress = !this.streaming;\n }\n\n if (this.message?.role === \"assistant\") {\n this.references = [];\n this.referenceMap.clear();\n for (let m of this.conversation) {\n if (m.additionalProperties.$attachment) {\n for (const attachment of m.additionalProperties.$attachment) {\n this.referenceMap.set('' + attachment.contextId, { ...attachment, $partId: attachment.parts?.[0]?.partId });\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, { ...attachment, $partId: attachment.parts?.[i]?.partId });\n }\n }\n }\n }\n\n if(m.content.startsWith(\"<chartjs>\")){\n m.messageType = \"CHART\";\n }\n else{\n m.messageType = \"MARKDOWN\";\n }\n }\n\n this.processor = unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(() => this.referencePlugin);\n\n if (this.streaming) {\n this.processor = this.processor.use(() => this.placeholderPlugin);\n }\n }\n }\n\n ngAfterViewInit(): void {\n Prism?.highlightAllUnder?.(this.el.nativeElement);\n }\n\n get name(): string {\n return !this.principalService.principal ? ''\n : this.principalService.principal['fullName'] as string || this.principalService.principal.name;\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * This Unified plugin looks a text nodes and replaces any reference in the\n * form [1], [2.3], etc. with custom nodes of type \"chat-reference\".\n */\n referencePlugin = (tree: Node) => {\n\n const references = new Set<number>();\n\n // Visit all text nodes\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n let text = node.value;\n\n text = this.reformatReferences(text);\n const matches = this.getReferenceMatches(text);\n\n // Quit if no references were found\n if (matches.length === 0) {\n return CONTINUE;\n }\n\n const nodes: (Content & { end: number })[] = [];\n\n for (let match of matches) {\n const refId = match[1].trim();\n const [ref] = refId.split(\".\");\n // We find a valid reference in the text\n if (!isNaN(+ref)) {\n references.add(+ref); // Add it to the set of used references\n\n // If needed, insert a text node before the reference\n const current = nodes.at(-1) ?? { end: 0 };\n if (match.index! > current.end) {\n nodes.push({ type: \"text\", value: text.substring(current.end, match.index!), end: match.index! });\n }\n\n // Add a custom reference node\n nodes.push({ type: \"chat-reference\", refId, end: match.index! + match[0].length } as any);\n }\n }\n\n // Quit if no references were found\n if (nodes.length === 0) {\n return CONTINUE;\n }\n\n if (nodes.at(-1)!.end < text.length) {\n nodes.push({ type: \"text\", value: text.substring(nodes.at(-1)!.end, text.length), end: text.length });\n }\n\n // Delete the current text node from the parent and replace it with the new nodes\n parent.children.splice(index, 1, ...nodes);\n\n return index + nodes.length; // Visit the next node after the inserted ones\n });\n\n if (references.size > 0) {\n this.references = Array.from(references.values())\n .sort((a, b) => a - b)\n .map(r => '' + r);\n this.cdr.detectChanges();\n }\n\n return tree;\n }\n\n placeholderPlugin = (tree: Node) => {\n\n visit(tree, \"text\", (node: Text, index: number, parent: Parent) => {\n parent.children.push({ type: \"streaming-placeholder\" } as any);\n return EXIT;\n }, true);\n\n return tree;\n }\n\n getLinkText(node: any): string {\n if (node.text) {\n return node.text; // Return directly if text is provided in node.text ([Example link](https://example.com))\n } else if (node.children && node.children.length > 0) {\n // Recursively search for text content in child nodes\n for (const child of node.children) {\n if (child.type === 'text' && child.value) {\n return child.value; // Return the value of the first text node found ([**Emphasized Link Text**](https://example.com))\n } else if (child.children && child.children.length > 0) {\n const textContent = this.getLinkText(child); // Recursively search child nodes ([](https://example.com))\n if (textContent) {\n return textContent; // Return text content if found\n }\n }\n }\n }\n return 'link'; // Return empty string if no text content is found\n }\n\n /**\n * Reformat [ids: 12.2, 42.5] to [12.2][42.5]\n */\n reformatReferences(content: string) {\n return content.replace(/\\[(?:ids?:?\\s*)?(?:documents?:?\\s*)?(\\s*(?:,?\\s*\\d+(?:\\.\\d+)?(?:\\.part)?\\s*)+)\\]/g,\n (str, match: string) => `[${match.replace(/\\.part/g, \"\").split(',').join(\"] [\")}]`\n );\n }\n\n /**\n * Match all references in a given message\n */\n getReferenceMatches(content: string) {\n return Array.from(content.matchAll(/\\[(\\s*\\d+(?:\\.\\d+)?\\s*)\\]/g));\n }\n\n private _copyToClipboard(content: string) {\n this.ui.copyToClipboard(content);\n\n }\n\n copyMessage(message: ChatMessage) {\n const content = message.content.replaceAll(/\\s+\\[.+?\\]/g, \"\")\n this._copyToClipboard(content);\n this.copy.emit(message);\n }\n\n copyCode(code: string) {\n this._copyToClipboard(code);\n }\n\n openAttachmentPreview(attachment: ChatContextAttachment, partId?: number) {\n this.openPreview.emit({reference: attachment, partId});\n this.hideTooltip();\n }\n\n openOriginalAttachment(attachment: ChatContextAttachment, partId?: number) {\n this.openDocument.emit({reference: attachment, partId});\n this.hideTooltip();\n }\n\n hideTooltip(): void {\n this.hiddenTooltip = true;\n setTimeout(() => {\n this.hiddenTooltip = false;\n });\n }\n}\n","<!-- Message icon -->\n<span class=\"message-icon\" [title]=\"message?.role\">\n <i class=\"d-block\" [style.width.px]=\"iconSize\" *ngIf=\"!message\"></i>\n <ng-container [ngSwitch]=\"message?.role\">\n <!-- For 'assistant' -->\n <i *ngSwitchCase=\"'assistant'\" [ngClass]=\"assistantMessageIcon\" [style.--sq-size.px]=\"iconSize\"></i>\n <!-- 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 <!-- 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 <!-- 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\n</span>\n\n<!-- Message body -->\n<div class=\"flex-grow-1\" 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 <a href=\"#\" (click)=\"collapseProgress = !collapseProgress; false\" class=\"text-muted\">\n View progress\n <i class=\"fas fa-chevron-{{collapseProgress? 'right' : 'down'}}\"></i>\n </a>\n <sq-collapse [collapsed]=\"collapseProgress\">\n <ng-template>\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 </ng-template>\n </sq-collapse>\n </div>\n\n <!-- Message content -->\n <div class=\"message-content\" *ngIf=\"message.content\">\n\n <div *ngIf=\"message?.role === 'assistant' && message.messageType === 'CHART'\">\n <sq-assistant-chart [rawChartData]=\"message.content\"></sq-assistant-chart>\n </div>\n\n <!-- This section is responsible for customizing the template nodes used in the application.\n Template nodes are predefined structures that serve as blueprints for creating/customizing dynamic content -->\n <remark *ngIf=\"(message?.role === 'assistant' && message.messageType === 'MARKDOWN') || message?.role === 'connection-error' || message?.role === 'search-warning'\" [markdown]=\"message.content\" [processor]=\"processor\">\n\n <ng-template remarkTemplate=\"chat-reference\" let-ref>\n\n <a *ngIf=\"referenceMap.get(ref.refId) as attachment; else staticRefTpl\"\n class=\"reference\"\n [sqTooltip]=\"attachment\"\n [sqTooltipTemplate]=\"tooltipTpl\"\n [hoverableTooltip]=\"true\"\n >{{ref.refId}}\n </a>\n\n <ng-template #staticRefTpl>\n <span class=\"reference\">{{ref.refId}}</span>\n </ng-template>\n\n </ng-template>\n\n <ng-template remarkTemplate=\"streaming-placeholder\">\n <span class=\"placeholder-glow\" *ngIf=\"streaming\">\n <span class=\"placeholder ms-1\"></span>\n </span>\n </ng-template>\n\n <ng-template remarkTemplate=\"code\" let-node>\n <div class=\"card mb-2\">\n <div class=\"card-header d-flex justify-content-between align-items-center\">\n <span>{{node.lang}}</span>\n <button class=\"btn btn-light btn-sm\" (click)=\"copyCode(node.value)\"><i class=\"far fa-fw fa-clipboard\"></i> Copy code</button>\n </div>\n <pre class=\"language-{{node.lang}} my-0 rounded-0 rounded-bottom\"><code class=\"language-{{node.lang}}\">{{node.value}}</code></pre>\n </div>\n </ng-template>\n\n <ng-template remarkTemplate=\"link\" let-node>\n <a [href]=\"node.url\" target=\"_blank\" rel=\"noopener noreferrer\">{{getLinkText(node)}}</a>\n </ng-template>\n\n </remark>\n\n <p *ngIf=\"message?.role === 'user'\">{{message.content}}</p>\n\n <!-- List of reference, if any -->\n <div *ngIf=\"references?.length\" class=\"references\">\n <span class=\"references-title\">References</span> <i class=\"fas references-collapse\" [class.fa-chevron-down]=\"showReferences\" [class.fa-chevron-right]=\"!showReferences\" (click)=\"showReferences=!showReferences\"></i>\n <sq-collapse [collapsed]=\"!showReferences\">\n <ng-template>\n <ul>\n <ng-container *ngFor=\"let reference of references\">\n <li *ngIf=\"referenceMap.get(reference) as attachment\" class=\"text-truncate\">\n <sq-chat-reference\n [class.expanded]=\"attachment.$expanded\"\n [attachment]=\"attachment\"\n [reference]=\"reference\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (openDocument)=\"openOriginalAttachment($event)\">\n </sq-chat-reference>\n </li>\n </ng-container>\n </ul>\n </ng-template>\n </sq-collapse>\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=\"Copy text\" (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=\"Edit message\" (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 === true\" *ngIf=\"canLike\" sqTooltip=\"Like the answer\" (click)=\"like.emit()\">\n <i class=\"fa-thumbs-up {{message.additionalProperties.$liked === true ? 'fas' : 'far'}}\"></i>\n </button>\n <button class=\"btn btn-sm bounce\" [class.bounce]=\"message.additionalProperties.$disliked === true\" *ngIf=\"canDislike\" sqTooltip=\"Report an issue\" (click)=\"dislike.emit()\">\n <i class=\"fa-thumbs-down {{message.additionalProperties.$disliked === true ? 'fas' : 'far'}}\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canRegenerate\" sqTooltip=\"Regenerate message\" (click)=\"regenerate.emit(message)\">\n <i class=\"fas fa-sync-alt\"></i>\n </button>\n <button class=\"btn btn-sm\" *ngIf=\"canDebug\" sqTooltip=\"Show Log Information\" (click)=\"debug.emit(message);\">\n <i class=\"far fa-list-alt\"></i>\n </button>\n </div>\n\n <!-- List of suggested actions, if any -->\n <div *ngIf=\"suggestedActions\" class=\"mt-2 message-suggestion\">\n <div class=\"suggested-action\" *ngFor=\"let suggestedAction of suggestedActions\" (click)=\"suggestAction.emit(suggestedAction)\">\n <div class=\"message-icon\" [style.width.px]=\"iconSize\"></div>\n <div class=\"message-content\">\n <p><i class=\"fas fa-clipboard-question\"></i> {{suggestedAction.content}}</p>\n </div>\n </div>\n </div>\n\n <ng-template #tooltipTpl let-ref>\n <sq-chat-reference\n *ngIf=\"!hiddenTooltip\"\n class=\"expanded\"\n [attachment]=\"ref\"\n [reference]=\"ref.contextId\"\n [partId]=\"ref.$partId\"\n (openPreview)=\"openAttachmentPreview($event, ref.$partId)\"\n (openDocument)=\"openOriginalAttachment($event, ref.$partId)\">\n </sq-chat-reference>\n </ng-template>\n\n</div>\n","import { Injectable, inject } from '@angular/core';\nimport { ChatService } from './chat.service';\nimport { Observable, catchError, filter, finalize, forkJoin, map, shareReplay, switchMap, take, tap, throwError } from 'rxjs';\nimport { ActionMessage, ChatMessage, ChatPayload, ChatProgress, ChatResponse, GllmFunction, GllmModelDescription, HttpChatResponse, SavedChat, SavedChatHistory } from './types';\nimport { JsonMethodPluginService } from '@sinequa/core/web-services';\nimport { Query } from \"@sinequa/core/app-utils\";\n\n@Injectable()\nexport class RestChatService extends ChatService {\n\n public jsonMethodWebService = inject(JsonMethodPluginService);\n\n constructor() {\n super();\n }\n\n /**\n * Initialize the chat process after the login is complete.\n * It listens for the 'login-complete' event, initializes necessary URL, and performs parallel requests for models, functions and quota data.\n * @returns An Observable<boolean> indicating the success of the initialization process.\n */\n init(): Observable<boolean> {\n return this.loginService.events.pipe(\n filter((e) => e.type === 'login-complete'),\n tap(() => this.getRequestsUrl()),\n // Execute parallel requests for models and functions\n switchMap(() =>\n forkJoin([\n this.listModels(),\n this.listFunctions()\n ])\n ),\n // Map the results of parallel requests to a boolean indicating success\n map(([models, functions]) => {\n const result = !!models && !!functions;\n this.initProcess$.next(result);\n return result;\n }),\n // Any errors during the process are caught, logged, and re-thrown to propagate the error further\n catchError((error) => {\n console.error('Error occurred:', error);\n return throwError(() => error);\n }),\n // cache and replay the emitted value for subsequent subscribers, ensuring the initialization logic is only executed once even if there are multiple subscribers\n shareReplay(1)\n );\n }\n\n /**\n * Define the GLLM plugin to use for the http requests\n * It can be overridden by the app config\n */\n getRequestsUrl() {\n if (this.assistantConfig$.value!.connectionSettings.restEndpoint) {\n this.REQUEST_URL = this.assistantConfig$.value!.connectionSettings.restEndpoint;\n } else {\n throw new Error(`The property 'restEndpoint' must be provided when attempting to use 'REST' in assistant instance`);\n }\n }\n\n override overrideUser(): void {\n const error = new Error('Override user is not supported in REST');\n console.error(error);\n }\n\n listModels(): Observable<GllmModelDescription[] | undefined> {\n const data = {\n action: \"listmodels\",\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.models),\n tap(models => this.models = models?.filter(model => !!model.enable)),\n catchError((error) => {\n console.error('Error invoking listmodels:', error);\n return throwError(() => error);\n })\n );\n }\n\n listFunctions(): Observable<GllmFunction[] | undefined> {\n const data = {\n action: \"listfunctions\",\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.functions),\n tap((functions: GllmFunction[] | undefined) => this.functions = functions?.filter(func => func.enabled && !!this.assistantConfig$.value!.defaultValues.functions.find(fn => fn.name === func.functionName))),\n catchError((error) => {\n console.error('Error invoking listfunctions:', error);\n return throwError(() => error);\n })\n );\n }\n\n fetch(messages: ChatMessage[], query: Query): Observable<ChatResponse> {\n // Start streaming by invoking the Chat method\n this.streaming$.next(true);\n\n // Prepare the payload to send to the Chat method\n const data: ChatPayload & {action: \"chat\"} = {\n action: \"chat\",\n history: messages,\n functions: this.assistantConfig$.value!.defaultValues.functions?.filter(func => func.enabled).map(func => func.name),\n debug: this.assistantConfig$.value!.defaultValues.debug,\n serviceSettings: {\n service_id: this.assistantConfig$.value!.defaultValues.service_id,\n model_id: this.assistantConfig$.value!.defaultValues.model_id,\n top_p: this.assistantConfig$.value!.defaultValues.top_p,\n temperature: this.assistantConfig$.value!.defaultValues.temperature,\n max_tokens: this.assistantConfig$.value!.defaultValues.max_tokens,\n ...this.assistantConfig$.value!.additionalServiceSettings\n },\n appQuery: {\n app: this.appService.appName,\n query\n },\n genericChatErrorMessage: this.assistantConfig$.value!.globalSettings.genericChatErrorMessage\n }\n if (this.assistantConfig$.value!.savedChatSettings.enabled) {\n data.instanceId = this.chatInstanceId;\n data.savedChatId = this.savedChatId;\n }\n\n // Request the Chat endpoint\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n tap((res: HttpChatResponse) => this.updateQuota(res.quota, true)),\n map((res: HttpChatResponse) => {\n // Define $progress from the actions property of the response\n let $progress: ChatProgress[] | undefined;\n if( res.actions?.length > 0) {\n const actions: ActionMessage[] = Object.values(res.actions.reduce((acc, item) => {\n acc[item.guid] = { ...(acc[item.guid] || {}), ...item };\n return acc;\n }, {}));\n $progress = actions.map((a) => ({\n title: a.displayName ?? \"\",\n content: a.displayValue ?? \"\",\n done: a.executionTime !== undefined,\n time: a.executionTime,\n }))\n }\n // Re-attach the $progress and $attachment of the last response to the last assistant's response in the chat history\n const response = {...(res.history as Array<ChatMessage>).at(-1)} as ChatMessage;\n if($progress) response.additionalProperties.$progress = $progress;\n if(res.context) response.additionalProperties.$attachment = res.context.map((ctx) => ctx.additionalProperties);\n if(res.suggestedActions) response.additionalProperties.$suggestedAction = res.suggestedActions;\n // Emit the updated chat usage metrics once the generation of the assistant response is completed\n if (!!response.additionalProperties.usageMetrics) {\n this.updateChatUsageMetrics(response.additionalProperties.usageMetrics!);\n }\n // Update the chat history with the incoming history property of the res AND the processed response message\n this.chatHistory = res.history;\n this.chatHistory[this.chatHistory.length - 1] = response;\n // Save/update the chat if savedChat enabled\n if (this.assistantConfig$.value!.savedChatSettings.enabled && this.chatHistory.some((msg) => msg.additionalProperties?.isUserInput === true)) {\n const action = !this.savedChatId ? this.addSavedChat(this.chatHistory) : this.updateSavedChat(this.savedChatId, undefined, this.chatHistory);\n action.pipe(take(1)).subscribe();\n }\n // Generate audit event\n const details = {\n 'duration': res.executionTime,\n 'text': response.content,\n 'role': response.role, // 'assistant'\n 'rank': this.chatHistory.length - 1,\n 'generation-tokencount': response.additionalProperties.usageMetrics?.completionTokenCount,\n 'prompt-tokencount': response.additionalProperties.usageMetrics?.promptTokenCount,\n 'attachments': response.additionalProperties.$attachment?.map(({ recordId, contextId, parts, type }) => ({\n recordId,\n contextId,\n parts: parts.map(({ partId, text }) => ({ partId, text })),\n type\n }))\n };\n this.generateAuditEvent('message', details);\n // Return the result\n return { history: [...messages, response], executionTime: res.executionTime };\n }),\n finalize(() => this.streaming$.next(false))\n );\n }\n\n stopGeneration(): Observable<any> {\n const error = new Error('Not supported in REST');\n console.error(error);\n return throwError(() => error);\n }\n\n listSavedChat(): void {\n if (!this.assistantConfig$.value!.savedChatSettings.enabled) {\n return;\n }\n\n const data = {\n action: \"SavedChatList\",\n instanceId: this.chatInstanceId,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n this.jsonMethodWebService.get(this.REQUEST_URL, data).subscribe(\n res => this.savedChats$.next(res.savedChats),\n error => {\n console.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatList API:', error.error.errorMessage);\n }\n );\n }\n\n addSavedChat(messages: ChatMessage[]): Observable<SavedChat> {\n const data = {\n action: \"SavedChatAdd\",\n instanceId: this.chatInstanceId,\n savedChatId: this.chatId,\n history: messages,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n tap((savedChat: SavedChat) => {\n this.setSavedChatId(savedChat.id); // Persist the savedChatId\n this.generateAuditEvent('saved-chat.add', {}, savedChat.id); // Generate audit event\n }),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatAdd API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n getSavedChat(id: string): Observable<SavedChatHistory | undefined> {\n const data = {\n action: \"SavedChatGet\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.get(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatGet API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n updateSavedChat(id: string, name?: string, messages?: ChatMessage[]): Observable<SavedChat> {\n const data = {\n action: \"SavedChatUpdate\",\n instanceId: this.chatInstanceId,\n savedChatId: id,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n\n if(name) data[\"title\"] = name;\n if(messages) data[\"history\"] = messages;\n\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.savedChat),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatUpdate API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n deleteSavedChat(ids: string[]): Observable<number> {\n const data = {\n action: \"SavedChatDelete\",\n instanceId: this.chatInstanceId,\n savedChatIds: ids,\n debug: this.assistantConfig$.value!.defaultValues.debug\n };\n return this.jsonMethodWebService.post(this.REQUEST_URL, data).pipe(\n map(res => res.deletedCount),\n catchError((error) => {\n console.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n this.notificationsService.error('Error occurred while calling the SavedChatDelete API:', error.error.errorMessage);\n return throwError(() => error);\n })\n );\n }\n\n}\n","import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';\nimport { Subscription, filter, switchMap, tap } from 'rxjs';\nimport { CommonModule } from '@angular/common';\nimport { ChatConfig, TokenConsumption, UserTokenConsumption } from '../types';\nimport { LoginService } from '@sinequa/core/login';\nimport { InstanceManagerService } from '../instance-manager.service';\nimport { ChatService } from '../chat.service';\nimport { UtilsModule } from '@sinequa/components/utils';\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 imports: [CommonModule, UtilsModule]\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 userTitle?: string;\n\n // Current chat token consumption progress bar\n chatPercentage?: number;\n chatTitle?: string;\n\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n\n ngOnInit() {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\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.userTitle = `Max generation allowed: ${this.userPercentage}% consumed. Resets at ${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 this.chatTitle = `Max length of conversation: ${this.chatPercentage}% reached.`;\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]=\"userTitle\"\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]=\"chatTitle\"\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 { AfterViewInit, Component, Input } from \"@angular/core\";\nimport { DebugMessage } from \"../types\";\nimport { Utils } from \"@sinequa/core/base\";\nimport * as Prism from 'prismjs';\nimport { UIService } from \"@sinequa/components/utils\";\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]\n})\nexport class DebugMessageComponent implements AfterViewInit {\n @Input() data: DebugMessage[] | undefined;\n @Input() level: number = 0; // Track the nesting level\n @Input() parentColor: string = ''; // Track the parent row color\n\n constructor(public ui: UIService) { }\n\n ngAfterViewInit() {\n Prism.highlightAll();\n }\n\n isObject(value: any): boolean {\n return Utils.isObject(value);\n }\n\n getRowClass(item: DebugMessage, index: number): string {\n if (item.isError) return 'row-error';\n if (this.level === 0) return index % 2 === 0 ? 'row-even' : 'row-odd';\n return this.parentColor;\n }\n\n copyToClipboard(code: any) {\n this.ui.copyToClipboard(JSON.stringify(code, null, 2));\n }\n}\n","<div *ngIf=\"data\" class=\"table-root\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <div *ngIf=\"item.type === 'KV'\" [ngClass]=\"getRowClass(item, i)\" class=\"table-row 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> Copy code</button>\n </div>\n <pre class=\"language-json my-0 rounded-0 rounded-bottom\"><code class=\"language-json\">{{ item.data.value | json }}</code></pre>\n </div>\n </ng-container>\n <ng-template #normalValue><div class=\"data-value\">{{ item.data.value }}</div></ng-template>\n </div>\n </div>\n <div *ngIf=\"item.type === 'LIST'\" [ngClass]=\"getRowClass(item, i)\" class=\"table-row list-object\">\n <div class=\"list-name w-100\" [class.fw-bold]=\"level === 0\" (click)=\"item.expanded=!item.expanded\">\n <i class=\"fas\" [class.fa-chevron-up]=\"item.expanded\" [class.fa-chevron-down]=\"!item.expanded\"></i>\n {{ item.name }}\n </div>\n <div class=\"list-items w-100\" *ngIf=\"item.expanded\">\n <sq-debug-message [data]=\"item.items\" [level]=\"level + 1\" [parentColor]=\"getRowClass(item, i)\"></sq-debug-message>\n </div>\n </div>\n </ng-container>\n</div>\n","import { inject, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef, ViewChild } from \"@angular/core\";\nimport { Action } from \"@sinequa/components/action\";\nimport { AbstractFacet } from \"@sinequa/components/facet\";\nimport { SearchService } from \"@sinequa/components/search\";\nimport { AppService, Query } from \"@sinequa/core/app-utils\";\nimport { PrincipalWebService, Record as Article } from \"@sinequa/core/web-services\";\nimport { BehaviorSubject, Subscription, combineLatest, filter, fromEvent, map, merge, switchMap, take, tap } from \"rxjs\";\nimport { ChatService } from \"./chat.service\";\nimport { ChatContextAttachment, ChatConfig, ChatMessage, GllmModelDescription, MessageHandler, RawMessage, SuggestedAction, InitChat, DebugMessage } from \"./types\";\nimport { InstanceManagerService } from \"./instance-manager.service\";\nimport { WebSocketChatService } from \"./websocket-chat.service\";\nimport { ChatMessageComponent } from \"./chat-message/chat-message.component\";\nimport { CommonModule } from \"@angular/common\";\nimport { FormsModule } from \"@angular/forms\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { RestChatService } from \"./rest-chat.service\";\nimport { TokenProgressBarComponent } from \"./token-progress-bar/token-progress-bar.component\";\nimport { DebugMessageComponent } from \"./debug-message/debug-message.component\";\nimport { HubConnection, HubConnectionState } from \"@microsoft/signalr\";\nimport { UtilsModule } from \"@sinequa/components/utils\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\n\n@Component({\n selector: 'sq-chat-v3', // mandatory since @sinequa/components already has the same tag-name \"sq-chat\"\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n providers: [\n RestChatService,\n WebSocketChatService\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [CommonModule, FormsModule, ChatMessageComponent, TokenProgressBarComponent, DebugMessageComponent, UtilsModule]\n})\nexport class ChatComponent extends AbstractFacet implements OnInit, OnChanges, OnDestroy {\n\n public loginService = inject(LoginService);\n public websocketService = inject(WebSocketChatService);\n public restService = inject(RestChatService);\n public instanceManagerService = inject(InstanceManagerService);\n public searchService = inject(SearchService);\n public principalService = inject(PrincipalWebService);\n public cdr = inject(ChangeDetectorRef);\n public appService = inject(AppService);\n public notificationsService = inject(NotificationsService);\n\n /** Define the key based on it, the chat service instance will be stored */\n @Input() instanceId: string;\n /** Define the query to use to fetch answers */\n @Input() query: Query = this.searchService.query;\n /** Function that determines whether the chat should be reloaded after the query changes\n * If not provided, the chat will be reloaded by default\n * @param prevQuery The previous query\n * @param newQuery The new query\n * @returns true if the chat should be reloaded, false otherwise\n */\n @Input() queryChangeShouldTriggerReload: (prevQuery: Query, newQuery: Query) => boolean;\n /** Define the protocol to be used for this chat instance*/\n @Input() protocol: 'REST' | 'WEBSOCKET' = \"WEBSOCKET\";\n /** Map of listeners overriding default registered ones*/\n @Input() messageHandlers: Map<string, MessageHandler<any>> = new Map();\n /** When the assistant answer a user question, automatically scroll down to the bottom of the discussion */\n @Input() automaticScrollToLastResponse = false;\n /** When the assistant answer a user question, automatically focus to the chat input */\n @Input() focusAfterResponse = false;\n /** A chat discussion that the component should get initialized with it */\n @Input() chat?: InitChat;\n /** Icon to use for the assistant messages */\n @Input() assistantMessageIcon = 'sq-sinequa';\n /** Icon to use for the user messages */\n @Input() userMessageIcon: string;\n /** Icon to use for the connection error messages */\n @Input() connectionErrorMessageIcon: string;\n /** Icon to use for the search warning messages */\n @Input() searchWarningMessageIcon: string;\n /** Event emitter triggered once the signalR connection is established */\n @Output() connection = new EventEmitter<HubConnection>();\n /** Event emitter triggered each time the assistant updates the current chat */\n /** Event emitter triggered when the chat is loading new content */\n @Output(\"loading\") loading$ = new EventEmitter<boolean>(false);\n /** Emits the assistant configuration used when instantiating the component */\n @Output(\"config\") _config = new EventEmitter<ChatConfig>();\n @Output() data = new EventEmitter<ChatMessage[]>();\n /** Event emitter triggered when the user clicks to open the original document representing the context attachment*/\n @Output() openDocument = new EventEmitter<Article>();\n /** Event emitter triggered when the user clicks to open the preview of a document representing the context attachment */\n @Output() openPreview = new EventEmitter<ChatContextAttachment>();\n /** Event emitter triggered when the user clicks on a suggested action */\n @Output() suggestAction = new EventEmitter<SuggestedAction>();\n /** ViewChild decorators to access the template elements */\n @ViewChild('messageList') messageList?: ElementRef<HTMLUListElement>;\n @ViewChild('questionInput') questionInput?: ElementRef<HTMLTextAreaElement>;\n /** ContentChild decorators allowing the override of the default templates from the parent component */\n @ContentChild('loadingTpl') loadingTpl?: TemplateRef<any>;\n @ContentChild('reportTpl') reportTpl?: TemplateRef<any>;\n @ContentChild('tokenConsumptionTpl') tokenConsumptionTpl?: TemplateRef<any>;\n @ContentChild('debugMessagesTpl') debugMessagesTpl?: TemplateRef<any>;\n\n chatService: ChatService;\n config: ChatConfig;\n messages$ = new BehaviorSubject<ChatMessage[] | undefined>(undefined);\n\n question = '';\n\n _actions: Action[] = [];\n private _resetChatAction = new Action({\n icon: 'fas fa-sync',\n title: \"Reset assistant\",\n action: () => this.newChat()\n });\n\n private _sub = new Subscription();\n private _dataSubscription: Subscription | undefined;\n\n /** Variables that depend on the type of model in use */\n modelDescription?: GllmModelDescription;\n\n messageToEdit?: number;\n remappedMessageToEdit?: number;\n changes$ = new BehaviorSubject<SimpleChanges | undefined>(undefined);\n currentMessageIndex: number | undefined;\n firstChangesHandled = false;\n isAtBottom = true;\n initializationError = false;\n enabledUserInput = false;\n isConnected = true; // By default, the chat is considered connected\n retrialAttempts: number | undefined;\n // Flag to track whether the 'reconnected' listener is already registered\n private _isReconnectedListenerRegistered = false;\n\n // Issue reporting\n issueTypes?: string[];\n defaultIssueTypes: string[] = [\n 'User Interface bug',\n 'Incorrect or misleading response',\n 'Incomplete response',\n 'Technical issue',\n 'Privacy/data security issue',\n 'Other'\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 super();\n this._actions.push(this._resetChatAction);\n }\n\n ngOnInit(): void {\n this._sub.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n map(_ => this.chatService.initChatConfig()),\n switchMap(() => this.chatService.initConfig$),\n filter(initConfig => !!initConfig),\n switchMap(_ => this.chatService.init()),\n switchMap(_ => this.chatService.initProcess$),\n filter(success => !!success),\n tap(_ => {\n if (this.chatService instanceof WebSocketChatService) {\n this.connection.emit(this.chatService.connection);\n }\n this.onLoadChat();\n }),\n tap(_ => this.chatService.overrideUser()),\n switchMap(_ => this.chatService.userOverride$),\n switchMap(_ => this.chatService.assistantConfig$),\n tap(config => {\n this.config = config!;\n this.enabledUserInput = this.config.modeSettings.enabledUserInput;\n this.issueTypes = this.config.auditSettings?.issueTypes?.length ? this.config.auditSettings!.issueTypes : undefined;\n this._config.emit(config);\n try {\n this.updateModelDescription();\n if(!this.firstChangesHandled) {\n this._previousQuery = JSON.parse(JSON.stringify(this.query)); // Initialize the previous query\n this._handleChanges();\n this._addScrollListener();\n this.firstChangesHandled = true;\n }\n } catch (error) {\n this.initializationError = true\n throw error;\n }\n })\n ).subscribe()\n );\n\n this._sub.add(\n combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ]).pipe(\n map(([streaming, stoppingGeneration]) => !!(streaming || stoppingGeneration))\n ).subscribe((result) => {\n this._resetChatAction.disabled = result;\n })\n );\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this.changes$.next(changes);\n if (this.config) {\n this._handleChanges();\n }\n }\n\n ngOnDestroy(): void {\n this._sub.unsubscribe();\n this._dataSubscription?.unsubscribe();\n this._reloadSubscription?.unsubscribe();\n if (this.chatService instanceof WebSocketChatService) {\n this.chatService.stopConnection();\n }\n }\n\n get isAdmin(): boolean {\n return this.principalService.principal?.isAdministrator || false;\n }\n\n /**\n * Instantiate the chat service based on the provided @input protocol\n * This chat service instance will then be stored in the instanceManagerService with provided @input instanceId as a key\n */\n instantiateChatService(): void {\n switch (this.protocol) {\n case 'REST':\n this.chatService = this.restService;\n break;\n case 'WEBSOCKET':\n this.chatService = this.websocketService;\n break;\n default:\n throw new Error(`Could not found a ChatService implementation corresponding to the provided protocol: '${this.protocol}'`);\n }\n this.chatService.setChatInstanceId(this.instanceId);\n this.instanceManagerService.storeInstance(this.instanceId, this.chatService);\n }\n\n override get actions() { return this._actions; }\n\n\n /**\n * Handles the changes in the chat component.\n * If the chat service is a WebSocketChatService, it handles the override of the message handlers if they exist.\n * Initializes the chat with the provided chat messages if they exist, otherwise loads the default chat.\n * If the chat is initialized, the initialization event is \"Query\", the query changes, and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true. Otherwise, the chat should be reloaded by default.\n * It takes into account the ongoing streaming process and the ongoing stopping process to trigger that conditionally define the logic\n * of the reload :\n * - If the chat is streaming, then stop the generation and wait for the fetch to complete before reloading the chat.\n * - If the chat is stopping the generation, then wait for the fetch to complete before reloading the chat.\n */\n private _handleChanges() {\n const changes = this.changes$.value;\n // If the chat service is a WebSocketChatService, handle the override of the message handlers if exists\n if (changes?.messageHandlers && this.messageHandlers && this.chatService instanceof WebSocketChatService) {\n this.chatService.overrideMessageHandlers(this.messageHandlers);\n }\n /**\n * Initialize the chat with the provided chat messages if exists, otherwise load the default chat\n * Once the chat is initialized (firstChangesHandled is true), allow opening the chat with the new provided messages (if exists)\n */\n if (!this.firstChangesHandled || changes?.chat) {\n const openChat = () => {\n if (this.messages$.value) {\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n }\n this.openChat(this.chat!.messages);\n };\n this.chatService.generateChatId();\n if (this.chat) {\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value),'chat-init': JSON.stringify(this.chat)});\n openChat();\n } else {\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)});\n this.loadDefaultChat();\n }\n }\n /**\n * If the chat is initialized, the initialization event is \"Query\", the query changes and the queryChangeShouldTriggerReload function is provided,\n * then the chat should be reloaded if the function returns true\n * Otherwise, the chat should be reloaded by default\n */\n if (this.firstChangesHandled && changes?.query && this.config.modeSettings.initialization.event === 'Query') {\n if (this.queryChangeShouldTriggerReload ? this.queryChangeShouldTriggerReload(this._previousQuery, this.query) : true) {\n if (!!this.chatService.stoppingGeneration$.value) {\n if (!this._reloadSubscription) {\n // Create a subscription to wait for both streaming$ and stoppingGeneration$ to be false\n this._reloadSubscription = combineLatest([\n this.chatService.streaming$,\n this.chatService.stoppingGeneration$\n ])\n .pipe(\n filter(([streaming, stopping]) => !streaming && !stopping), // Wait until both are false\n take(1) // Complete after the first match\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription = undefined;\n });\n }\n } else if (!!this.chatService.streaming$.value) {\n if (!this._reloadSubscription) {\n this._reloadSubscription = this.chatService.stopGeneration()\n .subscribe({\n next: () => {},\n error: () => {\n // Clean up subscription and reset its value\n this._reloadSubscription?.unsubscribe();\n this._reloadSubscription = undefined;\n },\n complete: () => {\n // Wait for the ongoing fetch to complete, then trigger the reload\n this.chatService.streaming$.pipe(\n filter((streaming) => !streaming),\n take(1)\n ).subscribe(() => {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n // Clean up subscription and reset its value\n this._reloadSubscription!.unsubscribe();\n this._reloadSubscription = undefined;\n });\n }\n });\n }\n } else {\n // Execute the reload after the query change\n this._triggerReloadAfterQueryChange();\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n } else {\n // Update _previousQuery with the current query\n this._previousQuery = JSON.parse(JSON.stringify(this.query));\n }\n }\n }\n\n /**\n * Triggers a reload after the query change.\n * This method performs the necessary operations to reload the chat after a query change.\n * It sets the system and user messages, resets the savedChatId, generates a new chatId,\n * generates a new chat audit event, and handles the query mode.\n */\n private _triggerReloadAfterQueryChange() {\n const systemMsg = {role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: {display: false}};\n const userMsg = {role: 'user', content: ChatService.formatPrompt(this.config.defaultValues.userPrompt, {principal: this.principalService.principal}), additionalProperties: {display: this.config.modeSettings.displayUserPrompt}};\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this._handleQueryMode(systemMsg, userMsg);\n }\n\n\n /**\n * Adds a scroll listener to the message list element.\n * The listener is triggered when any of the following events occur:\n * - Loading state changes\n * - Messages change\n * - Streaming state changes\n * - Scroll event occurs on the message list element\n *\n * When the listener is triggered, it updates the `isAtBottom` property.\n */\n private _addScrollListener() {\n this._sub.add(\n merge(this.loading$, this.messages$, this.chatService.streaming$, fromEvent(this.messageList!.nativeElement, 'scroll')).subscribe(() => {\n this.isAtBottom = this._toggleScrollButtonVisibility();\n this.cdr.detectChanges();\n })\n );\n }\n\n /**\n * Get the model description based on the defaultValues service_id and model_id\n */\n updateModelDescription() {\n this.modelDescription = this.chatService.getModel(this.config.defaultValues.service_id, this.config.defaultValues.model_id);\n this.cdr.detectChanges();\n }\n\n /**\n * Submits a question from the user.\n * If the user is editing a previous message, removes all subsequent messages from the chat history.\n * Triggers the fetch of the answer for the submitted question by calling _fetchAnswer().\n * Clears the input value in the UI.\n * ⚠️ If the chat is streaming or stopping the generation, the operation is not allowed.\n */\n submitQuestion() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if(this.question.trim() && this.messages$.value && this.chatService.chatHistory) {\n // When the user submits a question, if the user is editing a previous message, remove all subsequent messages from the chat history\n if (this.messageToEdit !== undefined) {\n // Update the messages in the UI\n this.messages$.next(this.messages$.value.slice(0, this.messageToEdit));\n // Update the raw messages in the chat history which is the clean version used to make the next request\n this.chatService.chatHistory = this.chatService.chatHistory.slice(0, this.remappedMessageToEdit);\n this.messageToEdit = undefined;\n this.remappedMessageToEdit = undefined;\n }\n // Remove the search warning message if exists\n if (this.chatService.chatHistory.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory.pop();\n }\n // Fetch the answer\n this._fetchAnswer(this.question.trim(), this.chatService.chatHistory);\n // Clear the input value in the UI\n this.questionInput!.nativeElement.value = '';\n this.questionInput!.nativeElement.style.height = `auto`;\n }\n }\n\n /**\n * Triggers the fetch of the answer for the given question and updates the conversation.\n * Generates an audit event for the user input.\n *\n * @param question - The question asked by the user.\n * @param conversation - The current conversation messages.\n */\n private _fetchAnswer(question: string, conversation: ChatMessage[]) {\n const userMsg = {role: 'user', content: question, additionalProperties: {display: true, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n const messages = [...conversation, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userMsg, messages.length - 1), 'query': JSON.stringify(this.query), 'is-user-input': true, 'enabled-functions': this.config.defaultValues.functions?.filter(func => func.enabled).map(func => func.name), 'additional-workflow-properties': JSON.stringify(this.config.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 = {role: 'connection-error', content: this.config.connectionSettings.connectionErrorMessage, additionalProperties: {display: true}};\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.config.connectionSettings.connectionErrorMessage, additionalProperties: {display: true}};\n this.messages$.next([...messages, message]);\n }\n\n if(this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * Retry to fetch the messages if the connection issues.\n * - If reconnecting => keep display the connection error message even when clicking on the \"retry\" button and increasing the number of retrial attempts, until the connection is re-established\n * - If disconnected => On click on the \"retry\" button, start the connection process while displaying the connection error message :\n * * If successful => given a list of messages, the chat endpoint is invoked for a continuation and updates the list of messages accordingly.\n * * If failed => increase the number of retrial attempts\n */\n retryFetch() {\n if(this.chatService instanceof WebSocketChatService) {\n // A one-time listener for reconnected event\n const onReconnectedHandler = () => {\n // Get the messages without the last one (the connection error message)\n const messages = this.messages$.value!.slice(0, -1);\n // Find the last \"user\" message in the messages list\n let index = messages.length - 1;\n while (index >= 0 && messages[index].role !== 'user') {\n index--;\n }\n // If a user message is found (and it should always be the case), remove all subsequent messages from the chat history\n // Update the messages in the UI\n // and fetch the answer from the assistant\n if (index >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, index+1));\n const remappedIndex = this._remapIndexInChatHistory(index);\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, remappedIndex+1);\n this.fetch(this.chatService.chatHistory);\n }\n this.retrialAttempts = undefined; // Reset the number of retrial attempts\n /**\n * To remove the handler for onreconnected() after it's been registered,cannot directly use off() like you would for normal events registered with connection.on().\n * Instead, you need to explicitly remove or reset the handler by assigning it to null or an empty function\n */\n (this.chatService as WebSocketChatService).connection!.onreconnected(() => {});\n // Reset the flag to ensure the handler is registered again when needed\n this._isReconnectedListenerRegistered = false;\n }\n // Depending on the connection's state, take the appropriate action\n switch (this.chatService.connection!.state) {\n case HubConnectionState.Connected:\n // If the connection is re-established in the meantime, fetch the messages\n onReconnectedHandler();\n break;\n case HubConnectionState.Reconnecting:\n // Attach the reconnected listener if not already registered\n if (!this._isReconnectedListenerRegistered) {\n this.chatService.connection!.onreconnected(onReconnectedHandler);\n this._isReconnectedListenerRegistered = true;\n }\n // Increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts+1 : 1;\n break;\n case HubConnectionState.Disconnected:\n // Start the new connection\n this.chatService.startConnection()\n .then(() => onReconnectedHandler())\n .catch(() => { // If the connection fails, increase the number of retrial attempts\n this.retrialAttempts = this.retrialAttempts ? this.retrialAttempts+1 : 1;\n });\n break;\n default:\n break;\n }\n }\n }\n\n /**\n * Check if the signalR connection is connected.\n * For the REST protocol, the connection is always considered connected (for the moment).\n */\n private _updateConnectionStatus() {\n this.isConnected = (this.chatService instanceof WebSocketChatService) ? this.chatService.connection!.state === HubConnectionState.Connected : true;\n }\n\n /**\n * Update the UI with the new messages\n * @param messages\n */\n updateData(messages: ChatMessage[]) {\n this.messages$.next(messages);\n this.data.emit(messages);\n this.loading$.next(false);\n this.question = '';\n if(this.automaticScrollToLastResponse) {\n this.scrollDown();\n }\n }\n\n /**\n * @returns true if the chat discussion is scrolled down to the bottom, false otherwise\n */\n private _toggleScrollButtonVisibility(): boolean {\n if(this.messageList?.nativeElement) {\n return Math.round(this.messageList?.nativeElement.scrollHeight - this.messageList?.nativeElement.scrollTop - 1) <= this.messageList?.nativeElement.clientHeight;\n }\n return true;\n }\n\n /**\n * Scroll down to the bottom of the chat discussion\n */\n scrollDown() {\n setTimeout(() => {\n if(this.messageList?.nativeElement) {\n this.messageList.nativeElement.scrollTop = this.messageList.nativeElement.scrollHeight;\n this.cdr.detectChanges();\n }\n }, 10);\n }\n\n /**\n * Start a new chat with the defaultValues settings.\n * The savedChatId in the chat service will be reset, so that the upcoming saved chat operations will be performed on the fresh new chat.\n * If the savedChat feature is enabled, the list of saved chats will be refreshed.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n */\n newChat() {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.chatService.setSavedChatId(undefined); // Reset the savedChatId\n this.chatService.generateChatId(); // Generate a new chatId\n this.chatService.listSavedChat(); // Refresh the list of saved chats\n this.chatService.generateAuditEvent('new-chat', {'configuration': JSON.stringify(this.chatService.assistantConfig$.value)}); // Generate a new chat audit event\n this.loadDefaultChat(); // Start a new chat\n }\n\n /**\n * Attaches the specified document IDs to the assistant.\n * If no document IDs are provided, the operation is not allowed.\n * If the action for attaching a document is not defined at the application customization level, an error is logged.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param ids - An array of document IDs to attach.\n */\n attachToChat(ids: string[]) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n if (!ids || ids?.length < 1) {\n return;\n }\n const attachDocAction = this.config.modeSettings.actions?.[\"attachDocAction\"];\n if (!attachDocAction) {\n console.error(`No action is defined for attaching a document to the assistant \"${this.instanceId}\"`);\n return;\n }\n const userMsg = { role: 'user', content: '', additionalProperties: {display: false, isUserInput: false, type: \"Action\", forcedWorkflow: attachDocAction.forcedWorkflow, forcedWorkflowProperties: {...(attachDocAction.forcedWorkflowProperties || {}), ids}, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n // Remove the search warning message if exists\n if (this.chatService.chatHistory!.at(-1)?.role === 'search-warning') {\n this.chatService.chatHistory!.pop();\n }\n const messages = [...this.chatService.chatHistory!, userMsg];\n this.messages$.next(messages);\n this.fetch(messages);\n }\n\n /**\n * Start the default chat with the defaultValues settings\n * If the chat is meant to be initialized with event === \"Query\", the corresponding user query message will be added to the chat history\n */\n loadDefaultChat() {\n // Define the default system prompt and user prompt messages\n const systemMsg = {role: 'system', content: this.config.defaultValues.systemPrompt, additionalProperties: {display: false}};\n const userMsg = {role: 'user', content: ChatService.formatPrompt(this.config.defaultValues.userPrompt, {principal: this.principalService.principal}), additionalProperties: {display: this.config.modeSettings.displayUserPrompt}};\n\n if (this.config.modeSettings.initialization.event === 'Query') {\n this._handleQueryMode(systemMsg, userMsg);\n } else {\n this._handlePromptMode(systemMsg, userMsg);\n }\n }\n\n /**\n * Handles the prompt mode of the chat component.\n * If `sendUserPrompt` is true, it opens the chat with both system and user messages,\n * and generates audit events for both messages.\n * If `sendUserPrompt` is false, it opens the chat with only the system message,\n * and generates an audit event for the system message.\n *\n * @param systemMsg - The system message to be displayed in the chat.\n * @param userMsg - The user message to be displayed in the chat (optional).\n */\n private _handlePromptMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(userMsg, 1));\n } else {\n this.openChat([systemMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n }\n }\n\n /**\n * Handles the query mode by displaying the system message, user message, and user query message.\n * If the provided query text is not empty, then add the user query message to the chat history and invoke the assistant\n * Otherwise, just start a new chat with a warning message inviting the user to perform a full text search to retrieve some results\n * @param systemMsg - The system message to be displayed.\n * @param userMsg - The user message to be displayed.\n */\n private _handleQueryMode(systemMsg: ChatMessage, userMsg: ChatMessage) {\n if (!!this.query.text) {\n const userQueryMsg = {role: 'user', content: this.query.text, additionalProperties: {display: this.config.modeSettings.initialization.displayUserQuery, query: this.query, forcedWorkflow: this.config.modeSettings.initialization.forcedWorkflow, isUserInput: true, additionalWorkflowProperties: this.config.additionalWorkflowProperties}};\n if (this.config.modeSettings.sendUserPrompt) {\n this.openChat([systemMsg, userMsg, userQueryMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(userMsg, 1));\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userQueryMsg, 2), 'query': JSON.stringify(this.query) ,'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, '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('message', this._defineMessageAuditDetails(systemMsg, 0));\n this.chatService.generateAuditEvent('message', {...this._defineMessageAuditDetails(userQueryMsg, 1), 'query': JSON.stringify(this.query) ,'is-user-input': true, 'forced-workflow': this.config.modeSettings.initialization.forcedWorkflow, '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.config.globalSettings.searchWarningMessage, additionalProperties: {display: true}};\n this.openChat([systemMsg, warningMsg]);\n this.chatService.generateAuditEvent('message', this._defineMessageAuditDetails(warningMsg, 0));\n }\n }\n\n private _defineMessageAuditDetails(message: ChatMessage, rank: number): Record<string, any> {\n return {\n 'duration': 0,\n 'text': message.content,\n 'role': message.role,\n 'rank': rank\n };\n }\n\n /**\n * Start/open a new chat with the provided messages and chatId\n * If the last message is from the user, a request to the assistant is made to get an answer\n * If the last message is from the assistant, the conversation is loaded right away\n * @param messages The list of messages of the chat\n * @param savedChatId The id of the saved chat. If provided (ie. an existing discussion in the saved chat index), update the savedChatId in the chat service for the upcoming saved chat operations\n */\n openChat(messages: RawMessage[], savedChatId?: string) {\n if (!messages || !Array.isArray(messages)) {\n console.error('Error occurs while trying to load the discussion. Invalid messages received :', messages);\n return;\n }\n if (savedChatId) {\n this.chatService.setSavedChatId(savedChatId);\n this.chatService.generateChatId(savedChatId);\n }\n this.resetChat();\n this.messages$.next(messages);\n this.chatService.chatHistory = messages;\n const lastMessage = messages.at(-1);\n if(lastMessage && lastMessage.role === 'user') {\n this.fetch(messages); // If the last message if from a user, an answer from the assistant is expected\n }\n else {\n this.updateData(messages); // If the last message if from the assistant, we can load the conversation right away\n this.terminateFetch();\n }\n this._addScrollListener();\n }\n\n /**\n * Reset the chat by clearing the chat history and the UI accordingly\n * The user input will be cleared\n * The fetch subscription will be terminated\n */\n resetChat() {\n if(this.messages$.value) {\n this.messages$.next(undefined); // Reset chat\n }\n this.chatService.chatHistory = undefined; // Reset chat history\n this.question = '';\n this.terminateFetch();\n }\n\n /**\n * Fetch and Load the saved chat from the saved chat index.\n * If the saved chat is found, the chat discussion will be loaded with the provided messages and chatId\n */\n onLoadChat() {\n this.loading$.next(true);\n this._sub.add(\n this.chatService.loadSavedChat$\n .pipe(\n filter(savedChat => !!savedChat),\n switchMap(savedChat => this.chatService.getSavedChat(savedChat!.id)),\n filter(savedChatHistory => !!savedChatHistory),\n tap(savedChatHistory => this.openChat(savedChatHistory!.history, savedChatHistory!.id))\n ).subscribe()\n );\n }\n\n /**\n * Stop the generation of the current assistant's answer.\n * The fetch subscription will be terminated.\n */\n stopGeneration() {\n this.chatService.stopGeneration().subscribe(\n () => this.terminateFetch()\n );\n }\n\n /**\n * Terminate the fetch process by unsubscribing from the data subscription and updating the loading status to false.\n * Additionally, focus on the chat input if the focusAfterResponse flag is set to true.\n */\n terminateFetch() {\n this._dataSubscription?.unsubscribe();\n this._dataSubscription = undefined;\n this.loading$.next(false);\n this.cdr.detectChanges();\n\n if (this.focusAfterResponse) {\n setTimeout(() => {\n this.questionInput?.nativeElement.focus();\n });\n }\n }\n\n /**\n * Copy a previous user message of the chat history to the chat user input.\n * Thus, the user can edit and resubmit the message.\n * Once the edited message is submitted, all subsequent messages starting from @param index will be removed from the history and the UI will be updated accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the user's message to edit\n */\n editMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.messageToEdit = index;\n this.remappedMessageToEdit = this._remapIndexInChatHistory(index);\n this.question = this.chatService.chatHistory![this._remapIndexInChatHistory(index)].content;\n this.chatService.generateAuditEvent('edit.click', {'rank': this._remapIndexInChatHistory(index)});\n }\n\n /**\n * Copy a previous assistant message of the chat history to the clipboard.\n * @param index The index of the assistant's message to edit\n */\n copyMessage(index: number) {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(index);\n this.chatService.generateAuditEvent('copy.click', {'rank': idx});\n }\n\n /**\n * Starting from the provided index, remove all subsequent messages from the chat history and the UI accordingly.\n * The assistant will regenerate a new answer based on the updated chat history.\n * ⚠️ If the assistant is streaming or stopping the generation, the operation is not allowed.\n * @param index The index of the assistant's message to regenerate\n */\n regenerateMessage(index: number) {\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n // Update the messages in the UI by removing all subsequent 'assistant' messages starting from the provided index until the first previous 'user' message\n let i = index;\n while (i >= 0 && (this.messages$.value!)[i].role !== 'user') {\n i--;\n }\n // It should always be the case that i > 0\n if (i >= 0) {\n this.messages$.next(this.messages$.value!.slice(0, i+1));\n // Remap the index of this found first previous 'user' message in the chat history\n const idx = this._remapIndexInChatHistory(i);\n // Define and Update the chat history based on which the assistant will generate a new answer\n this.chatService.chatHistory = this.chatService.chatHistory!.slice(0, idx+1);\n // Fetch the answer\n this.fetch(this.chatService.chatHistory);\n this.chatService.generateAuditEvent('regenerate.click', {'rank': idx});\n }\n }\n\n /**\n * Remaps the index in the chat history.\n * The chat history is a list of messages where some messages can be hidden (display set to false).\n * The index provided as input is the index of the message in the chat history displayed in the UI.\n * This function should be removed once the backend is updated to add the ids of the messages in the chat history\n * @param index - The index to be remapped.\n */\n private _remapIndexInChatHistory(index: number) {\n // a copy of the chat history is created to avoid modifying the original chat history.\n // Additionally, a rank is giving to each message.\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n const history = this.chatService.chatHistory!\n .slice()\n .map((message, idx) => ({...message, additionalProperties: {...message.additionalProperties, rank: idx}}))\n .map((message) => {\n if (message.role === \"user\") {\n return {...message, additionalProperties: {...message.additionalProperties, display: true}}\n }\n return message;\n })\n // Count the number of hidden messages (of role different then \"user\") in messages$ before the provided index\n // All messages having role 'user' are updated with the display property set to true, this is mandatory to get the correct rank of the message in the chat history when the user message to remap is hidden\n // This is mandatory to get the correct rank of the message in the chat history\n // Since some hidden messages (like 'system' messages) are not displayed in the UI but have been counted in the provided index\n const numberOfHiddenMessagesInMessages$BeforeIndex = this.messages$.value!\n .slice(0, index)\n .map((message) => {\n if (message.role === \"user\") {\n return {...message, additionalProperties: {...message.additionalProperties, display: true}}\n }\n return message;\n })\n .filter(message => !message.additionalProperties.display).length;\n // remove all messages that have display set to false\n // this is mandatory since at the point of time when the assistant answers a question,\n // it might have some hidden messages (for example contextMessages) that are available in the chat history but don't figure in messages$ unless a new question is asked\n const filteredHistory = history.filter(message => message.additionalProperties.display);\n // return the index of the message in the filtered history\n return filteredHistory[index - numberOfHiddenMessagesInMessages$BeforeIndex].additionalProperties.rank;\n }\n\n /**\n * Handles the key up event for 'Backspace' and 'Enter' keys.\n * @param event - The keyboard event.\n */\n onKeyUp(event: KeyboardEvent): void {\n switch (event.key) {\n case 'Backspace':\n this.calculateHeight();\n break;\n case 'Enter':\n if (!event.shiftKey) {\n event.preventDefault();\n this.submitQuestion();\n }\n this.calculateHeight();\n break;\n default:\n break;\n }\n }\n\n /**\n * Calculates and adjusts the height of the question input element based on its content.\n * If the Enter key is pressed without the Shift key, it prevents the default behavior.\n * @param event The keyboard event\n */\n calculateHeight(event?: KeyboardEvent): void {\n if (event?.key === 'Enter' && !event.shiftKey) {\n event?.preventDefault();\n }\n const maxHeight = 170;\n const el = this.questionInput!.nativeElement;\n el.style.maxHeight = `${maxHeight}px`;\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n el.style.overflowY = el.scrollHeight >= maxHeight ? 'scroll' : 'hidden';\n }\n\n /**\n * Send a \"like\" event on clicking on the thumb-up icon of an assistant's message\n * @param message The assistant message to like\n * @param rank The rank of the message to like\n */\n onLike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('thumb-up.click', {rank: idx});\n this.reportType = 'like';\n this.messageToReport = message;\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$liked = true;\n this._updateChatHistory();\n }\n\n /**\n * Send a \"dislike\" event on clicking on the thumb-down icon of an assistant's message.\n * It also opens the issue reporting dialog.\n * @param message The assistant message to dislike\n * @param index The rank of the message to dislike\n */\n onDislike(message: ChatMessage, rank: number): void {\n // Remap the index in the chat history\n const idx = this._remapIndexInChatHistory(rank);\n this.chatService.generateAuditEvent('thumb-down.click', {rank: idx});\n this.reportType = 'dislike';\n this.messageToReport = message;\n this.issueType = '';\n this.reportComment = undefined;\n this.reportRank = rank;\n this.showReport = true\n\n this.chatService.chatHistory![this._remapIndexInChatHistory(rank)].additionalProperties.$disliked = true;\n this._updateChatHistory();\n }\n\n private _updateChatHistory(): void {\n this.messages$.next(this.chatService.chatHistory);\n if (this.chatService.savedChatId) {\n this.chatService.updateSavedChat(this.chatService.savedChatId, undefined, this.chatService.chatHistory).subscribe();\n }\n }\n\n /**\n * Report an issue related to the assistant's message.\n */\n sendReport(): void {\n const details = {\n 'comment': this.reportComment,\n 'text': this.messageToReport!.content,\n 'rank': this.reportRank,\n };\n if (this.reportType === 'dislike') {\n details['report-type'] = this.issueType;\n this.chatService.generateAuditEvent('negative-report.send', details);\n } else {\n this.chatService.generateAuditEvent('positive-report.send', details);\n }\n this.notificationsService.success('Your report has been successfully sent');\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 */\n openAttachmentPreview(data: {reference: ChatContextAttachment, partId?: number}) {\n this.openPreview.emit(data.reference);\n const details = {\n 'doc-id': data.reference.recordId,\n 'title': data.reference.record.title,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n };\n if(!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('attachment.preview.click', details);\n }\n\n /**\n * Handle the click on a reference's 'open original document'.\n * @param data\n */\n openOriginalAttachment(data: {reference: ChatContextAttachment, partId?: number}) {\n this.openDocument.emit(data.reference.record);\n const details = {\n 'doc-id': data.reference.recordId,\n 'title': data.reference.record.title,\n 'source': data.reference.record.treepath,\n 'collection': data.reference.record.collection,\n 'index': data.reference.record.databasealias,\n };\n if(!!data.partId) details['part-id'] = data.partId;\n this.chatService.generateAuditEvent('attachment.link.click', details);\n }\n\n /**\n * Handle the click on a suggested action.\n * @param action Suggested action.\n * @param index Rank of the message in the chatHistory related to the suggested action.\n */\n suggestActionClick(action: SuggestedAction, index: number) {\n this.suggestAction.emit(action);\n this.chatService.generateAuditEvent('suggestedAction.click', {'text': action.content, 'suggestedAction-type': action.type})\n }\n\n /**\n * It looks for the debug messages available in the current group of \"assistant\" messages.\n * By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n * @param index The rank of the message\n * @returns The debug messages available in the current group of \"assistant\" messages\n */\n getDebugMessages(index: number): DebugMessage[] {\n // If it is not an assistant message, return\n if ((this.messages$.value!)[index].role !== 'assistant') {\n return [];\n }\n // Get the array of messages up to the indicated index\n const array = this.messages$.value!.slice(0, index + 1);\n // If it is an assistant message, look for the debug messages available in the current group of \"assistant\" messages\n // By design, the debug messages are only available in the first visible message among the group \"assistant\" messages.\n const idx = this.chatService.firstVisibleAssistantMessageIndex(array);\n if (idx > -1) {\n return (this.messages$.value!)[idx].additionalProperties.$debug || [];\n }\n return [];\n }\n\n /**\n * Handle the click on the 'show log info' button of a message.\n * @param index The rank of the message\n */\n showDebug(index: number): void {\n this.debugMessages = this.getDebugMessages(index);\n this.showDebugMessages = true;\n this.cdr.detectChanges();\n }\n\n /**\n * Verify whether the current message is an assistant message and that all following messages are assistant ones\n * Used to keep the \"View progress\" opened even though the assistant is sending additional messages after the current one\n * @param messages the list of current messages\n * @param index the index of the current message\n * @returns if this messages and the following ones (if any) are the last ones\n */\n isAssistantLastMessages(messages: ChatMessage[], index: number): boolean {\n for (let i = index; i < messages.length; i++) {\n if (messages[i].role !== 'assistant') return false;\n }\n return true;\n }\n\n /**\n * Checks if the given message is an empty assistant message.\n * An empty assistant message is defined as a message with the role 'assistant',\n * an empty content, and no additional properties such as attachments, progress,\n * debug information, or suggested actions.\n *\n * @param message - The message to check.\n * @returns `true` if the message is an empty assistant message, `false` otherwise.\n */\n isEmptyAssistantMessage(message: ChatMessage | undefined): boolean {\n if (message?.role === 'assistant'\n && message?.content === \"\"\n && !message?.additionalProperties?.$attachment\n && !message?.additionalProperties?.$progress\n && !message?.additionalProperties?.$debug\n && !message?.additionalProperties?.$suggestedAction) {\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=\"list-group list-group-flush overflow-auto flex-grow-1 pe-2 pb-2\" #messageList>\n <ng-container *ngFor=\"let message of messages; let index = index; let last = last\">\n <!-- Regular messages -->\n <li class=\"list-group-item\"\n *ngIf=\"message.additionalProperties.display && !isEmptyAssistantMessage(message)\"\n [style.--bs-list-group-item-padding-y.rem]=\"'0.6'\"\n [class.opacity-50]=\"messageToEdit && (messageToEdit < (index + 1))\">\n <sq-chat-message\n [class.sq-user-message]=\"message.role === 'user'\"\n [class.last-message]=\"last\"\n [message]=\"message\"\n [conversation]=\"messages\"\n [suggestedActions]=\"last ? message.additionalProperties.$suggestedAction : undefined\"\n [assistantMessageIcon]=\"assistantMessageIcon\"\n [userMessageIcon]=\"userMessageIcon\"\n [connectionErrorMessageIcon]=\"connectionErrorMessageIcon\"\n [searchWarningMessageIcon]=\"searchWarningMessageIcon\"\n [streaming]=\"(chatService.streaming$ | async) && (last || isAssistantLastMessages(messages, index))\"\n [canEdit]=\"(chatService.streaming$ | async) === false && messageToEdit === undefined && message.role === 'user'\"\n [canCopy]=\"((chatService.streaming$ | async) === false || !last) && messageToEdit === undefined && message.role !== 'connection-error' && message.role !== 'search-warning'\"\n [canLike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDislike]=\"((chatService.streaming$ | async) === false || !last) && message.role === 'assistant'\"\n [canDebug]=\"(((chatService.streaming$ | async) === false && last) || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && isAdmin && (getDebugMessages(index).length > 0) && config?.defaultValues.debug\"\n [canRegenerate]=\"(chatService.streaming$ | async) === false && (last || (!last && messages[index+1].role !== 'assistant')) && message.role === 'assistant' && messageToEdit === undefined\"\n (edit)=\"editMessage(index)\"\n (copy)=\"copyMessage(index)\"\n (regenerate)=\"regenerateMessage(index)\"\n (openDocument)=\"openOriginalAttachment($event)\"\n (openPreview)=\"openAttachmentPreview($event)\"\n (suggestAction)=\"suggestActionClick($event, index)\"\n (like)=\"onLike(message, index)\"\n (dislike)=\"onDislike(message, index)\"\n (debug)=\"showDebug(index)\">\n </sq-chat-message>\n </li>\n </ng-container>\n <!-- Loading spinner -->\n <li class=\"list-group-item\" *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 pt-3 pb-2\" *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 <div class=\"user-input mt-auto\" *ngIf=\"!showReport\">\n <div class=\"py-2\">\n <div [hidden]=\"!isConnected\">\n <ng-container *ngIf=\"enabledUserInput\" [ngTemplateOutlet]=\"inputTpl\"></ng-container>\n </div>\n <!-- Retry button -->\n <button [hidden]=\"isConnected\" class=\"btn mb-4 ast-error ast-btn sq-retry\" (click)=\"retryFetch()\">\n <span>Try again</span>\n <span *ngIf=\"retrialAttempts\" class=\"ms-2 attempts\">{{ retrialAttempts }}</span>\n </button>\n <div class=\"text-end small text-muted px-3\" *ngIf=\"!!config?.globalSettings?.disclaimer\">\n {{ config?.globalSettings?.disclaimer }}\n </div>\n </div>\n </div>\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()\">\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\">Loading...</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\">\n <i class=\"fas fa-search\"></i>\n </button>\n <textarea #questionInput rows=\"1\"\n type=\"text\" class=\"form-control\"\n placeholder=\"Ask something\" 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 <button\n *ngIf=\"!(chatService.streaming$ | async) && !(loading$ | async) && !(chatService.stoppingGeneration$ | async)\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Send message\"\n (click)=\"submitQuestion()\">\n <i class=\"fas fa-paper-plane\"></i>\n </button>\n <button\n *ngIf=\"messageToEdit\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Cancel edition\"\n (click)=\"messageToEdit = undefined; question = ''\">\n <i class=\"fas fa-undo-alt\"></i>\n </button>\n <span *ngIf=\"(chatService.streaming$ | async) && !(chatService.stoppingGeneration$ | async)\" class=\"processing ms-2\">\n Generating <i class=\"ms-1 fas fa-spinner fa-pulse\"></i>\n </span>\n <span *ngIf=\"(chatService.stoppingGeneration$ | async)\" class=\"processing ms-2\">\n Stopping <i class=\"ms-1 fas fa-spinner fa-pulse\"></i>\n </span>\n <button\n *ngIf=\"(chatService.streaming$ | async) && !(chatService.stoppingGeneration$ | async)\"\n type=\"button\"\n class=\"btn btn-light ms-2\"\n sqTooltip=\"Stop generating\"\n (click)=\"stopGeneration()\">\n <i class=\"fas fa-stop\"></i>\n </button>\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>Issue type</h5>\n <select class=\"form-select mb-4\" [(ngModel)]=\"issueType\">\n <option [value]=\"''\">Choose an issue type</option>\n <option *ngFor=\"let type of (issueTypes ?? defaultIssueTypes)\">{{type}}</option>\n </select>\n <h5>What was unsatisfying about this response? (optional)</h5>\n </ng-container>\n <ng-container *ngIf=\"type === 'like'\">\n <h5>Why did you like this answer? (optional)</h5>\n </ng-container>\n <textarea class=\"form-control\" [(ngModel)]=\"reportComment\" placeholder=\"Write your comment\"></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()\">Send</button>\n <button class=\"btn btn-light\" (click)=\"ignoreReport()\">Do not send report</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\">\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, EventEmitter, Input, OnDestroy, OnInit, Output, inject } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { Validators } from '@angular/forms';\nimport { Subscription, catchError, filter, switchMap, tap, throwError, BehaviorSubject } from \"rxjs\";\nimport { LoginService } from \"@sinequa/core/login\";\nimport { ConfirmType, ModalButton, ModalResult, ModalService, PromptOptions, ModalModule } from \"@sinequa/core/modal\";\nimport { NotificationsService } from \"@sinequa/core/notification\";\nimport { UtilsModule } from \"@sinequa/components/utils\";\nimport { format, parseISO, isToday, isYesterday, isThisWeek, isThisMonth, isThisQuarter, isThisYear, endOfYesterday, differenceInDays, differenceInMonths, differenceInYears, toDate } from 'date-fns';\nimport { ChatService } from \"../chat.service\";\nimport { SavedChat } from \"../types\";\nimport { InstanceManagerService } from \"../instance-manager.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 imports: [CommonModule, ModalModule, UtilsModule]\n})\nexport class SavedChatsComponent implements OnInit, OnDestroy {\n /** Define the key based on it, the appropriate chatService instance will be returned from instanceManagerService */\n @Input() instanceId: string;\n\n @Output() load = new EventEmitter<SavedChat>();\n @Output() delete = new EventEmitter<SavedChat>();\n\n chatService: ChatService;\n subscription = new Subscription();\n groupedSavedChats$ = new BehaviorSubject<{ key: string; value: SavedChat[]}[]>([]);\n\n public loginService = inject(LoginService);\n public instanceManagerService = inject(InstanceManagerService);\n public modalService = inject(ModalService);\n public notificationsService = inject(NotificationsService);\n\n ngOnInit(): void {\n this.subscription.add(\n this.loginService.events.pipe(\n filter(e => e.type === 'login-complete'),\n tap(_ => this.instantiateChatService()),\n switchMap(_ => this.chatService.userOverride$),\n tap(_ => {\n this.onListSavedChat();\n this.chatService.listSavedChat();\n })\n ).subscribe()\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n instantiateChatService(): void {\n this.chatService = this.instanceManagerService.getInstance(this.instanceId);\n }\n\n onListSavedChat() {\n this.subscription.add(\n this.chatService.savedChats$.subscribe(\n (savedChats: SavedChat[]) => {\n 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.setSavedChatId(savedChat.id);\n this.chatService.generateChatId(savedChat.id);\n this.chatService.loadSavedChat$.next(savedChat);\n this.chatService.generateAuditEvent('saved-chat.load', {}, savedChat.id);\n this.chatService.listSavedChat();\n this.load.emit(savedChat);\n }\n\n onRename(event: Event, savedChat: SavedChat) {\n event.stopPropagation();\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n const model: PromptOptions = {\n title: 'Rename saved discussion',\n message: `Please enter a new name for the discussion \"${savedChat.title}\".`,\n buttons: [\n new ModalButton({result: ModalResult.Cancel}),\n new ModalButton({result: ModalResult.OK, text: \"Rename\", primary: true})\n ],\n output: savedChat.title,\n validators: [Validators.required]\n };\n\n this.modalService.prompt(model).then(res => {\n if(res === ModalResult.OK) {\n this.subscription.add(\n this.chatService.updateSavedChat(savedChat.id, model.output)\n .pipe(\n tap(() => {\n this.notificationsService.success(`The saved discussion \"${savedChat.title}\" has been successfully renamed to \"${model.output}\".`);\n this.chatService.listSavedChat();\n }),\n catchError((error) => {\n console.error('Error occurred while updating the saved chat:', error);\n this.notificationsService.error(`Error occurred while updating the saved discussion \"${savedChat.title}\"`);\n return throwError(() => error);\n })\n ).subscribe()\n );\n this.chatService.generateAuditEvent('saved-chat.rename', {'text': model.output}, savedChat.id);\n }\n });\n }\n\n onDelete(event: Event, savedChat: SavedChat) {\n event.stopPropagation();\n if (!!this.chatService.streaming$.value || !!this.chatService.stoppingGeneration$.value) {\n return;\n }\n this.modalService\n .confirm({\n title: \"Delete saved discussion\",\n message: `You are about to delete the discussion \"${savedChat.title}\". Do you want to continue?`,\n buttons: [\n new ModalButton({result: ModalResult.Cancel}),\n new ModalButton({result: ModalResult.OK, text: \"Confirm\", primary: true})\n ],\n confirmType: ConfirmType.Warning\n }).then(res => {\n if(res === ModalResult.OK) {\n this.subscription.add(\n this.chatService.deleteSavedChat([savedChat.id])\n .pipe(\n tap(() => {\n this.notificationsService.success(`The saved discussion \"${savedChat.title}\" has been successfully deleted.`);\n this.delete.emit(savedChat);\n this.chatService.listSavedChat();\n }),\n catchError((error) => {\n console.error('Error occurred while deleting the saved chat:', error);\n this.notificationsService.error(`Error occurred while deleting the saved discussion \"${savedChat.title}\"`);\n return throwError(() => error);\n })\n ).subscribe()\n );\n this.chatService.generateAuditEvent('saved-chat.delete', {}, savedChat.id);\n }\n });\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._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 _getTimeKey(date: Date): string {\n if (isToday(date)) {\n return 'Today';\n } else if (isYesterday(date)) {\n return 'Yesterday';\n } else if (isThisWeek(date)) {\n return 'This week';\n } else if (differenceInDays(endOfYesterday(), date) <= 7) {\n return 'Last week';\n } else if (isThisMonth(date)) {\n return 'This month';\n } else if (differenceInMonths(endOfYesterday(), date) <= 1) {\n return 'Last month';\n } else if (isThisQuarter(date)) {\n return 'This quarter';\n } else if (differenceInMonths(endOfYesterday(), date) <= 3) {\n return 'Last quarter';\n } else if (isThisYear(date)) {\n return 'This year';\n } else if (differenceInYears(endOfYesterday(), date) === 1) {\n return 'Last year';\n } else {\n return format(date, 'yyyy');\n }\n }\n\n}\n","<ng-container *ngIf=\"(chatService.assistantConfig$ | async)?.savedChatSettings.display\">\n <div *ngFor=\"let group of (groupedSavedChats$ | async)\" class=\"saved-chats\">\n <div class=\"saved-chat-date\">{{group.key}}</div>\n <div *ngFor=\"let savedChat of group.value\"\n (click)=\"onLoad(savedChat)\"\n class=\"saved-chat p-2\"\n [class.forbidden]=\"(chatService.streaming$ | async) || (chatService.stoppingGeneration$ | async)\"\n [class.active]=\"chatService.savedChatId === savedChat.id\">\n <span class=\"title me-1\">{{savedChat.title}}</span>\n <i class=\"saved-chat-actions fas fa-pen mx-1\" [sqTooltip]=\"'Rename'\"\n (click)=\"onRename($event, savedChat)\"></i>\n <i class=\"saved-chat-actions fas fa-trash ms-1\" [sqTooltip]=\"'Delete'\"\n (click)=\"onDelete($event, savedChat)\"></i>\n </div>\n </div>\n</ng-container>\n","export default {\n \"assistant\": {}\n}\n","export default {\n \"assistant\": {}\n}\n","export default {\n \"assistant\": {}\n}\n","import { Utils } from '@sinequa/core/base';\nimport _enAssistant from './en';\nimport _frAssistant from './fr';\nimport _deAssistant from './de';\n\nconst enAssistant = Utils.merge({}, _enAssistant);\nconst frAssistant = Utils.merge({}, _frAssistant);\nconst deAssistant = Utils.merge({}, _deAssistant);\n\nexport { enAssistant, frAssistant, deAssistant };\n","import { Component, Inject, OnDestroy, OnInit } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport { UntypedFormControl, UntypedFormBuilder, Validators, UntypedFormGroup } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { MODAL_MODEL, PromptOptions, ModalRef, ModalButton, ModalResult } from \"@sinequa/core/modal\";\nimport { Utils } from '@sinequa/core/base';\nimport { BsModalModule } from \"@sinequa/components/modal\";\nimport { ValidationModule } from \"@sinequa/core/validation\";\nimport { ReactiveFormsModule } from \"@angular/forms\";\nimport { IntlModule } from \"@sinequa/core/intl\";\n\n@Component({\n selector: \"sq-chat-prompt\",\n template: `\n <form name=\"prompt\" novalidate [formGroup]=\"form\">\n <sq-modal [title]=\"title\" [buttons]=\"buttons\">\n <div class=\"mb-3 sq-form-group\">\n <label class=\"form-label\" for=\"input\">{{model.message | sqMessage:model.messageParams}}</label>\n <input [sqValidation]=\"form\" type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"off\" sqAutofocus *ngIf=\"!model.rowCount\">\n <textarea [sqValidation]=\"form\" type=\"text\" class=\"form-control\" id=\"input\" formControlName=\"input\" spellcheck=\"on\" rows=\"{{model.rowCount}}\" sqAutofocus *ngIf=\"!!model.rowCount\">\n </textarea>\n </div>\n </sq-modal>\n </form>\n `,\n standalone: true,\n imports: [CommonModule, BsModalModule, ValidationModule, ReactiveFormsModule, IntlModule],\n})\nexport class ChatPrompt implements OnInit, OnDestroy {\n inputControl: UntypedFormControl;\n form: UntypedFormGroup;\n formChanges: Subscription;\n defaultButtons: ModalButton[];\n\n constructor(\n @Inject(MODAL_MODEL) public model: PromptOptions,\n protected modalRef: ModalRef,\n protected formBuilder: UntypedFormBuilder) {\n this.defaultButtons = [\n new ModalButton({\n result: ModalResult.OK,\n primary: true,\n validation: this.form\n }),\n new ModalButton({\n result: ModalResult.Cancel\n })\n ];\n }\n\n ngOnInit() {\n this.inputControl = new UntypedFormControl(this.model.output, this.model.validators || Validators.required);\n this.form = this.formBuilder.group({\n input: this.inputControl\n });\n this.formChanges = Utils.subscribe(this.form.valueChanges,\n (value) => {\n this.model.output = this.inputControl.value;\n });\n }\n\n ngOnDestroy() {\n this.formChanges.unsubscribe();\n }\n\n get title(): string {\n return this.model.title ? this.model.title : \"msg#modal.prompt.title\";\n }\n\n get buttons(): ModalButton[] {\n return (this.model.buttons && this.model.buttons.length > 0) ? this.model.buttons : this.defaultButtons;\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i2","Prism","i3","i5","i6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGG;MAIU,sBAAsB,CAAA;AAHnC,IAAA,WA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