|
#!/usr/bin/env node |
|
|
|
|
|
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'); |
|
|
|
|
|
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); |
|
} |
|
|
|
|
|
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(); |