八个项目子页逐页改完:主操作提进页头、只读计数改回显块、表格行高按内容定额

症状(用户第 1、2、6、7 条 + R17):①各页的主操作散在卡头或工具条里——出片藏在
「合成导出」表末尾、入队藏在「分镜任务清单」卡头、三个批量动作和六个只读计数挤在同一
张卡头;「+ 新建人物」挂在页签条右端把标签压扁。②成本预估那四个数不能点却穿了可点
chip 的皮肤,还裸浮在两张卡之间的页面底色上。③表格行被内容撑高:项目概况节点表 81px、
调度清单 125px、质检结论表 255px(一条长说明在 464px 列里折 13 行)、生成记录 227px。
④审核页主信息在右,左栏却和右栏等宽(第 7 条点名的那张截图)。

做法:①八个页面统一加上 PageHead(24px 环节名 + 12px 职责说明 + 图标主按钮),
卡头只留这一张卡自己的动作;Library 的页签条独占一行,新建按钮从
tabBarExtraContent.right 提进页头,执行中的忙态降进搜索条右端;②不能点的数字一律
走 Info 回显(label 带底纹),Delivery 那组再套进 Toolbar 让它落在卡片里而不是页面
底色上,概览/调度的设定回显同样换成 Info;③列宽按内容定额:短列收到 40/72/84/140,
长文列吃剩余宽度并配 Clamp 封顶一到两行、全文挂 title,行高回到内容本身(实测三张
超标表最高行分别降到 61 / 55 / 49px,tableaudit 违规 0 张);④Review 的左右栏改
spans={[9, 15]},430 档把审核结论的 Segmented 标签缩成「合格 · 进时间线」不再截断;
⑤卡内回显固定 column={2}(Library)或 column={1}(Overview):antd Descriptions 的
span 不跟断点走,窄屏降到 1 列时空白项当场报 Sum of column `span` in a line not match。

为什么:一屏的「这一页能干什么」只有页头一个答案,主操作混在卡头里就得逐个卡片找;
回显与控件共用皮肤会让用户去点不能点的东西;而定宽列 + 封顶行数是把行高从「内容
随机决定」变成「设计决定」的唯一办法,宽度不够就交给 title。
main
mula.liu 2026-11-03 20:21:09 +08:00
parent 3404d7874f
commit ad4cdcb52b
8 changed files with 647 additions and 513 deletions

View File

