feat: ConnectAI structural hardening and retrieval precision improvements

This commit is contained in:
g1nation
2026-05-05 21:37:45 +09:00
parent c2f17cfb03
commit 466e9e4d5f
17 changed files with 424 additions and 160 deletions
+15 -4
View File
@@ -26,10 +26,17 @@ export class WikiFormatter {
let cleanContent = content.replace(/^---[\s\S]*?---\n*/, '');
let formatted = frontmatter + cleanContent;
// 2. 필수 헤더 보정
// 2. 지능형 요약 추출 및 보정
if (!formatted.includes('## 📌 Brief Summary')) {
const summary = cleanContent.split('\n').find(l => l.trim().length > 10) || '요약이 생성되지 않았습니다.';
const summarySection = `## 📌 Brief Summary\n${summary.substring(0, 200)}...\n\n`;
const lines = cleanContent.split('\n');
// '📌', '요약', 'Summary'가 포함된 줄을 먼저 찾거나, 20자 이상의 첫 단락을 찾음
let summary = lines.find(l => l.includes('📌') || l.includes('Summary') || l.includes('요약'))?.replace(/^[#\s📌]*/, '');
if (!summary) {
summary = lines.find(l => l.trim().length > 30 && !l.startsWith('#')) || '요약 내용을 추출할 수 없습니다.';
}
const summarySection = `## 📌 Brief Summary\n${summary.substring(0, 300)}${summary.length > 300 ? '...' : ''}\n\n`;
formatted = formatted.replace(/---\n\n/, `---\n\n${summarySection}`);
}
@@ -59,7 +66,11 @@ export class WikiFormatter {
`| **Processing Time** | \`${(totalDuration / 1000).toFixed(1)}s\` | ✅ Fast |`,
'',
'### 🔍 Decision Audit Trail',
state.auditTrail.map(a => `- **[${a.to.toUpperCase()}]** ${a.message} (${a.durationFromPrev}ms)`).join('\n'),
// 재시도(retry) 등 반복적인 로그는 제외하고 핵심 단계 전환만 필터링하여 출력
state.auditTrail
.filter(a => !a.message.includes('재시도') && a.from !== a.to)
.map(a => `- **[${a.to.toUpperCase()}]** ${a.message} (${a.durationFromPrev}ms)`)
.join('\n'),
''
].join('\n');