// Debug script to test document processing in the testing environment const axios = require('axios'); const API_BASE = 'https://us-central1-cim-summarizer-testing.cloudfunctions.net/api'; async function debugProcessing() { console.log('šŸ” Starting debug of document processing...'); try { // First, check if any documents exist in the testing environment console.log('\nšŸ“‹ Checking recent documents...'); const docsResponse = await axios.get(`${API_BASE}/documents`, { headers: { 'Authorization': 'Bearer test-token' } }).catch(err => { console.log('āŒ Could not fetch documents (expected - auth required)'); return null; }); // Check health endpoint console.log('\nšŸ„ Checking API health...'); const healthResponse = await axios.get(`${API_BASE}/health`); console.log('āœ… Health check:', healthResponse.data); // Test a simple LLM request through the processing endpoint console.log('\nšŸ¤– Testing LLM processing capabilities...'); // Create a test document payload const testDocument = { id: 'debug-test-001', content: ` CONFIDENTIAL INVESTMENT MEMORANDUM TEST COMPANY INC. EXECUTIVE SUMMARY Test Company Inc. is a technology startup providing AI-powered solutions for small businesses. Founded in 2020, the company has achieved $2.5M in annual revenue with 150 employees. BUSINESS OVERVIEW Core Operations: AI software development Revenue Model: SaaS subscriptions Key Products: Business AI Platform, Analytics Dashboard FINANCIAL PERFORMANCE FY 2023: Revenue $2,500,000, EBITDA $750,000 FY 2022: Revenue $1,200,000, EBITDA $240,000 MARKET ANALYSIS Total Addressable Market: $15B Growth Rate: 25% annually Competition: Established players and startups `, metadata: { filename: 'test-debug.pdf', fileSize: 1500 } }; console.log('šŸ“„ Sample document content length:', testDocument.content.length); console.log('šŸ“„ Sample content preview:', testDocument.content.substring(0, 200) + '...'); } catch (error) { console.error('āŒ Debug failed:', error.message); if (error.response) { console.error(' Response status:', error.response.status); console.error(' Response data:', error.response.data); } } } debugProcessing();