초기 커밋 — 협상 AI 에이전트 정본: 엔진·데모 콘솔·측정 인프라·증빙

- server/: FastAPI 협상 엔진 (5라운드, Q-Table/UCB, 페르소나 계측, :53117)
- frontend/: 데모 콘솔 (React+Tailwind → nginx, /api 프록시)
- eval/·testdata/: 지표 8종 측정 하네스 + 재현 가능 테스트셋
- results/: 측정 증빙 (지표별 result+provenance, raw 원본 동결+SHA256)
  ① 86.0 · ② 76.0 · ③ 5.99% · ⑥ p95 3.61ms · ⑦ 611만/년 · ⑧ 91/100 · ⑨ 99.71 · ⑩ 97.99
- docker-compose.yml + run.sh: backend+frontend 일괄 기동

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0112XUWF4bc3gGrEt8vsYCzy
This commit is contained in:
민헌andClaude Fable 5 committed 2026-08-31 13:09:52 +09:00
commit dfb9ad6e66
268 files changed
+164241

No files matched your search

+140
View File
@@ -0,0 +1,140 @@
import type { ChatMetadata } from '../lib/api'
import type { DemoCase } from '../content/cases'
import type { NegoState } from '../App'
import { PriceTrack } from './PriceTrack'
const FLOW = ['서비스안내', '담당자확인', '협상품목안내', '가격협상', '협상종료']
function flowIndex(step: string): number {
if (step.includes('종료') || step.includes('완료') || step.includes('실패')) return 4
if (step.includes('가격') || step.startsWith('wild_')) return 3
const i = FLOW.indexOf(step)
return i >= 0 ? i : 0
}
function Panel({ title, children }: { title: string; children: React.ReactNode }) {
return (
<section className="rounded-xl border border-line bg-panel p-4">
<h2 className="text-xs font-semibold uppercase tracking-wider text-muted">{title}</h2>
<div className="mt-3">{children}</div>
</section>
)
}
export function Dashboard({
demoCase, nego, meta, priceTrail, started,
}: {
demoCase: DemoCase
nego: NegoState
meta: ChatMetadata | null
priceTrail: number[]
started: boolean
}) {
const fi = started ? flowIndex(nego.step) : -1
const tension = meta?.tension ?? null
const indicator = meta?.indicator_value ?? null
return (
<aside className="flex flex-col gap-3 min-[960px]:min-h-0 min-[960px]:overflow-y-auto">
<Panel title="가격 트랙">
<PriceTrack demoCase={demoCase} priceTrail={priceTrail} />
<dl className="mt-3 flex items-center justify-between border-t border-line pt-2.5 text-xs">
<div className="flex items-center gap-1.5">
<dt className="text-muted">시나리오</dt>
<dd className="font-mono font-medium">{demoCase.scenario.replace('Scenario_', '')}</dd>
</div>
<div className="flex items-center gap-1.5">
<dt className="text-muted">인터넷 최저가</dt>
<dd className="font-mono font-medium">{demoCase.card_data.internet_min_price.toLocaleString()}원</dd>
</div>
</dl>
<p className="mt-2 text-[11px] leading-relaxed text-muted">
앵커가·목표가는 실제 협상에서 공급사에게 보이지 않는 구매측 내부 기준입니다.
</p>
</Panel>
<Panel title="협상 진행">
<ol className="flex items-center gap-1">
{FLOW.map((s, i) => (
<li key={s} className="flex flex-1 flex-col items-center gap-1.5">
<div
className={`h-1.5 w-full rounded-full ${
i < fi ? 'bg-blue/40' : i === fi ? 'bg-blue' : 'bg-line'
}`}
/>
<span className={`text-[10px] ${i === fi ? 'font-semibold text-ink' : 'text-muted'}`}>{s}</span>
</li>
))}
</ol>
<div className="mt-3 flex items-center justify-between text-sm">
<span className="text-muted">가격 라운드</span>
<span className="font-mono font-medium">{Math.min(nego.iteration + (nego.initial ? 1 : 0), 5)} / 5</span>
</div>
</Panel>
<Panel title="엔진 판단">
{meta ? (
<dl className="flex flex-col gap-3 text-sm">
<div className="flex items-center justify-between gap-2">
<dt className="text-muted">협상 카드</dt>
<dd className="rounded bg-blue-soft px-2 py-0.5 font-mono text-[13px] font-medium text-blue">
{meta.card_id ?? '—'}
</dd>
</div>
<div>
<div className="flex items-center justify-between">
<dt className="text-muted">가격 지표</dt>
<dd className="font-mono text-[13px]">
{indicator != null ? (
<>
{indicator} <span className="text-muted">/ 99 · {meta.indicator_range}</span>
</>
) : '—'}
</dd>
</div>
<div className="mt-1.5 h-1.5 rounded-full bg-paper">
<div
className="h-full rounded-full bg-blue transition-[width] duration-500"
style={{ width: `${indicator ?? 0}%` }}
/>
</div>
</div>
<div>
<div className="flex items-center justify-between">
<dt className="text-muted">협상 긴장도</dt>
<dd className="font-mono text-[13px]">{tension != null ? tension.toFixed(2) : '—'}</dd>
</div>
<div className="mt-1.5 h-1.5 rounded-full bg-paper">
<div
className="h-full rounded-full bg-amber transition-[width] duration-500"
style={{ width: `${(tension ?? 0) * 100}%` }}
/>
</div>
</div>
<div className="flex items-center justify-between gap-2">
<dt className="text-muted">적용 페르소나</dt>
<dd>
{meta.persona ? (
<span className="rounded bg-amber-soft px-2 py-0.5 text-[13px] font-medium text-amber">
{meta.persona}
</span>
) : (
<span className="text-muted">—</span>
)}
</dd>
</div>
</dl>
) : (
<p className="text-xs leading-relaxed text-muted">
{nego.done
? '카드 라운드 없이 조기 합의됐습니다 — 첫 제안가가 앵커가 이하면 협상 카드 없이 종료됩니다.'
: '가격 협상이 시작되면 선택된 협상 카드와 가격 지표·긴장도·페르소나가 여기에 표시됩니다.'}
</p>
)}
</Panel>
</aside>
)
}