detective-app: 답변에 '메모에 추가' 버튼, 조회 안 한 사실 날조 금지·메모 저장 안내 규칙 추가

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Sonnet 5.5 committed 2026-10-16 14:55:20 +09:00
1 parent fdc5951f3c
commit aee2e3825b
1 file changed
+23 -2
+23 -2
View File
@@ -205,6 +205,8 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;dis
.dt-msg.assistant .dt-bubble{background:var(--panel-2);border:1px solid var(--line);border-radius:10px 10px 10px 3px;}
.dt-msg.system .dt-bubble{background:transparent;color:var(--muted);font-size:11px;}
.dt-bubble p{margin:3px 0;}
.dt-note-add-btn{margin-top:3px;align-self:flex-start;background:none;border:1px solid var(--line);border-radius:6px;padding:2px 8px;font-size:10.5px;color:var(--muted);cursor:pointer;font-family:inherit;}
.dt-note-add-btn:hover{border-color:#3b82f6;color:#3b82f6;}
.dt-bubble h3{font-size:13px;margin:6px 0 3px;}
.dt-bubble ul,.dt-bubble ol{padding-left:16px;margin:3px 0;}
.dt-bubble pre{background:var(--bg);border:1px solid var(--line);border-radius:6px;padding:8px;overflow-x:auto;font-size:11px;margin:6px 0;}
@@ -2009,7 +2011,7 @@ async function loadHistory(){
const sep=document.createElement('div');sep.style.cssText='text-align:center;color:var(--muted,#888);font-size:11px;padding:6px 0;';sep.textContent='─ 이전 대화 ─';el.appendChild(sep);
for(const m of recent){
if(m.role==='user')addMsg('user',escHtml(m.content||''));
else addMsg('assistant',renderMd(m.content||''));
else{const hb=addMsg('assistant',renderMd(m.content||''));addNoteBtn(hb.parentNode,m.content);}
}
const sep2=document.createElement('div');sep2.style.cssText='text-align:center;color:var(--muted,#888);font-size:11px;padding:6px 0;';sep2.textContent='─ 이어서 ─';el.appendChild(sep2);
el.scrollTop=el.scrollHeight;
@@ -2142,6 +2144,8 @@ triggers: [조사, 탐문, 인물, 기업, 사건, 단서, 증거, 추적, 사
4. **법적 근거 제시**: 관련 법령·판례를 조회해 법적 판단 근거 함께 제공
5. **전문가 연계 고지**: 형사고소·민사소송 등 법적 절차가 필요한 경우 변호사 상담 권고
6. **불법 조사 금지**: 해킹, 불법 감청, 개인정보 무단 수집 요청 거부
7. **조회하지 않은 사실 금지**: 사업자등록번호·대표자명·설립일·후기 점수·평판·민원/불법 사례 여부 같은 구체 정보는 이번 대화에서 도구(web_search 등)로 실제 조회한 결과에만 쓴다. 조회하지 못했으면 "미확인"이라고 쓰고 숫자·이름을 지어내지 않는다. 출처(URL)를 달 때는 실제로 열어 본 주소만 쓴다.
8. **메모 저장**: 사건 메모란은 도구로 쓸 수 없다. "메모에 정리" 요청에는 write_note를 쓰지 말고, 정리한 내용을 답변으로 보여 준 뒤 답변 아래 "📝 메모에 추가" 버튼을 누르라고 안내한다.
`;
function loadSkill(){
@@ -2162,6 +2166,22 @@ function escAttr(s){return String(s||'').replace(/'/g,'&#39;').replace(/"/g,'&qu
// result for the attribute layer, so both decoding steps land safely.
function escJsAttr(s){return escAttr(String(s||'').replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(/\n/g,'\\n').replace(/\r/g,''));}
// 답변 아래 "메모에 추가" 버튼: 모델이 엉뚱한 곳(전역 메모)에 저장하지 않도록, 답변 원문을 현재 사건 메모란 끝에 직접 붙인다.
function addNoteBtn(msgDiv,rawText){
if(!msgDiv||!rawText||!String(rawText).trim())return;
const btn=document.createElement('button');btn.className='dt-note-add-btn';btn.textContent='📝 메모에 추가';
btn.title='이 답변을 현재 사건의 메모란 끝에 붙입니다';
btn.onclick=function(){
const ta=document.getElementById('case-notes');
if(!currentCaseId||!ta){btn.textContent='⚠ 사건을 먼저 선택하세요';return;}
const cur=ta.value.replace(/\s+$/,'');
ta.value=(cur?cur+'\n\n':'')+String(rawText).trim()+'\n';
saveCases();refreshNotesView();
btn.textContent='✅ 메모에 추가됨';btn.disabled=true;
};
msgDiv.appendChild(btn);
}
function addMsg(role,html){
const msgs=document.getElementById('chat-msgs');
const div=document.createElement('div');div.className='dt-msg '+role;
@@ -2753,7 +2773,7 @@ async function buildCaseContext(){
const KIND={photo:'사진',document:'문서',video:'영상',other:'기타'};
const lines=files.slice(0,150).map(f=>`- ${f.relPath||f.name} (${KIND[f.category]||f.category||'기타'}, ${String(f.mtime||'').slice(0,10)})`);
const more=files.length>150?`\n(외 ${files.length-150}개 생략)`:'';
return `\n\n[현재 사건 정보 — 앱이 자동 첨부]\n사건명: ${c.title||'제목 없음'}\n상태: ${c.status||'조사중'}\n\n사건 메모:\n${notes||'(없음)'}\n\n증거 파일 ${files.length}개 (사건 폴더: workspace/detective/${currentCaseId}/). 파일 내용은 포함되어 있지 않으니, 판단에 필요하면 파일 도구로 열어서 확인하고 읽지 않은 파일의 내용을 추측하지 마세요:\n${lines.join('\n')||'(없음)'}${more}`+lang;
return `\n\n[현재 사건 정보 — 앱이 자동 첨부]\n사건명: ${c.title||'제목 없음'}\n상태: ${c.status||'조사중'}\n\n사건 메모:\n${notes||'(없음)'}\n\n증거 파일 ${files.length}개 (사건 폴더: workspace/detective/${currentCaseId}/). 파일 내용은 포함되어 있지 않으니, 판단에 필요하면 파일 도구로 열어서 확인하고 읽지 않은 파일의 내용을 추측하지 마세요. 조회하지 않은 사업자번호·대표자·후기 점수 등은 지어내지 말고 "미확인"으로 쓰세요. 메모 저장은 write_note를 쓰지 말고 답변 아래 "📝 메모에 추가" 버튼을 안내하세요:\n${lines.join('\n')||'(없음)'}${more}`+lang;
}
async function callChat(message){
@@ -2793,6 +2813,7 @@ async function callChat(message){
}
}
}
addNoteBtn(msgDiv,textBuf);
}catch(e){
typingDiv.remove();
if(e.name!=='AbortError'){if(!bubble)bubble=addMsg('assistant','');bubble.innerHTML='<span style="color:var(--err)">오류: '+escHtml(e.message)+'</span>';}