feat(engine): implement state persistence, failure reason tracking, and quality scoring as per Astra review
This commit is contained in:
@@ -35,6 +35,42 @@ export class AgentDataValidator {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// 품질 점수화 (Quality Scoring) - Astra 피드백 반영
|
||||
const score = QualityScorer.evaluate(data);
|
||||
if (score < 50) {
|
||||
logInfo(`[QualityWarning] ${stage} 결과 품질 낮음 (Score: ${score}). 내용 보강이 필요할 수 있습니다.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class QualityScorer {
|
||||
/**
|
||||
* 수집된 데이터의 품질을 휴리스틱하게 점수화합니다 (0-100).
|
||||
*/
|
||||
public static evaluate(data: string): number {
|
||||
if (!data) return 0;
|
||||
let score = 0;
|
||||
|
||||
// 1. 길이 기반 점수 (최대 40점)
|
||||
score += Math.min(40, data.length / 50);
|
||||
|
||||
// 2. 구조화 기반 점수 (최대 30점)
|
||||
if (data.includes('##') || data.includes('**') || data.includes('- ')) {
|
||||
score += 30;
|
||||
}
|
||||
|
||||
// 3. 밀도/정보량 기반 점수 (최대 30점)
|
||||
// 코드 블록이나 구체적 링크가 있으면 가산점
|
||||
if (data.includes('```')) score += 15;
|
||||
if (data.includes('[[') || data.includes('http')) score += 15;
|
||||
|
||||
// 감점 요소: Placeholder 나 Empty 상태
|
||||
if (data.includes('[Placeholder]') || data.includes('TODO')) {
|
||||
score -= 20;
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(100, score));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user