File size: 2,366 Bytes
7c012de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/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();