feat: Bridge 타깃 토글 + /research 제거 + 환각·오염 방지 강화 (v2.2.205)
- Datacollect Bridge 로컬/NAS 타깃 토글(Settings 패널) + NAS URL/x-bridge-token. 기본 local = 현행 동작 유지. (백엔드 NAS 분리 준비) - /research(NotebookLM) 제거 — 로컬 Datacollect 앱 전용으로 분리. - 에러로그 오염 차단: STT/스택트레이스/에러덤프를 장기기억 채굴 제외 + 자동 추출 항목 14일 TTL(참조 시 슬라이딩 연장). 기존·수동 항목 무영향. - 컨텍스트 [주제] 태깅 + 교차오염 방지 경계 지침. - "확인 불가" 사실 날조 금지 규칙(R7과 구분). - /meet STT 오타 보정: 철자 정규화 허용하되 사실 날조는 차단. 타입체크 + 407 테스트 통과. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,19 @@ export function selectWithinBudget(
|
||||
return { selected, dropped, tokensUsed };
|
||||
}
|
||||
|
||||
/**
|
||||
* 청크의 '주제(Subject)' 태그를 도출한다 — 서로 다른 프로젝트/주제의 정보가 한
|
||||
* 컨텍스트에 섞일 때 모델이 경계를 인지하도록(무성 교차오염 방지). category 가 있으면
|
||||
* 그걸, 없으면 title/filePath 의 최상위 폴더 세그먼트를 주제로 본다. 파일명만 있으면 ''.
|
||||
*/
|
||||
function deriveSubject(chunk: RetrievalChunk): string {
|
||||
const cat = (chunk.metadata.category || '').trim();
|
||||
if (cat) return cat;
|
||||
const ref = (chunk.title || chunk.metadata.filePath || '').replace(/\\/g, '/');
|
||||
const seg = ref.split('/').filter(Boolean);
|
||||
return seg.length >= 2 ? seg[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 선택된 청크들을 하나의 컨텍스트 문자열로 조립합니다.
|
||||
* 소스별로 그룹화하여 가독성을 높입니다.
|
||||
@@ -123,9 +136,11 @@ export function assembleContext(chunks: RetrievalChunk[]): string {
|
||||
const items = groupChunks
|
||||
.map((c) => {
|
||||
const metadata = c.metadata;
|
||||
const subject = deriveSubject(c);
|
||||
const subjectTag = subject ? `[${subject}] ` : '';
|
||||
const conflictTag = metadata.conflictDetected ? ` [⚠️ CONFLICT: ${metadata.conflictSeverity}]` : '';
|
||||
const coverageTag = metadata.queryCoverage !== undefined ? ` (Coverage: ${metadata.queryCoverage.toFixed(2)})` : '';
|
||||
return `- ${c.title}${conflictTag}${coverageTag}: ${c.content}`;
|
||||
return `- ${subjectTag}${c.title}${conflictTag}${coverageTag}: ${c.content}`;
|
||||
})
|
||||
.join('\n');
|
||||
sections.push(`### ${label}\n${items}`);
|
||||
@@ -134,6 +149,7 @@ export function assembleContext(chunks: RetrievalChunk[]): string {
|
||||
return [
|
||||
'[MEMORY CONTEXT]',
|
||||
'Review this layered memory before preparing the answer. Use it only when relevant, and prefer the current user request when there is conflict.',
|
||||
'각 항목 앞의 [주제] 태그와 섹션 출처를 확인하라. **현재 요청과 다른 프로젝트·주제의 항목은 사용하지 마라** — 서로 다른 프로젝트의 규칙·결정·수치·고유명사를 섞지 말 것. 어느 항목이 현재 작업과 관련 있는지 불확실하면 그 항목에 의존하지 마라.',
|
||||
'',
|
||||
sections.join('\n\n')
|
||||
].join('\n');
|
||||
|
||||
Reference in New Issue
Block a user