From 761c42a6371a370d8efee2fc77a6c2fbbb0d3955 Mon Sep 17 00:00:00 2001 From: sangwook yoo Date: Mon, 1 Jun 2026 09:12:15 +0900 Subject: [PATCH] =?UTF-8?q?feat(pdf-import):=20=EB=B6=84=EC=84=9D=20?= =?UTF-8?q?=EC=8B=A0=EB=A2=B0=EB=8F=84=20=EA=B2=8C=EC=9D=B4=ED=8C=85=20+?= =?UTF-8?q?=20=EC=A0=80=EC=8B=A0=EB=A2=B0=20=ED=99=95=EC=9D=B8=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80(ko/ja)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - analyzePdfAndApply에서 confidence < 0.6이면 반영 전 useSwal confirm으로 사용자 확인 - pdf.import.confirm.low.confidence 메시지 키 ko/ja 추가 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../modal/placementShape/PlacementShapeSetting.jsx | 14 ++++++++++++++ src/locales/ja.json | 1 + src/locales/ko.json | 1 + 3 files changed, 16 insertions(+) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index fc4f9e08..bad40354 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -44,6 +44,8 @@ const PDF_PAGE_MODE = { SPECIFY: 'specify', } +const PDF_CONFIDENCE_THRESHOLD = 0.6 // 이 값 미만이면 반영 전 사용자 확인 + /** * 지붕 레이아웃 */ @@ -189,6 +191,18 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, pla return false } + if (typeof payload.confidence === 'number' && payload.confidence < PDF_CONFIDENCE_THRESHOLD) { + const proceed = await new Promise((resolve) => { + swalFire({ + text: getMessage('pdf.import.confirm.low.confidence', [Math.round(payload.confidence * 100)]), + type: 'confirm', + confirmFn: () => resolve(true), + denyFn: () => resolve(false), + }) + }) + if (!proceed) return false + } + const applied = await applyOuterline(payload.outerline, { unit: payload.unit || 'mm' }) if (!applied) { swalFire({ text: getMessage('pdf.import.error.apply'), type: 'alert' }) diff --git a/src/locales/ja.json b/src/locales/ja.json index 88e88a2a..d1873a7c 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -19,6 +19,7 @@ "pdf.import.button.analyzing": "解析中...", "pdf.import.success": "外壁線をキャンバスに反映しました。", "pdf.import.confirm.overwrite": "既存の外壁線があります。新しい外壁線で上書きしますか?", + "pdf.import.confirm.low.confidence": "図面の認識信頼度が低いです({0}%)。それでも外壁線を反映しますか?ページを指定して再度お試しいただくこともできます。", "pdf.import.error.network": "ネットワークエラーで解析リクエストに失敗しました。", "pdf.import.error.analyze": "PDF 解析に失敗しました。", "pdf.import.error.no.floorplan": "平面図を認識できませんでした。別の PDF で再度お試しください。", diff --git a/src/locales/ko.json b/src/locales/ko.json index 956d552d..ada74c21 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -19,6 +19,7 @@ "pdf.import.button.analyzing": "분석 중...", "pdf.import.success": "외곽선이 캔버스에 반영되었습니다.", "pdf.import.confirm.overwrite": "기존 외곽선이 있습니다. 새 외곽선으로 덮어쓰시겠습니까?", + "pdf.import.confirm.low.confidence": "도면 인식 신뢰도가 낮습니다({0}%). 그래도 외곽선을 반영하시겠습니까? 페이지를 직접 지정해 다시 시도할 수도 있습니다.", "pdf.import.error.network": "네트워크 오류로 분석 요청에 실패했습니다.", "pdf.import.error.analyze": "PDF 분석에 실패했습니다.", "pdf.import.error.no.floorplan": "평면도를 인식하지 못했습니다. 다른 PDF 로 다시 시도해 주세요.",