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();