/** * @fileoverview AI Settings Modal Component * @description A modal dialog for configuring AI inference parameters, * RAG configuration, document type selection, and prompt templates. * Provides similar functionality to the panel but as an overlay modal. * * @module uc-ui/components/shared/ai-settings-modal * @requires @angular/core * @requires @angular/common * @requires @angular/forms * @requires @angular/material */ import { EventEmitter, ElementRef, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import * as i0 from "@angular/core"; /** * Interface representing the AI settings data * @interface AiSettingsData */ export interface AiSettingsData { /** Selected LLM model for inference */ selectedModel: string; /** Custom prompt template */ promptTemplate: string; /** Chunk size for document splitting (RAG) */ chunkSize: number; /** Overlap between consecutive chunks */ chunkOverlap: number; /** Number of top similar chunks to retrieve */ topK: number; /** Embedding model for vector representation */ embeddingModel: string; /** Search type (similarity, mmr, hybrid) */ searchType: string; /** Vector store backend (pgvector, inmemory) */ vectorStore: string; /** Whether GST analysis is selected */ selectedGst: boolean; /** Whether Bureau analysis is selected */ selectedBureau: boolean; /** Whether Financial analysis is selected */ selectedFinancial: boolean; /** GST-specific prompt template */ gstPromptTemplate: string; /** Bureau-specific prompt template */ bureauPromptTemplate: string; /** Financial-specific prompt template */ financialPromptTemplate: string; } /** * Interface for tracking prompt history items * @interface PromptHistoryItem */ export interface PromptHistoryItem { /** The prompt template content */ template: string; /** ISO timestamp when the prompt was saved */ timestamp: string; /** Source of the prompt (typed manually or uploaded from file) */ source: 'typed' | 'uploaded'; } /** * AI Settings Modal Component * * @description Provides a modal dialog UI for configuring AI model settings, * RAG parameters, and prompt templates. Supports document type selection, * prompt history, and file upload functionality. * * @example * ```html * * * ``` */ export declare class AiSettingsModalComponent implements OnInit, OnChanges { /** Whether the modal is currently open */ isOpen: boolean; /** Whether GST document is available in the proposal */ hasGstDocument: boolean; /** Whether Bureau document is available in the proposal */ hasBureauDocument: boolean; /** Whether Financial document is available in the proposal */ hasFinancialDocument: boolean; /** Event emitted when the modal is closed */ closeModal: EventEmitter; /** Event emitted when settings are saved successfully */ settingsSaved: EventEmitter; /** Reference to GST prompt file input element */ gstPromptFileInput: ElementRef; /** Reference to Bureau prompt file input element */ bureauPromptFileInput: ElementRef; /** Reference to Financial prompt file input element */ financialPromptFileInput: ElementRef; /** Injected loan summary service for state management */ private readonly loanSummaryService; /** Available LLM models for selection */ availableModels: string[]; /** Currently selected LLM model */ selectedModel: string; /** Custom prompt template */ promptTemplate: string; /** Chunk size for document splitting */ chunkSize: number; /** Overlap between consecutive chunks */ chunkOverlap: number; /** Number of top similar chunks to retrieve */ topK: number; /** Available embedding models */ availableEmbeddingModels: string[]; /** Currently selected embedding model */ selectedEmbeddingModel: string; /** Available search types with labels */ availableSearchTypes: Array<{ value: string; label: string; }>; /** Currently selected search type */ selectedSearchType: string; /** Available vector store backends */ availableVectorStores: Array<{ value: string; label: string; }>; /** Currently selected vector store */ selectedVectorStore: string; /** Whether GST analysis is selected */ selectedGst: boolean; /** Whether Bureau analysis is selected */ selectedBureau: boolean; /** Whether Financial analysis is selected */ selectedFinancial: boolean; /** GST-specific prompt template */ gstPromptTemplate: string; /** Bureau-specific prompt template */ bureauPromptTemplate: string; /** Financial-specific prompt template */ financialPromptTemplate: string; /** History of GST prompt templates */ gstPromptHistory: PromptHistoryItem[]; /** History of Bureau prompt templates */ bureauPromptHistory: PromptHistoryItem[]; /** History of Financial prompt templates */ financialPromptHistory: PromptHistoryItem[]; /** Whether GST prompt history is expanded */ showGstPromptHistory: boolean; /** Whether Bureau prompt history is expanded */ showBureauPromptHistory: boolean; /** Whether Financial prompt history is expanded */ showFinancialPromptHistory: boolean; private readonly settingsStorageKey; private readonly gstHistoryStorageKey; private readonly bureauHistoryStorageKey; private readonly financialHistoryStorageKey; private backupSelectedModel; private backupPromptTemplate; private backupChunkSize; private backupChunkOverlap; private backupTopK; private backupSelectedEmbeddingModel; private backupSelectedSearchType; private backupSelectedVectorStore; private backupSelectedGst; private backupSelectedBureau; private backupSelectedFinancial; private backupGstPromptTemplate; private backupBureauPromptTemplate; private backupFinancialPromptTemplate; /** Default GST prompt template */ readonly defaultGstPromptTemplate = "\nCredit underwriter summary for \n1. Detailed profile and GST report analysis\n2. ITC Utilization pattern\n3. Customer and supplier risk assessment\n4. Fraud & Compliance risk assessment\n5. Concentration Risk Assessment\n6. Financial Health indicators\n7. Underwriter Recommendation\n8. Final Recommendation\nNote: Don't include the document number in the response\n"; /** Default Bureau prompt template */ readonly defaultBureauPromptTemplate = "Generate in detailed CIBIL summary along with the profile"; /** Default Financial prompt template */ readonly defaultFinancialPromptTemplate = "Generate a comprehensive Financial Statement analysis covering:\n1. Balance Sheet Analysis - Assets, Liabilities, and Equity breakdown\n2. Income Statement Review - Revenue, Expenses, and Profitability trends\n3. Cash Flow Analysis - Operating, Investing, and Financing activities\n4. Key Financial Ratios - Liquidity, Solvency, Profitability, and Efficiency ratios\n5. Working Capital Assessment\n6. Debt Analysis and Coverage Ratios\n7. Year-over-Year Comparison and Trends\n8. Financial Health Indicators and Risk Flags\n9. Recommendations for Credit Assessment\nNote: Focus on data-driven insights relevant for credit underwriting decisions."; ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; /** * Initialize checkbox selections based on document availability * All available documents should be selected by default */ private initializeDocumentSelections; /** * Initialize the modal with current settings from the service * Should be called when the modal is opened */ initializeSettings(): void; private createBackup; private restoreBackup; /** * Handle modal close - restores backup and emits close event */ onClose(): void; /** * Handle overlay click - closes modal */ onOverlayClick(): void; /** * Prevent modal content clicks from closing modal */ onModalClick(event: Event): void; /** * Save all settings to localStorage and sync with service */ saveSettings(): void; /** * Reset all settings to default values */ resetSettings(): void; /** * Format slider label for display */ formatSliderLabel(value: number): string; toggleGstSelection(): void; toggleBureauSelection(): void; toggleFinancial(): void; loadDefaultGstPromptTemplate(): void; loadDefaultBureauPromptTemplate(): void; loadDefaultFinancialPromptTemplate(): void; triggerGstPromptFileUpload(): void; triggerBureauPromptFileUpload(): void; triggerFinancialPromptFileUpload(): void; onGstPromptFileUpload(event: Event): void; onBureauPromptFileUpload(event: Event): void; onFinancialPromptFileUpload(event: Event): void; private handleFileUpload; private loadPromptHistories; toggleGstPromptHistory(): void; toggleBureauPromptHistory(): void; toggleFinancialPromptHistory(): void; private loadGstPromptHistory; private loadBureauPromptHistory; private loadFinancialPromptHistory; addToGstPromptHistory(template: string, source: 'typed' | 'uploaded'): void; addToBureauPromptHistory(template: string, source: 'typed' | 'uploaded'): void; addToFinancialPromptHistory(template: string, source: 'typed' | 'uploaded'): void; selectGstFromHistory(historyItem: PromptHistoryItem): void; selectBureauFromHistory(historyItem: PromptHistoryItem): void; selectFinancialFromHistory(historyItem: PromptHistoryItem): void; deleteGstFromHistory(index: number, event: Event): void; deleteBureauFromHistory(index: number, event: Event): void; deleteFinancialFromHistory(index: number, event: Event): void; /** * Format history date for display */ formatHistoryDate(timestamp: string): string; /** * Get preview text for prompt history items */ getPromptPreview(template: string): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }