From ad4cdcb52ba6e258ed5f794c41ae53a6a8acceef Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Tue, 3 Nov 2026 20:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AB=E4=B8=AA=E9=A1=B9=E7=9B=AE=E5=AD=90?= =?UTF-8?q?=E9=A1=B5=E9=80=90=E9=A1=B5=E6=94=B9=E5=AE=8C=EF=BC=9A=E4=B8=BB?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8F=90=E8=BF=9B=E9=A1=B5=E5=A4=B4=E3=80=81?= =?UTF-8?q?=E5=8F=AA=E8=AF=BB=E8=AE=A1=E6=95=B0=E6=94=B9=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E5=9D=97=E3=80=81=E8=A1=A8=E6=A0=BC=E8=A1=8C=E9=AB=98=E6=8C=89?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=AE=9A=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 症状(用户第 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。 --- frontend/src/pages/project/AgentConsole.tsx | 2 +- frontend/src/pages/project/Delivery.tsx | 122 +++++--- frontend/src/pages/project/Dispatch.tsx | 210 ++++++++----- frontend/src/pages/project/Library.tsx | 182 +++++------ frontend/src/pages/project/Overview.tsx | 108 ++++--- frontend/src/pages/project/Review.tsx | 331 +++++++++++--------- frontend/src/pages/project/Storyboard.tsx | 78 +++-- frontend/src/pages/project/Timeline.tsx | 127 +++++--- 8 files changed, 647 insertions(+), 513 deletions(-) diff --git a/frontend/src/pages/project/AgentConsole.tsx b/frontend/src/pages/project/AgentConsole.tsx index 1186783..d3c12ae 100644 --- a/frontend/src/pages/project/AgentConsole.tsx +++ b/frontend/src/pages/project/AgentConsole.tsx @@ -747,7 +747,7 @@ export default function AgentConsole() { tone={STEP_TONE[stepItem.status] || 'default'} className={cn(stepItem.status === 'skipped' && 'opacity-68')}>
{stepItem.status === 'succeeded' ? diff --git a/frontend/src/pages/project/Delivery.tsx b/frontend/src/pages/project/Delivery.tsx index 10cc519..432f92a 100644 --- a/frontend/src/pages/project/Delivery.tsx +++ b/frontend/src/pages/project/Delivery.tsx @@ -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 = { draft_720p: '1280×720 · CRF28 · veryfast(试片最快)', @@ -169,17 +169,42 @@ export default function Delivery() { return ( -
- {/* 这四个数不能点,是回显:按规范 §2.0 走标签族,不借可点 chip 的皮肤 */} - - 成片 {succeeded.length} / {exportList.length} - 累计成本 {fmtMoney(costs?.total_cost, currency)} - 生成 {costs?.generations?.count ?? 0} 次 / {(costs?.generations?.seconds ?? 0).toFixed(1)}s - 待结算预估 {fmtMoney(costs?.estimated_pending, currency)} - {report && {report.ready ? '时间线可导出' : '时间线有阻塞'}} - - {busy && <> {busy}…} -
+ {/* 页头(第 1 条):出片是这一页唯一整页成立的主操作,从「合成导出」的表末尾提到页头; + 面板里只剩预设与参数,勾选完直接在最上方按同一颗按钮。 */} + + {busy ? {busy}… : null} + + 先检查时间线 + + + } + /> + + {/* 这四个数不能点,是回显:按 §13.1 走 Info(label 上底纹),不借可点 chip 的皮肤; + 交付预检也收进同一块,结论用重点色文字而不是描边 Tag。 + 第 80 改:整块套进 ——它原先裸浮在两张卡之间的页面底色上, + 像一条没装框的表格,和质检页同一条统计带不同容器;进度态改走工具条右端。 */} + {busy}… : undefined} + info={时间线可导出 + : 时间线有阻塞 + } + ]} />} /> {error} {blockingIssues.length > 0 && ( @@ -194,13 +219,14 @@ export default function Delivery() { - + {presetList.map((p) => ( togglePreset(p)}> {presetLabel[p] || p} ))} - + @@ -222,14 +248,10 @@ export default function Delivery() { - - - 先检查时间线 - + {/* 主操作已提到页头;表单末尾留一句口径,避免「按了没反应」的错觉 */} + {form.presets.length + ? `已选 ${form.presets.length} 个预设,点页面右上角「开始合成导出」依次入队。` + : '至少选择一个出片预设后才能入队合成。'} {burnBlocked && ( }>本机 ffmpeg 缺 libass(无 subtitles/ass 滤镜),烧录模式会自动降级为内嵌软字幕轨; @@ -241,8 +263,8 @@ export default function Delivery() { {costs?.records ?? 0} 条计费记录} /> - - + } label="已发生成本" value={fmtMoney(costs?.total_cost, currency)} /> + } label="待生成预估" value={fmtMoney(costs?.estimated_pending, currency)} /> 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 (
- {rec.name} -
{rec.preset} · timeline#{rec.timeline_id} · task#{rec.task_id || '—'}
- {rec.error_message && {rec.error_message}} + {rec.name} + {meta} + {rec.error_message && {rec.error_message}}
) } }, - { title: '状态', key: 'status', width: 120, render: (_: any, rec: any) => ( + { title: '状态', key: 'status', width: 104, render: (_: any, rec: any) => ( <> {rec.subtitle_burned &&
已烧字幕
} ) }, - { 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) => ( {(rec.checksum || '').slice(0, 10) || '—'} @@ -351,13 +377,23 @@ export default function Delivery() { <>shot#{g.shot_id || '—'}
{statusLabel(g.kind)}
) }, { 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 &&
{JSON.stringify(g.params).slice(0, 120)}
} - {g.asset_paths?.length ?
参考素材 {g.asset_paths.length} 个 · job {g.provider_job_id || '—'}
: null} - - ) }, + /* 第 28 轮:一条 130 字的提示词加两行元信息在 398px 的列里折成 7 行(行高 227)。 + 提示词正文交给 封顶两行、原文挂 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 ( + <> + {prompt} + {params || refs + ?
{params || refs}
+ : 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 }, diff --git a/frontend/src/pages/project/Dispatch.tsx b/frontend/src/pages/project/Dispatch.tsx index e742d3b..32f0559 100644 --- a/frontend/src/pages/project/Dispatch.tsx +++ b/frontend/src/pages/project/Dispatch.tsx @@ -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 ( + {/* 页头(第 1 条):入队是这一页唯一整页成立的主操作,从「分镜任务清单」的卡头里提出来。 + 卡头只留「预计成本 · 共 N 行」这句清单自身的口径。 */} + }>入队所选 / 全部待生成} + /> + {/* 队列总览:一排 Tag 悬浮在页面底色上时,它和下面的卡片没有任何归属关系 (截图上就是「这行字是页面上的脏东西」)。它是一块只有卡头的卡 = 。 只读计数仍走 Tag,不借 Chip 的胶囊皮肤(规范 §2.0)。 */} @@ -215,28 +223,35 @@ export default function Dispatch() { 预计成本 {fmtMoney(plan?.estimated_cost, plan?.currency)} · 共 {planRows.length} 行} - right={} /> - {/* 八颗只读计数在 378px 的侧栏卡里自然排列会折成 7+1(尾行孤一颗)。 - 它们是同一组「清单有多少」的对账单,用两列栅格对齐成表,不靠 flex 顺拐。 */} - - 待入队 {enqueueable.length} - 配音待生成 {voiceoverable.length} - 已排队 {plan?.queued_count || 0} - 阻塞 {plan?.blocked_count || 0} - 跳过 {plan?.skipped_count || 0} - 预检就绪 {plan?.preflight?.ready || 0} - 预检告警 {plan?.preflight?.warnings || 0} - 预计 {plan?.voiceover_count || 0} 条配音 - + sub={<>预计成本 {fmtMoney(plan?.estimated_cost, plan?.currency)} · 共 {planRows.length} 行} /> + {/* 八颗只读计数原先是无底纹的灰胶囊:统计块没有底纹就没有「块」的边界, + 在 378px 侧栏里还折成 7+1 的孤尾行。改成回显表:标签列由 antd 上 colorFillAlter + 底纹,对账单式对齐;数值等宽、只有非零才上色,0 降成次要色不占注意力。 + 列数跟着屏宽走(窄屏 2 列、桌面 4 列):写死 column={2} 时八颗计数要排四行, + 这块回显比下面的任务清单还高,主客颠倒。 */} + }, + { label: '已排队', value: }, + { label: '待配音', value: }, + { label: '预计配音', value: }, + { label: '预检就绪', value: }, + { label: '预检告警', value: }, + { label: '阻塞', value: }, + { label: '跳过', value: }, + ]} />
( + { title: '#', key: 'pick', width: 40, align: 'center', render: (_: any, row: any) => ( row._row === 'shot' ? toggleShot(row.shot_id)} /> : ) }, - { title: '镜头', key: 'shot', width: 220, render: (_: any, row: any) => ( - <> - #{row.order_index} {row._row === 'shot' ? row.title : '配音'} -
shot#{row.shot_id}
- - ) }, - { 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 <> + #{row.order_index} {who} + {meta} + + } }, + { title: '动作', key: 'action', width: 84, render: (_: any, row: any) => ( row._row === 'shot' ? {actionLabel(row.action)} : {row.action !== 'skip' ? '待配音' : '跳过'} ) }, - { 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 ? 阻塞:{row.blocking.join(';')} : null} - - ) } + { title: '说明', key: 'reason', className: MUTED, render: (_: any, row: any) => { + const blocking = row.blocking?.length ? `阻塞:${row.blocking.join(';')}` : '' + return + {row.reason} + {blocking ? {blocking} : null} + + } } ]} /> @@ -325,11 +341,13 @@ export default function Dispatch() {
kind} dataSource={QUEUE_KINDS} columns={[ - { title: '任务类型', key: 'kind', width: 140, render: (_: any, kind: any) => {statusLabel(kind)} }, + { title: '任务类型', key: 'kind', width: 104, render: (_: any, kind: any) => {statusLabel(kind)} }, ...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() {
`${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 || '默认'}
{c.media_type}
}, - { 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) => ( - {!c.enabled ? '已停用' : c.saturated ? '已满负荷' : '可用'} - ) } + { title: 'Provider / 模型', key: 'model', render: (_: any, c: any) => ( + <> + + {c.provider} / {c.model || '默认'} + + + + {!c.enabled ? '已停用' : c.saturated ? '满载' : '可用'} + + {c.media_type} + + + ) }, + { 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) => ( + <> +
{c.slots}/{c.concurrency_limit}
+
RPM {c.rpm_headroom}
+ + ) } ]} /> @@ -386,49 +415,68 @@ export default function Dispatch() { } />
封顶两行;定宽降到 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}
{statusLabel(t.kind)} · {t.stage}
+ { title: '任务', key: 'name', width: 180, render: (_: any, t: any) => ( + <> + #{t.id} {t.name} + + {statusLabel(t.kind)} · {t.stage} + + ) }, - { 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 ?
{t.worker_id}
: null} - }, - { title: '尝试', key: 'attempts', width: 76, align: 'center', className: MONO, + { title: '后端', key: 'backend', width: 124, render: (_: any, t: any) => ( + <> + {statusLabel(t.execution_backend)} + {t.worker_id} + + ) }, + { 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) => }, - { 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) => ( <> - -
{fmtAgo(t.updated_at)}
+ {' '} + {fmtAgo(t.updated_at)} + {/* 心跳停服只在这一行说结论,长解释挂 title:整表级的说明在卡头 sub 里。 + 原来这里是三行红字,行高从 42 顶到 125。 */} {t.stale - ?
}>心跳已停止 {fmtAge(t.heartbeat_age_seconds)}:可能已中断,不会永远转圈
+ ? + 心跳停止 + : null} ) }, - { title: '错误 / 检查点', key: 'error', className: cellWrap, render: (_: any, t: any) => ( - <> - {t.error_message ? {t.error_code} {t.error_message} : null} - {t.checkpoint?.last_note ?
{t.checkpoint.last_note}
- : Object.keys(t.checkpoint || {}).length ?
checkpoint: {JSON.stringify(t.checkpoint).slice(0, 90)}
: null} - {t.output_url ? 产物 : 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 <> + + {t.error_message ? {t.error_code} {t.error_message} : null} + {t.checkpoint?.last_note ? {t.checkpoint.last_note} + : Object.keys(t.checkpoint || {}).length + ? checkpoint: {JSON.stringify(t.checkpoint)} : null} + + {t.output_url ? 产物 : null} + + } }, + { title: '操作', key: 'actions', width: 112, align: 'right', render: (_: any, t: any) => ( {['failed', 'cancelled'].includes(t.status) ? : null} diff --git a/frontend/src/pages/project/Library.tsx b/frontend/src/pages/project/Library.tsx index eb64301..c88493f 100644 --- a/frontend/src/pages/project/Library.tsx +++ b/frontend/src/pages/project/Library.tsx @@ -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 = { ...(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 ( - {/* 页头(标题 + 说明 + 两个跳转)、四个内部页签、跨字段搜索条全部坐进同一张卡。 - 症状:这三截以前各自漂在页面底色上——裸

当页头、页签条独立一行、 - 搜索条自己写 border+圆角+内边距,四种高度与两套内边距贴在一起, - 看上去像三件互不相关的东西(这就是「页面布局不对」最常见的一型)。 - 做法:卡头交给 antd Card 的 title/sub/extra(K1 之后右端自带 wrap+gap), - 页签与搜索条是它的正文;页面不再出现任何自绘容器。 */} - - } to="/assets">平台资产库 - } to="/models">配置生成模型 - }> - {/* 人物 / 场景 / 声线 / 项目素材是四个内部页面 → Tabs(UI规范 §6.4)。 - 右侧动作走 antd 的 tabBarExtraContent,不再另起一行把页签和按钮分开。 */} + {/* 页头(第 1 条):环节名 + 职责说明 + 这一页的主操作。 + 主操作是「新建当前面板的资产」——它整页成立,所以进 PageHead; + 两个跨页跳转是另一层意思,自成一组并排放左边。 */} + + + } to="/assets">平台资产库 + } to="/models">配置生成模型 + + {panel !== 'project' && ( + + )} + } + /> + + {/* 四个内部页签 + 跨字段搜索条坐在同一张卡里(它们说的是同一件事:这一页看哪一份、怎么找)。 + 症状(第 6 条·截图1):「+ 新建人物」以前挂在 tabBarExtraContent.right, + 于是页签条和内容页的主按钮挤在同一行——页签回答「看哪一份」,按钮回答「做一件事」, + 两者语义不同层,同排必然打架(切到「项目素材」面板那颗按钮还会凭空消失)。 + 做法:页签条独占一行,右端不再放按钮;执行中的忙态文字降进搜索条右端。 */} + choosePanel(k as PanelKey)} - tabBarExtraContent={{ - right: ( - - {busy ? {busy}… : null} - {panel !== 'project' && ( - - )} - - ) - }} items={PANEL_KEYS.map((key) => ({ key, label: PANEL_LABEL[key], @@ -808,6 +777,7 @@ export default function Library() { title="只看还没被任何镜头引用的资产,便于清理" onClick={() => setOnlyUnused(!onlyUnused)}>未被镜头使用 + {busy ? {busy}… : null} {filterActive ? 命中 {shownCount} / {panelTotal} @@ -859,9 +829,23 @@ export default function Library() { {!c.is_active && 已停用} -

{c.appearance || c.persona_prompt || '未填写外观与一致性提示词'}

-

造型版本 {c.style_version || 'v1'} · 默认声线 {c.default_voice_name || '未绑定'} - {c.tags?.length ? ` · ${c.tags.join(' / ')}` : ''}

+ {/* 外观 / 造型版本 / 默认声线 / 标签是「这个人物的设定回显」, + 原来写成两行 `·` 分隔的散文,找不到列也看不出哪些能改; + 换成回显表:标签列带底纹,长描述独占一行,短属性并排。 + 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 也成立:长描述顶满一行、短属性并排。 */} + 未填写外观与一致性提示词 }, + { label: '造型版本', value: c.style_version || 'v1' }, + { label: '默认声线', value: c.default_voice_name || 未绑定 }, + { label: '标签', span: 2, value: c.tags?.length + ? {c.tags.map((t: string) => {t})} + : 未打标签 }, + ]} /> {/* 素材行 = 卡片动作行:容器下发 antd 紧凑档(componentSize=small), 于是两颗按钮是同一档、同一圆角,标签走只读标签的 sm 档, 一行里不再出现「一种按钮两档高、圆角一个 6 一个 8」。 */} @@ -996,9 +980,16 @@ export default function Library() { {v.is_default && 默认} -

{v.description || '未填写音色描述'}

-

voice_id {v.provider_voice_id} · {v.language} · {GENDER_LABEL[v.gender] || v.gender || '中性'} · 版本 {v.version}

- 未填写音色描述 }, + { label: 'voice_id', mono: true, value: v.provider_voice_id || 未绑定 }, + { label: '语言 / 性别 / 版本', + value: `${v.language || '—'} · ${GENDER_LABEL[v.gender] || v.gender || '中性'} · 版本 ${v.version}` }, + ]} /> + } label="AI 试听样本" last={gens && {gens.provider}/{gens.model}} disabled={!ttsProviders.length} @@ -1162,11 +1153,10 @@ export default function Library() { patchVoice({ name: e.target.value })} /> patchVoice({ provider: e.target.value })} /> - {voice.provider === 'macos-say' - ? - patchVoice({ provider_voice_id: e.target.value })} />} + + patchVoice({ provider_voice_id: e.target.value })} /> + patchVoice({ language: e.target.value })} /> setVoiceEffect(String(v))} options={EFFECT_OPTIONS} placeholder="真实人声" /> - - )}