@ -747,7 +747,7 @@ export default function AgentConsole() {
tone={STEP_TONE[stepItem.status] || 'default'}
className={cn(stepItem.status === 'skipped' && 'opacity-68')}>
<div className={cn('grid flex-none place-items-center w-6 h-6 rounded-full bg-fill-secondary text-text-tertiary text-xs font-bold',
stepItem.status === 'succeeded' && 'bg-success-bg text-success',
stepItem.status === 'succeeded' && 'bg-fill-tertiary text-success',
stepItem.status === 'running' && 'bg-warning text-warning-bg animate-agent-step',
stepItem.status === 'failed' && 'bg-error text-error-bg')}>
{stepItem.status === 'succeeded' ? <IconCheck />

View File

@ -10,12 +10,12 @@ import { fromExport } from '../../lib/media'
import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { MediaThumb } from '../../components/media/MediaThumb'
import { Actions, Button, cellWrap, Chip, ChipBar, ErrorText, ExtLink, Field, FormGrid, FormRow, Grid, IconText, Input, LineHint, LINK_CLS, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, Spinner, Stat, StatGrid, Status, Table, Tag, TagGroup } from '../../components/ui'
import { PageHead, ActionGroup, Button, Clamp, Value, Chip, ErrorText, ExtLink, Field, FormGrid, FormRow, Grid, IconText, Info, Input, LineHint, OptionGrid, Toolbar, LINK_CLS, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, Spinner, Stat, StatGrid, Status, Table, Tag } from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { presetLabel, presets as FALLBACK_PRESETS, useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { openTogether } from '../../stores/preview'
import { IconChevronUp, IconPlayCircle, IconRetry, IconWarn } from '../../components/icons'
import { IconChart, IconChevronUp, IconHourglass, IconPlayCircle, IconRetry, IconWarn } from '../../components/icons'
const PRESET_HINTS: Record<string, string> = {
draft_720p: '1280×720 · CRF28 · veryfast(试片最快)',
@ -169,17 +169,42 @@ export default function Delivery() {
return (
<PageStack>
<div className="flex flex-wrap items-center justify-between gap-3 min-w-0 mb-3 ">
{/* 这四个数不能点,是回显:按规范 §2.0 走标签族,不借可点 chip 的皮肤 */}
<TagGroup className="mb-0">
<Tag>成片 {succeeded.length} / {exportList.length}</Tag>
<Tag>累计成本 {fmtMoney(costs?.total_cost, currency)}</Tag>
<Tag>生成 {costs?.generations?.count ?? 0} 次 / {(costs?.generations?.seconds ?? 0).toFixed(1)}s</Tag>
<Tag>待结算预估 {fmtMoney(costs?.estimated_pending, currency)}</Tag>
{report && <Tag tone={report.ready ? 'ok' : 'bad'}>{report.ready ? '时间线可导出' : '时间线有阻塞'}</Tag>}
</TagGroup>
<span className={MUTED}>{busy && <><Spinner className="mr-1" /> {busy}…</>}</span>
</div>
{/* 页头(第 1 条):出片是这一页唯一整页成立的主操作,从「合成导出」的表末尾提到页头;
面板里只剩预设与参数,勾选完直接在最上方按同一颗按钮。 */}
<PageHead
title="导出与成本"
sub="按预设合成成片,核对成本台账与每一次生成的可复现参数。"
actions={<>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
<ActionGroup>
<Link to={`/projects/${projectId}/timeline`} className={LINK_CLS}>先检查时间线</Link>
<Button type="primary" disabled={!!busy || !report || !report.ready || !form.presets.length}
title={report && report.ready ? `将依次合成 ${form.presets.length} 个预设` : '时间线未就绪时不允许出片'}
onClick={compose} icon={<IconPlayCircle />}>
开始合成导出{form.presets.length > 1 ? `(${form.presets.length} 个预设)` : ''}
</Button>
</ActionGroup>
</>}
/>
{/* 这四个数不能点,是回显:按 §13.1 走 Info(label 上底纹),不借可点 chip 的皮肤;
交付预检也收进同一块,结论用重点色文字而不是描边 Tag。
第 80 改:整块套进 <Toolbar>——它原先裸浮在两张卡之间的页面底色上,
像一条没装框的表格,和质检页同一条统计带不同容器;进度态改走工具条右端。 */}
<Toolbar
actions={busy ? <Value><Spinner /> {busy}…</Value> : undefined}
info={<Info className="mb-0" column={{ xs: 2, sm: 3, lg: 5 }} items={[
{ label: '成片', mono: true, value: `${succeeded.length} / ${exportList.length}` },
{ label: '累计成本', mono: true, value: fmtMoney(costs?.total_cost, currency) },
{ label: '生成', mono: true, value: `${costs?.generations?.count ?? 0} 次 / ${(costs?.generations?.seconds ?? 0).toFixed(1)}s` },
{ label: '待结算预估', mono: true, value: fmtMoney(costs?.estimated_pending, currency) },
report && {
label: '交付预检',
value: report.ready
? <span className="text-success">时间线可导出</span>
: <span className="text-error">时间线有阻塞</span>
}
]} />} />
<ErrorText className="mb-3">{error}</ErrorText>
{blockingIssues.length > 0 && (
@ -194,13 +219,14 @@ export default function Delivery() {
<Grid cols={2} oneAt="lg">
<Panel>
<PanelHead title="合成导出" />
<ChipBar label="出片预设(可多选,依次入队)">
<OptionGrid cols={3} label="出片预设(可多选,依次入队)"
hint={`已选 ${form.presets.length} / ${presetList.length}`}>
{presetList.map((p) => (
<Chip key={p} title={PRESET_HINTS[p]} active={form.presets.includes(p)} onClick={() => togglePreset(p)}>
{presetLabel[p] || p}
</Chip>
))}
</ChipBar>
</OptionGrid>
<FormGrid>
<FormRow cols={2}>
<Field label="时间线">
@ -222,14 +248,10 @@ export default function Delivery() {
</Field>
</FormRow>
</FormGrid>
<Actions>
<Button type="primary" disabled={!!busy || !report || !report.ready || !form.presets.length}
title={report && report.ready ? `将依次合成 ${form.presets.length} 个预设` : '时间线未就绪时不允许出片'}
onClick={compose} icon={<IconPlayCircle />}>
开始合成导出{form.presets.length > 1 ? `(${form.presets.length} 个预设)` : ''}
</Button>
<Link to={`/projects/${projectId}/timeline`} className={LINK_CLS}>先检查时间线</Link>
</Actions>
{/* 主操作已提到页头;表单末尾留一句口径,避免「按了没反应」的错觉 */}
<LineHint>{form.presets.length
? `已选 ${form.presets.length} 个预设,点页面右上角「开始合成导出」依次入队。`
: '至少选择一个出片预设后才能入队合成。'}</LineHint>
{burnBlocked && (
<LineHint>
<IconText align="start" icon={<IconWarn />}>本机 ffmpeg 缺 libass(无 subtitles/ass 滤镜),烧录模式会自动降级为内嵌软字幕轨;
@ -241,8 +263,8 @@ export default function Delivery() {
<Panel>
<PanelHead title="成本台账" right={<span className={MUTED}>{costs?.records ?? 0} 条计费记录</span>} />
<StatGrid cols={2} className="mb-3">
<Stat label="已发生成本" value={fmtMoney(costs?.total_cost, currency)} />
<Stat label="待生成预估" value={fmtMoney(costs?.estimated_pending, currency)} />
<Stat icon={<IconChart />} label="已发生成本" value={fmtMoney(costs?.total_cost, currency)} />
<Stat icon={<IconHourglass />} label="待生成预估" value={fmtMoney(costs?.estimated_pending, currency)} />
</StatGrid>
<Table
maxHeight={170}
@ -280,34 +302,38 @@ export default function Delivery() {
dataSource={exportList}
empty="还没有成片。先在时间线页通过交付预检,再回到这里出片。"
columns={[
{ title: '#', key: 'id', width: 68, align: 'center', className: MONO, render: (_: any, rec: any) => rec.id },
{ title: '名称 / 预设', key: 'name', width: 320, render: (_: any, rec: any) => {
{ title: '#', key: 'id', width: 56, align: 'center', className: MONO, render: (_: any, rec: any) => rec.id },
/* 定宽列合计 776、容器 1118 ⇒ 这一列拿 ~342px,同时把原来 1184 的表宽收回容器内。
片名与「预设 · timeline# · task#」各占一行并封顶,全文挂 title:
这两行原本在 320px 里各折两行,把整行顶到 145px。 */
{ title: '名称 / 预设', key: 'name', render: (_: any, rec: any) => {
const at = indexOfExport(rec)
const meta = `${rec.preset} · timeline#${rec.timeline_id} · task#${rec.task_id || '—'}`
return (
<div className="flex min-w-0 flex-nowrap items-start gap-2">
<MediaThumb item={exportItems[at]} size="xs" width="60px" radius="chip"
queue={exportItems} index={at < 0 ? 0 : at} />
<div className="min-w-0 flex-1">
<b>{rec.name}</b>
<div className={MUTED_MONO}>{rec.preset} · timeline#{rec.timeline_id} · task#{rec.task_id || '—'}</div>
{rec.error_message && <ErrorText>{rec.error_message}</ErrorText>}
<Clamp lines={1} title={rec.name}><b>{rec.name}</b></Clamp>
<Clamp lines={1} className={MUTED_MONO} title={meta}>{meta}</Clamp>
{rec.error_message && <ErrorText lines={1} title={rec.error_message}>{rec.error_message}</ErrorText>}
</div>
</div>
)
} },
{ title: '状态', key: 'status', width: 120, render: (_: any, rec: any) => (
{ title: '状态', key: 'status', width: 104, render: (_: any, rec: any) => (
<>
<Status value={rec.status} />
{rec.subtitle_burned && <div className="mt-1"><Tag tone="info">已烧字幕</Tag></div>}
</>
) },
{ title: '规格', key: 'spec', width: 132, align: 'center', className: `${MONO} whitespace-nowrap`,
{ title: '规格', key: 'spec', width: 116, align: 'center', className: `${MONO} whitespace-nowrap`,
render: (_: any, rec: any) => `${rec.width || '?'}×${rec.height || '?'}${rec.fps ? ` @${rec.fps}` : ''}` },
{ title: '时长', key: 'duration', width: 88, align: 'right', className: MONO, render: (_: any, rec: any) => fmtMs(rec.duration_ms) },
{ title: '大小', key: 'size', width: 96, align: 'right', className: MONO, render: (_: any, rec: any) => fmtBytes(rec.size_bytes) },
{ title: '耗时', key: 'elapsed', width: 84, align: 'right', className: `${MONO} text-text-quaternary`,
{ title: '时长', key: 'duration', width: 80, align: 'right', className: `${MONO} whitespace-nowrap`, render: (_: any, rec: any) => fmtMs(rec.duration_ms) },
{ title: '大小', key: 'size', width: 84, align: 'right', className: MONO, render: (_: any, rec: any) => fmtBytes(rec.size_bytes) },
{ title: '耗时', key: 'elapsed', width: 72, align: 'right', className: `${MONO} text-text-quaternary`,
render: (_: any, rec: any) => (rec.elapsed_ms ? (rec.elapsed_ms / 1000).toFixed(1) + 's' : '—') },
{ title: '校验和', key: 'checksum', width: 108, className: `${MONO} text-text-quaternary`,
{ title: '校验和', key: 'checksum', width: 96, className: `${MONO} whitespace-nowrap text-text-quaternary`,
render: (_: any, rec: any) => (
<span title={rec.checksum ? '完整校验和为文件 SHA-256 前 32 位(上传超过 16MB 时按流式截断计算)' : '未记录校验和'}>
{(rec.checksum || '').slice(0, 10) || '—'}
@ -351,13 +377,23 @@ export default function Delivery() {
<>shot#{g.shot_id || '—'}<div className={MUTED}>{statusLabel(g.kind)}</div></>
) },
{ title: 'Provider / 模型', key: 'model', width: 168, className: MUTED_MONO, render: (_: any, g: any) => `${g.provider}/${g.model}` },
{ title: '提示词', key: 'prompt', className: cellWrap, render: (_: any, g: any) => (
<>
{(g.prompt || '').slice(0, 130)}{(g.prompt || '').length > 130 ? '…' : ''}
{g.params && Object.keys(g.params).length > 0 && <div className={MUTED_MONO}>{JSON.stringify(g.params).slice(0, 120)}</div>}
{g.asset_paths?.length ? <div className={MUTED_MONO}>参考素材 {g.asset_paths.length} 个 · job {g.provider_job_id || '—'}</div> : null}
</>
) },
/* 第 28 轮:一条 130 字的提示词加两行元信息在 398px 的列里折成 7 行(行高 227)。
提示词正文交给 <Clamp> 封顶两行、原文挂 title;参数与参考素材合成一行次要信息,
超长用 truncate 截断——单元格最多「正文两行 + 元信息一行」,超过就是设计没做完。 */
{ title: '提示词', key: 'prompt', render: (_: any, g: any) => {
const prompt = g.prompt || ''
const params = g.params && Object.keys(g.params).length > 0 ? JSON.stringify(g.params) : ''
const refs = g.asset_paths?.length
? `参考素材 ${g.asset_paths.length} 个 · job ${g.provider_job_id || '—'}` : ''
return (
<>
<Clamp title={prompt}>{prompt}</Clamp>
{params || refs
? <div className={`${MUTED_MONO} truncate`} title={`${params} ${refs}`.trim()}>{params || refs}</div>
: null}
</>
)
} },
{ title: '时长', key: 'duration', width: 84, align: 'right', className: MONO, render: (_: any, g: any) => fmtSeconds(g.duration_seconds) },
{ title: '成本', key: 'cost', width: 96, align: 'right', className: MONO, render: (_: any, g: any) => fmtMoney(g.cost, g.currency || currency) },
{ title: '尝试', key: 'attempts', width: 68, align: 'center', className: MONO, render: (_: any, g: any) => g.attempts },

View File

@ -8,12 +8,12 @@ import * as api from '../../api/client'
import { fmtAgo, fmtMoney, statusLabel } from '../../lib/format'
import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { ActionGroup, Actions, Button, Check, Ctlbar, Divider, ErrorText, ExtLink, Field, Grid, IconText, Layout, LinkButton, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, ProgressBar, Row, Spinner, Status, Table, Tag, TagGroup, Toolbar, Value, cellWrap } from '../../components/ui'
import { PageHead, ActionGroup, Actions, Button, Check, Ctlbar, Divider, Count, ErrorText, ExtLink, Field, Info, Layout, LinkButton, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, ProgressBar, Row, Spinner, Status, Table, Tag, TagGroup, Toolbar, Value, Clamp } from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { Checkbox } from '../../components/ui'
import { IconApi, IconClock, IconClose, IconPlayCircle, IconRetry, IconSend, IconSound, IconWarn } from '../../components/icons'
import { IconApi, IconClock, IconClose, IconPlayCircle, IconRetry, IconSend, IconSound } from '../../components/icons'
const QUEUE_STATUSES = ['planned', 'queued', 'running', 'retrying', 'succeeded', 'failed', 'cancelled', 'skipped']
const QUEUE_KINDS = ['generate_shot', 'voiceover', 'qc_shot', 'compose', 'import', 'asset']
@ -199,6 +199,14 @@ export default function Dispatch() {
return (
<PageStack>
{/* 页头(第 1 条):入队是这一页唯一整页成立的主操作,从「分镜任务清单」的卡头里提出来。
卡头只留「预计成本 · 共 N 行」这句清单自身的口径。 */}
<PageHead
title="任务调度中心"
sub="按分镜清单入队生成与配音任务,跟踪队列、重试与并发;模型本身的配置在模型管理中心。"
actions={<Button type="primary" disabled={!!busy} onClick={enqueue} icon={<IconPlayCircle />}>入队所选 / 全部待生成</Button>}
/>
{/* 队列总览:一排 Tag 悬浮在页面底色上时,它和下面的卡片没有任何归属关系
(截图上就是「这行字是页面上的脏东西」)。它是一块只有卡头的卡 = <Toolbar>。
只读计数仍走 Tag,不借 Chip 的胶囊皮肤(规范 §2.0)。 */}
@ -215,28 +223,35 @@ export default function Dispatch() {
<Layout>
<Panel>
<PanelHead title="分镜任务清单"
sub={<>预计成本 {fmtMoney(plan?.estimated_cost, plan?.currency)} · 共 {planRows.length} 行</>}
right={<Button type="primary" disabled={!!busy} onClick={enqueue} icon={<IconPlayCircle />}>入队所选 / 全部待生成</Button>} />
{/* 八颗只读计数在 378px 的侧栏卡里自然排列会折成 7+1(尾行孤一颗)。
它们是同一组「清单有多少」的对账单,用两列栅格对齐成表,不靠 flex 顺拐。 */}
<Grid cols={2} gap={8} className="mb-3">
<Tag>待入队 {enqueueable.length}</Tag>
<Tag>配音待生成 {voiceoverable.length}</Tag>
<Tag>已排队 {plan?.queued_count || 0}</Tag>
<Tag tone={plan?.blocked_count ? 'bad' : 'default'}>阻塞 {plan?.blocked_count || 0}</Tag>
<Tag>跳过 {plan?.skipped_count || 0}</Tag>
<Tag tone={plan?.preflight?.ready ? 'ok' : 'default'}>预检就绪 {plan?.preflight?.ready || 0}</Tag>
<Tag tone={plan?.preflight?.warnings ? 'warn' : 'default'}>预检告警 {plan?.preflight?.warnings || 0}</Tag>
<Tag>预计 {plan?.voiceover_count || 0} 条配音</Tag>
</Grid>
sub={<>预计成本 {fmtMoney(plan?.estimated_cost, plan?.currency)} · 共 {planRows.length} 行</>} />
{/* 八颗只读计数原先是无底纹的灰胶囊:统计块没有底纹就没有「块」的边界,
在 378px 侧栏里还折成 7+1 的孤尾行。改成回显表:标签列由 antd 上 colorFillAlter
底纹,对账单式对齐;数值等宽、只有非零才上色,0 降成次要色不占注意力。
列数跟着屏宽走(窄屏 2 列、桌面 4 列):写死 column={2} 时八颗计数要排四行,
这块回显比下面的任务清单还高,主客颠倒。 */}
<Info className="mb-3" column={{ xs: 2, md: 3, lg: 4 }} items={[
{ label: '待入队', value: <Count n={enqueueable.length} /> },
{ label: '已排队', value: <Count n={plan?.queued_count || 0} /> },
{ label: '待配音', value: <Count n={voiceoverable.length} /> },
{ label: '预计配音', value: <Count n={plan?.voiceover_count || 0} unit="条" /> },
{ label: '预检就绪', value: <Count n={plan?.preflight?.ready || 0} tone="ok" /> },
{ label: '预检告警', value: <Count n={plan?.preflight?.warnings || 0} tone="warn" /> },
{ label: '阻塞', value: <Count n={plan?.blocked_count || 0} tone="bad" /> },
{ label: '跳过', value: <Count n={plan?.skipped_count || 0} /> },
]} />
<Table
maxHeight={360}
minWidth={860}
/* 行高纪律(第 27 轮全站表格体检):这张表原先定宽 748 + minWidth 860,
说明列只分到 112px,一句「画面产物已存在(…mp4),镜头状态 generated」折成 8 行,
行高 168px —— 一屏只看得下两行清单。
做法:时长并进镜头列第二行(Provider 也挂在那儿),说明拿剩下的 274px 并封顶两行;
定宽合计 400 < 容器 674,横向滚动同时归零。 */
minWidth={false}
rowKey="_key"
dataSource={planRows}
empty="还没有分镜清单,先去「分镜工作台」拆镜头。"
columns={[
{ title: '#', key: 'pick', width: 56, align: 'center', render: (_: any, row: any) => (
{ title: '#', key: 'pick', width: 40, align: 'center', render: (_: any, row: any) => (
row._row === 'shot'
? <Checkbox className="mx-auto" aria-label={`选择镜头 ${row.order_index}`}
checked={shotIds.includes(row.shot_id)}
@ -244,29 +259,30 @@ export default function Dispatch() {
onCheckedChange={() => toggleShot(row.shot_id)} />
: <IconSound />
) },
{ title: '镜头', key: 'shot', width: 220, render: (_: any, row: any) => (
<>
<b>#{row.order_index}</b> {row._row === 'shot' ? row.title : '配音'}
<div className={MUTED_MONO}>shot#{row.shot_id}</div>
</>
) },
{ title: '动作', key: 'action', width: 104, render: (_: any, row: any) => (
{ title: '镜头', key: 'shot', width: 200, render: (_: any, row: any) => {
const who = row._row === 'shot' ? row.title : '配音'
const meta = row._row === 'shot'
? `shot#${row.shot_id} · ${row.duration}s · ${row.provider || '—'}/${row.model || '默认'}`
: `shot#${row.shot_id} · ${row.chars} 字 · TTS`
return <>
<Clamp lines={1} title={`#${row.order_index} ${who}`}><b>#{row.order_index}</b> {who}</Clamp>
<Clamp lines={1} className={MUTED_MONO} title={meta}>{meta}</Clamp>
</>
} },
{ title: '动作', key: 'action', width: 84, render: (_: any, row: any) => (
row._row === 'shot'
? <Tag tone={row.action === 'enqueue' ? 'info' : row.action === 'needs_attention' ? 'bad' : 'warn'}>{actionLabel(row.action)}</Tag>
: <Tag tone={row.action !== 'skip' ? 'info' : 'default'}>{row.action !== 'skip' ? '待配音' : '跳过'}</Tag>
) },
{ title: 'Provider / 模型', key: 'model', width: 180, className: `${MONO} ${MUTED}`,
render: (_: any, row: any) => (row._row === 'shot' ? `${row.provider || '—'} / ${row.model || '默认'}` : 'TTS') },
{ title: '时长', key: 'duration', width: 84, align: 'right', className: MONO,
render: (_: any, row: any) => (row._row === 'shot' ? `${row.duration}s` : `${row.chars} 字`) },
{ title: '预估成本', key: 'cost', width: 104, align: 'right', className: MONO,
{ title: '预估成本', key: 'cost', width: 76, align: 'right', className: MONO,
render: (_: any, row: any) => (row._row === 'shot' ? fmtMoney(row.estimated_cost) : '—') },
{ title: '说明', key: 'reason', className: `${cellWrap} ${MUTED}`, render: (_: any, row: any) => (
<>
{row.reason}
{row.blocking?.length ? <span className="text-error"> 阻塞:{row.blocking.join(';')}</span> : null}
</>
) }
{ title: '说明', key: 'reason', className: MUTED, render: (_: any, row: any) => {
const blocking = row.blocking?.length ? `阻塞:${row.blocking.join(';')}` : ''
return <Clamp title={[row.reason, blocking].filter(Boolean).join(' ')}>
{row.reason}
{blocking ? <span className="text-error"> {blocking}</span> : null}
</Clamp>
} }
]}
/>
</Panel>
@ -325,11 +341,13 @@ export default function Dispatch() {
<PanelHead title="队列状态" />
<Table
maxHeight={false}
minWidth={760}
/* 任务类型列 5 个字(「时间线合成」)压到 104 就折行,八颗计数列不给宽度:
104 + 8×71 = 672 ≈ 容器 674,minWidth 从 760 撤掉,横滚归零。 */
minWidth={false}
rowKey={(kind: string) => kind}
dataSource={QUEUE_KINDS}
columns={[
{ title: '任务类型', key: 'kind', width: 140, render: (_: any, kind: any) => <b>{statusLabel(kind)}</b> },
{ title: '任务类型', key: 'kind', width: 104, render: (_: any, kind: any) => <b>{statusLabel(kind)}</b> },
...QUEUE_STATUSES.map((st) => ({
title: statusLabel(st), key: st, align: 'center' as const,
render: (_: any, kind: string) => {
@ -345,25 +363,36 @@ export default function Dispatch() {
<PanelHead title="模型并发与限流" />
<Table
maxHeight={false}
/* 这张表住在 9/24 的侧栏里(容器 378):六列 + minWidth=700 等于
在窄栏里横滚一条 700px 的带子,槽位 / RPM / 状态三列各只露半个字。
收成三列:名称自己折,并发与额度各一颗数字,状态标签跟着名称走 —— 横滚归零。 */
minWidth={false}
rowKey={(c: any) => `${c.provider}${c.model}${c.media_type}`}
/* 定宽列合计 430 + 首列 210 = 640,560 的下限等于没设:
首列被压到竖排折字就是这个原因 → 抬到 700,交给横向滚动。 */
minWidth={700}
dataSource={queue?.capacity || []}
empty="没有登记并发的模型:所有任务按默认额度执行。"
columns={[
/* 这列没写 width 时被挤到「comfyui /」一行、「indextts2」一行:
mono 串本身没有空格可折,就得由表格外层横向滚动接手。 */
{ title: 'Provider / 模型', key: 'model', width: 210, className: `${MONO} whitespace-nowrap`,
render: (_: any, c: any) => <>{c.provider} / {c.model || '默认'}<div className={MUTED}>{c.media_type}</div></> },
{ title: '运行', key: 'running', width: 68, align: 'center', className: MONO, render: (_: any, c: any) => c.running },
{ title: '排队', key: 'queued', width: 68, align: 'center', className: MONO, render: (_: any, c: any) => c.queued },
{ title: '槽位', key: 'slots', width: 88, align: 'center', className: MONO,
render: (_: any, c: any) => `${c.slots}/${c.concurrency_limit}` },
{ title: 'RPM 余量', key: 'rpm', width: 96, align: 'center', className: MONO, render: (_: any, c: any) => c.rpm_headroom },
{ title: '状态', key: 'state', width: 110, render: (_: any, c: any) => (
<Tag tone={!c.enabled ? 'bad' : c.saturated ? 'warn' : 'ok'}>{!c.enabled ? '已停用' : c.saturated ? '已满负荷' : '可用'}</Tag>
) }
{ title: 'Provider / 模型', key: 'model', render: (_: any, c: any) => (
<>
<Clamp lines={1} className={MONO} title={`${c.provider} / ${c.model || '默认'}`}>
{c.provider} / {c.model || '默认'}
</Clamp>
<span className="inline-flex items-center gap-1">
<Tag size="sm" tone={!c.enabled ? 'bad' : c.saturated ? 'warn' : 'ok'}>
{!c.enabled ? '已停用' : c.saturated ? '满载' : '可用'}
</Tag>
<span className={MUTED}>{c.media_type}</span>
</span>
</>
) },
{ title: '运行 / 排队', key: 'running', width: 88, align: 'center', className: MONO,
render: (_: any, c: any) => `${c.running} / ${c.queued}` },
{ title: '槽位 / RPM', key: 'slots', width: 92, align: 'center',
render: (_: any, c: any) => (
<>
<div className={MONO}>{c.slots}/{c.concurrency_limit}</div>
<div className={MUTED_MONO}>RPM {c.rpm_headroom}</div>
</>
) }
]}
/>
</Panel>
@ -386,49 +415,68 @@ export default function Dispatch() {
</Field>
</Ctlbar>} />
<Table
/* 定宽列合计已接近 1150,余给「错误 / 检查点」的只有几十字;
表头「错误 / 检查点」被压成一竖条就是这个原因 → 下限抬到 1500,交给横向滚动。 */
minWidth={1500}
/* 行高纪律(第 27 轮体检:定宽合计 1152 + 错误列 348,最高行仍 125px,横滚 1500):
ID 并进取名行、心跳停服从三行红字换成一颗图标标签(解释留在 title 和卡头 sub),
长文案一律 <Clamp> 封顶两行;定宽降到 896,容器 1118 剩下的 222px 全给错误列
——「长文列 ≥ 200px」达标,横向滚动同时归零。 */
minWidth={false}
dataSource={tasks}
empty="暂无任务,先在上方生成任务清单并入队。"
columns={[
{ title: 'ID', key: 'id', width: 76, className: MONO, render: (_: any, t: any) => `#${t.id}` },
{ title: '任务', key: 'name', width: 190, render: (_: any, t: any) => (
<>{t.name}<div className={MUTED_MONO}>{statusLabel(t.kind)} · {t.stage}</div></>
{ title: '任务', key: 'name', width: 180, render: (_: any, t: any) => (
<>
<Clamp lines={1} title={`#${t.id} ${t.name}`}><span className={MONO}>#{t.id}</span> {t.name}</Clamp>
<Clamp lines={1} className={MUTED_MONO} title={`${statusLabel(t.kind)} · ${t.stage}`}>
{statusLabel(t.kind)} · {t.stage}
</Clamp>
</>
) },
{ title: '镜头', key: 'shot', width: 96, className: MONO,
{ title: '镜头', key: 'shot', width: 78, className: MONO,
render: (_: any, t: any) => (t.shot_id ? `#${t.shot_id}` : t.timeline_id ? `时间线#${t.timeline_id}` : '—') },
{ title: '后端', key: 'backend', width: 150, className: `${MONO} ${MUTED}`,
render: (_: any, t: any) => <>
{statusLabel(t.execution_backend)}
{t.worker_id ? <div className={MUTED}>{t.worker_id}</div> : null}
</> },
{ title: '尝试', key: 'attempts', width: 76, align: 'center', className: MONO,
{ title: '后端', key: 'backend', width: 124, render: (_: any, t: any) => (
<>
<Clamp lines={1} className={MUTED} title={statusLabel(t.execution_backend)}>{statusLabel(t.execution_backend)}</Clamp>
<Clamp lines={1} className={MUTED_MONO} title={t.worker_id}>{t.worker_id}</Clamp>
</>
) },
{ title: '尝试', key: 'attempts', width: 58, align: 'center', className: MONO,
render: (_: any, t: any) => `${t.attempts}/${t.max_attempts}` },
{ title: '进度', key: 'progress', width: 118, align: 'center',
{ title: '进度', key: 'progress', width: 100, align: 'center',
render: (_: any, t: any) => <ProgressBar value={Math.round((t.progress || 0) * 100)} /> },
{ title: '耗时', key: 'elapsed', width: 96, align: 'right', className: MONO, render: (_: any, t: any) => (
{ title: '耗时', key: 'elapsed', width: 82, align: 'right', className: MONO, render: (_: any, t: any) => (
t.elapsed_ms ? `${(t.elapsed_ms / 1000).toFixed(1)}s`
: t.queue_wait_ms ? `排队 ${(t.queue_wait_ms / 1000).toFixed(1)}s` : '—'
) },
{ title: '状态', key: 'status', width: 200, render: (_: any, t: any) => (
{ title: '状态', key: 'status', width: 168, render: (_: any, t: any) => (
<>
<Status value={t.status} />
<div className={MUTED}>{fmtAgo(t.updated_at)}</div>
<Status value={t.status} />{' '}
<span className={MUTED}>{fmtAgo(t.updated_at)}</span>
{/* 心跳停服只在这一行说结论,长解释挂 title:整表级的说明在卡头 sub 里。
原来这里是三行红字,行高从 42 顶到 125。 */}
{t.stale
? <div className="mt-1 max-w-[190px] text-xs leading-normal text-warning-hover"><IconText align="start" icon={<IconWarn />}>心跳已停止 {fmtAge(t.heartbeat_age_seconds)}:可能已中断,不会永远转圈</IconText></div>
? <Tag size="sm" tone="warn" className="ml-1"
title={`执行体超过 ${fmtAge(t.heartbeat_age_seconds)}没有报活:多半是那台机器上的模型服务或平台进程中断过,产物与断点都留着,平台回收后会自动续跑`}>
心跳停止
</Tag>
: null}
</>
) },
{ title: '错误 / 检查点', key: 'error', className: cellWrap, render: (_: any, t: any) => (
<>
{t.error_message ? <span className="text-error">{t.error_code} {t.error_message}</span> : null}
{t.checkpoint?.last_note ? <div className={MUTED}>{t.checkpoint.last_note}</div>
: Object.keys(t.checkpoint || {}).length ? <div className={MUTED_MONO}>checkpoint: {JSON.stringify(t.checkpoint).slice(0, 90)}</div> : null}
{t.output_url ? <ExtLink href={t.output_url}>产物</ExtLink> : null}
</>
) },
{ title: '操作', key: 'actions', width: 150, align: 'right', render: (_: any, t: any) => (
{ title: '错误 / 检查点', key: 'error', render: (_: any, t: any) => {
const detail = [
t.error_message ? `${t.error_code || 'error'} ${t.error_message}` : '',
t.checkpoint?.last_note || ''
].filter(Boolean).join(' / ')
return <>
<Clamp title={detail}>
{t.error_message ? <span className="text-error">{t.error_code} {t.error_message}</span> : null}
{t.checkpoint?.last_note ? <span> {t.checkpoint.last_note}</span>
: Object.keys(t.checkpoint || {}).length
? <span className={MUTED_MONO}> checkpoint: {JSON.stringify(t.checkpoint)}</span> : null}
</Clamp>
{t.output_url ? <ExtLink href={t.output_url}>产物</ExtLink> : null}
</>
} },
{ title: '操作', key: 'actions', width: 112, align: 'right', render: (_: any, t: any) => (
<Row className="justify-end">
{['failed', 'cancelled'].includes(t.status)
? <Button icon={<IconRetry />} size="sm" onClick={() => retryTask(t)}>重试</Button> : null}

View File

@ -21,12 +21,12 @@ import { Select } from '../../components/forms'
import { AudioPlay } from '../../components/media/AudioPlay'
import { MediaThumb } from '../../components/media/MediaThumb'
import { RecordAudio, type RecordPickMeta } from '../../components/media/RecordAudio'
import { ActionGroup, Actions, BarRight, Block, Button, CARD_ROW, CardActions, Check, Chip, ChipBar, Ctlbar, Divider, Drawer, Empty, ErrorText, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LINK_CLS, LineHint, LinkButton, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, cellWrap } from '../../components/ui'
import { ActionGroup, Actions, BarRight, Block, Button, CARD_ROW, CardActions, Check, Chip, ChipBar, Ctlbar, Divider, Drawer, Empty, ErrorText, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Info, Input, LINK_CLS, LineHint, LinkButton, MONO, MUTED, MUTED_MONO, Notice, NumberInput, PageHead, PageStack, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, cellWrap } from '../../components/ui'
import { useSystemStore } from '../../stores/system'
import { refresh, useProjectStore } from '../../stores/project'
import { notify } from '../../stores/notice'
import { Checkbox } from '../../components/ui'
import { IconBolt, IconBulb, IconCheck, IconChevronUp, IconClose, IconDelete, IconEdit, IconImage, IconLibrary, IconParams, IconPass, IconReject, IconSync, IconUpload, IconVoice, IconWarn } from '../../components/icons'
import { IconAdd, IconBolt, IconBulb, IconCheck, IconChevronUp, IconClose, IconDelete, IconEdit, IconImage, IconLibrary, IconParams, IconSync, IconUpload, IconVoice } from '../../components/icons'
type GenType = 'human' | 'scene' | 'voice'
type PanelKey = GenType | 'project'
@ -69,16 +69,6 @@ const GENDER_OPTIONS = [
const ROLE_OPTIONS = ['主角', '配角', '反派', '旁白', '群众']
/** 上传区里的项目级素材类型(配乐 / 音效是时间线合成页直接要吃的东西) */
const PROJECT_ASSET_KINDS = ['bgm', 'sfx', 'reference', 'reference_image', 'reference_video']
const SAY_VOICES = [
{ value: 'Tingting', label: 'Tingting · 中文女声' },
{ value: 'Meijia', label: 'Meijia · 中文女声' },
{ value: 'Sinji', label: 'Sinji · 粤语女声' },
{ value: 'Fred', label: 'Fred · 英文低男声' },
]
const EFFECT_OPTIONS = [
{ value: '', label: '真实人声' },
{ value: 'alien', label: '外星低吼(降调 + 金属共振)' },
]
const IMAGE_REF_ACCEPT = 'image/*'
const assetKindLabel = (kind: string) => opt('asset_kinds', kind)
@ -171,7 +161,6 @@ export default function Library() {
const [scene, setScene] = useState({ ...EMPTY_SCENE })
const [voice, setVoice] = useState({ ...EMPTY_VOICE })
const [voiceSpeed, setVoiceSpeed] = useState(1)
const [voiceEffect, setVoiceEffect] = useState('')
const [keyword, setKeyword] = useState('')
const [onlyMissing, setOnlyMissing] = useState(false)
@ -197,13 +186,6 @@ export default function Library() {
/* 「AI 补全一致性提示词」走的是后端的 resolve_llm,只认大模型分类 */
const llmProviders = useMemo(() => modelsOf('llm', false), [registryRows])
const ttsProviders = useMemo(() => modelsOf('tts', false), [registryRows])
/** SAY_VOICES 是封闭清单,但旧数据里存过手填的系统声音名;
不加这一条,下拉会把已存值静默显示成清单第一项,保存时就把音色改没了 */
const sayVoiceOptions = voice.provider === 'macos-say' && voice.provider_voice_id
&& !SAY_VOICES.some((v) => v.value === voice.provider_voice_id)
? [...SAY_VOICES, { value: voice.provider_voice_id, label: `${voice.provider_voice_id} · 自定义` }]
: SAY_VOICES
/** 注册表在回调里也要读到最新值,但抽屉要显示「所选通道不可用」→ 统一走这份订阅 */
const providerById = useCallback((id: number | null | undefined) => {
const row = registryRows.find((p) => p.id === id) || null
@ -457,19 +439,18 @@ export default function Library() {
async function saveVoice() {
if (!voice.name.trim()) { setError('请填写声线名称'); return }
const params: Record<string, any> = { ...(voice.tuning?.params || {}) }
if (voiceEffect) params.effect = voiceEffect
else delete params.effect
/* 只保留还活着的那几个音色参数:speed 是 ffmpeg 后期调的,
params 里原来的 effect(外星低吼)只有 macOS say 认,随适配器一起退役。 */
const body = {
...voice,
provider_voice_id: voice.provider_voice_id || voice.name,
tuning: { ...(voice.tuning || {}), speed: Number(voiceSpeed) || 1, params },
tuning: { ...(voice.tuning || {}), speed: Number(voiceSpeed) || 1 },
}
const ok = editing.kind === 'voice' && editing.id
? await run('保存声线', () => api.patch(`/api/projects/${projectId}/voices/${editing.id}`, body))
: await run('创建声线', () => api.post(`/api/projects/${projectId}/voices`, body))
if (ok) {
setVoice({ ...EMPTY_VOICE }); setVoiceSpeed(1); setVoiceEffect('')
setVoice({ ...EMPTY_VOICE }); setVoiceSpeed(1)
setEditing({ kind: '', id: null }); setShowForm(false)
notify('声线资产已保存')
}
@ -487,7 +468,6 @@ export default function Library() {
if (kind === 'voice') {
setVoice({ ...EMPTY_VOICE, ...row, tuning: { ...(row.tuning || {}) } })
setVoiceSpeed(Number(row.tuning?.speed || 1))
setVoiceEffect(row.tuning?.params?.effect || '')
}
setPanel(kind)
setShowForm(true)
@ -495,23 +475,12 @@ export default function Library() {
/** 点候选模型 = 一次性把 provider 和它自带的 voice 填好,省得两边填歪 */
function chooseTts(p: ModelRow) {
patchVoice({
provider: p.provider,
...(p.adapter === 'macos_say'
? {
provider_voice_id: p.config?.voice || 'Tingting',
language: 'zh-CN',
gender: 'female',
name: voice.name || '系统中文女声',
}
: { provider_voice_id: p.config?.voice || p.model })
})
patchVoice({ provider: p.provider, provider_voice_id: p.config?.voice || p.model })
}
function clearVoiceForm() {
setVoice({ ...EMPTY_VOICE, tuning: {} })
setVoiceSpeed(1)
setVoiceEffect('')
setEditing({ kind: '', id: null })
}
@ -759,34 +728,34 @@ export default function Library() {
return (
<PageStack>
{/* 页头(标题 + 说明 + 两个跳转)、四个内部页签、跨字段搜索条全部坐进同一张卡。
症状:这三截以前各自漂在页面底色上——裸 <h2> 当页头、页签条独立一行、
搜索条自己写 border+圆角+内边距,四种高度与两套内边距贴在一起,
看上去像三件互不相关的东西(这就是「页面布局不对」最常见的一型)。
做法:卡头交给 antd Card 的 title/sub/extra(K1 之后右端自带 wrap+gap),
页签与搜索条是它的正文;页面不再出现任何自绘容器。 */}
<Panel title="资产管理"
sub="集中维护人物、声音与场景。资产可单独调用模型生成,绑定到分镜后会自动进入视频参考素材与提示词。"
extra={<>
<LinkButton icon={<IconLibrary />} to="/assets">平台资产库</LinkButton>
<LinkButton icon={<IconParams />} to="/models">配置生成模型</LinkButton>
</>}>
{/* 人物 / 场景 / 声线 / 项目素材是四个内部页面 → Tabs(UI规范 §6.4)。
右侧动作走 antd 的 tabBarExtraContent,不再另起一行把页签和按钮分开。 */}
{/* 页头(第 1 条):环节名 + 职责说明 + 这一页的主操作。
主操作是「新建当前面板的资产」——它整页成立,所以进 PageHead;
两个跨页跳转是另一层意思,自成一组并排放左边。 */}
<PageHead
title="资产管理"
sub="集中维护人物、声音与场景。资产可单独调用模型生成,绑定到分镜后会自动进入视频参考素材与提示词。"
actions={<>
<ActionGroup>
<LinkButton icon={<IconLibrary />} to="/assets">平台资产库</LinkButton>
<LinkButton icon={<IconParams />} to="/models">配置生成模型</LinkButton>
</ActionGroup>
{panel !== 'project' && (
<Button icon={showForm ? <IconChevronUp /> : <IconAdd />} type="primary"
onClick={() => setShowForm(!showForm)}>
{showForm ? `收起${PANEL_LABEL[panel]}表单` : `新建${PANEL_LABEL[panel]}`}
</Button>
)}
</>}
/>
{/* 四个内部页签 + 跨字段搜索条坐在同一张卡里(它们说的是同一件事:这一页看哪一份、怎么找)。
症状(第 6 条·截图1):「+ 新建人物」以前挂在 tabBarExtraContent.right,
于是页签条和内容页的主按钮挤在同一行——页签回答「看哪一份」,按钮回答「做一件事」,
两者语义不同层,同排必然打架(切到「项目素材」面板那颗按钮还会凭空消失)。
做法:页签条独占一行,右端不再放按钮;执行中的忙态文字降进搜索条右端。 */}
<Panel>
<Tabs className="!mb-2" activeKey={panel}
onChange={(k) => choosePanel(k as PanelKey)}
tabBarExtraContent={{
right: (
<Row tight>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
{panel !== 'project' && (
<Button icon={<IconChevronUp />} type="primary" onClick={() => setShowForm(!showForm)}>
{showForm ? '收起' : `+ 新建${panel === 'human' ? '人物' : panel === 'scene' ? '场景' : '声线'}`}
</Button>
)}
</Row>
)
}}
items={PANEL_KEYS.map((key) => ({
key,
label: PANEL_LABEL[key],
@ -808,6 +777,7 @@ export default function Library() {
title="只看还没被任何镜头引用的资产,便于清理"
onClick={() => setOnlyUnused(!onlyUnused)}>未被镜头使用</Chip>
<BarRight>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
{filterActive
? <Value>命中 {shownCount} / {panelTotal}
<Button icon={<IconClose />} type="link" className="ml-[5px] pb-0" onClick={resetFilters}>清除筛选</Button>
@ -859,9 +829,23 @@ export default function Library() {
{!c.is_active && <Tag tone="bad">已停用</Tag>}
<UsageLine type="human" id={c.id} usage={use} projectId={projectId} />
</Row>
<p>{c.appearance || c.persona_prompt || '未填写外观与一致性提示词'}</p>
<p>造型版本 {c.style_version || 'v1'} · 默认声线 {c.default_voice_name || '未绑定'}
{c.tags?.length ? ` · ${c.tags.join(' / ')}` : ''}</p>
{/* 外观 / 造型版本 / 默认声线 / 标签是「这个人物的设定回显」,
原来写成两行 `·` 分隔的散文,找不到列也看不出哪些能改;
换成回显表:标签列带底纹,长描述独占一行,短属性并排。
column 写死 2 而不是 { xs: 1, sm: 2 }:antd Descriptions 的
span 不跟断点走,窄屏降到 1 列时「span:2 > column:1」当场
违反「每行 span 之和 = column」,控制台报 Sum of column
`span` in a line not match `column`(visualcheck 的 console
闸门就是它)。两列在 430 也成立:长描述顶满一行、短属性并排。 */}
<Info className="nex-info-in-card mt-1" column={2} items={[
{ label: '外观设定', span: 2,
value: c.appearance || c.persona_prompt || <span className="text-text-tertiary">未填写外观与一致性提示词</span> },
{ label: '造型版本', value: c.style_version || 'v1' },
{ label: '默认声线', value: c.default_voice_name || <span className="text-text-tertiary">未绑定</span> },
{ label: '标签', span: 2, value: c.tags?.length
? <TagGroup size="sm" className="mb-0">{c.tags.map((t: string) => <Tag key={t} size="sm">{t}</Tag>)}</TagGroup>
: <span className="text-text-tertiary">未打标签</span> },
]} />
{/* 素材行 = 卡片动作行:容器下发 antd 紧凑档(componentSize=small),
于是两颗按钮是同一档、同一圆角,标签走只读标签的 sm 档,
一行里不再出现「一种按钮两档高、圆角一个 6 一个 8」。 */}
@ -996,9 +980,16 @@ export default function Library() {
{v.is_default && <Tag tone="accent">默认</Tag>}
<UsageLine type="voice" id={v.id} usage={use} projectId={projectId} />
</Row>
<p>{v.description || '未填写音色描述'}</p>
<p>voice_id <span className={MONO}>{v.provider_voice_id}</span> · {v.language} · {GENDER_LABEL[v.gender] || v.gender || '中性'} · 版本 {v.version}</p>
<AiBar title="调用声音模型生成并登记为音色样本版本(IndexTTS2 支持参考音频克隆)"
{/* 音色设定原来是两行 `·` 分隔的散文:没有列,扫读只能整行读完。
改成回显表后标签列自带底纹,描述顶满一行、其余属性并排。
column 同人物卡写死 2——「音色描述」是 span:2,降到 1 列就警告。 */}
<Info className="nex-info-in-card mt-1" column={2} items={[
{ label: '音色描述', span: 2, value: v.description || <span className="text-text-tertiary">未填写音色描述</span> },
{ label: 'voice_id', mono: true, value: v.provider_voice_id || <span className="text-text-tertiary">未绑定</span> },
{ label: '语言 / 性别 / 版本',
value: `${v.language || '—'} · ${GENDER_LABEL[v.gender] || v.gender || '中性'} · 版本 ${v.version}` },
]} />
<AiBar title="调用声音模型生成并登记为音色样本版本(IndexTTS2:参考音频克隆 / 音色描述直出)"
icon={<IconVoice />} label="AI 试听样本"
last={gens && <Tag>{gens.provider}/{gens.model}</Tag>}
disabled={!ttsProviders.length}
@ -1162,11 +1153,10 @@ export default function Library() {
<FormRow>
<Field label="名称" required><Input value={voice.name} placeholder="例如:低沉男声" onChange={(e) => patchVoice({ name: e.target.value })} /></Field>
<Field label="Provider"><Input value={voice.provider} placeholder="从下方选择真实模型" onChange={(e) => patchVoice({ provider: e.target.value })} /></Field>
{voice.provider === 'macos-say'
? <Field label="macOS 系统声音">
<Select value={voice.provider_voice_id} onChange={(v) => patchVoice({ provider_voice_id: String(v) })} options={sayVoiceOptions} />
</Field>
: <Field label="Provider voice_id"><Input value={voice.provider_voice_id} placeholder="填写供应商 voice_id" onChange={(e) => patchVoice({ provider_voice_id: e.target.value })} /></Field>}
<Field label="供应商音色 ID"
hint="克隆模型可留空:音色由参考音频决定;没录过音就填下方「音色描述」,IndexTTS2 会按描述词直出">
<Input value={voice.provider_voice_id} placeholder="云端音色库填音色 ID;IndexTTS2 留空" onChange={(e) => patchVoice({ provider_voice_id: e.target.value })} />
</Field>
<Field label="语言"><Input value={voice.language} onChange={(e) => patchVoice({ language: e.target.value })} /></Field>
<Field label="性别">
<Select value={voice.gender} onChange={(v) => patchVoice({ gender: String(v) })} options={GENDER_OPTIONS} />
@ -1175,11 +1165,6 @@ export default function Library() {
<Field label="语速">
<NumberInput min={0.5} max={2} step={0.05} value={voiceSpeed} onChange={ (v) => setVoiceSpeed(v)} />
</Field>
{voice.provider === 'macos-say' && (
<Field label="声音效果">
<Select value={voiceEffect} onChange={(v) => setVoiceEffect(String(v))} options={EFFECT_OPTIONS} placeholder="真实人声" />
</Field>
)}
</FormRow>
<FieldBlock label="音色描述">
<TextArea rows={2} value={voice.description} onChange={(e) => patchVoice({ description: e.target.value })} />
@ -1193,13 +1178,6 @@ export default function Library() {
))}
{!ttsProviders.length && <span className={MUTED}>未登记可用 TTS 模型</span>}
</ChipBar>
{voice.provider === 'macos-say' && (
<ChipBar top>
{SAY_VOICES.map((v) => (
<Chip key={v.value} active={voice.provider_voice_id === v.value} onClick={() => patchVoice({ provider_voice_id: v.value })}>{v.label}</Chip>
))}
</ChipBar>
)}
</FormGrid>
</Drawer>
@ -1266,12 +1244,13 @@ export default function Library() {
hint="弹出小面板:念几句话当作 IndexTTS2 的克隆参考,录完自动转成 WAV 并选中"
onPick={(file, meta) => void recordGenerationReference('voice', genOwner, file, meta)} />
<small className="flex-1 basis-[240px] text-xs leading-normal text-text-quaternary">
IndexTTS2 通过参考音频做 zero-shot 音色克隆;上传后会自动选中。
音色由参考音频决定,「性别 / 音色描述」对模型只是标注,所以留空时会拿到谁的嗓子必须实测告诉你:
IndexTTS2 两条路:上传参考音频做 zero-shot 克隆(上传后会自动选中),
或不传音频、直接用声线的「音色描述」由描述词直出。
留空时会拿到谁的嗓子,下面这条预告会说清楚:
</small>
{voiceRefStatus && (
<RefStatus ready={!!voiceRefStatus.ready} borrowed={!!voiceRefStatus.borrowed}
note={voiceRefStatus.note} />
instruct={!!voiceRefStatus.instruct} note={voiceRefStatus.note} />
)}
</GenerationReference>
</>
@ -1449,26 +1428,25 @@ function GenerationReference({ children }: { children: ReactNode }) {
/**
* 音色预告(.ref-status)。
*
* IndexTTS2 的音色由参考音频决定,留空时后端会按性别「借」一条嗓子,
* 必须把借了谁写在生成按钮够得着的地方,而不是等失败才知道。
* 三种音色来源必须分得开:借了别人的嗓子(warning)、走描述词直出(正常但标明来源)、
* 用自己的参考音频克隆(正常)。两者都没有时后端会按性别「借」一条嗓子,
* 必须把这次用的是谁的嗓子写在生成按钮够得着的地方,而不是等失败才知道。
*/
function RefStatus({ ready, borrowed, note }: { ready: boolean; borrowed: boolean; note?: string }) {
function RefStatus({ ready, borrowed, instruct, note }: {
ready: boolean; borrowed: boolean; instruct?: boolean; note?: string
}) {
return (
<Block className="w-full" align="start"
tone={!ready ? 'bad' : borrowed ? 'warn' : 'ok'}>
<b className="text-xs"><IconText icon={ready ? (borrowed ? <IconWarn /> : <IconPass />)
: <IconReject />}>{ready ? '本次音色' : '现在还不能生成'}</IconText></b>
<span className="min-w-0 text-xs leading-normal">{note}</span>
</Block>
<Notice className="!mb-0 w-full" type={!ready ? 'error' : borrowed ? 'warning' : 'success'}
description={<span className="min-w-0">{note}</span>}>
{!ready ? '现在还不能生成' : instruct ? '本次音色 · 描述词直出' : '本次音色'}
</Notice>
)
}
/** 模型未就绪 / 完全没模型的提醒(.provider-warning):说清楚是「还能选」还是「点不动」 */
function ProviderWarning({ children }: { children: ReactNode }) {
return (
<Block tone="warn" align="start" className="mt-2 w-full text-xs leading-normal text-warning">
<span className="min-w-0">{children}</span>
</Block>
<Notice className="mt-2 w-full !mb-0" type="warning">{children}</Notice>
)
}

View File

@ -25,10 +25,9 @@ import { refresh, useProjectStore } from '../../stores/project'
import { notify } from '../../stores/notice'
import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { Actions, Button, CardRow, Chip, Ctlbar, Divider, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, LINK_CLS, Layout, LinkButton, LogBox, LogRow, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, SearchInput, Stack, Stat, Table, Tag, TagGroup, TextArea, Value, cellWrap } from '../../components/ui'
import type { GridStep } from '../../components/ui'
import { PageHead, Actions, Button, CardRow, Chip, Info, Ctlbar, Divider, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, LINK_CLS, Layout, LinkButton, LogBox, LogRow, MONO, Notice, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, SearchInput, Stack, Stat, Table, Tag, TagGroup, TextArea, Value, Clamp } from '../../components/ui'
import AgentConsole from './AgentConsole'
import { IconCheck, IconChevronRight, IconChevronUp, IconClose, IconPass } from '../../components/icons'
import { IconBolt, IconCheck, IconChevronRight, IconChevronUp, IconClose, IconFolder, IconGrid, IconImage, IconPass, IconTracks, IconUser, IconVoice } from '../../components/icons'
/**
* 只放后端 ProjectUpdate 真实接受的字段。
* status 不在这里:项目状态由后端 status.refresh() 按镜头与任务真实进度回写,
@ -86,7 +85,6 @@ const NEXT_ACTIONS: Record<string, Suggestion[]> = {
}
/** 统计卡栅格:照旧站 .grid4——≤1180 先并两列,≤560 才塌成一列 */
const STAT_STEPS: GridStep[] = [{ at: 'xl', cols: 2 }, { at: 'sm', cols: 1 }]
export default function Overview() {
const id = useProjectStore((s) => s.id)
@ -256,6 +254,19 @@ export default function Overview() {
return (
<PageStack>
{/* 页头(第 1 条):这一页的主操作只有「归档 / 取消归档」——它决定后端还推不推流程节点,
作用域是整个项目而不是「项目设置」那张卡,所以从卡头提到页头。
「编辑 / 保存设置」改的是表单本身,留在原卡头(离开那块就不成立)。 */}
<PageHead
title="流程概览"
sub="看清流程走到了哪一步、下一个节点还缺什么,并在总控台里下达任务指令。"
actions={<Button icon={<IconFolder />} disabled={saving}
title="项目状态由后端按镜头与任务真实进度回写,这里只提供归档开关;归档后不再自动推进流程节点。"
onClick={() => setArchived(!isArchived)}>
{isArchived ? '取消归档' : '归档项目'}
</Button>}
/>
<AgentConsole />
<Layout>
@ -263,23 +274,29 @@ export default function Overview() {
{/* 流程节点与指标卡由项目 store 每 6 秒轮询,本页只负责预检与事件流 */}
<Panel>
<PanelHead title="流程节点明细" />
{/* 第 28 轮:「节点」168px 时中文节点名先折两行,加上下方的 key 就是 81px 行高;
「说明」用 cellWrap 时还会把表宽顶到 720(容器 674)。
改成定宽列 356(状态 84 / 节点 200 / 完成度 72)+ 说明吃剩余 ~318 并封顶两行,
顺带把说明挪到最后一列——长文列放中间,后面每一列都要跟着它抖动。 */}
<Table
maxHeight={false}
minWidth={720}
minWidth={false}
dataSource={workflow}
rowKey="key"
columns={[
{ title: '状态', key: 'state', width: 92, render: (_: any, row: any) =>
{ title: '状态', key: 'state', width: 84, render: (_: any, row: any) =>
<Tag tone={STATE_TONE[row.state] || 'default'}>{STATE_LABEL[row.state] || row.state}</Tag> },
{ title: '节点', key: 'label', width: 168, render: (_: any, row: any) => (
{ title: '节点', key: 'label', width: 200, render: (_: any, row: any) => (
<>
<b>{row.label}</b>
<Clamp lines={1} title={row.label}><b>{row.label}</b></Clamp>
<div className={MUTED_MONO}>{row.key}</div>
</>
) },
{ title: '说明', dataIndex: 'detail', key: 'detail', className: cellWrap },
{ title: '完成度', key: 'done', width: 88, align: 'center', className: MONO,
render: (_: any, row: any) => (row.done == null ? '—' : `${row.done}/${row.total}`) }
{ title: '完成度', key: 'done', width: 72, align: 'center', className: MONO,
render: (_: any, row: any) => (row.done == null ? '—' : `${row.done}/${row.total}`) },
{ title: '说明', key: 'detail', render: (_: any, row: any) => (
<Clamp title={row.detail}>{row.detail}</Clamp>
) }
]}
/>
</Panel>
@ -313,16 +330,16 @@ export default function Overview() {
))}
</CardRow>
))}
{/* project_issues 是纯文本清单(项目级前置条件),不要按 issue 对象去取 severity */}
{/* project_issues 是纯文本清单(项目级前置条件),不要按 issue 对象去取 severity。
以前写成「建议」Tag + 裸文本一行行漂着——语义提示按 R16 只有 Notice 一种写法,
明细属于正文,放 description 第二层,不跟标题一起加粗。 */}
{!!preflight?.project_issues?.length && (
<>
<Divider />
{preflight.project_issues.map((i: any, k: number) => (
<p key={`pi${k}`} className="m-1 text-xs text-text-tertiary leading-normal">
<Tag tone="warn">建议</Tag>{' '}{i}
</p>
))}
</>
<Notice className="!mb-0 mt-3" type="warning"
description={<ul className="m-0 list-disc pl-4 text-xs leading-relaxed">
{preflight.project_issues.map((i: any, k: number) => <li key={`pi${k}`}>{i}</li>)}
</ul>}>
项目级前置条件还有 {preflight.project_issues.length} 项待处理
</Notice>
)}
{preflight && !badPreflight.length && !preflight.project_issues?.length && (
<Value><IconText icon={<IconPass />}>所有镜头的素材与参数均已就绪。</IconText></Value>
@ -336,10 +353,6 @@ export default function Overview() {
right={(
<Row tight>
<Tag tone={flowTagTone}>{flowTagText}</Tag>
<Button icon={<IconClose />} size="sm" disabled={saving} onClick={() => setArchived(!isArchived)}
title="项目状态由后端按镜头与任务真实进度回写,这里只提供归档开关;归档后不再自动推进流程节点。">
{isArchived ? '取消归档' : '归档项目'}
</Button>
<Button icon={<IconChevronUp />} size="sm" onClick={() => setEditing(!editing)}>
{editing ? '收起' : '编辑'}
</Button>
@ -416,26 +429,17 @@ export default function Overview() {
</Actions>
</>
) : (
<Grid cols={3} steps={STAT_STEPS}>
<div>
<small className={MUTED}>风格指南</small>
<Value>{project?.style_guide || '未设置'}</Value>
</div>
<div>
<small className={MUTED}>负面提示词</small>
<Value>{project?.global_negative_prompt || '未设置'}</Value>
</div>
<div>
<small className={MUTED}>默认生成参数</small>
<Value>
{project?.default_model
? `${project?.default_provider} / ${project?.default_model}`
: `跟随平台默认(${defaultVideoLabel})`}
{' · '}{project?.aspect_ratio} · {project?.resolution} @{project?.fps}fps
{' · '}单镜时长区间 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒
</Value>
</div>
</Grid>
<Info column={1} items={[
{ label: '风格指南', value: project?.style_guide || '未设置' },
{ label: '负面提示词', value: project?.global_negative_prompt || '未设置' },
{ label: '默认生成参数', value: <>
{project?.default_model
? `${project?.default_provider} / ${project?.default_model}`
: `跟随平台默认(${defaultVideoLabel})`}
{' · '}{project?.aspect_ratio} · {project?.resolution} @{project?.fps}fps
{' · '}单镜时长区间 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒
</> },
]} />
)}
<ErrorText>{error}</ErrorText>
</FormGrid>
@ -471,17 +475,17 @@ export default function Overview() {
为一处侧栏引入第二套(容器)断点,代价是全站栅格又有了两种尺子。
*/}
<Grid cols={2} steps={[{ at: 'sm', cols: 1 }]}>
<Stat label="人物" value={stats?.characters || 0} />
<Stat label="场景" value={stats?.scenes || 0} />
<Stat label="声线" value={stats?.voices || 0} />
<Stat label="素材文件" value={stats?.assets || 0} />
<Stat icon={<IconUser />} label="人物" value={stats?.characters || 0} />
<Stat icon={<IconGrid />} label="场景" value={stats?.scenes || 0} />
<Stat icon={<IconVoice />} label="声线" value={stats?.voices || 0} />
<Stat icon={<IconFolder />} label="素材文件" value={stats?.assets || 0} />
</Grid>
<Divider />
<Grid cols={2} steps={[{ at: 'sm', cols: 1 }]}>
<Stat label="镜头总数" value={stats?.shots || 0} />
<Stat label="待生成" value={stats?.shots_ready || 0} />
<Stat label="已生成" value={stats?.shots_generated || 0} />
<Stat label="审核合格" value={stats?.shots_approved || 0} />
<Stat icon={<IconTracks />} label="镜头总数" value={stats?.shots || 0} />
<Stat icon={<IconBolt />} label="待生成" value={stats?.shots_ready || 0} />
<Stat icon={<IconImage />} label="已生成" value={stats?.shots_generated || 0} />
<Stat icon={<IconPass />} label="审核合格" value={stats?.shots_approved || 0} />
</Grid>
<Divider />
<TagGroup>

View File

@ -13,19 +13,19 @@ import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { AudioPlay } from '../../components/media/AudioPlay'
import { MediaThumb } from '../../components/media/MediaThumb'
import { Actions, Block, Button, Check, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FieldBlock, FormRow, Grid, IconText, Input, Layout, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, ProgressBar, SectionTitle, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value, cellWrap } from '../../components/ui'
import { PageHead, ActionGroup, Actions, Button, Check, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FormRow, Row, BarRight, SegmentedTabs, Count, IconText, Info, Input, Layout, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, SectionTitle, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value, Clamp } from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { notify } from '../../stores/notice'
import { IconAim, IconDownload, IconEye, IconPass, IconReject, IconReload, IconRetry, IconWarn } from '../../components/icons'
import { IconAim, IconDownload, IconEye, IconPass, IconReject, IconReload, IconRetry } from '../../components/icons'
const KIND_OPTIONS = [
{ value: '', label: '全部记录' },
{ value: 'auto', label: '仅自动质检' },
{ value: 'manual', label: '仅人工审核' }
]
/** 检查项表固定列宽:右栏只有 ~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%]']
/** 质检结论表列宽(px,0 = 吃剩余宽度):右栏容器 674,定宽列合计 348,长文列拿 ~326 */
const CHECK_COLS = [104, 72, 0, 56, 132]
const VISUAL_COLS = [120, 78, 150, 0]
/** 画面质检(大模型看图):checks 里 key 以 visual. 开头的都是它的结论 */
const isVisual = (c: any) => { const k = String(c?.key || ''); return k.startsWith('visual.') || k === 'visual_error' }
@ -46,6 +46,8 @@ export default function Review() {
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 [verdict, setVerdict] = useState<'pass' | 'fail'>('pass')
const rows: any[] = qc?.shots || []
const byId = useMemo(() => {
@ -54,13 +56,6 @@ export default function Review() {
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)
@ -208,93 +203,95 @@ export default function Review() {
return (
<PageStack>
{/* 质检总览 + 三个批量动作:以前是 Between 悬浮在页面底色上(没有归属的卡片),
现在是「只有卡头的卡」= Toolbar;按钮也不再各写 size(档位由容器下发)。 */}
<Toolbar
info={<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>}
{/* 页头(第 1 条):三个批量动作是这一页的主操作,整页成立 → 进 PageHead。
症状(第 6 条):它们以前和六个只读计数挤在同一张卡头里,
左端是一排会折行的表格、右端是三颗长文案按钮,窄屏先把按钮压成两行。 */}
<PageHead
title="质检与审核"
sub="机器质检给出技术指标与画面判定,人工审核决定放行;驳回会把镜头退回生成环节重做。"
actions={<>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
<Button disabled={!!busy} onClick={qcAll} icon={<IconReload />}>全量重跑质检</Button>
<Button disabled={!!busy} onClick={recheckAll}
title="对所有已生成产物重新质检:技术指标 + 大模型看图判定人物/穿帮/镜头瑕疵" icon={<IconEye />}>整批复检(含画面质检)</Button>
<ActionGroup>
<Button disabled={!!busy} onClick={qcAll} icon={<IconReload />}>全量重跑质检</Button>
<Button disabled={!!busy} onClick={recheckAll}
title="对所有已生成产物重新质检:技术指标 + 大模型看图判定人物/穿帮/镜头瑕疵" icon={<IconEye />}>整批复检(含画面质检)</Button>
</ActionGroup>
<Button type="primary" disabled={!!busy || !approvable.length} onClick={approveAll}
title={busy ? '有任务正在执行,请稍候'
: approvable.length ? `${approvable.length} 个镜头质检通过且待人工审核`
: '没有可放行的镜头:需要「质检通过」且「人工未放行」;若已全部放行,此处会保持置灰'} icon={<IconPass />}>批量放行质检合格镜头</Button>
</>} />
</>}
/>
{/* 六个计数是只读回显:它自己占一条工具条,不再和按钮同排。 */}
<Toolbar
info={<Info className="mb-0" column={{ xs: 2, sm: 3, xxl: 6 }} items={[
{ label: '已质检', value: <Count n={qc?.checked ?? 0} /> },
{ label: '通过', value: <Count n={qc?.passed ?? 0} tone="ok" /> },
{ label: '不合格', value: <Count n={qc?.failed ?? 0} tone="bad" /> },
{ label: '平均分', mono: true, value: qc?.average_score ?? '—' },
{ label: '待人工审核', value: <Count n={approvable.length} tone="warn" /> },
{ label: '被驳回', value: <Count n={rejected.length} tone="bad" /> }
]} />} />
<ErrorText>{error}</ErrorText>
<Layout>
{/* 分栏比例(第 79 改):主信息(预览 + 质检明细 + 审核表单)在右栏,
左栏只是挑镜头的清单,却占了 15/24——右栏实测只有 341px,
视频压成小方块、表单只能挤成双栏。按「主内容在右就让右栏」收到 9:15,
右栏拿到 ~630px(先例:AgentConsole 的检查器也是 9:15)。 */}
<Layout spans={[9, 15]}>
{/* ===== 自动质检清单 ===== */}
<Panel>
<PanelHead
title={<span title="质检项由 QC_THRESHOLD 与镜头目标时长/分辨率决定;不合格项会阻塞时间线,需驳回重做。">自动质检清单</span>}
right={<span className={MUTED}>产物 {generated.length} / 镜头 {shots.length}</span>} />
{/* 六列里三列有固定职责:# 只放序号、状态放两行标签、得分放数字+条。
不给它们显式宽度,antd 的 fixed 布局会把宽度平均分掉,标签被压到断字。 */}
{/* 左栏收成 9/24 之后清单只有 ~360px:六列摆不下,硬留 minWidth=960
等于在窄栏里装了条横向滚动条,读者要横着推才能看到「重跑」。
这一栏的职责是「挑一镜」,不是看结论——序号并进标题、画面/技术分留给右栏明细,
这里只回答三件事:哪一镜、结论如何、要不要重跑(重跑降成图标按钮,R15)。 */}
<Table
maxHeight={520}
minWidth={960}
minWidth={false}
rowKey="shot_id"
dataSource={rows}
onPick={(r: any) => setSelected(r.shot_id)}
chosen={(r: any) => selected === r.shot_id}
empty="项目还没有镜头。"
columns={[
{ title: '#', key: 'order', width: 52, align: 'center', render: (_: any, r: any) => <b>{r.order_index}</b> },
{ title: '镜头', key: 'title', width: 250, render: (_: any, r: any) => (
/* 标题行封顶一行:镜号 + 镜头名在 240px 的列里本来要折两行,
加上第二行的时长/分辨率就是 81px 行高;名字全文交给 title。 */
{ title: '镜头', key: 'title', render: (_: any, r: any) => (
<>
{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>
<Clamp lines={1} title={`${String(r.order_index ?? 0).padStart(2, '0')} ${r.title || ''}`}>
<b className={MONO}>{String(r.order_index ?? 0).padStart(2, '0')}</b> {r.title}
</Clamp>
<div className={MUTED_MONO}>{r.probe?.duration ? `${r.probe.duration.toFixed(2)}s` : '—'} · {r.probe?.width || '?'}×{r.probe?.height || '?'}</div>
</>
) },
{ title: '状态', key: 'status', width: 108, className: 'whitespace-nowrap', render: (_: any, r: any) => {
/* 一格一个结论:已审用人工结论徽标(悬停看审核备注),未审用队列状态;
第二行给总分与问题数,不合格才上语义色,避免整列都在喊。 */
{ title: '结论', key: 'verdict', width: 104, className: 'whitespace-nowrap', render: (_: any, r: any) => {
const shot = byId[r.shot_id]
const mark = reviewBadge(shot)
const n = (r.issues?.length || 0) + (r.warnings?.length || 0)
return <>
<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}
? <Tag tone={(mark?.tone as any) || (r.review_state === 'pass' ? 'ok' : 'bad')} title={shot?.review_notes || ''}>
{mark?.text || (r.review_state === 'pass' ? '人工合格' : '人工不合格')}
</Tag>
: <Status value={r.status} />}
{/* 一行里只留一个颜色类:MUTED_MONO 自带 text-text-quaternary,
再叠 text-error 会被同优先级的后者吃掉,实测不合格行仍然是灰字。 */}
<div className={`${r.score === null ? 'text-text-quaternary' : r.passed ? (n ? 'text-warning' : 'text-text-quaternary') : 'text-error'} mt-1 ${MONO} text-xs`}>
{r.score === null ? '未评分' : `${r.score} 分`}{n ? ` · ${n} 项` : ''}
</div>
</>
} },
/* 得分列固定宽:数字 + 条在一行里各占自己的轨道,
副结论单独一行且不换行——列一窄「画面 35 / 技术 100」会拐成两行压到进度条上。
114px 装不下「画面 100 / 技术 100」这 17 个等宽字符(实测溢出到「问题」列被裁),
所以轨道给到 138px、列宽 150px:宁可让数字列宽一点,也不让两列的文字互相咬。 */
{ title: '得分', key: 'score', width: 150, align: 'right', render: (_: any, r: any) => (
<div className="ml-auto w-[138px]">
<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>
) },
{ title: '问题', key: 'issues', className: cellWrap, render: (_: any, r: any) => (
<>
{!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>)}
</>
) },
{ title: '操作', key: 'actions', width: 92, align: 'right', render: (_: any, r: any) => (
<Button icon={<IconRetry />} size="sm" disabled={!!busy || !byId[r.shot_id]?.output_exists}
onClick={(e) => { e.stopPropagation(); reQc(r.shot_id) }}>重跑</Button>
{ title: '', key: 'actions', width: 34, align: 'right', render: (_: any, r: any) => (
<Button type="text" shape="circle" icon={<IconRetry />} title="只重跑这一镜的质检"
aria-label={`只重跑镜头 ${r.order_index} 的质检`}
disabled={!!busy || !byId[r.shot_id]?.output_exists}
onClick={(e) => { e.stopPropagation(); reQc(r.shot_id) }} />
) }
]}
/>
@ -383,44 +380,64 @@ export default function Review() {
) : null}
<Divider />
<Grid cols={2} oneAt="lg">
<div>
<SectionTitle className="!mt-0"><IconText icon={<IconPass />}>合格</IconText></SectionTitle>
<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 icon={<IconPass />} type="primary" size="sm" disabled={!!busy || !current.output_exists} onClick={approveShot}>标记合格</Button></Actions>
{/* 人工结论(第 79 改,用户截图点的就是这里):原先左右两栏各摆一套表单,
左半填两格就见底、大片空白,右半排五格还断字。合格与不合格本来就是互斥的
一次结论,改成「切一格填一格」:结论用 Segmented 选,字段单列铺满整幅。
判据见 Tabs.tsx——切完看的还是这批数据 → Segmented,不是 Tabs。 */}
<SectionTitle className="!mt-0"><IconText icon={<IconAim />}>人工结论</IconText></SectionTitle>
<SegmentedTabs ariaLabel="审核结论" block value={verdict} onChange={setVerdict} items={[
/* label 只写结论,说明交给 hint:430 档 block 等分后每格只剩 122px 给文字,
「不合格 · 改提示词重做」实测 136px,被 .ant-segmented-item-label 的
overflow:hidden 裁成「不合格 · 改提示…」(visualcheck 控件标签断言)。 */
{ value: 'pass', label: '合格 · 进时间线', hint: '通过后这一镜解锁给时间线' },
{ value: 'fail', label: '不合格 · 驳回重做', hint: '驳回后可覆盖提示词重新入队' }
]} />
{verdict === 'pass' ? (
<div className="mt-3">
{/* 审核人是短字段(128 就够),备注吃剩下的整行:两个字段一行放完,
不再为了一格输入框起一整行。 */}
<div className="flex min-w-0 flex-wrap items-start gap-3">
<Field label="审核人" width="narrow">
<Input value={approve.reviewer} onChange={(e) => setApprove((f) => ({ ...f, reviewer: e.target.value }))} />
</Field>
<Field label="备注" width="grow">
<TextArea rows={2} placeholder="例如:构图与角色一致性合格" value={approve.notes} onChange={(e) => setApprove((f) => ({ ...f, notes: e.target.value }))} />
</Field>
</div>
<Actions><Button icon={<IconPass />} type="primary" disabled={!!busy || !current.output_exists} onClick={approveShot}>标记合格</Button></Actions>
</div>
<div>
<SectionTitle className="!mt-0"><IconText icon={<IconReject />}>不合格(可改提示词重做)</IconText></SectionTitle>
<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 }))} />
) : (
<div className="mt-3">
<div className="flex min-w-0 flex-wrap items-start gap-3">
<Field label="审核人" width="narrow">
<Input value={reject.reviewer} onChange={(e) => setReject((f) => ({ ...f, reviewer: e.target.value }))} />
</Field>
<Field label="问题描述" width="grow" title="写清是哪一类穿帮,返工理由会和镜头一起留痕">
<TextArea rows={2} placeholder="例如:角色发型与原画不一致" value={reject.notes} onChange={(e) => setReject((f) => ({ ...f, notes: e.target.value }))} />
</Field>
</div>
{/* 两段提示词是同一件事的两半,并排各占半行正好对齐;
竖排会把右栏撑成一屏滚不到底。 */}
<FormRow cols={2} className="mt-3">
<Field label="覆盖提示词(可选)" title="留空则沿用原提示词">
<TextArea rows={3} placeholder="留空则沿用原提示词" value={reject.prompt} onChange={(e) => setReject((f) => ({ ...f, prompt: e.target.value }))} />
</Field>
<Field label="覆盖负面提示词(可选)">
<TextArea rows={3} placeholder="留空则沿用原负面提示词" 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 }))} />
{/* 勾选 / 优先级 / 驳回动作一行收尾:驳回是这一支的关键动作,重点色只给它。 */}
<Row className="mt-3">
<Check checked={reject.regenerate} onChange={(v) => setReject((f) => ({ ...f, regenerate: v }))}>立即重新入队生成</Check>
{reject.regenerate
? <Field inline label="任务优先级" width="narrow" title="数字越小越先派发;重做会强制覆盖已有产物,配音任务排在生成之前">
<NumberInput min={0} max={9} value={reject.priority} onChange={(v) => setReject((f) => ({ ...f, priority: v }))} />
</Field>
</FormRow>
: null}
<Actions><Button icon={<IconReject />} size="sm" disabled={!!busy} onClick={rejectShot}>驳回</Button></Actions>
: null}
<BarRight><Button icon={<IconReject />} type="primary" disabled={!!busy} onClick={rejectShot}>驳回</Button></BarRight>
</Row>
</div>
</Grid>
)}
</>
)}
</Panel>
@ -434,33 +451,40 @@ export default function Review() {
<Select ariaLabel="审核记录类型筛选" value={kindFilter} onChange={setKindFilter} options={KIND_OPTIONS} />
</Field>
</Ctlbar>} />
{/* 第 28 轮:这张表最高的一行有 255px(一条质检长说明在 464px 的列里折了 13 行)。
六列定宽共 548,「说明」吃剩下 ~570,长文用 <Clamp> 封顶两行、全文挂 title;
minWidth 一并关掉——留 900 只会在窄屏多出一条横向滚动条,换不来任何可读性。 */}
<Table
maxHeight={320}
minWidth={900}
minWidth={false}
dataSource={reviews}
empty="暂无审核记录。"
columns={[
{ title: '时间', key: 'time', width: 152, align: 'center', className: `${MUTED_MONO} whitespace-nowrap`,
{ title: '时间', key: 'time', width: 132, align: 'center', className: `${MUTED_MONO} whitespace-nowrap`,
render: (_: any, rv: any) => fmtTime(rv.created_at) },
{ title: '类型', key: 'kind', width: 92, align: 'center', render: (_: any, rv: any) => statusLabel(rv.kind) },
{ title: '镜头', key: 'shot', width: 130, className: MONO, render: (_: any, rv: any) => (
{ title: '类型', key: 'kind', width: 80, align: 'center', render: (_: any, rv: any) => statusLabel(rv.kind) },
{ title: '镜头', key: 'shot', width: 100, className: MONO, render: (_: any, rv: any) => (
<>{byId[rv.shot_id] ? `镜头 ${String(byId[rv.shot_id].order_index).padStart(2, '0')}` : '未知'}
<div className={MUTED}>shot#{rv.shot_id}</div>
</>
) },
{ title: '结论', key: 'verdict', width: 96, align: 'center', render: (_: any, rv: any) => (
{ title: '结论', key: 'verdict', width: 84, align: 'center', render: (_: any, rv: any) => (
<Tag tone={rv.verdict === 'pass' ? 'ok' : 'bad'}>{rv.verdict === 'pass' ? '合格' : '不合格'}</Tag>
) },
{ title: '得分', key: 'score', width: 76, align: 'right', className: MONO, render: (_: any, rv: any) => (rv.score ?? '—') },
{ title: '审核人', key: 'reviewer', width: 108, className: MUTED, render: (_: any, rv: any) => rv.reviewer },
{ title: '说明', key: 'notes', className: cellWrap, render: (_: any, rv: any) => (
<>
{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}
</>
) }
{ title: '得分', key: 'score', width: 60, align: 'right', className: MONO, render: (_: any, rv: any) => (rv.score ?? '—') },
{ title: '审核人', key: 'reviewer', width: 92, className: `${MUTED} whitespace-nowrap`, render: (_: any, rv: any) => rv.reviewer },
{ title: '说明', key: 'notes', render: (_: any, rv: any) => {
const fails = rv.checks?.checks
? rv.checks.checks.filter((c: any) => !c.passed).map((c: any) => c.label).join('、') || '全部达标'
: ''
const note = rv.notes || ''
return (
<Clamp title={[note, fails ? `检查:${fails}` : ''].filter(Boolean).join(' ') || '无补充说明'}>
{note || '—'}
{fails ? <span className={MUTED_MONO}> 检查:{fails}</span> : null}
</Clamp>
)
} }
]}
/>
</Panel>
@ -473,56 +497,71 @@ function VisualQc({ probe, checks, frames, frameItems, note }: {
probe: any; checks: any[]; frames: string[]; frameItems: any[]; note: string
}) {
return (
<Block tone="info" vertical gap={0} className="mb-1">
<SectionTitle className="!mt-0" action={<span className={MUTED}>{probe.visual_frames ? `${probe.visual_frames.length} 张判定帧` : ''}</span>}>
<IconText icon={<IconEye />}>画面质检(大模型看图)</IconText>
</SectionTitle>
{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}
<div className="mb-1">
{/* 原来是「一段标题 + 三段散排正文」,读起来像公告栏;质检产出本来就是
「模型说了什么 + 看了哪几帧」,一张回显表一次读完(R16.3)。 */}
<Info className="nex-info-in-card" column={1}
title={<IconText icon={<IconEye />}>画面质检(大模型看图)</IconText>}
extra={probe.visual_frames ? `${probe.visual_frames.length} 张判定帧` : undefined}
items={[
!!probe.visual_summary && { label: '结论摘要', value: probe.visual_summary },
frames.length > 0 && {
label: '判定帧',
value: <div className="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>
},
]} />
{note ? <LineHint className="mt-2">{note}</LineHint> : null}
{checks.length
? <div className="mt-2">
<CheckTable items={checks} cols={VISUAL_COLS} visual />
</div>
: null}
</Block>
</div>
)
}
/** 质检结论表:窄栏里必须固定布局 + 百分比列宽,否则「标准」列被挤出容器;长串实测值要允许折行 */
function CheckTable({ items, cols, visual }: { items: any[]; cols: string[]; visual?: boolean }) {
/**
* 质检结论表(第 28 轮改,用户点的就是「表格行被内容撑高」)
* 症状 两张结论表在 674px 的右栏里按百分比均分(每列 169 / 135),
* 一句「镜头存在严重的配饰串装(手表)与特征丢失(眼镜)」折成 4 行,
* 行高 92px,210px 的可视区里只塞得下 3 条结论。
* 做法 列宽按内容定额:结论、权重这种短列收到 72 / 56,长文列吃剩下的 ~326px,
* 并且长文案一律套 <Clamp> 封顶两行、悬停看全文;minWidth 关掉,
* 定宽列合计 348 < 容器 674,横向滚动自然归零。
* 为什么 百分比列宽在窄栏里等于「谁的话长谁说话」——四列均分只会把每一列都折成多行,
* 而行高只取决于最长的那一列。窄栏更要用固定像素把短列钉住。
*/
function CheckTable({ items, cols, visual }: { items: any[]; cols: number[]; visual?: boolean }) {
const heads = visual ? ['画面问题', '结论', '位置', '说明'] : ['检查项', '结论', '实测', '权重', '标准']
const nowrap = visual ? 'whitespace-normal' : 'whitespace-nowrap'
/** 0 = 这一列不设宽度,吃掉容器剩余空间(antd 固定布局下的「长文列」写法) */
const w = (n: number) => n || undefined
return (
<Table
maxHeight={visual ? 210 : 230}
minWidth={0}
minWidth={false}
rowKey="key"
dataSource={items}
columns={[
{ title: heads[0], key: 'label', width: cols[0], className: nowrap,
render: (_: any, c: any) => (visual ? visualShortLabel(c) : c.label) },
{ title: heads[1], key: 'verdict', width: cols[1], align: 'center', render: (_: any, c: any) => (
{ title: heads[0], key: 'label', width: w(cols[0]),
render: (_: any, c: any) => <Clamp lines={1} title={c.label}>{visual ? visualShortLabel(c) : c.label}</Clamp> },
{ title: heads[1], key: 'verdict', width: w(cols[1]), align: 'center', render: (_: any, c: any) => (
<Tag tone={(visual ? visualTone(c) : c.passed ? 'ok' : c.severity === 'warning' ? 'warn' : 'bad') as any}>
{visual ? visualVerdict(c) : c.passed ? '合格' : c.severity === 'warning' ? '提醒' : '不合格'}
</Tag>
) },
{ title: heads[2], key: 'value', width: cols[2], className: `${MONO} whitespace-normal break-words`,
render: (_: any, c: any) => c.value },
...(visual ? [] : [{ title: heads[3], key: 'weight', width: cols[3], align: 'right' as const, className: MONO,
{ title: heads[2], key: 'value', width: w(cols[2]), className: MONO,
render: (_: any, c: any) => <Clamp title={String(c.value ?? '')}>{c.value}</Clamp> },
...(visual ? [] : [{ title: heads[3], key: 'weight', width: w(cols[3]), align: 'right' as const, className: MONO,
render: (_: any, c: any) => c.weight }]),
{ title: heads[heads.length - 1], key: 'detail', width: cols[cols.length - 1],
className: `${cellWrap} ${MUTED} break-words`, render: (_: any, c: any) => c.detail }
{ title: heads[heads.length - 1], key: 'detail', width: w(cols[cols.length - 1]), className: MUTED,
render: (_: any, c: any) => <Clamp title={c.detail}>{c.detail}</Clamp> }
]}
/>
)

View File

@ -24,13 +24,13 @@ import {
capsOf, defaultFor, findByPair, loadModels, modelsOf, parseRef, projectVideoModel, useModelsStore
} from '../../stores/models'
import { refresh, useBriefStore, useProjectStore } from '../../stores/project'
import { refresh, useProjectStore } from '../../stores/project'
import { options, useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { openPreview, usePreviewOpen } from '../../stores/preview'
import { ActionGroup, Actions, BarRight, Between, BLOCK_TONE, Button, CARD_ROW, Check, Checkbox, Chip, ChipBar, CloseButton, Ctlbar, DRAWER_ACTIONS, DRAWER_BODY, DRAWER_HEAD, DRAWER_TITLE, Divider, Empty, ErrorText, ExportMenu, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LINK_CLS, LinkButton, Loading, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, PageStack, Panel, PanelHead, Row, Scrim, SearchInput, SectionTitle, Spinner, Status, TAG_DENSE, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, ViewSwitch, cellWrap, type Columns } from '../../components/ui'
import { PageHead, ActionGroup, Actions, BarRight, Between, BLOCK_TONE, Button, CARD_ROW, Check, Checkbox, Chip, ChipBar, CloseButton, Ctlbar, DRAWER_ACTIONS, DRAWER_BODY, DRAWER_HEAD, DRAWER_TITLE, Divider, Empty, ErrorText, ExportMenu, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LINK_CLS, LinkButton, Loading, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, PageStack, Panel, PanelHead, Row, Scrim, SearchInput, SectionTitle, Spinner, Status, TAG_DENSE, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, ViewSwitch, cellWrap, type Columns } from '../../components/ui'
import { floatingLayerOpen } from '../../lib/layers'
import { IconAdd, IconArrowDown, IconArrowUp, IconAudit, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconCompose, IconCopy, IconDelete, IconDownload, IconDragHandle, IconEdit, IconEye, IconGrid, IconImage, IconListOrdered, IconMic, IconParams, IconPlayCircle, IconReload, IconRetry, IconSearch, IconSound, IconToTop, IconUpload, IconVideo, IconWarn } from '../../components/icons'
import { IconAdd, IconArrowDown, IconArrowUp, IconAudit, IconCheck, IconChevronUp, IconClose, IconCompose, IconCopy, IconDelete, IconDownload, IconDragHandle, IconEdit, IconEye, IconGrid, IconImage, IconListOrdered, IconMic, IconParams, IconPlayCircle, IconReload, IconRetry, IconSearch, IconSound, IconToTop, IconUpload, IconVideo, IconWarn } from '../../components/icons'
type ViewMode = 'grid' | 'table'
type InspectorTab = 'shot' | 'assets' | 'prompt' | 'output'
@ -263,8 +263,6 @@ export default function Storyboard() {
const meta = useSystemStore((s) => s.meta)
const registryRows = useModelsStore((s) => s.rows)
const registryError = useModelsStore((s) => s.error)
const briefOpen = useBriefStore((s) => s.open)
const setBriefOpen = useBriefStore((s) => s.set)
const previewIsOpen = usePreviewOpen()
const [params, setParams] = useSearchParams()
@ -1086,39 +1084,35 @@ export default function Storyboard() {
Stat variant="inline":卡片头是 antd 的,这一条却不是,圆角、内边距、
分隔线全都自己定,于是它是全站唯一「像卡皮、但不是卡」的横条。
现在它就是 <Toolbar>(只有卡头的 Card),指标改成一行摘要文字。 */}
{/* 页头(第 1 条):「导入」和「新建」是同一件事的两种入口(都是往工作台里加镜头),
永远并排,整页成立 → 进 PageHead,不再混在吸顶工具条的视图切换旁边。 */}
<PageHead
title="分镜与脚本"
sub="逐镜维护脚本、关键帧与提示词。看板适合逐镜对照画面,分镜表适合一屏看更多、批量改参数。"
actions={<>
<Button type="primary" onClick={() => { setShowImport(!showImport); setCreating(false) }}
icon={<IconUpload />}>
导入脚本 / 关键帧
</Button>
<Button type="dashed" onClick={startCreate} icon={<IconAdd />}>新增镜头</Button>
</>}
/>
{/* 吸顶工具条只剩「这一页现在是什么规模 + 用哪种版式看」。
概况折叠归外壳(面包屑那一行已有同一颗按钮,共用 useBriefStore,不再重复一颗)。 */}
<Toolbar
sticky
info={<>
<Tag tone="default">分镜工作台</Tag>
<Value>共 {shots.length} 镜 · 计划 {plannedDuration.toFixed(1)}s · 已合格 {approvedCount} 镜{issueCount ? ` · 有阻塞 ${issueCount} 镜` : ''}</Value>
</>}
actions={<>
{/* 「导入」和「新建」是同一件事的两种入口,永远并排;视图切换与概况折叠
是另一件事(看版式),各成一组,整组一起换行,不再互相挤到半行 */}
<ActionGroup>
<Button type="primary" onClick={() => { setShowImport(!showImport); setCreating(false) }}
icon={<IconUpload />}>
导入脚本 / 关键帧
</Button>
<Button type="dashed" onClick={startCreate} icon={<IconAdd />}>新增镜头</Button>
</ActionGroup>
<ActionGroup>
<ViewSwitch value={view} onChange={setView} label="切换分镜视图"
items={[{ value: 'grid', label: <><IconGrid />看板</>,
hint: '网格看板:缩略图 + 脚本要点,逐镜对照最舒服' },
{ value: 'table', label: <><IconListOrdered />分镜表</>,
hint: '分镜表:一屏看更多镜,便于批量勾选与改参数' }]} />
<Button aria-expanded={briefOpen} onClick={() => setBriefOpen(!briefOpen)}
title={briefOpen ? '收起上方项目概况,把屏幕让给分镜' : '展开项目概况'}
icon={briefOpen ? <IconChevronUp /> : <IconChevronDown />}>
{briefOpen ? '收起概况' : '展开概况'}
</Button>
</ActionGroup>
</>} />
info={<Value>共 {shots.length} 镜 · 计划 {plannedDuration.toFixed(1)}s · 已合格 {approvedCount} 镜{issueCount ? ` · 有阻塞 ${issueCount} 镜` : ''}</Value>}
actions={<ViewSwitch value={view} onChange={setView} label="切换分镜视图"
items={[{ value: 'grid', label: <><IconGrid />看板</>,
hint: '网格看板:缩略图 + 脚本要点,逐镜对照最舒服' },
{ value: 'table', label: <><IconListOrdered />分镜表</>,
hint: '分镜表:一屏看更多镜,便于批量勾选与改参数' }]} />} />
{/* ===== 筛选 / 导出 ===== */}
<Panel>
<Ctlbar className="!mb-0">
{/* 4 个筛选字段铺 4 等分:搜索占一格,控件右边缘与同排对齐(R7 栅格条) */}
<Ctlbar className="!mb-0" cols={4}>
<Field inline label="搜索" width="grow">
<SearchInput value={keyword} onChange={(e) => setKeyword(e.target.value)} aria-label="搜索分镜" placeholder="镜号 / 标题 / 画面 / 台词 / 角色 / 场景…" />
</Field>
@ -1164,7 +1158,8 @@ export default function Storyboard() {
<Button icon={<IconClose />} size="sm" onClick={clearCheck}>取消选择</Button>
</>} />
{bulk.open ? (
<Ctlbar className="mt-4 !mb-0 border-t border-dashed border-border-secondary pt-4">
/* 批量改字段:4 个字段 + 1 颗应用按钮=5 等分一行放完(三元分支里不能放 JSX 注释) */
<Ctlbar className="mt-4 !mb-0 border-t border-dashed border-border-secondary pt-4" cols={5}>
<Field inline label="生成模式">
<Select value={bulk.fields.mode} placeholder="不改"
onChange={(next) => setBulk((prev) => ({ ...prev, fields: { ...prev.fields, mode: next } }))}
@ -1640,10 +1635,14 @@ export default function Storyboard() {
会把这一整块 md 档表单控件降成 24,和同一抽屉里其它字段差一档(R3)。 */}
<div className={cn('min-w-0 rounded-lg border p-3 flex flex-col gap-3', BLOCK_TONE.info)}>
<Between>
<b className="text-sm text-primary-hover">AI 生成关键帧</b>
<Tag tone={keyframeModel?.available ? 'ok' : 'warn'}>
{keyframeModel ? `${keyframeModel.provider}/${keyframeModel.model}` : '无可用图像模型'}
</Tag>
<b className="text-sm text-primary-hover">AI 生成关键帧</b>
{/* 模型与输出尺寸都是只读回显,收到卡头一行:抽屉里少一个「填不了的输入框」 */}
<TagGroup size="sm" className="!mb-0">
<Tag tone={keyframeModel?.available ? 'ok' : 'warn'}>
{keyframeModel ? `${keyframeModel.provider}/${keyframeModel.model}` : '无可用图像模型'}
</Tag>
<Tag>输出 {keyframeGen.width} × {keyframeGen.height}</Tag>
</TagGroup>
</Between>
<FormRow>
<Field label="图像模型">
@ -1655,9 +1654,6 @@ export default function Storyboard() {
label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}`
}))} />
</Field>
<Field label="生成尺寸">
<Input readOnly value={`${keyframeGen.width} × ${keyframeGen.height}`} />
</Field>
</FormRow>
<FieldBlock label="关键帧提示词">
<TextArea rows={5} spellCheck={false} value={keyframeGen.prompt} placeholder="描述这一镜的最终画面、机位、人物动作、光线与场景" onChange={(e) => setKeyframeGen((prev) => ({ ...prev, prompt: e.target.value }))} />

View File

@ -16,7 +16,7 @@ import { refresh, useProjectStore } from '../../stores/project'
import { useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { openPreview } from '../../stores/preview'
import { ActionGroup, Actions, Button, Check, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, IconText, Input, IssueRow, Layout, LineHint, MONO, MUTED, MUTED_MONO, MaybeNumberInput, Mono, NumberInput, PageStack, Panel, PanelHead, Row, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value } from '../../components/ui'
import { PageHead, ActionGroup, Actions, Button, Check, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Count, IconText, Input, IssueRow, Layout, LineHint, MONO, MUTED, MUTED_MONO, MaybeNumberInput, Mono, NumberInput, OptionGrid, PageStack, Panel, PanelHead, Row, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value } from '../../components/ui'
import { IconAdd, IconArrowDown, IconArrowUp, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEdit, IconEye, IconMic, IconPass, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
/**
@ -411,6 +411,37 @@ export default function Timeline() {
{/* 时间线总览 + 版本切换:以前是 Between 裸排在页面底色上
(名字 <b>、TagGroup、SectionTitle 当标签用、两颗按钮,四种高度挤一排)。
现在它是「只有卡头的卡」:名字进卡头标题、计数进 sub、版本操作进 extra。 */}
{/* 页头(第 1 条):时间线版本是这一页的全局对象——下拉选中哪一版,
「设为当前 / 删除」就作用于哪一版,三件必须同排,所以整组提进 PageHead。 */}
<PageHead
title="时间线合成"
sub="把有产物的镜头按镜序编排版本,逐段核对画面、配音与字幕,再交给导出。"
actions={<>
<ActionGroup>
<Select ariaLabel="选择时间线版本" className="w-[210px] shrink-0"
value={viewVersion ?? ''}
onChange={(next: any) => {
const id = next === '' || next === null || next === undefined ? null : Number(next)
showVersion(id)
void load(false, id)
}}
options={versionOptions} />
<Button disabled={!!busy || !viewVersion} onClick={activateVersion}
title={viewVersion ? '把下拉中选中的版本设为当前生效版本' : '先在左侧下拉中选择一个历史版本'}
icon={<IconStar />}>
设为当前
</Button>
<Button type="text" danger disabled={!!busy || !viewVersion || versions.length < 2} onClick={removeVersion}
title={versions.length < 2 ? '至少保留一个时间线版本' : '删除选中的版本(仅删编排记录,不动成片)'}
icon={<IconDelete />}>
删除版本
</Button>
</ActionGroup>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
</>}
/>
{/* 当前这一版时间线是什么:名称进卡头标题,计数进 sub(第 8 条:不写项目信息)。 */}
<Toolbar
info={timeline ? timeline.name : '尚未构建时间线'}
sub={timeline
@ -424,31 +455,7 @@ export default function Timeline() {
{report && <Tag tone={report.ready ? 'ok' : 'bad'}>{report.ready ? '可导出' : '有阻塞'}</Tag>}
<Tag>共 {versions.length} 个版本</Tag>
</TagGroup>
: <Value>先在左侧「构建时间线」生成第一个版本</Value>}
actions={<>
{/* 下拉选中哪一版 → 对这版「设为当前 / 删除」:三件必须同排,否则按钮指向不明 */}
<ActionGroup>
<Select ariaLabel="选择时间线版本" className="w-[210px] shrink-0"
value={viewVersion ?? ''}
onChange={(next: any) => {
const id = next === '' || next === null || next === undefined ? null : Number(next)
showVersion(id)
void load(false, id)
}}
options={versionOptions} />
<Button disabled={!!busy || !viewVersion} onClick={activateVersion}
title={viewVersion ? '把下拉中选中的版本设为当前生效版本' : '先在左侧下拉中选择一个历史版本'}
icon={<IconStar />}>
设为当前
</Button>
<Button type="text" danger disabled={!!busy || !viewVersion || versions.length < 2} onClick={removeVersion}
title={versions.length < 2 ? '至少保留一个时间线版本' : '删除选中的版本(仅删编排记录,不动成片)'}
icon={<IconDelete />}>
删除版本
</Button>
</ActionGroup>
{busy ? <Value><Spinner /> {busy}…</Value> : null}
</>} />
: <Value>先在「构建时间线」生成第一个版本</Value>} />
<ErrorText className="mb-3">{error}</ErrorText>
{/* ===== 构建 / 报告 ===== */}
@ -467,15 +474,19 @@ export default function Timeline() {
{/* 计数是这颗按钮的口径说明,两者必须同一行;两颗主按钮也并进来,
原来「计数一行 / 按钮一行」把半张卡留白。 */}
<Ctlbar>
<Tag>有产物镜头 {buildable.length}</Tag>
<Tag>已审核合格 {stats?.shots_approved ?? 0}</Tag>
<Button icon={<IconCheck />} onClick={selectAllBuildable}>
{build.shot_ids.length === buildable.length ? '清空指定' : '指定全部镜头'}
</Button>
<Button type="primary" disabled={!!busy || !buildable.length} onClick={buildTimeline} icon={<IconTracks />}>构建 / 重建时间线</Button>
<Button disabled={!!busy || !missingVoice.length} onClick={makeVoiceover} icon={<IconSound />}>
补齐缺失配音({missingVoice.length})
</Button>
{/* 这两个数只是「构建按钮的口径说明」,不能点,就不该穿 chip 的胶囊皮;
和右侧按钮同排时用一句 Value 把它们连读,非零才上色。 */}
<Value>有产物镜头 <Count n={buildable.length} unit="个" /> · 已审核合格 <Count n={stats?.shots_approved ?? 0} tone="ok" unit="个" /></Value>
{/* 三颗按钮是同一个动作组:整组一起换行,别出现「两颗在这行、第三颗掉下行」 */}
<ActionGroup>
<Button icon={<IconCheck />} onClick={selectAllBuildable}>
{build.shot_ids.length === buildable.length ? '清空指定' : '指定全部镜头'}
</Button>
<Button type="primary" disabled={!!busy || !buildable.length} onClick={buildTimeline} icon={<IconTracks />}>构建 / 重建时间线</Button>
<Button disabled={!!busy || !missingVoice.length} onClick={makeVoiceover} icon={<IconSound />}>
补齐缺失配音({missingVoice.length})
</Button>
</ActionGroup>
</Ctlbar>
<ChipBar>
{buildable.map((s: any) => (
@ -569,7 +580,9 @@ export default function Timeline() {
</div>
))}
<Divider />
<FormRow>
{/* 四个字段一行放完:默认三列会把「结束 ms」单独甩到第二行,
起始 / 结束必须并排才看得出是一条区间。 */}
<FormRow cols={4}>
<Field label="所属镜头">
<Select ariaLabel="字幕所属镜头" value={cue.shot_id} onChange={(v: any) => patchCue({ shot_id: v ?? '' })}
options={[{ value: '', label: '(全局字幕)' }, ...shotOptions]} />
@ -722,16 +735,25 @@ export default function Timeline() {
<Check checked={audio.loop} onChange={(v) => patchAudio({ loop: v })} className="self-center">循环铺满</Check>
<Check checked={audio.ducking} onChange={(v) => patchAudio({ ducking: v })} className="self-center">压低 BGM</Check>
</FormRow>
{/* 「上传新文件」与「引用已有素材」是两条选择路径,各占一行;
已有素材是**从固定集合里挑一个**,走 OptionGrid 等宽格子(实测 13 个胶囊
自然排列时宽 84–158、折 2~3 行且每行起点随文案漂移)。 */}
<Row tight>
<FilePick icon={<IconMic />} label="选择音频文件" accept="audio/*"
onFiles={(files) => patchAudio({ file: files[0] ?? null })} />
{audio.file
? <Tag tone="accent" title="已选本地文件,点「开始替换」生效">{audio.file.name}</Tag>
: <span className={MUTED}>或直接引用已有素材:</span>}
{audioAssets.map((a: any) => (
<Chip key={a.id} active={audio.source_path === a.path} onClick={() => useAsset(a.path)}>{a.name}</Chip>
))}
{audio.file && (
<Tag tone="accent" title="已选本地文件,点「开始替换」生效">{audio.file.name}</Tag>
)}
</Row>
{!!audioAssets.length && (
<OptionGrid cols={4} label="或直接引用已有素材" hint="点一下填进下方路径"
className="mt-2">
{audioAssets.map((a: any) => (
<Chip key={a.id} active={audio.source_path === a.path}
onClick={() => useAsset(a.path)}>{a.name}</Chip>
))}
</OptionGrid>
)}
<FormRow className="mt-3">
<Field label="素材路径(可留空,或直接点上方已有素材)">
<Input value={audio.source_path} placeholder="media 相对路径,如 5/bgm/timeline-bgm_xxx.mp3" onChange={(e) => patchAudio({ source_path: e.target.value })} />
@ -759,12 +781,23 @@ export default function Timeline() {
render: (_: any, v: any) => fmtMs(v.total_duration_ms) },
{ title: '状态', key: 'state', width: 104, align: 'center', render: (_: any, v: any) =>
<Tag tone={v.is_current ? 'accent' : 'default'}>{v.is_current ? '当前生效' : '历史版本'}</Tag> },
{ title: '更新时间', key: 'updated', width: 156, className: MUTED_MONO, render: (_: any, v: any) => fmtTime(v.updated_at) },
{ title: '操作', key: 'actions', width: 220, align: 'right', render: (_: any, v: any) => (
{ title: '更新时间', key: 'updated', width: 140, className: `${MUTED_MONO} whitespace-nowrap`,
render: (_: any, v: any) => fmtTime(v.updated_at) },
/* 三颗动作收成图标按钮(R15):「查看 / 设为当前 / 删除」三枚带字按钮要 262px,
220 的列放不下就折成两排,整行被顶到 79px。图标 + title + aria-label 之后按
「3 颗 circle 按钮 3×32 + 2×6 间距 = 108,再加 antd small 单元格左右 16 内边距」
留 128px,一行放完,行高回到 48。名称列不设宽度,吃掉剩下的宽度。 */
{ title: '操作', key: 'actions', width: 128, align: 'right', render: (_: any, v: any) => (
<Row tight className="justify-end">
<Button icon={<IconEye />} type="text" size="sm" onClick={() => { showVersion(v.id); void load(false, v.id) }}>查看</Button>
<Button icon={<IconCheck />} type="text" size="sm" disabled={!!busy || v.is_current} onClick={() => activateOne(v)}>设为当前</Button>
<Button icon={<IconDelete />} type="text" danger disabled={!!busy || versions.length < 2} onClick={() => removeOne(v)}>删除</Button>
<Button type="text" shape="circle" icon={<IconEye />} title="查看这一版的时间线"
aria-label={`查看 v${v.version}`}
onClick={() => { showVersion(v.id); void load(false, v.id) }} />
<Button type="text" shape="circle" icon={<IconCheck />} title="设为当前生效版本"
aria-label={`将 v${v.version} 设为当前版本`}
disabled={!!busy || v.is_current} onClick={() => activateOne(v)} />
<Button type="text" shape="circle" danger icon={<IconDelete />} title="删除这一版"
aria-label={`删除 v${v.version}`}
disabled={!!busy || versions.length < 2} onClick={() => removeOne(v)} />
</Row>
) }
]}