diff --git a/bitnet_tools/ui/app.js b/bitnet_tools/ui/app.js index 8167313..29aa4f7 100644 --- a/bitnet_tools/ui/app.js +++ b/bitnet_tools/ui/app.js @@ -17,6 +17,8 @@ const UI = { schemaMappings: document.getElementById('schemaMappings'), prompt: document.getElementById('prompt'), answer: document.getElementById('answer'), + rawJson: document.getElementById('rawJson'), + codeDetails: document.getElementById('codeDetails'), analyzeAssist: document.getElementById('analyzeAssist'), confidenceBadge: document.getElementById('confidenceBadge'), switchToCsvBtn: document.getElementById('switchToCsvBtn'), @@ -95,6 +97,36 @@ const CONFIDENCE_THRESHOLD_DEFAULT = 0.7; const CANDIDATE_PREVIEW_ROWS = 5; + +const CODE_REQUEST_PATTERN = /코드도\s*보여줘/; + +function shouldShowCodeBlock() { + return CODE_REQUEST_PATTERN.test(String(UI.question?.value || '')); +} + +function formatCoreSummary(summary) { + if (!summary) return '요약 결과가 없습니다.'; + if (typeof summary === 'string') return summary; + if (Array.isArray(summary)) return summary.slice(0, 3).map((item, idx) => `${idx + 1}. ${item}`).join('\n'); + const lines = []; + const insights = Array.isArray(summary.insights) ? summary.insights : []; + if (insights.length) lines.push(...insights.slice(0, 3).map((item, idx) => `${idx + 1}. ${item}`)); + if (!lines.length) { + Object.entries(summary).slice(0, 3).forEach(([key, value]) => { + if (Array.isArray(value)) lines.push(`${key}: ${value.slice(0, 3).join(', ')}`); + else if (value && typeof value === 'object') lines.push(`${key}: ${JSON.stringify(value)}`); + else lines.push(`${key}: ${value}`); + }); + } + return lines.length ? lines.join('\n') : '핵심 결과를 추출하지 못했습니다.'; +} + +function renderPrimaryResult(data) { + if (UI.summary) UI.summary.textContent = formatCoreSummary(data?.summary); + if (UI.prompt) UI.prompt.textContent = data?.prompt || ''; + if (UI.rawJson) UI.rawJson.textContent = JSON.stringify(data || {}, null, 2); + if (UI.codeDetails) UI.codeDetails.hidden = !shouldShowCodeBlock(); +} function getInputTypeForFile(file) { const selected = UI.inputType?.value || 'auto'; if (selected !== 'auto') return selected; @@ -736,10 +768,9 @@ async function runAnalyzeFromPreprocessed(result, fallbackQuestion = '') { }; const data = await postJson('/api/analyze', body, '분석'); appState.latestPrompt = data.prompt; - UI.summary.textContent = JSON.stringify(data.summary, null, 2); + renderPrimaryResult(data); renderSchemaMappings(data); renderAnalyzeAssist(data); - if (UI.prompt) UI.prompt.textContent = data.prompt; if (UI.answer) UI.answer.textContent = ''; setStatus(STATUS.analyzeDone); } @@ -905,6 +936,7 @@ async function runAnalyze() { resetAnalyzeAssist(); setStatus(STATUS.analyzing); UI.summary.textContent = STATUS.analyzing; + if (UI.codeDetails) UI.codeDetails.hidden = true; if (UI.schemaMappings) UI.schemaMappings.textContent = '자동 매핑 결과를 계산 중입니다...'; toggleBusy(true); try { diff --git a/bitnet_tools/ui/index.html b/bitnet_tools/ui/index.html index 8c9b70a..aa4b689 100644 --- a/bitnet_tools/ui/index.html +++ b/bitnet_tools/ui/index.html @@ -9,20 +9,49 @@

BitNet CSV Analyzer

-

파일 입력 → 분석 실행 → 결과 확인 순서로 바로 시작하세요.

+

입력 1개 → 실행 → 결과 카드 확인

-
-

1) 작업 모드

+
+

요청 입력

+
- - +
-

빠른 시작은 핵심 분석에 집중하고, 고급 모드는 멀티 분석/모델 실행 옵션을 제공합니다.

-
    + + + +
    +
    -

    2) 입력

    +

    결과 카드

    +
    + 핵심 결과 +
    실행하면 핵심 결과가 여기에 표시됩니다.
    +
    + + + +
    + 고급 디버그 / 원본 JSON +
    자동 매핑 결과가 여기에 표시됩니다.
    +
    
    +          
    
    +          
    대기 중
    +
    +
    + 상세 오류 보기 +
    
    +          
    +
    +
    + +
    + 입력 데이터(파일/CSV) -
    - +
    +
    - -
    - - - -
    - -
    - -
    -
    추천 시각화 옵션이 여기에 표시됩니다.
    - - - -
    - -
    - - -
    -
    - -
    -

    고급: 모델 실행

    - - -
    - -
    -
    - -
    -

    3) 실행 상태

    -
    대기 중
    -
    - -
    -
    입력 전처리 대기 중
    -
    -
    - 상세 오류 보기 -
    
    -        
    -
    - - -
    -

    Geo 의심 케이스 추출

    -

    지도 렌더링 없이 의심 케이스 파일(CSV/JSON)을 생성합니다.

    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - -
    -
    Geo 추출 대기 중
    -
    - -
    -

    4) 결과

    - -

    스키마 자동 매핑

    -
    자동 매핑 결과가 여기에 표시됩니다.
    -

    데이터 요약

    -
    
    -      
    - -
    -

    생성 프롬프트

    -
    -
    
    -      
    - -
    -

    BitNet 응답

    -
    
    -      
    - -
    -

    고급: 멀티 CSV/Excel 분석

    - -
    -
    - - -
    -
    - - -
    -
    -
    - - - -
    -
    차트 작업 대기 중
    -
    - -
    -

    고급: 멀티 분석 대시보드(JSON)

    - -
    - -
    -
    - -

    인사이트 필터

    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -

    인사이트 리스트

    -
    - -

    이유 후보 보기

    -
    이유 후보가 없습니다.
    - -

    드릴다운(근거 데이터)

    -
    인사이트를 선택하면 근거 데이터가 표시됩니다.
    - +
    diff --git a/bitnet_tools/ui/styles.css b/bitnet_tools/ui/styles.css index 7f6158c..e8dc99d 100644 --- a/bitnet_tools/ui/styles.css +++ b/bitnet_tools/ui/styles.css @@ -139,3 +139,17 @@ select { border-radius: 8px; padding: 10px; } + +.simple-panel textarea#question { + font-size: 16px; +} +.result-card { + max-width: 720px; + margin: 0 auto; +} +.result-card pre { + min-height: 140px; +} +.container { + max-width: 840px; +}