범인찾기 C3: 사이트 🔍 범인찾기 탭 · 결과 화면 · 경기 화면 버튼

- 경기 목록(분석 가능 · 분석 완료 · 준비 중 · 기록 부족 + 이유), 분석에 쓰는 기록 · 참가자(음성 표시) · 예상 비용 · 남은 예산 · 오늘 남은 횟수
- 진행 단계(기록 모으기 → AI가 읽는 중 → 근거 확인 → 완료) 실시간 표시, 실패 이유 표시
- 결과: 한 줄 요약 · 확신도, 팀별 범인 카드(이유 + 근거: 대화 ▶ 듣기 · 킬/라운드 → 타임라인 · 스탯 → 스코어보드), 10명 평점 · 태그 · 한 줄 평, 휴대폰 한 줄 배치
- 다시 분석은 관리자에게만 버튼, 예전 앱이면 "앱을 업데이트해 주세요"
- app/scripts/culprit-shots.mts: 실제 앱 코어 + 사이트 서버 + 헤드리스 브라우저로 화면 확인 (CSP 위반 · 오류 없음)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-15 14:35:12 +09:00
parent dc67f2105b
commit 1cf7d7ebce
8 changed files with 975 additions and 2 deletions

View File

@@ -1,4 +1,7 @@
import type {
CulpritBudget,
CulpritMatchInfo,
CulpritMatchItem,
DeviceStatus,
MatchDetail,
MatchSummary,
@@ -122,6 +125,33 @@ export const api = {
),
matches: (o: { game?: GameType; limit?: number; before?: number } = {}) => request<MatchSummary[]>(`/api/matches${qs(o)}`),
match: (id: string) => request<MatchDetail>(`/api/matches/${encodeURIComponent(id)}`),
culpritMatches: (o: { game?: GameType; limit?: number } = {}) => request<CulpritMatchItem[]>(`/api/culprit/matches${qs(o)}`),
culpritMatch: (id: string) => request<CulpritMatchInfo>(`/api/culprit/matches/${encodeURIComponent(id)}`),
culpritBudget: () => request<CulpritBudget>('/api/culprit/budget'),
/** 범인 분석 시작 (202). 실패하면 { error, message } 를 그대로 돌려준다 */
async culpritAnalyze(id: string, reanalyze = false): Promise<{ ok: true } | { ok: false; status: number; error: string; message: string }> {
let res: Response;
try {
res = await fetch(`/api/culprit/matches/${encodeURIComponent(id)}/analyze`, {
method: 'POST',
credentials: 'include',
headers: { accept: 'application/json', 'content-type': 'application/json' },
body: JSON.stringify({ reanalyze }),
});
} catch {
return { ok: false, status: 0, error: 'network', message: '네트워크 오류' };
}
if (res.status === 202) return { ok: true };
let b: { error?: string; message?: string } = {};
try {
b = await res.json();
} catch {
/* 본문 없음 */
}
if (res.status === 401) emit('unauthorized');
if (res.status === 503 && b.error === 'device_offline') emit('device_offline');
return { ok: false, status: res.status, error: b.error ?? 'error', message: b.message ?? '분석을 시작하지 못했습니다' };
},
correct: (id: string, text: string) =>
request<UtteranceItem>(`/api/utterances/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ text }) }),
};