Skip to content

feat(ui): 문서 추출 실패/저신뢰 시 CSV 전환 동선 및 후보 테이블 선택 UI 추가#41

Merged
rad1092 merged 1 commit into
mainfrom
codex/add-alternative-flow-for-document-failure
Feb 15, 2026
Merged

feat(ui): 문서 추출 실패/저신뢰 시 CSV 전환 동선 및 후보 테이블 선택 UI 추가#41
rad1092 merged 1 commit into
mainfrom
codex/add-alternative-flow-for-document-failure

Conversation

@rad1092
Copy link
Copy Markdown
Owner

@rad1092 rad1092 commented Feb 15, 2026

Motivation

  • 문서(내부 추출) 기반 분석에서 추출 실패나 낮은 신뢰도에 대해 사용자가 즉시 대응할 수 있는 대체 동선이 필요했습니다.
  • 추출 결과에 후보 테이블이 여러 개 존재할 수 있어, 사용자가 적절한 후보를 선택하고 상위 행을 미리 확인할 수 있어야 합니다.
  • 기존의 error_detail 패널과 일관되게 오류 세부 정보를 연결해 디버깅 경험을 개선하려고 했습니다.

Description

  • 결과 패널에 보조 영역 analyzeAssist를 추가하고 confidenceBadge, switchToCsvBtn, analyzeRecommendation, candidateTableWrap, candidateTableSelect, candidateTablePreview 마크업을 추가했습니다 (bitnet_tools/ui/index.html).
  • 프런트엔드에서 분석 응답의 여러 신호(confidence, confidence_threshold, candidate_tables, error_detail, 추출 실패 플래그 등)를 통합 파싱하는 유틸을 추가하고(extractAnalyzeSignals), 이를 기반으로 보조 UI를 렌더링하도록 구현했습니다 (bitnet_tools/ui/app.js).
  • 후보 테이블이 2개 이상일 때 선택 드롭다운과 상위 N행(기본 5행) 미리보기 기능을 제공하도록 구현했습니다 (renderCandidateTableSelection, renderCandidateTablePreview).
  • 분석 실행 시 보조 UI 초기화(resetAnalyzeAssist) 및 응답 직후 보조 UI 표시(renderAnalyzeAssist)를 호출하도록 통합했습니다.
  • 사용자가 즉시 CSV 업로드 경로로 전환할 수 있도록 CSV 업로드로 전환 버튼 클릭 핸들러를 바인딩했고, 후보 선택 변경 이벤트를 바인딩했습니다.
  • 기존 error_detail을 발견하면 기존 오류 상세 패널(showError)에 내용을 채워 일관된 오류 노출을 유지합니다.
  • 변경 대상 파일: bitnet_tools/ui/index.html, bitnet_tools/ui/app.js (프론트엔드 변경만, 백엔드 API 계약 변경 없음).

Testing

  • node --check bitnet_tools/ui/app.js로 문법 검사(정상 종료) — 성공.
  • 로컬 UI 서버 실행으로 통합 확인: python -m bitnet_tools.cli ui --host 0.0.0.0 --port 8765로 서버 기동 후 접속 확인 — 성공.
  • Playwright 기반 E2E 스크립트로 http://127.0.0.1:8765에 접속해 fetch를 mock(저신뢰 + 복수 후보 시나리오)한 뒤 보조 UI 렌더링을 검증하고 스크린샷을 캡처함(artifacts/ui-analyze-assist.png) — 성공.

Codex Task

@rad1092 rad1092 merged commit e9f0da4 into main Feb 15, 2026
4 checks passed
@rad1092 rad1092 deleted the codex/add-alternative-flow-for-document-failure branch February 15, 2026 04:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98bfb0852d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bitnet_tools/ui/app.js
Comment on lines +267 to +271
UI.candidateTableSelect.innerHTML = candidateTables.map((table, idx) => {
const label = table?.label || table?.name || `후보 ${idx + 1}`;
const score = toNumberOrNull(table?.confidence ?? table?.score);
const suffix = score === null ? '' : ` (신뢰도 ${score.toFixed(2)})`;
return `<option value="${idx}">${label}${suffix}</option>`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape candidate labels before setting select innerHTML

renderCandidateTableSelection writes table.label/table.name directly into innerHTML, so analyze-response data is treated as markup instead of plain text. If a candidate label contains HTML (for example from extracted document content), it can break the DOM or inject executable elements in the page context; this is especially risky because the value comes from server response data, not a trusted constant. Build the <option> nodes with document.createElement and textContent (or escape the label) to prevent HTML injection.

Useful? React with 👍 / 👎.

Comment thread bitnet_tools/ui/app.js
Comment on lines +926 to +929
setMode('quick');
if (UI.inputType) UI.inputType.value = 'csv';
UI.csvFile?.focus();
setStatus('CSV 업로드로 전환되었습니다. CSV 파일을 선택한 뒤 다시 분석하세요.');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear stale file selection when switching to CSV mode

The CSV-switch click handler only changes inputType to csv but keeps the previous file selection intact, so users who came from an extraction failure can immediately re-run analysis against the old non-CSV file. In buildAnalyzeRequest, that stale file is then read with file.text() as if it were CSV, which commonly produces another parsing failure instead of actually switching workflows. Resetting the file input (or forcing a new CSV pick) when this button is used would prevent this retry loop.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant