修正 AI 產出結果
This commit is contained in:
@@ -142,15 +142,16 @@ ${pptContent}
|
||||
**評分標準:**
|
||||
${criteriaList}
|
||||
|
||||
**評分要求:**
|
||||
1. 請對每個評分項目給出 0 到滿分的分數
|
||||
2. 為每個項目提供具體的評分理由、優點和改進建議
|
||||
3. 計算總分(各項目分數 × 權重比例)
|
||||
4. 提供整體評價和建議
|
||||
5. 分析優秀項目和待改進項目的數量
|
||||
6. 給出等級評比 (S、A+、A、A-、B+、B、B-、C、D)
|
||||
7. 給出表現狀態 (表現極優、表現良好、表現普通、表現有待加強)
|
||||
8. 給出推薦星星數量 (1-5顆星)
|
||||
**評分要求:**
|
||||
1. 請對每個評分項目給出 0 到滿分的分數,要敢於給出極高分(9-10分)和極低分(1-3分)
|
||||
2. 為每個項目提供具體的評分理由、優點和改進建議
|
||||
3. 計算總分(各項目分數 × 權重比例)
|
||||
4. 提供整體評價和建議
|
||||
5. 分析優秀項目和待改進項目的數量
|
||||
6. 給出等級評比 (S、A+、A、A-、B+、B、B-、C、D)
|
||||
7. 給出表現狀態 (表現極優、表現良好、表現普通、表現有待加強)
|
||||
8. 給出推薦星星數量 (1-5顆星)
|
||||
9. **重要:請根據實際內容質量給出真實評分,不要過於保守,優秀的內容應該得到高分,糟糕的內容應該得到低分**
|
||||
|
||||
**回應格式 (請嚴格按照以下 JSON 格式回應):**
|
||||
{
|
||||
@@ -279,18 +280,41 @@ ${criteriaList}
|
||||
}
|
||||
|
||||
/**
|
||||
* 計算總覽統計
|
||||
* 計算總覽統計 - 基於 criteria_items 的平均分作為閾值
|
||||
*/
|
||||
private static calculateOverview(criteria: any[]): any {
|
||||
// 調整判斷標準,使其更合理
|
||||
const excellentItems = criteria.filter(item => (item.score / item.maxScore) >= 0.75).length; // 75%以上為優秀
|
||||
const improvementItems = criteria.filter(item => (item.score / item.maxScore) < 0.6).length; // 60%以下為待改進
|
||||
const overallPerformance = criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0);
|
||||
if (!criteria || criteria.length === 0) {
|
||||
return {
|
||||
excellentItems: 0,
|
||||
improvementItems: 0,
|
||||
overallPerformance: 0
|
||||
};
|
||||
}
|
||||
|
||||
// 計算所有項目的平均分數(不考慮權重)
|
||||
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||
const averageScore = totalScore / criteria.length;
|
||||
|
||||
console.log('🔍 計算 overview 統計:');
|
||||
console.log(' 評分項目:', criteria.map(item => `${item.name}: ${item.score}/${item.maxScore}`));
|
||||
console.log(' 總分:', totalScore);
|
||||
console.log(' 平均分:', averageScore);
|
||||
|
||||
// 以平均分作為閾值
|
||||
// ≥ 平均分 = 優秀項目,< 平均分 = 待改進項目
|
||||
const excellentItems = criteria.filter(item => item.score >= averageScore).length;
|
||||
const improvementItems = criteria.filter(item => item.score < averageScore).length;
|
||||
|
||||
console.log(' 優秀項目 (≥' + averageScore + '):', excellentItems);
|
||||
console.log(' 待改進項目 (<' + averageScore + '):', improvementItems);
|
||||
|
||||
// 整體表現:基於權重的加權平均分數
|
||||
const overallPerformance = Math.round(criteria.reduce((sum, item) => sum + (item.score / item.maxScore) * item.weight, 0));
|
||||
|
||||
return {
|
||||
excellentItems,
|
||||
improvementItems,
|
||||
overallPerformance: Math.round(overallPerformance)
|
||||
overallPerformance
|
||||
};
|
||||
}
|
||||
|
||||
@@ -322,8 +346,12 @@ ${criteriaList}
|
||||
* 生成改進建議
|
||||
*/
|
||||
private static generateImprovementSuggestions(criteria: any[]): any {
|
||||
const excellentItems = criteria.filter(item => (item.score / item.maxScore) >= 0.75); // 75%以上為優秀
|
||||
const improvementItems = criteria.filter(item => (item.score / item.maxScore) < 0.6); // 60%以下為待改進
|
||||
// 計算平均分作為閾值
|
||||
const totalScore = criteria.reduce((sum, item) => sum + item.score, 0);
|
||||
const averageScore = totalScore / criteria.length;
|
||||
|
||||
const excellentItems = criteria.filter(item => item.score >= averageScore); // ≥ 平均分為優秀
|
||||
const improvementItems = criteria.filter(item => item.score < averageScore); // < 平均分為待改進
|
||||
|
||||
return {
|
||||
overallSuggestions: '基於 AI 分析結果的具體改進方向',
|
||||
@@ -396,13 +424,13 @@ ${criteriaList}
|
||||
recommendedStars: parsed.recommendedStars || this.calculateRecommendedStars(totalScore),
|
||||
analysisDate: new Date().toISOString().split('T')[0],
|
||||
criteria: parsed.criteria || [],
|
||||
overview: parsed.overview || this.calculateOverview(parsed.criteria || []),
|
||||
overview: this.calculateOverview(parsed.criteria || []),
|
||||
detailedAnalysis: parsed.detailedAnalysis || {
|
||||
summary: parsed.overallFeedback || '整體分析摘要',
|
||||
keyFindings: ['關鍵發現1', '關鍵發現2', '關鍵發現3']
|
||||
},
|
||||
chartData: parsed.chartData || this.generateChartData(parsed.criteria || []),
|
||||
improvementSuggestions: parsed.improvementSuggestions || this.generateImprovementSuggestions(parsed.criteria || [])
|
||||
improvementSuggestions: this.generateImprovementSuggestions(parsed.criteria || [])
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user