- Add new database migrations for analysis data and job tracking - Implement enhanced document processing service with LLM integration - Add processing progress and queue status components - Create testing guides and utility scripts for CIM processing - Update frontend components for better user experience - Add environment configuration and backup files - Implement job queue service and upload progress tracking
56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
const { DocumentProcessingService } = require('./src/services/documentProcessingService');
|
|
const { DocumentModel } = require('./src/models/DocumentModel');
|
|
const { config } = require('./src/config/env');
|
|
|
|
async function regenerateSummary() {
|
|
try {
|
|
console.log('Starting summary regeneration test...');
|
|
|
|
const documentId = '9138394b-228a-47fd-a056-e3eeb8fca64c';
|
|
|
|
// Get the document
|
|
const document = await DocumentModel.findById(documentId);
|
|
if (!document) {
|
|
console.error('Document not found');
|
|
return;
|
|
}
|
|
|
|
console.log('Document found:', {
|
|
id: document.id,
|
|
filename: document.original_file_name,
|
|
status: document.status,
|
|
hasExtractedText: !!document.extracted_text,
|
|
extractedTextLength: document.extracted_text?.length || 0
|
|
});
|
|
|
|
if (!document.extracted_text) {
|
|
console.error('Document has no extracted text');
|
|
return;
|
|
}
|
|
|
|
// Create document processing service instance
|
|
const documentProcessingService = new DocumentProcessingService();
|
|
|
|
// Regenerate summary
|
|
console.log('Starting summary regeneration...');
|
|
await documentProcessingService.regenerateSummary(documentId);
|
|
|
|
console.log('Summary regeneration completed successfully!');
|
|
|
|
// Check the updated document
|
|
const updatedDocument = await DocumentModel.findById(documentId);
|
|
console.log('Updated document:', {
|
|
status: updatedDocument.status,
|
|
hasSummary: !!updatedDocument.generated_summary,
|
|
summaryLength: updatedDocument.generated_summary?.length || 0,
|
|
markdownPath: updatedDocument.summary_markdown_path,
|
|
pdfPath: updatedDocument.summary_pdf_path
|
|
});
|
|
|
|
} catch (error) {
|
|
console.error('Error regenerating summary:', error);
|
|
}
|
|
}
|
|
|
|
// Run the test
|
|
regenerateSummary();
|