Files
cim_summary/backend/trigger-processing.js
Jon c67dab22b4 Add comprehensive CIM processing features and UI improvements
- 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
2025-07-27 20:25:46 -04:00

60 lines
1.9 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { Pool } = require('pg');
const pool = new Pool({
connectionString: 'postgresql://postgres:password@localhost:5432/cim_processor'
});
async function triggerProcessing() {
try {
console.log('🔍 Finding STAX CIM document...');
// Find the STAX CIM document
const result = await pool.query(`
SELECT id, original_file_name, status, user_id
FROM documents
WHERE original_file_name = 'stax-cim-test.pdf'
ORDER BY created_at DESC
LIMIT 1
`);
if (result.rows.length === 0) {
console.log('❌ No STAX CIM document found');
return;
}
const document = result.rows[0];
console.log(`📄 Found document: ${document.original_file_name} (${document.status})`);
if (document.status === 'uploaded') {
console.log('🚀 Updating document status to trigger processing...');
// Update the document status to trigger processing
await pool.query(`
UPDATE documents
SET status = 'processing_llm',
updated_at = CURRENT_TIMESTAMP
WHERE id = $1
`, [document.id]);
console.log('✅ Document status updated to processing_llm');
console.log('📊 The document should now be processed by the LLM service');
console.log('🔍 Check the backend logs for processing progress');
console.log('');
console.log('💡 You can now:');
console.log('1. Go to http://localhost:3000');
console.log('2. Login with user1@example.com / user123');
console.log('3. Check the Documents tab to see processing status');
console.log('4. Watch the backend logs for LLM processing');
} else {
console.log(` Document status is already: ${document.status}`);
}
} catch (error) {
console.error('❌ Error triggering processing:', error.message);
} finally {
await pool.end();
}
}
triggerProcessing();