import * as i0 from '@angular/core'; import { OnChanges, EventEmitter, SimpleChanges, ChangeDetectorRef, OnDestroy, ElementRef, TemplateRef, AfterViewInit, OnInit } from '@angular/core'; import * as _sinequa_core_web_services from '@sinequa/core/web-services'; import { AuditWebService, Results, Answer, Record as Record$1, MatchingPassage, TopPassage, TextChunksWebService, JsonMethodPluginService, UserSettingsWebService, RelevantExtract, SimilarityParams, DocumentSimilarityService, SimilarDocument } from '@sinequa/core/web-services'; import * as rxjs from 'rxjs'; import { Observable, BehaviorSubject, Subject, Subscription } from 'rxjs'; import { AbstractFacet } from '@sinequa/components/facet'; import { SearchService } from '@sinequa/components/search'; import * as _sinequa_core_app_utils from '@sinequa/core/app-utils'; import { AppService, Query } from '@sinequa/core/app-utils'; import { NotificationsService } from '@sinequa/core/notification'; import * as i13 from '@sinequa/components/action'; import { Action } from '@sinequa/components/action'; import { UserPreferences } from '@sinequa/components/user-settings'; import { LoginService } from '@sinequa/core/login'; import { ModalService } from '@sinequa/core/modal'; import * as unist from 'unist'; import { Node } from 'unist'; import { Processor } from 'unified'; import * as i11 from '@sinequa/components/utils'; import { UIService } from '@sinequa/components/utils'; import * as i8 from '@angular/common'; import * as i9 from '@sinequa/components/result'; import * as i10 from '@sinequa/core/intl'; import * as i12 from '@angular/forms'; import * as i14 from 'ngx-remark'; declare class AnswerCardComponent extends AbstractFacet implements OnChanges { searchService: SearchService; appService: AppService; auditService: AuditWebService; notificationsService: NotificationsService; results: Results; collapsed: boolean; showLikeButtons: boolean; hideDate: boolean; dateFormat: Intl.DateTimeFormatOptions; previewOpened: EventEmitter<{ score: number; text: string; passage: { id: number; location: number[]; rlocation: number[]; highlightedText: string; }; recordId: string; "af.score": number; "rm.score": number; $record?: { id: string; $selected: boolean; matchlocations: string[]; rank: number; databasealias: string; matchingpartnames: string[]; matchlocationsperpartname: { matchlocations: { data: string; partname: string; }[]; }[]; documentlanguages: string[]; documentweight: string; modified: string; indexationtime: string; version: string; title: string; size: number; treepath: string[]; filename: string; fileext: string; flags: string[]; collection: string[]; docformat: string; url1: string; text: string; authors: string[]; rfmEnabled: boolean; termspresence: { term: string; presence: "found" | "missing"; }[]; $isDuplicate: boolean; $duplicateCount: number; globalrelevance?: number | undefined; displayTitle?: string | undefined; doctype?: string | undefined; url2?: string | undefined; relevantExtracts?: string | undefined; extracts?: { score: number; highlighted: string; locations: string; originalLocations: string; partname?: string | undefined; }[] | undefined; accesslists?: { accessListIndices: number[]; authorizedLists: { domain: string; id: string; }[]; deniedLists: { domain: string; id: string; }[]; } | undefined; thumbnailUrl?: string | undefined; originalUrl?: string | undefined; pdfUrl?: string | undefined; rfm?: { click?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; like?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; important?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; } | undefined; groupcount?: number | undefined; nearhash?: string | undefined; exacthash?: string | undefined; containerid?: string | undefined; $page?: number | undefined; matchingpassages?: { passages: { id: number; score: number; location: number[]; rlocation: number[]; highlightedText: string; $expanded?: boolean | undefined; }[]; } | undefined; $hasPassages?: boolean | undefined; } | undefined; $liked?: boolean | undefined; }>; titleClicked: EventEmitter<{ item: Answer; isLink: boolean; }>; selectedAnswer: number; answer$: Observable; get answers(): Answer[]; constructor(searchService: SearchService, appService: AppService, auditService: AuditWebService, notificationsService: NotificationsService); ngOnChanges(changes: SimpleChanges): void; openPreview(answer: Answer): void; onTitleClicked(isLink: boolean, answer: Answer): void; previous(): void; next(): void; setAnswer(): void; likeAnswer(answer: Answer): void; dislikeAnswer(answer: Answer): void; private setLiked; private notifyAnswer; private notifyAnswerResult; private makeAuditEvent; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class PassageListComponent implements OnChanges { record: Record$1; maxPassages?: number; passageId?: string; ngOnChanges(changes: SimpleChanges): void; expand(passage: MatchingPassage): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class TopPassagesComponent extends AbstractFacet implements OnChanges { private auditService; private searchService; cdRef: ChangeDetectorRef; results: Results; hideDate: boolean; dateFormat: Intl.DateTimeFormatOptions; passageClicked: EventEmitter<{ id: number; score: number; location: [number, number]; text: string; recordId: string; index: string; $record?: { id: string; $selected: boolean; matchlocations: string[]; rank: number; databasealias: string; matchingpartnames: string[]; matchlocationsperpartname: { matchlocations: { data: string; partname: string; }[]; }[]; documentlanguages: string[]; documentweight: string; modified: string; indexationtime: string; version: string; title: string; size: number; treepath: string[]; filename: string; fileext: string; flags: string[]; collection: string[]; docformat: string; url1: string; text: string; authors: string[]; rfmEnabled: boolean; termspresence: { term: string; presence: "found" | "missing"; }[]; $isDuplicate: boolean; $duplicateCount: number; globalrelevance?: number | undefined; displayTitle?: string | undefined; doctype?: string | undefined; url2?: string | undefined; relevantExtracts?: string | undefined; extracts?: { score: number; highlighted: string; locations: string; originalLocations: string; partname?: string | undefined; }[] | undefined; accesslists?: { accessListIndices: number[]; authorizedLists: { domain: string; id: string; }[]; deniedLists: { domain: string; id: string; }[]; } | undefined; thumbnailUrl?: string | undefined; originalUrl?: string | undefined; pdfUrl?: string | undefined; rfm?: { click?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; like?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; important?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; } | undefined; groupcount?: number | undefined; nearhash?: string | undefined; exacthash?: string | undefined; containerid?: string | undefined; $page?: number | undefined; matchingpassages?: { passages: { id: number; score: number; location: number[]; rlocation: number[]; highlightedText: string; $expanded?: boolean | undefined; }[]; } | undefined; $hasPassages?: boolean | undefined; } | undefined; answer?: string | undefined; answerScore?: number | undefined; }>; documentOpened: EventEmitter<{ id: string; $selected: boolean; matchlocations: string[]; rank: number; databasealias: string; matchingpartnames: string[]; matchlocationsperpartname: { matchlocations: { data: string; partname: string; }[]; }[]; documentlanguages: string[]; documentweight: string; modified: string; indexationtime: string; version: string; title: string; size: number; treepath: string[]; filename: string; fileext: string; flags: string[]; collection: string[]; docformat: string; url1: string; text: string; authors: string[]; rfmEnabled: boolean; termspresence: { term: string; presence: "found" | "missing"; }[]; $isDuplicate: boolean; $duplicateCount: number; globalrelevance?: number | undefined; displayTitle?: string | undefined; doctype?: string | undefined; url2?: string | undefined; relevantExtracts?: string | undefined; extracts?: { score: number; highlighted: string; locations: string; originalLocations: string; partname?: string | undefined; }[] | undefined; accesslists?: { accessListIndices: number[]; authorizedLists: { domain: string; id: string; }[]; deniedLists: { domain: string; id: string; }[]; } | undefined; thumbnailUrl?: string | undefined; originalUrl?: string | undefined; pdfUrl?: string | undefined; rfm?: { click?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; like?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; important?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; } | undefined; groupcount?: number | undefined; nearhash?: string | undefined; exacthash?: string | undefined; containerid?: string | undefined; $page?: number | undefined; matchingpassages?: { passages: { id: number; score: number; location: number[]; rlocation: number[]; highlightedText: string; $expanded?: boolean | undefined; }[]; } | undefined; $hasPassages?: boolean | undefined; }>; passages?: TopPassage[]; documentsNb: number; constructor(auditService: AuditWebService, searchService: SearchService, cdRef: ChangeDetectorRef); ngOnChanges(): void; fetchPassagesRecords(passages: TopPassage[]): void; openPreview(passage: TopPassage): void; onTitleClicked(isLink: boolean, passage: TopPassage): void; private notifyTopPassagesClick; private notifyTopPassagesDisplay; private makeAuditEvent; isHidden(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface Chunk { offset: number; length: number; } /** * Individual message sent & returned by the ChatGPT API. * If this message is an attachment, we attach the minimal * information needed to reconstruct this attachment (RawAttachment) * as well as the reference id computed at the moment of sending * the attachment to the API. */ interface RawMessage { role: string; content: string; display: boolean; /** Messages from the user can have attachments */ $attachment?: RawAttachment; /** Reference of this attachment in the contexte of the conversation */ $refId?: number; /** Optionally include a custom action suggested by the assistant */ $actions?: Action[]; } /** * A chat message that has been processed to include the markdown-formatted * content for display, as well as detailed attachment data, and optionally * a list of the references extracted from that message */ interface ChatMessage extends RawMessage { /** Messages from the user can have attachments */ $attachment?: ChatAttachment; } /** * Minimal information necessary to reconstruct an attachment */ interface RawAttachment { recordId: string; chunks: DocumentChunk[]; } /** * Chunk of text extracted from a document at a specific location */ interface DocumentChunk { offset: number; length: number; text: string; } /** * Chat attachment for which we know the text and the source * record object */ interface ChatAttachment extends RawAttachment { /** Record from which this this attachment is taken */ $record: Record$1; /** Whether the attachment is displayed expanded of not */ $expanded?: boolean; } interface ChatAttachmentOpen extends ChatAttachment { $chunkIndex: number; } /** * Chat Attachment for which we know the number * of tokens it consumes */ interface ChatAttachmentWithTokens extends ChatAttachment { /** Number of tokens of this message */ $tokenCount: number; } /** * Information provided by the API about the number of tokens consumed * by the current conversation */ type GllmTokens = { used: number; model: number; }; /** * Information provided by the API about the number of tokens consumed * across all conversations */ type GllmTokenQuota = { tokenCount: number; periodTokens: number; resetHours: number; lastResetUTC: string; nextResetUTC: string; }; /** * Raw response of the API */ interface RawResponse { messagesHistory: RawMessage[]; tokens: number; streaming?: boolean; } /** * Enriched response of the API */ interface ChatResponse extends RawResponse { messagesHistory: ChatMessage[]; } /** * Model names supported by the API */ type GllmModel = "GPT35Turbo" | "GPT4-8K" | "GPT4-32K" | "Chat-Bison-001" | "command-xlarge-nightly"; type GllmProvider = "OpenAI" | "Google" | "Cohere"; interface GllmModelDescription { name: GllmModel; displayName: string; provider: GllmProvider; size: number; eventStream: boolean; } /** * Minimal data structure saved to reconstruct a conversation */ interface SavedChat { name: string; messages: RawMessage[]; tokens: GllmTokens; } interface SearchAttachmentsOptions { /** Max number of top passages to include */ maxTopPassages: number; /** Minimum score a top passage should have to be included */ minScoreTopPassage: number; /** Max number of documents to include */ maxDocuments: number; /** Minimum global relevance that a document should have to be included */ minDocumentRelevance: number; /** Max number of relevant extracts to include for one document */ maxExtractsPerDocument: number; /** Max number of matching passages to include for one document */ maxPassagesPerDocument: number; /** Length of the document to include from offset 0 (not tied to a specific snippet, just the beginning of the document) */ startLengthPerDocument: number; /** Number of sentences to extend before each snippet */ extendBefore: number; /** Number of sentences to extend after each snippet */ extendAfter: number; } declare const defaultSearchAttachmentsOptions: SearchAttachmentsOptions; declare class ChatService { textChunksService: TextChunksWebService; jsonMethodWebService: JsonMethodPluginService; searchService: SearchService; userSettingsService: UserSettingsWebService; modalService: ModalService; notificationsService: NotificationsService; auditService: AuditWebService; prefs: UserPreferences; loginService: LoginService; /** When 2 passages in a document are within this number of characters, we merge them */ chunkMargin: number; /** * Global list of attachments fed by various methods from the ChatService, * such as: searchAttachments, addAttachments, removeAttachment... */ attachments$: BehaviorSubject; /** LLM used for computing the number of tokens in text */ attachmentModel: GllmModel; /** Name of the GLLM plugin */ GLLM_PLUGIN: string; /** Metadata possibly included in the attachments */ availableAttachmentMetadata: { field: string; name?: string; formatter?: (value: any) => string; }[]; defaultAttachmentMetadata: string[]; initialized$: BehaviorSubject; models?: GllmModelDescription[]; quota?: GllmTokenQuota; quotaPercentage: number; constructor(textChunksService: TextChunksWebService, jsonMethodWebService: JsonMethodPluginService, searchService: SearchService, userSettingsService: UserSettingsWebService, modalService: ModalService, notificationsService: NotificationsService, auditService: AuditWebService, prefs: UserPreferences, loginService: LoginService); /** * Calls the ChatGPT API to retrieve a new message given all previous messages */ fetch(messages: ChatMessage[], name: GllmModel, temperature: number, generateTokens: number, topP: number, context?: string, stream?: boolean): Observable; fetchAll(data: any): Observable; fetchStream(data: any): Observable; /** * Returns the number of tokens taken by the given text */ count(text: string[], model: GllmModel): Observable; /** * Return the list of OpenAI models available on the server */ listModels(): Observable; /** * Return the number of tokens left for the current user */ getQuota(): Observable; /** * Fetch document text chunks from the standard Sinequa API */ fetchChunks(id: string, chunks: { offset: number; length: number; }[], sentencesBefore?: number, sentencesAfter?: number): Observable<_sinequa_core_web_services.TextChunk[]>; /** * Takes a list of ChatMessage and strips it from its * optional data ($content, $record, etc.) so that it can be sent * to the chat, or saved in the user settings */ cleanMessages(messagesHistory: ChatMessage[], minimize?: boolean): RawMessage[]; /** * Given a list of raw messages (typically from a saved chat), * this function reconstructs all the necessary data (records, attachments...) * and returns a list of ChatMessage objects ready to be displayed */ restoreMessages(messages: RawMessage[]): Observable; processResponse(messages: ChatMessage[], response: RawResponse): { tokens: number; messagesHistory: ChatMessage[]; }; /** * Given a list of attachments this function generates * a list of chat messages with the formatted attachment as content. */ prepareAttachmentMessages(attachments: ChatAttachment[], conversation: ChatMessage[], display: boolean): ChatMessage[]; protected formatContent(id: number, record: Record$1, text: string[]): string; /** * Get the model description for the given model name */ getModel(name: GllmModel): GllmModelDescription | undefined; /** * Use Sinequa to retrieve relevant passages for the given text query * When relevant content is retrieved, the attachments$ subject is * upated. */ searchAttachments(results: Results, options: Partial): Observable; /** * Automatically search attachments in the results yielded by the given query */ searchAttachmentsSync(query: _sinequa_core_app_utils.Query | undefined, options: Partial): rxjs.Subscription; protected passagesWithRecords(passages: TopPassage[], records: (Record$1 | undefined)[], retrieveRecords?: boolean): Observable<{ $record: Record$1; location: number[]; }[]>; /** * Get the list of chunks currently present in the attachments for * a given record id (and return an empty list if there is none) */ protected getChunks(recordId: string): DocumentChunk[]; /** * Adds a list of text chunks from a record to the list of attachments. * If the record was already in the attachments, it will merge * the new chunks into the existing ones. */ addChunks($record: Record$1, _chunks: { offset: number; length: number; }[], sentencesBefore?: number, sentencesAfter?: number): Observable; /** * Increase the size of all the chunks in an attachment */ increaseChunks(attachment: ChatAttachmentWithTokens, sentencesBefore?: number, sentencesAfter?: number): Observable<{ $expanded: boolean | undefined; $tokenCount: number; $record: Record$1; recordId: string; chunks: DocumentChunk[]; }>; increaseChunksSync(attachment: ChatAttachmentWithTokens, sentencesBefore?: number, sentencesAfter?: number): void; /** * Take in a list of chat attachment and enriches it with the number of tokens of each one */ countChunks(attachments: ChatAttachment[]): Observable; /** * Removes a document chunk from an attachment and update the list * of attachments. * If this was the last chunk, the attachment is removed altogether. */ removeChunk(attachment: ChatAttachmentWithTokens, chunk: DocumentChunk): void; /** * Add a list of records as attachments */ addDocuments(records: Record$1[], includeStart?: number, includeExtracts?: number, includePassages?: number, sentencesBefore?: number, sentencesAfter?: number): Observable; addDocumentsSync(records: Record$1[], includeStart?: number, includeExtracts?: number, includePassages?: number, sentencesBefore?: number, sentencesAfter?: number): void; /** * Returns a (truncated) document attachment */ addDocument(record: Record$1, chunks?: Chunk[], includeStart?: number, includeExtracts?: number, includePassages?: number, sentencesBefore?: number, sentencesAfter?: number): Observable; addDocumentSync(record: Record$1, chunks?: Chunk[], includeStart?: number, includeExtracts?: number, includePassages?: number, sentencesBefore?: number, sentencesAfter?: number): void; /** * Preprocess top passage to ensure they have a record object and add them * via the addPassages method */ addTopPassages(passages: TopPassage[], records?: Record$1[], sentencesBefore?: number, sentencesAfter?: number): Observable; addTopPassagesSync(passages: TopPassage[], records?: Record$1[], sentencesBefore?: number, sentencesAfter?: number): void; protected groupPassages(passages: { $record: Record$1; location: number[]; }[]): { $record: Record$1; chunks: Chunk[]; }[]; /** * Take a list of passages (typically "top passages"), group them by record id * and for each record generate an attachment (merged with potential existing attachments) */ addPassages(passages: { $record: Record$1; location: number[]; }[], sentencesBefore?: number, sentencesAfter?: number): Observable[]; addPassagesSync(passages: { $record: Record$1; location: number[]; }[], sentencesBefore?: number, sentencesAfter?: number): void; /** * Add relevant extracts to the attachments. * There must be at least one extract. */ addExtracts(record: Record$1, extracts: RelevantExtract[], sentencesBefore?: number, sentencesAfter?: number): Observable; addExtractsSync(record: Record$1, extracts: RelevantExtract[], sentencesBefore?: number, sentencesAfter?: number): void; protected getExtractChunks(extracts: RelevantExtract[]): { offset: number; length: number; }[]; /** * Updates the list of attachments with a new attachment, * replacing the existing attachment for that record if it exists */ addAttachments(attachments: ChatAttachmentWithTokens[]): void; /** * Replace an old attachment with a new one */ protected spliceAttachment(old: ChatAttachmentWithTokens, replace?: ChatAttachmentWithTokens): void; /** * Remove an attachment */ removeAttachment(attachment: ChatAttachmentWithTokens): void; savedChats$: Subject; /** * Chats saved by the user to reopen them later */ get savedChats(): SavedChat[]; /** * Returns the saved chat with the given name */ getSavedChat(name: string): SavedChat | undefined; /** * Save a agiven chat in the user settings */ saveChat(savedChat: SavedChat): void; /** * Delete a given chat */ deleteSavedChat(name: string, skipSync?: boolean): void; syncSavedChats(): Observable; /** * Open a prompt to let the user pick a name for a saved chat. * If the user obliges the chat is saved. */ saveChatModal(conversation: ChatMessage[], tokens: GllmTokens): void; notifyAudit(messagesHistory: ChatMessage[], model: string, tokens: number): void; get attachmentMetadata(): string[]; set attachmentMetadata(metadata: string[]); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } interface ChatConfig extends SearchAttachmentsOptions { model: GllmModel; temperature: number; topP: number; maxTokens: number; googleContextPrompt: string; stream: boolean; textBeforeAttachments: boolean; displayAttachments: boolean; initialSystemPrompt: string; initialUserPrompt: string; addAttachmentPrompt: string; addAttachmentsPrompt: string; attachmentsHiddenPrompt: string; } declare const defaultChatConfig: ChatConfig; interface InitChat { messages: RawMessage[]; tokens?: GllmTokens; attachments?: Observable; } declare class ChatComponent extends AbstractFacet implements OnChanges, OnDestroy { chatService: ChatService; searchService: SearchService; cdr: ChangeDetectorRef; chat?: InitChat; enableChat: boolean; searchMode: boolean; model: GllmModel; temperature: number; topP: number; maxTokens: number; googleContextPrompt: string; stream: boolean; textBeforeAttachments: boolean; displayAttachments: boolean; showCredits: boolean; customAssistantIcon?: string; initialSystemPrompt: string; initialUserPrompt: string; addAttachmentPrompt: string; addAttachmentsPrompt: string; attachmentsHiddenPrompt: string; minScoreTopPassage: number; maxTopPassages: number; maxDocuments: number; minDocumentRelevance: number; maxExtractsPerDocument: number; maxPassagesPerDocument: number; startLengthPerDocument: number; extendBefore: number; extendAfter: number; query?: Query; data: EventEmitter; referenceClicked: EventEmitter<{ id: string; $selected: boolean; matchlocations: string[]; rank: number; databasealias: string; matchingpartnames: string[]; matchlocationsperpartname: { matchlocations: { data: string; partname: string; }[]; }[]; documentlanguages: string[]; documentweight: string; modified: string; indexationtime: string; version: string; title: string; size: number; treepath: string[]; filename: string; fileext: string; flags: string[]; collection: string[]; docformat: string; url1: string; text: string; authors: string[]; rfmEnabled: boolean; termspresence: { term: string; presence: "found" | "missing"; }[]; $isDuplicate: boolean; $duplicateCount: number; globalrelevance?: number | undefined; displayTitle?: string | undefined; doctype?: string | undefined; url2?: string | undefined; relevantExtracts?: string | undefined; extracts?: { score: number; highlighted: string; locations: string; originalLocations: string; partname?: string | undefined; }[] | undefined; accesslists?: { accessListIndices: number[]; authorizedLists: { domain: string; id: string; }[]; deniedLists: { domain: string; id: string; }[]; } | undefined; thumbnailUrl?: string | undefined; originalUrl?: string | undefined; pdfUrl?: string | undefined; rfm?: { click?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; like?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; important?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; } | undefined; groupcount?: number | undefined; nearhash?: string | undefined; exacthash?: string | undefined; containerid?: string | undefined; $page?: number | undefined; matchingpassages?: { passages: { id: number; score: number; location: number[]; rlocation: number[]; highlightedText: string; $expanded?: boolean | undefined; }[]; } | undefined; $hasPassages?: boolean | undefined; }>; openPreview: EventEmitter; loading: EventEmitter; error: EventEmitter; messageList?: ElementRef; questionInput?: ElementRef; loadingTpl?: TemplateRef; streaming: boolean; loadingAttachments: boolean; messages$: BehaviorSubject; question: string; tokensPercentage: number; tokensAbsolute: number; tokens: number; get tokensModel(): number; openChatAction: Action; _actions: Action[]; get actions(): Action[]; sub: Subscription; dataSubscription: Subscription | undefined; /** Variables that depend on the type of model in use */ modelDescription?: GllmModelDescription; assistantIcon: string; privacyUrl: string; messageToEdit?: number; constructor(chatService: ChatService, searchService: SearchService, cdr: ChangeDetectorRef); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; submitQuestion(): void; searchAttachments(event?: Event): void; updateTokensPercentage(): void; updateModelDescription(): void; private fetchAnswer; /** * Given a list of messages, fetch the server for a continuation and updates * the list of messages accordingly. * @param messages */ fetch(messages: ChatMessage[]): void; private getAttachmentMessages; updateData(messages: ChatMessage[], tokens: number): void; suggestQuestion(attachments: ChatAttachment[]): string; scrollDown(): void; resetChat(): void; loadDefaultChat(): void; saveChat(): void; openChat(messages: RawMessage[], tokens?: GllmTokens, attachments$?: Observable): void; updateActions(): void; terminateFetch(): void; editMessage(index: number): void; regenerateMessage(index: number): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ChatMessageComponent implements OnChanges, AfterViewInit { searchService: SearchService; ui: UIService; cdr: ChangeDetectorRef; el: ElementRef; message: ChatMessage; conversation: ChatMessage[]; assistantIcon: string; streaming: boolean; canEdit: boolean; canRegenerate: boolean; referenceClicked: EventEmitter<{ id: string; $selected: boolean; matchlocations: string[]; rank: number; databasealias: string; matchingpartnames: string[]; matchlocationsperpartname: { matchlocations: { data: string; partname: string; }[]; }[]; documentlanguages: string[]; documentweight: string; modified: string; indexationtime: string; version: string; title: string; size: number; treepath: string[]; filename: string; fileext: string; flags: string[]; collection: string[]; docformat: string; url1: string; text: string; authors: string[]; rfmEnabled: boolean; termspresence: { term: string; presence: "found" | "missing"; }[]; $isDuplicate: boolean; $duplicateCount: number; globalrelevance?: number | undefined; displayTitle?: string | undefined; doctype?: string | undefined; url2?: string | undefined; relevantExtracts?: string | undefined; extracts?: { score: number; highlighted: string; locations: string; originalLocations: string; partname?: string | undefined; }[] | undefined; accesslists?: { accessListIndices: number[]; authorizedLists: { domain: string; id: string; }[]; deniedLists: { domain: string; id: string; }[]; } | undefined; thumbnailUrl?: string | undefined; originalUrl?: string | undefined; pdfUrl?: string | undefined; rfm?: { click?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; like?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; important?: { status: _sinequa_core_web_services.RFMDisplay; eventCount: number; average: number; image: _sinequa_core_web_services.RFMDisplay; imageAction: _sinequa_core_web_services.RFMDisplay; availableActions: _sinequa_core_web_services.RFMDisplay; } | undefined; } | undefined; groupcount?: number | undefined; nearhash?: string | undefined; exacthash?: string | undefined; containerid?: string | undefined; $page?: number | undefined; matchingpassages?: { passages: { id: number; score: number; location: number[]; rlocation: number[]; highlightedText: string; $expanded?: boolean | undefined; }[]; } | undefined; $hasPassages?: boolean | undefined; }>; edit: EventEmitter; regenerate: EventEmitter; openPreview: EventEmitter; processor: Processor; references: string[]; referenceMap: Map; constructor(searchService: SearchService, ui: UIService, cdr: ChangeDetectorRef, el: ElementRef); ngOnChanges(changes: SimpleChanges): void; ngAfterViewInit(): void; onReferenceClicked(record: Record$1, event: MouseEvent): void; /** * This Unified plugin looks a text nodes and replaces any reference in the * form [1], [2.3], etc. with custom nodes of type "chat-reference". */ referencePlugin: (tree: Node) => Node; placeholderPlugin: (tree: Node) => Node; /** * Reformat [ids: 12.2, 42.5] to [12.2][42.5] */ reformatReferences(content: string): string; /** * Match all references in a given message */ getReferenceMatches(content: string): RegExpExecArray[]; copyToClipboard(text: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ChatSettingsComponent { chatService: ChatService; config: ChatConfig; _reset: EventEmitter; constructor(chatService: ChatService); reset(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class SavedChatsComponent { chatService: ChatService; auditService: AuditWebService; load: EventEmitter; constructor(chatService: ChatService, auditService: AuditWebService); onLoad(chat: SavedChat): void; delete(chat: SavedChat): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class MLModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } type OptionsProps = { params?: SimilarityParams; expand?: string[]; }; declare class SimilarDocumentsComponent implements OnInit { cdr: ChangeDetectorRef; similarityService: DocumentSimilarityService; /** * Array of similar documents. */ similarDocuments: SimilarDocument[]; _documentId$: BehaviorSubject; _queryName$: BehaviorSubject; _options$: BehaviorSubject; /** * Event emitted when a document is clicked. * * @event documentClick * @type {EventEmitter} */ documentClick: EventEmitter<{ id: string; documentSimilarity: number; doc: Record; }>; /** * Sets the query name. * @param value The new value for the query name. */ set queryName(value: string); /** * Sets the document ID. * * @param value - The document ID value. */ set documentId(id: string); /** * Setter for the options property. * @param value - The options object. */ set options(value: OptionsProps); /** * Initializes the component and subscribes to changes in documentId, queryName, and options. * Fetches similar documents based on the provided inputs. */ ngOnInit(): void; /** * Fetches similar documents based on the provided document ID and query name. * * @param documentId - The ID of the document. * @param queryName - The name of the query. * @param options - Optional parameters for the similarity service. */ fetchSimilarDocuments(documentId: string, queryName: string, options?: OptionsProps): void; /** * Handles the click event for a document. * @param document - The document that was clicked. */ handleClick(document: SimilarDocument): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const enML: any; declare const frML: any; declare const deML: any; export { AnswerCardComponent, ChatComponent, ChatService, ChatSettingsComponent, MLModule, PassageListComponent, SavedChatsComponent, SimilarDocumentsComponent, TopPassagesComponent, deML, defaultChatConfig, defaultSearchAttachmentsOptions, enML, frML }; export type { ChatAttachment, ChatAttachmentOpen, ChatAttachmentWithTokens, ChatConfig, ChatMessage, ChatResponse, DocumentChunk, GllmModel, GllmModelDescription, GllmProvider, GllmTokenQuota, GllmTokens, InitChat, OptionsProps, RawAttachment, RawMessage, RawResponse, SavedChat, SearchAttachmentsOptions };