From ef9687b0bf21f97aaf7aecb89534d254af0a8a2d Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Wed, 15 Apr 2026 10:27:03 +0900 Subject: [PATCH] =?UTF-8?q?feat(library):=20Phase=202B=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=20=EC=83=81=EC=84=B8=20facet=20=ED=8E=B8=EC=A7=91=20+?= =?UTF-8?q?=20=EC=97=85=EB=A1=9C=EB=93=9C=20facet=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FileInfoView에 회사/주제/연도/문서유형 select 4개 추가. facet 옵션은 /api/library/facets에서 로드, 세션 캐시. 업로드 엔드포인트에 facet Form 파라미터 4개 추가. 업로드 시 현재 선택 facet 자동 전달 + 미리보기 텍스트. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/api/documents.py | 8 ++ .../components/editors/FileInfoView.svelte | 92 ++++++++++++++++++- frontend/src/routes/library/+page.svelte | 16 ++++ 3 files changed, 115 insertions(+), 1 deletion(-) diff --git a/app/api/documents.py b/app/api/documents.py index 4b0ec26..13d4ce6 100644 --- a/app/api/documents.py +++ b/app/api/documents.py @@ -422,6 +422,10 @@ async def upload_document( session: Annotated[AsyncSession, Depends(get_session)], doc_purpose: str | None = Form(None, description="business | knowledge"), library_path: str | None = Form(None, description="자료실 경로 (자동 @library/ 태깅)"), + facet_company: str | None = Form(None), + facet_topic: str | None = Form(None), + facet_year: int | None = Form(None), + facet_doctype: str | None = Form(None), ): """파일 업로드 → Inbox 저장 + DB 등록 + 처리 큐 등록""" from core.library import DEFAULT_LIBRARY_PATH, LIBRARY_PREFIX, normalize_library_path @@ -490,6 +494,10 @@ async def upload_document( source_channel="manual", doc_purpose=doc_purpose, user_tags=[library_tag] if library_tag else [], + facet_company=facet_company or None, + facet_topic=facet_topic or None, + facet_year=facet_year, + facet_doctype=facet_doctype or None, ) session.add(doc) await session.flush() diff --git a/frontend/src/lib/components/editors/FileInfoView.svelte b/frontend/src/lib/components/editors/FileInfoView.svelte index 09b087c..39963db 100644 --- a/frontend/src/lib/components/editors/FileInfoView.svelte +++ b/frontend/src/lib/components/editors/FileInfoView.svelte @@ -1,10 +1,14 @@
@@ -82,4 +107,69 @@
{formatDate(doc.created_at)}
+ + +

탐색 축

+
+
+
회사
+
+ +
+
+
+
주제
+
+ +
+
+
+
연도
+
+ +
+
+
+
문서유형
+
+ +
+
+
diff --git a/frontend/src/routes/library/+page.svelte b/frontend/src/routes/library/+page.svelte index b9890d0..15d6781 100644 --- a/frontend/src/routes/library/+page.svelte +++ b/frontend/src/routes/library/+page.svelte @@ -287,6 +287,10 @@ formData.append('file', file); formData.append('doc_purpose', 'business'); formData.append('library_path', activePath || DEFAULT_LIBRARY_PATH); + if (activeFacetCompany) formData.append('facet_company', activeFacetCompany); + if (activeFacetTopic) formData.append('facet_topic', activeFacetTopic); + if (activeFacetYear) formData.append('facet_year', activeFacetYear); + if (activeFacetDoctype) formData.append('facet_doctype', activeFacetDoctype); try { await api('/documents/', { method: 'POST', body: formData }); success++; @@ -606,6 +610,18 @@ {uploadingCount > 0 ? `업로드 중 (${uploadingCount})` : '업로드'} + + {#if hasAnyFacet} + + 적용: {[ + activeFacetCompany && `회사:${activeFacetCompany}`, + activeFacetTopic && `주제:${activeFacetTopic}`, + activeFacetYear && `연도:${activeFacetYear}`, + activeFacetDoctype && `유형:${activeFacetDoctype}`, + ].filter(Boolean).join(' / ')} + + {/if} +