19 个页面按 antd 口径重排:一行放完、按钮带图标、信息块带底纹、重点色只给关键动作
症状(用户三轮截图指向同一件事:控件换成 antd 了,版面还是手写的):
① 该一行的排成两行——项目列表把「搜索 + 状态」塞在卡头右端,两个带标签
的字段折成一竖列,右边空出半张卡;筛选条里所有字段标签在上,
一次横向扫读被排成填表。
② 按钮全是纯文字——AI 生成、上传、引入项目、清除筛选、下达指令、执行计划
……读者只能逐字读,一排按钮长得完全一样,扫不出主次。
③ 统计块和页面底色同色——项目总览四张指标卡、质检页的计数、抽屉里的回显块
全是「白底白框」,看不出哪块是信息。
④ 重点色滥用——一个容器里三颗 blue primary 并排,等于没有主次。
另有一批残留:裸 <h2> 当页头、页签条独立一行漂在底色上、全选条是列表上方
一整个只装一颗勾选框的虚线盒、侧栏里的指标卡按整页宽度选了 4 列、
档位写成「≤1600 三列」结果 1440 上 5 张卡排成 3+2、手册 31 遍自绘卡片。
做法:① 筛选/工具条一律 Ctlbar + <Field inline>(标签在左、控件在右、同一行,
放不下整条折行),全站 19 条 Ctlbar 内 27 个字段全部 inline,0 例外;
筛选条按 antd 列表页口径从卡头右端移到卡头下方的正文里,卡头只留计数。
② 每颗按钮一只语义图标(icon={<IconX/>}),FilePick / RecordAudio 这类
自绘控件也走 icon 槽;扫描脚本 inv2 复扫,页面侧 0 处纯文字按钮。
③ 统计与回显块统一带底纹(Stat / Block 默认档 / 中性 Tag),
漂在底色上的裸标题、裸页签条收进 Card 的 title / sub / extra。
④ 一个容器只留一颗 primary:AI 生成、入队所选、保存资料、修改密码、
新建长视频项目;其余降级为默认/text,危险动作用 text danger。
⑤ 版式残留逐页清:页头交还 PageHead/Toolbar,手册 31 处自绘卡改用
Panel size="small" + Typography.Title(仍留在本页——规范:被第二个页面
用到才提上 kit),指标卡按所在栏宽度选列(侧栏 2 列),
栅格档位改到 1440 这一档,全选条并进卡头右端。
⑥ 手册 12 张插图用 helpshots.py 重拍:旧图还是上一套绿色皮肤,
正文里写的「浅绿色标签」在插图上字面成立。
为什么:控件同价不等于版面同价——同一颗 antd Button,摆在哪儿、有没有图标、
是不是这一片唯一的重点,才是读者判断「下一步点它」的依据。
这四条写成规矩容易,只有逐页改完并由扫描脚本兜住,才不会下一轮又长回去。
main
|
Before Width: | Height: | Size: 409 KiB After Width: | Height: | Size: 330 KiB |
|
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 290 KiB |
|
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 307 KiB |
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 285 KiB |
|
Before Width: | Height: | Size: 271 KiB After Width: | Height: | Size: 187 KiB |
|
Before Width: | Height: | Size: 385 KiB After Width: | Height: | Size: 317 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 440 KiB |
|
Before Width: | Height: | Size: 369 KiB After Width: | Height: | Size: 299 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 528 KiB |
|
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 345 KiB |
|
Before Width: | Height: | Size: 317 KiB After Width: | Height: | Size: 230 KiB |
|
|
@ -13,6 +13,7 @@ import { useAutoRefresh } from '../hooks/use-auto-refresh'
|
|||
import { SecretInput } from '../components/forms'
|
||||
import { Actions, Button, CardRow, Empty, ErrorText, Field, FormGrid, FormRow, Input, Layout, Notice, PageHead, Panel, PanelHead, Stack, Tag } from '../components/ui'
|
||||
import { login, roleLabel, setUser, useAuthStore } from '../stores/auth'
|
||||
import { IconCheck, IconKey, IconLogout, IconUser } from '../components/icons'
|
||||
|
||||
const RULES_HINT = '至少 8 位,字母 / 数字 / 符号至少两种'
|
||||
|
||||
|
|
@ -119,7 +120,7 @@ export default function Account() {
|
|||
<Field label="角色"><Input value={role + '(由管理员分配)'} disabled /></Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy} onClick={saveProfile}>保存资料</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={saveProfile}>保存资料</Button>
|
||||
</Actions>
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
|
|
@ -143,11 +144,11 @@ export default function Account() {
|
|||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy} title="改密后其它设备的会话会自动注销,本机保留。"
|
||||
<Button icon={<IconKey />} type="primary" disabled={!!busy} title="改密后其它设备的会话会自动注销,本机保留。"
|
||||
onClick={changePassword}>
|
||||
修改密码
|
||||
</Button>
|
||||
<Button disabled={!!busy || !pwd.new_password || pwd.new_password !== pwd.confirm}
|
||||
<Button icon={<IconUser />} disabled={!!busy || !pwd.new_password || pwd.new_password !== pwd.confirm}
|
||||
onClick={relogin}>
|
||||
用新密码重新登录本机
|
||||
</Button>
|
||||
|
|
@ -169,8 +170,8 @@ export default function Account() {
|
|||
<CardRow key={row.id}
|
||||
title={<span title={row.label || ''}>{row.current ? '当前会话' : describeUserAgent(row.label)}</span>}
|
||||
right={row.current
|
||||
? <Tag tone="ok">使用中</Tag>
|
||||
: <Button size="sm" disabled={!!busy} onClick={() => revoke(row)}>注销</Button>}>
|
||||
? <Tag tone="accent">使用中</Tag>
|
||||
: <Button icon={<IconLogout />} size="sm" disabled={!!busy} onClick={() => revoke(row)}>注销</Button>}>
|
||||
<p>{row.ip || '未知 IP'} · 活跃于 {fmtAgo(row.last_seen_at)} · {fmtTime(row.expires_at)} 过期</p>
|
||||
</CardRow>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ import { MediaPick, MediaRemove, MediaThumb, type MediaRadius } from '../compone
|
|||
import { RecordAudio, type RecordPickMeta } from '../components/media/RecordAudio'
|
||||
import { useAutoRefresh } from '../hooks'
|
||||
import { useRecordingBusy } from '../stores/recording'
|
||||
import { BarRight, Between, Button, CardActions, Check, Checkbox, Chip, ChipBar, Ctlbar, Drawer, Empty, ErrorText, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Input, LINK_CLS, MONO, MUTED, MUTED_MONO, Modal, Notice, NumberInput, PageHead, Pager, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Tabs, Tag, TagGroup, TextArea, ViewSwitch, Stat, StatGrid } from '../components/ui'
|
||||
import { IconAdd, IconBlocks, IconBolt, IconClose, IconDelete, IconGrid, IconImage, IconList, IconRobot, IconSound, IconUser, IconVoice } from '../components/icons'
|
||||
import { ActionGroup, BarRight, Between, Block, Button, CardActions, Check, Checkbox, Chip, ChipBar, Ctlbar, Drawer, Empty, ErrorText, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Input, LINK_CLS, MONO, MUTED, MUTED_MONO, Modal, Notice, NumberInput, PageHead, Pager, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, Value, ViewSwitch } from '../components/ui'
|
||||
import { IconAdd, IconBlocks, IconBolt, IconCheck, IconUpload, IconClose, IconDelete, IconEdit, IconGrid, IconImage, IconLibrary, IconList, IconRobot, IconSound, IconTag, IconUser, IconVoice } from '../components/icons'
|
||||
|
||||
type AssetType = 'human' | 'scene' | 'voice'
|
||||
type ViewMode = 'grid' | 'list' | 'media'
|
||||
|
|
@ -1033,8 +1033,10 @@ export default function AssetLibrary() {
|
|||
hint: `${TYPE_META[key].hint}。资产在此管理母版,进入项目后仍可独立改版`
|
||||
}))} />
|
||||
|
||||
<section className="min-w-0">
|
||||
<Panel className="bg-bg-container p-4">
|
||||
{/* 一张卡装下「卡头 + 筛选 + 标签 + 列表 + 分页」:
|
||||
以前外面套一层什么都不管的 <section>,卡自己又写 p-4(antd 的卡身内边距
|
||||
于是变成两层),筛选条再自己描一次边——卡里套盒子,盒子里再套盒子。 */}
|
||||
<Panel>
|
||||
<PanelHead
|
||||
title={view === 'media' ? '全部素材墙' : `${typeMeta.label}母版`}
|
||||
sub={view === 'media'
|
||||
|
|
@ -1048,14 +1050,14 @@ export default function AssetLibrary() {
|
|||
right={<ViewSwitch value={view} onChange={chooseView} items={VIEW_ITEMS}
|
||||
className="shrink-0" />} />
|
||||
|
||||
{/* 筛选栏:只有皮肤,布局(等高 / 折行 / 行内标签)全部来自 Ctlbar。
|
||||
{/* 筛选栏:坐在卡正文里,不再自己描边(站内有边框的横块只有 Card 一种)。
|
||||
「每页」不在这里——分页条是 page_size 唯一的家(UI规范 §5)。 */}
|
||||
<Ctlbar className="px-3 py-2 mb-3 border border-fill rounded-lg bg-bg-container">
|
||||
<Field label="搜索" width="grow" title="跨字段匹配名称、代号、设定、提示词与标签">
|
||||
<Ctlbar className="mb-1">
|
||||
<Field inline label="搜索" width="grow" title="跨字段匹配名称、代号、设定、提示词与标签">
|
||||
<SearchInput value={search} onChange={(e) => setSearch(e.target.value)} aria-label="搜索平台资产" placeholder="名称 / 代号 / 设定 / 提示词 / 标签(跨字段)" />
|
||||
</Field>
|
||||
<Field label="素材类型" title="选项只列当前大分类该有的类型:在「人物」下筛「音色样本」永远 0 条">
|
||||
<Select size="sm" value={filters.kind} ariaLabel="按素材类型筛选"
|
||||
<Field inline label="素材类型" title="选项只列当前大分类该有的类型:在「人物」下筛「音色样本」永远 0 条">
|
||||
<Select value={filters.kind} ariaLabel="按素材类型筛选"
|
||||
onChange={(next) => patchFilters({ kind: String(next) })}
|
||||
options={[{ value: '', label: '全部类型' },
|
||||
...kindOptions.map((entry) => ({
|
||||
|
|
@ -1065,14 +1067,14 @@ export default function AssetLibrary() {
|
|||
</Field>
|
||||
{view !== 'media' ? (
|
||||
<>
|
||||
<Field label="素材情况">
|
||||
<Select size="sm" value={filters.has_media} ariaLabel="按素材情况筛选"
|
||||
<Field inline label="素材情况">
|
||||
<Select value={filters.has_media} ariaLabel="按素材情况筛选"
|
||||
onChange={(next) => patchFilters({ has_media: String(next) })}
|
||||
options={[{ value: '', label: '全部情况' },
|
||||
{ value: 'with', label: '已有素材' }, { value: 'without', label: '待补素材' }]} />
|
||||
</Field>
|
||||
<Field label="状态">
|
||||
<Select size="sm" value={filters.status} ariaLabel="按状态筛选"
|
||||
<Field inline label="状态">
|
||||
<Select value={filters.status} ariaLabel="按状态筛选"
|
||||
onChange={(next) => patchFilters({ status: String(next) })}
|
||||
options={[{ value: '', label: '全部状态' },
|
||||
{ value: 'active', label: '启用中' }, { value: 'inactive', label: '已停用' }]} />
|
||||
|
|
@ -1083,8 +1085,8 @@ export default function AssetLibrary() {
|
|||
仅多版本素材
|
||||
</Check>
|
||||
)}
|
||||
<Field label="排序" width="narrow">
|
||||
<Select size="sm" ariaLabel="排序方式"
|
||||
<Field inline label="排序" width="narrow">
|
||||
<Select ariaLabel="排序方式"
|
||||
value={view === 'media' ? wallQuery.sort : filters.sort}
|
||||
onChange={(next) => (view === 'media'
|
||||
? patchWall({ sort: String(next) })
|
||||
|
|
@ -1125,27 +1127,27 @@ export default function AssetLibrary() {
|
|||
|
||||
{/* AS-10:勾选后先摊开影响面(素材量 / 体积 / 谁在引用),再给动作 */}
|
||||
{view !== 'media' && selected.size > 0 && (
|
||||
<div className="flex items-center flex-wrap gap-2 mt-3 px-3 py-2 border border-primary-border rounded-lg bg-primary-bg text-xs text-text-secondary ">
|
||||
<Block tone="info" className="mt-3 w-full">
|
||||
<b className="text-xs">已选 {selected.size} 个{typeMeta.label}母版</b>
|
||||
<span className={cn(MUTED, 'text-xs')}>{selectedSummary}</span>
|
||||
<Button size="sm" className="ml-auto" onClick={selectAllFiltered}>
|
||||
<Value>{selectedSummary}</Value>
|
||||
<Button icon={<IconCheck />} className="ml-auto" onClick={selectAllFiltered}>
|
||||
{allSelected ? '取消全选' : '全选本页筛选结果'}
|
||||
</Button>
|
||||
<Button size="sm" onClick={() => openImportSelection()}>引入项目</Button>
|
||||
<Button size="sm" onClick={() => { setBatchDialog('tag'); setError('') }}>批量标签</Button>
|
||||
<Button type="text" danger disabled={!!busy} title="删除这些母版(项目内的快照副本不受影响)"
|
||||
<Button icon={<IconLibrary />} onClick={() => openImportSelection()}>引入项目</Button>
|
||||
<Button icon={<IconTag />} onClick={() => { setBatchDialog('tag'); setError('') }}>批量标签</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger disabled={!!busy} title="删除这些母版(项目内的快照副本不受影响)"
|
||||
onClick={() => setBatchDialog('delete')}>批量删除</Button>
|
||||
<Button type="text" size="sm" onClick={clearSelection}>取消选择</Button>
|
||||
</div>
|
||||
<Button icon={<IconClose />} type="text" onClick={clearSelection}>取消选择</Button>
|
||||
</Block>
|
||||
)}
|
||||
{view === 'media' && selectedMedia.size > 0 && (
|
||||
<div className="flex items-center flex-wrap gap-2 mt-3 px-3 py-2 border border-primary-border rounded-lg bg-primary-bg text-xs text-text-secondary ">
|
||||
<Block tone="info" className="mt-3 w-full">
|
||||
<b className="text-xs">已选 {selectedMedia.size} 个素材</b>
|
||||
<Button type="text" danger className="ml-auto" disabled={!!busy}
|
||||
<Button icon={<IconDelete />} type="text" danger className="ml-auto" disabled={!!busy}
|
||||
title="Shift 可范围勾选;删除会连同全部历史版本一起移除"
|
||||
onClick={() => setBatchDialog('media-delete')}>批量删除素材</Button>
|
||||
<Button type="text" size="sm" onClick={clearSelection}>取消选择</Button>
|
||||
</div>
|
||||
<Button icon={<IconClose />} type="text" onClick={clearSelection}>取消选择</Button>
|
||||
</Block>
|
||||
)}
|
||||
|
||||
{view === 'media' ? (
|
||||
|
|
@ -1153,15 +1155,17 @@ export default function AssetLibrary() {
|
|||
/* AS-9:「筛不出东西」和「本来就空的」是两件事,出口也不同 */
|
||||
<Empty>
|
||||
{filtersActive
|
||||
? <>没有符合条件的素材。<Button type="link" onClick={clearFilters}>清除全部筛选</Button></>
|
||||
? <>没有符合条件的素材。<Button icon={<IconClose />} type="link" onClick={clearFilters}>清除全部筛选</Button></>
|
||||
: <>当前类型还没有登记任何素材。切回母版视图,用卡片上的「AI 生成」或「上传」补素材。</>}
|
||||
</Empty>
|
||||
) : (
|
||||
<div className="grid gap-2 grid-cols-[repeat(auto-fill,minmax(148px,1fr))] max-sm:grid-cols-[repeat(auto-fill,minmax(120px,1fr))] min-w-0 [&>*]:min-w-0">
|
||||
/* 【全站唯一保留的私有栅格】素材墙按**容器**宽度铺满缩略图:
|
||||
antd 的 Row/Col 断点看的是视口,抽屉与两栏里会算错列数,
|
||||
auto-fill + minmax 才是这一族该有的行为。 */
|
||||
<div className="grid gap-2 grid-cols-[repeat(auto-fill,minmax(148px,1fr))] min-w-0 [&>*]:min-w-0">
|
||||
{wall.items.map((media: any, idx: number) => (
|
||||
<div key={media.id}
|
||||
className={cn('relative flex flex-col gap-1 pt-2 pr-2 pb-2 pl-2 rounded-lg bg-bg-container border border-fill',
|
||||
selectedMedia.has(media.id) && 'border-primary-border shadow-[0_0_0_1px_var(--ant-color-primary-bg)]')}>
|
||||
<Tile key={media.id} as="div" variant="pick" active={selectedMedia.has(media.id)}
|
||||
className="relative flex-col items-start gap-1 p-2">
|
||||
<MediaPick title="勾选后可批量删除(Shift 范围选择)" className="left-[12px] top-[12px]">
|
||||
<Checkbox checked={selectedMedia.has(media.id)}
|
||||
onClick={(e) => { e.stopPropagation(); toggleMedia(media, idx, e.shiftKey) }} />
|
||||
|
|
@ -1182,7 +1186,7 @@ export default function AssetLibrary() {
|
|||
{media.version_count > 1 && `(共 ${media.version_count} 版)`}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</Tile>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
|
|
@ -1190,11 +1194,11 @@ export default function AssetLibrary() {
|
|||
<Empty>
|
||||
{filtersActive ? (
|
||||
<>没有符合当前筛选条件的{typeMeta.label}母版。
|
||||
<Button type="link" onClick={clearFilters}>清除全部筛选</Button>
|
||||
<Button icon={<IconClose />} type="link" onClick={clearFilters}>清除全部筛选</Button>
|
||||
</>
|
||||
) : (
|
||||
<>还没有{typeMeta.label}母版。
|
||||
<Button type="link" onClick={openCreate}>新建{typeMeta.label}母版</Button>
|
||||
<Button icon={<IconAdd />} type="link" onClick={openCreate}>新建{typeMeta.label}母版</Button>
|
||||
,或到项目资产库把已有资产「上架到平台」。
|
||||
</>
|
||||
)}
|
||||
|
|
@ -1203,23 +1207,24 @@ export default function AssetLibrary() {
|
|||
/* 列表视图:一行一个母版,专为批量勾选与巡检设计 */
|
||||
<div className="flex flex-col gap-1.5 min-w-0">
|
||||
{rows.map((row: any, idx: number) => (
|
||||
<article key={row.id}
|
||||
className={cn('grid items-center gap-3 grid-cols-[auto_auto_minmax(200px,1fr)_auto_auto] '
|
||||
+ 'py-2 px-3 rounded-lg border border-fill '
|
||||
+ 'bg-[linear-gradient(145deg,var(--ant-color-bg-container),var(--ant-color-bg-layout))] max-lg:grid-cols-[auto_minmax(0,1fr)] max-lg:[&_.row-media]:hidden',
|
||||
isSelected(row) && 'border-primary-border shadow-[0_0_0_1px_var(--ant-color-primary-bg)]',
|
||||
row.duplicate_of?.length && 'border-warning-border')}>
|
||||
<label className="contents max-lg:hidden"
|
||||
title={isSelected(row) ? '取消选择' : '勾选后可批量引入 / 打标签 / 删除(Shift 范围选择)'}>
|
||||
<Checkbox checked={isSelected(row)} className="self-center cursor-pointer"
|
||||
onClick={(e) => { e.stopPropagation(); toggleSelect(row, idx, e.shiftKey) }} />
|
||||
</label>
|
||||
/* 一行母版 = 整块热区那一族(Tile pick)。
|
||||
症状:这一行自己写了五轨道 grid(含 minmax(200px,1fr))+ 私有断点 max-lg
|
||||
+ 一层 145° 渐变底——同一屏里卡片按 antd 栅格降列、列表按私有轨道降列,
|
||||
两套尺子各排各的,选中态还得再手写一遍 box-shadow。
|
||||
做法:皮肤交给 Tile(描边 / 圆角 / 底色 / 命中态都在 kit 里),
|
||||
分区交给会折行的 Flex:窄屏时素材条自己隐藏,不需要再改轨道。 */
|
||||
<Tile key={row.id} as="div" variant="pick" active={isSelected(row)}
|
||||
className={cn('flex-wrap items-center gap-3 p-3',
|
||||
row.duplicate_of?.length && 'border-warning-border')}
|
||||
title={isSelected(row) ? '取消选择' : '勾选后可批量引入 / 打标签 / 删除(Shift 范围选择)'}>
|
||||
<Checkbox checked={isSelected(row)} className="cursor-pointer max-lg:hidden"
|
||||
onClick={(e) => { e.stopPropagation(); toggleSelect(row, idx, e.shiftKey) }} />
|
||||
<Portrait name={row.name} sm />
|
||||
<div className="min-w-0">
|
||||
<div className="flex items-center gap-1 flex-wrap">
|
||||
<b className="text-xs">{row.name}</b>
|
||||
<span className={MUTED_MONO}>{row.code || `${type}-${row.id}`}</span>
|
||||
{!!row.is_default && <Tag tone="ok">默认声线</Tag>}
|
||||
{!!row.is_default && <Tag tone="accent">默认声线</Tag>}
|
||||
{row.is_active === false && <Tag tone="bad">停用</Tag>}
|
||||
{!!row.duplicate_of?.length && (
|
||||
<Tag tone="bad"
|
||||
|
|
@ -1244,7 +1249,7 @@ export default function AssetLibrary() {
|
|||
<Tag>{row.style_version || row.version || 'v1'} · {fmtAgo(row.updated_at)}</Tag>
|
||||
</TagGroup>
|
||||
</div>
|
||||
<div className="row-media flex items-center gap-1 shrink-0">
|
||||
<div className="flex items-center gap-1 shrink-0 max-lg:hidden">
|
||||
{stripOf(row, 5).map((media: any) => (
|
||||
<MediaTile key={media.id} media={media} width="58px" size="xs"
|
||||
queue={itemsOf(row)} index={mediaIndex(row, media)}
|
||||
|
|
@ -1259,20 +1264,20 @@ export default function AssetLibrary() {
|
|||
{!row.assets?.length && <span className={cn(MUTED, 'text-xs')}>暂无素材</span>}
|
||||
</div>
|
||||
<div className="flex flex-col gap-1 w-[132px] flex-none items-stretch ">
|
||||
<Button type="primary" size="sm" onClick={() => openGenerate(row)} icon={<IconBolt />}>
|
||||
<Button type="primary" block onClick={() => openGenerate(row)} icon={<IconBolt />}>
|
||||
{isVoice ? '生成试听' : 'AI 生成'}
|
||||
</Button>
|
||||
<div className="flex gap-1 [&>*]:flex-1">
|
||||
<FilePick label="上传" title="选完即作为新版本登记到这个母版下"
|
||||
<FilePick icon=<IconUpload /> label="上传" title="选完即作为新版本登记到这个母版下"
|
||||
onFiles={(files) => files.forEach((file) => void uploadFile(row, file, uploadKindFor(row)))} />
|
||||
<Button size="sm" onClick={() => openImportSelection(row)}>引入</Button>
|
||||
<Button icon={<IconLibrary />} onClick={() => openImportSelection(row)}>引入</Button>
|
||||
</div>
|
||||
<div className="flex gap-1 [&>*]:flex-1">
|
||||
<Button size="sm" onClick={() => openEdit(row)}>编辑</Button>
|
||||
<Button type="text" danger title="删除这个资源" onClick={() => setConfirmDelete(row)}>删除</Button>
|
||||
<Button icon={<IconEdit />} onClick={() => openEdit(row)}>编辑</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这个资源" onClick={() => setConfirmDelete(row)} aria-label="删除这个资源" />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</Tile>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
|
|
@ -1281,11 +1286,9 @@ export default function AssetLibrary() {
|
|||
{rows.map((row: any, idx: number) => {
|
||||
const audios = (row.assets || []).filter(isAudio)
|
||||
return (
|
||||
<article key={row.id}
|
||||
className={cn('relative flex flex-col min-w-0 p-4 rounded-lg border border-fill '
|
||||
+ 'bg-[linear-gradient(145deg,var(--ant-color-bg-container),var(--ant-color-bg-layout))]',
|
||||
isSelected(row) && 'border-primary-border shadow-[0_0_0_1px_var(--ant-color-primary-bg)]',
|
||||
row.duplicate_of?.length && 'border-warning-border')}>
|
||||
<Tile key={row.id} as="div" variant="pick" active={isSelected(row)}
|
||||
className={cn('relative flex-col items-start gap-0 p-4',
|
||||
row.duplicate_of?.length && 'border-warning-border')}>
|
||||
<MediaPick title={isSelected(row) ? '取消选择' : '勾选后可批量引入 / 打标签 / 删除(Shift 范围选择)'}>
|
||||
<Checkbox checked={isSelected(row)}
|
||||
onClick={(e) => { e.stopPropagation(); toggleSelect(row, idx, e.shiftKey) }} />
|
||||
|
|
@ -1294,8 +1297,8 @@ export default function AssetLibrary() {
|
|||
<Portrait name={row.name} />
|
||||
<div className="grow min-w-0">
|
||||
<div className="flex items-center gap-1 flex-wrap">
|
||||
<h3 className="m-0 text-sm truncate">{row.name}</h3>
|
||||
{!!row.is_default && <Tag tone="ok">默认声线</Tag>}
|
||||
<b className="truncate text-sm">{row.name}</b>
|
||||
{!!row.is_default && <Tag tone="accent">默认声线</Tag>}
|
||||
{row.is_active === false && <Tag tone="bad">停用</Tag>}
|
||||
{!!row.duplicate_of?.length && (
|
||||
<Tag tone="bad"
|
||||
|
|
@ -1307,7 +1310,7 @@ export default function AssetLibrary() {
|
|||
</div>
|
||||
<div className={MUTED_MONO}>{row.code || `${type}-${row.id}`}</div>
|
||||
</div>
|
||||
<Button size="sm" onClick={() => openEdit(row)}>编辑</Button>
|
||||
<Button icon={<IconEdit />} size="sm" onClick={() => openEdit(row)}>编辑</Button>
|
||||
</div>
|
||||
|
||||
<p className={SUMMARY}>
|
||||
|
|
@ -1381,11 +1384,13 @@ export default function AssetLibrary() {
|
|||
<Button type="primary" onClick={() => openGenerate(row)} icon={<IconBolt />}>
|
||||
{isVoice ? '生成试听' : 'AI 生成'}
|
||||
</Button>
|
||||
{/* 「传成哪一类」和「上传」是同一个动作的两半,拆到两行就读不出主谓 */}
|
||||
<ActionGroup>
|
||||
<Select className="w-[105px]" ariaLabel="选择要上传的资产类型"
|
||||
value={uploadKindFor(row)}
|
||||
onChange={(next) => setUploadKinds((prev) => ({ ...prev, [keyOf(row)]: String(next) }))}
|
||||
options={UPLOAD_KINDS[type].map((kind) => ({ value: kind, label: opt('asset_kinds', kind) }))} />
|
||||
<FilePick label="上传" title="按左侧类型登记为新版本;同名素材会追加版本,不会新建一条"
|
||||
<FilePick icon=<IconUpload /> label="上传" title="按左侧类型登记为新版本;同名素材会追加版本,不会新建一条"
|
||||
onFiles={(files) => files.forEach((file) => void uploadFile(row, file, uploadKindFor(row)))} />
|
||||
{isVoice && (
|
||||
<RecordAudio label="录制" target={opt('asset_kinds', uploadKindFor(row))}
|
||||
|
|
@ -1394,13 +1399,17 @@ export default function AssetLibrary() {
|
|||
hint="弹出小面板:录 → 试听 → 再决定存成哪条素材的哪个版本"
|
||||
onPick={(file, picked) => void recordSample(row, file, picked)} />
|
||||
)}
|
||||
<Button onClick={() => openImportSelection(row)}>引入项目</Button>
|
||||
<Button type="text" danger title="删除这个资源" onClick={() => setConfirmDelete(row)}>删除</Button>
|
||||
<span className={STAMP}>
|
||||
</ActionGroup>
|
||||
<ActionGroup>
|
||||
<Button icon={<IconLibrary />} onClick={() => openImportSelection(row)}>引入项目</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这个资源" onClick={() => setConfirmDelete(row)} aria-label="删除这个资源" />
|
||||
</ActionGroup>
|
||||
{/* 版本 / 更新时间是元数据,不是动作:靠右自成一段,别混在动作流里被挤上换行 */}
|
||||
<BarRight className={STAMP}>
|
||||
{row.style_version || row.version || 'v1'} · 更新于 {fmtAgo(row.updated_at)}
|
||||
</span>
|
||||
</BarRight>
|
||||
</CardActions>
|
||||
</article>
|
||||
</Tile>
|
||||
)
|
||||
})}
|
||||
</Grid>
|
||||
|
|
@ -1418,8 +1427,7 @@ export default function AssetLibrary() {
|
|||
onPageSize={(next) => patchFilters({ page_size: next })}
|
||||
onPage={(next) => patchWall({ page: next })} />
|
||||
)}
|
||||
</Panel>
|
||||
</section>
|
||||
</Panel>
|
||||
|
||||
{/* ── 新建 / 编辑母版 ────────────────────────────────────────
|
||||
抽屉而不是模态:这个表单最长有 11 个字段,模态里滚到一半就会把「保存」
|
||||
|
|
@ -1429,8 +1437,8 @@ export default function AssetLibrary() {
|
|||
{editingId ? '编辑' : '新建'}{TYPE_META[form.type].label}母版
|
||||
</span>}
|
||||
actions={<>
|
||||
<Button onClick={() => setDrawer(false)}>取消</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={() => void save()}>
|
||||
<Button icon={<IconClose />} onClick={() => setDrawer(false)}>取消</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={() => void save()}>
|
||||
{busy ? '处理中…' : '保存母版'}
|
||||
</Button>
|
||||
</>}>
|
||||
|
|
@ -1630,7 +1638,7 @@ export default function AssetLibrary() {
|
|||
value: m.id, label: `${m.name || m.kind_label} · v${m.version}`
|
||||
}))} />
|
||||
</FieldBlock>
|
||||
<FilePick accept="image/*" label="上传参考图" className={REF_PICK}
|
||||
<FilePick icon=<IconImage /> accept="image/*" label="上传参考图" className={REF_PICK}
|
||||
title="选完直接登记为该母版的一个新版本,随即可在上方勾选"
|
||||
onFiles={(files) => files.forEach((f) => void uploadImageReference(genTarget, f))} />
|
||||
<small className={REF_HINT}>
|
||||
|
|
@ -1660,7 +1668,7 @@ export default function AssetLibrary() {
|
|||
}))
|
||||
]} />
|
||||
</Field>
|
||||
<FilePick accept="audio/*" label="上传参考音色" className={REF_PICK}
|
||||
<FilePick icon=<IconVoice /> accept="audio/*" label="上传参考音色" className={REF_PICK}
|
||||
title="上传后立即可勾选为本次克隆的参考"
|
||||
onFiles={(files) => files.forEach((f) => void uploadReferenceFile(genTarget, f))} />
|
||||
<RecordAudio label="录制参考音色" target="参考音色"
|
||||
|
|
@ -1724,7 +1732,7 @@ export default function AssetLibrary() {
|
|||
title="生成结果作为该母版的 新版本 登记,旧版本仍可在预览器里逐版切换;项目里已锁定的快照不会自动改版。">
|
||||
现有素材({genTarget.assets.length})
|
||||
</SectionTitle>
|
||||
<Grid gap={6} className="grid-cols-[repeat(auto-fill,minmax(76px,1fr))] items-center">
|
||||
<Grid cols={6} steps={[{ at: 'md', cols: 4 }, { at: 'sm', cols: 3 }]} gap={6}>
|
||||
{genTarget.assets.filter((item: any) => isImage(item)).map((media: any) => (
|
||||
<MediaThumb key={media.id} item={fromAsset(media)} size="xs"
|
||||
title={media.name || media.kind_label}
|
||||
|
|
@ -1754,8 +1762,8 @@ export default function AssetLibrary() {
|
|||
label="确认删除平台母版"
|
||||
title={confirmDelete && <>删除{TYPE_META[confirmDelete.owner_type || type].label}母版?</>}
|
||||
footer={<>
|
||||
<Button disabled={!!busy} onClick={() => setConfirmDelete(null)}>取消</Button>
|
||||
<Button type="primary" danger disabled={!!busy} onClick={() => void runDelete()}>确认删除</Button>
|
||||
<Button icon={<IconClose />} disabled={!!busy} onClick={() => setConfirmDelete(null)}>取消</Button>
|
||||
<Button icon={<IconDelete />} type="primary" danger disabled={!!busy} onClick={() => void runDelete()}>确认删除</Button>
|
||||
</>}>
|
||||
<p className={IMPORT_SUBJECT}>
|
||||
将从平台资产库移除 <b className="text-primary-hover">「{confirmDelete?.name}」</b>
|
||||
|
|
@ -1768,8 +1776,8 @@ export default function AssetLibrary() {
|
|||
label="引入到项目资产库"
|
||||
title={<>引入到项目资产库{importTargets.length > 1 ? `(${importTargets.length} 个母版)` : ''}</>}
|
||||
footer={<>
|
||||
<Button onClick={() => setImportTargets([])}>取消</Button>
|
||||
<Button type="primary" disabled={!!busy || !importProjectId}
|
||||
<Button icon={<IconClose />} onClick={() => setImportTargets([])}>取消</Button>
|
||||
<Button icon={<IconLibrary />} type="primary" disabled={!!busy || !importProjectId}
|
||||
onClick={() => void importIntoProject()}>
|
||||
{busy ? '引入中…' : '确认引入'}
|
||||
</Button>
|
||||
|
|
@ -1799,8 +1807,8 @@ export default function AssetLibrary() {
|
|||
<Modal open={batchDialog === 'tag'} onClose={() => setBatchDialog('')}
|
||||
label="批量标签" title="批量调整标签"
|
||||
footer={<>
|
||||
<Button onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button type="primary"
|
||||
<Button icon={<IconClose />} onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button icon={<IconCheck />} type="primary"
|
||||
disabled={!!busy || (!batchTags.add.trim() && !batchTags.remove.trim())}
|
||||
onClick={() => void runBatchTag()}>
|
||||
{busy ? '处理中…' : '应用标签'}
|
||||
|
|
@ -1826,8 +1834,8 @@ export default function AssetLibrary() {
|
|||
label="批量删除母版"
|
||||
title={<>删除 {selected.size} 个母版?</>}
|
||||
footer={<>
|
||||
<Button disabled={!!busy} onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button type="primary" danger disabled={!!busy} onClick={() => void runBatchDelete()}>
|
||||
<Button icon={<IconClose />} disabled={!!busy} onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button icon={<IconDelete />} type="primary" danger disabled={!!busy} onClick={() => void runBatchDelete()}>
|
||||
{busy ? '处理中…' : `确认删除 ${selected.size} 个母版`}
|
||||
</Button>
|
||||
</>}>
|
||||
|
|
@ -1852,8 +1860,8 @@ export default function AssetLibrary() {
|
|||
label="批量删除素材"
|
||||
title={<>删除 {selectedMedia.size} 个素材?</>}
|
||||
footer={<>
|
||||
<Button disabled={!!busy} onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button type="primary" danger disabled={!!busy} onClick={() => void runBatchMediaDelete()}>
|
||||
<Button icon={<IconClose />} disabled={!!busy} onClick={() => setBatchDialog('')}>取消</Button>
|
||||
<Button icon={<IconDelete />} type="primary" danger disabled={!!busy} onClick={() => void runBatchMediaDelete()}>
|
||||
{busy ? '处理中…' : `确认删除 ${selectedMedia.size} 个素材`}
|
||||
</Button>
|
||||
</>}>
|
||||
|
|
@ -1897,7 +1905,7 @@ function Portrait({ name, sm }: { name?: string; sm?: boolean }) {
|
|||
/** 引用状态:删除母版前最需要知道的一件事就是「有没有项目在用」 */
|
||||
function ScopeTag({ row }: { row: any }) {
|
||||
return row.usage_count
|
||||
? <Tag tone="ok"
|
||||
? <Tag
|
||||
title={`已引入 ${row.usage_count} 个项目:${(row.usage || []).map((u: any) => u.project_name).join('、')}\n删除母版不会影响这些快照副本`}>
|
||||
已引入 {row.usage_count} 个项目
|
||||
</Tag>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { useAutoRefresh } from '../hooks'
|
|||
import { Select } from '../components/forms'
|
||||
import { MediaThumb } from '../components/media/MediaThumb'
|
||||
import { WorkflowBar } from '../components/media/WorkflowBar'
|
||||
import { Actions, Button, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, Input, LINK_CLS, LinkButton, Loading, LogBox, LogRow, MONO, MUTED, NumberInput, PageHead, Panel, PanelHead, ProgressBar, Row, SectionTitle, Stat, StatGrid, Status, PageStack, Tile, Table, TableBox, Tag, TagChip, TagGroup, TextArea, Value, cellRight, cellWrap } from '../components/ui'
|
||||
import { Actions, Block, Button, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, Input, LINK_CLS, SearchInput, LinkButton, Loading, LogBox, LogRow, MONO, MUTED, NumberInput, PageHead, Panel, PanelHead, ProgressBar, Row, SectionTitle, Stat, StatGrid, Status, PageStack, Tile, Table, Tag, TagChip, TagGroup, TextArea, Value, cellWrap } from '../components/ui'
|
||||
import {
|
||||
|
||||
capabilityHint, capsOf, defaultFor, deliveryResolutions, fpsChoices, isMock, loadModels,
|
||||
|
|
@ -27,7 +27,7 @@ import {
|
|||
} from '../stores/models'
|
||||
import { useSystemStore } from '../stores/system'
|
||||
import { notify } from '../stores/notice'
|
||||
import { IconAdd, IconCheck, IconChevronUp, IconImage, IconPlayCircle, IconSound } from '../components/icons'
|
||||
import { IconAdd, IconCheck, IconChevronUp, IconClose, IconDelete, IconFolder, IconImage, IconPlayCircle, IconReload, IconSound } from '../components/icons'
|
||||
/** 新建项目表单:字段名与后端 POST /api/projects 一致,提交时直接展开 */
|
||||
type NewProjectForm = {
|
||||
name: string
|
||||
|
|
@ -334,13 +334,9 @@ export default function Dashboard() {
|
|||
|
||||
{creating && (
|
||||
<form onSubmit={submit} className="min-w-0">
|
||||
<Panel>
|
||||
{/* 标签列锁 92px:这一表单里最长的是「目标总时长(秒)」92px。
|
||||
不锁的话标签列宽 = minmax(66, max-content),这一格控件会被长标题顶右 15px,
|
||||
整表就长出两条控件左边界(体检 misaligned 唯一报红的表单)。 */}
|
||||
{/* 标题写进卡头:表单正文里再顶一个大标题=同一个标题出现两次 */}
|
||||
<Panel title="新建长视频项目" sub="流程第 ① 步:创建视频项目">
|
||||
<FormGrid>
|
||||
<h3 className="mb-3" title="流程第 ① 步:创建视频项目">新建长视频项目</h3>
|
||||
|
||||
<FormRow>
|
||||
<Field label="项目名称" required>
|
||||
<Input value={form.name} placeholder="例如:星海纪元 · 第一集" onChange={(e) => setForm({ name: e.target.value })} />
|
||||
|
|
@ -404,8 +400,8 @@ export default function Dashboard() {
|
|||
{modelWarnings.map((w, i) => <ErrorText key={`w${i}`} className="mb-1">{w}</ErrorText>)}
|
||||
|
||||
<Actions>
|
||||
<Button type="primary" htmlType="submit">创建并进入项目</Button>
|
||||
<Button htmlType="button" onClick={() => setCreating(false)}>取消</Button>
|
||||
<Button type="primary" htmlType="submit" icon={<IconCheck />}>创建并进入项目</Button>
|
||||
<Button htmlType="button" onClick={() => setCreating(false)} icon={<IconClose />}>取消</Button>
|
||||
</Actions>
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
|
|
@ -420,76 +416,88 @@ export default function Dashboard() {
|
|||
</StatGrid>
|
||||
|
||||
<Panel>
|
||||
<PanelHead title="项目列表" right={
|
||||
<Ctlbar className="mb-0 w-full">
|
||||
<Field label="搜索" width="grow">
|
||||
<Input value={keyword} aria-label="搜索项目" placeholder="名称 / 简介 / 题材" onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
<Field label="状态" width="narrow">
|
||||
<Select size="sm" value={statusFilter} ariaLabel="项目状态筛选" onChange={setStatusFilter}
|
||||
options={[{ value: '', label: '全部状态' },
|
||||
...statuses.map((st) => ({ value: st, label: statusLabel(st) }))]} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
} />
|
||||
{/*
|
||||
症状:搜索 + 状态筛选塞在 PanelHead right。卡头右端只有半张卡的宽度,
|
||||
两个带标签的字段折成一竖列,"项目列表"右边空出一大块(见 1440 截图)。
|
||||
做法:卡头右端只留计数;筛选条按 antd 的列表页口径放在卡头**下方的正文里**
|
||||
(ProTable 的 search area 同一位置),满宽横排,字段标签在上。
|
||||
为什么不是把卡头改成两行:Card 的 title 区高度由 antd 定,塞控件进去
|
||||
就等于给卡头再写一套私有排版——正是这一轮要清掉的东西。
|
||||
*/}
|
||||
<PanelHead title="项目列表"
|
||||
right={<Value>{filtered.length} / {projects.length} 个项目</Value>} />
|
||||
{/*
|
||||
症状(用户截图):搜索 + 状态两个字段占掉两行——上排标签、下排控件,
|
||||
右端还空着半条。筛选是一次扫读,不是填表。
|
||||
做法:字段 inline(标签在左、控件在右,同一行),搜索框自带放大镜图标,
|
||||
筛选生效时同排补一颗「清除筛选」图标按钮;放不下才折行。
|
||||
*/}
|
||||
<Ctlbar className="mb-3">
|
||||
<Field inline label="搜索" width="grow" className="max-w-[380px]">
|
||||
<SearchInput value={keyword} aria-label="搜索项目" placeholder="名称 / 简介 / 题材" onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
<Field inline label="状态" width="narrow">
|
||||
<Select value={statusFilter} ariaLabel="项目状态筛选" onChange={setStatusFilter}
|
||||
options={[{ value: '', label: '全部状态' },
|
||||
...statuses.map((st) => ({ value: st, label: statusLabel(st) }))]} />
|
||||
</Field>
|
||||
{keyword || statusFilter
|
||||
? (
|
||||
<Button type="text" icon={<IconClose />}
|
||||
onClick={() => { setKeyword(''); setStatusFilter('') }}>清除筛选</Button>
|
||||
)
|
||||
: null}
|
||||
</Ctlbar>
|
||||
|
||||
{loading ? <Loading>正在读取项目…</Loading>
|
||||
: !filtered.length ? <Empty>还没有项目。点击右上角「新建长视频项目」开始。</Empty>
|
||||
: (
|
||||
<>
|
||||
<TableBox maxHeight={false} className="max-sm:hidden">
|
||||
<Table minWidth={940}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>项目</th><th>状态</th><th>流程节点</th>
|
||||
<th className={cellRight}>镜头</th><th className={cellRight}>进度</th>
|
||||
<th className={cellRight}>时长</th><th className={cellRight}>成本</th>
|
||||
<th className={cellRight}>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filtered.map((p) => (
|
||||
<tr key={p.id}>
|
||||
<td className={cellWrap}>
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<div className="w-[72px] flex-none">
|
||||
{p.cover_url
|
||||
? <MediaThumb src={p.cover_url} size="xs" width="72px" title={`${p.name} 首帧`} />
|
||||
: <span className={COVER_NONE}
|
||||
title={p.shot_count ? '已有镜头,但还没有生成任何画面' : '还没有导入分镜'}>
|
||||
{p.shot_count ? <IconPlayCircle /> : <IconAdd />}
|
||||
</span>}
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Link to={`/projects/${p.id}/overview`} className={LINK_CLS}><b>{p.name}</b></Link>
|
||||
<div className={MUTED}>{p.aspect_ratio} · {p.resolution} · {p.fps}fps
|
||||
{p.genre ? ` · ${p.genre}` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className={NOWRAP}><Status value={p.status} /></td>
|
||||
<td className={cellWrap}>{stageNote(p)}</td>
|
||||
<td className={cn(cellRight, NOWRAP)}>{p.stats?.shots || 0}
|
||||
<span className={MUTED}> / 合格 {p.stats?.shots_approved || 0}</span>
|
||||
</td>
|
||||
<td className={cn(cellRight, NOWRAP, 'min-w-[96px]')}>
|
||||
<ProgressBar className="mb-1 w-full" value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
|
||||
<small className={MUTED}>{pct(p.stats?.progress_ratio)}</small>
|
||||
</td>
|
||||
<td className={cn(cellRight, NOWRAP, MONO)}>{(p.stats?.planned_duration || 0).toFixed(0)}s</td>
|
||||
<td className={cn(cellRight, NOWRAP, MONO)}>{fmtMoney(p.stats?.cost?.total_cost)}</td>
|
||||
<td className={cn(cellRight, NOWRAP)}>
|
||||
<Row className="justify-end">
|
||||
<Link to={`/projects/${p.id}/overview`} className={LINK_CLS}>进入</Link>
|
||||
<Button type="text" danger title="删除这个项目" onClick={() => void removeProject(p)}>删除</Button>
|
||||
</Row>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table className="max-sm:hidden" maxHeight={false} minWidth={940}
|
||||
dataSource={filtered}
|
||||
columns={[
|
||||
{ title: '项目', key: 'project', className: cellWrap, render: (_: any, p: any) => (
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
<div className="w-[72px] flex-none">
|
||||
{p.cover_url
|
||||
? <MediaThumb src={p.cover_url} size="xs" width="72px" title={`${p.name} 首帧`} />
|
||||
: <span className={COVER_NONE}
|
||||
title={p.shot_count ? '已有镜头,但还没有生成任何画面' : '还没有导入分镜'}>
|
||||
{p.shot_count ? <IconPlayCircle /> : <IconAdd />}
|
||||
</span>}
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Link to={`/projects/${p.id}/overview`} className={LINK_CLS}><b>{p.name}</b></Link>
|
||||
<div className={MUTED}>{p.aspect_ratio} · {p.resolution} · {p.fps}fps
|
||||
{p.genre ? ` · ${p.genre}` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) },
|
||||
{ title: '状态', key: 'status', width: 104, className: NOWRAP, render: (_: any, p: any) => <Status value={p.status} /> },
|
||||
{ title: '流程节点', key: 'stage', width: 172, className: cellWrap, render: (_: any, p: any) => stageNote(p) },
|
||||
{ title: '镜头', key: 'shots', width: 112, align: 'right', className: NOWRAP, render: (_: any, p: any) => (
|
||||
<>{p.stats?.shots || 0}<span className={MUTED}> / 合格 {p.stats?.shots_approved || 0}</span></>
|
||||
) },
|
||||
{ title: '进度', key: 'progress', width: 118, align: 'right', className: NOWRAP, render: (_: any, p: any) => (
|
||||
<>
|
||||
<ProgressBar className="mb-1 w-full" value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
|
||||
<small className={MUTED}>{pct(p.stats?.progress_ratio)}</small>
|
||||
</>
|
||||
) },
|
||||
{ title: '时长', key: 'duration', width: 78, align: 'right', className: `${NOWRAP} ${MONO}`,
|
||||
render: (_: any, p: any) => `${(p.stats?.planned_duration || 0).toFixed(0)}s` },
|
||||
{ title: '成本', key: 'cost', width: 96, align: 'right', className: `${NOWRAP} ${MONO}`,
|
||||
render: (_: any, p: any) => fmtMoney(p.stats?.cost?.total_cost) },
|
||||
{ title: '操作', key: 'actions', width: 128, align: 'right', className: NOWRAP, render: (_: any, p: any) => (
|
||||
<Row className="justify-end">
|
||||
<Link to={`/projects/${p.id}/overview`} className={LINK_CLS}>进入</Link>
|
||||
<Button type="text" danger title="删除这个项目" onClick={() => void removeProject(p)}
|
||||
icon={<IconDelete />} aria-label="删除这个项目" />
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
|
||||
{/* 窄屏换成卡片:940px 的表在手机上只能横向拖,进度和成本永远看不见 */}
|
||||
<div className="hidden min-w-0 gap-2 max-sm:grid">
|
||||
|
|
@ -525,8 +533,8 @@ export default function Dashboard() {
|
|||
? <em className="text-primary not-italic"> {levelCounts[lv.value]}</em> : null}
|
||||
</Chip>
|
||||
))}
|
||||
<Field label="搜索" width="grow" className="max-w-[260px]">
|
||||
<Input value={eventKeyword} aria-label="搜索事件" placeholder="事件内容 / 动作" onChange={(e) => setEventKeyword(e.target.value)} />
|
||||
<Field inline label="搜索" width="grow" className="max-w-[280px]">
|
||||
<SearchInput value={eventKeyword} aria-label="搜索事件" placeholder="事件内容 / 动作" onChange={(e) => setEventKeyword(e.target.value)} />
|
||||
</Field>
|
||||
</ChipBar>
|
||||
<LogBox>
|
||||
|
|
@ -542,7 +550,7 @@ export default function Dashboard() {
|
|||
{!!events.length && !shownEvents.length && (
|
||||
<div className={cn(MUTED, 'flex flex-wrap items-center gap-2 py-2 px-0.5')}>
|
||||
当前筛选条件下没有事件。
|
||||
<Button size="sm" onClick={() => { setEventLevel(''); setEventKeyword('') }}>清除筛选</Button>
|
||||
<Button icon={<IconClose />} onClick={() => { setEventLevel(''); setEventKeyword('') }}>清除筛选</Button>
|
||||
</div>
|
||||
)}
|
||||
</LogBox>
|
||||
|
|
@ -586,12 +594,12 @@ function LibraryPicker({ open, type, onType, query, onQuery, rows, loading, erro
|
|||
{open ? '收起资源库'
|
||||
: (pickedRows.length ? `已选 ${pickedRows.length} 个资源` : '从资源库引入人物 / 场景 / 声线')}
|
||||
</Button>
|
||||
{pickedRows.length > 0 && <Tag tone="ok">创建时自动引入 {pickedRows.length} 个母版</Tag>}
|
||||
{pickedRows.length > 0 && <Tag tone="accent">创建时自动引入 {pickedRows.length} 个母版</Tag>}
|
||||
</Row>
|
||||
|
||||
{open && (
|
||||
<div className="mt-3 rounded-lg border border-fill bg-bg-container p-3">
|
||||
<div className="mb-3 flex min-w-0 flex-wrap items-center gap-2">
|
||||
<Block tone="default" vertical className="mt-3 w-full">
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||
{LIB_TYPES.map((t) => (
|
||||
<Chip key={t.value} active={type === t.value} onClick={() => onType(t.value)}>
|
||||
{t.label}
|
||||
|
|
@ -599,10 +607,10 @@ function LibraryPicker({ open, type, onType, query, onQuery, rows, loading, erro
|
|||
? <em className="text-primary not-italic"> {pickedByType[t.value].length}</em> : null}
|
||||
</Chip>
|
||||
))}
|
||||
<Field label="搜索" width="grow" className="max-w-[260px]">
|
||||
<Input value={query} placeholder="名称 / 编号 / 标签" onChange={(e) => onQuery(e.target.value)} />
|
||||
<Field inline label="搜索" width="grow" className="max-w-[280px]">
|
||||
<SearchInput value={query} placeholder="名称 / 编号 / 标签" onChange={(e) => onQuery(e.target.value)} />
|
||||
</Field>
|
||||
<Button size="sm" disabled={loading} onClick={onRefresh}>刷新</Button>
|
||||
<Button disabled={loading} onClick={onRefresh} icon={<IconReload />}>刷新</Button>
|
||||
</div>
|
||||
|
||||
<ErrorText>{error}</ErrorText>
|
||||
|
|
@ -613,6 +621,7 @@ function LibraryPicker({ open, type, onType, query, onQuery, rows, loading, erro
|
|||
</div>
|
||||
)}
|
||||
{!empty && (
|
||||
/* 按容器铺满的资源墙:格子宽度由容器算,antd 百分比栅格做不到,全站少数几处之一 */
|
||||
<div className="grid max-h-[268px] min-w-0 grid-cols-[repeat(auto-fill,minmax(212px,1fr))] gap-2 overflow-auto pr-0.5 scrollbar-slim">
|
||||
{rows.map((row) => (
|
||||
<LibCard key={libKey(row)} row={row} on={!!picked[libKey(row)]} onToggle={() => onPick(row)} />
|
||||
|
|
@ -621,8 +630,8 @@ function LibraryPicker({ open, type, onType, query, onQuery, rows, loading, erro
|
|||
)}
|
||||
|
||||
{pickedRows.length > 0 && (
|
||||
<div className="mt-3 flex min-w-0 flex-wrap items-center gap-2">
|
||||
<span className="mr-[2px] text-text-quaternary text-xs">将引入</span>
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||
<Value className="!text-text-quaternary">将引入</Value>
|
||||
{pickedRows.map((row: any) => (
|
||||
<TagChip key={`p${row.owner_type}${row.asset_id}`}
|
||||
removeTitle={`不再引入 ${row.name}`}
|
||||
|
|
@ -632,7 +641,7 @@ function LibraryPicker({ open, type, onType, query, onQuery, rows, loading, erro
|
|||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Block>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
@ -663,7 +672,7 @@ function LibCard({ row, on, onToggle }: { row: any; on: boolean; onToggle: () =>
|
|||
/** 窄屏项目卡:表格里那些列,在手机上换成一张卡逐项列出 */
|
||||
function ProjectCard({ p, onRemove }: { p: any; onRemove: (p: any) => void }) {
|
||||
return (
|
||||
<article className="min-w-0 rounded-lg border border-fill bg-bg-container p-3">
|
||||
<Tile as="div" variant="pick" className="min-w-0 flex-col items-stretch gap-1 p-3">
|
||||
<div className="mb-1 flex min-w-0 flex-wrap items-start justify-between gap-2">
|
||||
{p.cover_url && <MediaThumb src={p.cover_url} size="xs" width="56px" title={`${p.name} 首帧`} />}
|
||||
<Link to={`/projects/${p.id}/overview`} className={cn(LINK_CLS, 'min-w-0 flex-1 text-text')}>
|
||||
|
|
@ -686,9 +695,9 @@ function ProjectCard({ p, onRemove }: { p: any; onRemove: (p: any) => void }) {
|
|||
<ProgressBar className="w-full" value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
|
||||
|
||||
<div className="mt-3 flex min-w-0 flex-wrap items-center gap-3 ">
|
||||
<LinkButton to={`/projects/${p.id}/overview`} size="sm">进入项目</LinkButton>
|
||||
<Button type="text" danger title="删除这个项目" onClick={() => onRemove(p)}>删除</Button>
|
||||
<LinkButton type="primary" to={`/projects/${p.id}/overview`} icon={<IconFolder />}>进入项目</LinkButton>
|
||||
<Button type="text" danger title="删除这个项目" onClick={() => onRemove(p)} icon={<IconDelete />} aria-label="删除这个项目" />
|
||||
</div>
|
||||
</article>
|
||||
</Tile>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
import { useEffect, useRef, useState, type FormEvent } from 'react'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { SecretInput } from '../components/forms'
|
||||
import { Button, FieldBlock, Input, Notice } from '../components/ui'
|
||||
import { Button, FieldBlock, Heading, Input, Mark, Notice, Panel, Row, Value } from '../components/ui'
|
||||
import { login, useAuthStore } from '../stores/auth'
|
||||
import { setTheme, useAppliedTheme } from '../stores/theme'
|
||||
import { IconMoon, IconSun } from '../components/icons'
|
||||
import { IconMoon, IconSun, IconUser } from '../components/icons'
|
||||
|
||||
export default function Login() {
|
||||
const navigate = useNavigate()
|
||||
|
|
@ -57,23 +57,35 @@ export default function Login() {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="grid min-h-screen place-items-center bg-[radial-gradient(900px_420px_at_50%_-8%,var(--ant-color-primary-bg-hover),transparent_70%),var(--ant-color-bg-layout)] p-6">
|
||||
/*
|
||||
* 症状(用户截图 2 那一类病灶):登录卡是页面自己画的——`rounded-lg border` 的盒子
|
||||
* 叠一层 `shadow-[0_24px_60px…]` 重投影,品牌行 37px 方牌、大标题裸 <h1> 各写
|
||||
* 一把尺子,和站内其它所有卡(antd Card)不是同一种东西。
|
||||
* 做法:外壳=Panel(antd Card);品牌方牌用 kit 的 <Mark>(与顶栏、项目总控台同一颗 N);
|
||||
* 标题=Heading level={3};底注=Value。页面底色退回 antd 的 colorBgLayout,
|
||||
* 那层 radial 渐变和 60px 投影整层删掉——登录页不该比产品页更花。
|
||||
* 为什么还留着原生 <form>:Enter 提交和浏览器的密码自动填充都挂在 form 上,
|
||||
* antd Card 只是 div,所以表单语义包在卡外面,而不是反过来把卡换成 form。
|
||||
*/
|
||||
<div className="flex min-h-screen items-center justify-center bg-bg-layout p-6">
|
||||
{/* 和顶栏那颗是同一个动作、同一颗控件:antd 的 type="text" 图标按钮
|
||||
(悬停底、按压、焦点环、图标尺寸全部来自 Button token),
|
||||
页面只负责把它钉在右上角。以前这里是一颗自绘胶囊,和顶栏长得不一样。 */}
|
||||
<Button type="text" onClick={() => setTheme(isLight ? 'dark' : 'light')}
|
||||
icon={isLight ? <IconSun /> : <IconMoon />}
|
||||
className="fixed right-5 top-[14px]"
|
||||
className="fixed right-5 top-4"
|
||||
aria-label={'切换明暗主题,当前为' + (isLight ? '浅色' : '深色')}
|
||||
title={'显示模式:' + (isLight ? '浅色' : '深色')} />
|
||||
|
||||
<form className="w-[min(392px,100%)] rounded-lg border border-border-secondary bg-bg-container px-6 pb-6 pt-6 shadow-[0_24px_60px_var(--ant-color-fill-secondary)]" onSubmit={submit}>
|
||||
<div className="flex items-center gap-2.5 pb-5 text-xs font-bold tracking-wide text-text-secondary">
|
||||
<b aria-hidden="true" className="grid h-[37px] w-[37px] place-items-center rounded-lg bg-primary text-lg text-on-primary">N</b>
|
||||
<form className="w-[min(400px,100%)]" onSubmit={submit}>
|
||||
<Panel>
|
||||
<Row gap={10} className="min-w-0 text-xs font-bold text-text-secondary">
|
||||
<Mark size={36}>N</Mark>
|
||||
<span>长视频编导平台</span>
|
||||
</div>
|
||||
</Row>
|
||||
|
||||
<h1 className="mb-5 mt-0 text-xl font-bold" title="账号决定你能做什么:管理员管模型与账号,制作可以跑生产,观摩只读。">登录以继续</h1>
|
||||
<Heading level={3} className="!mb-5 !mt-4"
|
||||
title="账号决定你能做什么:管理员管模型与账号,制作可以跑生产,观摩只读。">登录以继续</Heading>
|
||||
|
||||
{params.get('loggedOut') === '1' && <Notice className="mb-1">已退出登录。</Notice>}
|
||||
{offline && <Notice danger className="mb-1">后端连接不上:{connError || '请确认服务已启动'}</Notice>}
|
||||
|
|
@ -91,10 +103,11 @@ export default function Login() {
|
|||
onKeyUp={(e) => { if (e.key === 'Enter') void submit() }} />
|
||||
</FieldBlock>
|
||||
|
||||
<Button htmlType="submit" type="primary" size="lg" disabled={busy} className="mt-4 w-full">
|
||||
<Button icon={<IconUser />} htmlType="submit" type="primary" size="lg" disabled={busy} className="mt-4 w-full">
|
||||
{busy ? '正在验证…' : '登录'}
|
||||
</Button>
|
||||
<p className="mt-4 mb-0 text-center text-xs text-text-quaternary">忘记密码请联系平台管理员在「用户管理」里重置。</p>
|
||||
<Value muted className="mt-4 block text-center">忘记密码请联系平台管理员在「用户管理」里重置。</Value>
|
||||
</Panel>
|
||||
</form>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ import { fmtAgo, fmtSeconds } from '../lib/format'
|
|||
import { useAutoRefresh } from '../hooks'
|
||||
import { cn } from '../lib/cn'
|
||||
import { EyeIcon, SecretInput, Select } from '../components/forms'
|
||||
import { Between, Button, CardActions, Check, Chip, ChipBar, Ctlbar, Drawer, Empty, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, LinkButton, MONO, MUTED, Notice, NumberInput, PageHead, Panel, PanelHead, Row, SectionTitle, Slider, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea } from '../components/ui'
|
||||
import { Between, Block, Button, CardActions, Check, Chip, ChipBar, Ctlbar, Dense, Drawer, Empty, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, Layout, LinkButton, MONO, MUTED, Notice, NumberInput, PageHead, Panel, PanelHead, Row, SearchInput, SectionTitle, Slider, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, Value } from '../components/ui'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
import { useProjectStore } from '../stores/project'
|
||||
import { IconAdd, IconBolt, IconChart, IconCheck, IconClose, IconGrid, IconImage, IconPlayCircle, IconVoice, IconWarn } from '../components/icons'
|
||||
import { IconAdd, IconBolt, IconChart, IconCheck, IconChevronUp, IconClose, IconDelete, IconGrid, IconImage, IconNodeIndex, IconParams, IconPlayCircle, IconReload, IconVoice, IconWarn } from '../components/icons'
|
||||
/** /api/providers 还没回来(或后端挂了这个接口)时左栏仍要能渲染 */
|
||||
const FALLBACK_TYPES = ['llm', 'video', 'image', 'tts']
|
||||
|
||||
|
|
@ -515,7 +515,7 @@ export default function ModelCenter() {
|
|||
title={<span title="本地 H3、Qwen-Image 与 IndexTTS2 共用一张 GPU;大模型通过 OpenAI 兼容接口接入。配置按能力拆分,密钥只加密保存并以掩码回显。">模型控制台</span>}
|
||||
actions={<>
|
||||
{dispatchLink && (
|
||||
<LinkButton to={dispatchLink}>任务调度</LinkButton>
|
||||
<LinkButton icon={<IconNodeIndex />} to={dispatchLink}>任务调度</LinkButton>
|
||||
)}
|
||||
<Button type="primary" onClick={addModel} icon={<IconAdd />}>添加{rail(selectedType).label}</Button>
|
||||
</>}
|
||||
|
|
@ -569,15 +569,15 @@ export default function ModelCenter() {
|
|||
|
||||
<section className="min-w-0">
|
||||
<Panel className="bg-bg-container">
|
||||
{/* 同项目总览:卡头右端只放计数,筛选条放正文(见 Dashboard 同处注释) */}
|
||||
<PanelHead
|
||||
title={<span title={selectedMeta?.description}>{selectedMeta?.label}</span>}
|
||||
right={
|
||||
<Ctlbar className="mb-0">
|
||||
<Field label="搜索" width="grow">
|
||||
<Input value={keyword} aria-label="搜索模型" placeholder="名称 / 模型标识 / 编码" onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
} />
|
||||
right={<Value>{currentRows.length} / {countOf(selectedType)} 个配置</Value>} />
|
||||
<Ctlbar className="mb-3">
|
||||
<Field inline label="搜索" width="grow">
|
||||
<SearchInput value={keyword} aria-label="搜索模型" placeholder="名称 / 模型标识 / 编码" onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
|
||||
{!currentRows.length
|
||||
? <Empty>当前能力还没有配置。添加后即可在资产生成、分镜与调度中选择。</Empty>
|
||||
|
|
@ -595,7 +595,7 @@ export default function ModelCenter() {
|
|||
)}
|
||||
|
||||
{probe && (
|
||||
<div className="mt-3 p-3 rounded-lg border border-primary-border bg-bg-container min-w-0">
|
||||
<Block tone="info" vertical className="mt-3 w-full">
|
||||
<Between>
|
||||
<Row>
|
||||
<Tag tone={(probe.reachable ?? probe.available) ? 'ok' : 'bad'}>
|
||||
|
|
@ -605,9 +605,9 @@ export default function ModelCenter() {
|
|||
</Tag>
|
||||
<b>{probe.model.display_name || probe.model.model}</b>
|
||||
</Row>
|
||||
<Button size="sm" onClick={() => setProbe(null)}>关闭</Button>
|
||||
<Button icon={<IconClose />} onClick={() => setProbe(null)}>关闭</Button>
|
||||
</Between>
|
||||
<p className="my-2 text-text-tertiary text-xs leading-normal">{probe.message || '—'}</p>
|
||||
<Value>{probe.message || '—'}</Value>
|
||||
{probe.queue && (
|
||||
<TagGroup>
|
||||
<Tag tone={probe.queue.running ? 'info' : 'default'}>运行 {probe.queue.running}</Tag>
|
||||
|
|
@ -624,16 +624,16 @@ export default function ModelCenter() {
|
|||
{probe.files && (
|
||||
<div className="flex flex-col gap-1 mt-3 min-w-0">
|
||||
{Object.entries(probe.files).map(([kind, items]) => (
|
||||
<div key={kind} className="grid gap-2 grid-cols-[80px_minmax(0,1fr)] min-w-0">
|
||||
<span className="text-text-quaternary text-xs uppercase">{kind}</span>
|
||||
<Row key={kind} className="items-baseline">
|
||||
<span className="w-20 flex-none text-text-quaternary text-xs uppercase">{kind}</span>
|
||||
<code className="text-text-tertiary text-xs min-w-0 [overflow-wrap:anywhere]">
|
||||
{((items as any[]) || []).slice(0, 8).join(' · ') || '—'}
|
||||
</code>
|
||||
</div>
|
||||
</Row>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Block>
|
||||
)}
|
||||
</Panel>
|
||||
</section>
|
||||
|
|
@ -643,8 +643,8 @@ export default function ModelCenter() {
|
|||
actions={<>
|
||||
{/* 浮层底部口径:辅助提示(mr-auto) → 取消 → 主行动。见 Overlay.DRAWER_ACTIONS 注释。 */}
|
||||
{busy && <span className={cn('mr-auto inline-flex items-center gap-1.5', MUTED)}><Spinner /> {busy}…</span>}
|
||||
<Button onClick={closeForm}>取消</Button>
|
||||
<Button htmlType="submit" form={FORM_ID} type="primary" disabled={!!busy}>
|
||||
<Button icon={<IconClose />} onClick={closeForm}>取消</Button>
|
||||
<Button icon={<IconCheck />} htmlType="submit" form={FORM_ID} type="primary" disabled={!!busy}>
|
||||
{editingId ? '保存配置' : '创建模型'}
|
||||
</Button>
|
||||
</>}>
|
||||
|
|
@ -831,20 +831,20 @@ export default function ModelCenter() {
|
|||
<TextArea rows={2} placeholder="模型约束、显存策略或接入说明" value={form.notes} onChange={(e) => patch({ notes: e.target.value })} />
|
||||
</FieldBlock>
|
||||
|
||||
<Button onClick={toggleAdvanced}
|
||||
<Button icon={<IconChevronUp />} onClick={toggleAdvanced}
|
||||
className="w-full mt-5 h-8 border-dashed text-xs">
|
||||
{showAdvanced ? '收起高级 JSON' : '展开高级 JSON / 原始适配器参数'}
|
||||
</Button>
|
||||
{showAdvanced && (
|
||||
/* 两块的比例是本页特有的(config 比 default_params 长得多),栅格本身仍是栅格 */
|
||||
<div className="grid gap-3 grid-cols-[1.3fr_1fr] max-lg:grid-cols-1 mt-3 min-w-0 [&>*]:min-w-0">
|
||||
/* 比例是本页特有的(config 比 default_params 长得多),但栅格仍是 antd 的那一套 */
|
||||
<Layout spans={[14, 10]} oneAt="lg" gutter={12} className="mt-3">
|
||||
<FieldBlock label="config JSON">
|
||||
<TextArea rows={8} spellCheck={false} className={MONO} value={form.extra_config} onChange={(e) => patch({ extra_config: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="default_params JSON">
|
||||
<TextArea rows={6} spellCheck={false} className={MONO} value={form.extra_params} onChange={(e) => patch({ extra_params: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</div>
|
||||
</Layout>
|
||||
)}
|
||||
</DrawerSection>
|
||||
</FormGrid>
|
||||
|
|
@ -903,19 +903,16 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
const shown = revealed || keyLabel(row)
|
||||
const eyeTitle = revealed ? '隐藏密钥' : !canReveal ? '密钥明文仅管理员可查看' : '显示密钥:读取已保存的明文'
|
||||
return (
|
||||
<article className={cn('flex flex-col min-h-[230px] p-4 min-w-0 rounded-lg border border-fill',
|
||||
'bg-[linear-gradient(145deg,var(--ant-color-bg-container),var(--ant-color-bg-layout))] '
|
||||
+ 'transition-[border-color,transform] duration-150 hover:border-border hover:-translate-y-px',
|
||||
!row.enabled && 'opacity-60')}>
|
||||
<Dense className="contents">
|
||||
<Tile as="div" variant="pick"
|
||||
className={cn('min-h-[230px] flex-col items-stretch gap-0 p-4', !row.enabled && 'opacity-60')}>
|
||||
<div className="flex items-start gap-2.5 min-w-0">
|
||||
<div className={cn('grid place-items-center w-9 h-9 flex-none rounded-lg bg-split text-xl', meta.color)}>
|
||||
{meta.icon}
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-1.5 flex-wrap">
|
||||
<h3 className="m-0 text-sm font-semibold max-w-full overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
{row.display_name || row.model}
|
||||
</h3>
|
||||
<b className="truncate text-sm">{row.display_name || row.model}</b>
|
||||
{row.is_default && (
|
||||
<Tag tone="accent" className="bg-primary border-primary text-on-primary font-bold">默认</Tag>
|
||||
)}
|
||||
|
|
@ -929,11 +926,11 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
{row.provider} · {row.model_code || '未设置编码'} · {row.adapter}
|
||||
</div>
|
||||
</div>
|
||||
<Button size="sm" onClick={onEdit}>配置</Button>
|
||||
<Button icon={<IconParams />} onClick={onEdit}>配置</Button>
|
||||
</div>
|
||||
|
||||
{/* 密钥默认只有掩码;展开明文后允许换行 —— 密钥 40+ 字符,省略号等于没显示 */}
|
||||
<div className="mt-3 py-2 px-3 rounded-lg min-w-0 bg-bg-container border border-split">
|
||||
<Block tone="default" vertical gap={0} className="mt-3 min-w-0">
|
||||
<span className="block text-text-quaternary text-xs">{row.media_type === 'llm' ? 'Endpoint / Key' : '资源地址 / 参考'}</span>
|
||||
<div className="flex items-center gap-1.5 mt-1 min-w-0">
|
||||
<b title={shown}
|
||||
|
|
@ -945,15 +942,15 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
与这一行 19px 高的掩码文字同高,不会把行顶开)。
|
||||
显隐状态由图形本身表达(睁眼 / 斜线眼 / 转圈),不另设选中色。 */}
|
||||
{row.has_api_key && (
|
||||
<Button type="text" size="sm" shape="circle" onClick={onReveal} disabled={revealing}
|
||||
<Button type="text" shape="circle" onClick={onReveal} disabled={revealing}
|
||||
aria-label={eyeTitle} title={eyeTitle}
|
||||
icon={<EyeIcon shown={!!revealed} loading={revealing} size={14} />} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Block>
|
||||
|
||||
{files.length > 0 && (
|
||||
<div className="flex flex-col gap-1 mt-2 min-w-0">
|
||||
<div className="mt-2 flex min-w-0 flex-col gap-1">
|
||||
{files.slice(0, 3).map((file) => (
|
||||
<span key={file} title={file} className={cn(MONO, 'block text-text-quaternary text-xs overflow-hidden text-ellipsis whitespace-nowrap')}>
|
||||
{file}
|
||||
|
|
@ -963,7 +960,7 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
)}
|
||||
|
||||
{/* 这些是「这张卡是什么配置」的只读标签,不是可点的筛选项:用 Tag,不用 ChipBar / Chip */}
|
||||
<TagGroup size="sm">
|
||||
<TagGroup>
|
||||
{(row.modes || []).slice(0, 5).map((mode: string) => <Tag key={mode}>{mode}</Tag>)}
|
||||
{!!row.timeout_seconds && <Tag>超时 {row.timeout_seconds}s</Tag>}
|
||||
{!!row.max_concurrency && <Tag>并发 {row.max_concurrency}</Tag>}
|
||||
|
|
@ -971,9 +968,8 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
|
||||
{row.notes && <p className="mt-2 mb-0 text-text-quaternary text-xs leading-normal">{row.notes}</p>}
|
||||
|
||||
<div title="统计来自生成台账,为全平台累计(含历史项目与失败重试);只读,不影响配置"
|
||||
className={cn('mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 py-2 px-3 rounded-lg min-w-0 '
|
||||
+ 'border border-dashed border-border bg-bg-layout text-text-tertiary text-xs',
|
||||
<Block tone="default" gap={8} title="统计来自生成台账,为全平台累计(含历史项目与失败重试);只读,不影响配置"
|
||||
className={cn('mt-auto !border-dashed text-text-tertiary text-xs',
|
||||
!usage.calls && 'text-text-quaternary')}>
|
||||
<span className="text-primary"><IconChart /></span>
|
||||
{usageParts(row).map((part, idx) => (
|
||||
|
|
@ -984,22 +980,23 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
|
|||
</b>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</Block>
|
||||
|
||||
<CardActions className="min-w-0 border-t border-fill-secondary mt-auto pt-2">
|
||||
<Check checked={!!row.enabled} disabled={busy} className="mr-auto"
|
||||
onChange={() => onPatch({ enabled: !row.enabled }, row.enabled ? '停用模型' : '启用模型')}>
|
||||
启用
|
||||
</Check>
|
||||
<Button disabled={busy || !!row.is_default}
|
||||
<Button icon={<IconCheck />} disabled={busy || !!row.is_default}
|
||||
onClick={() => onPatch({ is_default: true }, '设为默认')}>
|
||||
{row.is_default ? '当前默认' : '设为默认'}
|
||||
</Button>
|
||||
<Button disabled={busy || probing} onClick={onProbe}>
|
||||
<Button icon={<IconReload />} disabled={busy || probing} onClick={onProbe}>
|
||||
{probing ? '探测中…' : '检测连接'}
|
||||
</Button>
|
||||
<Button type="text" danger disabled={busy} title="删除这个模型" onClick={onRemove}>删除</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger disabled={busy} title="删除这个模型" onClick={onRemove} aria-label="删除这个模型" />
|
||||
</CardActions>
|
||||
</article>
|
||||
</Tile>
|
||||
</Dense>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@
|
|||
* 项目工作台外壳:标题行 + 可折叠「项目概况」+ 各业务子页(<Outlet/>)。
|
||||
* 「页签」这个词从本轮起只指页面内部页签(UI规范 §6.4),路由级子页不叫页签——
|
||||
* 内容页没有外壳级页签条(§6.1)。
|
||||
*
|
||||
* 症状(本轮):这一层是全站唯一还留着裸 <header>/<h1> 和自绘折叠 Tile 的地方——
|
||||
* 八个项目子页共用它,于是每一页首屏都是「一段不属于任何卡片的横条 + 一屏概览」,
|
||||
* 正文被顶到折叠线以下,看着就是「这页没跟着改版」。
|
||||
* 做法:页头交还 kit 的 <PageHead>(Typography.Title + Flex),折叠条交还 <Toolbar>
|
||||
* (只有卡头的 Card),指标数字交还 kit 的 <Stat> + <i> 分母约定。
|
||||
*
|
||||
* GL-1:项目概况(4 张指标卡 + 12 节点流程条)在桌面端同样要能收起。
|
||||
* 以前只有 ≤900px 才折叠,正文被顶出首屏 ≈470px,每个子页都要先滚一屏废话。
|
||||
|
|
@ -13,11 +19,10 @@ import { Link, Outlet, useNavigate, useParams } from 'react-router-dom'
|
|||
import * as api from '../api/client'
|
||||
import { allNodesDone, stageNote } from '../lib/pipeline'
|
||||
import { fmtMoney, pct, statusLabel } from '../lib/format'
|
||||
import { cn } from '../lib/cn'
|
||||
import { Button, Empty, ErrorText, IconText, Loading, Notice, Panel, PanelHead, Stat, StatGrid, Status, Tag, Tile, Value } from '../components/ui'
|
||||
import { Button, Empty, ErrorText, IconText, LINK_CLS, Loading, Notice, PageHead, PageStack, Panel, PanelHead, Stat, StatGrid, Status, Tag, Toolbar, Value } from '../components/ui'
|
||||
import { WorkflowBar } from '../components/media/WorkflowBar'
|
||||
import { loadProject, startPolling, stopPolling, useBriefStore, useProjectStore } from '../stores/project'
|
||||
import { IconArrowBack, IconChevronDown, IconChevronUp, IconDelete } from '../components/icons'
|
||||
import { IconArrowBack, IconChevronDown, IconChevronUp, IconClose, IconDelete } from '../components/icons'
|
||||
|
||||
export default function ProjectDetail() {
|
||||
const { id: idParam } = useParams()
|
||||
|
|
@ -67,81 +72,87 @@ export default function ProjectDetail() {
|
|||
}
|
||||
|
||||
const st = stats || {}
|
||||
/* 折叠状态下这一行就是全部信息,所以它必须一直在:展开时是概览的摘要,
|
||||
收起时它就是那条紧凑横条(旧站用一个自绘 Tile 假扮卡头,见 K1/Toolbar)。 */
|
||||
const briefLine = `${statusLabel(project.status)} · 镜头 ${st.shots_approved || 0}/${st.shots || 0}`
|
||||
+ ` · 合格 ${pct(st.progress_ratio)} · 任务 ${st.tasks_active || 0}/${st.tasks || 0}`
|
||||
+ ` · 成本 ${fmtMoney(st.cost?.total_cost, st.cost?.currency)}`
|
||||
return (
|
||||
<div className="min-w-0">
|
||||
<header className="mb-6 flex flex-wrap items-center justify-between gap-3 min-w-0 max-lg:items-start">
|
||||
<div className="min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-2 min-w-0 max-lg:w-full">
|
||||
<Link to="/" className="text-primary text-xs no-underline hover:underline"><IconText icon={<IconArrowBack />}>项目总览</IconText></Link>
|
||||
<Status value={project.status} />
|
||||
{flowDone
|
||||
? <Tag tone="ok">{flowNote}</Tag>
|
||||
: <Tag tone="info">当前节点:{flowNote || project.stage_label}</Tag>}
|
||||
</div>
|
||||
<h1>{project.name}</h1>
|
||||
</div>
|
||||
{/* 项目状态由 project.ts 每 6 秒轮询,页面无需再单独刷新 */}
|
||||
<div className="flex flex-wrap items-center gap-2 max-lg:w-full max-lg:[&>button]:flex-1">
|
||||
<PageStack className="min-w-0">
|
||||
<PageHead
|
||||
title={project.name}
|
||||
meta={<>
|
||||
<Link to="/" className={LINK_CLS}><IconText icon={<IconArrowBack />}>项目总览</IconText></Link>
|
||||
<Status value={project.status} />
|
||||
{flowDone
|
||||
? <Tag tone="ok">{flowNote}</Tag>
|
||||
: <Tag tone="info">当前节点:{flowNote || project.stage_label}</Tag>}
|
||||
</>}
|
||||
/* 项目状态由 project.ts 每 6 秒轮询,页面无需再单独刷新 */
|
||||
actions={
|
||||
<Button type="text" danger title="删除整个项目:分镜、任务与已生成素材一起清除"
|
||||
onClick={() => setConfirming((v) => !v)} icon={<IconDelete />}>
|
||||
删除项目
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
}
|
||||
/>
|
||||
|
||||
<ErrorText className="mb-3">{error || storeError}</ErrorText>
|
||||
<ErrorText>{error || storeError}</ErrorText>
|
||||
|
||||
{confirming && (
|
||||
<Notice danger onClose={() => setConfirming(false)}>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 w-full min-w-0">
|
||||
<span className="min-w-0">删除《{project.name}》会同时清除分镜、任务与已生成素材,确认?</span>
|
||||
<div className="flex flex-wrap items-center gap-2 ">
|
||||
<Button size="sm" onClick={() => setConfirming(false)}>取消</Button>
|
||||
<Button type="primary" danger size="sm" onClick={removeProject}>确认删除</Button>
|
||||
<Button icon={<IconClose />} onClick={() => setConfirming(false)}>取消</Button>
|
||||
<Button icon={<IconDelete />} type="primary" danger onClick={removeProject}>确认删除</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Notice>
|
||||
)}
|
||||
|
||||
{/* 折叠条在所有断点都可用:收起后这一行本身就是紧凑摘要,正文直接顶到首屏 */}
|
||||
<Tile variant="bar" onClick={() => setSummaryOpen(!summaryOpen)} expanded={summaryOpen}
|
||||
className="mb-4 text-text-secondary">
|
||||
<span className="flex-none text-xs font-bold">项目概况</span>
|
||||
<small className="min-w-0 flex-1 truncate text-text-tertiary text-xs">
|
||||
{statusLabel(project.status)} · 镜头 {st.shots_approved || 0}/{st.shots || 0} · 合格 {pct(st.progress_ratio)}
|
||||
{' '}· 任务 {st.tasks_active || 0}/{st.tasks || 0} · 成本 {fmtMoney(st.cost?.total_cost, st.cost?.currency)}
|
||||
</small>
|
||||
<b className="flex-none whitespace-nowrap text-primary text-xs">
|
||||
<IconText icon={summaryOpen ? <IconChevronUp /> : <IconChevronDown />}>
|
||||
{/* 折叠条在所有断点都可用:收起后这一行本身就是紧凑摘要,正文直接顶到首屏。
|
||||
它是「一行卡头」,所以就是 Toolbar(antd Card 的 title/extra),不再用自绘 Tile。 */}
|
||||
<Toolbar
|
||||
info={<>
|
||||
<Tag tone="default">项目概况</Tag>
|
||||
<Value>{briefLine}</Value>
|
||||
</>}
|
||||
actions={
|
||||
<Button type="link" aria-expanded={summaryOpen} onClick={() => setSummaryOpen(!summaryOpen)}
|
||||
icon={summaryOpen ? <IconChevronUp /> : <IconChevronDown />}>
|
||||
{summaryOpen ? '收起概况' : '展开概况'}
|
||||
</IconText>
|
||||
</b>
|
||||
</Tile>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className={cn('min-w-0', summaryOpen ? 'mb-5' : 'hidden')}>
|
||||
<StatGrid cols={4}>
|
||||
<Stat label="镜头(合格/总数)"
|
||||
value={<>{st.shots_approved || 0}<span className="text-base text-text-quaternary"> / {st.shots || 0}</span></>}
|
||||
hint={`${statusLabel('failed')} ${st.shots_failed || 0} · ${st.shots_rejected || 0} 驳回`} />
|
||||
<Stat label="时长(计划/已生成)"
|
||||
value={<><span className="text-lg">{(st.planned_duration || 0).toFixed(1)}s</span>
|
||||
<span className="text-sm text-text-quaternary"> / {(st.generated_duration || 0).toFixed(1)}s</span></>}
|
||||
hint={`镜头合格进度 ${pct(st.progress_ratio)}`} />
|
||||
<Stat label="任务(活跃/总数)"
|
||||
value={<>{st.tasks_active || 0}<span className="text-base text-text-quaternary"> / {st.tasks || 0}</span></>}
|
||||
hint={taskHint || '暂无任务'} />
|
||||
<Stat label="成本 / 成片" value={<span className="text-lg">{fmtMoney(st.cost?.total_cost, st.cost?.currency)}</span>}
|
||||
hint={`${(st.exports || []).length} 个导出记录`} />
|
||||
</StatGrid>
|
||||
{summaryOpen && (
|
||||
<>
|
||||
<StatGrid cols={4}>
|
||||
{/* 「主数字 + 灰分母」走 kit Stat 的 <i> 约定(字号/颜色只定义一次),
|
||||
页面不再自己写 text-base text-text-quaternary 这套私有度量。 */}
|
||||
<Stat label="镜头(合格/总数)"
|
||||
value={<>{st.shots_approved || 0}<i>/ {st.shots || 0}</i></>}
|
||||
hint={`${statusLabel('failed')} ${st.shots_failed || 0} · ${st.shots_rejected || 0} 驳回`} />
|
||||
<Stat label="时长(计划/已生成)"
|
||||
value={<>{(st.planned_duration || 0).toFixed(1)}s<i>/ {(st.generated_duration || 0).toFixed(1)}s</i></>}
|
||||
hint={`镜头合格进度 ${pct(st.progress_ratio)}`} />
|
||||
<Stat label="任务(活跃/总数)"
|
||||
value={<>{st.tasks_active || 0}<i>/ {st.tasks || 0}</i></>}
|
||||
hint={taskHint || '暂无任务'} />
|
||||
<Stat label="成本 / 成片" value={fmtMoney(st.cost?.total_cost, st.cost?.currency)}
|
||||
hint={`${(st.exports || []).length} 个导出记录`} />
|
||||
</StatGrid>
|
||||
|
||||
<Panel className="mb-5">
|
||||
<PanelHead title="流程进度"
|
||||
right={nextStep ? <Value>下一步:{nextStep.label} — {nextStep.detail}</Value> : undefined} />
|
||||
<WorkflowBar workflow={workflow} />
|
||||
</Panel>
|
||||
</div>
|
||||
<Panel className="mb-0">
|
||||
<PanelHead title="流程进度"
|
||||
right={nextStep ? <Value>下一步:{nextStep.label} — {nextStep.detail}</Value> : undefined} />
|
||||
<WorkflowBar workflow={workflow} />
|
||||
</Panel>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="min-w-0"><Outlet /></div>
|
||||
</div>
|
||||
<Outlet />
|
||||
</PageStack>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@ import * as api from '../api/client'
|
|||
import { fmtAgo, fmtTime } from '../lib/format'
|
||||
import { useAutoRefresh } from '../hooks'
|
||||
import { SecretInput, Select } from '../components/forms'
|
||||
import { Actions, Badge, Button, Check, Ctlbar, Empty, ErrorText, Field, FieldBlock, FormRow, Input, Layout, MUTED, MUTED_MONO, PageHead, Panel, PanelHead, Stack, Stat, StatGrid, Sub, Table, TableBox, Tag, TextArea, cellRight } from '../components/ui'
|
||||
import { ActionGroup, Actions, Badge, Button, Check, Ctlbar, Empty, ErrorText, Field, FieldBlock, FormRow, Heading, Input, Layout, MUTED, MUTED_MONO, Mono, PageHead, Panel, PanelHead, SearchInput, Stack, Stat, StatGrid, Sub, Table, Tag, TextArea } from '../components/ui'
|
||||
import { notify, notifyBad } from '../stores/notice'
|
||||
import { roleLabel, useAuthStore } from '../stores/auth'
|
||||
import { IconAdd, IconCheck, IconKey, IconLogout, IconStop } from '../components/icons'
|
||||
|
||||
const FALLBACK_ROLES = ['admin', 'editor', 'viewer'].map((v) => ({ value: v, label: roleLabel(v) }))
|
||||
|
||||
|
|
@ -159,7 +160,10 @@ export default function UserAdmin() {
|
|||
<ErrorText className="mb-4 text-xs">{error}</ErrorText>
|
||||
|
||||
{/* 统计卡一共 5 项:给 5 列,别让第 5 张孤零零掉到第二行 */}
|
||||
<StatGrid cols={5} steps={[{ at: '2xl', cols: 3 }, { at: 'lg', cols: 2 }]}>
|
||||
{/* 症状:档位写成「≤1600 三列」,而 1440 正是最常见的宽度——5 张卡排成 3+2,
|
||||
右下角留一个空位,看着像少了一张卡。5 这一档本来就排得下(每张 ~214px,
|
||||
标签最长 6 个字),宽屏一列铺满,窄下去才降列。 */}
|
||||
<StatGrid cols={5} steps={[{ at: 'xl', cols: 3 }, { at: 'md', cols: 2 }, { at: 'sm', cols: 1 }]}>
|
||||
<Stat label="账号总数" value={counts.total ?? users.length} />
|
||||
<Stat label="管理员" value={counts.admins ?? 0} />
|
||||
<Stat label="已停用" value={counts.disabled ?? 0} />
|
||||
|
|
@ -172,42 +176,45 @@ export default function UserAdmin() {
|
|||
<Panel>
|
||||
<PanelHead title="账号列表" right={<Badge>{visible.length}</Badge>} />
|
||||
<Ctlbar>
|
||||
<Field label="搜索" width="grow">
|
||||
<Input value={keyword} placeholder="用户名 / 姓名 / 邮箱 / 备注" onChange={(e) => setKeyword(e.target.value)} />
|
||||
<Field inline label="搜索" width="grow">
|
||||
<SearchInput value={keyword} placeholder="用户名 / 姓名 / 邮箱 / 备注" onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
<Field label="角色" width="narrow">
|
||||
<Select size="sm" ariaLabel="按角色筛选" value={roleFilter} onChange={setRoleFilter}
|
||||
<Field inline label="角色" width="narrow">
|
||||
<Select ariaLabel="按角色筛选" value={roleFilter} onChange={setRoleFilter}
|
||||
options={[{ value: '', label: '全部角色' }, ...roleOptions]} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
<TableBox maxHeight={460}>
|
||||
<Table pickable minWidth={0}>
|
||||
<thead>
|
||||
<tr><th>账号</th><th>角色</th><th>状态</th><th>最近登录</th><th className={cellRight}>会话</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{visible.map((row) => (
|
||||
<tr key={row.id} data-chosen={row.id === selectedId || undefined} onClick={() => pick(row)}>
|
||||
<td>
|
||||
<b className="text-sm">{row.display_name || row.username}</b>
|
||||
<p className={`mt-1 mb-0 ${MUTED_MONO}`}>{row.username}{row.email ? ` · ${row.email}` : ''}</p>
|
||||
</td>
|
||||
<td><Tag tone={row.role === 'admin' ? 'info' : 'default'}>{row.role_label || roleLabel(row.role)}</Tag></td>
|
||||
<td>
|
||||
<Tag tone={row.is_active ? 'default' : 'bad'}>{row.is_active ? '正常' : '已停用'}</Tag>
|
||||
{row.must_change_password && <p className={`mt-1 mb-0 ${MUTED}`}>未改初始密码</p>}
|
||||
</td>
|
||||
<td>
|
||||
<span>{row.last_login_at ? fmtAgo(row.last_login_at) : '从未登录'}</span>
|
||||
<p className={`mt-1 mb-0 ${MUTED}`}>{row.login_count || 0} 次{row.last_login_ip ? ' · ' + row.last_login_ip : ''}</p>
|
||||
</td>
|
||||
<td className={cellRight}>{row.active_sessions || 0}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
{!visible.length && <Empty className="m-3 border-0">没有匹配的账号。</Empty>}
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={460}
|
||||
minWidth={0}
|
||||
onPick={pick}
|
||||
chosen={(row) => row.id === selectedId}
|
||||
empty={<Empty className="m-3 border-0">没有匹配的账号。</Empty>}
|
||||
columns={[
|
||||
{ title: '账号', key: 'name', render: (_: any, row: any) => (
|
||||
<>
|
||||
<b className="text-sm">{row.display_name || row.username}</b>
|
||||
<p className={`mt-1 mb-0 ${MUTED_MONO}`}>{row.username}{row.email ? ` · ${row.email}` : ''}</p>
|
||||
</>
|
||||
) },
|
||||
{ title: '角色', key: 'role', width: 96, render: (_: any, row: any) =>
|
||||
<Tag tone={row.role === 'admin' ? 'info' : 'default'}>{row.role_label || roleLabel(row.role)}</Tag> },
|
||||
{ title: '状态', key: 'state', width: 132, render: (_: any, row: any) => (
|
||||
<>
|
||||
<Tag tone={row.is_active ? 'default' : 'bad'}>{row.is_active ? '正常' : '已停用'}</Tag>
|
||||
{row.must_change_password && <p className={`mt-1 mb-0 ${MUTED}`}>未改初始密码</p>}
|
||||
</>
|
||||
) },
|
||||
{ title: '最近登录', key: 'login', width: 168, render: (_: any, row: any) => (
|
||||
<>
|
||||
<span>{row.last_login_at ? fmtAgo(row.last_login_at) : '从未登录'}</span>
|
||||
<p className={`mt-1 mb-0 ${MUTED}`}>{row.login_count || 0} 次{row.last_login_ip ? ' · ' + row.last_login_ip : ''}</p>
|
||||
</>
|
||||
) },
|
||||
{ title: '会话', key: 'sessions', width: 72, align: 'right', render: (_: any, row: any) => row.active_sessions || 0 }
|
||||
]}
|
||||
dataSource={visible}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel>
|
||||
|
|
@ -233,7 +240,7 @@ export default function UserAdmin() {
|
|||
<Input value={create.note} maxLength={200} placeholder="例如:外包配音,仅本项目" onChange={(e) => setCreate((f) => ({ ...f, note: e.target.value }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Actions><Button type="primary" disabled={!!busy} onClick={createUser}>创建账号</Button></Actions>
|
||||
<Actions><Button icon={<IconAdd />} type="primary" disabled={!!busy} onClick={createUser}>创建账号</Button></Actions>
|
||||
</Panel>
|
||||
|
||||
<Panel>
|
||||
|
|
@ -244,10 +251,10 @@ export default function UserAdmin() {
|
|||
<div className="flex max-h-[320px] flex-col gap-0.5 overflow-auto scrollbar-slim">
|
||||
{audit.map((row) => (
|
||||
<div key={row.id}
|
||||
className="grid grid-cols-[132px_74px_minmax(0,1fr)] items-baseline gap-2 border-b border-border-secondary px-0.5 py-2 text-xs last:border-b-0">
|
||||
<span className={`${MUTED_MONO} text-xs`}>{fmtTime(row.created_at)}</span>
|
||||
<span className="font-semibold text-primary-hover [overflow-wrap:anywhere]">{row.actor || 'system'}</span>
|
||||
<span className="text-text-secondary [overflow-wrap:anywhere]">{row.message}</span>
|
||||
className="flex items-baseline gap-2 border-b border-border-secondary px-0.5 py-2 text-xs last:border-b-0 max-sm:flex-wrap">
|
||||
<Mono className="flex-none">{fmtTime(row.created_at)}</Mono>
|
||||
<span className="w-[74px] flex-none font-semibold text-primary-hover [overflow-wrap:anywhere]">{row.actor || 'system'}</span>
|
||||
<span className="min-w-0 flex-1 text-text-secondary [overflow-wrap:anywhere]">{row.message}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -280,23 +287,27 @@ export default function UserAdmin() {
|
|||
<TextArea rows={2} maxLength={200} value={edit.note} onChange={(e) => setEdit((f) => ({ ...f, note: e.target.value }))} />
|
||||
</FieldBlock>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy} onClick={saveEdit}>保存</Button>
|
||||
<Button disabled={!!busy || !selected.is_active} onClick={disable}>停用账号</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={saveEdit}>保存</Button>
|
||||
<Button icon={<IconStop />} disabled={!!busy || !selected.is_active} onClick={disable}>停用账号</Button>
|
||||
</Actions>
|
||||
|
||||
<Sub>
|
||||
<h3>重置密码</h3>
|
||||
<Heading level={5} className="!mb-3 !mt-0">重置密码</Heading>
|
||||
<FieldBlock label="新密码" required>
|
||||
<SecretInput value={reset.password} maxLength={200} autocomplete="new-password" placeholder="留空不可提交"
|
||||
onChange={(v) => setReset((f) => ({ ...f, password: v }))} />
|
||||
</FieldBlock>
|
||||
{/* 这两条是「重置时顺带做什么」的两个选项:竖排等宽,
|
||||
而不是在窄侧栏里被折成一行一个、行宽还各不同 */}
|
||||
<Ctlbar>
|
||||
<Check checked={reset.must_change} onChange={(v) => setReset((f) => ({ ...f, must_change: v }))}>要求该账号下次登录改密</Check>
|
||||
<Check checked={reset.revoke_sessions} onChange={(v) => setReset((f) => ({ ...f, revoke_sessions: v }))}>同时注销该账号全部会话</Check>
|
||||
<ActionGroup stack className="w-full">
|
||||
<Check checked={reset.must_change} onChange={(v) => setReset((f) => ({ ...f, must_change: v }))}>要求该账号下次登录改密</Check>
|
||||
<Check checked={reset.revoke_sessions} onChange={(v) => setReset((f) => ({ ...f, revoke_sessions: v }))}>同时注销该账号全部会话</Check>
|
||||
</ActionGroup>
|
||||
</Ctlbar>
|
||||
<Actions>
|
||||
<Button disabled={!!busy || !reset.password} onClick={resetPassword}>重置密码</Button>
|
||||
<Button disabled={!!busy} onClick={kickSessions}>仅注销会话</Button>
|
||||
<Button icon={<IconKey />} disabled={!!busy || !reset.password} onClick={resetPassword}>重置密码</Button>
|
||||
<Button icon={<IconLogout />} disabled={!!busy} onClick={kickSessions}>仅注销会话</Button>
|
||||
</Actions>
|
||||
</Sub>
|
||||
</Panel>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ import { notify } from '../../stores/notice'
|
|||
import { useProjectStore } from '../../stores/project'
|
||||
import { loadModels } from '../../stores/models'
|
||||
import { Select } from '../../components/forms'
|
||||
import { BarRight, Between, Button, Check, Chip, Ctlbar, DisclosureRow, ErrorText, Field, LinkButton, MONO, MUTED, Mono, Row, Tag, TextArea, TILE_HINT, Value } from '../../components/ui'
|
||||
import { IconCheck, IconChevronRight, IconClose } from '../../components/icons'
|
||||
import { Between, Block, Button, Check, Chip, ChipBar, DisclosureRow, Empty, Field, FieldBlock, FormGrid, FormRow, Heading, Layout, LinkButton, LiveDot, Mark, MUTED, Mono, Notice, Panel, Paragraph, Row, Tag, TextArea, TILE_HINT, Value } from '../../components/ui'
|
||||
import { IconAudit, IconCheck, IconChevronRight, IconClose, IconNodeIndex, IconPlay, IconRetry, IconRobot, IconStoryboard } from '../../components/icons'
|
||||
/** 计划里的一步(白名单动作),status: pending/running/succeeded/skipped/failed */
|
||||
type AgentStep = {
|
||||
action: string
|
||||
|
|
@ -99,12 +99,14 @@ const STATUS_TONES: Record<string, 'default' | 'ok' | 'bad' | 'warn' | 'info'> =
|
|||
succeeded: 'ok', failed: 'bad', cancelled: 'default'
|
||||
}
|
||||
|
||||
/** 阻塞 / 风险 / 提示三种配色的说明块共用一套骨架 */
|
||||
const CALLOUT = 'mt-3 py-3 px-3 border border-primary-border rounded-lg bg-primary-bg'
|
||||
const CALLOUT_TITLE = 'text-xs tracking-wide'
|
||||
const CALLOUT_TEXT = 'mt-1 mb-0 text-text-tertiary text-xs leading-normal'
|
||||
const CALLOUT_EMPTY = 'p-5 border border-dashed border-border rounded-lg text-text-quaternary '
|
||||
+ 'text-xs leading-relaxed text-center'
|
||||
/**
|
||||
* 步骤块的状态配色:一档一色交给 kit 的 Block(antd 的 success/warning/error 语义色族),
|
||||
* 页面不再自己拼「绿描边 + primary 底」——主色还是柠檬绿时两种色相看不出冲突,
|
||||
* 换成标准蓝就露出两条蓝底红边。pending / skipped 落 Block 的 default 灰底。
|
||||
*/
|
||||
const STEP_TONE: Record<string, 'ok' | 'warn' | 'bad'> = {
|
||||
succeeded: 'ok', running: 'warn', failed: 'bad'
|
||||
}
|
||||
|
||||
/** planning 记录的起点时间:刷新页面后计时要继续接着走,不能从 0 重来 */
|
||||
function planningSeconds(row: AgentRun | null) {
|
||||
|
|
@ -188,16 +190,13 @@ function Scanline() {
|
|||
return <div aria-hidden className="absolute left-[9%] right-[9%] top-0 h-px opacity-45 animate-agent-scan bg-[linear-gradient(90deg,transparent,var(--ant-color-primary),transparent)]" />
|
||||
}
|
||||
|
||||
/* 多段渐变背景各自保持成一个完整字面量:Tailwind 只扫描源码里连续出现的候选串,
|
||||
/* 剩下的渐变只服务三处**动效/氛围**(规划中、空态、模型回复块),不再是版式:
|
||||
卡底、卡头、栅格已经全是 antd Card / Row·Col,这里再铺一层底纹只会和它打架。
|
||||
多段渐变各自保持成一个完整字面量:Tailwind 只扫描源码里连续出现的候选串,
|
||||
一条类名被字符串拼接劈成两半就永远不会被生成。 */
|
||||
const CONSOLE_BG = 'bg-[radial-gradient(circle_at_88%_-20%,color-mix(in_srgb,var(--ant-color-primary)_16%,transparent),transparent_34%),radial-gradient(circle_at_10%_130%,var(--ant-color-primary-bg),transparent_40%),linear-gradient(135deg,var(--ant-color-bg-container)_0%,var(--ant-color-bg-container)_54%,var(--ant-color-primary-bg)_100%)]'
|
||||
const MARK_BG = 'bg-[linear-gradient(145deg,var(--ant-color-primary),var(--ant-color-primary-active))]'
|
||||
const MARK_GLOW = 'shadow-[0_0_28px_color-mix(in_srgb,var(--ant-color-primary)_20%,transparent)]'
|
||||
const PULSE_GLOW = 'shadow-[0_0_0_0_color-mix(in_srgb,var(--ant-color-primary)_60%,transparent)]'
|
||||
const THINKING_BG = 'bg-[radial-gradient(circle_at_50%_0%,var(--ant-color-primary-bg),transparent_62%),repeating-radial-gradient(circle_at_center,transparent_0_25px,color-mix(in_srgb,var(--ant-color-primary)_4%,transparent)_26px_27px)]'
|
||||
const HERO_BG = 'bg-[radial-gradient(circle_at_center,color-mix(in_srgb,var(--ant-color-primary)_8%,transparent),transparent_55%),repeating-radial-gradient(circle_at_center,transparent_0_25px,color-mix(in_srgb,var(--ant-color-primary)_4%,transparent)_26px_27px)]'
|
||||
const FADE_BG = 'bg-[linear-gradient(to_bottom,transparent,color-mix(in_srgb,var(--ant-color-bg-container)_92%,transparent))]'
|
||||
const REPLY_BG = 'bg-[color-mix(in_srgb,var(--ant-color-primary)_6%,transparent)]'
|
||||
|
||||
/**
|
||||
* 规划中的渐进清单。
|
||||
|
|
@ -231,7 +230,7 @@ function Thinking({ planSeconds, thinking, thinkingLabel, autoExecute, planMarks
|
|||
: thinking === 'low' ? '有限思考通常 5~20 秒' : '关思考通常 3~8 秒'};期间页面不会推进,属正常现象。
|
||||
</p>
|
||||
<Row className="mt-1 mb-2 gap-3">
|
||||
<Button size="sm" disabled={!!busy} onClick={onCancel}>取消这次规划</Button>
|
||||
<Button icon={<IconClose />} size="sm" disabled={!!busy} onClick={onCancel}>取消这次规划</Button>
|
||||
<span className="text-text-quaternary text-xs">记录已落库,刷新页面也会继续显示进度</span>
|
||||
</Row>
|
||||
<ol className="mt-4 p-0 list-none grid gap-2">
|
||||
|
|
@ -526,109 +525,110 @@ export default function AgentConsole() {
|
|||
}
|
||||
|
||||
return (
|
||||
<section className={cn('animate-agent-in relative min-w-0 overflow-hidden mb-5 rounded-lg border border-border p-5 shadow-[0_18px_55px_var(--ant-color-fill-tertiary)] max-[620px]:p-4 max-[620px]:rounded-lg', CONSOLE_BG)}>
|
||||
{/* 控制台底纹(旧 .agent-console::before):mask 要带 -webkit 前缀,
|
||||
用内联样式一次写清,比在类名里叠四条 arbitrary 好读。 */}
|
||||
<div aria-hidden className="pointer-events-none absolute inset-0 opacity-16"
|
||||
style={{
|
||||
backgroundImage: 'linear-gradient(color-mix(in srgb, var(--ant-color-primary) 8%, transparent) 1px, transparent 1px),'
|
||||
+ 'linear-gradient(90deg, color-mix(in srgb, var(--ant-color-primary) 8%, transparent) 1px, transparent 1px)',
|
||||
backgroundSize: '32px 32px',
|
||||
maskImage: 'linear-gradient(90deg, black, transparent 70%)',
|
||||
WebkitMaskImage: 'linear-gradient(90deg, black, transparent 70%)'
|
||||
}} />
|
||||
|
||||
<div className="relative z-[1] flex items-start justify-between gap-5 border-b border-split pb-4 min-w-0 max-[620px]:flex-col max-[620px]:items-start">
|
||||
<div className="flex items-center gap-3 min-w-0">
|
||||
<div className={cn('grid place-items-center w-[45px] h-[45px] flex-none rounded-lg text-on-primary text-2xl font-extrabold', MARK_BG, MARK_GLOW)}>
|
||||
N
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<h2 className="mt-0 mb-0 text-lg font-bold"
|
||||
title="用一句话下达目标。系统 LLM 负责诊断与排程,平台只执行已确认的白名单步骤。">
|
||||
项目总控台
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-text-tertiary text-xs whitespace-nowrap max-[620px]:whitespace-normal">
|
||||
{latest
|
||||
? <Tag tone="info" className="font-mono">{latest.provider}/{latest.model}</Tag>
|
||||
: <Tag>读取默认 LLM</Tag>}
|
||||
<span className={cn('w-[7px] h-[7px] flex-none rounded-full bg-border',
|
||||
isRunning && cn('bg-primary animate-agent-pulse', PULSE_GLOW))} />
|
||||
<span>{busy || (isRunning ? '调度进行中' : '等待指令')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative z-[1] grid min-w-0 grid-cols-[minmax(290px,.82fr)_minmax(0,1.45fr)] gap-5 pt-5 max-lg:grid-cols-1">
|
||||
/*
|
||||
* 症状(用户截图 1):这一整块是**自绘的**——`<section>` 上叠了三层渐变底纹 +
|
||||
* 一层 32px 网格 mask + 一条 55px 投影;「任务指令」是裸 `<label>`;
|
||||
* 快捷指令是一排自绘小 Button;深度思考/单步超时用 `Ctlbar + Field width="narrow"`
|
||||
* 排在复选框后面,标签在上、控件在右下,和上方 textarea 的对齐关系完全断开。
|
||||
* 本质是「antd 控件贴在旧版式上」,正是这一轮要清掉的东西。
|
||||
* 做法:外壳=Panel(antd Card),卡头用 Card 自己的 title/extra(标记=Avatar、
|
||||
* 运行指示=Badge status);两栏=kit 的 Layout(antd Row/Col,lg 折单列);
|
||||
* 左栏一整个 FormGrid——任务指令 FieldBlock(高度交给 autoSize,不再 min-h-[118px])、
|
||||
* 快捷指令 ChipBar+Chip(可点的东西属于标签选择这一族,不是按钮)、
|
||||
* 深度思考/单步超时 FormRow cols=2、执行策略 Field 装两个复选框、
|
||||
* 底部一颗主按钮 + 快捷键说明。底纹、投影、网格 mask 整层删除。
|
||||
* 为什么不再留一点"控制台味":那一层渐变只在深色主题下成立,
|
||||
* 浅色主题里它把正文压成灰底(截图 1 就是浅色档),而 Card 的两套主题都是 antd 调好的。
|
||||
*/
|
||||
<Panel className="animate-agent-in mb-5"
|
||||
title={<Row gap={10} className="min-w-0">
|
||||
<Mark>N</Mark>
|
||||
<span title="用一句话下达目标。系统 LLM 负责诊断与排程,平台只执行已确认的白名单步骤。">
|
||||
项目总控台
|
||||
</span>
|
||||
</Row>}
|
||||
extra={<Row gap={8} className="text-xs text-text-tertiary max-[620px]:!justify-start">
|
||||
{latest
|
||||
? <Tag tone="info" className="font-mono">{latest.provider}/{latest.model}</Tag>
|
||||
: <Tag>读取默认 LLM</Tag>}
|
||||
<LiveDot on={!!isRunning} />
|
||||
<span>{busy || (isRunning ? '调度进行中' : '等待指令')}</span>
|
||||
</Row>}>
|
||||
<Layout side="left" spans={[9, 15]} oneAt="lg" gutter={24}>
|
||||
{/* ── 左:下达指令 ─────────────────────────────────────────── */}
|
||||
<div className="min-w-0 pr-5 border-r border-split max-lg:pr-0 max-lg:pb-5 max-lg:border-r-0 max-lg:border-b max-lg:border-split">
|
||||
<label className="block m-0 mb-2 text-text-secondary text-xs font-bold tracking-wider" htmlFor="agent-command">
|
||||
任务指令
|
||||
</label>
|
||||
<TextArea id="agent-command" ref={taRef} rows={5} value={message} onChange={(e) => setMessage(e.target.value)} onKeyDown={(e) => {
|
||||
if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
void planAgent()
|
||||
}
|
||||
}} placeholder="例如:把当前分镜完整生成到成片;质检合格后自动放行,已有产物不要重复生成。" className="w-full min-h-[118px] resize-y px-4 py-3 border-primary-border bg-bg-layout leading-relaxed" />
|
||||
<div className="flex flex-wrap gap-1.5 mt-2 min-w-0">
|
||||
<FormGrid>
|
||||
<FieldBlock label="任务指令" title="写目标,不用写步骤:范围、顺序、跳过哪些已有产物,由 LLM 判断。">
|
||||
<TextArea id="agent-command" ref={taRef} autoSize={{ minRows: 4, maxRows: 10 }}
|
||||
value={message} onChange={(e) => setMessage(e.target.value)} onKeyDown={(e) => {
|
||||
if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
void planAgent()
|
||||
}
|
||||
}} placeholder="例如:把当前分镜完整生成到成片;质检合格后自动放行,已有产物不要重复生成。" />
|
||||
</FieldBlock>
|
||||
|
||||
{/* 快捷指令是可点的模板,属于「标签选择」而不是动作按钮:
|
||||
点亮态就是「框里现在装的正是这条」,点一下原样填回输入框。 */}
|
||||
<ChipBar label="常用指令" className="-mt-3 mb-2">
|
||||
{PRESETS.map((preset) => (
|
||||
<Button key={preset.label} size="sm" title={preset.text}
|
||||
className="text-text-tertiary" onClick={() => setMessage(preset.text)}>
|
||||
<Chip key={preset.label} title={preset.text}
|
||||
active={message.trim() === preset.text}
|
||||
onClick={() => setMessage(preset.text)}>
|
||||
{preset.label}
|
||||
</Button>
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
</ChipBar>
|
||||
|
||||
<Ctlbar className="mt-3 mb-2 gap-x-4">
|
||||
<Check checked={autoExecute} onChange={setAutoExecute} className="text-text-secondary">
|
||||
计划生成后立即执行
|
||||
</Check>
|
||||
<Check checked={autoApprove} onChange={setAutoApprove} className="text-text-secondary">
|
||||
质检合格后允许 AI 代审
|
||||
</Check>
|
||||
<BarRight className="gap-3">
|
||||
<Field label="深度思考" width="narrow">
|
||||
<Select size="sm" value={thinking} onChange={(v) => setThinking(v)} options={THINKING_OPTIONS} />
|
||||
</Field>
|
||||
<Field label="单步超时" width="narrow">
|
||||
<Select size="sm" value={timeoutSec} onChange={(v) => setTimeoutSec(v)} options={TIMEOUT_OPTIONS} />
|
||||
</Field>
|
||||
</BarRight>
|
||||
</Ctlbar>
|
||||
<FormRow cols={2}>
|
||||
<Field label="深度思考" title="规划阶段给模型的推理预算;越往下越慢,但拆解长目标更稳。">
|
||||
<Select value={thinking} onChange={(v) => setThinking(v)} options={THINKING_OPTIONS} />
|
||||
</Field>
|
||||
<Field label="单步超时" title="单个步骤的最长执行时间,超时记为失败并停在当前节点。">
|
||||
<Select value={timeoutSec} onChange={(v) => setTimeoutSec(v)} options={TIMEOUT_OPTIONS} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
<div className="flex items-center gap-2.5 mt-3 min-w-0">
|
||||
<Button type="primary" className="min-w-[142px]" disabled={!!busy || planning || !message.trim()}
|
||||
<Field label="执行策略" title="两条都只影响这一次运行,不改项目设置。">
|
||||
<Row className="!gap-4">
|
||||
<Check checked={autoExecute} onChange={setAutoExecute}>计划生成后立即执行</Check>
|
||||
<Check checked={autoApprove} onChange={setAutoApprove}>质检合格后允许 AI 代审</Check>
|
||||
</Row>
|
||||
</Field>
|
||||
|
||||
<Row className="mt-1">
|
||||
<Button type="primary" icon={<IconRobot />} className="min-w-[142px]"
|
||||
disabled={!!busy || planning || !message.trim()}
|
||||
onClick={() => void planAgent()}>
|
||||
{sendLabel}
|
||||
</Button>
|
||||
<span className={MUTED}>⌘ / Ctrl + Enter</span>
|
||||
</div>
|
||||
</Row>
|
||||
|
||||
<ErrorText className="mt-2.5 block py-2 px-3 border border-error-border rounded-md bg-error-bg">
|
||||
{planError}
|
||||
</ErrorText>
|
||||
<Notice danger className="!mb-0 mt-3">{planError}</Notice>
|
||||
|
||||
{notice && (
|
||||
<div className={cn(CALLOUT, 'grid gap-1.5 border-error-border')}>
|
||||
<b className={CALLOUT_TITLE}>{notice.title}</b>
|
||||
{notice.lines.map((line, i) => <p key={`an${i}`} className={CALLOUT_TEXT}>{line}</p>)}
|
||||
<Row className="mt-1 gap-2">
|
||||
<Button type="primary" size="sm" onClick={reuseInstruction}>把这条指令重新下达</Button>
|
||||
<Button size="sm" onClick={() => setNotice(null)}>知道了</Button>
|
||||
</Row>
|
||||
</div>
|
||||
<Notice danger className="!mb-0 mt-3"
|
||||
description={<>
|
||||
{notice.lines.map((line, i) => <Paragraph key={`an${i}`} className="!mb-0">{line}</Paragraph>)}
|
||||
<Row className="mt-2">
|
||||
<Button icon={<IconRetry />} type="primary" size="sm" onClick={reuseInstruction}>把这条指令重新下达</Button>
|
||||
<Button icon={<IconClose />} size="sm" onClick={() => setNotice(null)}>知道了</Button>
|
||||
</Row>
|
||||
</>}>
|
||||
{notice.title}
|
||||
</Notice>
|
||||
)}
|
||||
</div>
|
||||
</FormGrid>
|
||||
|
||||
{/* ── 右:指令列表 + 展开的执行过程 ─────────────────────────── */}
|
||||
<div className="min-w-0 max-h-[min(760px,78vh)] overflow-auto pr-[3px] scrollbar-slim max-lg:max-h-none">
|
||||
{planning && !planningRun && (
|
||||
<p className={cn('relative overflow-hidden m-0 mb-2 py-2 px-3 border border-primary-border rounded-lg text-text-tertiary text-xs', THINKING_BG)}>
|
||||
LLM 正在盘点项目 <Mono className="ml-[5px] text-primary">{planSeconds}s</Mono>
|
||||
,计划生成后挂在对应的指令下,点开即可查看。
|
||||
</p>
|
||||
<Block tone="info" vertical className={cn('relative mb-2 overflow-hidden', THINKING_BG)}>
|
||||
<Paragraph className="!mb-0">
|
||||
LLM 正在盘点项目 <Mono className="ml-[5px] text-primary">{planSeconds}s</Mono>
|
||||
,计划生成后挂在对应的指令下,点开即可查看。
|
||||
</Paragraph>
|
||||
</Block>
|
||||
)}
|
||||
|
||||
{!!runs.length && (
|
||||
|
|
@ -697,16 +697,16 @@ export default function AgentConsole() {
|
|||
<>
|
||||
<div className="flex items-start justify-between gap-3 min-w-0">
|
||||
<div className="min-w-0">
|
||||
<h3 className="mt-0.5 mb-0 text-sm font-bold">{row.summary || '执行计划'}</h3>
|
||||
<Heading level={5} className="!mb-0 !mt-0.5">{row.summary || '执行计划'}</Heading>
|
||||
{/* 旧站这里写的是 var(--muted,#8b93a7),令牌表里没有 --c-muted,
|
||||
取不到值时永远走硬编码灰:改成真令牌,深浅主题才会跟着翻。 */}
|
||||
{!!planStat(row) && (
|
||||
<p className={cn(MONO, 'mt-1 mb-0 text-xs text-text-tertiary')}>{planStat(row)}</p>
|
||||
<Mono className="mt-1 block text-text-tertiary">{planStat(row)}</Mono>
|
||||
)}
|
||||
</div>
|
||||
<Row className="">
|
||||
{row.status === 'running' && (
|
||||
<Button size="sm" disabled={!!busy} onClick={() => void cancelAgent(row)}>
|
||||
<Button icon={<IconClose />} size="sm" disabled={!!busy} onClick={() => void cancelAgent(row)}>
|
||||
取消
|
||||
</Button>
|
||||
)}
|
||||
|
|
@ -714,48 +714,46 @@ export default function AgentConsole() {
|
|||
</div>
|
||||
|
||||
{row.reply && (
|
||||
<div className={cn('mt-3 py-3 px-4 border-l-2 border-primary rounded-r-[9px] text-text-secondary text-xs leading-relaxed', REPLY_BG)}>
|
||||
{row.reply}
|
||||
</div>
|
||||
<Block tone="info" vertical className="mt-3">
|
||||
<Paragraph className="!mb-0">{row.reply}</Paragraph>
|
||||
</Block>
|
||||
)}
|
||||
|
||||
{!!row.blockers?.length && (
|
||||
<div className={cn(CALLOUT, 'border-error-border')}>
|
||||
<b className={CALLOUT_TITLE}>需要处理</b>
|
||||
<Block tone="bad" vertical className="mt-3">
|
||||
<Heading level={5} className="!mb-1 !mt-0">需要处理</Heading>
|
||||
{row.blockers.map((item, i) => (
|
||||
<p key={`b${i}`} className={CALLOUT_TEXT}>{item}</p>
|
||||
<Paragraph key={`b${i}`} className="!mb-0">{item}</Paragraph>
|
||||
))}
|
||||
</div>
|
||||
</Block>
|
||||
)}
|
||||
{!!row.warnings?.length && (
|
||||
<div className={cn(CALLOUT, 'border-warning-border')}>
|
||||
<b className={CALLOUT_TITLE}>风险提醒</b>
|
||||
<Block tone="warn" vertical className="mt-3">
|
||||
<Heading level={5} className="!mb-1 !mt-0">风险提醒</Heading>
|
||||
{row.warnings.map((item, i) => (
|
||||
<p key={`w${i}`} className={CALLOUT_TEXT}>{item}</p>
|
||||
<Paragraph key={`w${i}`} className="!mb-0">{item}</Paragraph>
|
||||
))}
|
||||
</div>
|
||||
</Block>
|
||||
)}
|
||||
|
||||
{!!row.steps?.length ? (
|
||||
<div className="flex flex-col gap-2 mt-3 min-w-0">
|
||||
{row.steps.map((stepItem, index) => (
|
||||
<div key={stepItem.action}
|
||||
className={cn('grid grid-cols-[28px_minmax(0,1fr)] gap-3 py-3 px-3 rounded-lg border border-border-secondary bg-bg-container min-w-0',
|
||||
/* 状态条:一档一色,描边与底纹同族(旧代码是「绿/红描边 + primary 底」,
|
||||
主色还是柠檬绿时看不出来,换成标准蓝就是两条蓝底绿边)。
|
||||
序号圆点里的「成功」取浅底 + 绿字:实心绿配白勾在
|
||||
light #52c41a 上只有 2.3:1、dark #95de64 上 1.8:1,读不出是个勾。 */
|
||||
(stepItem.status === 'succeeded' || stepItem.status === 'running') && 'border-success-border bg-success-bg',
|
||||
stepItem.status === 'failed' && 'border-error-border bg-error-bg',
|
||||
stepItem.status === 'skipped' && 'opacity-68')}>
|
||||
<div className={cn('grid place-items-center w-6 h-6 rounded-full bg-fill-secondary text-text-tertiary text-xs font-bold',
|
||||
/* 序号圆点里的「成功」取浅底 + 绿字:实心绿配白勾在
|
||||
light #52c41a 上只有 2.3:1、dark #95de64 上 1.8:1,读不出是个勾。
|
||||
running 不跟着 succeeded 蹭绿:圆点和右侧标签都是 amber
|
||||
(Status 的 running = warn),绿色在这一版只回答「做完了 / 合格了」。 */
|
||||
<Block key={stepItem.action} align="start" gap={12}
|
||||
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 === 'running' && 'bg-warning text-warning-bg animate-agent-step',
|
||||
stepItem.status === 'failed' && 'bg-error text-error-bg')}>
|
||||
{stepItem.status === 'succeeded' ? <IconCheck />
|
||||
: stepItem.status === 'failed' ? <IconClose /> : index + 1}
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="min-w-0 flex-1">
|
||||
<Between>
|
||||
<b className="text-xs">{stepItem.label}</b>
|
||||
<Tag tone={stepItem.status === 'succeeded' ? 'ok'
|
||||
|
|
@ -765,39 +763,40 @@ export default function AgentConsole() {
|
|||
{stepStatusLabel(stepItem.status)}
|
||||
</Tag>
|
||||
</Between>
|
||||
<p className="mt-1 mb-0 text-text-quaternary text-xs leading-normal">{stepItem.reason}</p>
|
||||
<Value muted className="mt-1 block leading-normal">{stepItem.reason}</Value>
|
||||
{!!stepDetail(stepItem, row) && (
|
||||
<small className="block mt-1 text-text-tertiary text-xs leading-normal">
|
||||
<Value className="mt-1 block leading-normal">
|
||||
{stepDetail(stepItem, row)}
|
||||
</small>
|
||||
</Value>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Block>
|
||||
))}
|
||||
</div>
|
||||
) : row.status === 'succeeded' ? (
|
||||
<div className={CALLOUT_EMPTY}>项目当前已完成,没有需要重复执行的步骤。</div>
|
||||
<Empty className="mt-3">项目当前已完成,没有需要重复执行的步骤。</Empty>
|
||||
) : (
|
||||
<div className={CALLOUT_EMPTY}>
|
||||
<Empty className="mt-3">
|
||||
LLM 没有生成可执行步骤;请根据上方阻塞项补齐素材后重新下达指令。
|
||||
</div>
|
||||
</Empty>
|
||||
)}
|
||||
|
||||
<div className="flex items-center justify-between gap-3 mt-3 pt-3 border-t border-border-secondary min-w-0 max-[620px]:flex-col max-[620px]:items-start">
|
||||
<Row className="">
|
||||
{row.can_execute && row.status !== 'running' && (
|
||||
<Button type="primary" disabled={!!busy} onClick={() => void executeAgent(row)}>
|
||||
<Button type="primary" icon={<IconPlay />} disabled={!!busy}
|
||||
onClick={() => void executeAgent(row)}>
|
||||
{executeLabel(row)}
|
||||
</Button>
|
||||
)}
|
||||
{row.status === 'waiting_review' && (
|
||||
<LinkButton to={`/projects/${projectId}/review`}>逐镜人工审核</LinkButton>
|
||||
<LinkButton icon={<IconAudit />} to={`/projects/${projectId}/review`}>逐镜人工审核</LinkButton>
|
||||
)}
|
||||
{row.status === 'blocked' && (
|
||||
<LinkButton to={`/projects/${projectId}/storyboard`}>去分镜工作台</LinkButton>
|
||||
<LinkButton icon={<IconStoryboard />} to={`/projects/${projectId}/storyboard`}>去分镜工作台</LinkButton>
|
||||
)}
|
||||
{row.status === 'failed' && (
|
||||
<LinkButton to={failurePath(row)}>打开失败节点</LinkButton>
|
||||
<LinkButton icon={<IconNodeIndex />} to={failurePath(row)}>打开失败节点</LinkButton>
|
||||
)}
|
||||
</Row>
|
||||
{!!row.steps?.length && (
|
||||
|
|
@ -817,16 +816,17 @@ export default function AgentConsole() {
|
|||
)}
|
||||
|
||||
{!runs.length && (
|
||||
<div className={cn(CALLOUT_EMPTY, 'relative flex min-h-[250px] flex-col items-center justify-center overflow-hidden p-10 border-solid max-[620px]:min-h-[190px] max-[620px]:p-6', HERO_BG)}>
|
||||
<Block tone="default" vertical
|
||||
className={cn('relative min-h-[250px] !justify-center overflow-hidden !border-dashed py-10 max-[620px]:min-h-[190px] max-[620px]:py-6', HERO_BG)}>
|
||||
<Scanline />
|
||||
<b className="text-text-secondary text-base">还没有调度记录</b>
|
||||
</div>
|
||||
<Empty className="!my-0">还没有调度记录:在左侧写一句目标,LLM 会把它拆成白名单步骤。</Empty>
|
||||
</Block>
|
||||
)}
|
||||
|
||||
{/* 面板自己滚动,末尾用一条 sticky 渐隐收尾,免得步骤卡被硬生生切断 */}
|
||||
<div aria-hidden className={cn('sticky bottom-0 -mt-6 h-[22px] pointer-events-none', FADE_BG)} />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Layout>
|
||||
</Panel>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, Chip, ChipBar, ErrorText, ExtLink, Field, FormGrid, FormRow, Grid, IconText, Input, LINK_CLS, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, Panel, PanelHead, Spinner, Stat, StatGrid, Status, PageStack, Table, TableBox, Tag, TagGroup, cellCenter, cellRight } from '../../components/ui'
|
||||
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 { 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 { IconPlayCircle, IconWarn } from '../../components/icons'
|
||||
import { IconChevronUp, IconPlayCircle, IconRetry, IconWarn } from '../../components/icons'
|
||||
|
||||
const PRESET_HINTS: Record<string, string> = {
|
||||
draft_720p: '1280×720 · CRF28 · veryfast(试片最快)',
|
||||
|
|
@ -37,7 +37,6 @@ const SUBTITLE_MODES = [
|
|||
{ value: 'off', label: '不输出字幕' }
|
||||
]
|
||||
|
||||
const EMPTY_CELL = 'text-center py-6 leading-relaxed'
|
||||
|
||||
export default function Delivery() {
|
||||
const projectId = useProjectStore((s) => s.id)
|
||||
|
|
@ -59,6 +58,13 @@ export default function Delivery() {
|
|||
const succeeded = exportList.filter((e) => e.status === 'succeeded')
|
||||
const presetList: string[] = meta?.presets?.length ? meta.presets : FALLBACK_PRESETS
|
||||
const shownCostItems = showAllCost ? costItems : costItems.slice(0, 12)
|
||||
/* 成本台账原来把三个维度写成三段 tbody 接成一张表:走 antd Table 需要一个数据源,
|
||||
所以在这里合流,_key 保住了原来 k/p/m 前缀的行主键。 */
|
||||
const costRows: any[] = [
|
||||
...(costs?.by_kind || []).map((row: any) => ({ ...row, _dim: '任务类型', _mono: false, _key: 'k' + row.key })),
|
||||
...(costs?.by_provider || []).map((row: any) => ({ ...row, _dim: 'Provider', _mono: true, _key: 'p' + row.key })),
|
||||
...(costs?.by_model || []).map((row: any) => ({ ...row, _dim: '模型', _mono: true, _key: 'm' + row.key }))
|
||||
]
|
||||
const blockingIssues = report && !report.ready
|
||||
? (report.issues || []).filter((y: any) => y.level === 'error') : []
|
||||
|
||||
|
|
@ -185,7 +191,7 @@ export default function Delivery() {
|
|||
)}
|
||||
|
||||
{/* ===== 出片 ===== */}
|
||||
<Grid cols={2} oneAt="sm">
|
||||
<Grid cols={2} oneAt="lg">
|
||||
<Panel>
|
||||
<PanelHead title="合成导出" />
|
||||
<ChipBar label="出片预设(可多选,依次入队)">
|
||||
|
|
@ -238,39 +244,28 @@ export default function Delivery() {
|
|||
<Stat label="已发生成本" value={fmtMoney(costs?.total_cost, currency)} />
|
||||
<Stat label="待生成预估" value={fmtMoney(costs?.estimated_pending, currency)} />
|
||||
</StatGrid>
|
||||
<TableBox maxHeight={170}>
|
||||
<Table minWidth={0}>
|
||||
<thead><tr><th>维度</th><th>取值</th><th className={cellRight}>金额</th><th className={cellRight}>记录数</th></tr></thead>
|
||||
<tbody>
|
||||
{(costs?.by_kind || []).map((row: any) => (
|
||||
<tr key={'k' + row.key}>
|
||||
<td className={MUTED}>任务类型</td><td>{statusLabel(row.key)}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
|
||||
</tr>
|
||||
))}
|
||||
{(costs?.by_provider || []).map((row: any) => (
|
||||
<tr key={'p' + row.key}>
|
||||
<td className={MUTED}>Provider</td><td className={MONO}>{row.key}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
|
||||
</tr>
|
||||
))}
|
||||
{(costs?.by_model || []).map((row: any) => (
|
||||
<tr key={'m' + row.key}>
|
||||
<td className={MUTED}>模型</td><td className={MONO}>{row.key}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(row.cost, currency)}</td><td className={`${cellRight} ${MONO}`}>{row.count}</td>
|
||||
</tr>
|
||||
))}
|
||||
{!costs?.by_model?.length && (
|
||||
<tr><td colSpan={4} className={`${MUTED} ${EMPTY_CELL}`}>
|
||||
暂无计费明细:本项目使用自建模型,但未在模型管理中心配置单价,服务端因此不会写入计费记录;
|
||||
「待生成预估」只统计排队中 / 执行中 / 已规划的任务,全部跑完后自然归零。<br />
|
||||
可量化的投入见下方<b>生成记录</b>({costs?.generations?.count ?? 0} 次调用 / {(costs?.generations?.seconds ?? 0).toFixed(1)} 秒)。{' '}
|
||||
<Link to="/models" className={LINK_CLS}>去配置模型单价</Link>
|
||||
</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={170}
|
||||
minWidth={0}
|
||||
rowKey="_key"
|
||||
dataSource={costRows}
|
||||
empty={(
|
||||
<>
|
||||
暂无计费明细:本项目使用自建模型,但未在模型管理中心配置单价,服务端因此不会写入计费记录;
|
||||
「待生成预估」只统计排队中 / 执行中 / 已规划的任务,全部跑完后自然归零。<br />
|
||||
可量化的投入见下方<b>生成记录</b>({costs?.generations?.count ?? 0} 次调用 / {(costs?.generations?.seconds ?? 0).toFixed(1)} 秒)。{' '}
|
||||
<Link to="/models" className={LINK_CLS}>去配置模型单价</Link>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
{ title: '维度', key: 'dim', width: 118, className: MUTED, render: (_: any, row: any) => row._dim },
|
||||
{ title: '取值', key: 'value', render: (_: any, row: any) => (
|
||||
row._mono ? <span className={MONO}>{row.key}</span> : statusLabel(row.key)
|
||||
) },
|
||||
{ title: '金额', key: 'cost', width: 128, align: 'right', className: MONO, render: (_: any, row: any) => fmtMoney(row.cost, currency) },
|
||||
{ title: '记录数', key: 'count', width: 96, align: 'right', className: MONO, render: (_: any, row: any) => row.count }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
</Grid>
|
||||
|
||||
|
|
@ -279,69 +274,63 @@ export default function Delivery() {
|
|||
<PanelHead
|
||||
title={<span title="点「预览」在统一预览器中播放,多份成片可用左右方向键连续比对、Esc 关闭;出片参数 H.264 high profile · yuv420p · AAC 48kHz 双声道 · faststart,逐预设调整 CRF 与 x264 preset。">成片记录</span>}
|
||||
right={<span className={MUTED}>媒体由后端 <span className={MONO}>/media</span> 直出,下载走 <span className={MONO}>/api/exports/:id/download</span></span>} />
|
||||
<TableBox maxHeight={420}>
|
||||
<Table minWidth={0}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={cellCenter}>#</th><th>名称 / 预设</th><th>状态</th><th className={cellCenter}>规格</th>
|
||||
<th className={cellRight}>时长</th><th className={cellRight}>大小</th><th className={cellRight}>耗时</th>
|
||||
<th>校验和</th><th className={cellRight}>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{exportList.map((rec) => {
|
||||
const at = indexOfExport(rec)
|
||||
return (
|
||||
<tr key={rec.id}>
|
||||
<td className={`${cellCenter} ${MONO}`}>{rec.id}</td>
|
||||
<td>
|
||||
<div className="flex items-start gap-2 flex-nowrap min-w-0">
|
||||
<MediaThumb item={exportItems[at]} size="xs" width="60px" radius="chip"
|
||||
queue={exportItems} index={at < 0 ? 0 : at} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<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>}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<Status value={rec.status} />
|
||||
{rec.subtitle_burned && <div className="mt-1"><Tag tone="info">已烧字幕</Tag></div>}
|
||||
</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{rec.width || '?'}×{rec.height || '?'}{rec.fps ? ` @${rec.fps}` : ''}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMs(rec.duration_ms)}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtBytes(rec.size_bytes)}</td>
|
||||
<td className={`${cellRight} ${MONO} text-text-quaternary`}>{rec.elapsed_ms ? (rec.elapsed_ms / 1000).toFixed(1) + 's' : '—'}</td>
|
||||
<td className={`${MONO} text-text-quaternary`}
|
||||
title={rec.checksum ? '完整校验和为文件 SHA-256 前 32 位(上传超过 16MB 时按流式截断计算)' : '未记录校验和'}>
|
||||
{(rec.checksum || '').slice(0, 10) || '—'}
|
||||
</td>
|
||||
<td className={cellRight}>
|
||||
<div className="flex flex-wrap items-center gap-2 justify-end min-w-0 ">
|
||||
{rec.status === 'succeeded' && (
|
||||
<>
|
||||
<Button size="sm" onClick={() => openTogether(exportList, rec, fromExport)} icon={<IconPlayCircle />}>预览</Button>
|
||||
<ExtLink className={LINK_CLS} href={api.href(`/api/exports/${rec.id}/download`)}>下载</ExtLink>
|
||||
</>
|
||||
)}
|
||||
{rec.status !== 'succeeded' && rec.task_id && ['failed', 'cancelled'].includes(rec.status) && (
|
||||
<Button size="sm" onClick={() => retryExport(rec)}>重试</Button>
|
||||
)}
|
||||
{rec.status !== 'succeeded' && !(rec.task_id && ['failed', 'cancelled'].includes(rec.status)) && (
|
||||
<span className={MUTED}>—</span>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
{!exportList.length && (
|
||||
<tr><td colSpan={9} className={`${MUTED} ${EMPTY_CELL}`}>还没有成片。先在时间线页通过交付预检,再回到这里出片。</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={420}
|
||||
minWidth={0}
|
||||
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) => {
|
||||
const at = indexOfExport(rec)
|
||||
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>}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
} },
|
||||
{ title: '状态', key: 'status', width: 120, 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`,
|
||||
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`,
|
||||
render: (_: any, rec: any) => (rec.elapsed_ms ? (rec.elapsed_ms / 1000).toFixed(1) + 's' : '—') },
|
||||
{ title: '校验和', key: 'checksum', width: 108, className: `${MONO} text-text-quaternary`,
|
||||
render: (_: any, rec: any) => (
|
||||
<span title={rec.checksum ? '完整校验和为文件 SHA-256 前 32 位(上传超过 16MB 时按流式截断计算)' : '未记录校验和'}>
|
||||
{(rec.checksum || '').slice(0, 10) || '—'}
|
||||
</span>
|
||||
) },
|
||||
{ title: '操作', key: 'actions', width: 168, align: 'right', render: (_: any, rec: any) => (
|
||||
<Row className="justify-end">
|
||||
{rec.status === 'succeeded' && (
|
||||
<>
|
||||
<Button size="sm" onClick={() => openTogether(exportList, rec, fromExport)} icon={<IconPlayCircle />}>预览</Button>
|
||||
<ExtLink className={LINK_CLS} href={api.href(`/api/exports/${rec.id}/download`)}>下载</ExtLink>
|
||||
</>
|
||||
)}
|
||||
{rec.status !== 'succeeded' && rec.task_id && ['failed', 'cancelled'].includes(rec.status) && (
|
||||
<Button icon={<IconRetry />} size="sm" onClick={() => retryExport(rec)}>重试</Button>
|
||||
)}
|
||||
{rec.status !== 'succeeded' && !(rec.task_id && ['failed', 'cancelled'].includes(rec.status)) && (
|
||||
<span className={MUTED}>—</span>
|
||||
)}
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
{/* ===== 生成记录 ===== */}
|
||||
|
|
@ -349,63 +338,49 @@ export default function Delivery() {
|
|||
<PanelHead title="生成记录(可复现)"
|
||||
right={<>
|
||||
<span className={MUTED}>{generations.length} 条</span>
|
||||
<Button size="sm" onClick={() => setShowAllCost((v) => !v)}>{showAllCost ? '收起明细' : '展开计费明细'}</Button>
|
||||
<Button icon={<IconChevronUp />} size="sm" onClick={() => setShowAllCost((v) => !v)}>{showAllCost ? '收起明细' : '展开计费明细'}</Button>
|
||||
</>} />
|
||||
<TableBox maxHeight={360}>
|
||||
<Table minWidth={0}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={cellCenter}>#</th><th>镜头 / 类型</th><th>Provider / 模型</th><th>提示词</th>
|
||||
<th className={cellRight}>时长</th><th className={cellRight}>成本</th><th className={cellCenter}>尝试</th><th className={cellCenter}>时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{generations.map((g) => (
|
||||
<tr key={g.id}>
|
||||
<td className={`${cellCenter} ${MONO}`}>{g.id}</td>
|
||||
<td className={MONO}>shot#{g.shot_id || '—'}<div className={MUTED}>{statusLabel(g.kind)}</div></td>
|
||||
<td className={MUTED_MONO}>{g.provider}/{g.model}</td>
|
||||
<td className="max-w-[340px] whitespace-normal leading-normal wrap-anywhere">
|
||||
{(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}
|
||||
</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtSeconds(g.duration_seconds)}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(g.cost, g.currency || currency)}</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{g.attempts}</td>
|
||||
<td className={`${cellCenter} ${MONO} text-text-quaternary`} title={fmtTime(g.created_at)}>{fmtAgo(g.created_at)}</td>
|
||||
</tr>
|
||||
))}
|
||||
{!generations.length && (
|
||||
<tr><td colSpan={8} className={`${MUTED} ${EMPTY_CELL}`}>暂无生成记录。</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={360}
|
||||
minWidth={0}
|
||||
dataSource={generations}
|
||||
empty="暂无生成记录。"
|
||||
columns={[
|
||||
{ title: '#', key: 'id', width: 68, align: 'center', className: MONO, render: (_: any, g: any) => g.id },
|
||||
{ title: '镜头 / 类型', key: 'shot', width: 132, className: MONO, render: (_: any, g: any) => (
|
||||
<>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}
|
||||
</>
|
||||
) },
|
||||
{ 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 },
|
||||
{ title: '时间', key: 'created', width: 104, align: 'center', className: `${MONO} text-text-quaternary`,
|
||||
render: (_: any, g: any) => <span title={fmtTime(g.created_at)}>{fmtAgo(g.created_at)}</span> }
|
||||
]}
|
||||
/>
|
||||
{showAllCost && costItems.length > 0 && (
|
||||
<TableBox maxHeight={280} className="mt-3">
|
||||
<Table minWidth={0}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={cellCenter}>#</th><th>类型</th><th>Provider / 模型</th>
|
||||
<th className={cellRight}>数量</th><th className={cellRight}>单价</th><th className={cellRight}>金额</th><th className={cellCenter}>时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shownCostItems.map((it) => (
|
||||
<tr key={it.id}>
|
||||
<td className={`${cellCenter} ${MONO}`}>{it.id}</td>
|
||||
<td>{statusLabel(it.kind)}</td>
|
||||
<td className={MUTED_MONO}>{it.provider}/{it.model}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{it.quantity} {it.unit}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(it.unit_price, it.currency || currency)}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(it.cost, it.currency || currency)}</td>
|
||||
<td className={`${cellCenter} ${MONO} text-text-quaternary`}>{fmtTime(it.created_at)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
className="mt-3"
|
||||
maxHeight={280}
|
||||
minWidth={0}
|
||||
dataSource={shownCostItems}
|
||||
columns={[
|
||||
{ title: '#', key: 'id', width: 68, align: 'center', className: MONO, render: (_: any, it: any) => it.id },
|
||||
{ title: '类型', key: 'kind', width: 120, render: (_: any, it: any) => statusLabel(it.kind) },
|
||||
{ title: 'Provider / 模型', key: 'model', width: 180, className: MUTED_MONO, render: (_: any, it: any) => `${it.provider}/${it.model}` },
|
||||
{ title: '数量', key: 'quantity', width: 96, align: 'right', className: MONO, render: (_: any, it: any) => `${it.quantity} ${it.unit}` },
|
||||
{ title: '单价', key: 'unit_price', width: 104, align: 'right', className: MONO, render: (_: any, it: any) => fmtMoney(it.unit_price, it.currency || currency) },
|
||||
{ title: '金额', key: 'cost', width: 104, align: 'right', className: MONO, render: (_: any, it: any) => fmtMoney(it.cost, it.currency || currency) },
|
||||
{ title: '时间', key: 'created', width: 140, align: 'center', className: `${MONO} text-text-quaternary`, render: (_: any, it: any) => fmtTime(it.created_at) }
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</Panel>
|
||||
</PageStack>
|
||||
|
|
|
|||
|
|
@ -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 { Actions, Between, Button, Check, Ctlbar, Divider, ErrorText, ExtLink, Field, IconText, Layout, LinkButton, MONO, MUTED, MUTED_MONO, NumberInput, Panel, PanelHead, ProgressBar, Row, Spinner, Status, PageStack, Table, TableBox, Tag, TagGroup, cellCenter, cellRight, cellWrap } from '../../components/ui'
|
||||
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 { refresh, useProjectStore } from '../../stores/project'
|
||||
import { useSystemStore } from '../../stores/system'
|
||||
import { notify } from '../../stores/notice'
|
||||
import { Checkbox } from '../../components/ui'
|
||||
import { IconClock, IconClose, IconPlayCircle, IconRetry, IconSend, IconSound, IconWarn } from '../../components/icons'
|
||||
import { IconApi, IconClock, IconClose, IconPlayCircle, IconRetry, IconSend, IconSound, IconWarn } 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']
|
||||
|
|
@ -25,7 +25,6 @@ const EXEC_LABEL: Record<string, string> = { inline: '平台内即时执行', ce
|
|||
/** 清单动作:后端是三态 enqueue / skip / needs_attention,别把「阻塞」显示成「跳过」 */
|
||||
const ACTION_LABELS: Record<string, string> = { enqueue: '待入队', skip: '跳过', needs_attention: '预检阻塞' }
|
||||
const actionLabel = (a: string) => ACTION_LABELS[a] || a || '—'
|
||||
const EMPTY_CELL = 'text-center py-6 leading-relaxed'
|
||||
|
||||
/** 心跳年龄说成人话:「12 分钟」比「742 秒」更能判断该不该干预。 */
|
||||
function fmtAge(sec?: number | null) {
|
||||
|
|
@ -69,6 +68,12 @@ export default function Dispatch() {
|
|||
})()
|
||||
const enqueueable = (plan?.shots || []).filter((s: any) => s.action !== 'skip')
|
||||
const voiceoverable = (plan?.voiceovers || []).filter((v: any) => v.action !== 'skip')
|
||||
/* 镜头清单与配音清单合并成一张表(原来两段 tbody 首尾相接,看起来像一张表):
|
||||
走 antd Table 就得有一个数据源,所以在这里合流,用 _row 区分两种行的取数。 */
|
||||
const planRows: any[] = [
|
||||
...(plan?.shots || []).map((r: any) => ({ ...r, _row: 'shot', _key: `s${r.shot_id}` })),
|
||||
...(plan?.voiceovers || []).map((r: any) => ({ ...r, _row: 'voice', _key: `v${r.shot_id}` }))
|
||||
]
|
||||
/** 队列矩阵按 kind×status 反查,表格里三列循环不必每次都扫一遍数组 */
|
||||
const matrix = useMemo(() => {
|
||||
const map = new Map<string, any>()
|
||||
|
|
@ -194,83 +199,90 @@ export default function Dispatch() {
|
|||
|
||||
return (
|
||||
<PageStack>
|
||||
<Between>
|
||||
{/* 只读计数:跟旁边的 Tag 同档,不借 Chip 的 31px 胶囊皮肤(规范 §2.0) */}
|
||||
<TagGroup className="mb-0">
|
||||
{/* 队列总览:一排 Tag 悬浮在页面底色上时,它和下面的卡片没有任何归属关系
|
||||
(截图上就是「这行字是页面上的脏东西」)。它是一块只有卡头的卡 = <Toolbar>。
|
||||
只读计数仍走 Tag,不借 Chip 的胶囊皮肤(规范 §2.0)。 */}
|
||||
<Toolbar
|
||||
info={<TagGroup className="mb-0">
|
||||
<Tag tone="info">任务执行:{executorLabel}</Tag>
|
||||
{Object.entries(counts).map(([k, v]) => <Tag key={k}>{statusLabel(k)} {String(v)}</Tag>)}
|
||||
{!activeCount && <span className={MUTED}>队列空闲</span>}
|
||||
</TagGroup>
|
||||
<Row>{busy ? <span className={MUTED}><Spinner /> {busy}…</span> : null}</Row>
|
||||
</Between>
|
||||
</TagGroup>}
|
||||
actions={busy ? <Value><Spinner /> {busy}…</Value> : undefined} />
|
||||
<ErrorText>{error}</ErrorText>
|
||||
|
||||
{/* ===== 任务清单(图2 节点④ plan_tasks) ===== */}
|
||||
<Layout>
|
||||
<Panel>
|
||||
<PanelHead title="分镜任务清单"
|
||||
right={<><span className={MUTED}>预计成本 {fmtMoney(plan?.estimated_cost, plan?.currency)}</span>
|
||||
<Button type="primary" disabled={!!busy} onClick={enqueue} icon={<IconPlayCircle />}>入队所选 / 全部待生成</Button></>} />
|
||||
<TagGroup>
|
||||
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="ok">预检就绪 {plan?.preflight?.ready || 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>
|
||||
</TagGroup>
|
||||
<TableBox maxHeight={360}>
|
||||
<Table minWidth={860}>
|
||||
<thead>
|
||||
<tr><th className={`${cellCenter} w-8`}>#</th><th>镜头</th><th>动作</th><th>Provider / 模型</th>
|
||||
<th className={cellRight}>时长</th><th className={cellRight}>预估成本</th><th>说明</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(plan?.shots || []).map((s: any) => (
|
||||
<tr key={s.shot_id}>
|
||||
<td className={cellCenter}>
|
||||
<Checkbox className="mx-auto" aria-label={`选择镜头 ${s.order_index}`}
|
||||
checked={shotIds.includes(s.shot_id)} disabled={s.action === 'skip' && !switches.force}
|
||||
onCheckedChange={() => toggleShot(s.shot_id)} />
|
||||
</td>
|
||||
<td><b>#{s.order_index}</b> {s.title}<div className={MUTED_MONO}>shot#{s.shot_id}</div></td>
|
||||
<td><Tag tone={s.action === 'enqueue' ? 'ok' : s.action === 'needs_attention' ? 'bad' : 'warn'}>{actionLabel(s.action)}</Tag></td>
|
||||
<td className={`${MONO} ${MUTED}`}>{s.provider || '—'} / {s.model || '默认'}</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{s.duration}s</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{fmtMoney(s.estimated_cost)}</td>
|
||||
<td className={`${cellWrap} ${MUTED}`}>{s.reason}
|
||||
{s.blocking?.length ? <span className="text-error"> 阻塞:{s.blocking.join(';')}</span> : null}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{(plan?.voiceovers || []).map((v: any) => (
|
||||
<tr key={`v${v.shot_id}`}>
|
||||
<td className={cellCenter}><IconSound /></td>
|
||||
<td><b>#{v.order_index}</b> 配音<div className={MUTED_MONO}>shot#{v.shot_id}</div></td>
|
||||
<td><Tag tone={v.action !== 'skip' ? 'ok' : 'default'}>{v.action !== 'skip' ? '待配音' : '跳过'}</Tag></td>
|
||||
<td className={`${MONO} ${MUTED}`}>TTS</td>
|
||||
<td className={`${cellRight} ${MONO}`}>{v.chars} 字</td>
|
||||
<td className={`${cellRight} ${MONO}`}>—</td>
|
||||
<td className={`${cellWrap} ${MUTED}`}>{v.reason}</td>
|
||||
</tr>
|
||||
))}
|
||||
{!(plan?.shots || []).length && !(plan?.voiceovers || []).length
|
||||
? <tr><td colSpan={7} className={`${MUTED} ${EMPTY_CELL}`}>还没有分镜清单,先去「分镜工作台」拆镜头。</td></tr> : null}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
</Grid>
|
||||
<Table
|
||||
maxHeight={360}
|
||||
minWidth={860}
|
||||
rowKey="_key"
|
||||
dataSource={planRows}
|
||||
empty="还没有分镜清单,先去「分镜工作台」拆镜头。"
|
||||
columns={[
|
||||
{ title: '#', key: 'pick', width: 56, align: 'center', render: (_: any, row: any) => (
|
||||
row._row === 'shot'
|
||||
? <Checkbox className="mx-auto" aria-label={`选择镜头 ${row.order_index}`}
|
||||
checked={shotIds.includes(row.shot_id)}
|
||||
disabled={row.action === 'skip' && !switches.force}
|
||||
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) => (
|
||||
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,
|
||||
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}
|
||||
</>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel>
|
||||
<h3>调度控制</h3>
|
||||
<PanelHead title="调度控制" />
|
||||
<Ctlbar>
|
||||
<Check checked={withVoiceover} onChange={setWithVoiceover}>入队时一并排配音任务</Check>
|
||||
<Check checked={switches.allow_unready} onChange={(v) => setSwitches((s) => ({ ...s, allow_unready: v }))}>放行预检未通过的镜头(默认只跳过它们)</Check>
|
||||
<Check title="忽略「产物已存在 / 已审核合格 / 已在队列」这三类跳过判定,也忽略幂等键。要单独重做某一镜就得勾它"
|
||||
checked={switches.force} onChange={(v) => setSwitches((s) => ({ ...s, force: v }))}>强制重建任务(忽略幂等,可重做已生成的镜头)</Check>
|
||||
<Field label="优先级" width="narrow">
|
||||
{/* 三条开关是一个决定(这批任务怎么排),右侧窄栏 378px 里横排必拆,
|
||||
竖排等宽;「优先级」是另一个字段,留在开关组外面 */}
|
||||
<ActionGroup stack className="w-full">
|
||||
<Check checked={withVoiceover} onChange={setWithVoiceover}>入队时一并排配音任务</Check>
|
||||
<Check checked={switches.allow_unready} onChange={(v) => setSwitches((s) => ({ ...s, allow_unready: v }))}>放行预检未通过的镜头(默认只跳过它们)</Check>
|
||||
<Check title="忽略「产物已存在 / 已审核合格 / 已在队列」这三类跳过判定,也忽略幂等键。要单独重做某一镜就得勾它"
|
||||
checked={switches.force} onChange={(v) => setSwitches((s) => ({ ...s, force: v }))}>强制重建任务(忽略幂等,可重做已生成的镜头)</Check>
|
||||
</ActionGroup>
|
||||
<Field inline label="优先级" width="narrow">
|
||||
<NumberInput min={0} max={9} aria-label="任务优先级" value={priority} onChange={ (v) => setPriority(v)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
|
|
@ -278,10 +290,10 @@ export default function Dispatch() {
|
|||
<Ctlbar>
|
||||
<Check title="勾选「派发后同步排空」会一直等到任务执行结束再返回,适合小批量验证;不勾选时任务留在队列后台执行,页面自动刷新进度。"
|
||||
checked={drain} onChange={setDrain}>派发后同步排空(等任务跑完再返回)</Check>
|
||||
<Field label="单次派发上限" width="narrow">
|
||||
<Field inline label="单次派发上限" width="narrow">
|
||||
<NumberInput min={1} max={256} aria-label="单次派发上限" value={limit} onChange={ (v) => setLimit(v)} />
|
||||
</Field>
|
||||
<Field label="排空等待(秒)" width="narrow">
|
||||
<Field inline label="排空等待(秒)" width="narrow">
|
||||
<NumberInput min={30} max={7200} aria-label="排空等待秒数" value={timeout_} onChange={ (v) => setTimeout_(v)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
|
|
@ -291,15 +303,18 @@ export default function Dispatch() {
|
|||
<Button disabled={!!busy} onClick={buildVoiceover}
|
||||
icon={<IconSound />}>批量生成配音</Button>
|
||||
</Actions>
|
||||
<Divider />
|
||||
<h3 className="mt-0">异常处理</h3>
|
||||
<Divider text="异常处理" />
|
||||
{/* 三颗都是「异常处理」,合计 480px > 侧栏卡 378px:竖排等宽,
|
||||
不留「前两颗并排、第三颗孤零零一行」那种 ragged 折行 */}
|
||||
<Actions>
|
||||
<Button disabled={!!busy} onClick={retryFailed}
|
||||
icon={<IconRetry />}>重排全部失败任务</Button>
|
||||
<Button disabled={!!busy} onClick={resume}
|
||||
icon={<IconClock />}>断点续跑(恢复中断)</Button>
|
||||
<Button disabled={!!busy} onClick={cancelActive}
|
||||
icon={<IconClose />}>取消进行中任务</Button>
|
||||
<ActionGroup stack className="w-full">
|
||||
<Button disabled={!!busy} onClick={retryFailed}
|
||||
icon={<IconRetry />}>重排全部失败任务</Button>
|
||||
<Button disabled={!!busy} onClick={resume}
|
||||
icon={<IconClock />}>断点续跑(恢复中断)</Button>
|
||||
<Button disabled={!!busy} onClick={cancelActive}
|
||||
icon={<IconClose />}>取消进行中任务</Button>
|
||||
</ActionGroup>
|
||||
</Actions>
|
||||
</Panel>
|
||||
</Layout>
|
||||
|
|
@ -308,52 +323,49 @@ export default function Dispatch() {
|
|||
<Layout>
|
||||
<Panel>
|
||||
<PanelHead title="队列状态" />
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={760}>
|
||||
<thead>
|
||||
<tr><th>任务类型</th>
|
||||
{QUEUE_STATUSES.map((st) => <th key={st} className={cellCenter}>{statusLabel(st)}</th>)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{QUEUE_KINDS.map((kind) => (
|
||||
<tr key={kind}>
|
||||
<td><b>{statusLabel(kind)}</b></td>
|
||||
{QUEUE_STATUSES.map((st) => {
|
||||
const hit = matrix.get(`${kind}|${st}`)
|
||||
return <td key={st} className={`${cellCenter} ${MONO}`}>{hit ? <Tag tone="ok">{hit.count || ''}</Tag> : null}</td>
|
||||
})}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={false}
|
||||
minWidth={760}
|
||||
rowKey={(kind: string) => kind}
|
||||
dataSource={QUEUE_KINDS}
|
||||
columns={[
|
||||
{ title: '任务类型', key: 'kind', width: 140, 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) => {
|
||||
const hit = matrix.get(`${kind}|${st}`)
|
||||
return hit ? <Tag>{hit.count || ''}</Tag> : null
|
||||
}
|
||||
}))
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel>
|
||||
<PanelHead title="模型并发与限流" />
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={560}>
|
||||
<thead>
|
||||
<tr><th>Provider / 模型</th><th className={cellCenter}>运行</th><th className={cellCenter}>排队</th>
|
||||
<th className={cellCenter}>槽位</th><th className={cellCenter}>RPM 余量</th><th>状态</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(queue?.capacity || []).map((c: any) => (
|
||||
<tr key={`${c.provider}${c.model}${c.media_type}`}>
|
||||
<td className={MONO}>{c.provider} / {c.model || '默认'}<div className={MUTED}>{c.media_type}</div></td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{c.running}</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{c.queued}</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{c.slots}/{c.concurrency_limit}</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{c.rpm_headroom}</td>
|
||||
<td><Tag tone={!c.enabled ? 'bad' : c.saturated ? 'warn' : 'ok'}>{!c.enabled ? '已停用' : c.saturated ? '已满负荷' : '可用'}</Tag></td>
|
||||
</tr>
|
||||
))}
|
||||
{!(queue?.capacity || []).length
|
||||
? <tr><td colSpan={6} className={`${MUTED} ${EMPTY_CELL}`}>没有登记并发的模型:所有任务按默认额度执行。</td></tr> : null}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={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>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
</Layout>
|
||||
|
||||
|
|
@ -368,66 +380,70 @@ export default function Dispatch() {
|
|||
产物与断点都留着,平台回收后会自动续跑;着急就点上方「断点续跑」立即处理。</>
|
||||
: undefined}
|
||||
right={<Ctlbar as="div" className="mb-0">
|
||||
<Field label="状态" width="narrow">
|
||||
<Select size="sm" ariaLabel="任务状态筛选" value={statusFilter} onChange={setStatusFilter}
|
||||
<Field inline label="状态" width="narrow">
|
||||
<Select ariaLabel="任务状态筛选" value={statusFilter} onChange={setStatusFilter}
|
||||
options={[{ value: '', label: '全部状态' }, ...taskStatusOptions.map((s) => ({ value: s, label: statusLabel(s) }))]} />
|
||||
</Field>
|
||||
</Ctlbar>} />
|
||||
<TableBox>
|
||||
<Table minWidth={1180}>
|
||||
<thead>
|
||||
<tr><th>ID</th><th>任务</th><th>镜头</th><th>后端</th><th className={cellCenter}>尝试</th>
|
||||
<th className={cellCenter}>进度</th><th className={cellRight}>耗时</th><th>状态</th><th>错误 / 检查点</th><th className={cellRight}>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{tasks.map((t: any) => (
|
||||
<tr key={t.id}>
|
||||
<td className={MONO}>#{t.id}</td>
|
||||
<td>{t.name}<div className={MUTED_MONO}>{statusLabel(t.kind)} · {t.stage}</div></td>
|
||||
<td className={MONO}>{t.shot_id ? `#${t.shot_id}` : t.timeline_id ? `时间线#${t.timeline_id}` : '—'}</td>
|
||||
<td className={`${MONO} ${MUTED}`}>{statusLabel(t.execution_backend)}
|
||||
{t.worker_id ? <div className={MUTED}>{t.worker_id}</div> : null}
|
||||
</td>
|
||||
<td className={`${cellCenter} ${MONO}`}>{t.attempts}/{t.max_attempts}</td>
|
||||
<td className={cellCenter}><ProgressBar value={Math.round((t.progress || 0) * 100)} /></td>
|
||||
<td className={`${cellRight} ${MONO}`}>{t.elapsed_ms ? `${(t.elapsed_ms / 1000).toFixed(1)}s`
|
||||
: t.queue_wait_ms ? `排队 ${(t.queue_wait_ms / 1000).toFixed(1)}s` : '—'}</td>
|
||||
<td><Status value={t.status} />
|
||||
<div className={MUTED}>{fmtAgo(t.updated_at)}</div>
|
||||
{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>
|
||||
: null}
|
||||
</td>
|
||||
<td className={cellWrap}>
|
||||
{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}
|
||||
</td>
|
||||
<td className={cellRight}>
|
||||
<Row className="justify-end">
|
||||
{['failed', 'cancelled'].includes(t.status)
|
||||
? <Button size="sm" onClick={() => retryTask(t)}>重试</Button> : null}
|
||||
{ACTIVE_STATUSES.includes(t.status)
|
||||
? <Button size="sm" onClick={() => cancelTask(t)}>取消</Button> : null}
|
||||
{t.status === 'succeeded' || t.status === 'skipped' ? <span className={MUTED}>—</span> : null}
|
||||
</Row>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{!tasks.length
|
||||
? <tr><td colSpan={10} className={`${MUTED} ${EMPTY_CELL}`}>暂无任务,先在上方生成任务清单并入队。</td></tr> : null}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
/* 定宽列合计已接近 1150,余给「错误 / 检查点」的只有几十字;
|
||||
表头「错误 / 检查点」被压成一竖条就是这个原因 → 下限抬到 1500,交给横向滚动。 */
|
||||
minWidth={1500}
|
||||
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: 'shot', width: 96, 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,
|
||||
render: (_: any, t: any) => `${t.attempts}/${t.max_attempts}` },
|
||||
{ title: '进度', key: 'progress', width: 118, 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) => (
|
||||
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) => (
|
||||
<>
|
||||
<Status value={t.status} />
|
||||
<div className={MUTED}>{fmtAgo(t.updated_at)}</div>
|
||||
{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>
|
||||
: 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) => (
|
||||
<Row className="justify-end">
|
||||
{['failed', 'cancelled'].includes(t.status)
|
||||
? <Button icon={<IconRetry />} size="sm" onClick={() => retryTask(t)}>重试</Button> : null}
|
||||
{ACTIVE_STATUSES.includes(t.status)
|
||||
? <Button icon={<IconClose />} size="sm" onClick={() => cancelTask(t)}>取消</Button> : null}
|
||||
{t.status === 'succeeded' || t.status === 'skipped' ? <span className={MUTED}>—</span> : null}
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel className="flex justify-between items-center gap-5 flex-wrap max-md:flex-col max-md:items-start">
|
||||
<div className="min-w-0">
|
||||
<h2 className="mt-0 mb-0 text-xl font-bold">模型配置已迁移至独立管理中心</h2>
|
||||
</div>
|
||||
<LinkButton to="/models" type="primary" title="统一维护大模型、图像、视频与声音模型的适配器、默认项、并发、限流、价格、能力与连接探测。调度中心只负责项目任务编排与执行。">打开模型管理中心</LinkButton>
|
||||
</Panel>
|
||||
<Toolbar
|
||||
info="模型配置已迁移至独立管理中心"
|
||||
actions={<LinkButton icon={<IconApi />} to="/models" type="primary" title="统一维护大模型、图像、视频与声音模型的适配器、默认项、并发、限流、价格、能力与连接探测。调度中心只负责项目任务编排与执行。">打开模型管理中心</LinkButton>} />
|
||||
</PageStack>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 { Actions, BarRight, Between, 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, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, PageStack, Table, TableBox, Tabs, Tag, TagGroup, TextArea, cellRight, 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, 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 { useSystemStore } from '../../stores/system'
|
||||
import { refresh, useProjectStore } from '../../stores/project'
|
||||
import { notify } from '../../stores/notice'
|
||||
import { Checkbox } from '../../components/ui'
|
||||
import { IconBulb, IconDelete, IconImage, IconPass, IconReject, IconSync, IconUpload, IconVoice, IconWarn } from '../../components/icons'
|
||||
import { IconBolt, IconBulb, IconCheck, IconChevronUp, IconClose, IconDelete, IconEdit, IconImage, IconLibrary, IconParams, IconPass, IconReject, IconSync, IconUpload, IconVoice, IconWarn } from '../../components/icons'
|
||||
|
||||
type GenType = 'human' | 'scene' | 'voice'
|
||||
type PanelKey = GenType | 'project'
|
||||
|
|
@ -44,6 +44,8 @@ type GenDraft = {
|
|||
}
|
||||
|
||||
const PANEL_LABEL: Record<PanelKey, string> = { human: '人物', scene: '场景', voice: '声线', project: '项目素材' }
|
||||
/** 全选框里的量词跟面板走:中文里「个人物 / 条声线」读起来才对,统一成「个」会像机器话 */
|
||||
const SELECT_UNIT: Record<PanelKey, string> = { human: '个人物', scene: '个场景', voice: '条声线', project: '项素材' }
|
||||
/** 批量删除 / 编辑走的 REST 路径段(项目素材面板不参与批量,所以没有这一项) */
|
||||
const PANEL_PATH: Record<GenType, string> = { human: 'characters', scene: 'scenes', voice: 'voices' }
|
||||
const PANEL_KEYS: PanelKey[] = ['human', 'scene', 'voice', 'project']
|
||||
|
|
@ -353,6 +355,13 @@ export default function Library() {
|
|||
setPicks(next)
|
||||
}
|
||||
function clearPicks() { setPicks(new Set()) }
|
||||
/* 症状:全选条原本是列表上方一整个虚线盒,只装了一颗勾选框,白占一行。
|
||||
做法:做成卡头右端的一个节点,和面板标题共用同一行;空面板不渲染,
|
||||
免得写出「全选当前 0 个人物」。批量条仍按当前面板解释勾选。 */
|
||||
const selAll = () => (panelRows.length
|
||||
? <SelectAll checked={allPicked} onChange={checkAllRows}
|
||||
label={`全选当前 ${panelRows.length} ${SELECT_UNIT[panel]}`} />
|
||||
: undefined)
|
||||
function resetFilters() { setKeyword(''); setOnlyMissing(false); setOnlyUnused(false) }
|
||||
/** 切面板同时收起表单与勾选:批量动作是按面板解释的,留着跨面板的勾选会误删 */
|
||||
function choosePanel(key: PanelKey) {
|
||||
|
|
@ -747,78 +756,77 @@ export default function Library() {
|
|||
const projectMediaQueue = projectAssets
|
||||
.map((a: any) => fromAsset(a, { group: '项目素材' }))
|
||||
.filter(Boolean) as any[]
|
||||
const linkCls = { size: 'sm' as const }
|
||||
|
||||
return (
|
||||
<PageStack>
|
||||
<Between className="max-lg:flex-col max-lg:items-start">
|
||||
<div className="min-w-0">
|
||||
<h2 className="mt-0 mb-0 text-lg font-bold"
|
||||
title="集中维护人物、声音与场景。资产可单独调用模型生成,绑定到分镜后会自动进入视频参考素材与提示词。">
|
||||
资产管理
|
||||
</h2>
|
||||
</div>
|
||||
<Row tight>
|
||||
<LinkButton to="/assets" {...linkCls}>平台资产库</LinkButton>
|
||||
<LinkButton to="/models" {...linkCls}>配置生成模型</LinkButton>
|
||||
</Row>
|
||||
</Between>
|
||||
{/* 页头(标题 + 说明 + 两个跳转)、四个内部页签、跨字段搜索条全部坐进同一张卡。
|
||||
症状:这三截以前各自漂在页面底色上——裸 <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,不再另起一行把页签和按钮分开。 */}
|
||||
<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],
|
||||
count: key === 'human' ? characters.length
|
||||
: key === 'scene' ? scenes.length
|
||||
: key === 'voice' ? voices.length : projectAssets.length
|
||||
}))}
|
||||
/>
|
||||
|
||||
{/* 四个人物 / 场景 / 声线 / 项目素材面板是四个内部页面 → Tabs(UI规范 §6.4)。
|
||||
右侧动作走 antd 的 tabBarExtraContent,不再另起一行把页签和按钮分开。 */}
|
||||
<Tabs
|
||||
className="mb-3"
|
||||
activeKey={panel}
|
||||
onChange={(k) => choosePanel(k as PanelKey)}
|
||||
tabBarExtraContent={{
|
||||
right: (
|
||||
<Row tight>
|
||||
{busy ? <span className={MUTED}><Spinner /> {busy}…</span> : null}
|
||||
{panel !== 'project' && (
|
||||
<Button type="primary" onClick={() => setShowForm(!showForm)}>
|
||||
{showForm ? '收起' : `+ 新建${panel === 'human' ? '人物' : panel === 'scene' ? '场景' : '声线'}`}
|
||||
</Button>
|
||||
)}
|
||||
</Row>
|
||||
)
|
||||
}}
|
||||
items={PANEL_KEYS.map((key) => ({
|
||||
key,
|
||||
label: PANEL_LABEL[key],
|
||||
count: key === 'human' ? characters.length
|
||||
: key === 'scene' ? scenes.length
|
||||
: key === 'voice' ? voices.length : projectAssets.length
|
||||
}))}
|
||||
/>
|
||||
|
||||
{/* 工具栏:跨字段搜索 + 筛选 + 批量,和平台资产库一套动作 */}
|
||||
<Ctlbar className="px-3 py-2 border border-fill rounded-lg bg-bg-container">
|
||||
<Field label="搜索" width="grow">
|
||||
<SearchInput aria-label="搜索当前面板" value={keyword} placeholder={panel === 'project' ? '搜索项目素材名称 / 类型 / 文件名…' : '搜索名称 / 代号 / 设定 / 标签 / 素材文件名…'} onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
<Chip active={onlyMissing} disabled={panel === 'project'}
|
||||
title={panel === 'project' ? '项目素材面板暂不支持该筛选' : '只看还没有任何素材的资产'}
|
||||
onClick={() => setOnlyMissing(!onlyMissing)}>缺素材</Chip>
|
||||
<Chip active={onlyUnused} disabled={panel === 'project'}
|
||||
title="只看还没被任何镜头引用的资产,便于清理"
|
||||
onClick={() => setOnlyUnused(!onlyUnused)}>未被镜头使用</Chip>
|
||||
<BarRight>
|
||||
{filterActive
|
||||
? <span className={cn(MUTED, 'text-xs')}>命中 {shownCount} / {panelTotal}
|
||||
<Button type="link" size="sm" className="ml-[5px] pb-0" onClick={resetFilters}>清除筛选</Button>
|
||||
</span>
|
||||
: panelTotal ? <span className={cn(MUTED, 'text-xs')}>共 {panelTotal} 项</span> : null}
|
||||
</BarRight>
|
||||
</Ctlbar>
|
||||
{/* 工具栏:跨字段搜索 + 筛选,和平台资产库一套动作(条本身不带容器,坐在卡正文里) */}
|
||||
<Ctlbar className="!mb-0">
|
||||
<Field inline label="搜索" width="grow">
|
||||
<SearchInput aria-label="搜索当前面板" value={keyword} placeholder={panel === 'project' ? '搜索项目素材名称 / 类型 / 文件名…' : '搜索名称 / 代号 / 设定 / 标签 / 素材文件名…'} onChange={(e) => setKeyword(e.target.value)} />
|
||||
</Field>
|
||||
<Chip active={onlyMissing} disabled={panel === 'project'}
|
||||
title={panel === 'project' ? '项目素材面板暂不支持该筛选' : '只看还没有任何素材的资产'}
|
||||
onClick={() => setOnlyMissing(!onlyMissing)}>缺素材</Chip>
|
||||
<Chip active={onlyUnused} disabled={panel === 'project'}
|
||||
title="只看还没被任何镜头引用的资产,便于清理"
|
||||
onClick={() => setOnlyUnused(!onlyUnused)}>未被镜头使用</Chip>
|
||||
<BarRight>
|
||||
{filterActive
|
||||
? <Value>命中 {shownCount} / {panelTotal}
|
||||
<Button icon={<IconClose />} type="link" className="ml-[5px] pb-0" onClick={resetFilters}>清除筛选</Button>
|
||||
</Value>
|
||||
: panelTotal ? <Value>共 {panelTotal} 项</Value> : null}
|
||||
</BarRight>
|
||||
</Ctlbar>
|
||||
</Panel>
|
||||
|
||||
{/* 勾选之后才出现的批量条:临时工具条 = 只有卡头的那张卡(描边走主色,表示「这不是内容」) */}
|
||||
{pickedRows.length > 0 && (
|
||||
<div className="flex flex-wrap items-center gap-2 mb-3 px-3 py-2 border border-primary-border rounded-lg bg-primary-bg text-xs ">
|
||||
<b className="text-xs">已选 {pickedRows.length} 个{PANEL_LABEL[panel]}</b>
|
||||
<span className={cn(MUTED, 'text-xs')}>其中 {pickedUsed} 个仍被镜头引用</span>
|
||||
<Button size="sm" disabled={!!busy} onClick={bulkPublish} icon={<IconUpload />}>批量上架平台</Button>
|
||||
<Button type="text" danger disabled={!!busy} onClick={bulkDelete} icon={<IconDelete />}>批量删除</Button>
|
||||
<Button size="sm" onClick={clearPicks}>取消选择</Button>
|
||||
</div>
|
||||
<Toolbar className="!border-primary-border"
|
||||
info={`已选 ${pickedRows.length} 个${PANEL_LABEL[panel]}`}
|
||||
sub={`其中 ${pickedUsed} 个仍被镜头引用`}
|
||||
actions={<>
|
||||
<Button disabled={!!busy} onClick={bulkPublish} icon={<IconUpload />}>批量上架平台</Button>
|
||||
<Button type="text" danger disabled={!!busy} onClick={bulkDelete} icon={<IconDelete />}>批量删除</Button>
|
||||
<Button icon={<IconClose />} onClick={clearPicks}>取消选择</Button>
|
||||
</>} />
|
||||
)}
|
||||
|
||||
<ErrorText className="mb-3">{error}</ErrorText>
|
||||
|
|
@ -827,14 +835,13 @@ export default function Library() {
|
|||
{panel === 'human' && (
|
||||
<Panel>
|
||||
<PanelHead
|
||||
title={<span title="定妆图 / 三视图 / 服装 / 表情 → 自动拼接到镜头提示词">角色与一致性素材</span>} />
|
||||
title={<span title="定妆图 / 三视图 / 服装 / 表情 → 自动拼接到镜头提示词">角色与一致性素材</span>}
|
||||
right={selAll()} />
|
||||
{!characters.length
|
||||
? <Empty>还没有人物。建立人物并上传定妆图,导入分镜时就能按名称自动绑定。</Empty>
|
||||
: !shownHumans.length
|
||||
? <Empty>当前筛选下没有人物。<Button size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
? <Empty>当前筛选下没有人物。<Button icon={<IconClose />} size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
: <>
|
||||
<SelectAll checked={allPicked} onChange={checkAllRows}
|
||||
label={`全选当前 ${shownHumans.length} 个人物`} />
|
||||
{shownHumans.map((c) => {
|
||||
const picked = picks.has(`human:${c.id}`)
|
||||
const use = usageFor('human', c.id)
|
||||
|
|
@ -845,11 +852,16 @@ export default function Library() {
|
|||
onToggle={(ev) => togglePick(c, ev)} />
|
||||
<Avatar name={c.name}>{String(c.name || '').slice(0, 1)}</Avatar>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h4>{c.name} <Tag>{c.role || '角色'}</Tag>{!c.is_active && <Tag tone="bad">已停用</Tag>}</h4>
|
||||
{/* 标题行:名字 + 角色 + 引用数同一行读完,不再为「被几个镜头用」单独占一行 */}
|
||||
<Row tight className="!gap-2">
|
||||
<b className="text-sm">{c.name}</b>
|
||||
<Tag>{c.role || '角色'}</Tag>
|
||||
{!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>
|
||||
<UsageLine type="human" id={c.id} usage={use} projectId={projectId} />
|
||||
{/* 素材行 = 卡片动作行:容器下发 antd 紧凑档(componentSize=small),
|
||||
于是两颗按钮是同一档、同一圆角,标签走只读标签的 sm 档,
|
||||
一行里不再出现「一种按钮两档高、圆角一个 6 一个 8」。 */}
|
||||
|
|
@ -860,7 +872,7 @@ export default function Library() {
|
|||
queue={mediaQueue(c)} index={ai}
|
||||
title={`${assetKindLabel(a.kind)} · ${a.name} · v${a.version}`} />
|
||||
<Tag size="sm">{assetKindLabel(a.kind)} v{a.version}</Tag>
|
||||
{a.metadata?.model && <Tag size="sm" tone="info">{a.metadata.provider}/{a.metadata.model}</Tag>}
|
||||
{a.metadata?.model && <Tag size="sm">{a.metadata.provider}/{a.metadata.model}</Tag>}
|
||||
<Button size="sm" title="登记新版本" aria-label="登记新版本"
|
||||
onClick={() => refreshAsset(a)} icon={<IconSync />} />
|
||||
<Button type="text" danger size="sm" title="删除素材" aria-label="删除素材" onClick={() => dropAsset(a)} icon={<IconDelete />} />
|
||||
|
|
@ -869,22 +881,28 @@ export default function Library() {
|
|||
</CardActions>
|
||||
<AiBar title="定妆图 / 三视图 / 服装 / 表情 → 自动登记新版本并作为镜头参考图"
|
||||
icon={<IconImage />} label="AI 资产生成"
|
||||
last={gens && <Tag tone="ok">最近:{gens.provider}/{gens.model}</Tag>}
|
||||
last={gens && <Tag>最近:{gens.provider}/{gens.model}</Tag>}
|
||||
disabled={!imageProviders.length}
|
||||
disabledHint="模型管理中心还没有可用的图像模型"
|
||||
onOpen={() => openGen('human', c)} />
|
||||
<Actions>
|
||||
<FilePick label="定妆图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'portrait', '定妆图')} />
|
||||
<FilePick label="三视图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'turnaround', '三视图')} />
|
||||
<FilePick label="服装" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'costume', '服装参考')} />
|
||||
<FilePick label="表情" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'expression', '表情参考')} />
|
||||
<Button size="sm" onClick={() => edit('human', c)}>编辑</Button>
|
||||
<Button size="sm" onClick={() => publish('human', c)}>上架平台</Button>
|
||||
<Button type="text" danger title="删除这个人物" onClick={() => drop('characters', c)}>删除</Button>
|
||||
{/* 四类一致性素材是「一次上传」的四个槽位,必须成套出现;
|
||||
编辑 / 上架 / 删除是对这个人物的动作,另一组 */}
|
||||
<ActionGroup>
|
||||
<FilePick icon=<IconImage /> label="定妆图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'portrait', '定妆图')} />
|
||||
<FilePick icon=<IconImage /> label="三视图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'turnaround', '三视图')} />
|
||||
<FilePick icon=<IconImage /> label="服装" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'costume', '服装参考')} />
|
||||
<FilePick icon=<IconImage /> label="表情" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('human', c.id), 'expression', '表情参考')} />
|
||||
</ActionGroup>
|
||||
<ActionGroup>
|
||||
<Button icon={<IconEdit />} size="sm" onClick={() => edit('human', c)}>编辑</Button>
|
||||
<Button icon={<IconUpload />} size="sm" onClick={() => publish('human', c)}>上架平台</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这个人物" onClick={() => drop('characters', c)} aria-label="删除这个人物" />
|
||||
</ActionGroup>
|
||||
</Actions>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -897,65 +915,57 @@ export default function Library() {
|
|||
{/* ===== 场景资产 ===== */}
|
||||
{panel === 'scene' && (
|
||||
<Panel>
|
||||
<PanelHead title="场景与美术参考" />
|
||||
<PanelHead title="场景与美术参考"
|
||||
right={selAll()} />
|
||||
{!scenes.length
|
||||
? <Empty>还没有场景。导入分镜时脚本里的「场景:」字段会按名称匹配这里登记的内容。</Empty>
|
||||
: !shownScenes.length
|
||||
? <Empty>当前筛选下没有场景。<Button size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
? <Empty>当前筛选下没有场景。<Button icon={<IconClose />} size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
: <>
|
||||
<SelectAll checked={allPicked} onChange={checkAllRows}
|
||||
label={`全选当前 ${shownScenes.length} 个场景`} />
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={900} className="[&_tbody_tr[data-chosen]>td]:bg-primary-bg">
|
||||
<thead>
|
||||
<tr><th>场景</th><th>提示词</th><th>光线 / 时间 / 色调</th><th>参考图</th><th className={cellRight}>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shownScenes.map((s) => {
|
||||
const picked = picks.has(`scene:${s.id}`)
|
||||
const use = usageFor('scene', s.id)
|
||||
return (
|
||||
<tr key={s.id} data-chosen={picked || undefined}>
|
||||
<td>
|
||||
<div className="flex items-start gap-2 min-w-0">
|
||||
<PickBox checked={picked} label={`选择场景 ${s.name}`} className="mt-1"
|
||||
onToggle={(ev) => togglePick(s, ev)} />
|
||||
<div className="min-w-0">
|
||||
<b>{s.name}</b>
|
||||
<div className={MUTED_MONO}>{s.code || '—'}</div>
|
||||
<UsageLine type="scene" id={s.id} usage={use} projectId={projectId} limit={3} />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className={cellWrap}>{s.prompt || s.description || '—'}</td>
|
||||
<td className={cn(cellWrap, MUTED)}>{[s.lighting, s.time_of_day, s.palette].filter(Boolean).join(' · ') || '—'}</td>
|
||||
<td>
|
||||
<div className="flex items-center gap-2 flex-wrap min-w-0">
|
||||
{assetsOf(s).map((a: any, ai: number) => (
|
||||
<MediaThumb key={a.id} width="34px" src={a.url} kind={a.kind}
|
||||
size="xs" inlineAudio={false} queue={mediaQueue(s)} index={ai} title={a.name} />
|
||||
))}
|
||||
{!assetsOf(s).length && <span className={MUTED}>未上传</span>}
|
||||
</div>
|
||||
</td>
|
||||
<td className={cellRight}>
|
||||
<div className="flex items-center justify-end gap-2 flex-wrap min-w-0 ">
|
||||
<FilePick label="场景图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('scene', s.id), 'scene_image', s.name)} />
|
||||
<Button size="sm" disabled={!imageProviders.length}
|
||||
title="打开生成台(模型 / 参考图 / 提示词)"
|
||||
onClick={() => openGen('scene', s)} icon={<IconImage />}>AI 生成</Button>
|
||||
<Button size="sm" onClick={() => edit('scene', s)}>编辑</Button>
|
||||
<Button size="sm" onClick={() => publish('scene', s)}>上架平台</Button>
|
||||
<Button type="text" danger title="删除这个场景" onClick={() => drop('scenes', s)}>删除</Button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={false}
|
||||
minWidth={900}
|
||||
rowKey="id"
|
||||
chosen={(s: any) => picks.has(`scene:${s.id}`)}
|
||||
dataSource={shownScenes}
|
||||
columns={[
|
||||
{ title: '', key: 'pick', width: 40, render: (_: any, s: any) => (
|
||||
<PickBox checked={picks.has(`scene:${s.id}`)} label={`选择场景 ${s.name}`} className="mt-1"
|
||||
onToggle={(ev) => togglePick(s, ev)} />
|
||||
) },
|
||||
{ title: '场景', key: 'name', width: 220, render: (_: any, s: any) => (
|
||||
<div className="min-w-0">
|
||||
<b>{s.name}</b>
|
||||
<div className={MUTED_MONO}>{s.code || '—'}</div>
|
||||
<UsageLine type="scene" id={s.id} usage={usageFor('scene', s.id)} projectId={projectId} limit={3} />
|
||||
</div>
|
||||
) },
|
||||
{ title: '提示词', key: 'prompt', className: cellWrap, render: (_: any, s: any) => s.prompt || s.description || '—' },
|
||||
{ title: '光线 / 时间 / 色调', key: 'look', width: 200, className: `${cellWrap} ${MUTED}`,
|
||||
render: (_: any, s: any) => [s.lighting, s.time_of_day, s.palette].filter(Boolean).join(' · ') || '—' },
|
||||
{ title: '参考图', key: 'refs', width: 130, render: (_: any, s: any) => (
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||
{assetsOf(s).map((asset: any, ai: number) => (
|
||||
<MediaThumb key={asset.id} width="34px" src={asset.url} kind={asset.kind}
|
||||
size="xs" inlineAudio={false} queue={mediaQueue(s)} index={ai} title={asset.name} />
|
||||
))}
|
||||
{!assetsOf(s).length && <span className={MUTED}>未上传</span>}
|
||||
</div>
|
||||
) },
|
||||
{ title: '操作', key: 'actions', width: 340, align: 'right', render: (_: any, s: any) => (
|
||||
<Row className="justify-end">
|
||||
<FilePick icon=<IconImage /> label="场景图" accept={IMAGE_REF_ACCEPT}
|
||||
onFiles={onUpload(assetPath('scene', s.id), 'scene_image', s.name)} />
|
||||
<Button size="sm" disabled={!imageProviders.length}
|
||||
title="打开生成台(模型 / 参考图 / 提示词)"
|
||||
onClick={() => openGen('scene', s)} icon={<IconImage />}>AI 生成</Button>
|
||||
<Button icon={<IconEdit />} size="sm" onClick={() => edit('scene', s)}>编辑</Button>
|
||||
<Button icon={<IconUpload />} size="sm" onClick={() => publish('scene', s)}>上架平台</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这个场景" onClick={() => drop('scenes', s)} aria-label="删除这个场景" />
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</>}
|
||||
</Panel>
|
||||
)}
|
||||
|
|
@ -964,14 +974,13 @@ export default function Library() {
|
|||
{panel === 'voice' && (
|
||||
<Panel>
|
||||
<PanelHead
|
||||
title={<span title="镜头绑定声线后,台词会自动生成配音并参与混音">声线与配音模型</span>} />
|
||||
title={<span title="镜头绑定声线后,台词会自动生成配音并参与混音">声线与配音模型</span>}
|
||||
right={selAll()} />
|
||||
{!voices.length
|
||||
? <Empty>还没有声线。先登记声线基础设定,再到生成区选择真实 TTS 模型。</Empty>
|
||||
: !shownVoices.length
|
||||
? <Empty>当前筛选下没有声线。<Button size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
? <Empty>当前筛选下没有声线。<Button icon={<IconClose />} size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
: <>
|
||||
<SelectAll checked={allPicked} onChange={checkAllRows}
|
||||
label={`全选当前 ${shownVoices.length} 条声线`} />
|
||||
{shownVoices.map((v) => {
|
||||
const picked = picks.has(`voice:${v.id}`)
|
||||
const use = usageFor('voice', v.id)
|
||||
|
|
@ -981,18 +990,22 @@ export default function Library() {
|
|||
<PickBox checked={picked} label={`选择声线 ${v.name}`} className="mt-1"
|
||||
onToggle={(ev) => togglePick(v, ev)} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<h4>{v.name} <Tag>{v.provider}</Tag>{v.is_default && <Tag tone="ok">默认</Tag>}</h4>
|
||||
<Row tight className="!gap-2">
|
||||
<b className="text-sm">{v.name}</b>
|
||||
<Tag>{v.provider}</Tag>
|
||||
{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>
|
||||
<UsageLine type="voice" id={v.id} usage={use} projectId={projectId} />
|
||||
<AiBar title="调用声音模型生成并登记为音色样本版本(IndexTTS2 支持参考音频克隆)"
|
||||
icon={<IconVoice />} label="AI 试听样本"
|
||||
last={gens && <Tag tone="ok">{gens.provider}/{gens.model}</Tag>}
|
||||
last={gens && <Tag>{gens.provider}/{gens.model}</Tag>}
|
||||
disabled={!ttsProviders.length}
|
||||
disabledHint="模型管理中心还没有可用的声音模型"
|
||||
onOpen={() => openGen('voice', v)} />
|
||||
<Actions>
|
||||
<FilePick label="音色样本" accept="audio/*"
|
||||
<FilePick icon=<IconVoice /> label="音色样本" accept="audio/*"
|
||||
onFiles={onUpload(assetPath('voice', v.id), 'voice_sample', v.name)} />
|
||||
<RecordAudio label="录音色样本" target="音色样本"
|
||||
defaultName={defaultAssetName(v.assets, v.name, 'voice_sample')}
|
||||
|
|
@ -1003,9 +1016,9 @@ export default function Library() {
|
|||
<AudioPlay key={a.id} src={a.url} label={`${v.name} · ${a.name}`}
|
||||
durationMs={a.duration_ms} size="sm" />
|
||||
))}
|
||||
<Button size="sm" onClick={() => edit('voice', v)}>编辑</Button>
|
||||
<Button size="sm" onClick={() => publish('voice', v)}>上架平台</Button>
|
||||
<Button type="text" danger title="删除这条声线" onClick={() => drop('voices', v)}>删除</Button>
|
||||
<Button icon={<IconEdit />} size="sm" onClick={() => edit('voice', v)}>编辑</Button>
|
||||
<Button icon={<IconUpload />} size="sm" onClick={() => publish('voice', v)}>上架平台</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这条声线" onClick={() => drop('voices', v)} aria-label="删除这条声线" />
|
||||
</Actions>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1022,49 +1035,44 @@ export default function Library() {
|
|||
title={<span title="配乐可在「时间线合成」页直接挂到音轨">配乐 / 音效 / 通用参考</span>} />
|
||||
<Row className="mb-4">
|
||||
{PROJECT_ASSET_KINDS.map((k) => (
|
||||
<FilePick key={k} label={`上传${assetKindLabel(k)}`}
|
||||
<FilePick icon=<IconUpload /> key={k} label={`上传${assetKindLabel(k)}`}
|
||||
onFiles={onUpload(`/api/projects/${projectId}/assets`, k, assetKindLabel(k))} />
|
||||
))}
|
||||
</Row>
|
||||
{!projectAssets.length
|
||||
? <Empty>还没有项目级素材。</Empty>
|
||||
: !shownProjectAssets.length
|
||||
? <Empty>当前搜索下没有素材。<Button size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
? <Empty>当前搜索下没有素材。<Button icon={<IconClose />} size="sm" className="ml-2" onClick={resetFilters}>清除筛选</Button></Empty>
|
||||
: (
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={820}>
|
||||
<thead>
|
||||
<tr><th>名称</th><th>类型</th><th>大小</th><th>版本</th><th>上传时间</th><th>预览</th><th className={cellRight}>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shownProjectAssets.map((a: any, ai: number) => (
|
||||
<tr key={a.id}>
|
||||
<td><b>{a.name}</b><div className={MUTED_MONO}>{a.path}</div></td>
|
||||
<td><Tag>{assetKindLabel(a.kind)}</Tag></td>
|
||||
<td className={MONO}>{fmtBytes(a.size_bytes)}</td>
|
||||
<td className={MONO}>v{a.version}</td>
|
||||
<td className={MUTED}>{fmtTime(a.created_at || a.versions?.[0]?.created_at)}</td>
|
||||
<td>
|
||||
{isAudioAsset(a)
|
||||
? <AudioPlay src={a.url} label={a.name} durationMs={a.duration_ms} size="sm" />
|
||||
: isImageAsset(a) || isVideoAsset(a)
|
||||
? (
|
||||
<MediaThumb width="34px" src={a.url} kind={a.kind}
|
||||
size="xs" inlineAudio={false} queue={projectMediaQueue} index={ai} title={a.name} />
|
||||
)
|
||||
: <ExtLink href={a.url}>打开</ExtLink>}
|
||||
</td>
|
||||
<td className={cellRight}>
|
||||
<div className="flex items-center justify-end gap-2 flex-wrap min-w-0 ">
|
||||
<Button size="sm" onClick={() => refreshAsset(a)} icon={<IconSync />}>新版本</Button>
|
||||
<Button type="text" danger title="删除这个素材" onClick={() => dropAsset(a)}>删除</Button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={false}
|
||||
minWidth={820}
|
||||
dataSource={shownProjectAssets}
|
||||
columns={[
|
||||
{ title: '名称', key: 'name', render: (_: any, row: any) => (
|
||||
<><b>{row.name}</b><div className={MUTED_MONO}>{row.path}</div></>
|
||||
) },
|
||||
{ title: '类型', key: 'kind', width: 104, render: (_: any, row: any) => <Tag>{assetKindLabel(row.kind)}</Tag> },
|
||||
{ title: '大小', key: 'size', width: 92, className: MONO, render: (_: any, row: any) => fmtBytes(row.size_bytes) },
|
||||
{ title: '版本', key: 'version', width: 72, className: MONO, render: (_: any, row: any) => `v${row.version}` },
|
||||
{ title: '上传时间', key: 'created', width: 156, className: MUTED,
|
||||
render: (_: any, row: any) => fmtTime(row.created_at || row.versions?.[0]?.created_at) },
|
||||
{ title: '预览', key: 'preview', width: 150, render: (_: any, row: any, ai: number) => (
|
||||
isAudioAsset(row)
|
||||
? <AudioPlay src={row.url} label={row.name} durationMs={row.duration_ms} size="sm" />
|
||||
: isImageAsset(row) || isVideoAsset(row)
|
||||
? <MediaThumb width="34px" src={row.url} kind={row.kind}
|
||||
size="xs" inlineAudio={false} queue={projectMediaQueue} index={ai} title={row.name} />
|
||||
: <ExtLink href={row.url}>打开</ExtLink>
|
||||
) },
|
||||
{ title: '操作', key: 'actions', width: 190, align: 'right', render: (_: any, row: any) => (
|
||||
<Row className="justify-end">
|
||||
<Button size="sm" onClick={() => refreshAsset(row)} icon={<IconSync />}>新版本</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger title="删除这个素材" onClick={() => dropAsset(row)} aria-label="删除这个素材" />
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
{health?.executor === 'inline' && (
|
||||
<LineHint className="mt-3">当前任务在平台内即时执行,提交配音或生成后会很快完成,进度自动刷新。</LineHint>
|
||||
|
|
@ -1077,9 +1085,9 @@ export default function Library() {
|
|||
title={<span title="编辑区已展开为全宽抽屉,长文本可直接拖拽调整高度">{editing.kind === 'human' ? '编辑人物' : '新建人物'}</span>}
|
||||
actions={<>
|
||||
{/* 浮层底部口径:辅助动作(mr-auto) → 取消 → 主行动。见 Overlay.DRAWER_ACTIONS 注释。 */}
|
||||
<Button className="mr-auto" onClick={() => { setChar({ ...EMPTY_CHAR }); setEditing({ kind: '', id: null }) }}>清空</Button>
|
||||
<Button onClick={closeForm}>取消</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={saveCharacter}>{busy ? '处理中…' : '保存人物'}</Button>
|
||||
<Button icon={<IconClose />} className="mr-auto" onClick={() => { setChar({ ...EMPTY_CHAR }); setEditing({ kind: '', id: null }) }}>清空</Button>
|
||||
<Button icon={<IconClose />} onClick={closeForm}>取消</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={saveCharacter}>{busy ? '处理中…' : '保存人物'}</Button>
|
||||
</>}>
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
|
|
@ -1115,9 +1123,9 @@ export default function Library() {
|
|||
title={<span title="编辑区已展开为全宽抽屉,长文本可直接拖拽调整高度">{editing.kind === 'scene' ? '编辑场景' : '新建场景'}</span>}
|
||||
actions={<>
|
||||
{/* 浮层底部口径:辅助动作(mr-auto) → 取消 → 主行动。见 Overlay.DRAWER_ACTIONS 注释。 */}
|
||||
<Button className="mr-auto" onClick={() => { setScene({ ...EMPTY_SCENE }); setEditing({ kind: '', id: null }) }}>清空</Button>
|
||||
<Button onClick={closeForm}>取消</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={saveScene}>{busy ? '处理中…' : '保存场景'}</Button>
|
||||
<Button icon={<IconClose />} className="mr-auto" onClick={() => { setScene({ ...EMPTY_SCENE }); setEditing({ kind: '', id: null }) }}>清空</Button>
|
||||
<Button icon={<IconClose />} onClick={closeForm}>取消</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={saveScene}>{busy ? '处理中…' : '保存场景'}</Button>
|
||||
</>}>
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
|
|
@ -1146,9 +1154,9 @@ export default function Library() {
|
|||
title={<span title="编辑区已展开为全宽抽屉,长文本可直接拖拽调整高度">{editing.kind === 'voice' ? '编辑声线' : '新建声线'}</span>}
|
||||
actions={<>
|
||||
{/* 浮层底部口径:辅助动作(mr-auto) → 取消 → 主行动。见 Overlay.DRAWER_ACTIONS 注释。 */}
|
||||
<Button className="mr-auto" onClick={clearVoiceForm}>清空</Button>
|
||||
<Button onClick={closeForm}>取消</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={saveVoice}>{busy ? '处理中…' : '保存声线'}</Button>
|
||||
<Button icon={<IconClose />} className="mr-auto" onClick={clearVoiceForm}>清空</Button>
|
||||
<Button icon={<IconClose />} onClick={closeForm}>取消</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={saveVoice}>{busy ? '处理中…' : '保存声线'}</Button>
|
||||
</>}>
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
|
|
@ -1213,7 +1221,7 @@ export default function Library() {
|
|||
title="用大模型把资产设定改写成一段可复用的一致性提示词,先预览再决定采用"
|
||||
onClick={() => suggestText(genSuggestType, genOwner)} icon={<IconBulb />}>AI 补全一致性提示词</Button>
|
||||
)}
|
||||
<Button onClick={closeGen}>取消</Button>
|
||||
<Button icon={<IconClose />} onClick={closeGen}>取消</Button>
|
||||
<Button type="primary" loading={!!busy} disabled={!genProvidersReady} onClick={genFromDrawer}
|
||||
icon={genType === 'voice' ? <IconVoice /> : <IconImage />}>
|
||||
{genType === 'voice' ? '生成试听样本' : `生成${assetKindLabel(genDraft.kind)}`}
|
||||
|
|
@ -1237,7 +1245,7 @@ export default function Library() {
|
|||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考音色" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
<Select value={genDraft.reference_asset_id}
|
||||
onChange={(v) => patchDraft(genType, genOwner, { reference_asset_id: v === null ? null : Number(v) })}
|
||||
options={[
|
||||
/* 「自动」到底自动成什么,必须写在这个选项上:留空时后端按性别借嗓子,
|
||||
|
|
@ -1250,7 +1258,7 @@ export default function Library() {
|
|||
...voiceReferenceOptions(genOwner).map((a: any) => ({
|
||||
value: a.id, label: `${a.name} · ${assetKindLabel(a.kind)} v${a.version}` }))]} />
|
||||
</Field>
|
||||
<FilePick label="上传参考音色" accept="audio/*" className="flex-none border-primary-border text-primary"
|
||||
<FilePick icon=<IconVoice /> label="上传参考音色" accept="audio/*" className="flex-none border-primary-border text-primary"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference('voice', genOwner, f) }} />
|
||||
<RecordAudio label="录参考音色" target="参考音色"
|
||||
defaultName={defaultAssetName(genOwner.assets, `${genOwner.name}参考音色`, 'reference')}
|
||||
|
|
@ -1296,13 +1304,13 @@ export default function Library() {
|
|||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考图" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
<Select value={genDraft.reference_asset_id}
|
||||
onChange={(v) => patchDraft(genType, genOwner, { reference_asset_id: v === null ? null : Number(v) })}
|
||||
options={[{ value: null, label: '不使用参考图(纯文生图)' },
|
||||
...imageReferenceOptions(genOwner).map((a: any) => ({
|
||||
value: a.id, label: `${a.name} · ${assetKindLabel(a.kind)} v${a.version}` }))]} />
|
||||
</Field>
|
||||
<FilePick label="上传参考图" accept={IMAGE_REF_ACCEPT}
|
||||
<FilePick icon=<IconImage /> label="上传参考图" accept={IMAGE_REF_ACCEPT}
|
||||
title="选择已有定妆 / 三视图 / 场景素材,或临时上传一张图作为本次生成锚点,可显著提升跨镜头一致性。"
|
||||
className="flex-none border-primary-border text-primary"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference(genType, genOwner, f) }} />
|
||||
|
|
@ -1383,7 +1391,7 @@ function UsageLine({ type, id, usage, projectId, limit = 5 }: {
|
|||
}) {
|
||||
return (
|
||||
<TagGroup size="sm" className="mb-0 mt-2">
|
||||
<Tag tone={usage.count ? 'ok' : 'default'}>被 {usage.count} 个镜头使用</Tag>
|
||||
<Tag>被 {usage.count} 个镜头使用</Tag>
|
||||
{(usage.shots || []).slice(0, limit).map((shot: any) => (
|
||||
<Link key={shot.id} to={`/projects/${projectId}/storyboard?shot=${shot.id}`}
|
||||
title={`跳转到分镜 #${shot.order_index}`}
|
||||
|
|
@ -1395,14 +1403,16 @@ function UsageLine({ type, id, usage, projectId, limit = 5 }: {
|
|||
)
|
||||
}
|
||||
|
||||
/** 全选条(.lib-selectall):虚线框贴在列表头上,右侧将来留给本面板计数/动作 */
|
||||
/**
|
||||
* 全选框(规则①:一行都不多占)——它只是「本面板 N 条全选」的一颗 Checkbox,
|
||||
* 原先那条虚线框是自己画的壳,现在整颗挪进卡头 right,和标题共用一行。
|
||||
*/
|
||||
function SelectAll({ checked, onChange, label }: {
|
||||
checked: boolean; onChange: () => void; label: ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div className={cn('flex items-center justify-between gap-3 mb-2 px-3 py-2', 'border border-dashed border-border rounded-lg bg-bg-container')}>
|
||||
<Check checked={checked} onChange={onChange} title="勾选后可批量上架 / 删除;按住 Shift 连选">{label}</Check>
|
||||
</div>
|
||||
<Check checked={checked} onChange={onChange}
|
||||
title="勾选后可批量上架 / 删除;按住 Shift 连选">{label}</Check>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1417,20 +1427,22 @@ function AiBar({ icon, label, title, last, disabled, disabledHint, onOpen }: {
|
|||
disabled?: boolean; disabledHint?: string; onOpen: () => void
|
||||
}) {
|
||||
return (
|
||||
<div className={cn(' flex items-center flex-wrap gap-2 mt-3 px-3 py-2', 'border border-border rounded-lg bg-bg-container')}>
|
||||
<Block className="mt-3">
|
||||
<b className="text-xs text-text-secondary"><IconText icon={icon}>{label}</IconText></b>
|
||||
{last}
|
||||
<Button type="primary" size="sm" className="ml-auto" disabled={disabled}
|
||||
<Button icon={<IconBolt />} type="primary" className="ml-auto" disabled={disabled}
|
||||
title={disabled ? disabledHint : '打开生成台(模型 / 类型 / 参考图 / 提示词)'}
|
||||
onClick={onOpen}>打开生成台</Button>
|
||||
</div>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
/** 参考素材行(.generation-reference):抽屉里唯一一处「选择 + 上传 + 录制」并排 */
|
||||
function GenerationReference({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<Ctlbar className="m-0 py-2 px-3 border border-border rounded-md bg-bg-container">{children}</Ctlbar>
|
||||
<Block>
|
||||
<Ctlbar className="!mb-0 w-full">{children}</Ctlbar>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1442,24 +1454,21 @@ function GenerationReference({ children }: { children: ReactNode }) {
|
|||
*/
|
||||
function RefStatus({ ready, borrowed, note }: { ready: boolean; borrowed: boolean; note?: string }) {
|
||||
return (
|
||||
<p className={cn('flex-[1_1_100%] mt-0.5 mb-0 px-2 py-2 rounded-lg border '
|
||||
+ 'text-xs leading-normal text-text',
|
||||
!ready ? 'border-error-border bg-error-bg'
|
||||
: borrowed ? 'border-warning-border bg-warning-bg'
|
||||
: 'border-success-border bg-success-bg')}>
|
||||
<b className="mr-1"><IconText icon={ready ? (borrowed ? <IconWarn /> : <IconPass />)
|
||||
<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>
|
||||
{note}
|
||||
</p>
|
||||
<span className="min-w-0 text-xs leading-normal">{note}</span>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
/** 模型未就绪 / 完全没模型的提醒(.provider-warning):说清楚是「还能选」还是「点不动」 */
|
||||
function ProviderWarning({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<small className="block mt-2 px-2 py-2 border border-warning-border rounded-sm bg-warning-bg text-warning text-xs leading-normal">
|
||||
{children}
|
||||
</small>
|
||||
<Block tone="warn" align="start" className="mt-2 w-full text-xs leading-normal text-warning">
|
||||
<span className="min-w-0">{children}</span>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1468,12 +1477,12 @@ function SuggestionBox({ text, busy, onApply, onDismiss }: {
|
|||
text: string; busy: boolean; onApply: () => void; onDismiss: () => void
|
||||
}) {
|
||||
return (
|
||||
<div className="p-2 bg-primary-bg border border-primary-border rounded-md">
|
||||
<p className="m-0 mb-2 text-xs leading-relaxed text-text-secondary">{text}</p>
|
||||
<Actions className="mt-0">
|
||||
<Button type="primary" size="sm" disabled={busy} onClick={onApply}>采用为一致性提示词</Button>
|
||||
<Button size="sm" onClick={onDismiss}>放弃</Button>
|
||||
</Actions>
|
||||
</div>
|
||||
<Block tone="info" align="start" className="w-full">
|
||||
<p className="m-0 w-full text-xs leading-relaxed text-text-secondary">{text}</p>
|
||||
<CardActions>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={busy} onClick={onApply}>采用为一致性提示词</Button>
|
||||
<Button icon={<IconClose />} onClick={onDismiss}>放弃</Button>
|
||||
</CardActions>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ 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, Panel, PanelHead, Row, Stack, Stat, PageStack, Table, TableBox, Tag, TagGroup, TextArea, Value, cellCenter, cellWrap } from '../../components/ui'
|
||||
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 AgentConsole from './AgentConsole'
|
||||
import { IconPass } from '../../components/icons'
|
||||
import { IconCheck, IconChevronRight, IconChevronUp, IconClose, IconPass } from '../../components/icons'
|
||||
/**
|
||||
* 只放后端 ProjectUpdate 真实接受的字段。
|
||||
* status 不在这里:项目状态由后端 status.refresh() 按镜头与任务真实进度回写,
|
||||
|
|
@ -263,31 +263,25 @@ export default function Overview() {
|
|||
{/* 流程节点与指标卡由项目 store 每 6 秒轮询,本页只负责预检与事件流 */}
|
||||
<Panel>
|
||||
<PanelHead title="流程节点明细" />
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={720}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="w-[64px]">状态</th>
|
||||
<th>节点</th>
|
||||
<th>说明</th>
|
||||
<th className={`${cellCenter} w-[74px]`}>完成度</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{workflow.map((s: any) => (
|
||||
<tr key={s.key}>
|
||||
<td><Tag tone={STATE_TONE[s.state] || 'default'}>{STATE_LABEL[s.state] || s.state}</Tag></td>
|
||||
<td>
|
||||
<b>{s.label}</b>
|
||||
<div className={MUTED_MONO}>{s.key}</div>
|
||||
</td>
|
||||
<td className={cellWrap}>{s.detail}</td>
|
||||
<td className={cn(MONO, cellCenter)}>{s.done == null ? '—' : `${s.done}/${s.total}`}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={false}
|
||||
minWidth={720}
|
||||
dataSource={workflow}
|
||||
rowKey="key"
|
||||
columns={[
|
||||
{ title: '状态', key: 'state', width: 92, 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) => (
|
||||
<>
|
||||
<b>{row.label}</b>
|
||||
<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}`) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel>
|
||||
|
|
@ -342,11 +336,11 @@ export default function Overview() {
|
|||
right={(
|
||||
<Row tight>
|
||||
<Tag tone={flowTagTone}>{flowTagText}</Tag>
|
||||
<Button size="sm" disabled={saving} onClick={() => setArchived(!isArchived)}
|
||||
<Button icon={<IconClose />} size="sm" disabled={saving} onClick={() => setArchived(!isArchived)}
|
||||
title="项目状态由后端按镜头与任务真实进度回写,这里只提供归档开关;归档后不再自动推进流程节点。">
|
||||
{isArchived ? '取消归档' : '归档项目'}
|
||||
</Button>
|
||||
<Button size="sm" onClick={() => setEditing(!editing)}>
|
||||
<Button icon={<IconChevronUp />} size="sm" onClick={() => setEditing(!editing)}>
|
||||
{editing ? '收起' : '编辑'}
|
||||
</Button>
|
||||
</Row>
|
||||
|
|
@ -418,7 +412,7 @@ export default function Overview() {
|
|||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={saving} onClick={save}>{saving ? '保存中…' : '保存设置'}</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={saving} onClick={save}>{saving ? '保存中…' : '保存设置'}</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : (
|
||||
|
|
@ -456,7 +450,8 @@ export default function Overview() {
|
|||
// hint 不在按钮里:antd 按钮 white-space:nowrap,整句塞进去窄屏必捅出视口
|
||||
// (430 档实测 363px > 342px 可用宽)。按钮只放动作,说明放旁边自己折行。
|
||||
<span key={a.to} className="inline-flex items-center gap-2 min-w-0 max-w-full">
|
||||
<LinkButton to={`/projects/${id}/${a.to}`} className="shrink-0">{a.label}</LinkButton>
|
||||
<LinkButton to={`/projects/${id}/${a.to}`} icon={<IconChevronRight />}
|
||||
className="shrink-0">{a.label}</LinkButton>
|
||||
<span className={cn(MUTED, 'leading-normal')}>{a.hint}</span>
|
||||
</span>
|
||||
))}
|
||||
|
|
@ -466,14 +461,23 @@ export default function Overview() {
|
|||
<Panel>
|
||||
<PanelHead title="资产与镜头统计"
|
||||
right={<Link className={LINK_CLS} to={`/projects/${id}/library`}>资产库</Link>} />
|
||||
<Grid cols={4} steps={STAT_STEPS}>
|
||||
{/*
|
||||
症状:这两排指标卡写在 <Stack>(右侧那一栏)里,却按整页宽度选了 4 列。
|
||||
antd 的 Col 断点看的是**视口**不是容器,所以 lg 以上永远给 6 等分,
|
||||
落到 ~440px 的侧栏里每格只剩 100px,"素材文件""审核合格"被压成两行竖排。
|
||||
做法:这一栏里的指标卡按侧栏宽度选 2 列(每格 ~210px,标签一行放得下),
|
||||
降档只留 sm(窄屏本来就单列)。
|
||||
为什么不给 Grid 加容器查询:站内所有栅格都按 antd Grid 的六个断点走,
|
||||
为一处侧栏引入第二套(容器)断点,代价是全站栅格又有了两种尺子。
|
||||
*/}
|
||||
<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} />
|
||||
</Grid>
|
||||
<Divider />
|
||||
<Grid cols={4} steps={STAT_STEPS}>
|
||||
<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} />
|
||||
|
|
@ -489,21 +493,20 @@ export default function Overview() {
|
|||
</Panel>
|
||||
|
||||
<Panel>
|
||||
<PanelHead
|
||||
title="项目事件流"
|
||||
right={(
|
||||
<Ctlbar className="mb-0">
|
||||
{EVENT_LEVELS.map((lv) => (
|
||||
<Chip key={lv.value || 'all'} active={level === lv.value} onClick={() => setLevel(lv.value)}>
|
||||
{lv.label}
|
||||
</Chip>
|
||||
))}
|
||||
<Field label="搜索" width="narrow">
|
||||
<Input value={eventKeyword} aria-label="搜索项目事件" placeholder="事件内容 / 动作" onChange={(e) => setEventKeyword(e.target.value)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
)}
|
||||
/>
|
||||
{/* 四颗筛选胶囊 + 一个搜索框塞在卡头右端会折成一坨(标题都被挤到换行),
|
||||
统一挪进正文:卡头只留标题,筛选条满宽横排。见 Dashboard 同处注释。 */}
|
||||
<PanelHead title="项目事件流"
|
||||
right={<Value>{shownEvents.length} / {events.length} 条</Value>} />
|
||||
<Ctlbar className="mb-2">
|
||||
{EVENT_LEVELS.map((lv) => (
|
||||
<Chip key={lv.value || 'all'} active={level === lv.value} onClick={() => setLevel(lv.value)}>
|
||||
{lv.label}
|
||||
</Chip>
|
||||
))}
|
||||
<Field inline label="搜索" width="grow" className="max-w-[240px]">
|
||||
<SearchInput value={eventKeyword} aria-label="搜索项目事件" placeholder="事件内容 / 动作" onChange={(e) => setEventKeyword(e.target.value)} />
|
||||
</Field>
|
||||
</Ctlbar>
|
||||
<LogBox>
|
||||
{shownEvents.map((e: any) => (
|
||||
<LogRow key={e.id} level={eventLevelKey(e.level)}
|
||||
|
|
@ -517,7 +520,7 @@ export default function Overview() {
|
|||
{!!events.length && !shownEvents.length && (
|
||||
<div className={cn(MUTED, 'flex flex-wrap items-center gap-2 py-2 px-0.5')}>
|
||||
当前筛选条件下没有事件。
|
||||
<Button size="sm"
|
||||
<Button icon={<IconClose />} size="sm"
|
||||
onClick={() => { setLevel(''); setEventKeyword('') }}>清除筛选</Button>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -13,17 +13,16 @@ import { useAutoRefresh } from '../../hooks'
|
|||
import { Select } from '../../components/forms'
|
||||
import { AudioPlay } from '../../components/media/AudioPlay'
|
||||
import { MediaThumb } from '../../components/media/MediaThumb'
|
||||
import { Actions, Between, Button, Check, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FieldBlock, FormRow, Grid, IconText, Input, Layout, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, Panel, PanelHead, ProgressBar, Row, Spinner, Status, PageStack, Table, TableBox, Tag, TagGroup, TextArea, cellCenter, cellRight, cellWrap } from '../../components/ui'
|
||||
import { 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 { refresh, useProjectStore } from '../../stores/project'
|
||||
import { notify } from '../../stores/notice'
|
||||
import { IconAim, IconEye, IconPass, IconReject, IconReload, IconWarn } from '../../components/icons'
|
||||
import { IconAim, IconDownload, IconEye, IconPass, IconReject, IconReload, IconRetry, IconWarn } from '../../components/icons'
|
||||
|
||||
const KIND_OPTIONS = [
|
||||
{ value: '', label: '全部记录' },
|
||||
{ value: 'auto', label: '仅自动质检' },
|
||||
{ value: 'manual', label: '仅人工审核' }
|
||||
]
|
||||
const EMPTY_CELL = 'text-center py-6 leading-relaxed'
|
||||
/** 检查项表固定列宽:右栏只有 ~460px,五列自动布局会把「标准」挤出容器 */
|
||||
const CHECK_COLS = ['w-[19%]', 'w-[13%] whitespace-nowrap', 'w-[28%]', 'w-[8%]', 'w-[32%]']
|
||||
const VISUAL_COLS = ['w-[22%]', 'w-[13%]', 'w-[17%]', 'w-[48%]']
|
||||
|
|
@ -209,26 +208,27 @@ export default function Review() {
|
|||
|
||||
return (
|
||||
<PageStack>
|
||||
<Between>
|
||||
<TagGroup className="mb-0">
|
||||
{/* 质检总览 + 三个批量动作:以前是 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>
|
||||
<Row>
|
||||
{busy ? <span className={MUTED}><Spinner /> {busy}…</span> : null}
|
||||
<Button size="sm" disabled={!!busy} onClick={qcAll} icon={<IconReload />}>全量重跑质检</Button>
|
||||
<Button size="sm" disabled={!!busy} onClick={recheckAll}
|
||||
</TagGroup>}
|
||||
actions={<>
|
||||
{busy ? <Value><Spinner /> {busy}…</Value> : null}
|
||||
<Button disabled={!!busy} onClick={qcAll} icon={<IconReload />}>全量重跑质检</Button>
|
||||
<Button disabled={!!busy} onClick={recheckAll}
|
||||
title="对所有已生成产物重新质检:技术指标 + 大模型看图判定人物/穿帮/镜头瑕疵" icon={<IconEye />}>整批复检(含画面质检)</Button>
|
||||
<Button type="primary" size="sm" disabled={!!busy || !approvable.length} onClick={approveAll}
|
||||
<Button type="primary" disabled={!!busy || !approvable.length} onClick={approveAll}
|
||||
title={busy ? '有任务正在执行,请稍候'
|
||||
: approvable.length ? `${approvable.length} 个镜头质检通过且待人工审核`
|
||||
: '没有可放行的镜头:需要「质检通过」且「人工未放行」;若已全部放行,此处会保持置灰'} icon={<IconPass />}>批量放行质检合格镜头</Button>
|
||||
</Row>
|
||||
</Between>
|
||||
</>} />
|
||||
<ErrorText>{error}</ErrorText>
|
||||
|
||||
<Layout>
|
||||
|
|
@ -237,63 +237,67 @@ export default function Review() {
|
|||
<PanelHead
|
||||
title={<span title="质检项由 QC_THRESHOLD 与镜头目标时长/分辨率决定;不合格项会阻塞时间线,需驳回重做。">自动质检清单</span>}
|
||||
right={<span className={MUTED}>产物 {generated.length} / 镜头 {shots.length}</span>} />
|
||||
<TableBox maxHeight={520}>
|
||||
{/* 六列里三列有固定职责:# 只放序号、状态放两行标签、得分放数字+条。
|
||||
不给它们显式宽度,浏览器会把宽度全给「问题」那列,标签被压到断字。 */}
|
||||
<Table pickable minWidth={960}>
|
||||
<thead>
|
||||
<tr><th className={`${cellCenter} w-8`}>#</th><th>镜头</th><th className="w-[96px]">状态</th>
|
||||
<th className={`${cellRight} w-[126px]`}>得分</th><th>问题</th><th className={cellRight}>操作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((r: any) => {
|
||||
const shot = byId[r.shot_id]
|
||||
const mark = reviewBadge(shot)
|
||||
return (
|
||||
<tr key={r.shot_id} data-chosen={selected === r.shot_id || undefined} onClick={() => setSelected(r.shot_id)}>
|
||||
<td className={cellCenter}><b>{r.order_index}</b></td>
|
||||
<td>{r.title}
|
||||
<div className={MUTED_MONO}>shot#{r.shot_id} · {r.probe?.width || '?'}×{r.probe?.height || '?'} · {r.probe?.duration ? `${r.probe.duration.toFixed(2)}s` : '—'}</div>
|
||||
</td>
|
||||
<td className="whitespace-nowrap"><Status value={r.status} />
|
||||
{r.review_state && r.review_state !== 'pending'
|
||||
? <div className="mt-1">
|
||||
<Tag tone={(mark?.tone as any) || (r.review_state === 'pass' ? 'ok' : 'bad')}
|
||||
title={shot?.review_notes || ''}>
|
||||
{mark?.text || (r.review_state === 'pass' ? '人工合格' : '人工不合格')}
|
||||
</Tag>
|
||||
</div>
|
||||
: null}
|
||||
</td>
|
||||
{/* 得分列固定宽:数字 + 条在一行里各占自己的轨道,
|
||||
副结论单独一行且不换行——列一窄「画面 35 / 技术 100」会拐成两行压到进度条上。 */}
|
||||
<td className={cellRight}>
|
||||
<div className="ml-auto w-[114px]">
|
||||
<div className="flex items-center gap-2">
|
||||
<b className={`${MONO} flex-none tabular-nums`}>{r.score === null ? '—' : r.score}</b>
|
||||
<ProgressBar className="min-w-0 flex-1" value={Math.max(0, Math.min(100, Number(r.score || 0)))} bad={!r.passed} />
|
||||
</div>
|
||||
{r.probe?.visual_score !== null && r.probe?.visual_score !== undefined
|
||||
? <div className={`${MUTED_MONO} mt-1 whitespace-nowrap text-xs`}>画面 {r.probe.visual_score} / 技术 {techOf(r) ?? '—'}</div>
|
||||
: <div className={`${MUTED} mt-1 text-xs`}>画面未检</div>}
|
||||
</div>
|
||||
</td>
|
||||
<td className={cellWrap}>
|
||||
{!r.issues?.length && !r.warnings?.length ? <span className={MUTED}>无</span> : null}
|
||||
{(r.issues || []).map((x: string) => <div key={`i${x}`} className="text-error">{x}</div>)}
|
||||
{(r.warnings || []).map((x: string) => <div key={`w${x}`} className={MUTED}><IconText icon={<IconWarn />}>{x}</IconText></div>)}
|
||||
</td>
|
||||
<td className={cellRight}>
|
||||
<Button size="sm" disabled={!!busy || !shot?.output_exists}
|
||||
onClick={(e) => { e.stopPropagation(); reQc(r.shot_id) }}>重跑</Button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
{!rows.length ? <tr><td colSpan={6} className={`${MUTED} ${EMPTY_CELL}`}>项目还没有镜头。</td></tr> : null}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
{/* 六列里三列有固定职责:# 只放序号、状态放两行标签、得分放数字+条。
|
||||
不给它们显式宽度,antd 的 fixed 布局会把宽度平均分掉,标签被压到断字。 */}
|
||||
<Table
|
||||
maxHeight={520}
|
||||
minWidth={960}
|
||||
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) => (
|
||||
<>
|
||||
{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>
|
||||
</>
|
||||
) },
|
||||
{ title: '状态', key: 'status', width: 108, className: 'whitespace-nowrap', render: (_: any, r: any) => {
|
||||
const shot = byId[r.shot_id]
|
||||
const mark = reviewBadge(shot)
|
||||
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}
|
||||
</>
|
||||
} },
|
||||
/* 得分列固定宽:数字 + 条在一行里各占自己的轨道,
|
||||
副结论单独一行且不换行——列一窄「画面 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>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
|
||||
{/* ===== 人工审核 ===== */}
|
||||
|
|
@ -319,9 +323,9 @@ export default function Review() {
|
|||
</LineHint>
|
||||
<ChipBar>
|
||||
{current.voiceover_url && !current.preview_url && current.native_audio
|
||||
? <Button size="sm" disabled={!!busy} onClick={() => buildPreview(current)}>封装审片预览(用平台配音替换模型原声)</Button> : null}
|
||||
? <Button icon={<IconDownload />} disabled={!!busy} onClick={() => buildPreview(current)}>封装审片预览(用平台配音替换模型原声)</Button> : null}
|
||||
{current.preview_url
|
||||
? <Button size="sm" disabled={!!busy} onClick={() => buildPreview(current)}>重新封装预览</Button> : null}
|
||||
? <Button icon={<IconDownload />} disabled={!!busy} onClick={() => buildPreview(current)}>重新封装预览</Button> : null}
|
||||
</ChipBar>
|
||||
</>
|
||||
: null}
|
||||
|
|
@ -371,7 +375,7 @@ export default function Review() {
|
|||
|
||||
{techChecks.length
|
||||
? <>
|
||||
<h3 className="mt-4 mb-3 text-sm"><IconText icon={<IconAim />}>技术指标</IconText></h3>
|
||||
<SectionTitle><IconText icon={<IconAim />}>技术指标</IconText></SectionTitle>
|
||||
<CheckTable items={techChecks} cols={CHECK_COLS} />
|
||||
</>
|
||||
: null}
|
||||
|
|
@ -379,19 +383,19 @@ export default function Review() {
|
|||
) : null}
|
||||
|
||||
<Divider />
|
||||
<Grid cols={2} oneAt="sm">
|
||||
<Grid cols={2} oneAt="lg">
|
||||
<div>
|
||||
<h3 className="m-0 mb-2 text-sm"><IconText icon={<IconPass />}>合格</IconText></h3>
|
||||
<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 type="primary" size="sm" disabled={!!busy || !current.output_exists} onClick={approveShot}>标记合格</Button></Actions>
|
||||
<Actions><Button icon={<IconPass />} type="primary" size="sm" disabled={!!busy || !current.output_exists} onClick={approveShot}>标记合格</Button></Actions>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="m-0 mb-2 text-sm"><IconText icon={<IconReject />}>不合格(可改提示词重做)</IconText></h3>
|
||||
<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>
|
||||
|
|
@ -414,7 +418,7 @@ export default function Review() {
|
|||
</Field>
|
||||
</FormRow>
|
||||
: null}
|
||||
<Actions><Button size="sm" disabled={!!busy} onClick={rejectShot}>驳回</Button></Actions>
|
||||
<Actions><Button icon={<IconReject />} size="sm" disabled={!!busy} onClick={rejectShot}>驳回</Button></Actions>
|
||||
</div>
|
||||
</Grid>
|
||||
</>
|
||||
|
|
@ -426,38 +430,39 @@ export default function Review() {
|
|||
<Panel>
|
||||
<PanelHead title="审核留痕"
|
||||
right={<Ctlbar className="mb-0">
|
||||
<Field label="类型" width="narrow">
|
||||
<Select size="sm" ariaLabel="审核记录类型筛选" value={kindFilter} onChange={setKindFilter} options={KIND_OPTIONS} />
|
||||
<Field inline label="类型" width="narrow">
|
||||
<Select ariaLabel="审核记录类型筛选" value={kindFilter} onChange={setKindFilter} options={KIND_OPTIONS} />
|
||||
</Field>
|
||||
</Ctlbar>} />
|
||||
<TableBox maxHeight={320}>
|
||||
<Table minWidth={900}>
|
||||
<thead>
|
||||
<tr><th className={cellCenter}>时间</th><th className={cellCenter}>类型</th><th>镜头</th>
|
||||
<th className={cellCenter}>结论</th><th className={cellRight}>得分</th><th>审核人</th><th>说明</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{reviews.map((rv: any) => (
|
||||
<tr key={rv.id}>
|
||||
<td className={`${cellCenter} ${MUTED_MONO}`}>{fmtTime(rv.created_at)}</td>
|
||||
<td className={cellCenter}>{statusLabel(rv.kind)}</td>
|
||||
<td className={MONO}>{byId[rv.shot_id] ? `镜头 ${String(byId[rv.shot_id].order_index).padStart(2, '0')}` : '未知'}
|
||||
<div className={MUTED}>shot#{rv.shot_id}</div>
|
||||
</td>
|
||||
<td className={cellCenter}><Tag tone={rv.verdict === 'pass' ? 'ok' : 'bad'}>{rv.verdict === 'pass' ? '合格' : '不合格'}</Tag></td>
|
||||
<td className={`${cellRight} ${MONO}`}>{rv.score ?? '—'}</td>
|
||||
<td className={MUTED}>{rv.reviewer}</td>
|
||||
<td className={cellWrap}>{rv.notes || '—'}
|
||||
{rv.checks?.checks
|
||||
? <div className={MUTED_MONO}>检查:{rv.checks.checks.filter((c: any) => !c.passed).map((c: any) => c.label).join('、') || '全部达标'}</div>
|
||||
: null}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{!reviews.length ? <tr><td colSpan={7} className={`${MUTED} ${EMPTY_CELL}`}>暂无审核记录。</td></tr> : null}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={320}
|
||||
minWidth={900}
|
||||
dataSource={reviews}
|
||||
empty="暂无审核记录。"
|
||||
columns={[
|
||||
{ title: '时间', key: 'time', width: 152, 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) => (
|
||||
<>{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) => (
|
||||
<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}
|
||||
</>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
</PageStack>
|
||||
)
|
||||
|
|
@ -468,11 +473,10 @@ function VisualQc({ probe, checks, frames, frameItems, note }: {
|
|||
probe: any; checks: any[]; frames: string[]; frameItems: any[]; note: string
|
||||
}) {
|
||||
return (
|
||||
<div className="mb-1 rounded-lg bg-info-bg p-3">
|
||||
<div className="flex items-center justify-between gap-3 flex-wrap">
|
||||
<b className="text-xs"><IconText icon={<IconEye />}>画面质检(大模型看图)</IconText></b>
|
||||
<span className={MUTED}>{probe.visual_frames ? `${probe.visual_frames.length} 张判定帧` : ''}</span>
|
||||
</div>
|
||||
<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
|
||||
|
|
@ -491,37 +495,35 @@ function VisualQc({ probe, checks, frames, frameItems, note }: {
|
|||
<CheckTable items={checks} cols={VISUAL_COLS} visual />
|
||||
</div>
|
||||
: null}
|
||||
</div>
|
||||
</Block>
|
||||
)
|
||||
}
|
||||
|
||||
/** 质检结论表:窄栏里必须固定布局 + 百分比列宽,否则「标准」列被挤出容器;长串实测值要允许折行 */
|
||||
function CheckTable({ items, cols, visual }: { items: any[]; cols: string[]; visual?: boolean }) {
|
||||
const heads = visual ? ['画面问题', '结论', '位置', '说明'] : ['检查项', '结论', '实测', '权重', '标准']
|
||||
const nowrap = visual ? 'whitespace-normal' : 'whitespace-nowrap'
|
||||
return (
|
||||
<TableBox maxHeight={visual ? 210 : 230}>
|
||||
<Table minWidth={0} className="table-fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
{(visual ? ['画面问题', '结论', '位置', '说明'] : ['检查项', '结论', '实测', '权重', '标准'])
|
||||
.map((h, i) => <th key={h} className={`${cols[i]} ${visual ? 'whitespace-normal' : 'whitespace-nowrap'}`}>{h}</th>)}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{items.map((c: any) => (
|
||||
<tr key={c.key}>
|
||||
<td className={visual ? 'whitespace-normal' : 'whitespace-nowrap'}>{visual ? visualShortLabel(c) : c.label}</td>
|
||||
<td className={cellCenter}>
|
||||
<Tag tone={(visual ? visualTone(c) : c.passed ? 'ok' : c.severity === 'warning' ? 'warn' : 'bad') as any}>
|
||||
{visual ? visualVerdict(c) : c.passed ? '合格' : c.severity === 'warning' ? '提醒' : '不合格'}
|
||||
</Tag>
|
||||
</td>
|
||||
<td className={`${MONO} whitespace-normal break-words`}>{c.value}</td>
|
||||
{visual ? null : <td className={`${cellRight} ${MONO}`}>{c.weight}</td>}
|
||||
<td className={`${cellWrap} ${MUTED} break-words`}>{c.detail}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={visual ? 210 : 230}
|
||||
minWidth={0}
|
||||
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) => (
|
||||
<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,
|
||||
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 }
|
||||
]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ import { refresh, useBriefStore, useProjectStore } from '../../stores/project'
|
|||
import { options, useSystemStore } from '../../stores/system'
|
||||
import { notify } from '../../stores/notice'
|
||||
import { openPreview, usePreviewOpen } from '../../stores/preview'
|
||||
import { Actions, BarRight, Between, Button, CARD_ROW, Check, Checkbox, Chip, ChipBar, CloseButton, Ctlbar, DRAWER_ACTIONS, DRAWER_BODY, DRAWER_HEAD, Divider, Empty, ErrorText, ExportMenu, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LINK_CLS, LinkButton, Loading, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, Panel, PanelHead, Row, Scrim, SectionTitle, Spinner, Stat, StatRow, Status, TAG_DENSE, PageStack, Table, TableBox, Tabs, Tag, TagGroup, TextArea, ViewSwitch, cellCenter, cellRight, cellWrap } from '../../components/ui'
|
||||
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 { floatingLayerOpen } from '../../lib/layers'
|
||||
import { IconAdd, IconArrowDown, IconArrowUp, IconChevronDown, IconChevronUp, IconCompose, IconCopy, IconDelete, IconDownload, IconEdit, IconGrid, IconImage, IconListOrdered, IconMic, IconParams, IconPlayCircle, IconReload, IconSearch, IconToTop, IconUpload, IconVideo, IconWarn } from '../../components/icons'
|
||||
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'
|
||||
|
||||
type ViewMode = 'grid' | 'table'
|
||||
type InspectorTab = 'shot' | 'assets' | 'prompt' | 'output'
|
||||
|
|
@ -109,8 +109,33 @@ const LINE_EMPTY = 'rounded-lg border border-dashed border-border bg-bg-containe
|
|||
+ 'text-xs leading-relaxed text-text-quaternary'
|
||||
|
||||
/** 表格里那枚缩略图(.tthumb):高度由 92px 宽的画面比例决定,不是一档一档的表单控件 */
|
||||
|
||||
const TABLE_THUMB = 'grid w-[92px] place-items-center text-text-quaternary min-h-[34px]'
|
||||
|
||||
/**
|
||||
* 脚本导入的「解析结果」表(列定义在模块层,页面里只留数据源)。
|
||||
* 这些列不依赖组件状态,放在 render 里会让每次重渲染都重建一遍数组。
|
||||
*/
|
||||
const PREVIEW_COLS: Columns<any> = [
|
||||
{ title: '#', width: 56, className: MUTED_MONO, render: (_: any, s: any, i: number) => s.order_index ?? i + 1 },
|
||||
{ title: '标题', className: cellWrap, render: (_: any, s: any) => s.title },
|
||||
{ title: '画面', className: cn(cellWrap, MUTED), render: (_: any, s: any) => s.description },
|
||||
{ title: '景别/运镜', width: 150, className: MUTED,
|
||||
render: (_: any, s: any) => `${opt('shot_size', s.shot_size)} · ${opt('camera_movement', s.camera_movement)}` },
|
||||
{ title: '时长', width: 72, align: 'right', className: MUTED_MONO, render: (_: any, s: any) => `${s.duration}s` },
|
||||
{ title: '台词 / 说话人', className: cellWrap, render: (_: any, s: any) => (
|
||||
<>
|
||||
{s.dialogue || '—'}
|
||||
{s.speaker ? <span className={MUTED}> / {s.speaker}</span> : null}
|
||||
</>) },
|
||||
{ title: '角色 · 场景', className: cn(cellWrap, MUTED),
|
||||
render: (_: any, s: any) => `${(s.characters || []).join('、') || '—'} · ${s.scene || '—'}` },
|
||||
{ title: '关键帧', width: 150, className: MUTED_MONO,
|
||||
render: (_: any, s: any) => (s.images || []).join(', ') || '—' },
|
||||
{ title: '动作', width: 118, render: (_: any, s: any) => (
|
||||
<Tag tone={s.will_create ? 'ok' : 'warn'}>{s.skipped_reason || (s.will_create ? '将新建' : '跳过')}</Tag>) }
|
||||
]
|
||||
|
||||
/* ── 纯函数 ─────────────────────────────────────────────────────────────── */
|
||||
|
||||
/** 数字输入清空后是 '',直接 PATCH 会被后端 422 拒掉,这里统一归一成 null / 默认值 */
|
||||
|
|
@ -1056,20 +1081,28 @@ export default function Storyboard() {
|
|||
|
||||
return (
|
||||
<PageStack>
|
||||
{/* ===== 顶栏:sticky 在应用顶栏之下,「+新增镜头 / 切视图 / 收概况」始终够得到 ===== */}
|
||||
<div className="sticky top-(--nex-bar) z-40 flex min-w-0 flex-wrap items-center justify-between gap-4 rounded-lg border border-border-secondary bg-bg-container py-4 px-5">
|
||||
<StatRow>
|
||||
<Stat variant="inline" value={shots.length} label="镜头" />
|
||||
<Stat variant="inline" value={`${plannedDuration.toFixed(1)}s`} label="计划时长" />
|
||||
<Stat variant="inline" value={approvedCount} label="已合格" tone="ok" />
|
||||
{issueCount ? <Stat variant="inline" value={issueCount} label="有阻塞" tone="bad" /> : null}
|
||||
</StatRow>
|
||||
<Row className="justify-end">
|
||||
<Button type="primary" onClick={() => { setShowImport(!showImport); setCreating(false) }}
|
||||
icon={<IconUpload />}>
|
||||
导入脚本 / 关键帧
|
||||
</Button>
|
||||
<Button type="dashed" onClick={startCreate} icon={<IconAdd />}>新增镜头</Button>
|
||||
{/* ===== 工具条:吸在应用顶栏下沿,「新增镜头 / 切视图 / 收概况」始终够得到 =====
|
||||
以前这是一条自绘 div(rounded-lg border bg-bg-container py-4 px-5)+ 四个
|
||||
Stat variant="inline":卡片头是 antd 的,这一条却不是,圆角、内边距、
|
||||
分隔线全都自己定,于是它是全站唯一「像卡皮、但不是卡」的横条。
|
||||
现在它就是 <Toolbar>(只有卡头的 Card),指标改成一行摘要文字。 */}
|
||||
<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: '网格看板:缩略图 + 脚本要点,逐镜对照最舒服' },
|
||||
|
|
@ -1080,26 +1113,27 @@ export default function Storyboard() {
|
|||
icon={briefOpen ? <IconChevronUp /> : <IconChevronDown />}>
|
||||
{briefOpen ? '收起概况' : '展开概况'}
|
||||
</Button>
|
||||
</Row>
|
||||
</div>
|
||||
</ActionGroup>
|
||||
</>} />
|
||||
|
||||
{/* ===== 筛选 / 导出 ===== */}
|
||||
<Ctlbar>
|
||||
<Field label="搜索" width="grow">
|
||||
<Input value={keyword} onChange={(e) => setKeyword(e.target.value)} aria-label="搜索分镜" placeholder="镜号 / 标题 / 画面 / 台词 / 角色 / 场景…" />
|
||||
<Panel>
|
||||
<Ctlbar className="!mb-0">
|
||||
<Field inline label="搜索" width="grow">
|
||||
<SearchInput value={keyword} onChange={(e) => setKeyword(e.target.value)} aria-label="搜索分镜" placeholder="镜号 / 标题 / 画面 / 台词 / 角色 / 场景…" />
|
||||
</Field>
|
||||
<Field label="状态" width="narrow">
|
||||
<Select size="sm" ariaLabel="按镜头状态筛选" value={statusFilter} onChange={setStatusFilter}
|
||||
<Field inline label="状态" width="narrow">
|
||||
<Select ariaLabel="按镜头状态筛选" value={statusFilter} onChange={setStatusFilter}
|
||||
options={[{ value: '', label: '全部状态' },
|
||||
...((meta?.shot_statuses as string[]) || SHOT_STATUS_FALLBACK)
|
||||
.map((s) => ({ value: s, label: statusLabel(s) }))]} />
|
||||
</Field>
|
||||
<Field label="模式" width="narrow">
|
||||
<Select size="sm" ariaLabel="按生成模式筛选" value={modeFilter} onChange={setModeFilter}
|
||||
<Field inline label="模式" width="narrow">
|
||||
<Select ariaLabel="按生成模式筛选" value={modeFilter} onChange={setModeFilter}
|
||||
options={[{ value: '', label: '全部模式' }, ...options('mode')]} />
|
||||
</Field>
|
||||
<Field label="排序" width="narrow">
|
||||
<Select size="sm" ariaLabel="分镜排序" value={sortKey} onChange={(next) => setSortKey(next as typeof sortKey)}
|
||||
<Field inline label="排序" width="narrow">
|
||||
<Select ariaLabel="分镜排序" value={sortKey} onChange={(next) => setSortKey(next as typeof sortKey)}
|
||||
options={[{ value: 'order', label: '按镜序' }, { value: 'status', label: '按状态' },
|
||||
{ value: 'duration', label: '按时长' }]} />
|
||||
</Field>
|
||||
|
|
@ -1111,6 +1145,7 @@ export default function Storyboard() {
|
|||
{ label: 'JSON(原样字段)', href: exportHref(projectId, 'json'), hint: '交给外部管线' }]} />
|
||||
</BarRight>
|
||||
</Ctlbar>
|
||||
</Panel>
|
||||
|
||||
<ErrorText>{error}</ErrorText>
|
||||
{notice ? <Notice className="mb-0">{notice}</Notice> : null}
|
||||
|
|
@ -1118,40 +1153,43 @@ export default function Storyboard() {
|
|||
|
||||
{/* ===== 批量操作条 ===== */}
|
||||
{checked.size ? (
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2 rounded-lg border border-info-border py-3 px-4 bg-[linear-gradient(90deg,var(--ant-color-fill-tertiary),var(--ant-color-bg-container))]">
|
||||
<b className="text-primary-hover text-sm">已选 {checked.size} 个镜头</b>
|
||||
/* 勾选之后浮出来的批量条:它是一块卡片(卡头 = 已选数量 + 动作,
|
||||
正文 = 「统一改参数」那一排字段),不再是页面里自绘的渐变横条。 */
|
||||
<Panel className="!border-primary-border">
|
||||
<PanelHead className="!mb-0" title={`已选 ${checked.size} 个镜头`} right={<>
|
||||
<Button size="sm" onClick={() => void bulkAction('duplicate', {}, '复制镜头')} icon={<IconCopy />}>复制</Button>
|
||||
<Button size="sm" onClick={() => void bulkAction('move', { index: 1 }, '前移到片头')} icon={<IconToTop />}>移到最前</Button>
|
||||
<Button size="sm" onClick={() => setBulk((prev) => ({ ...prev, open: !prev.open }))} icon={<IconParams />}>统一改参数</Button>
|
||||
<Button type="text" danger onClick={() => void bulkAction('delete', {}, '删除镜头')} icon={<IconDelete />}>删除</Button>
|
||||
<Button size="sm" onClick={clearCheck}>取消选择</Button>
|
||||
<Button icon={<IconClose />} size="sm" onClick={clearCheck}>取消选择</Button>
|
||||
</>} />
|
||||
{bulk.open ? (
|
||||
<Ctlbar className="w-full mt-0 border-t border-dashed border-border pt-2">
|
||||
<Field label="生成模式">
|
||||
<Select size="sm" value={bulk.fields.mode} placeholder="不改"
|
||||
<Ctlbar className="mt-4 !mb-0 border-t border-dashed border-border-secondary pt-4">
|
||||
<Field inline label="生成模式">
|
||||
<Select value={bulk.fields.mode} placeholder="不改"
|
||||
onChange={(next) => setBulk((prev) => ({ ...prev, fields: { ...prev.fields, mode: next } }))}
|
||||
options={[{ value: '', label: '不改' }, ...options('mode')]} />
|
||||
</Field>
|
||||
<Field label="时长(秒)" width="narrow">
|
||||
<Field inline label="时长(秒)" width="narrow">
|
||||
<MaybeNumberInput min="0.5" step="0.5" placeholder="不改" value={bulk.fields.duration} onChange={(v) => setBulk((prev) => ({ ...prev,
|
||||
fields: { ...prev.fields, duration: v } }))} />
|
||||
</Field>
|
||||
<Field label="景别">
|
||||
<Select size="sm" value={bulk.fields.shot_size} placeholder="不改"
|
||||
<Field inline label="景别">
|
||||
<Select value={bulk.fields.shot_size} placeholder="不改"
|
||||
onChange={(next) => setBulk((prev) => ({ ...prev, fields: { ...prev.fields, shot_size: next } }))}
|
||||
options={[{ value: '', label: '不改' }, ...options('shot_size')]} />
|
||||
</Field>
|
||||
<Field label="出转场">
|
||||
<Select size="sm" value={bulk.fields.transition_out} placeholder="不改"
|
||||
<Field inline label="出转场">
|
||||
<Select value={bulk.fields.transition_out} placeholder="不改"
|
||||
onChange={(next) => setBulk((prev) => ({ ...prev, fields: { ...prev.fields, transition_out: next } }))}
|
||||
options={[{ value: '', label: '不改' }, ...options('transition')]} />
|
||||
</Field>
|
||||
<Button type="primary" size="sm" disabled={!!busy} onClick={applyBulkPatch}>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy} onClick={applyBulkPatch}>
|
||||
应用到 {checked.size} 个镜头
|
||||
</Button>
|
||||
</Ctlbar>
|
||||
) : null}
|
||||
</div>
|
||||
</Panel>
|
||||
) : null}
|
||||
|
||||
{/* ===== 导入脚本 / 关键帧(图2 节点②)===== */}
|
||||
|
|
@ -1162,7 +1200,7 @@ export default function Storyboard() {
|
|||
right={<Row tight>
|
||||
<Chip active={importMode === 'paste'} onClick={() => setImportMode('paste')}>粘贴脚本</Chip>
|
||||
<Chip active={importMode === 'file'} onClick={() => setImportMode('file')}>上传脚本文件</Chip>
|
||||
<Button size="sm" onClick={() => setShowImport(false)}>收起</Button>
|
||||
<Button icon={<IconChevronUp />} size="sm" onClick={() => setShowImport(false)}>收起</Button>
|
||||
</Row>}
|
||||
/>
|
||||
<FormRow cols={2}>
|
||||
|
|
@ -1191,18 +1229,23 @@ export default function Storyboard() {
|
|||
</TagGroup>
|
||||
) : null}
|
||||
<Ctlbar>
|
||||
<Field label="默认时长(秒)" width="narrow">
|
||||
<Field inline label="默认时长(秒)" width="narrow">
|
||||
<NumberInput min="0.5" step="0.5" value={script.default_duration} onChange={ (v) => setScript((prev) => ({ ...prev, default_duration: v }))} />
|
||||
</Field>
|
||||
<Check checked={script.keep_existing}
|
||||
onChange={(next) => setScript((prev) => ({ ...prev, keep_existing: next }))}>保留已有镜头</Check>
|
||||
<Check checked={script.replace}
|
||||
onChange={(next) => setScript((prev) => ({ ...prev, replace: next }))}>替换同名镜头</Check>
|
||||
<ActionGroup>
|
||||
<Check checked={script.keep_existing}
|
||||
onChange={(next) => setScript((prev) => ({ ...prev, keep_existing: next }))}>保留已有镜头</Check>
|
||||
<Check checked={script.replace}
|
||||
onChange={(next) => setScript((prev) => ({ ...prev, replace: next }))}>替换同名镜头</Check>
|
||||
</ActionGroup>
|
||||
</Ctlbar>
|
||||
<Actions>
|
||||
<Button disabled={!!busy} onClick={previewText} icon={<IconSearch />}>文本预览</Button>
|
||||
<Button disabled={!!busy} onClick={() => void doImport(true)} icon={<IconPlayCircle />}>导入预演(含图片匹配)</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={() => void doImport(false)} icon={<IconDownload />}>正式导入</Button>
|
||||
{/* 预览 → 预演 → 正式导入是同一条流程,读的顺序就是点的顺序:整组不换行 */}
|
||||
<ActionGroup>
|
||||
<Button disabled={!!busy} onClick={previewText} icon={<IconSearch />}>文本预览</Button>
|
||||
<Button disabled={!!busy} onClick={() => void doImport(true)} icon={<IconPlayCircle />}>导入预演(含图片匹配)</Button>
|
||||
<Button type="primary" disabled={!!busy} onClick={() => void doImport(false)} icon={<IconDownload />}>正式导入</Button>
|
||||
</ActionGroup>
|
||||
</Actions>
|
||||
</div>
|
||||
</FormRow>
|
||||
|
|
@ -1210,39 +1253,15 @@ export default function Storyboard() {
|
|||
{preview ? (
|
||||
<>
|
||||
<Divider />
|
||||
<Between>
|
||||
<h3 className="m-0 text-base">
|
||||
解析结果:{preview.parsed} 个镜头
|
||||
{preview.created !== undefined ? ` · 实际新建 ${preview.created}` : ''}
|
||||
</h3>
|
||||
{preview.unmatched_images?.length
|
||||
? <Tag tone="warn">未匹配图片:{preview.unmatched_images.join(', ')}</Tag>
|
||||
: <Tag tone="ok">图片全部匹配</Tag>}
|
||||
</Between>
|
||||
<TableBox maxHeight={300}>
|
||||
<Table minWidth={1040}>
|
||||
<thead>
|
||||
<tr><th>#</th><th>标题</th><th>画面</th><th>景别/运镜</th>
|
||||
<th className={cellRight}>时长</th><th>台词 / 说话人</th><th>角色 · 场景</th><th>关键帧</th><th>动作</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(preview.shots || []).map((s: any, i: number) => (
|
||||
<tr key={i}>
|
||||
<td className={MUTED_MONO}>{s.order_index}</td>
|
||||
<td className={cellWrap}>{s.title}</td>
|
||||
<td className={`${cellWrap} ${MUTED}`}>{s.description}</td>
|
||||
<td className={MUTED}>{opt('shot_size', s.shot_size)} · {opt('camera_movement', s.camera_movement)}</td>
|
||||
<td className={`${cellRight} ${MUTED_MONO}`}>{s.duration}s</td>
|
||||
<td className={cellWrap}>{s.dialogue || '—'}
|
||||
{s.speaker ? <span className={MUTED}> / {s.speaker}</span> : null}</td>
|
||||
<td className={MUTED}>{(s.characters || []).join('、') || '—'} · {s.scene || '—'}</td>
|
||||
<td className={MUTED_MONO}>{(s.images || []).join(', ') || '—'}</td>
|
||||
<td><Tag tone={s.will_create ? 'ok' : 'warn'}>{s.skipped_reason || (s.will_create ? '将新建' : '跳过')}</Tag></td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<SectionTitle className="!mb-3 !mt-0 !text-sm !text-text"
|
||||
action={preview.unmatched_images?.length
|
||||
? <Tag tone="warn">未匹配图片:{preview.unmatched_images.join(', ')}</Tag>
|
||||
: <Tag tone="ok">图片全部匹配</Tag>}>
|
||||
解析结果:{preview.parsed} 个镜头
|
||||
{preview.created !== undefined ? ` · 实际新建 ${preview.created}` : ''}
|
||||
</SectionTitle>
|
||||
<Table minWidth={1040} maxHeight={300} rowKey={(_: any, i: any) => String(i)}
|
||||
dataSource={preview.shots || []} columns={PREVIEW_COLS} />
|
||||
</>
|
||||
) : null}
|
||||
</Panel>
|
||||
|
|
@ -1265,7 +1284,7 @@ export default function Storyboard() {
|
|||
<Empty>
|
||||
<div className="flex min-w-0 flex-wrap items-center justify-center gap-2">
|
||||
当前筛选条件下没有镜头。
|
||||
<Button size="sm"
|
||||
<Button icon={<IconClose />} size="sm"
|
||||
onClick={() => {
|
||||
setKeyword(''); setStatusFilter(''); setModeFilter('')
|
||||
setIssueOnly(false); setNoKeyframeOnly(false)
|
||||
|
|
@ -1303,96 +1322,91 @@ export default function Storyboard() {
|
|||
</div>
|
||||
) : (
|
||||
<Panel>
|
||||
<Row tight className="mb-2">
|
||||
<Check checked={checked.size === filtered.length && !!filtered.length} onChange={checkAll}>
|
||||
全选({filtered.length})
|
||||
</Check>
|
||||
</Row>
|
||||
<TableBox maxHeight={false}>
|
||||
<Table minWidth={1180}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="w-[26px]" title="按住行首拖拽即可改镜序"></th>
|
||||
<th className={cn(cellCenter, 'w-[40px]')}>#</th>
|
||||
<th className="w-[96px]">预览</th>
|
||||
<th>镜头</th>
|
||||
<th>画面 / 台词</th>
|
||||
<th>绑定</th>
|
||||
<th className={cellRight}>时长</th>
|
||||
<th>摄影</th>
|
||||
<th>状态</th>
|
||||
<th className={cellRight}>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filtered.map((s) => (
|
||||
<tr key={s.id}
|
||||
draggable
|
||||
onDragStart={() => startDrag(s.id)}
|
||||
onDragOver={(ev) => { ev.preventDefault(); overDrag(s.id) }}
|
||||
onDragEnd={() => { setDragOver(null); setDragging(null) }}
|
||||
onDrop={(ev) => { ev.preventDefault(); void dropOn(s.id) }}
|
||||
onClick={() => void select(s.id)}
|
||||
className={cn('cursor-pointer',
|
||||
/* 三态顺序 = 基础 → 选中 → 拖拽 → 勾选,跟看板卡一致;
|
||||
tailwind-merge 留最后一条,「选中 + 勾选」才是看板里那种
|
||||
「既是当前镜头又被选中」的叠色,而不是互相抹掉。 */
|
||||
s.id === selectedId && '[&>td]:bg-primary-bg',
|
||||
checked.has(s.id) && '[&>td]:bg-primary [&>td]:inset-shadow-[2px_0_0_var(--ant-color-primary-border)]',
|
||||
s.id === selectedId && checked.has(s.id) && '[&>td]:bg-primary-bg',
|
||||
dragOver === s.id && '[&>td]:border-t [&>td]:border-dashed [&>td]:border-info [&>td]:bg-fill-tertiary')}>
|
||||
<td onClick={(ev) => ev.stopPropagation()}>
|
||||
<Checkbox checked={checked.has(s.id)} aria-label={`选择镜头 ${s.code || s.order_index}`}
|
||||
onClick={(ev) => toggleCheck(s.id, ev.shiftKey)} />
|
||||
</td>
|
||||
<td className={cellCenter}><Mono>{s.order_index}</Mono></td>
|
||||
<td>
|
||||
<div className={TABLE_THUMB}>
|
||||
{s.keyframe_url || s.output_url ? (
|
||||
<MediaThumb item={fromShot(s, s.keyframe_url ? 'keyframe' : 'output')}
|
||||
width="92px" size="xs" radius="chip" className="cursor-zoom-in"
|
||||
onOpen={() => previewShot(s, s.keyframe_url ? 'keyframe' : 'output')} />
|
||||
) : <span className="text-text-quaternary"><IconImage /></span>}
|
||||
</div>
|
||||
</td>
|
||||
<td className={cellWrap}>
|
||||
<b>{s.title || '未命名'}</b>
|
||||
<div className={MUTED_MONO}>{s.code}</div>
|
||||
</td>
|
||||
<td className={cellWrap}>
|
||||
{s.description || '未填写画面描述'}
|
||||
{s.dialogue ? <div className={MUTED}>「{s.dialogue}」 {s.speaker_name}</div> : null}
|
||||
</td>
|
||||
<td className={cn(cellWrap, MUTED)}>
|
||||
{(s.characters || []).map((c: any) => c.name).join('、') || '—'}
|
||||
<div>{(s.scenes || []).map((c: any) => c.name).join('、') || '—'}</div>
|
||||
</td>
|
||||
<td className={cn(cellRight, MUTED_MONO)}>{s.duration}s</td>
|
||||
<td className={MUTED}>{opt('shot_size', s.shot_size)} · {opt('camera_movement', s.camera_movement)}</td>
|
||||
<td>
|
||||
<Status value={s.status} />
|
||||
{!s.ready
|
||||
? <ErrorText>{issueOf(s, 'error')[0]?.message || '预检未通过'}</ErrorText>
|
||||
: (s.qc_score !== null && s.qc_score !== undefined
|
||||
? <div className={MUTED_MONO}>QC {s.qc_score.toFixed(0)}</div>
|
||||
: null)}
|
||||
</td>
|
||||
<td className={cellRight} onClick={(ev) => ev.stopPropagation()}>
|
||||
<Row className="justify-end">
|
||||
<Button size="sm" disabled={!canMove(s, -1) || !!busy}
|
||||
onClick={() => void move(s, -1)} title="前移" aria-label="前移" icon={<IconArrowUp />} />
|
||||
<Button size="sm" disabled={!canMove(s, 1) || !!busy}
|
||||
onClick={() => void move(s, 1)} title="后移" aria-label="后移" icon={<IconArrowDown />} />
|
||||
<Button size="sm" onClick={() => void focusText(s)}
|
||||
title="直接改这一镜的画面描述与台词" icon={<IconEdit />}>文案</Button>
|
||||
<Button type="text" danger onClick={() => void removeShot(s)} title="删除这一镜">删除</Button>
|
||||
</Row>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
{/* 分镜表:antd Table。
|
||||
勾选交还给 antd 的 rowSelection——列头复选框 + 「全选」都是它自带的,
|
||||
页面不再手搓那一行「全选(N)」;选中底色直接复用 antd 自己的
|
||||
.ant-table-row-selected,它跟着 Table.rowSelectedBg token 走。
|
||||
可拖的是整行:onRow 把 draggable/onDrop 落到底层 <tr> 上,
|
||||
列首那格只负责给出把手(HolderOutlined = antd 拖拽排序的标准图形)。
|
||||
行不写内联高度,密度由 kit 的 size=small 统一下发。 */}
|
||||
<Table minWidth={1180} maxHeight={false} rowKey="id" dataSource={filtered}
|
||||
rowSelection={{
|
||||
selectedRowKeys: [...checked],
|
||||
preserveSelectedRowKeys: true,
|
||||
columnWidth: 42,
|
||||
onSelect: (s: any, _on: boolean, _rows: any, ev: any) => toggleCheck(s.id, !!(ev && ev.shiftKey)),
|
||||
onSelectAll: () => checkAll()
|
||||
}}
|
||||
rowClassName={(s: any) => cn('cursor-pointer',
|
||||
/* 三态顺序 = 基础 → 勾选 → 选中 → 拖拽落点,跟看板卡一致;
|
||||
tailwind-merge 留最后一条,「选中 + 勾选」才是看板里那种
|
||||
「既是当前镜头又被选中」的叠色,而不是互相抹掉。 */
|
||||
s.id === selectedId && '[&>td]:bg-primary-bg',
|
||||
checked.has(s.id) && '[&>td]:inset-shadow-[2px_0_0_var(--ant-color-primary-border)]',
|
||||
s.id === selectedId && checked.has(s.id) && '[&>td]:bg-primary-bg',
|
||||
dragOver === s.id && '[&>td]:border-t [&>td]:border-dashed [&>td]:border-info [&>td]:bg-fill-tertiary')}
|
||||
onRow={(s: any) => ({
|
||||
draggable: true,
|
||||
title: '按住整行拖拽即可改镜序',
|
||||
onDragStart: () => startDrag(s.id),
|
||||
onDragOver: (ev: any) => { ev.preventDefault(); overDrag(s.id) },
|
||||
onDragEnd: () => { setDragOver(null); setDragging(null) },
|
||||
onDrop: (ev: any) => { ev.preventDefault(); void dropOn(s.id) },
|
||||
onClick: () => void select(s.id)
|
||||
})}
|
||||
columns={[
|
||||
{ title: <span title="按住整行拖拽即可改镜序"><IconDragHandle /></span>,
|
||||
width: 62, align: 'center', className: MUTED_MONO,
|
||||
render: (_: any, s: any) => <Mono>{s.order_index}</Mono> },
|
||||
{ title: '预览', width: 108, render: (_: any, s: any) => (
|
||||
<div className={TABLE_THUMB}>
|
||||
{s.keyframe_url || s.output_url ? (
|
||||
<MediaThumb item={fromShot(s, s.keyframe_url ? 'keyframe' : 'output')}
|
||||
width="92px" size="xs" radius="chip" className="cursor-zoom-in"
|
||||
onOpen={() => previewShot(s, s.keyframe_url ? 'keyframe' : 'output')} />
|
||||
) : <span className="text-text-quaternary"><IconImage /></span>}
|
||||
</div>) },
|
||||
{ title: '镜头', className: cellWrap, render: (_: any, s: any) => (
|
||||
<>
|
||||
<b>{s.title || '未命名'}</b>
|
||||
<div className={MUTED_MONO}>{s.code}</div>
|
||||
</>) },
|
||||
{ title: '画面 / 台词', className: cellWrap, render: (_: any, s: any) => (
|
||||
<>
|
||||
{s.description || '未填写画面描述'}
|
||||
{s.dialogue ? <div className={MUTED}>「{s.dialogue}」 {s.speaker_name}</div> : null}
|
||||
</>) },
|
||||
{ title: '绑定', className: cn(cellWrap, MUTED), render: (_: any, s: any) => (
|
||||
<>
|
||||
{(s.characters || []).map((c: any) => c.name).join('、') || '—'}
|
||||
<div>{(s.scenes || []).map((c: any) => c.name).join('、') || '—'}</div>
|
||||
</>) },
|
||||
{ title: '时长', width: 72, align: 'right', className: MUTED_MONO,
|
||||
render: (_: any, s: any) => `${s.duration}s` },
|
||||
{ title: '摄影', width: 150, className: MUTED,
|
||||
render: (_: any, s: any) => `${opt('shot_size', s.shot_size)} · ${opt('camera_movement', s.camera_movement)}` },
|
||||
{ title: '状态', width: 132, render: (_: any, s: any) => (
|
||||
<>
|
||||
<Status value={s.status} />
|
||||
{!s.ready
|
||||
? <ErrorText>{issueOf(s, 'error')[0]?.message || '预检未通过'}</ErrorText>
|
||||
: (s.qc_score !== null && s.qc_score !== undefined
|
||||
? <div className={MUTED_MONO}>QC {s.qc_score.toFixed(0)}</div>
|
||||
: null)}
|
||||
</>) },
|
||||
{ title: '操作', width: 208, align: 'right',
|
||||
onCell: () => ({ onClick: (ev: any) => ev.stopPropagation() }),
|
||||
render: (_: any, s: any) => (
|
||||
<Row className="justify-end">
|
||||
<Button size="sm" disabled={!canMove(s, -1) || !!busy}
|
||||
onClick={() => void move(s, -1)} title="前移" aria-label="前移" icon={<IconArrowUp />} />
|
||||
<Button size="sm" disabled={!canMove(s, 1) || !!busy}
|
||||
onClick={() => void move(s, 1)} title="后移" aria-label="后移" icon={<IconArrowDown />} />
|
||||
<Button size="sm" onClick={() => void focusText(s)}
|
||||
title="直接改这一镜的画面描述与台词" icon={<IconEdit />}>文案</Button>
|
||||
<Button icon={<IconDelete />} type="text" danger onClick={() => void removeShot(s)} title="删除这一镜" aria-label="删除这一镜" />
|
||||
</Row>) }
|
||||
]} />
|
||||
</Panel>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -1421,7 +1435,7 @@ export default function Storyboard() {
|
|||
{current?.code || '镜头'} · 第 {shotPos} / {filtered.length} 镜
|
||||
</small>
|
||||
)}
|
||||
<h2 className={cn('text-lg font-bold mb-0', !creating && 'mt-1')}>
|
||||
<h2 className={cn(DRAWER_TITLE, !creating && 'mt-1')}>
|
||||
{creating ? '新增镜头' : (detail?.title || current?.title || '未命名镜头')}
|
||||
</h2>
|
||||
</div>
|
||||
|
|
@ -1479,7 +1493,7 @@ export default function Storyboard() {
|
|||
action={(
|
||||
<>
|
||||
{draft.lines.length > 1
|
||||
? <Tag tone="ok" title="按说话人各自的声线逐句配音">本镜 {draft.lines.length} 人说话</Tag>
|
||||
? <Tag tone="info" title="按说话人各自的声线逐句配音">本镜 {draft.lines.length} 人说话</Tag>
|
||||
: null}
|
||||
<Button type="dashed" htmlType="button" title="再加一句台词" onClick={addLine} icon={<IconAdd />}>加一句</Button>
|
||||
</>
|
||||
|
|
@ -1588,7 +1602,7 @@ export default function Storyboard() {
|
|||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-bg-container', inspectorTab !== 'assets' && 'hidden')}>
|
||||
<h3>资产绑定</h3>
|
||||
<PanelHead title="资产绑定" className="!mb-4" />
|
||||
<FormRow>
|
||||
<Field label="出镜人物">
|
||||
<MultiSelect value={binding.character_ids} ariaLabel="出镜人物" size="md"
|
||||
|
|
@ -1614,12 +1628,17 @@ export default function Storyboard() {
|
|||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy || !selectedId} onClick={() => void saveBindings()}
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy || !selectedId} onClick={() => void saveBindings()}
|
||||
title="绑定后自动进入参考图与一致性提示词">保存绑定</Button>
|
||||
</Actions>
|
||||
|
||||
<Divider />
|
||||
<div className="rounded-lg border border-primary-border bg-[linear-gradient(145deg,var(--ant-color-primary-bg),var(--ant-color-bg-container)_65%)] p-3">
|
||||
{/* 手涂的 primary 渐变盒(bg-[linear-gradient(...)])属于「第二个调色板」:同一个语义的底块
|
||||
全站有好几种长相,圆角/内边距/描边各写各的。底纹改抄 Block 那把尺子 BLOCK_TONE.info
|
||||
(antd 的 colorInfoBg + colorInfoBorder),圆角 borderRadiusLG / 内边距 paddingSM
|
||||
沿用 Block 里同两组 utility。没有直接套 <Block> 是刻意的:它下发 Dense,
|
||||
会把这一整块 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'}>
|
||||
|
|
@ -1658,7 +1677,7 @@ export default function Storyboard() {
|
|||
<Button type="primary" disabled={!!busy || !keyframeModel || !selectedId}
|
||||
onClick={() => void generateKeyframe()}
|
||||
title="使用当前镜头提示词与真实图像模型,生成后自动成为 i2v 首帧" icon={<IconImage />}>生成并设为关键帧</Button>
|
||||
<Button disabled={!detail} onClick={() => syncKeyframeDraft(detail)}>
|
||||
<Button icon={<IconReload />} disabled={!detail} onClick={() => syncKeyframeDraft(detail)}>
|
||||
恢复镜头提示词与默认参考
|
||||
</Button>
|
||||
</Actions>
|
||||
|
|
@ -1695,7 +1714,7 @@ export default function Storyboard() {
|
|||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-bg-container', inspectorTab !== 'prompt' && 'hidden')}>
|
||||
<h3>提示词与版本</h3>
|
||||
<PanelHead title="提示词与版本" className="!mb-4" />
|
||||
<ChipBar>
|
||||
<Tag tone={promptForm.auto_sync ? 'ok' : 'warn'}>{promptForm.auto_sync ? '自动组装' : '人工覆盖'}</Tag>
|
||||
<Tag>正向 {promptForm.prompt.length} 字</Tag>
|
||||
|
|
@ -1716,7 +1735,7 @@ export default function Storyboard() {
|
|||
跟随镜头参数自动组装(勾选后人工文本只读)
|
||||
</Check>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy || !selectedId} onClick={() => void savePrompt()}>保存为新版本</Button>
|
||||
<Button icon={<IconCheck />} type="primary" disabled={!!busy || !selectedId} onClick={() => void savePrompt()}>保存为新版本</Button>
|
||||
</Actions>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">历史版本({revisions.length})</SectionTitle>
|
||||
|
|
@ -1727,7 +1746,7 @@ export default function Storyboard() {
|
|||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-bg-container', inspectorTab !== 'output' && 'hidden')}>
|
||||
<h3>产物与质检</h3>
|
||||
<PanelHead title="产物与质检" className="!mb-4" />
|
||||
{detail?.output_url ? (
|
||||
<>
|
||||
<video className="block max-h-[220px] w-full rounded-lg bg-bg-layout" controls
|
||||
|
|
@ -1741,7 +1760,7 @@ export default function Storyboard() {
|
|||
{detail.qc_score !== null && detail.qc_score !== undefined
|
||||
? <Tag tone={detail.qc_score >= 80 ? 'ok' : 'warn'}>QC {detail.qc_score.toFixed(0)}</Tag>
|
||||
: null}
|
||||
<Button size="sm"
|
||||
<Button icon={<IconEye />} size="sm"
|
||||
onClick={() => previewShot(detail, shotOutputWhich(detail, preferVoiceoverAudio))}>大屏预览</Button>
|
||||
<ExtLink href={detail.output_url}>原片</ExtLink>
|
||||
<Tag tone={detail.preview_ready ? 'ok' : (detail.native_audio && detail.voiceover_url ? 'warn' : 'default')}>
|
||||
|
|
@ -1751,39 +1770,31 @@ export default function Storyboard() {
|
|||
</Tag>
|
||||
{detail.preview_ready
|
||||
? (
|
||||
<Button size="sm"
|
||||
<Button icon={<IconSound />} size="sm"
|
||||
onClick={() => setPreferVoiceoverAudio(!preferVoiceoverAudio)}>
|
||||
{preferVoiceoverAudio ? '听模型原声' : '听平台配音'}
|
||||
</Button>
|
||||
)
|
||||
: (detail.voiceover_url && detail.native_audio
|
||||
? (
|
||||
<Button size="sm" disabled={busy === '封装审片预览'}
|
||||
<Button icon={<IconDownload />} disabled={busy === '封装审片预览'}
|
||||
onClick={() => void buildShotPreview(true)}>封装审片预览</Button>
|
||||
)
|
||||
: null)}
|
||||
</ChipBar>
|
||||
{detail.qc?.checks?.length ? (
|
||||
<TableBox maxHeight={230}>
|
||||
<Table minWidth={520}>
|
||||
<thead>
|
||||
<tr><th>检查项</th><th className={cellCenter}>结论</th><th>实测</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{detail.qc.checks.map((c: any) => (
|
||||
<tr key={c.key}>
|
||||
<td>{c.label}</td>
|
||||
<td className={cellCenter}>
|
||||
<Tag tone={c.passed ? 'ok' : (c.severity === 'warning' ? 'warn' : 'bad')}>
|
||||
{c.passed ? '合格' : (c.severity === 'warning' ? '提醒' : '不合格')}
|
||||
</Tag>
|
||||
</td>
|
||||
<td className={MUTED_MONO}>{c.value} · {c.detail}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table minWidth={520} maxHeight={230} rowKey="key"
|
||||
dataSource={detail.qc.checks}
|
||||
columns={[
|
||||
{ title: '检查项', className: cellWrap, render: (_: any, c: any) => c.label },
|
||||
{ title: '结论', width: 88, align: 'center', render: (_: any, c: any) => (
|
||||
<Tag tone={c.passed ? 'ok' : (c.severity === 'warning' ? 'warn' : 'bad')}>
|
||||
{c.passed ? '合格' : (c.severity === 'warning' ? '提醒' : '不合格')}
|
||||
</Tag>
|
||||
) },
|
||||
{ title: '实测', className: cn(cellWrap, MUTED_MONO),
|
||||
render: (_: any, c: any) => `${c.value} · ${c.detail}` }
|
||||
]} />
|
||||
) : null}
|
||||
{detail.voiceover_url ? (
|
||||
<>
|
||||
|
|
@ -1793,13 +1804,13 @@ export default function Storyboard() {
|
|||
durationMs={detail.voiceover_duration_ms} size="sm"
|
||||
hint="试听走平台统一音频引擎,切页/换镜头自动停上一段" />
|
||||
<Actions>
|
||||
<Button size="sm" onClick={() => previewShot(detail, 'voiceover')}>放大预览</Button>
|
||||
<Button icon={<IconEye />} size="sm" onClick={() => previewShot(detail, 'voiceover')}>放大预览</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : null}
|
||||
<Actions>
|
||||
<LinkButton to={`/projects/${projectId}/review?shot=${selectedId}`} type="primary">前往审核</LinkButton>
|
||||
<LinkButton to={detail?.output_url ? dispatchLink(projectId, detail) : `/projects/${projectId}/dispatch?shot=${selectedId}`}
|
||||
<LinkButton icon={<IconAudit />} to={`/projects/${projectId}/review?shot=${selectedId}`} type="primary">前往审核</LinkButton>
|
||||
<LinkButton icon={<IconRetry />} to={detail?.output_url ? dispatchLink(projectId, detail) : `/projects/${projectId}/dispatch?shot=${selectedId}`}
|
||||
title="只把这一镜排进队列;已有产物时自动带上强制重建">重新生成</LinkButton>
|
||||
</Actions>
|
||||
</>
|
||||
|
|
@ -1817,11 +1828,11 @@ export default function Storyboard() {
|
|||
也不会出现「sticky 停在半屏、把后面的控件压在身下」的错位。 */}
|
||||
{inspectorTab === 'shot' ? (
|
||||
<div className={DRAWER_ACTIONS}>
|
||||
<Button type="primary" disabled={!!busy} onClick={() => void saveShot()}
|
||||
<Button icon={<IconAdd />} type="primary" disabled={!!busy} onClick={() => void saveShot()}
|
||||
title={creating ? '创建这一镜' : '保存这一镜(⌘S)'}>
|
||||
{creating ? '创建镜头' : '保存镜头'}
|
||||
</Button>
|
||||
<Button disabled={!dirty} onClick={resetDraft} title="用后端这份重新填一遍表单">放弃修改</Button>
|
||||
<Button icon={<IconClose />} disabled={!dirty} onClick={resetDraft} title="用后端这份重新填一遍表单">放弃修改</Button>
|
||||
{dirty
|
||||
? <Tag tone="warn">未保存</Tag>
|
||||
: (current && !creating
|
||||
|
|
@ -2041,7 +2052,7 @@ function AssetRow({ asset: a, queue, index, onPreview }: {
|
|||
</div>
|
||||
</div>
|
||||
{a.metadata?.model ? <Tag tone="info">{a.metadata.model}</Tag> : null}
|
||||
<Button size="sm" onClick={onPreview}>预览</Button>
|
||||
<Button icon={<IconEye />} size="sm" onClick={onPreview}>预览</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -2058,7 +2069,7 @@ function RevisionCard({ rev: r, onUse }: { rev: any; onUse: () => void }) {
|
|||
<p>{(r.prompt || '').slice(0, 200)}…</p>
|
||||
<small className={MUTED}>{fmtTime(r.created_at)}</small>
|
||||
</div>
|
||||
<Button size="sm" onClick={onUse}>回填</Button>
|
||||
<Button icon={<IconCheck />} size="sm" onClick={onUse}>回填</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import { refresh, useProjectStore } from '../../stores/project'
|
|||
import { useSystemStore } from '../../stores/system'
|
||||
import { notify } from '../../stores/notice'
|
||||
import { openPreview } from '../../stores/preview'
|
||||
import { Actions, Between, 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, Panel, PanelHead, Row, SectionTitle, Spinner, Status, PageStack, Table, TableBox, Tag, TagGroup, TextArea, Value, cellCenter, cellRight } from '../../components/ui'
|
||||
import { IconArrowDown, IconArrowUp, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEye, IconMic, IconPass, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
|
||||
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 { IconAdd, IconArrowDown, IconArrowUp, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEdit, IconEye, IconMic, IconPass, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
|
||||
|
||||
/**
|
||||
* 这三条下拉(字幕方式 / 台词语音来源 / 模型原声策略)的选项名是一整句解释,
|
||||
|
|
@ -408,12 +408,13 @@ export default function Timeline() {
|
|||
|
||||
return (
|
||||
<PageStack>
|
||||
<Between className="mb-3">
|
||||
{timeline ? (
|
||||
<Row>
|
||||
<b>{timeline.name}</b>
|
||||
{/* 这一段全是只读回显,用 TagGroup 收进同一档;Chip 留给真正能点的东西 */}
|
||||
<TagGroup className="mb-0">
|
||||
{/* 时间线总览 + 版本切换:以前是 Between 裸排在页面底色上
|
||||
(名字 <b>、TagGroup、SectionTitle 当标签用、两颗按钮,四种高度挤一排)。
|
||||
现在它是「只有卡头的卡」:名字进卡头标题、计数进 sub、版本操作进 extra。 */}
|
||||
<Toolbar
|
||||
info={timeline ? timeline.name : '尚未构建时间线'}
|
||||
sub={timeline
|
||||
? <TagGroup className="mb-0">
|
||||
<Tag tone="info">v{timeline.version}{timeline.is_current ? ' · 当前' : ' · 历史版本'}</Tag>
|
||||
<Tag>{segments.length} 段</Tag>
|
||||
<Tag>总时长 {fmtMs(timeline.total_duration_ms)}</Tag>
|
||||
|
|
@ -421,11 +422,12 @@ export default function Timeline() {
|
|||
<Tag>字幕 {subtitles.length}</Tag>
|
||||
<Tag>音轨 {clips.length}</Tag>
|
||||
{report && <Tag tone={report.ready ? 'ok' : 'bad'}>{report.ready ? '可导出' : '有阻塞'}</Tag>}
|
||||
<Tag>共 {versions.length} 个版本</Tag>
|
||||
</TagGroup>
|
||||
</Row>
|
||||
) : <Row><span className={MUTED}>尚未构建时间线</span></Row>}
|
||||
<Row tight>
|
||||
<SectionTitle className="mt-0 mb-0">时间线版本 {versions.length}</SectionTitle>
|
||||
: <Value>先在左侧「构建时间线」生成第一个版本</Value>}
|
||||
actions={<>
|
||||
{/* 下拉选中哪一版 → 对这版「设为当前 / 删除」:三件必须同排,否则按钮指向不明 */}
|
||||
<ActionGroup>
|
||||
<Select ariaLabel="选择时间线版本" className="w-[210px] shrink-0"
|
||||
value={viewVersion ?? ''}
|
||||
onChange={(next: any) => {
|
||||
|
|
@ -444,17 +446,17 @@ export default function Timeline() {
|
|||
icon={<IconDelete />}>
|
||||
删除版本
|
||||
</Button>
|
||||
{busy ? <span className={MUTED}><Spinner /> {busy}…</span> : null}
|
||||
</Row>
|
||||
</Between>
|
||||
</ActionGroup>
|
||||
{busy ? <Value><Spinner /> {busy}…</Value> : null}
|
||||
</>} />
|
||||
<ErrorText className="mb-3">{error}</ErrorText>
|
||||
|
||||
{/* ===== 构建 / 报告 ===== */}
|
||||
<Grid cols={2} gap={12} oneAt="sm">
|
||||
<Grid cols={2} gap={12} oneAt="lg">
|
||||
<Panel>
|
||||
<PanelHead title="构建时间线" />
|
||||
<Ctlbar>
|
||||
<Field label="时间线名称" width="grow">
|
||||
<Field inline label="时间线名称" width="grow">
|
||||
<Input value={build.name} placeholder="留空使用「主时间线」" onChange={(e) => patchBuild({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Check checked={build.only_approved} onChange={(v) => patchBuild({ only_approved: v })}
|
||||
|
|
@ -462,13 +464,19 @@ export default function Timeline() {
|
|||
仅收录审核合格的镜头
|
||||
</Check>
|
||||
</Ctlbar>
|
||||
<TagGroup>
|
||||
{/* 计数是这颗按钮的口径说明,两者必须同一行;两颗主按钮也并进来,
|
||||
原来「计数一行 / 按钮一行」把半张卡留白。 */}
|
||||
<Ctlbar>
|
||||
<Tag>有产物镜头 {buildable.length}</Tag>
|
||||
<Tag>已审核合格 {stats?.shots_approved ?? 0}</Tag>
|
||||
<Button size="sm" onClick={selectAllBuildable}>
|
||||
<Button icon={<IconCheck />} onClick={selectAllBuildable}>
|
||||
{build.shot_ids.length === buildable.length ? '清空指定' : '指定全部镜头'}
|
||||
</Button>
|
||||
</TagGroup>
|
||||
<Button type="primary" disabled={!!busy || !buildable.length} onClick={buildTimeline} icon={<IconTracks />}>构建 / 重建时间线</Button>
|
||||
<Button disabled={!!busy || !missingVoice.length} onClick={makeVoiceover} icon={<IconSound />}>
|
||||
补齐缺失配音({missingVoice.length})
|
||||
</Button>
|
||||
</Ctlbar>
|
||||
<ChipBar>
|
||||
{buildable.map((s: any) => (
|
||||
<Chip key={s.id} active={build.shot_ids.includes(s.id)} onClick={() => toggleBuildShot(s.id)}>
|
||||
|
|
@ -476,12 +484,6 @@ export default function Timeline() {
|
|||
</Chip>
|
||||
))}
|
||||
</ChipBar>
|
||||
<Actions>
|
||||
<Button type="primary" disabled={!!busy || !buildable.length} onClick={buildTimeline} icon={<IconTracks />}>构建 / 重建时间线</Button>
|
||||
<Button disabled={!!busy || !missingVoice.length} onClick={makeVoiceover} icon={<IconSound />}>
|
||||
补齐缺失配音({missingVoice.length})
|
||||
</Button>
|
||||
</Actions>
|
||||
{!buildable.length && <LineHint className="mt-3">先在调度中心生成镜头产物,才能构建时间线。</LineHint>}
|
||||
</Panel>
|
||||
|
||||
|
|
@ -563,7 +565,7 @@ export default function Timeline() {
|
|||
<Mono className={MUTED}>{fmtMs(c.start_ms)} – {fmtMs(c.end_ms)}</Mono>
|
||||
<span>{c.text}{c.speaker ? <span className={MUTED}> — {c.speaker}</span> : null}</span>
|
||||
<Mono className={MUTED}>{c.shot_id ? `shot#${c.shot_id}` : '全局'}</Mono>
|
||||
<Button size="sm" onClick={() => editSubtitle(c)}>编辑</Button>
|
||||
<Button icon={<IconEdit />} size="sm" onClick={() => editSubtitle(c)}>编辑</Button>
|
||||
</div>
|
||||
))}
|
||||
<Divider />
|
||||
|
|
@ -586,7 +588,7 @@ export default function Timeline() {
|
|||
<TextArea rows={2} value={cue.text} placeholder={cue.cue_id ? '留空表示删除这条字幕' : '留空表示删除该镜头字幕'} onChange={(e) => patchCue({ text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<Actions>
|
||||
<Button type="primary" size="sm" disabled={!!busy || !timeline} onClick={saveSubtitle}>保存字幕</Button>
|
||||
<Button icon={<IconCheck />} type="primary" size="sm" disabled={!!busy || !timeline} onClick={saveSubtitle}>保存字幕</Button>
|
||||
<Button size="sm" icon={<IconClose />}
|
||||
onClick={() => setCue({ ...CUE_INIT })}>
|
||||
{cue.cue_id ? `取消编辑 #${cue.cue_id}` : '清空表单(新增字幕)'}
|
||||
|
|
@ -665,7 +667,7 @@ export default function Timeline() {
|
|||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button type="primary" size="sm" disabled={!!busy || !timeline} onClick={saveSettings}>保存并重排</Button>
|
||||
<Button icon={<IconCheck />} type="primary" size="sm" disabled={!!busy || !timeline} onClick={saveSettings}>保存并重排</Button>
|
||||
</Actions>
|
||||
</Panel>
|
||||
</Layout>
|
||||
|
|
@ -677,7 +679,7 @@ export default function Timeline() {
|
|||
right={<>
|
||||
<Value>共 {clips.length} 条</Value>
|
||||
{/* 旧站这颗按钮漏了 @click,点了没反应;配音表单就在同一页下方,直接接上 addAudio */}
|
||||
<Button type="dashed" disabled={!!busy || !timeline} onClick={addAudio}
|
||||
<Button icon={<IconAdd />} type="dashed" disabled={!!busy || !timeline} onClick={addAudio}
|
||||
title="导出时按 lead/tail padding 与配音时长对齐字幕;缺配音会用视频原声并给出提醒。">+ 追加音轨</Button>
|
||||
</>} />
|
||||
{!clips.length && <Empty>暂无音轨。配音由「补齐缺失配音」生成,BGM 可在下方上传。</Empty>}
|
||||
|
|
@ -724,7 +726,7 @@ export default function Timeline() {
|
|||
<FilePick icon={<IconMic />} label="选择音频文件" accept="audio/*"
|
||||
onFiles={(files) => patchAudio({ file: files[0] ?? null })} />
|
||||
{audio.file
|
||||
? <Tag tone="ok" title="已选本地文件,点「开始替换」生效">{audio.file.name}</Tag>
|
||||
? <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>
|
||||
|
|
@ -743,38 +745,30 @@ export default function Timeline() {
|
|||
<Panel>
|
||||
<PanelHead title="时间线版本"
|
||||
right={<span className={MUTED}>最近编辑 {fmtTime(versions[0]?.updated_at)}</span>} />
|
||||
<TableBox maxHeight={220}>
|
||||
<Table className="[&_tbody_tr[data-chosen]>td]:bg-primary-bg-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className={cellCenter}>版本</th><th>名称</th>
|
||||
<th className={cellRight}>片段</th><th className={cellRight}>时长</th>
|
||||
<th className={cellCenter}>状态</th><th>更新时间</th><th className={cellRight}>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{versions.map((v: any) => (
|
||||
<tr key={v.id} data-chosen={v.is_current || undefined}>
|
||||
<td className={cn(cellCenter, MONO)}>v{v.version}</td>
|
||||
<td>{v.name}</td>
|
||||
<td className={cn(cellRight, MONO)}>{v.segments}</td>
|
||||
<td className={cn(cellRight, MONO)}>{fmtMs(v.total_duration_ms)}</td>
|
||||
<td className={cellCenter}>
|
||||
<Tag tone={v.is_current ? 'ok' : 'default'}>{v.is_current ? '当前生效' : '历史版本'}</Tag>
|
||||
</td>
|
||||
<td className={MUTED_MONO}>{fmtTime(v.updated_at)}</td>
|
||||
<td className={cellRight}>
|
||||
<Row tight className="justify-end">
|
||||
<Button type="text" size="sm" onClick={() => { showVersion(v.id); void load(false, v.id) }}>查看</Button>
|
||||
<Button type="text" size="sm" disabled={!!busy || v.is_current} onClick={() => activateOne(v)}>设为当前</Button>
|
||||
<Button type="text" danger disabled={!!busy || versions.length < 2} onClick={() => removeOne(v)}>删除</Button>
|
||||
</Row>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
</TableBox>
|
||||
<Table
|
||||
maxHeight={220}
|
||||
minWidth={820}
|
||||
dataSource={versions}
|
||||
chosen={(v: any) => !!v.is_current}
|
||||
columns={[
|
||||
{ title: '版本', key: 'version', width: 72, align: 'center', className: MONO,
|
||||
render: (_: any, v: any) => `v${v.version}` },
|
||||
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||
{ title: '片段', key: 'segments', width: 76, align: 'right', className: MONO, render: (_: any, v: any) => v.segments },
|
||||
{ title: '时长', key: 'duration', width: 92, align: 'right', className: MONO,
|
||||
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) => (
|
||||
<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>
|
||||
</Row>
|
||||
) }
|
||||
]}
|
||||
/>
|
||||
</Panel>
|
||||
)}
|
||||
</PageStack>
|
||||
|
|
@ -822,7 +816,7 @@ function SegmentRow({ seg, i, count, item, queue, shot, transitions, busy, open,
|
|||
<Mono className={MUTED}>{fmtMs(seg.start_ms)} → {fmtMs(seg.start_ms + seg.duration_ms)}</Mono>
|
||||
<Tag>源 {fmtMs(seg.source_in_ms)}–{fmtMs(seg.source_out_ms)}</Tag>
|
||||
{hasVoice && (
|
||||
<Tag tone={native ? 'info' : 'ok'}
|
||||
<Tag tone={native ? 'info' : 'default'}
|
||||
title={native ? '台词直接用模型自带音轨,与口型天然同步' : '台词用平台配音(TTS),片段按配音长度补足'}>
|
||||
{native ? '原声' : '配音'}
|
||||
</Tag>
|
||||
|
|
@ -864,7 +858,7 @@ function SegmentRow({ seg, i, count, item, queue, shot, transitions, busy, open,
|
|||
<Actions>
|
||||
<Button size="sm" disabled={busy || i === 0} onClick={() => onMove(i, -1)} icon={<IconArrowUp />}>上移</Button>
|
||||
<Button size="sm" disabled={busy || i === count - 1} onClick={() => onMove(i, 1)} icon={<IconArrowDown />}>下移</Button>
|
||||
<Button size="sm" onClick={() => onPatch(seg, { muted: !seg.muted }, '切换静音')}>
|
||||
<Button icon={<IconSound />} size="sm" onClick={() => onPatch(seg, { muted: !seg.muted }, '切换静音')}>
|
||||
{seg.muted ? '取消静音' : '静音该片段'}
|
||||
</Button>
|
||||
<Button type="link" onClick={onOpen} icon={<IconEye />}>预览该片段</Button>
|
||||
|
|
|
|||