43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
|
|
import { PrismaClient } from '@prisma/client';
|
|||
|
|
import { AIService } from './ai.service';
|
|||
|
|
interface ParsedData {
|
|||
|
|
direction?: string;
|
|||
|
|
customer?: string;
|
|||
|
|
objectName?: string;
|
|||
|
|
executor?: string;
|
|||
|
|
works?: Array<{
|
|||
|
|
name: string;
|
|||
|
|
volume: number;
|
|||
|
|
unit: string;
|
|||
|
|
priceItemId?: string;
|
|||
|
|
justification?: string;
|
|||
|
|
}>;
|
|||
|
|
vatIncluded?: boolean;
|
|||
|
|
missingFields?: string[];
|
|||
|
|
}
|
|||
|
|
interface ProcessResult {
|
|||
|
|
message: string;
|
|||
|
|
extractedData?: ParsedData;
|
|||
|
|
needsClarification: boolean;
|
|||
|
|
clarificationQuestions?: string[];
|
|||
|
|
}
|
|||
|
|
export declare class ParserService {
|
|||
|
|
private prisma;
|
|||
|
|
private aiService;
|
|||
|
|
constructor(prisma: PrismaClient, aiService: AIService);
|
|||
|
|
/** Режим обсуждения сметы: свободный диалог о прикреплённой смете */
|
|||
|
|
private processEstimateDiscussion;
|
|||
|
|
/** Берём последние извлечённые данные из истории (ответ ассистента с metadata) */
|
|||
|
|
private getPreviousExtractedData;
|
|||
|
|
/** Значения-заполнители: не перезаписываем ими ранее указанные данные */
|
|||
|
|
private static readonly PLACEHOLDER_VALUES;
|
|||
|
|
private isPlaceholder;
|
|||
|
|
/** Объединяем новые данные с предыдущими: не затираем поля, которые пользователь уже указал */
|
|||
|
|
private mergeExtractedData;
|
|||
|
|
processMessage(content: string, history: any[], estimateId?: string | null): Promise<ProcessResult>;
|
|||
|
|
private matchWorksWithPriceItems;
|
|||
|
|
private getRelevantPriceBookCode;
|
|||
|
|
createEstimateFromParsedData(data: ParsedData): Promise<any>;
|
|||
|
|
}
|
|||
|
|
export {};
|
|||
|
|
//# sourceMappingURL=parser.service.d.ts.map
|