feat: 전체 판례 검색과 판례 탭 추가
This commit is contained in:
1 parent
fa15117df7
commit
5386222f1b
11 files changed
+443
-44
No files matched your search
+161
-5
@@ -170,6 +170,21 @@
|
||||
.corpus-table th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }
|
||||
.corpus-table tr:hover { background: var(--panel-2); }
|
||||
.corpus-table .doc-id { font-family: ui-monospace, monospace; font-size: 11px; color: var(--accent); }
|
||||
.precedent-toolbar {
|
||||
display: grid; grid-template-columns: minmax(220px, 1fr) 160px 180px auto;
|
||||
gap: 10px; align-items: end; margin-bottom: 14px;
|
||||
}
|
||||
.precedent-toolbar button { margin-top: 4px; }
|
||||
.precedent-table .cited-row { background: rgba(88, 166, 255, 0.10); }
|
||||
.precedent-table .case-link { color: var(--accent); text-decoration: none; font-family: ui-monospace, monospace; }
|
||||
.precedent-table .title-cell { min-width: 280px; }
|
||||
.precedent-table .holding { margin-top: 5px; color: var(--muted); font-size: 11px; white-space: pre-line; }
|
||||
.precedent-table .tag { display: inline-block; margin: 2px 3px 2px 0; padding: 1px 5px; border: 1px solid var(--border); border-radius: 10px; font-size: 10px; }
|
||||
.precedent-summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
|
||||
.precedent-summary strong { color: var(--text); }
|
||||
.precedent-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }
|
||||
.precedent-pager button { margin: 0; }
|
||||
@media (max-width: 900px) { .precedent-toolbar { grid-template-columns: 1fr 1fr; } }
|
||||
.btn-danger {
|
||||
margin: 0; padding: 3px 10px; background: transparent; color: var(--danger);
|
||||
border: 1px solid var(--danger); border-radius: 4px; font-size: 11px; cursor: pointer;
|
||||
@@ -233,6 +248,7 @@
|
||||
display: inline-block; margin: 2px 4px 2px 0; padding: 3px 8px;
|
||||
color: var(--accent); background: rgba(88, 166, 255, 0.1);
|
||||
border: 1px solid rgba(88, 166, 255, 0.45); border-radius: 12px; font-size: 11px;
|
||||
cursor: pointer; font-family: inherit; font-weight: 500;
|
||||
}
|
||||
.legal-disclaimer { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--warning); font-size: 11px; }
|
||||
|
||||
@@ -267,6 +283,7 @@
|
||||
<nav class="tab-nav">
|
||||
<button class="tab-btn active" data-tab="detect">탐지 검토</button>
|
||||
<button class="tab-btn" data-tab="corpus">코퍼스 관리</button>
|
||||
<button class="tab-btn" data-tab="precedents">판례</button>
|
||||
</nav>
|
||||
<span id="health-badge" class="badge">엔진 확인 중…</span>
|
||||
</div>
|
||||
@@ -443,6 +460,47 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<main id="tab-precedents" class="tab-content" style="max-width: 1600px; margin: 0 auto; padding: 24px 28px;">
|
||||
<section class="panel" style="width: 100%; overflow-x: auto;">
|
||||
<h2>판례 검색 후보</h2>
|
||||
<p style="color: var(--muted); font-size: 12px; margin-top: 0;">
|
||||
적재된 판례 전체를 검색 후보로 사용합니다. A/B/C는 사람 검토 수준을 나타내는 보조 신호이며,
|
||||
미검토 판례도 내용 관련성이 높으면 인용될 수 있습니다.
|
||||
</p>
|
||||
<div class="precedent-toolbar">
|
||||
<label>사건번호·제목·판시 내용 검색
|
||||
<input type="text" id="precedent-query" placeholder="예: 실질적 유사성, 2014다14375">
|
||||
</label>
|
||||
<label>검토 등급
|
||||
<select id="precedent-grade-filter">
|
||||
<option value="">전체</option><option value="A">A 직접 적용</option>
|
||||
<option value="B">B 조건부</option><option value="C">C 참고</option>
|
||||
<option value="unreviewed">미검토</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>저작물 유형
|
||||
<select id="precedent-type-filter">
|
||||
<option value="">전체</option><option value="literary">문학·출판</option>
|
||||
<option value="musical">음악</option><option value="visual">미술·사진·영상</option>
|
||||
<option value="software">컴퓨터프로그램</option>
|
||||
</select>
|
||||
</label>
|
||||
<button id="precedent-search-btn">검색</button>
|
||||
</div>
|
||||
<div id="precedent-cited-summary" class="precedent-summary">이번 탐지에서 인용된 판례가 없습니다.</div>
|
||||
<div id="precedent-list-summary" class="precedent-summary">판례 목록을 불러오는 중…</div>
|
||||
<table class="corpus-table precedent-table">
|
||||
<thead><tr><th>사건번호</th><th>등급</th><th>사건·판시 요약</th><th>저작물 유형</th><th>쟁점</th><th>출처</th></tr></thead>
|
||||
<tbody id="precedent-tbody"><tr><td colspan="6" style="text-align:center; padding:20px; color:var(--muted);">로딩 중…</td></tr></tbody>
|
||||
</table>
|
||||
<div class="precedent-pager">
|
||||
<button class="ghost" id="precedent-prev-btn">이전</button>
|
||||
<span id="precedent-page-label">1 / 1</span>
|
||||
<button class="ghost" id="precedent-next-btn">다음</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<a href="docs">API 문서 (Swagger)</a> ·
|
||||
<a href="openapi.json">OpenAPI 스펙</a> ·
|
||||
@@ -475,6 +533,7 @@ const SAMPLES = {
|
||||
},
|
||||
clear: { title: "", author: "", text: "" },
|
||||
};
|
||||
let lastCitedPrecedentIds = new Set();
|
||||
|
||||
const TYPE_LABELS = {
|
||||
copy: "복제 (Copy)",
|
||||
@@ -676,6 +735,8 @@ function renderLegalRisk(risk) {
|
||||
const selectedIds = risk.llm_matched_precedent_ids && risk.llm_matched_precedent_ids.length
|
||||
? risk.llm_matched_precedent_ids
|
||||
: (risk.precedent_ids || []);
|
||||
lastCitedPrecedentIds = new Set(selectedIds);
|
||||
renderCitedPrecedentSummary();
|
||||
const confidence = Number.isFinite(risk.llm_confidence)
|
||||
? `<div class="legal-risk-confidence">${(risk.llm_confidence * 100).toFixed(0)}<small style="font-size: 11px; color: var(--muted);"> / 100 자기평가</small></div>`
|
||||
: "";
|
||||
@@ -690,17 +751,17 @@ function renderLegalRisk(risk) {
|
||||
const chip = (id) => {
|
||||
const g = grades[id];
|
||||
return g
|
||||
? `<span class="precedent-chip g-${g}">${escapeHtml(id)}<span class="grade">${g}</span></span>`
|
||||
: `<span class="precedent-chip">${escapeHtml(id)}</span>`;
|
||||
? `<button type="button" class="precedent-chip g-${g}" onclick="openPrecedentTab('${escapeJs(id)}')">${escapeHtml(id)}<span class="grade">${g}</span></button>`
|
||||
: `<button type="button" class="precedent-chip" onclick="openPrecedentTab('${escapeJs(id)}')">${escapeHtml(id)}</button>`;
|
||||
};
|
||||
const legend = selectedIds.length
|
||||
? `<div class="precedent-legend">A 직접 적용 · B 조건부 · C 참고 · 인용 후보는 사람 검토를 마친 리스트업 판례로 제한</div>`
|
||||
? `<div class="precedent-legend">A/B/C는 사람 검토 등급 · 미표기는 미검토 · 등급보다 유형·쟁점·판시 내용 관련성을 우선</div>`
|
||||
: "";
|
||||
const precedents = selectedIds.length
|
||||
? selectedIds.map(chip).join("") + legend
|
||||
: noCorpus
|
||||
? '<div class="legal-risk-meta precedent-empty">판례가 적재되지 않아 판단 근거를 제시할 수 없습니다.</div>'
|
||||
: '<div class="legal-risk-meta">이 건과 저작물 유형·법적 태그가 맞는 판례가 없습니다.</div>';
|
||||
: '<div class="legal-risk-meta">이 건의 저작물 유형과 입력 내용에 맞는 판례가 없습니다.</div>';
|
||||
// 적재 수를 함께 보여 줘야 "판례를 안 쓰는 것"이 아니라 "이 건에 맞는 게 없는 것"임이 드러난다.
|
||||
const precedentCountLabel = Number.isFinite(precedentCount)
|
||||
? `<span class="count">인용 ${selectedIds.length}건 / 적재 ${precedentCount}건</span>`
|
||||
@@ -853,9 +914,9 @@ document.querySelectorAll(".tab-btn").forEach((btn) => {
|
||||
const tab = btn.dataset.tab;
|
||||
document.getElementById(`tab-${tab}`).classList.add("active");
|
||||
if (tab === "corpus") loadCorpus();
|
||||
if (tab === "precedents") loadPrecedents();
|
||||
});
|
||||
});
|
||||
|
||||
// ========== 코퍼스 관리 ==========
|
||||
async function loadCorpus() {
|
||||
const tbody = document.getElementById("corpus-tbody");
|
||||
@@ -973,6 +1034,97 @@ function escapeJs(s) {
|
||||
return String(s).replace(/['\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
// ========== 판례 목록 ==========
|
||||
const PRECEDENT_PAGE_SIZE = 25;
|
||||
let precedentOffset = 0;
|
||||
let precedentTotal = 0;
|
||||
|
||||
function renderCitedPrecedentSummary() {
|
||||
const el = document.getElementById("precedent-cited-summary");
|
||||
if (!el) return;
|
||||
const ids = [...lastCitedPrecedentIds];
|
||||
el.innerHTML = ids.length
|
||||
? `<strong>이번 탐지 인용 ${ids.length}건</strong> ${ids.map(id =>
|
||||
`<button class="ghost" style="margin:0; padding:3px 8px;" onclick="searchPrecedentById('${escapeJs(id)}')">${escapeHtml(id)}</button>`
|
||||
).join("")}`
|
||||
: "이번 탐지에서 인용된 판례가 없습니다.";
|
||||
}
|
||||
|
||||
function searchPrecedentById(caseId) {
|
||||
document.getElementById("precedent-query").value = caseId;
|
||||
precedentOffset = 0;
|
||||
loadPrecedents();
|
||||
}
|
||||
|
||||
function openPrecedentTab(caseId) {
|
||||
document.querySelector('.tab-btn[data-tab="precedents"]').click();
|
||||
searchPrecedentById(caseId);
|
||||
}
|
||||
|
||||
async function loadPrecedents() {
|
||||
const tbody = document.getElementById("precedent-tbody");
|
||||
const q = document.getElementById("precedent-query").value.trim();
|
||||
const grade = document.getElementById("precedent-grade-filter").value;
|
||||
const workType = document.getElementById("precedent-type-filter").value;
|
||||
const params = new URLSearchParams({
|
||||
offset: String(precedentOffset), limit: String(PRECEDENT_PAGE_SIZE),
|
||||
});
|
||||
if (q) params.set("q", q);
|
||||
if (grade) params.set("grade", grade);
|
||||
if (workType) params.set("work_type", workType);
|
||||
tbody.innerHTML = '<tr><td colspan="6" style="text-align:center; padding:20px; color:var(--muted);">로딩 중…</td></tr>';
|
||||
try {
|
||||
const resp = await fetch(`v1/precedents?${params}`);
|
||||
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
|
||||
const data = await resp.json();
|
||||
precedentTotal = data.total;
|
||||
document.getElementById("precedent-list-summary").innerHTML =
|
||||
`<strong>검색 ${data.total}건</strong> · 전체 적재 ${data.loaded_total}건 · A/B/C 검토 ${data.graded_total}건 · 미검토 ${data.loaded_total - data.graded_total}건`;
|
||||
if (!data.items.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="6" style="text-align:center; padding:20px; color:var(--muted);">조건에 맞는 판례가 없습니다.</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = data.items.map(p => {
|
||||
const cited = lastCitedPrecedentIds.has(p.case_id);
|
||||
const grade = p.grade
|
||||
? `<span class="precedent-chip g-${p.grade}">${p.grade}</span>`
|
||||
: '<span style="color:var(--muted);">미검토</span>';
|
||||
const tags = [...(p.criteria || []), ...(p.legal_tags || [])]
|
||||
.map(tag => `<span class="tag">${escapeHtml(tag)}</span>`).join("");
|
||||
return `<tr class="${cited ? "cited-row" : ""}">
|
||||
<td><a class="case-link" href="${escapeHtml(p.source_url)}" target="_blank" rel="noopener">${escapeHtml(p.case_id)}</a>${cited ? '<div style="color:var(--accent); font-size:10px; margin-top:4px;">이번 탐지 인용</div>' : ""}</td>
|
||||
<td>${grade}</td>
|
||||
<td class="title-cell"><strong>${escapeHtml(p.title)}</strong><details><summary style="cursor:pointer; color:var(--accent); font-size:11px;">판시 요약 보기</summary><div class="holding">${escapeHtml(p.holding_excerpt)}</div></details></td>
|
||||
<td>${(p.work_types || []).map(t => `<span class="tag">${escapeHtml(t)}</span>`).join("") || '<span style="color:var(--muted);">공통</span>'}</td>
|
||||
<td>${tags || '<span style="color:var(--muted);">미분류</span>'}</td>
|
||||
<td><a class="case-link" href="${escapeHtml(p.source_url)}" target="_blank" rel="noopener">공식 판례 ↗</a></td>
|
||||
</tr>`;
|
||||
}).join("");
|
||||
}
|
||||
const page = Math.floor(precedentOffset / PRECEDENT_PAGE_SIZE) + 1;
|
||||
const pages = Math.max(1, Math.ceil(data.total / PRECEDENT_PAGE_SIZE));
|
||||
document.getElementById("precedent-page-label").textContent = `${page} / ${pages}`;
|
||||
document.getElementById("precedent-prev-btn").disabled = precedentOffset === 0;
|
||||
document.getElementById("precedent-next-btn").disabled = precedentOffset + PRECEDENT_PAGE_SIZE >= data.total;
|
||||
} catch (err) {
|
||||
tbody.innerHTML = `<tr><td colspan="6" style="color:var(--danger); padding:20px;">로딩 실패: ${escapeHtml(err.message)}</td></tr>`;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("precedent-search-btn").addEventListener("click", () => {
|
||||
precedentOffset = 0; loadPrecedents();
|
||||
});
|
||||
document.getElementById("precedent-query").addEventListener("keydown", (event) => {
|
||||
if (event.key === "Enter") { precedentOffset = 0; loadPrecedents(); }
|
||||
});
|
||||
document.getElementById("precedent-prev-btn").addEventListener("click", () => {
|
||||
precedentOffset = Math.max(0, precedentOffset - PRECEDENT_PAGE_SIZE); loadPrecedents();
|
||||
});
|
||||
document.getElementById("precedent-next-btn").addEventListener("click", () => {
|
||||
if (precedentOffset + PRECEDENT_PAGE_SIZE < precedentTotal) {
|
||||
precedentOffset += PRECEDENT_PAGE_SIZE; loadPrecedents();
|
||||
}
|
||||
});
|
||||
|
||||
// 헬스 체크 + 코퍼스 정보 표시
|
||||
// 적재된 판례 수. 저작권 판단 카드에서 '인용 N / 적재 M' 을 보여주는 데 쓴다.
|
||||
let precedentCount = null;
|
||||
@@ -1006,6 +1158,10 @@ async function checkHealth() {
|
||||
document.getElementById("precedent-count").textContent = "확인 불가";
|
||||
}
|
||||
}
|
||||
const initialTab = new URLSearchParams(window.location.search).get("tab");
|
||||
if (["detect", "corpus", "precedents"].includes(initialTab)) {
|
||||
document.querySelector(`.tab-btn[data-tab="${initialTab}"]`).click();
|
||||
}
|
||||
checkHealth();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user