67 lines
2.4 KiB
JavaScript
67 lines
2.4 KiB
JavaScript
const http = require('http');
|
|
|
|
function makeRequest(url) {
|
|
return new Promise((resolve, reject) => {
|
|
const req = http.get(url, (res) => {
|
|
let data = '';
|
|
res.on('data', (chunk) => {
|
|
data += chunk;
|
|
});
|
|
res.on('end', () => {
|
|
try {
|
|
const jsonData = JSON.parse(data);
|
|
resolve(jsonData);
|
|
} catch (error) {
|
|
reject(error);
|
|
}
|
|
});
|
|
});
|
|
req.on('error', reject);
|
|
});
|
|
}
|
|
|
|
async function testFixedAPI() {
|
|
try {
|
|
console.log('🧪 測試修正後的 API...');
|
|
|
|
// 測試評審詳細API
|
|
console.log('📋 測試評審詳細API (ID=2)...');
|
|
const detailData = await makeRequest('http://localhost:3000/api/evaluation/2');
|
|
|
|
if (detailData.success) {
|
|
console.log('✅ API 調用成功');
|
|
console.log('📊 專案標題:', detailData.data.projectTitle);
|
|
console.log('📊 總分:', detailData.data.overallScore);
|
|
console.log('📊 等級:', detailData.data.grade);
|
|
|
|
console.log('\n📝 評分標準詳情:');
|
|
detailData.data.criteria.forEach((criteria, index) => {
|
|
console.log(` ${index + 1}. ${criteria.name}: ${criteria.score}/${criteria.maxScore}`);
|
|
console.log(` AI 評語: ${criteria.feedback}`);
|
|
console.log(` 優點: ${criteria.strengths.length > 0 ? criteria.strengths.join(', ') : '無'}`);
|
|
console.log(` 改進建議: ${criteria.improvements.length > 0 ? criteria.improvements.join(', ') : '無'}`);
|
|
console.log('');
|
|
});
|
|
|
|
console.log('📋 詳細分析:');
|
|
console.log(' 摘要:', detailData.data.detailedAnalysis.summary);
|
|
console.log(' 關鍵發現:', detailData.data.detailedAnalysis.keyFindings);
|
|
|
|
console.log('\n💡 改進建議:');
|
|
console.log(' 整體建議:', detailData.data.improvementSuggestions.overallSuggestions);
|
|
console.log(' 保持優勢:', detailData.data.improvementSuggestions.maintainStrengths);
|
|
console.log(' 關鍵改進:', detailData.data.improvementSuggestions.keyImprovements);
|
|
console.log(' 行動計劃:', detailData.data.improvementSuggestions.actionPlan);
|
|
|
|
} else {
|
|
console.log('❌ API 調用失敗:', detailData.error);
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ 測試失敗:', error.message);
|
|
}
|
|
}
|
|
|
|
// 等待一下讓服務器啟動
|
|
setTimeout(testFixedAPI, 2000);
|