nex_animation/frontend/src/pages/project/Review.tsx

528 lines
29 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 质检与审核(图2 节点 ⑨ quality_check → ⑩ review → ⑪ revise 回路)
* - 自动质检:解码完整性 / 时长偏差 / 分辨率 / 帧率 / 码率 / 黑屏 / 画面冻结
* - 画面质检:大模型看判定帧,识别人物穿帮与镜头瑕疵
* - 人工审核:合格 → 进入时间线;不合格 → 改写提示词并重新生成
*/
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useSearchParams } from 'react-router-dom'
import * as api from '../../api/client'
import { fmtTime, opt, reviewBadge, statusLabel } from '../../lib/format'
import { fromShot, normalize } from '../../lib/media'
import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { AudioPlay } from '../../components/media/AudioPlay'
import { MediaThumb } from '../../components/media/MediaThumb'
import { Actions, Between, Button, Check, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FieldBlock, FormRow, Grid, IconText, Input, Layout, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, Panel, PanelHead, ProgressBar, Row, Spinner, Status, PageStack, Table, TableBox, Tag, TagGroup, TextArea, cellCenter, cellRight, cellWrap } from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { notify } from '../../stores/notice'
import { IconAim, IconEye, IconPass, IconReject, IconReload, IconWarn } from '../../components/icons'
const KIND_OPTIONS = [
{ value: '', label: '全部记录' },
{ value: 'auto', label: '仅自动质检' },
{ value: 'manual', label: '仅人工审核' }
]
const EMPTY_CELL = 'text-center py-6 leading-relaxed'
/** 检查项表固定列宽:右栏只有 ~460px,五列自动布局会把「标准」挤出容器 */
const CHECK_COLS = ['w-[19%]', 'w-[13%] whitespace-nowrap', 'w-[28%]', 'w-[8%]', 'w-[32%]']
const VISUAL_COLS = ['w-[22%]', 'w-[13%]', 'w-[17%]', 'w-[48%]']
/** 画面质检(大模型看图):checks 里 key 以 visual. 开头的都是它的结论 */
const isVisual = (c: any) => { const k = String(c?.key || ''); return k.startsWith('visual.') || k === 'visual_error' }
const visualShortLabel = (c: any) => String(c?.label || '').replace(/^画面质检·/, '')
const visualVerdict = (c: any) => (c.passed ? '合格' : c.severity === 'warning' ? '提醒' : '需返工')
const visualTone = (c: any) => (c.passed ? 'ok' : c.severity === 'warning' ? 'warn' : 'bad')
const seq = (shot: any) => (shot ? `镜头 ${String(shot.order_index ?? 0).padStart(2, '0')} · ${shot.code || 'SH' + shot.id} · shot#${shot.id}` : '')
export default function Review() {
const projectId = useProjectStore((s) => s.id)
const [params] = useSearchParams()
const [error, setError] = useState('')
const [busy, setBusy] = useState('')
const [qc, setQc] = useState<any>(null)
const [shots, setShots] = useState<any[]>([])
const [reviews, setReviews] = useState<any[]>([])
const [kindFilter, setKindFilter] = useState('')
const [selected, setSelected] = useState<number | null>(null)
const [approve, setApprove] = useState({ notes: '', reviewer: 'studio' })
const [reject, setReject] = useState({ notes: '', reviewer: 'studio', prompt: '', negative_prompt: '', regenerate: true, priority: 4 })
const rows: any[] = qc?.shots || []
const byId = useMemo(() => {
const map: Record<number, any> = {}
shots.forEach((s) => { map[s.id] = s })
return map
}, [shots])
const current = selected ? byId[selected] : null
/**
* 清单行的技术分。
*
* /qc 接口每行只带画面分(probe.visual_score),技术分在 shots[].qc.tech_score,
* 两边按 shot_id 拼一下,避免列表里「画面 35 / 技术 —」这种半截结论。
*/
const techOf = (r: any) => byId[r.shot_id]?.qc?.tech_score ?? r.probe?.tech_score ?? null
const checks: any[] = current?.qc?.checks || []
const techChecks = checks.filter((c) => !isVisual(c))
const visualChecks = checks.filter(isVisual)
const shotQc = current?.qc || {}
const visualProbe = shotQc.probe || {}
const visualRan = visualProbe.visual_score !== null && visualProbe.visual_score !== undefined
const visualScoreText = visualRan ? visualProbe.visual_score : '未检'
const visualSkipNote = (() => {
const skipped = visualChecks.find((c) => String(c.key).endsWith('.skipped'))
if (skipped) return skipped.detail
if (!visualChecks.length) return '该镜头还没跑过画面质检,点顶部「整批复检(含画面质检)」补上。'
return ''
})()
const frameUrls: string[] = (visualProbe.visual_frames || []).filter(Boolean)
const frameItems = frameUrls
.map((url: string, i: number) => normalize(
{ url, kind: 'image', exists: true, name: `判定帧 第 ${i + 1} 帧` },
{ group: '画面质检', title: `${seq(current)} · 判定帧 第 ${i + 1} 帧` }))
.filter(Boolean)
/** 审核取证顺序:审片预览(平台配音)→ 模型原片 → 关键帧 → 尾帧 → 配音,←/→ 直接翻 */
const currentQueue = useMemo(() => {
if (!current) return []
const wanted: Array<'preview' | 'output' | 'keyframe' | 'last_frame' | 'voiceover'> =
current.preview_url ? ['preview', 'output', 'keyframe', 'last_frame', 'voiceover']
: ['output', 'keyframe', 'last_frame', 'voiceover']
return wanted.map((which) => fromShot(current, which)).filter(Boolean)
}, [current])
/** 取证条只列画面类素材:配音在下方有完整的播放条,缩略条里的 96px 音频块显示不全 */
const evidenceStrips = currentQueue.map((m: any, i: number) => ({ m, i })).filter((x) => x.m.kind !== 'audio')
const audioSourceHint = (() => {
if (!current) return ''
if (current.preview_url) return '主画面音轨 = 平台配音(IndexTTS2 声线),与成片一致'
if (current.native_audio && current.voiceover_url) return '模型自带音轨与配音不一致时,请以此处下方配音为准;可点「封装审片预览」替换'
if (current.voiceover_url) return '主画面无音轨,配音在下方试听'
return '该镜头还没有配音'
})()
const generated = shots.filter((s) => s.output_exists)
const approvable = rows.filter((r) => r.passed && !['pass'].includes(r.review_state))
const rejected = shots.filter((s) => s.status === 'rejected')
const load = useCallback(async (silent = true) => {
if (!projectId) return
if (!silent) setBusy('读取质检结果')
try {
const [q, sh, rv] = await Promise.all([
api.get(`/api/projects/${projectId}/qc`),
api.get(`/api/projects/${projectId}/shots`),
api.get(`/api/projects/${projectId}/reviews`, { kind: kindFilter })
])
const list: any[] = sh.shots || []
setQc(q.qc)
setShots(list)
setReviews(rv.reviews || [])
// 支持从分镜工作台带 ?shot= 直接跳到指定镜头;选中的镜头被删了就回到第一个
const want = Number(params.get('shot') || 0)
setSelected((cur) => {
if (cur === null && want && list.some((s) => s.id === want)) return want
if (cur === null && list.length) return list[0].id
if (cur !== null && !list.some((s) => s.id === cur)) return list.length ? list[0].id : null
return cur
})
setError('')
} catch (exc: any) { setError(exc?.message || String(exc)) }
finally { setBusy('') }
}, [projectId, kindFilter, params])
useEffect(() => { void load(false) }, [load])
useAutoRefresh(() => void load(), 12000, !!busy, !!busy)
async function run(label: string, fn: () => Promise<any>, message?: (res: any) => string) {
setBusy(label); setError('')
try {
const res = await fn()
const text = message ? message(res) : ''
if (text) notify(text)
await Promise.all([load(), refresh()])
return res
} catch (exc: any) { setError(exc?.message || String(exc)); return null }
finally { setBusy('') }
}
/** 单镜头重新质检:入队并同步排空(inline 模式可直接拿到结果) */
const reQc = (shotId: number) => run('质检镜头', () => api.post(`/api/projects/${projectId}/shots/${shotId}/qc?drain=true`, {}),
(r) => `质检完成:${r?.score ?? '—'} 分`)
const approveShot = () => run('审核通过', () => api.post(`/api/projects/${projectId}/shots/${selected}/approve`, {
notes: approve.notes, reviewer: approve.reviewer
}), () => `镜头 ${current?.code} 已通过审核`)
const rejectShot = () => run('驳回并重新生成', () => api.post(`/api/projects/${projectId}/shots/${selected}/reject`, {
notes: reject.notes, reviewer: reject.reviewer,
prompt: reject.prompt.trim() || null, negative_prompt: reject.negative_prompt.trim() || null,
regenerate: reject.regenerate, priority: reject.priority
}), (r) => reject.regenerate
? `镜头已驳回,重新生成任务 ${r?.requeue?.created?.count ?? 0} 个(可在调度中心派发)`
: '镜头已驳回')
async function approveAll() {
if (!approvable.length) { setError('没有「质检通过且待审核」的镜头'); return }
setBusy(`批量放行 ${approvable.length} 个镜头`); setError('')
let ok = 0
const failures: string[] = []
for (const row of approvable) {
try {
await api.post(`/api/projects/${projectId}/shots/${row.shot_id}/approve`, { notes: '批量放行:自动质检通过', reviewer: 'studio' })
ok += 1
} catch (exc: any) { failures.push(`#${row.order_index} ${exc.message}`) }
}
setBusy('')
await Promise.all([load(), refresh()])
notify(`已放行 ${ok} 个镜头${failures.length ? `,失败 ${failures.length} 个:${failures[0]}` : ''}`)
}
/** 整批复检:走后端 qc/run 批量入队,含画面质检;drain=false 交给调度派发,前端自动刷新轮询 */
const recheckAll = () => run(`整批复检 ${generated.length} 个镜头`,
() => api.post(`/api/projects/${projectId}/qc/run`, { include_approved: true, drain: false }),
(r) => `已提交 ${r?.task_ids?.length ?? generated.length} 个镜头的整批复检(含画面质检),跑完后列表自动刷新`)
async function qcAll() {
if (!generated.length) { setError('还没有生成产物,无法质检'); return }
setBusy(`全量质检 ${generated.length} 个镜头`); setError('')
let ok = 0
for (const s of generated) {
try { await api.post(`/api/projects/${projectId}/shots/${s.id}/qc?drain=true`, {}); ok += 1 } catch { /* 单镜头失败不中断整体 */ }
}
setBusy('')
await Promise.all([load(), refresh()])
notify(`已完成 ${ok} 个镜头的自动质检`)
}
/** 审片预览:画面不变,只把音轨换成平台配音 */
async function buildPreview(shot: any) {
if (!shot?.id) return
setBusy('封装审片预览')
try {
await api.post(`/api/projects/${projectId}/shots/${shot.id}/preview`, { force: true, actor: 'review' })
notify('审片预览已封装:画面不变,声音换成平台配音')
await load(true)
} catch (e: any) {
notify(e?.message || '封装审片预览失败')
} finally {
setBusy('')
}
}
return (
<PageStack>
<Between>
<TagGroup className="mb-0">
<Tag>已质检 {qc?.checked ?? 0}</Tag>
<Tag tone={qc?.passed ? 'ok' : 'default'}>通过 {qc?.passed ?? 0}</Tag>
<Tag tone={qc?.failed ? 'bad' : 'default'}>不合格 {qc?.failed ?? 0}</Tag>
<Tag>平均分 {qc?.average_score ?? '—'}</Tag>
<Tag tone={approvable.length ? 'warn' : 'default'}>待人工审核 {approvable.length}</Tag>
<Tag tone={rejected.length ? 'bad' : 'default'}>被驳回 {rejected.length}</Tag>
</TagGroup>
<Row>
{busy ? <span className={MUTED}><Spinner /> {busy}…</span> : null}
<Button size="sm" disabled={!!busy} onClick={qcAll} icon={<IconReload />}>全量重跑质检</Button>
<Button size="sm" disabled={!!busy} onClick={recheckAll}
title="对所有已生成产物重新质检:技术指标 + 大模型看图判定人物/穿帮/镜头瑕疵" icon={<IconEye />}>整批复检(含画面质检)</Button>
<Button type="primary" size="sm" disabled={!!busy || !approvable.length} onClick={approveAll}
title={busy ? '有任务正在执行,请稍候'
: approvable.length ? `${approvable.length} 个镜头质检通过且待人工审核`
: '没有可放行的镜头:需要「质检通过」且「人工未放行」;若已全部放行,此处会保持置灰'} icon={<IconPass />}>批量放行质检合格镜头</Button>
</Row>
</Between>
<ErrorText>{error}</ErrorText>
<Layout>
{/* ===== 自动质检清单 ===== */}
<Panel>
<PanelHead
title={<span title="质检项由 QC_THRESHOLD 与镜头目标时长/分辨率决定;不合格项会阻塞时间线,需驳回重做。">自动质检清单</span>}
right={<span className={MUTED}>产物 {generated.length} / 镜头 {shots.length}</span>} />
<TableBox maxHeight={520}>
{/* 六列里三列有固定职责:# 只放序号、状态放两行标签、得分放数字+条。
不给它们显式宽度,浏览器会把宽度全给「问题」那列,标签被压到断字。 */}
<Table pickable minWidth={960}>
<thead>
<tr><th className={`${cellCenter} w-8`}>#</th><th>镜头</th><th className="w-[96px]">状态</th>
<th className={`${cellRight} w-[126px]`}>得分</th><th>问题</th><th className={cellRight}>操作</th></tr>
</thead>
<tbody>
{rows.map((r: any) => {
const shot = byId[r.shot_id]
const mark = reviewBadge(shot)
return (
<tr key={r.shot_id} data-chosen={selected === r.shot_id || undefined} onClick={() => setSelected(r.shot_id)}>
<td className={cellCenter}><b>{r.order_index}</b></td>
<td>{r.title}
<div className={MUTED_MONO}>shot#{r.shot_id} · {r.probe?.width || '?'}×{r.probe?.height || '?'} · {r.probe?.duration ? `${r.probe.duration.toFixed(2)}s` : '—'}</div>
</td>
<td className="whitespace-nowrap"><Status value={r.status} />
{r.review_state && r.review_state !== 'pending'
? <div className="mt-1">
<Tag tone={(mark?.tone as any) || (r.review_state === 'pass' ? 'ok' : 'bad')}
title={shot?.review_notes || ''}>
{mark?.text || (r.review_state === 'pass' ? '人工合格' : '人工不合格')}
</Tag>
</div>
: null}
</td>
{/* 得分列固定宽:数字 + 条在一行里各占自己的轨道,
副结论单独一行且不换行——列一窄「画面 35 / 技术 100」会拐成两行压到进度条上。 */}
<td className={cellRight}>
<div className="ml-auto w-[114px]">
<div className="flex items-center gap-2">
<b className={`${MONO} flex-none tabular-nums`}>{r.score === null ? '—' : r.score}</b>
<ProgressBar className="min-w-0 flex-1" value={Math.max(0, Math.min(100, Number(r.score || 0)))} bad={!r.passed} />
</div>
{r.probe?.visual_score !== null && r.probe?.visual_score !== undefined
? <div className={`${MUTED_MONO} mt-1 whitespace-nowrap text-xs`}>画面 {r.probe.visual_score} / 技术 {techOf(r) ?? '—'}</div>
: <div className={`${MUTED} mt-1 text-xs`}>画面未检</div>}
</div>
</td>
<td className={cellWrap}>
{!r.issues?.length && !r.warnings?.length ? <span className={MUTED}>无</span> : null}
{(r.issues || []).map((x: string) => <div key={`i${x}`} className="text-error">{x}</div>)}
{(r.warnings || []).map((x: string) => <div key={`w${x}`} className={MUTED}><IconText icon={<IconWarn />}>{x}</IconText></div>)}
</td>
<td className={cellRight}>
<Button size="sm" disabled={!!busy || !shot?.output_exists}
onClick={(e) => { e.stopPropagation(); reQc(r.shot_id) }}>重跑</Button>
</td>
</tr>
)
})}
{!rows.length ? <tr><td colSpan={6} className={`${MUTED} ${EMPTY_CELL}`}>项目还没有镜头。</td></tr> : null}
</tbody>
</Table>
</TableBox>
</Panel>
{/* ===== 人工审核 ===== */}
<Panel>
<PanelHead title="人工审核"
right={current
? <span className={MUTED_MONO} title="审核记录按 shot_id 关联,避免把 review id 当镜号">{seq(current)}</span>
: undefined} />
{!current ? <Empty>在左侧选择一个镜头开始审核。</Empty> : (
<>
{current.output_url
? <MediaThumb item={currentQueue[0]} size="lg" queue={currentQueue} index={0}
title={current.preview_url ? '审片预览(平台配音)' : '成片预览'} />
: <Empty>该镜头还没有生成产物,请先在调度中心生成。</Empty>}
{current.output_url
? <>
{/* 音源提示是一整句话:nowrap 的标签在 341px 的右栏里会顶出整页横向滚动,
折了行的标签又变成「不知道该不该点」的假按钮。句子就该按句子排——
用 LineHint 做说明行,胶囊只留给两三个词的短标签。 */}
<LineHint className={`mt-3 mb-2 ${current.preview_url ? 'text-success' : 'text-warning-hover'}`}>
{audioSourceHint}
</LineHint>
<ChipBar>
{current.voiceover_url && !current.preview_url && current.native_audio
? <Button size="sm" disabled={!!busy} onClick={() => buildPreview(current)}>封装审片预览(用平台配音替换模型原声)</Button> : null}
{current.preview_url
? <Button size="sm" disabled={!!busy} onClick={() => buildPreview(current)}>重新封装预览</Button> : null}
</ChipBar>
</>
: null}
{evidenceStrips.length > 1
? <div className="mt-3 flex flex-wrap gap-2">
{evidenceStrips.map(({ m, i }: any) => (
<div key={m.key} className="flex w-24 flex-col gap-1 text-left">
<MediaThumb item={m} size="sm" queue={currentQueue} index={i} />
<span className="text-xs text-text-quaternary">{m.kindLabel}</span>
</div>
))}
</div>
: null}
{current.voiceover_url
? <div className="mt-3">
<AudioPlay src={current.voiceover_url} label={`${current.title || current.code} 配音`}
durationMs={current.voiceover_duration_ms} hint="审核可边听边核对口型与台词" />
</div>
: null}
<TagGroup top>
<Status value={current.status} />
<Tag>目标 {current.duration}s</Tag>
<Tag>模式 {opt('mode', current.mode)}</Tag>
<Tag>{current.effective_provider} / {current.effective_model || '默认'}</Tag>
<Tag>尝试 {current.attempts} 次</Tag>
{current.voiceover_url ? <Tag tone="ok">已有配音</Tag> : null}
</TagGroup>
{checks.length ? (
<>
<TagGroup>
<Tag>总分 <b className={MONO}>{shotQc.score ?? '—'}</b></Tag>
<Tag>技术 <b className={MONO}>{shotQc.tech_score ?? '—'}</b></Tag>
<Tag tone={!visualRan ? 'warn' : Number(shotQc.visual_score) >= 80 ? 'ok' : 'bad'}>画面 <b className={MONO}>{visualScoreText}</b></Tag>
{visualProbe.visual_model ? <Tag className={MUTED_MONO}>{visualProbe.visual_model}</Tag> : null}
{visualProbe.visual_cast?.length
? <Tag>出场:{visualProbe.visual_cast.map((c: any) => `${c.name}${(c.frames || []).length ? `(${c.frames.join(',')})` : '·未出现'}`).join('、')}</Tag>
: null}
</TagGroup>
{visualChecks.length || visualRan
? <VisualQc probe={visualProbe} checks={visualChecks} frames={frameUrls} frameItems={frameItems} note={visualSkipNote} />
: null}
{techChecks.length
? <>
<h3 className="mt-4 mb-3 text-sm"><IconText icon={<IconAim />}>技术指标</IconText></h3>
<CheckTable items={techChecks} cols={CHECK_COLS} />
</>
: null}
</>
) : null}
<Divider />
<Grid cols={2} oneAt="sm">
<div>
<h3 className="m-0 mb-2 text-sm"><IconText icon={<IconPass />}>合格</IconText></h3>
<FormRow>
<Field label="审核人"><Input value={approve.reviewer} onChange={(e) => setApprove((f) => ({ ...f, reviewer: e.target.value }))} /></Field>
</FormRow>
<FieldBlock label="备注">
<TextArea rows={2} placeholder="例如:构图与角色一致性合格" value={approve.notes} onChange={(e) => setApprove((f) => ({ ...f, notes: e.target.value }))} />
</FieldBlock>
<Actions><Button type="primary" size="sm" disabled={!!busy || !current.output_exists} onClick={approveShot}>标记合格</Button></Actions>
</div>
<div>
<h3 className="m-0 mb-2 text-sm"><IconText icon={<IconReject />}>不合格(可改提示词重做)</IconText></h3>
<FormRow>
<Field label="审核人"><Input value={reject.reviewer} onChange={(e) => setReject((f) => ({ ...f, reviewer: e.target.value }))} /></Field>
</FormRow>
<FieldBlock label="问题描述">
<TextArea rows={2} placeholder="例如:角色发型与原画不一致" value={reject.notes} onChange={(e) => setReject((f) => ({ ...f, notes: e.target.value }))} />
</FieldBlock>
<FieldBlock label="覆盖提示词(可选)">
<TextArea rows={2} placeholder="留空则沿用原提示词" value={reject.prompt} onChange={(e) => setReject((f) => ({ ...f, prompt: e.target.value }))} />
</FieldBlock>
<FormRow>
<Field label="覆盖负面提示词(可选)" width="full">
<Input value={reject.negative_prompt} onChange={(e) => setReject((f) => ({ ...f, negative_prompt: e.target.value }))} />
</Field>
</FormRow>
<Check checked={reject.regenerate} onChange={(v) => setReject((f) => ({ ...f, regenerate: v }))}>立即重新入队生成</Check>
{reject.regenerate
? <FormRow className="mt-3">
<Field label={<span title="数字越小越先派发;重做会强制覆盖已有产物,配音任务排在生成之前">任务优先级</span>}>
<NumberInput min={0} max={9} value={reject.priority} onChange={ (v) => setReject((f) => ({ ...f, priority: v }))} />
</Field>
</FormRow>
: null}
<Actions><Button size="sm" disabled={!!busy} onClick={rejectShot}>驳回</Button></Actions>
</div>
</Grid>
</>
)}
</Panel>
</Layout>
{/* ===== 审核留痕 ===== */}
<Panel>
<PanelHead title="审核留痕"
right={<Ctlbar className="mb-0">
<Field label="类型" width="narrow">
<Select size="sm" ariaLabel="审核记录类型筛选" value={kindFilter} onChange={setKindFilter} options={KIND_OPTIONS} />
</Field>
</Ctlbar>} />
<TableBox maxHeight={320}>
<Table minWidth={900}>
<thead>
<tr><th className={cellCenter}>时间</th><th className={cellCenter}>类型</th><th>镜头</th>
<th className={cellCenter}>结论</th><th className={cellRight}>得分</th><th>审核人</th><th>说明</th></tr>
</thead>
<tbody>
{reviews.map((rv: any) => (
<tr key={rv.id}>
<td className={`${cellCenter} ${MUTED_MONO}`}>{fmtTime(rv.created_at)}</td>
<td className={cellCenter}>{statusLabel(rv.kind)}</td>
<td className={MONO}>{byId[rv.shot_id] ? `镜头 ${String(byId[rv.shot_id].order_index).padStart(2, '0')}` : '未知'}
<div className={MUTED}>shot#{rv.shot_id}</div>
</td>
<td className={cellCenter}><Tag tone={rv.verdict === 'pass' ? 'ok' : 'bad'}>{rv.verdict === 'pass' ? '合格' : '不合格'}</Tag></td>
<td className={`${cellRight} ${MONO}`}>{rv.score ?? '—'}</td>
<td className={MUTED}>{rv.reviewer}</td>
<td className={cellWrap}>{rv.notes || '—'}
{rv.checks?.checks
? <div className={MUTED_MONO}>检查:{rv.checks.checks.filter((c: any) => !c.passed).map((c: any) => c.label).join('、') || '全部达标'}</div>
: null}
</td>
</tr>
))}
{!reviews.length ? <tr><td colSpan={7} className={`${MUTED} ${EMPTY_CELL}`}>暂无审核记录。</td></tr> : null}
</tbody>
</Table>
</TableBox>
</Panel>
</PageStack>
)
}
/** 画面质检面板(大模型看图):判定帧可以直接点开灯箱,逐条结论单独列表 */
function VisualQc({ probe, checks, frames, frameItems, note }: {
probe: any; checks: any[]; frames: string[]; frameItems: any[]; note: string
}) {
return (
<div className="mb-1 rounded-lg bg-info-bg p-3">
<div className="flex items-center justify-between gap-3 flex-wrap">
<b className="text-xs"><IconText icon={<IconEye />}>画面质检(大模型看图)</IconText></b>
<span className={MUTED}>{probe.visual_frames ? `${probe.visual_frames.length} 张判定帧` : ''}</span>
</div>
{probe.visual_summary
? <p className="mt-2 mb-0 text-xs leading-relaxed text-text-quaternary break-words">{probe.visual_summary}</p> : null}
{frames.length
? <div className="mt-2 flex flex-wrap gap-2">
{frames.map((u, i) => (
<div key={u} className="flex w-[108px] flex-col gap-1 text-left">
<MediaThumb src={u} kind="image" size="sm" queue={frameItems} index={i} />
<span className="text-xs text-text-quaternary">第 {i + 1} 帧</span>
</div>
))}
</div>
: null}
{note ? <LineHint className="mt-2">{note}</LineHint> : null}
{checks.length
? <div className="mt-2">
<CheckTable items={checks} cols={VISUAL_COLS} visual />
</div>
: null}
</div>
)
}
/** 质检结论表:窄栏里必须固定布局 + 百分比列宽,否则「标准」列被挤出容器;长串实测值要允许折行 */
function CheckTable({ items, cols, visual }: { items: any[]; cols: string[]; visual?: boolean }) {
return (
<TableBox maxHeight={visual ? 210 : 230}>
<Table minWidth={0} className="table-fixed">
<thead>
<tr>
{(visual ? ['画面问题', '结论', '位置', '说明'] : ['检查项', '结论', '实测', '权重', '标准'])
.map((h, i) => <th key={h} className={`${cols[i]} ${visual ? 'whitespace-normal' : 'whitespace-nowrap'}`}>{h}</th>)}
</tr>
</thead>
<tbody>
{items.map((c: any) => (
<tr key={c.key}>
<td className={visual ? 'whitespace-normal' : 'whitespace-nowrap'}>{visual ? visualShortLabel(c) : c.label}</td>
<td className={cellCenter}>
<Tag tone={(visual ? visualTone(c) : c.passed ? 'ok' : c.severity === 'warning' ? 'warn' : 'bad') as any}>
{visual ? visualVerdict(c) : c.passed ? '合格' : c.severity === 'warning' ? '提醒' : '不合格'}
</Tag>
</td>
<td className={`${MONO} whitespace-normal break-words`}>{c.value}</td>
{visual ? null : <td className={`${cellRight} ${MONO}`}>{c.weight}</td>}
<td className={`${cellWrap} ${MUTED} break-words`}>{c.detail}</td>
</tr>
))}
</tbody>
</Table>
</TableBox>
)
}