#!/usr/bin/env node // Test both formatting options async function testFormatting() { console.log('🎨 Testing Document Analysis Formatting Options...\n'); const testContent = "This research paper introduces a new machine learning algorithm for natural language processing. The algorithm achieves state-of-the-art results on multiple benchmark datasets including GLUE and SuperGLUE. It reduces training time by 45% compared to previous methods while maintaining 98% accuracy. The approach uses a novel attention mechanism and efficient gradient optimization."; console.log('📝 Test Content:', testContent.substring(0, 100) + '...\n'); // Test 1: Markdown formatting (default) console.log('🔤 Testing MARKDOWN formatting...'); try { const markdownResponse = await fetch('http://localhost:5000/api/analyze-document', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content: testContent, analysisType: 'summary', useMarkdown: true }) }); if (markdownResponse.ok) { const markdownResult = await markdownResponse.json(); console.log('✅ MARKDOWN Result:'); console.log('---'); console.log(markdownResult.analysis); console.log('---\n'); } else { console.log('❌ Markdown test failed'); } } catch (error) { console.log('❌ Markdown error:', error.message); } // Test 2: Plain text formatting console.log('📄 Testing PLAIN TEXT formatting...'); try { const plainResponse = await fetch('http://localhost:5000/api/analyze-document', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content: testContent, analysisType: 'summary', useMarkdown: false }) }); if (plainResponse.ok) { const plainResult = await plainResponse.json(); console.log('✅ PLAIN TEXT Result:'); console.log('---'); console.log(plainResult.analysis); console.log('---\n'); } else { console.log('❌ Plain text test failed'); } } catch (error) { console.log('❌ Plain text error:', error.message); } console.log('🎯 Test Complete!'); console.log('💡 You can now choose formatting in the AI Tools → Analysis tab'); } testFormatting();