feat(roof-shape): 지붕형상 자동판독 결과 로깅 추가 — 수동 QA 보조
[작업내용] : - route.js: Gemini roofShape 원본+정규화 결과 logger.debug (서버 콘솔) - useRoofShapeSetting: descriptor→매칭 shapeNum+패턴명 logger.info (브라우저 콘솔, pre-select 시점) - raw console.log 대신 logger 사용(NEXT_PUBLIC_ENABLE_LOGGING=true 시 출력, 프로덕션 무음) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
729198b650
commit
6457817e70
@ -343,6 +343,10 @@ export async function POST(req) {
|
|||||||
return NextResponse.json({ error: { code: validation.code, message: validation.message } }, { status: 422 })
|
return NextResponse.json({ error: { code: validation.code, message: validation.message } }, { status: 422 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const roofShape = normalizeRoofShape(parsed.roofShape)
|
||||||
|
// 수동 QA 용 — Gemini 가 판독한 지붕형상 원본과 정규화 결과를 함께 남긴다(NEXT_PUBLIC_ENABLE_LOGGING=true 시).
|
||||||
|
logger.debug('[gemini/floor-plan] roofShape 판독', { raw: parsed.roofShape ?? null, normalized: roofShape })
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
outerline: parsed.outerline,
|
outerline: parsed.outerline,
|
||||||
unit: parsed.unit || 'mm',
|
unit: parsed.unit || 'mm',
|
||||||
@ -350,7 +354,7 @@ export async function POST(req) {
|
|||||||
confidence: parsed.confidence ?? null,
|
confidence: parsed.confidence ?? null,
|
||||||
notes: parsed.notes ?? null,
|
notes: parsed.notes ?? null,
|
||||||
selectedDrawingType: parsed.selectedDrawingType ?? null,
|
selectedDrawingType: parsed.selectedDrawingType ?? null,
|
||||||
roofShape: normalizeRoofShape(parsed.roofShape),
|
roofShape,
|
||||||
empty: validation.empty,
|
empty: validation.empty,
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import { usePolygon } from '@/hooks/usePolygon'
|
|||||||
import { useMode } from '@/hooks/useMode'
|
import { useMode } from '@/hooks/useMode'
|
||||||
import { useLine } from '@/hooks/useLine'
|
import { useLine } from '@/hooks/useLine'
|
||||||
import { outerLineFixState, pdfRoofShapeDescriptorState } from '@/store/outerLineAtom'
|
import { outerLineFixState, pdfRoofShapeDescriptorState } from '@/store/outerLineAtom'
|
||||||
import { matchRoofShapePattern } from '@/common/roofShapePattern'
|
import { matchRoofShapePattern, getRoofShapePatternByShapeNum } from '@/common/roofShapePattern'
|
||||||
|
import { logger } from '@/util/logger'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { usePopup } from '@/hooks/usePopup'
|
import { usePopup } from '@/hooks/usePopup'
|
||||||
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
||||||
@ -94,6 +95,14 @@ export function useRoofShapeSetting(id) {
|
|||||||
// PDF 분석 지붕형상 descriptor 가 있으면 매칭 버튼을 pre-select 한다(자동 선택만 — handleSave 는 사용자 [적용]).
|
// PDF 분석 지붕형상 descriptor 가 있으면 매칭 버튼을 pre-select 한다(자동 선택만 — handleSave 는 사용자 [적용]).
|
||||||
if (pdfRoofShapeDescriptor) {
|
if (pdfRoofShapeDescriptor) {
|
||||||
const matched = matchRoofShapePattern(pdfRoofShapeDescriptor)
|
const matched = matchRoofShapePattern(pdfRoofShapeDescriptor)
|
||||||
|
const pattern = matched != null ? getRoofShapePatternByShapeNum(matched) : null
|
||||||
|
// 수동 QA 용 — Gemini 가 판독한 지붕형상과 자동 선택된 버튼을 콘솔에 남긴다(NEXT_PUBLIC_ENABLE_LOGGING=true 시).
|
||||||
|
logger.info('[지붕형상 자동판독]', {
|
||||||
|
descriptor: pdfRoofShapeDescriptor,
|
||||||
|
matchedShapeNum: matched,
|
||||||
|
pattern: pattern ? `${pattern.shapeNum}:${pattern.key}(${pattern.note})` : null,
|
||||||
|
result: matched != null ? 'pre-select(사용자 [적용] 대기)' : '매칭 실패 → 수동 선택(기본값 유지)',
|
||||||
|
})
|
||||||
if (matched != null) setShapeNum(matched)
|
if (matched != null) setShapeNum(matched)
|
||||||
resetPdfRoofShapeDescriptor() // consume-once: 비-PDF 재진입 시 stale 적용 방지
|
resetPdfRoofShapeDescriptor() // consume-once: 비-PDF 재진입 시 stale 적용 방지
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user