新增 FormGrid 表单级 12 列基准栅格:列边界从每条 FormRow 上收到表单作用域统一定义一次,FormRow 的 cols 退化为「这行几个字段」= 每字段跨 12/cols 格,横向间距也归表单管(基准栅格里换列间距会让整条列线漂 1.7px),一行一项与 width=full 用 :only-child/data-full 铺满;模型抽屉、分镜检视器、素材抽屉等 7 个多行表单容器接入,字段标题错位从 110px 降到 0;Slider 标签并入 LABEL_CLS 与 Field 同尺;孤立 FormRow 保留原 auto-fit 路径零改动。
parent
c5edd65d82
commit
139db20320
|
|
@ -1,3 +1,4 @@
|
|||
import { createContext, useContext } from 'react'
|
||||
import type { ReactNode } from 'react'
|
||||
import { cn } from '../../lib/cn'
|
||||
import { TAG_DENSE } from './Status'
|
||||
|
|
@ -12,12 +13,15 @@ import { TAG_DENSE } from './Status'
|
|||
* <Field> 行内标签字段(标签在左、控件在右;grow / wide / narrow 调宽)
|
||||
* <BarRight> 需要右靠的一组控件(替代写在控件上的 margin-left:auto)
|
||||
* <ChipBar> chip 行(与下方内容强制呼吸 12px)
|
||||
* <FormRow> 短字段栅格(auto-fit 自己降列,页面不写 @media)
|
||||
* <FormGrid> 表单级栅格作用域:一个表单只在这里定义一次列边界(12 等分)
|
||||
* <FormRow> 表单里的一行(有 FormGrid 时按跨格数落位,没有时 auto-fit 自己降列)
|
||||
* <Pager> 分页条(page_size 唯一的家)
|
||||
* 高度一律不写在控件上:容器把 --ctl-h 压到紧凑档,行内控件跟着一起降。
|
||||
*/
|
||||
|
||||
const LABEL = 'flex flex-row items-center gap-1.5 m-0 text-muted text-tiny tracking-[.3px] whitespace-nowrap'
|
||||
/** 行内字段标签的唯一尺子:Field 与 Slider 共用,抽屉里两种字段的标题必须量出同一个字号 */
|
||||
export const LABEL_CLS = 'flex flex-row items-center gap-1.5 m-0 text-muted text-tiny tracking-[.3px] whitespace-nowrap'
|
||||
const LABEL = LABEL_CLS
|
||||
/** 字段行内标签(标签在左):文字本身不拉伸,否则被挤成两行 */
|
||||
const LABEL_CHILD = '[&>label]:flex [&>label]:flex-row [&>label]:items-center [&>label]:gap-1.5 [&>label]:m-0 '
|
||||
+ '[&>label]:text-muted [&>label]:text-tiny [&>label]:tracking-[.3px] [&>label]:whitespace-nowrap'
|
||||
|
|
@ -71,7 +75,8 @@ export function Field({ label, required, children, width = 'default', className,
|
|||
title?: string
|
||||
}) {
|
||||
return (
|
||||
<label title={title} className={cn(LABEL, FIELD_INNER, WIDTHS[width], 'min-w-0',
|
||||
<label title={title} data-full={width === 'full' ? '' : undefined}
|
||||
className={cn(LABEL, FIELD_INNER, WIDTHS[width], 'min-w-0',
|
||||
// 带 hint 的字段翻成两列栅格:标签在左上、控件在右上、说明贴在控件下面。
|
||||
// 不能只是 flex-wrap——base.css 里控件是 w-full,一换行控件就被整体挤到第二行,
|
||||
// 标签跑回上面,同一栅格里就成了「一个横排、两个竖排」的混排(规范 R3)。
|
||||
|
|
@ -109,7 +114,56 @@ export function FieldBlock({ label, required, children, className, title }: {
|
|||
}
|
||||
|
||||
/**
|
||||
* 短字段栅格:列数由容器决定,页面不写 @media;stack 把标签退回控件上方。
|
||||
* 12 列基准栅格:整个表单的列边界只在这里定义一次。
|
||||
*
|
||||
* 病灶(用户说的「字段标题不对齐」):轨道以前写在每条 FormRow 自己身上,
|
||||
* 模型抽屉里「模型身份」那行 cols={3}、「并发/RPM」那行 cols={4},
|
||||
* 同宽的两行列边界差了 110px,标题看着就是斜的。
|
||||
* 现在基准取 12 等分(2/3/4/6 都能整除),FormRow 的 cols 退化成
|
||||
* 「这一行放几个字段」= 每个字段跨 12/cols 格,任何一行都对齐同一套线。
|
||||
*
|
||||
* 没有 FormGrid 的孤立 FormRow 走原来的 auto-fit 路径,全站不必一次性改写;
|
||||
* 只要一个表单里出现两行列数不同,就必须用 FormGrid 包起来。
|
||||
*
|
||||
* 它是「布局作用域」而不是又一个盒子:只发 context,不加 DOM,
|
||||
* 所以能在不改动缩进结构、不新增一层 div 的前提下套住整个抽屉表单。
|
||||
*/
|
||||
const FormGridCtx = createContext<{ gapX: string; gapY: string } | null>(null)
|
||||
|
||||
export function FormGrid({ children, gap = 'loose' }: {
|
||||
children: ReactNode; gap?: 'loose' | 'tight'
|
||||
}) {
|
||||
const spec = gap === 'tight' ? { gapX: 'gap-x-[8px]', gapY: 'gap-y-[8px]' }
|
||||
: { gapX: 'gap-x-[10px]', gapY: 'gap-y-[8px]' }
|
||||
return <FormGridCtx.Provider value={spec}>{children}</FormGridCtx.Provider>
|
||||
}
|
||||
|
||||
/**
|
||||
* 每行字段数 → 跨格数 + 窄屏降列。
|
||||
* 降列的档位沿用原来的规则:3/4 列在 mid 以下两列、6 列在 nav 以下两列,2 列不降。
|
||||
* cols 省略(原来靠 auto-fit 猜列数)在基准栅格里按每行 4 个字段处理——
|
||||
* 栅格必须有一个确定的列数,这正是「轨道写在行上」会被消灭的原因。
|
||||
*
|
||||
* 两个「占满整行」的例外,否则长文本字段会在 12 格里被压成一小截:
|
||||
* :only-child —— 整行只有一个字段(审核台那种一行一项),铺满;
|
||||
* width="full" —— 字段自己声明占满(Field 挂 data-full)。
|
||||
*/
|
||||
// 注意:这些类名必须原样写成字面量。Tailwind 扫的是源码文本,
|
||||
// 用模板字符串把 col-span-${n} 拼出来,产物 CSS 里根本不会有那条规则(踩过)。
|
||||
const SPAN_FULL = '[&>[data-full]]:col-span-full [&>:only-child]:col-span-full'
|
||||
const LATTICE: Record<number, string> = {
|
||||
2: '[&>*:not([data-full]):not(:only-child)]:col-span-6 '
|
||||
+ 'max-mid:[&>*:not([data-full]):not(:only-child)]:col-span-12 ' + SPAN_FULL,
|
||||
3: '[&>*:not([data-full]):not(:only-child)]:col-span-4 '
|
||||
+ 'max-mid:[&>*:not([data-full]):not(:only-child)]:col-span-6 ' + SPAN_FULL,
|
||||
4: '[&>*:not([data-full]):not(:only-child)]:col-span-3 '
|
||||
+ 'max-mid:[&>*:not([data-full]):not(:only-child)]:col-span-6 ' + SPAN_FULL,
|
||||
6: '[&>*:not([data-full]):not(:only-child)]:col-span-2 '
|
||||
+ 'max-nav:[&>*:not([data-full]):not(:only-child)]:col-span-6 ' + SPAN_FULL
|
||||
}
|
||||
|
||||
/**
|
||||
* 短字段栅格:列边界来自 <FormGrid>;stack 把标签退回控件上方。
|
||||
*
|
||||
* 表单容器显式声明自己是主尺寸(38px):抽屉/对话框里的字段永远同一档,
|
||||
* 不会因为外面套了一层紧凑档工具条(Ctlbar / ChipBar / 抽屉动作条)
|
||||
|
|
@ -117,28 +171,42 @@ export function FieldBlock({ label, required, children, className, title }: {
|
|||
*/
|
||||
export function FormRow({ children, cols, tight, stack, className }: {
|
||||
children: ReactNode
|
||||
/** 这一行放几个字段;在 FormGrid 里 = 每个字段跨 12/cols 格 */
|
||||
cols?: 2 | 3 | 4 | 6
|
||||
/** 更紧的一行(仅脱离 FormGrid 时生效,基准栅格里间距由表单统一) */
|
||||
tight?: boolean
|
||||
stack?: boolean
|
||||
className?: string
|
||||
}) {
|
||||
const grid = useContext(FormGridCtx)
|
||||
const shared = '[--ctl-h:var(--ctl-h-main)] grid mb-[10px] min-w-0 [&>*]:min-w-0 '
|
||||
// 每个字段贴到自己格子的顶端:否则带 hint 的字段把行撑高之后,
|
||||
// 旁边没 hint 的字段会被垂直居中,同一行三个输入框错开半行(规范 R3)。
|
||||
+ '[&>*]:self-start '
|
||||
// 这里必须显式 [&>*]:flex:带 hint 的字段自己是 grid,
|
||||
// grid 元素不认 flex-direction,不覆盖就会在 stack 栅格里漏掉竖排。
|
||||
+ (stack ? 'gap-y-[10px] [&>*]:flex [&>*]:flex-col [&>*]:items-stretch [&>*]:gap-[5px] [&>*]:w-auto [&>*:not(span)]:w-full' : '')
|
||||
if (grid) {
|
||||
// 间距也归 FormGrid 统管:基准 12 格下只要列间距换一个数,
|
||||
// 每条列线就整体漂移(实测 10→8px 时最后一格偏 1.7px),对齐又是假的。
|
||||
// 所以基准栅格里 tight 只影响纵向,横向密度由表单说了算。
|
||||
return (
|
||||
<div className={cn(shared, 'grid-cols-12', grid.gapX, grid.gapY, LATTICE[cols ?? 3], className)}>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const tracks = cols === undefined ? 'repeat(auto-fit,minmax(190px,1fr))'
|
||||
: cols === 6 ? 'repeat(6,minmax(78px,1fr))'
|
||||
: `repeat(${cols},minmax(0,1fr))`
|
||||
return (
|
||||
<div className={cn('[--ctl-h:var(--ctl-h-main)] grid mb-[10px] min-w-0 [&>*]:min-w-0',
|
||||
// 每个字段贴到自己格子的顶端:否则带 hint 的字段把行撑高之后,
|
||||
// 旁边没 hint 的字段会被垂直居中,同一行三个输入框错开半行(规范 R3)。
|
||||
'[&>*]:self-start',
|
||||
<div className={cn(shared,
|
||||
// 间距照旧站 .frow(gap: 8px 10px):列间 10px 是「标签在左」不贴到上一格控件的地板,
|
||||
// 之前这里只在 tight 时给 gap,非 tight 档位间距为 0,窄屏上「镜号」几乎贴着上一格的输入框。
|
||||
tight ? 'gap-[8px]' : 'gap-x-[10px] gap-y-[8px]',
|
||||
cols === undefined && 'max-mid:grid-cols-2',
|
||||
(cols === 3 || cols === 4) && 'max-mid:grid-cols-2',
|
||||
(cols === 4 || cols === 6) && 'max-nav:grid-cols-2',
|
||||
// 这里必须显式 [&>*]:flex:带 hint 的字段自己是 grid,
|
||||
// grid 元素不认 flex-direction,不覆盖就会在 stack 栅格里漏掉竖排。
|
||||
stack && 'gap-y-[10px] [&>*]:flex [&>*]:flex-col [&>*]:items-stretch [&>*]:gap-[5px] [&>*]:w-auto [&>*:not(span)]:w-full',
|
||||
className)}
|
||||
style={{ gridTemplateColumns: tracks }}>
|
||||
{children}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { type ReactNode } from 'react'
|
||||
import { cn } from '../../lib/cn'
|
||||
import { LABEL_CLS } from './Controls'
|
||||
|
||||
/**
|
||||
* 数值滑杆 + 当前值。
|
||||
|
|
@ -21,7 +22,7 @@ export function Slider({ value, min = 0, max = 1, step = 0.01, onChange, label,
|
|||
}) {
|
||||
return (
|
||||
<label className={cn('flex items-center gap-2 min-w-0', className)}>
|
||||
{label && <span className="flex-none text-caption text-muted whitespace-nowrap">{label}</span>}
|
||||
{label && <span className={cn('flex-none', LABEL_CLS)}>{label}</span>}
|
||||
<input type="range" min={min} max={max} step={step} value={value} disabled={disabled}
|
||||
onChange={(e) => onChange(Number(e.target.value))}
|
||||
className="min-w-0 flex-1 h-[5px] p-0 m-0 border-0 accent-[--c-accent-fill]" />
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import { useAutoRefresh } from '../hooks'
|
|||
import { useRecordingBusy } from '../stores/recording'
|
||||
import {
|
||||
BarRight, Between, Button, Chip, ChipBar, Check, Ctlbar, Drawer, Empty, ErrorText, Field, FieldBlock,
|
||||
FilePick, FormRow, Grid, LINK_CLS, Modal, MONO, MUTED, MUTED_MONO, Notice, PageHead, Pager, Panel, PanelHead,
|
||||
FilePick, FormGrid, FormRow, Grid, LINK_CLS, Modal, MONO, MUTED, MUTED_MONO, Notice, PageHead, Pager, Panel, PanelHead,
|
||||
Row, SectionTitle, Spinner, Tag, TagGroup, TEXTAREA_TALL, ViewBtn
|
||||
} from '../components/ui'
|
||||
|
||||
|
|
@ -1462,129 +1462,131 @@ export default function AssetLibrary() {
|
|||
</Button>
|
||||
<Button variant="outline" onClick={() => setDrawer(false)}>取消</Button>
|
||||
</>}>
|
||||
{/* 长文本字段要有可写的面积,还要允许用户自己继续拉高(旧站 .drawer-body textarea) */}
|
||||
<div className={TEXTAREA_TALL}>
|
||||
<FormRow>
|
||||
<Field label="名称" required>
|
||||
<input value={form.name} placeholder="角色 / 场景 / 声线名称"
|
||||
onChange={(e) => patchForm({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="代号">
|
||||
<input value={form.code} placeholder="可留空"
|
||||
onChange={(e) => patchForm({ code: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="标签">
|
||||
<input value={form.tags} placeholder="科幻 主角 冷色"
|
||||
onChange={(e) => patchForm({ tags: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormGrid>
|
||||
{/* 长文本字段要有可写的面积,还要允许用户自己继续拉高(旧站 .drawer-body textarea) */}
|
||||
<div className={TEXTAREA_TALL}>
|
||||
<FormRow>
|
||||
<Field label="名称" required>
|
||||
<input value={form.name} placeholder="角色 / 场景 / 声线名称"
|
||||
onChange={(e) => patchForm({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="代号">
|
||||
<input value={form.code} placeholder="可留空"
|
||||
onChange={(e) => patchForm({ code: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="标签">
|
||||
<input value={form.tags} placeholder="科幻 主角 冷色"
|
||||
onChange={(e) => patchForm({ tags: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
{form.type === 'human' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="定位">
|
||||
<Select value={form.role} options={ROLES.map((r) => ({ value: r, label: r }))}
|
||||
onChange={(next) => patchForm({ role: String(next) })} ariaLabel="角色定位" />
|
||||
</Field>
|
||||
<Field label="造型版本">
|
||||
<input value={form.style_version}
|
||||
onChange={(e) => patchForm({ style_version: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="默认声线">
|
||||
<Select value={form.default_voice_id}
|
||||
options={[{ value: null, label: '不绑定' },
|
||||
...voices.map((v: any) => ({ value: v.id, label: v.name }))]}
|
||||
onChange={(next) => patchForm({ default_voice_id: next == null ? null : Number(next) })}
|
||||
ariaLabel="默认声线" />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="外观">
|
||||
<textarea value={form.appearance} rows={2} placeholder="五官、发型、体型、服装与配饰"
|
||||
onChange={(e) => patchForm({ appearance: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="性格与表演">
|
||||
<textarea value={form.personality} rows={2}
|
||||
onChange={(e) => patchForm({ personality: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词">
|
||||
<textarea value={form.persona_prompt} rows={3}
|
||||
onChange={(e) => patchForm({ persona_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="声音描述">
|
||||
<input value={form.voice_profile}
|
||||
onChange={(e) => patchForm({ voice_profile: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</>
|
||||
)}
|
||||
{form.type === 'human' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="定位">
|
||||
<Select value={form.role} options={ROLES.map((r) => ({ value: r, label: r }))}
|
||||
onChange={(next) => patchForm({ role: String(next) })} ariaLabel="角色定位" />
|
||||
</Field>
|
||||
<Field label="造型版本">
|
||||
<input value={form.style_version}
|
||||
onChange={(e) => patchForm({ style_version: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="默认声线">
|
||||
<Select value={form.default_voice_id}
|
||||
options={[{ value: null, label: '不绑定' },
|
||||
...voices.map((v: any) => ({ value: v.id, label: v.name }))]}
|
||||
onChange={(next) => patchForm({ default_voice_id: next == null ? null : Number(next) })}
|
||||
ariaLabel="默认声线" />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="外观">
|
||||
<textarea value={form.appearance} rows={2} placeholder="五官、发型、体型、服装与配饰"
|
||||
onChange={(e) => patchForm({ appearance: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="性格与表演">
|
||||
<textarea value={form.personality} rows={2}
|
||||
onChange={(e) => patchForm({ personality: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词">
|
||||
<textarea value={form.persona_prompt} rows={3}
|
||||
onChange={(e) => patchForm({ persona_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="声音描述">
|
||||
<input value={form.voice_profile}
|
||||
onChange={(e) => patchForm({ voice_profile: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</>
|
||||
)}
|
||||
|
||||
{form.type === 'scene' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="光线">
|
||||
<input value={form.lighting} onChange={(e) => patchForm({ lighting: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="时间">
|
||||
<input value={form.time_of_day}
|
||||
onChange={(e) => patchForm({ time_of_day: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="主色调">
|
||||
<input value={form.palette} onChange={(e) => patchForm({ palette: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="场景描述">
|
||||
<textarea value={form.description} rows={2}
|
||||
onChange={(e) => patchForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词">
|
||||
<textarea value={form.prompt} rows={3}
|
||||
onChange={(e) => patchForm({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</>
|
||||
)}
|
||||
{form.type === 'scene' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="光线">
|
||||
<input value={form.lighting} onChange={(e) => patchForm({ lighting: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="时间">
|
||||
<input value={form.time_of_day}
|
||||
onChange={(e) => patchForm({ time_of_day: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="主色调">
|
||||
<input value={form.palette} onChange={(e) => patchForm({ palette: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="场景描述">
|
||||
<textarea value={form.description} rows={2}
|
||||
onChange={(e) => patchForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词">
|
||||
<textarea value={form.prompt} rows={3}
|
||||
onChange={(e) => patchForm({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</>
|
||||
)}
|
||||
|
||||
{form.type === 'voice' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="语言">
|
||||
<input value={form.language} onChange={(e) => patchForm({ language: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="性别">
|
||||
<Select value={form.gender} options={GENDERS}
|
||||
onChange={(next) => patchForm({ gender: String(next ?? '') })} ariaLabel="声线性别" />
|
||||
</Field>
|
||||
<Field label="语速">
|
||||
<input type="number" min={0.5} max={2} step={0.05} value={form.tuning_speed}
|
||||
onChange={(e) => patchForm({ tuning_speed: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="效果" title={EFFECT_HINT}>
|
||||
<Select value={form.tuning_effect} options={EFFECTS}
|
||||
onChange={(next) => patchForm({ tuning_effect: String(next ?? '') })}
|
||||
ariaLabel="声音效果" />
|
||||
</Field>
|
||||
<Check className="self-end h-(--ctl-h-md)" checked={form.is_default}
|
||||
onChange={(next) => patchForm({ is_default: next })}>
|
||||
设为平台默认声线
|
||||
</Check>
|
||||
</FormRow>
|
||||
<FieldBlock label="音色描述">
|
||||
<textarea value={form.description} rows={3}
|
||||
onChange={(e) => patchForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="版本">
|
||||
<input value={form.version} onChange={(e) => patchForm({ version: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</>
|
||||
)}
|
||||
{form.type === 'voice' && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="语言">
|
||||
<input value={form.language} onChange={(e) => patchForm({ language: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="性别">
|
||||
<Select value={form.gender} options={GENDERS}
|
||||
onChange={(next) => patchForm({ gender: String(next ?? '') })} ariaLabel="声线性别" />
|
||||
</Field>
|
||||
<Field label="语速">
|
||||
<input type="number" min={0.5} max={2} step={0.05} value={form.tuning_speed}
|
||||
onChange={(e) => patchForm({ tuning_speed: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="效果" title={EFFECT_HINT}>
|
||||
<Select value={form.tuning_effect} options={EFFECTS}
|
||||
onChange={(next) => patchForm({ tuning_effect: String(next ?? '') })}
|
||||
ariaLabel="声音效果" />
|
||||
</Field>
|
||||
<Check className="self-end h-(--ctl-h-md)" checked={form.is_default}
|
||||
onChange={(next) => patchForm({ is_default: next })}>
|
||||
设为平台默认声线
|
||||
</Check>
|
||||
</FormRow>
|
||||
<FieldBlock label="音色描述">
|
||||
<textarea value={form.description} rows={3}
|
||||
onChange={(e) => patchForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="版本">
|
||||
<input value={form.version} onChange={(e) => patchForm({ version: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</>
|
||||
)}
|
||||
|
||||
<FieldBlock label="备注">
|
||||
<textarea value={form.notes} rows={2} onChange={(e) => patchForm({ notes: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<ErrorText>{error}</ErrorText>
|
||||
</div>
|
||||
<FieldBlock label="备注">
|
||||
<textarea value={form.notes} rows={2} onChange={(e) => patchForm({ notes: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<ErrorText>{error}</ErrorText>
|
||||
</div>
|
||||
</FormGrid>
|
||||
</Drawer>
|
||||
|
||||
{/* AS-1:AI 生成表单收进右侧抽屉。以前每张卡片里塞一个 600px 的表单,
|
||||
|
|
@ -1602,163 +1604,165 @@ export default function AssetLibrary() {
|
|||
</span>}>
|
||||
<div className="flex flex-col gap-3">
|
||||
<Panel className="border-line-strong bg-card p-[10px]">
|
||||
<Between tight className="mb-[10px] gap-x-[14px]">
|
||||
<b className="text-caption">AI {isVoice ? '试听' : '母版生成'}</b>
|
||||
<span className={cn(MUTED, 'text-tiny')}>{specCaps(genTarget).label || '模型注册表读取中…'}</span>
|
||||
</Between>
|
||||
<FormGrid>
|
||||
<Between tight className="mb-[10px] gap-x-[14px]">
|
||||
<b className="text-caption">AI {isVoice ? '试听' : '母版生成'}</b>
|
||||
<span className={cn(MUTED, 'text-tiny')}>{specCaps(genTarget).label || '模型注册表读取中…'}</span>
|
||||
</Between>
|
||||
|
||||
<FormRow>
|
||||
<Field label="模型">
|
||||
<Select size="sm" value={modelRef(genTarget)} ariaLabel="生成模型"
|
||||
placeholder={noModelHint(isVoice)}
|
||||
onChange={(next) => setDraft(genTarget, { model: String(next) })}
|
||||
options={[
|
||||
{ value: '', label: noModelHint(isVoice), disabled: true },
|
||||
...genModels.map((p: ModelRow) => ({
|
||||
value: refOf(p),
|
||||
label: `${p.display_name || `${p.provider}/${p.model}`}${p.is_default ? '(平台默认)' : ''}`
|
||||
}))
|
||||
]} />
|
||||
</Field>
|
||||
{!isVoice && (
|
||||
<Field label="类型">
|
||||
<Select size="sm" value={draft.kind} ariaLabel="生成素材类型"
|
||||
onChange={(next) => selectAtmosphereReference(genTarget, String(next))}
|
||||
options={KIND_CHOICES[isScene ? 'scene' : 'human']} />
|
||||
</Field>
|
||||
)}
|
||||
</FormRow>
|
||||
|
||||
{isVoice && (
|
||||
<FieldBlock label="试听文本" required>
|
||||
<textarea rows={2} value={draft.sample_text}
|
||||
title="这是要念出来的台词,不是声线设定;「音色描述」不会被当成台词。"
|
||||
placeholder="输入一句要让模型朗读的台词,例如:我是俊杰,公司的产品专家。"
|
||||
onChange={(e) => setDraft(genTarget, { sample_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
)}
|
||||
|
||||
{!isVoice && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="分辨率档位">
|
||||
<Select size="sm" value={draftTier(genTarget)} ariaLabel="分辨率档位"
|
||||
onChange={(next) => setDraft(genTarget, { tier: String(next) })}
|
||||
options={tierChoices(genTarget).map((tk: any) => ({
|
||||
value: tk.value, label: `${tk.label}(长边 ${tk.edge}px)`
|
||||
}))} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select size="sm" value={draftAspect(genTarget)} ariaLabel="画幅"
|
||||
onChange={(next) => setDraft(genTarget, { aspect: String(next) })}
|
||||
options={aspectChoices(genTarget).map((a: any) => ({ value: a.value, label: a.label }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
{/* 能力条:把选中模型真的支持什么摊开,而不是等用户提交后吃一个 400 */}
|
||||
<Row tight className="gap-1 mb-[10px]">
|
||||
{!!caps.resolutions.length && <Tag>档位 {caps.resolutions.join(' / ')}</Tag>}
|
||||
{!!caps.aspectRatios.length && <Tag>画幅 {caps.aspectRatios.join(' / ')}</Tag>}
|
||||
<Tag>输出 {canvasOf(genTarget).width}×{canvasOf(genTarget).height}</Tag>
|
||||
{!!caps.maxReferenceImages && <Tag>参考图 ≤ {caps.maxReferenceImages}</Tag>}
|
||||
{!caps.known && <Tag tone="bad">模型未注册</Tag>}
|
||||
</Row>
|
||||
|
||||
<div className={REF_BOX}>
|
||||
<FieldBlock label="参考图(可多选,留空即纯文生图)"
|
||||
className="flex-1 min-w-[220px] mb-0">
|
||||
<MultiSelect size="sm" value={draft.reference_media_ids}
|
||||
ariaLabel={`${genTarget.name}:参考图`}
|
||||
onChange={(ids) => pickReferences(genTarget, ids)}
|
||||
options={imageReferenceOptions(genTarget).map((m: any) => ({
|
||||
value: m.id, label: `${m.name || m.kind_label} · v${m.version}`
|
||||
}))} />
|
||||
</FieldBlock>
|
||||
<FilePick accept="image/*" label="上传参考图" className={REF_PICK}
|
||||
title="选完直接登记为该母版的一个新版本,随即可在上方勾选"
|
||||
onFiles={(files) => files.forEach((f) => void uploadImageReference(genTarget, f))} />
|
||||
<small className={REF_HINT}>
|
||||
已选 {draft.reference_media_ids.length} / {specCaps(genTarget).maxReferenceImages || 1} 张。
|
||||
定妆图、三视图或场景图可作一致性锚点;超出上限时按勾选顺序取前几张。
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<FieldBlock label="补充提示" className="mt-[10px]">
|
||||
<textarea rows={2} value={draft.prompt} placeholder="留空则自动使用母版设定"
|
||||
onChange={(e) => setDraft(genTarget, { prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isVoice && (
|
||||
<div className={REF_BOX}>
|
||||
<Field label="参考音色" width="grow" className="flex-1 min-w-[220px]">
|
||||
<Select size="sm" value={draft.reference_media_id} ariaLabel="参考音色"
|
||||
onChange={(next) => {
|
||||
setDraft(genTarget, { reference_media_id: next == null ? null : Number(next) })
|
||||
void loadVoiceReferenceStatus(genTarget)
|
||||
}}
|
||||
<FormRow>
|
||||
<Field label="模型">
|
||||
<Select size="sm" value={modelRef(genTarget)} ariaLabel="生成模型"
|
||||
placeholder={noModelHint(isVoice)}
|
||||
onChange={(next) => setDraft(genTarget, { model: String(next) })}
|
||||
options={[
|
||||
{ value: null, label: '自动(本声线 → 同性别声线 → 模型默认)' },
|
||||
...referenceOptions(genTarget).map((m: any) => ({
|
||||
value: m.id, label: `${m.name || m.kind_label} · v${m.version}`
|
||||
{ value: '', label: noModelHint(isVoice), disabled: true },
|
||||
...genModels.map((p: ModelRow) => ({
|
||||
value: refOf(p),
|
||||
label: `${p.display_name || `${p.provider}/${p.model}`}${p.is_default ? '(平台默认)' : ''}`
|
||||
}))
|
||||
]} />
|
||||
</Field>
|
||||
<FilePick accept="audio/*" label="上传参考音色" className={REF_PICK}
|
||||
title="上传后立即可勾选为本次克隆的参考"
|
||||
onFiles={(files) => files.forEach((f) => void uploadReferenceFile(genTarget, f))} />
|
||||
<RecordAudio label="录制参考音色" target="参考音色"
|
||||
defaultName={defaultAssetName(genTarget.assets || [],
|
||||
`${genTarget.name || '声线'}参考音色`, 'reference')}
|
||||
names={existingNames(genTarget.assets)}
|
||||
hint="弹出小面板:对着麦克风念几句话即可当作克隆参考,录完自动转成 WAV"
|
||||
onPick={(file, meta) => void recordReference(genTarget, file, meta)} />
|
||||
{voiceRefBusy && <div className={cn(REF_FULL, REF_STATUS, 'text-dim')}>正在确认这次会用谁的嗓子…</div>}
|
||||
{!voiceRefBusy && voiceRefStatus && (
|
||||
<div className={cn(REF_FULL, REF_STATUS,
|
||||
!voiceRefStatus.ready && REF_BAD,
|
||||
(voiceRefStatus.borrowed || voiceRefStatus.bound_generated) && REF_WARN)}>
|
||||
<b>本次音色:{voiceRefStatus.note}</b>
|
||||
{voiceRefStatus.bound_generated
|
||||
? <small>
|
||||
这条声线现在挂着的是<b>模型生成的试听样本</b>,不是真人录音:可以拿去给镜头配音,
|
||||
但不能反过来当克隆参考,否则第一次生成错了性别,之后每次重试都会继续克隆那个错的嗓子。
|
||||
上传一段{voiceRefStatus.gender_label}真人参考音频就能固定成这个角色自己的音色。
|
||||
</small>
|
||||
: <small>
|
||||
设定性别:{voiceRefStatus.gender_label}。音色由参考音频决定,「性别 / 音色描述」只是标注——
|
||||
要给这个角色一副自己的嗓子,请上传一段同性别参考音频。
|
||||
</small>}
|
||||
</div>
|
||||
{!isVoice && (
|
||||
<Field label="类型">
|
||||
<Select size="sm" value={draft.kind} ariaLabel="生成素材类型"
|
||||
onChange={(next) => selectAtmosphereReference(genTarget, String(next))}
|
||||
options={KIND_CHOICES[isScene ? 'scene' : 'human']} />
|
||||
</Field>
|
||||
)}
|
||||
<small className={REF_HINT}>
|
||||
需要参考音频的模型(如 IndexTTS2)用参考音频做 zero-shot 音色克隆;
|
||||
设定了性别却没有任何同性别参考时,平台会直接拒绝生成,而不是悄悄给你一个陌生人的嗓门。
|
||||
</small>
|
||||
</div>
|
||||
)}
|
||||
</FormRow>
|
||||
|
||||
<Button variant="primary" size="sm"
|
||||
disabled={!!busy || !genModels.length || !generationSpec(genTarget)
|
||||
|| (isVoice && (!String(draft.sample_text || '').trim() || !voiceHasReference(genTarget)))}
|
||||
onClick={() => void generate(genTarget)}>
|
||||
{busy ? '处理中…' : (isVoice ? '◉ 生成试听样本' : '▧ 生成母版图像')}
|
||||
</Button>
|
||||
<ErrorText>{error}</ErrorText>
|
||||
{isVoice && (
|
||||
<FieldBlock label="试听文本" required>
|
||||
<textarea rows={2} value={draft.sample_text}
|
||||
title="这是要念出来的台词,不是声线设定;「音色描述」不会被当成台词。"
|
||||
placeholder="输入一句要让模型朗读的台词,例如:我是俊杰,公司的产品专家。"
|
||||
onChange={(e) => setDraft(genTarget, { sample_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
)}
|
||||
|
||||
{/* 注册表不在首屏:所以这里必须解释「为什么模型下拉是空的」,
|
||||
否则用户只会看到一个空下拉,以为平台没接模型。 */}
|
||||
{registryError
|
||||
? <small className={PROVIDER_WARN}>模型注册表读取失败:{registryError}</small>
|
||||
: registryBusy
|
||||
? <small className={PROVIDER_WARN}>正在读取模型注册表…</small>
|
||||
: !genModels.length
|
||||
? <small className={PROVIDER_WARN}>
|
||||
当前没有已启用的真实{isVoice ? '声音' : '图像'}模型(mock 演练通道不出正式素材),请先到{' '}
|
||||
<Link to="/models" className={LINK_CLS}>模型中心</Link> 启用。
|
||||
{!isVoice && (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="分辨率档位">
|
||||
<Select size="sm" value={draftTier(genTarget)} ariaLabel="分辨率档位"
|
||||
onChange={(next) => setDraft(genTarget, { tier: String(next) })}
|
||||
options={tierChoices(genTarget).map((tk: any) => ({
|
||||
value: tk.value, label: `${tk.label}(长边 ${tk.edge}px)`
|
||||
}))} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select size="sm" value={draftAspect(genTarget)} ariaLabel="画幅"
|
||||
onChange={(next) => setDraft(genTarget, { aspect: String(next) })}
|
||||
options={aspectChoices(genTarget).map((a: any) => ({ value: a.value, label: a.label }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
{/* 能力条:把选中模型真的支持什么摊开,而不是等用户提交后吃一个 400 */}
|
||||
<Row tight className="gap-1 mb-[10px]">
|
||||
{!!caps.resolutions.length && <Tag>档位 {caps.resolutions.join(' / ')}</Tag>}
|
||||
{!!caps.aspectRatios.length && <Tag>画幅 {caps.aspectRatios.join(' / ')}</Tag>}
|
||||
<Tag>输出 {canvasOf(genTarget).width}×{canvasOf(genTarget).height}</Tag>
|
||||
{!!caps.maxReferenceImages && <Tag>参考图 ≤ {caps.maxReferenceImages}</Tag>}
|
||||
{!caps.known && <Tag tone="bad">模型未注册</Tag>}
|
||||
</Row>
|
||||
|
||||
<div className={REF_BOX}>
|
||||
<FieldBlock label="参考图(可多选,留空即纯文生图)"
|
||||
className="flex-1 min-w-[220px] mb-0">
|
||||
<MultiSelect size="sm" value={draft.reference_media_ids}
|
||||
ariaLabel={`${genTarget.name}:参考图`}
|
||||
onChange={(ids) => pickReferences(genTarget, ids)}
|
||||
options={imageReferenceOptions(genTarget).map((m: any) => ({
|
||||
value: m.id, label: `${m.name || m.kind_label} · v${m.version}`
|
||||
}))} />
|
||||
</FieldBlock>
|
||||
<FilePick accept="image/*" label="上传参考图" className={REF_PICK}
|
||||
title="选完直接登记为该母版的一个新版本,随即可在上方勾选"
|
||||
onFiles={(files) => files.forEach((f) => void uploadImageReference(genTarget, f))} />
|
||||
<small className={REF_HINT}>
|
||||
已选 {draft.reference_media_ids.length} / {specCaps(genTarget).maxReferenceImages || 1} 张。
|
||||
定妆图、三视图或场景图可作一致性锚点;超出上限时按勾选顺序取前几张。
|
||||
</small>
|
||||
: null}
|
||||
</div>
|
||||
|
||||
<FieldBlock label="补充提示" className="mt-[10px]">
|
||||
<textarea rows={2} value={draft.prompt} placeholder="留空则自动使用母版设定"
|
||||
onChange={(e) => setDraft(genTarget, { prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</>
|
||||
)}
|
||||
|
||||
{isVoice && (
|
||||
<div className={REF_BOX}>
|
||||
<Field label="参考音色" width="grow" className="flex-1 min-w-[220px]">
|
||||
<Select size="sm" value={draft.reference_media_id} ariaLabel="参考音色"
|
||||
onChange={(next) => {
|
||||
setDraft(genTarget, { reference_media_id: next == null ? null : Number(next) })
|
||||
void loadVoiceReferenceStatus(genTarget)
|
||||
}}
|
||||
options={[
|
||||
{ value: null, label: '自动(本声线 → 同性别声线 → 模型默认)' },
|
||||
...referenceOptions(genTarget).map((m: any) => ({
|
||||
value: m.id, label: `${m.name || m.kind_label} · v${m.version}`
|
||||
}))
|
||||
]} />
|
||||
</Field>
|
||||
<FilePick accept="audio/*" label="上传参考音色" className={REF_PICK}
|
||||
title="上传后立即可勾选为本次克隆的参考"
|
||||
onFiles={(files) => files.forEach((f) => void uploadReferenceFile(genTarget, f))} />
|
||||
<RecordAudio label="录制参考音色" target="参考音色"
|
||||
defaultName={defaultAssetName(genTarget.assets || [],
|
||||
`${genTarget.name || '声线'}参考音色`, 'reference')}
|
||||
names={existingNames(genTarget.assets)}
|
||||
hint="弹出小面板:对着麦克风念几句话即可当作克隆参考,录完自动转成 WAV"
|
||||
onPick={(file, meta) => void recordReference(genTarget, file, meta)} />
|
||||
{voiceRefBusy && <div className={cn(REF_FULL, REF_STATUS, 'text-dim')}>正在确认这次会用谁的嗓子…</div>}
|
||||
{!voiceRefBusy && voiceRefStatus && (
|
||||
<div className={cn(REF_FULL, REF_STATUS,
|
||||
!voiceRefStatus.ready && REF_BAD,
|
||||
(voiceRefStatus.borrowed || voiceRefStatus.bound_generated) && REF_WARN)}>
|
||||
<b>本次音色:{voiceRefStatus.note}</b>
|
||||
{voiceRefStatus.bound_generated
|
||||
? <small>
|
||||
这条声线现在挂着的是<b>模型生成的试听样本</b>,不是真人录音:可以拿去给镜头配音,
|
||||
但不能反过来当克隆参考,否则第一次生成错了性别,之后每次重试都会继续克隆那个错的嗓子。
|
||||
上传一段{voiceRefStatus.gender_label}真人参考音频就能固定成这个角色自己的音色。
|
||||
</small>
|
||||
: <small>
|
||||
设定性别:{voiceRefStatus.gender_label}。音色由参考音频决定,「性别 / 音色描述」只是标注——
|
||||
要给这个角色一副自己的嗓子,请上传一段同性别参考音频。
|
||||
</small>}
|
||||
</div>
|
||||
)}
|
||||
<small className={REF_HINT}>
|
||||
需要参考音频的模型(如 IndexTTS2)用参考音频做 zero-shot 音色克隆;
|
||||
设定了性别却没有任何同性别参考时,平台会直接拒绝生成,而不是悄悄给你一个陌生人的嗓门。
|
||||
</small>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Button variant="primary" size="sm"
|
||||
disabled={!!busy || !genModels.length || !generationSpec(genTarget)
|
||||
|| (isVoice && (!String(draft.sample_text || '').trim() || !voiceHasReference(genTarget)))}
|
||||
onClick={() => void generate(genTarget)}>
|
||||
{busy ? '处理中…' : (isVoice ? '◉ 生成试听样本' : '▧ 生成母版图像')}
|
||||
</Button>
|
||||
<ErrorText>{error}</ErrorText>
|
||||
|
||||
{/* 注册表不在首屏:所以这里必须解释「为什么模型下拉是空的」,
|
||||
否则用户只会看到一个空下拉,以为平台没接模型。 */}
|
||||
{registryError
|
||||
? <small className={PROVIDER_WARN}>模型注册表读取失败:{registryError}</small>
|
||||
: registryBusy
|
||||
? <small className={PROVIDER_WARN}>正在读取模型注册表…</small>
|
||||
: !genModels.length
|
||||
? <small className={PROVIDER_WARN}>
|
||||
当前没有已启用的真实{isVoice ? '声音' : '图像'}模型(mock 演练通道不出正式素材),请先到{' '}
|
||||
<Link to="/models" className={LINK_CLS}>模型中心</Link> 启用。
|
||||
</small>
|
||||
: null}
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
|
||||
{!!genTarget.assets?.length && (
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { MediaThumb } from '../components/media/MediaThumb'
|
|||
import { WorkflowBar } from '../components/media/WorkflowBar'
|
||||
import {
|
||||
Actions, Button, buttonCls, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field,
|
||||
FieldBlock, FormRow, Grid, LINK_CLS, Loading, LogBox, LogRow, MONO, MUTED, PageHead, Panel,
|
||||
FieldBlock, FormGrid, FormRow, Grid, LINK_CLS, Loading, LogBox, LogRow, MONO, MUTED, PageHead, Panel,
|
||||
PanelHead, ProgressBar, Row, SectionTitle, Stat, StatGrid, Status, TabStack, Table, TableBox,
|
||||
Tag, TagChip, TagGroup, Value, cellRight, cellWrap
|
||||
} from '../components/ui'
|
||||
|
|
@ -337,80 +337,82 @@ export default function Dashboard() {
|
|||
{creating && (
|
||||
<form onSubmit={submit} className="min-w-0">
|
||||
<Panel>
|
||||
<h3 className="mb-3" title="流程第 ① 步:创建视频项目">新建长视频项目</h3>
|
||||
<FormGrid>
|
||||
<h3 className="mb-3" title="流程第 ① 步:创建视频项目">新建长视频项目</h3>
|
||||
|
||||
<FormRow>
|
||||
<Field label="项目名称" required>
|
||||
<input value={form.name} placeholder="例如:星海纪元 · 第一集"
|
||||
onChange={(e) => setForm({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="题材">
|
||||
<input value={form.genre} placeholder="科幻 / 悬疑 / 都市"
|
||||
onChange={(e) => setForm({ genre: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="目标总时长(秒)">
|
||||
<input type="number" min={1} value={form.target_duration} title={durationRule}
|
||||
onChange={(e) => setForm({ target_duration: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="默认转场">
|
||||
<Select value={form.default_transition} options={meta?.options?.transition || []}
|
||||
onChange={(v) => setForm({ default_transition: v })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormRow>
|
||||
<Field label="项目名称" required>
|
||||
<input value={form.name} placeholder="例如:星海纪元 · 第一集"
|
||||
onChange={(e) => setForm({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="题材">
|
||||
<input value={form.genre} placeholder="科幻 / 悬疑 / 都市"
|
||||
onChange={(e) => setForm({ genre: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="目标总时长(秒)">
|
||||
<input type="number" min={1} value={form.target_duration} title={durationRule}
|
||||
onChange={(e) => setForm({ target_duration: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="默认转场">
|
||||
<Select value={form.default_transition} options={meta?.options?.transition || []}
|
||||
onChange={(v) => setForm({ default_transition: v })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
<FormRow>
|
||||
<Field label="默认视频模型">
|
||||
<Select value={videoRef} options={videoOptions} onChange={applyVideoRef}
|
||||
title={`生成模式 ${videoCaps.modes.map((m) => opt('mode', m)).join(' / ') || '未声明'};后续可在项目设置里改`} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select value={form.aspect_ratio} options={meta?.options?.aspect_ratio || []}
|
||||
onChange={(v) => setForm({ aspect_ratio: v })} />
|
||||
</Field>
|
||||
<Field label="分辨率">
|
||||
<Select value={form.resolution} options={resOptions}
|
||||
onChange={(v) => setForm({ resolution: v })} />
|
||||
</Field>
|
||||
<Field label="帧率">
|
||||
<Select value={form.fps} options={fpsOptions}
|
||||
onChange={(v) => setForm({ fps: Number(v) })} />
|
||||
</Field>
|
||||
<Field label="全局负面提示词">
|
||||
<input value={form.global_negative_prompt} placeholder="文字水印,画面抖动,肢体畸变"
|
||||
onChange={(e) => setForm({ global_negative_prompt: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormRow>
|
||||
<Field label="默认视频模型">
|
||||
<Select value={videoRef} options={videoOptions} onChange={applyVideoRef}
|
||||
title={`生成模式 ${videoCaps.modes.map((m) => opt('mode', m)).join(' / ') || '未声明'};后续可在项目设置里改`} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select value={form.aspect_ratio} options={meta?.options?.aspect_ratio || []}
|
||||
onChange={(v) => setForm({ aspect_ratio: v })} />
|
||||
</Field>
|
||||
<Field label="分辨率">
|
||||
<Select value={form.resolution} options={resOptions}
|
||||
onChange={(v) => setForm({ resolution: v })} />
|
||||
</Field>
|
||||
<Field label="帧率">
|
||||
<Select value={form.fps} options={fpsOptions}
|
||||
onChange={(v) => setForm({ fps: Number(v) })} />
|
||||
</Field>
|
||||
<Field label="全局负面提示词">
|
||||
<input value={form.global_negative_prompt} placeholder="文字水印,画面抖动,肢体畸变"
|
||||
onChange={(e) => setForm({ global_negative_prompt: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
<FormRow cols={2}>
|
||||
<FieldBlock label="项目简介">
|
||||
<textarea rows={2} value={form.description}
|
||||
onChange={(e) => setForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="全局风格指南(拼接到每个镜头提示词)">
|
||||
<textarea rows={2} value={form.style_guide} placeholder="赛博朋克国风,冷色调,电影质感"
|
||||
onChange={(e) => setForm({ style_guide: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</FormRow>
|
||||
<FormRow cols={2}>
|
||||
<FieldBlock label="项目简介">
|
||||
<textarea rows={2} value={form.description}
|
||||
onChange={(e) => setForm({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="全局风格指南(拼接到每个镜头提示词)">
|
||||
<textarea rows={2} value={form.style_guide} placeholder="赛博朋克国风,冷色调,电影质感"
|
||||
onChange={(e) => setForm({ style_guide: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</FormRow>
|
||||
|
||||
<LibraryPicker open={libOpen} type={libType} onType={pickType}
|
||||
query={libQuery} onQuery={setLibQuery} rows={libShown}
|
||||
loading={libLoading} error={libError} picked={picked}
|
||||
pickedByType={pickedByType}
|
||||
onToggle={toggleLibrary} onPick={togglePick}
|
||||
onRefresh={() => void loadLibrary(libType, true)} />
|
||||
<LibraryPicker open={libOpen} type={libType} onType={pickType}
|
||||
query={libQuery} onQuery={setLibQuery} rows={libShown}
|
||||
loading={libLoading} error={libError} picked={picked}
|
||||
pickedByType={pickedByType}
|
||||
onToggle={toggleLibrary} onPick={togglePick}
|
||||
onRefresh={() => void loadLibrary(libType, true)} />
|
||||
|
||||
<TagGroup>
|
||||
<Tag>可用档位 {videoCaps.resolutions.join(' / ') || '未声明'}</Tag>
|
||||
<Tag>帧率 {videoCaps.fps || '未声明'}fps</Tag>
|
||||
<Tag>单镜 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒</Tag>
|
||||
<Tag>参考图上限 {videoCaps.maxReferenceImages || '未声明'}</Tag>
|
||||
</TagGroup>
|
||||
{modelWarnings.map((w, i) => <ErrorText key={`w${i}`} className="mb-1">{w}</ErrorText>)}
|
||||
<TagGroup>
|
||||
<Tag>可用档位 {videoCaps.resolutions.join(' / ') || '未声明'}</Tag>
|
||||
<Tag>帧率 {videoCaps.fps || '未声明'}fps</Tag>
|
||||
<Tag>单镜 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒</Tag>
|
||||
<Tag>参考图上限 {videoCaps.maxReferenceImages || '未声明'}</Tag>
|
||||
</TagGroup>
|
||||
{modelWarnings.map((w, i) => <ErrorText key={`w${i}`} className="mb-1">{w}</ErrorText>)}
|
||||
|
||||
<Actions>
|
||||
<Button variant="primary" type="submit">创建并进入项目</Button>
|
||||
<Button variant="outline" type="button" onClick={() => setCreating(false)}>取消</Button>
|
||||
</Actions>
|
||||
<Actions>
|
||||
<Button variant="primary" type="submit">创建并进入项目</Button>
|
||||
<Button variant="outline" type="button" onClick={() => setCreating(false)}>取消</Button>
|
||||
</Actions>
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
</form>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { useAutoRefresh } from '../hooks'
|
|||
import { cn } from '../lib/cn'
|
||||
import { EyeIcon, SecretInput, Select } from '../components/forms'
|
||||
import {
|
||||
Between, Button, Check, Chip, ChipBar, Ctlbar, Drawer, Empty, Field, FieldBlock, FormRow, Grid, MONO,
|
||||
Between, Button, Check, Chip, ChipBar, Ctlbar, Drawer, Empty, Field, FieldBlock, FormGrid, FormRow, Grid, MONO,
|
||||
MUTED, Notice, PageHead, Panel, PanelHead, Row, SectionTitle, Slider, Spinner, Tag, TagGroup, buttonCls
|
||||
} from '../components/ui'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
|
|
@ -659,215 +659,219 @@ export default function ModelCenter() {
|
|||
{busy && <span className={cn('inline-flex items-center gap-1.5', MUTED)}><Spinner /> {busy}…</span>}
|
||||
</>}>
|
||||
<form id={FORM_ID} className="min-w-0" onSubmit={(e) => { e.preventDefault(); void save() }}>
|
||||
{form.media_type === 'llm' && (
|
||||
<>
|
||||
<DrawerSection first title="供应商连接" note="OpenAI 兼容协议">
|
||||
<FieldBlock label="Base URL" required>
|
||||
<input value={form.base_url} placeholder="https://coding.dashscope.aliyuncs.com/v1"
|
||||
<FormGrid>
|
||||
{form.media_type === 'llm' && (
|
||||
<>
|
||||
<DrawerSection first title="供应商连接" note="OpenAI 兼容协议">
|
||||
<FieldBlock label="Base URL" required>
|
||||
<input value={form.base_url} placeholder="https://coding.dashscope.aliyuncs.com/v1"
|
||||
onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="API Key">
|
||||
<SecretInput title="列表只回显掩码;点右侧图标会向后端取一次真实密钥并显示(仅管理员,留痕)。"
|
||||
value={form.api_key} onChange={(v) => patch({ api_key: v })} hasSaved={editingHasKey}
|
||||
revealUrl={editingId ? `/api/providers/${editingId}/api-key` : ''}
|
||||
placeholder={editingId ? '留空保持原密钥;填写即覆盖' : 'sk-…'}
|
||||
autocomplete="new-password" />
|
||||
</FieldBlock>
|
||||
{editingId !== null && form.api_key === '' && (
|
||||
<Check checked={form.clear_api_key} onChange={(v) => patch({ clear_api_key: v })} className="mb-2">
|
||||
清除已保存的 API Key
|
||||
</Check>
|
||||
)}
|
||||
</DrawerSection>
|
||||
|
||||
<DrawerSection title="生成参数" note="与常见大模型控制台一致">
|
||||
{/* 旧站每个页面各写一套 height:5px + accent-color 的滑杆,值只在标题里;
|
||||
换成共享 Slider 后拖动时当前值一直可见,刻度尺那行小字随之取消 */}
|
||||
{/* 以前这里自带一套 grid + p-2,标题比同抽屉别处低 8px;
|
||||
并进表单栅格后滑杆和输入框共用同一套列边界 */}
|
||||
<FormRow cols={2}>
|
||||
<Slider label="Temperature" value={numOf(form.temperature)} min={0} max={2} step={0.1}
|
||||
format={(v) => v.toFixed(1)} onChange={(v) => patch({ temperature: v })} />
|
||||
<Slider label="Top P" value={numOf(form.top_p)} min={0} max={1} step={0.01}
|
||||
format={(v) => v.toFixed(2)} onChange={(v) => patch({ top_p: v })} />
|
||||
</FormRow>
|
||||
<ChipBar label="Max Tokens" className="mt-3">
|
||||
{TOKEN_OPTIONS.map((n) => (
|
||||
<Chip key={n} active={Number(form.max_tokens) === n} onClick={() => patch({ max_tokens: n })}>
|
||||
{n / 1024}K
|
||||
</Chip>
|
||||
))}
|
||||
</ChipBar>
|
||||
</DrawerSection>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(form.media_type === 'video' || form.media_type === 'image') && (
|
||||
<DrawerSection first
|
||||
title={form.media_type === 'video' ? 'ComfyUI 视频工作流' : 'Qwen-Image 本地工作流'}
|
||||
note="9200 单卡">
|
||||
<FieldBlock label="ComfyUI Base URL">
|
||||
<input value={form.base_url} placeholder="http://10.100.53.199:9200"
|
||||
onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="API Key">
|
||||
<SecretInput title="列表只回显掩码;点右侧图标会向后端取一次真实密钥并显示(仅管理员,留痕)。"
|
||||
value={form.api_key} onChange={(v) => patch({ api_key: v })} hasSaved={editingHasKey}
|
||||
revealUrl={editingId ? `/api/providers/${editingId}/api-key` : ''}
|
||||
placeholder={editingId ? '留空保持原密钥;填写即覆盖' : 'sk-…'}
|
||||
autocomplete="new-password" />
|
||||
</FieldBlock>
|
||||
{editingId !== null && form.api_key === '' && (
|
||||
<Check checked={form.clear_api_key} onChange={(v) => patch({ clear_api_key: v })} className="mb-2">
|
||||
清除已保存的 API Key
|
||||
</Check>
|
||||
)}
|
||||
</DrawerSection>
|
||||
|
||||
<DrawerSection title="生成参数" note="与常见大模型控制台一致">
|
||||
{/* 旧站每个页面各写一套 height:5px + accent-color 的滑杆,值只在标题里;
|
||||
换成共享 Slider 后拖动时当前值一直可见,刻度尺那行小字随之取消 */}
|
||||
<div className="grid gap-x-6 gap-y-3 p-2 items-center grid-cols-2 max-short:grid-cols-1">
|
||||
<Slider label="Temperature" value={numOf(form.temperature)} min={0} max={2} step={0.1}
|
||||
format={(v) => v.toFixed(1)} onChange={(v) => patch({ temperature: v })} />
|
||||
<Slider label="Top P" value={numOf(form.top_p)} min={0} max={1} step={0.01}
|
||||
format={(v) => v.toFixed(2)} onChange={(v) => patch({ top_p: v })} />
|
||||
</div>
|
||||
<ChipBar label="Max Tokens" className="mt-3">
|
||||
{TOKEN_OPTIONS.map((n) => (
|
||||
<Chip key={n} active={Number(form.max_tokens) === n} onClick={() => patch({ max_tokens: n })}>
|
||||
{n / 1024}K
|
||||
</Chip>
|
||||
))}
|
||||
</ChipBar>
|
||||
</DrawerSection>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(form.media_type === 'video' || form.media_type === 'image') && (
|
||||
<DrawerSection first
|
||||
title={form.media_type === 'video' ? 'ComfyUI 视频工作流' : 'Qwen-Image 本地工作流'}
|
||||
note="9200 单卡">
|
||||
<FieldBlock label="ComfyUI Base URL">
|
||||
<input value={form.base_url} placeholder="http://10.100.53.199:9200"
|
||||
onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={2} stack>
|
||||
<Field label={form.media_type === 'video' ? '扩散模型(UNET GGUF)' : 'GGUF 扩散模型'}>
|
||||
<input value={form.unet} onChange={(e) => patch({ unet: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="文本编码器">
|
||||
<input value={form.clip} onChange={(e) => patch({ clip: e.target.value })} />
|
||||
</Field>
|
||||
<Field label={form.media_type === 'video' ? '视频 VAE' : '图像 VAE'}>
|
||||
<input value={form.vae} onChange={(e) => patch({ vae: e.target.value })} />
|
||||
</Field>
|
||||
{form.media_type === 'video' && (
|
||||
<Field label="音频 VAE">
|
||||
<input value={form.audio_vae} onChange={(e) => patch({ audio_vae: e.target.value })} />
|
||||
<FormRow cols={2} stack>
|
||||
<Field label={form.media_type === 'video' ? '扩散模型(UNET GGUF)' : 'GGUF 扩散模型'}>
|
||||
<input value={form.unet} onChange={(e) => patch({ unet: e.target.value })} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="CLIP 类型">
|
||||
<input value={form.clip_type} onChange={(e) => patch({ clip_type: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="工作流模板">
|
||||
<input value={form.workflow} onChange={(e) => patch({ workflow: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="采样器">
|
||||
<input value={form.sampler} onChange={(e) => patch({ sampler: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="步数">
|
||||
<input type="number" min={1} value={form.steps}
|
||||
onChange={(e) => patch({ steps: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="文本编码器">
|
||||
<input value={form.clip} onChange={(e) => patch({ clip: e.target.value })} />
|
||||
</Field>
|
||||
<Field label={form.media_type === 'video' ? '视频 VAE' : '图像 VAE'}>
|
||||
<input value={form.vae} onChange={(e) => patch({ vae: e.target.value })} />
|
||||
</Field>
|
||||
{form.media_type === 'video' && (
|
||||
<Field label="音频 VAE">
|
||||
<input value={form.audio_vae} onChange={(e) => patch({ audio_vae: e.target.value })} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="CLIP 类型">
|
||||
<input value={form.clip_type} onChange={(e) => patch({ clip_type: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="工作流模板">
|
||||
<input value={form.workflow} onChange={(e) => patch({ workflow: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="采样器">
|
||||
<input value={form.sampler} onChange={(e) => patch({ sampler: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="步数">
|
||||
<input type="number" min={1} value={form.steps}
|
||||
onChange={(e) => patch({ steps: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
{form.media_type === 'image' && (
|
||||
<Field label="CFG">
|
||||
<input type="number" step={0.1} value={form.cfg}
|
||||
onChange={(e) => patch({ cfg: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="FPS">
|
||||
<input type="number" min={1} value={form.fps}
|
||||
onChange={(e) => patch({ fps: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
{form.media_type === 'image' && (
|
||||
<Field label="CFG">
|
||||
<input type="number" step={0.1} value={form.cfg}
|
||||
onChange={(e) => patch({ cfg: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<FieldBlock label="固定 Sigma 序列">
|
||||
<textarea rows={2} className={MONO} value={form.sigmas}
|
||||
onChange={(e) => patch({ sigmas: e.target.value })} />
|
||||
</FieldBlock>
|
||||
)}
|
||||
<Field label="FPS">
|
||||
<input type="number" min={1} value={form.fps}
|
||||
onChange={(e) => patch({ fps: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
{form.media_type === 'image' && (
|
||||
<FieldBlock label="固定 Sigma 序列">
|
||||
<textarea rows={2} className={MONO} value={form.sigmas}
|
||||
onChange={(e) => patch({ sigmas: e.target.value })} />
|
||||
</FieldBlock>
|
||||
)}
|
||||
</DrawerSection>
|
||||
)}
|
||||
|
||||
{form.media_type === 'tts' && (
|
||||
<DrawerSection first title="IndexTTS2 本地推理" note="Zero-shot 音色克隆">
|
||||
<FieldBlock label="ComfyUI Base URL">
|
||||
<input value={form.base_url} placeholder="http://10.100.53.199:9200"
|
||||
onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={2} stack>
|
||||
<Field label="模型目录标识">
|
||||
<input value={form.tts_model} onChange={(e) => patch({ tts_model: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="模型来源">
|
||||
<Select value={form.download_from} onChange={(v) => patch({ download_from: v })}
|
||||
options={[{ value: 'modelscope', label: 'ModelScope' },
|
||||
{ value: 'huggingface', label: 'HuggingFace' },
|
||||
{ value: 'local', label: '仅本地' }]} />
|
||||
</Field>
|
||||
<Field label="工作流模板">
|
||||
<input value={form.workflow} onChange={(e) => patch({ workflow: e.target.value })} />
|
||||
</Field>
|
||||
<Field title="声线资产中的「供应商音色 ID」可填 ComfyUI input 文件名,或客户端本地音频路径;平台会自动上传本地参考音频。"
|
||||
label="参考音频">
|
||||
<input value={form.reference_audio} onChange={(e) => patch({ reference_audio: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</DrawerSection>
|
||||
)}
|
||||
|
||||
{!['llm', 'video', 'image', 'tts'].includes(form.media_type) && (
|
||||
<DrawerSection first title="旧版文本接口" note="兼容保留">
|
||||
<FieldBlock label="Base URL">
|
||||
<input value={form.base_url} onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="自定义端点">
|
||||
<input value={form.endpoint} placeholder="可留空,默认 /chat/completions"
|
||||
onChange={(e) => patch({ endpoint: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</DrawerSection>
|
||||
)}
|
||||
|
||||
<DrawerSection title="模型身份与调度" note="所有能力通用,仅在此处填写一次">
|
||||
<FormRow cols={3} stack>
|
||||
<Field label="显示名称" required>
|
||||
<input value={form.display_name} onChange={(e) => patch({ display_name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="供应商标识">
|
||||
<input value={form.provider} onChange={(e) => patch({ provider: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="适配器">
|
||||
{/* 能力由左栏决定,抽屉里不切换媒体类型,所以适配器下拉只需要给出本能力的候选 */}
|
||||
<Select value={form.adapter} onChange={(v) => patch({ adapter: v })}
|
||||
options={adapters[form.media_type] || []} />
|
||||
</Field>
|
||||
<Field label="模型标识" required>
|
||||
<input value={form.model} onChange={(e) => patch({ model: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="模型编码" required>
|
||||
<input value={form.model_code} onChange={(e) => patch({ model_code: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="超时(秒)">
|
||||
<input type="number" min={1} value={form.timeout_seconds}
|
||||
onChange={(e) => patch({ timeout_seconds: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormRow cols={4} stack tight>
|
||||
<Field label="并发">
|
||||
<input type="number" min={1} value={form.max_concurrency}
|
||||
onChange={(e) => patch({ max_concurrency: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="RPM">
|
||||
<input type="number" min={1} value={form.requests_per_minute}
|
||||
onChange={(e) => patch({ requests_per_minute: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
{form.media_type !== 'llm' && form.media_type !== 'image' && (
|
||||
<>
|
||||
<Field label="最短时长">
|
||||
<input type="number" step={0.5} value={form.min_duration}
|
||||
onChange={(e) => patch({ min_duration: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="最长时长">
|
||||
<input type="number" step={0.5} value={form.max_duration}
|
||||
onChange={(e) => patch({ max_duration: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
</FormRow>
|
||||
<Row className="gap-5 mt-3 mb-[5px]">
|
||||
<Check checked={form.enabled} onChange={(v) => patch({ enabled: v })}>启用模型</Check>
|
||||
<Check checked={form.is_default} onChange={(v) => patch({ is_default: v })}>设为该能力默认</Check>
|
||||
</Row>
|
||||
<FieldBlock label="备注">
|
||||
<textarea rows={2} placeholder="模型约束、显存策略或接入说明" value={form.notes}
|
||||
onChange={(e) => patch({ notes: e.target.value })} />
|
||||
</FieldBlock>
|
||||
|
||||
<Button variant="outline" onClick={toggleAdvanced}
|
||||
className="w-full mt-[18px] h-(--ctl-h-md) border-dashed text-tiny">
|
||||
{showAdvanced ? '收起高级 JSON' : '展开高级 JSON / 原始适配器参数'}
|
||||
</Button>
|
||||
{showAdvanced && (
|
||||
/* 两块的比例是本页特有的(config 比 default_params 长得多),栅格本身仍是栅格 */
|
||||
<div className="grid gap-[10px] grid-cols-[1.3fr_1fr] max-short:grid-cols-1 mt-3 min-w-0 [&>*]:min-w-0">
|
||||
<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>
|
||||
</DrawerSection>
|
||||
)}
|
||||
</DrawerSection>
|
||||
|
||||
{form.media_type === 'tts' && (
|
||||
<DrawerSection first title="IndexTTS2 本地推理" note="Zero-shot 音色克隆">
|
||||
<FieldBlock label="ComfyUI Base URL">
|
||||
<input value={form.base_url} placeholder="http://10.100.53.199:9200"
|
||||
onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={2} stack>
|
||||
<Field label="模型目录标识">
|
||||
<input value={form.tts_model} onChange={(e) => patch({ tts_model: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="模型来源">
|
||||
<Select value={form.download_from} onChange={(v) => patch({ download_from: v })}
|
||||
options={[{ value: 'modelscope', label: 'ModelScope' },
|
||||
{ value: 'huggingface', label: 'HuggingFace' },
|
||||
{ value: 'local', label: '仅本地' }]} />
|
||||
</Field>
|
||||
<Field label="工作流模板">
|
||||
<input value={form.workflow} onChange={(e) => patch({ workflow: e.target.value })} />
|
||||
</Field>
|
||||
<Field title="声线资产中的「供应商音色 ID」可填 ComfyUI input 文件名,或客户端本地音频路径;平台会自动上传本地参考音频。"
|
||||
label="参考音频">
|
||||
<input value={form.reference_audio} onChange={(e) => patch({ reference_audio: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</DrawerSection>
|
||||
)}
|
||||
|
||||
{!['llm', 'video', 'image', 'tts'].includes(form.media_type) && (
|
||||
<DrawerSection first title="旧版文本接口" note="兼容保留">
|
||||
<FieldBlock label="Base URL">
|
||||
<input value={form.base_url} onChange={(e) => patch({ base_url: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="自定义端点">
|
||||
<input value={form.endpoint} placeholder="可留空,默认 /chat/completions"
|
||||
onChange={(e) => patch({ endpoint: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</DrawerSection>
|
||||
)}
|
||||
|
||||
<DrawerSection title="模型身份与调度" note="所有能力通用,仅在此处填写一次">
|
||||
<FormRow cols={3} stack>
|
||||
<Field label="显示名称" required>
|
||||
<input value={form.display_name} onChange={(e) => patch({ display_name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="供应商标识">
|
||||
<input value={form.provider} onChange={(e) => patch({ provider: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="适配器">
|
||||
{/* 能力由左栏决定,抽屉里不切换媒体类型,所以适配器下拉只需要给出本能力的候选 */}
|
||||
<Select value={form.adapter} onChange={(v) => patch({ adapter: v })}
|
||||
options={adapters[form.media_type] || []} />
|
||||
</Field>
|
||||
<Field label="模型标识" required>
|
||||
<input value={form.model} onChange={(e) => patch({ model: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="模型编码" required>
|
||||
<input value={form.model_code} onChange={(e) => patch({ model_code: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="超时(秒)">
|
||||
<input type="number" min={1} value={form.timeout_seconds}
|
||||
onChange={(e) => patch({ timeout_seconds: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FormRow cols={4} stack tight>
|
||||
<Field label="并发">
|
||||
<input type="number" min={1} value={form.max_concurrency}
|
||||
onChange={(e) => patch({ max_concurrency: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="RPM">
|
||||
<input type="number" min={1} value={form.requests_per_minute}
|
||||
onChange={(e) => patch({ requests_per_minute: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
{form.media_type !== 'llm' && form.media_type !== 'image' && (
|
||||
<>
|
||||
<Field label="最短时长">
|
||||
<input type="number" step={0.5} value={form.min_duration}
|
||||
onChange={(e) => patch({ min_duration: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="最长时长">
|
||||
<input type="number" step={0.5} value={form.max_duration}
|
||||
onChange={(e) => patch({ max_duration: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
</FormRow>
|
||||
<Row className="gap-5 mt-3 mb-[5px]">
|
||||
<Check checked={form.enabled} onChange={(v) => patch({ enabled: v })}>启用模型</Check>
|
||||
<Check checked={form.is_default} onChange={(v) => patch({ is_default: v })}>设为该能力默认</Check>
|
||||
</Row>
|
||||
<FieldBlock label="备注">
|
||||
<textarea rows={2} placeholder="模型约束、显存策略或接入说明" value={form.notes}
|
||||
onChange={(e) => patch({ notes: e.target.value })} />
|
||||
</FieldBlock>
|
||||
|
||||
<Button variant="outline" onClick={toggleAdvanced}
|
||||
className="w-full mt-[18px] h-(--ctl-h-md) border-dashed text-tiny">
|
||||
{showAdvanced ? '收起高级 JSON' : '展开高级 JSON / 原始适配器参数'}
|
||||
</Button>
|
||||
{showAdvanced && (
|
||||
/* 两块的比例是本页特有的(config 比 default_params 长得多),栅格本身仍是栅格 */
|
||||
<div className="grid gap-[10px] grid-cols-[1.3fr_1fr] max-short:grid-cols-1 mt-3 min-w-0 [&>*]:min-w-0">
|
||||
<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>
|
||||
)}
|
||||
</DrawerSection>
|
||||
</FormGrid>
|
||||
</form>
|
||||
</Drawer>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import { MediaThumb } from '../../components/media/MediaThumb'
|
|||
import { RecordAudio, type RecordPickMeta } from '../../components/media/RecordAudio'
|
||||
import {
|
||||
Actions, BarRight, Between, buttonCls, Button, CARD_ROW, Check, Chip, ChipBar, Ctlbar, Divider, Drawer,
|
||||
Empty, ErrorText, Field, FieldBlock, FilePick, FormRow, LineHint, LINK_CLS, MONO, MUTED, MUTED_MONO, Panel,
|
||||
Empty, ErrorText, Field, FieldBlock, FilePick, FormGrid, FormRow, LineHint, LINK_CLS, MONO, MUTED, MUTED_MONO, Panel,
|
||||
PanelHead,
|
||||
Row, SectionTitle, Spinner, TabStack, Table, TableBox, Tag, TagGroup, TEXTAREA_TALL, cellRight, cellWrap
|
||||
} from '../../components/ui'
|
||||
|
|
@ -1076,33 +1076,35 @@ export default function Library() {
|
|||
<span className="ml-auto" />
|
||||
<Button variant="outline" onClick={closeForm}>取消</Button>
|
||||
</>}>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={char.name} placeholder="例如:林澈" onChange={(e) => patchChar({ name: e.target.value })} /></Field>
|
||||
<Field label="代号"><input value={char.code} placeholder="linche" onChange={(e) => patchChar({ code: e.target.value })} /></Field>
|
||||
<Field label="定位">
|
||||
<Select value={char.role} onChange={(v) => patchChar({ role: String(v) })} options={ROLE_OPTIONS} />
|
||||
</Field>
|
||||
<Field label="造型版本"><input value={char.style_version} onChange={(e) => patchChar({ style_version: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="外观描述(定妆图 + 镜头提示词)">
|
||||
<textarea rows={2} value={char.appearance} placeholder="黑色短发,深蓝战术服,左眼下方有疤——只写看得见的特征,气质/妆容类抽象词不会进入视频提示词"
|
||||
onChange={(e) => patchChar({ appearance: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="性格设定">
|
||||
<textarea rows={2} value={char.personality} onChange={(e) => patchChar({ personality: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词(仅用于生成定妆图/关键帧)">
|
||||
<textarea rows={2} value={char.persona_prompt} placeholder="同一张脸,五官比例保持一致——音画一体模型会把这段话当台词念出来,已不再注入镜头提示词"
|
||||
onChange={(e) => patchChar({ persona_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="声音描述"><input value={char.voice_profile} placeholder="低沉、克制的青年男声" onChange={(e) => patchChar({ voice_profile: e.target.value })} /></Field>
|
||||
<Field label="默认声线">
|
||||
<Select value={char.default_voice_id} onChange={(v) => patchChar({ default_voice_id: v === null ? null : Number(v) })}
|
||||
options={[{ value: null, label: '不绑定' }, ...voices.map((v) => ({ value: v.id, label: `${v.name} · ${v.provider}` }))]} />
|
||||
</Field>
|
||||
<Field label="标签(逗号分隔)"><input value={char.tags} placeholder="人类, 一号角色" onChange={(e) => patchChar({ tags: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={char.name} placeholder="例如:林澈" onChange={(e) => patchChar({ name: e.target.value })} /></Field>
|
||||
<Field label="代号"><input value={char.code} placeholder="linche" onChange={(e) => patchChar({ code: e.target.value })} /></Field>
|
||||
<Field label="定位">
|
||||
<Select value={char.role} onChange={(v) => patchChar({ role: String(v) })} options={ROLE_OPTIONS} />
|
||||
</Field>
|
||||
<Field label="造型版本"><input value={char.style_version} onChange={(e) => patchChar({ style_version: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="外观描述(定妆图 + 镜头提示词)">
|
||||
<textarea rows={2} value={char.appearance} placeholder="黑色短发,深蓝战术服,左眼下方有疤——只写看得见的特征,气质/妆容类抽象词不会进入视频提示词"
|
||||
onChange={(e) => patchChar({ appearance: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="性格设定">
|
||||
<textarea rows={2} value={char.personality} onChange={(e) => patchChar({ personality: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="一致性提示词(仅用于生成定妆图/关键帧)">
|
||||
<textarea rows={2} value={char.persona_prompt} placeholder="同一张脸,五官比例保持一致——音画一体模型会把这段话当台词念出来,已不再注入镜头提示词"
|
||||
onChange={(e) => patchChar({ persona_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="声音描述"><input value={char.voice_profile} placeholder="低沉、克制的青年男声" onChange={(e) => patchChar({ voice_profile: e.target.value })} /></Field>
|
||||
<Field label="默认声线">
|
||||
<Select value={char.default_voice_id} onChange={(v) => patchChar({ default_voice_id: v === null ? null : Number(v) })}
|
||||
options={[{ value: null, label: '不绑定' }, ...voices.map((v) => ({ value: v.id, label: `${v.name} · ${v.provider}` }))]} />
|
||||
</Field>
|
||||
<Field label="标签(逗号分隔)"><input value={char.tags} placeholder="人类, 一号角色" onChange={(e) => patchChar({ tags: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
</FormGrid>
|
||||
</Drawer>
|
||||
|
||||
{/* ===== 编辑抽屉:场景 ===== */}
|
||||
|
|
@ -1114,24 +1116,26 @@ export default function Library() {
|
|||
<span className="ml-auto" />
|
||||
<Button variant="outline" onClick={closeForm}>取消</Button>
|
||||
</>}>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={scene.name} placeholder="例如:雨夜巷口" onChange={(e) => patchScene({ name: e.target.value })} /></Field>
|
||||
<Field label="代号"><input value={scene.code} placeholder="alley-rain" onChange={(e) => patchScene({ code: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="场景描述">
|
||||
<textarea rows={2} value={scene.description} onChange={(e) => patchScene({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="提示词">
|
||||
<textarea rows={2} value={scene.prompt} onChange={(e) => patchScene({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={3}>
|
||||
<Field label="光线"><input value={scene.lighting} onChange={(e) => patchScene({ lighting: e.target.value })} /></Field>
|
||||
<Field label="时间"><input value={scene.time_of_day} onChange={(e) => patchScene({ time_of_day: e.target.value })} /></Field>
|
||||
<Field label="色调"><input value={scene.palette} onChange={(e) => patchScene({ palette: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="标签(逗号分隔)">
|
||||
<input value={scene.tags} onChange={(e) => patchScene({ tags: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={scene.name} placeholder="例如:雨夜巷口" onChange={(e) => patchScene({ name: e.target.value })} /></Field>
|
||||
<Field label="代号"><input value={scene.code} placeholder="alley-rain" onChange={(e) => patchScene({ code: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="场景描述">
|
||||
<textarea rows={2} value={scene.description} onChange={(e) => patchScene({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="提示词">
|
||||
<textarea rows={2} value={scene.prompt} onChange={(e) => patchScene({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={3}>
|
||||
<Field label="光线"><input value={scene.lighting} onChange={(e) => patchScene({ lighting: e.target.value })} /></Field>
|
||||
<Field label="时间"><input value={scene.time_of_day} onChange={(e) => patchScene({ time_of_day: e.target.value })} /></Field>
|
||||
<Field label="色调"><input value={scene.palette} onChange={(e) => patchScene({ palette: e.target.value })} /></Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="标签(逗号分隔)">
|
||||
<input value={scene.tags} onChange={(e) => patchScene({ tags: e.target.value })} />
|
||||
</FieldBlock>
|
||||
</FormGrid>
|
||||
</Drawer>
|
||||
|
||||
{/* ===== 编辑抽屉:声线 ===== */}
|
||||
|
|
@ -1143,48 +1147,50 @@ export default function Library() {
|
|||
<span className="ml-auto" />
|
||||
<Button variant="outline" onClick={closeForm}>取消</Button>
|
||||
</>}>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={voice.name} placeholder="例如:低沉男声" onChange={(e) => patchVoice({ name: e.target.value })} /></Field>
|
||||
<Field label="Provider"><input value={voice.provider} placeholder="从下方选择真实模型" onChange={(e) => patchVoice({ provider: e.target.value })} /></Field>
|
||||
{voice.provider === 'macos-say'
|
||||
? <Field label="macOS 系统声音">
|
||||
<Select value={voice.provider_voice_id} onChange={(v) => patchVoice({ provider_voice_id: String(v) })} options={sayVoiceOptions} />
|
||||
<FormGrid>
|
||||
<FormRow>
|
||||
<Field label="名称" required><input value={voice.name} placeholder="例如:低沉男声" onChange={(e) => patchVoice({ name: e.target.value })} /></Field>
|
||||
<Field label="Provider"><input value={voice.provider} placeholder="从下方选择真实模型" onChange={(e) => patchVoice({ provider: e.target.value })} /></Field>
|
||||
{voice.provider === 'macos-say'
|
||||
? <Field label="macOS 系统声音">
|
||||
<Select value={voice.provider_voice_id} onChange={(v) => patchVoice({ provider_voice_id: String(v) })} options={sayVoiceOptions} />
|
||||
</Field>
|
||||
: <Field label="Provider voice_id"><input value={voice.provider_voice_id} placeholder="填写供应商 voice_id" onChange={(e) => patchVoice({ provider_voice_id: e.target.value })} /></Field>}
|
||||
<Field label="语言"><input value={voice.language} onChange={(e) => patchVoice({ language: e.target.value })} /></Field>
|
||||
<Field label="性别">
|
||||
<Select value={voice.gender} onChange={(v) => patchVoice({ gender: String(v) })} options={GENDER_OPTIONS} />
|
||||
</Field>
|
||||
: <Field label="Provider voice_id"><input value={voice.provider_voice_id} placeholder="填写供应商 voice_id" onChange={(e) => patchVoice({ provider_voice_id: e.target.value })} /></Field>}
|
||||
<Field label="语言"><input value={voice.language} onChange={(e) => patchVoice({ language: e.target.value })} /></Field>
|
||||
<Field label="性别">
|
||||
<Select value={voice.gender} onChange={(v) => patchVoice({ gender: String(v) })} options={GENDER_OPTIONS} />
|
||||
</Field>
|
||||
<Field label="版本"><input value={voice.version} onChange={(e) => patchVoice({ version: e.target.value })} /></Field>
|
||||
<Field label="语速">
|
||||
<input type="number" min={0.5} max={2} step={0.05} value={voiceSpeed}
|
||||
onChange={(e) => setVoiceSpeed(numOf(e.target.value))} />
|
||||
</Field>
|
||||
{voice.provider === 'macos-say' && (
|
||||
<Field label="声音效果">
|
||||
<Select value={voiceEffect} onChange={(v) => setVoiceEffect(String(v))} options={EFFECT_OPTIONS} placeholder="真实人声" />
|
||||
<Field label="版本"><input value={voice.version} onChange={(e) => patchVoice({ version: e.target.value })} /></Field>
|
||||
<Field label="语速">
|
||||
<input type="number" min={0.5} max={2} step={0.05} value={voiceSpeed}
|
||||
onChange={(e) => setVoiceSpeed(numOf(e.target.value))} />
|
||||
</Field>
|
||||
)}
|
||||
</FormRow>
|
||||
<FieldBlock label="音色描述">
|
||||
<textarea rows={2} value={voice.description} onChange={(e) => patchVoice({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<Check checked={!!voice.is_default} onChange={(v) => patchVoice({ is_default: v })}>设为项目默认声线</Check>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0" title="候选来自模型管理中心登记的 TTS 模型">可用声音模型</SectionTitle>
|
||||
<ChipBar>
|
||||
{ttsProviders.map((p) => (
|
||||
<Chip key={p.id} active={p.provider === voice.provider} onClick={() => chooseTts(p)}>{p.display_name || p.model}</Chip>
|
||||
))}
|
||||
{!ttsProviders.length && <span className={MUTED}>未登记可用 TTS 模型</span>}
|
||||
</ChipBar>
|
||||
{voice.provider === 'macos-say' && (
|
||||
<ChipBar top>
|
||||
{SAY_VOICES.map((v) => (
|
||||
<Chip key={v.value} active={voice.provider_voice_id === v.value} onClick={() => patchVoice({ provider_voice_id: v.value })}>{v.label}</Chip>
|
||||
{voice.provider === 'macos-say' && (
|
||||
<Field label="声音效果">
|
||||
<Select value={voiceEffect} onChange={(v) => setVoiceEffect(String(v))} options={EFFECT_OPTIONS} placeholder="真实人声" />
|
||||
</Field>
|
||||
)}
|
||||
</FormRow>
|
||||
<FieldBlock label="音色描述">
|
||||
<textarea rows={2} value={voice.description} onChange={(e) => patchVoice({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<Check checked={!!voice.is_default} onChange={(v) => patchVoice({ is_default: v })}>设为项目默认声线</Check>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0" title="候选来自模型管理中心登记的 TTS 模型">可用声音模型</SectionTitle>
|
||||
<ChipBar>
|
||||
{ttsProviders.map((p) => (
|
||||
<Chip key={p.id} active={p.provider === voice.provider} onClick={() => chooseTts(p)}>{p.display_name || p.model}</Chip>
|
||||
))}
|
||||
{!ttsProviders.length && <span className={MUTED}>未登记可用 TTS 模型</span>}
|
||||
</ChipBar>
|
||||
)}
|
||||
{voice.provider === 'macos-say' && (
|
||||
<ChipBar top>
|
||||
{SAY_VOICES.map((v) => (
|
||||
<Chip key={v.value} active={voice.provider_voice_id === v.value} onClick={() => patchVoice({ provider_voice_id: v.value })}>{v.label}</Chip>
|
||||
))}
|
||||
</ChipBar>
|
||||
)}
|
||||
</FormGrid>
|
||||
</Drawer>
|
||||
|
||||
{/* ===== LB-1:AI 生成台(全页共用一个右侧抽屉,卡片里只留一个入口) =====
|
||||
|
|
@ -1210,117 +1216,119 @@ export default function Library() {
|
|||
<span className="ml-auto" />
|
||||
<Button variant="outline" onClick={closeGen}>取消</Button>
|
||||
</>}>
|
||||
{/* 正文走纵向 12px 节奏;提示词都是长句,textarea 给足高度并允许手工拉长 */}
|
||||
<div className={cn('flex flex-col gap-3', TEXTAREA_TALL)}>
|
||||
{genType === 'voice' ? (
|
||||
<>
|
||||
<FormRow className="mb-0">
|
||||
<Field label="声音模型" width="wide">
|
||||
<Select value={genDraft.model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { model_id: v === null ? null : Number(v) })}
|
||||
options={genProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="试听文本" required className="mb-0">
|
||||
<textarea rows={2} title="这是要念出来的台词,不是声线设定。" value={genDraft.sample_text}
|
||||
placeholder="输入一句要让模型朗读的台词,例如:在下郭靖,初次见面,请多指教。"
|
||||
onChange={(e) => patchDraft(genType, genOwner, { sample_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考音色" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { reference_asset_id: v === null ? null : Number(v) })}
|
||||
options={[
|
||||
/* 「自动」到底自动成什么,必须写在这个选项上:留空时后端按性别借嗓子,
|
||||
用户若以为会用本声线的参考,出来的音色就完全对不上。 */
|
||||
{ value: null, label: `自动(${voiceRefStatus?.borrowed
|
||||
? `本次借「${voiceRefStatus.voice_name || '同性别声线'}』的嗓子`
|
||||
: voiceRefStatus && !voiceRefStatus.ready
|
||||
? '库里没有同性别参考 · 会拦下'
|
||||
: '用本声线已绑定的参考音频'})` },
|
||||
...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-accent-line text-success"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference('voice', genOwner, f) }} />
|
||||
<RecordAudio label="录参考音色" target="参考音色"
|
||||
defaultName={defaultAssetName(genOwner.assets, `${genOwner.name}参考音色`, 'reference')}
|
||||
names={existingNames(genOwner.assets)}
|
||||
hint="弹出小面板:念几句话当作 IndexTTS2 的克隆参考,录完自动转成 WAV 并选中"
|
||||
onPick={(file, meta) => void recordGenerationReference('voice', genOwner, file, meta)} />
|
||||
<small className="flex-1 basis-[240px] text-tiny leading-[1.5] text-dim">
|
||||
IndexTTS2 通过参考音频做 zero-shot 音色克隆;上传后会自动选中。
|
||||
音色由参考音频决定,「性别 / 音色描述」对模型只是标注,所以留空时会拿到谁的嗓子必须实测告诉你:
|
||||
</small>
|
||||
{voiceRefStatus && (
|
||||
<RefStatus ready={!!voiceRefStatus.ready} borrowed={!!voiceRefStatus.borrowed}
|
||||
note={voiceRefStatus.note} />
|
||||
)}
|
||||
</GenerationReference>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="图像模型">
|
||||
<Select value={genDraft.model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { model_id: v === null ? null : Number(v) })}
|
||||
options={genProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
{genType === 'human' && (
|
||||
<Field label="生成类型">
|
||||
<Select value={genDraft.kind} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { kind: String(v) })}
|
||||
options={[{ value: 'portrait', label: '定妆图' }, { value: 'turnaround', label: '三视图' },
|
||||
{ value: 'costume', label: '服装设定' }, { value: 'expression', label: '表情参考' }]} />
|
||||
<FormGrid>
|
||||
{/* 正文走纵向 12px 节奏;提示词都是长句,textarea 给足高度并允许手工拉长 */}
|
||||
<div className={cn('flex flex-col gap-3', TEXTAREA_TALL)}>
|
||||
{genType === 'voice' ? (
|
||||
<>
|
||||
<FormRow className="mb-0">
|
||||
<Field label="声音模型" width="wide">
|
||||
<Select value={genDraft.model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { model_id: v === null ? null : Number(v) })}
|
||||
options={genProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="试听文本" required className="mb-0">
|
||||
<textarea rows={2} title="这是要念出来的台词,不是声线设定。" value={genDraft.sample_text}
|
||||
placeholder="输入一句要让模型朗读的台词,例如:在下郭靖,初次见面,请多指教。"
|
||||
onChange={(e) => patchDraft(genType, genOwner, { sample_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考音色" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { reference_asset_id: v === null ? null : Number(v) })}
|
||||
options={[
|
||||
/* 「自动」到底自动成什么,必须写在这个选项上:留空时后端按性别借嗓子,
|
||||
用户若以为会用本声线的参考,出来的音色就完全对不上。 */
|
||||
{ value: null, label: `自动(${voiceRefStatus?.borrowed
|
||||
? `本次借「${voiceRefStatus.voice_name || '同性别声线'}』的嗓子`
|
||||
: voiceRefStatus && !voiceRefStatus.ready
|
||||
? '库里没有同性别参考 · 会拦下'
|
||||
: '用本声线已绑定的参考音频'})` },
|
||||
...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-accent-line text-success"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference('voice', genOwner, f) }} />
|
||||
<RecordAudio label="录参考音色" target="参考音色"
|
||||
defaultName={defaultAssetName(genOwner.assets, `${genOwner.name}参考音色`, 'reference')}
|
||||
names={existingNames(genOwner.assets)}
|
||||
hint="弹出小面板:念几句话当作 IndexTTS2 的克隆参考,录完自动转成 WAV 并选中"
|
||||
onPick={(file, meta) => void recordGenerationReference('voice', genOwner, file, meta)} />
|
||||
<small className="flex-1 basis-[240px] text-tiny leading-[1.5] text-dim">
|
||||
IndexTTS2 通过参考音频做 zero-shot 音色克隆;上传后会自动选中。
|
||||
音色由参考音频决定,「性别 / 音色描述」对模型只是标注,所以留空时会拿到谁的嗓子必须实测告诉你:
|
||||
</small>
|
||||
{voiceRefStatus && (
|
||||
<RefStatus ready={!!voiceRefStatus.ready} borrowed={!!voiceRefStatus.borrowed}
|
||||
note={voiceRefStatus.note} />
|
||||
)}
|
||||
</GenerationReference>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="图像模型">
|
||||
<Select value={genDraft.model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { model_id: v === null ? null : Number(v) })}
|
||||
options={genProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
{genType === 'human' && (
|
||||
<Field label="生成类型">
|
||||
<Select value={genDraft.kind} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { kind: String(v) })}
|
||||
options={[{ value: 'portrait', label: '定妆图' }, { value: 'turnaround', label: '三视图' },
|
||||
{ value: 'costume', label: '服装设定' }, { value: 'expression', label: '表情参考' }]} />
|
||||
</Field>
|
||||
)}
|
||||
<Field label="大模型(提示词补全)" title="只给下面「AI 补全一致性提示词」用,不参与出图">
|
||||
<Select value={genDraft.assist_model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { assist_model_id: v === null ? null : Number(v) })}
|
||||
options={llmProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label={`生成描述(留空自动使用${genLabel}设定)`} className="mb-0">
|
||||
<textarea rows={3} value={genDraft.prompt}
|
||||
placeholder={genType === 'human' ? '电影级角色定妆照,冷色侧光,正面清晰' : '广角场景概念图,晨雾,冷色调,强透视'}
|
||||
onChange={(e) => patchDraft(genType, genOwner, { prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考图" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
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}
|
||||
title="选择已有定妆 / 三视图 / 场景素材,或临时上传一张图作为本次生成锚点,可显著提升跨镜头一致性。"
|
||||
className="flex-none border-accent-line text-success"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference(genType, genOwner, f) }} />
|
||||
</GenerationReference>
|
||||
{genSuggestion && (
|
||||
<SuggestionBox text={genSuggestion} busy={!!busy}
|
||||
onApply={() => void applySuggestion(genSuggestType, genOwner)}
|
||||
onDismiss={dismissSuggestion} />
|
||||
)}
|
||||
<Field label="大模型(提示词补全)" title="只给下面「AI 补全一致性提示词」用,不参与出图">
|
||||
<Select value={genDraft.assist_model_id} size="sm"
|
||||
onChange={(v) => patchDraft(genType, genOwner, { assist_model_id: v === null ? null : Number(v) })}
|
||||
options={llmProviders.map((p) => ({
|
||||
value: p.id, label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label={`生成描述(留空自动使用${genLabel}设定)`} className="mb-0">
|
||||
<textarea rows={3} value={genDraft.prompt}
|
||||
placeholder={genType === 'human' ? '电影级角色定妆照,冷色侧光,正面清晰' : '广角场景概念图,晨雾,冷色调,强透视'}
|
||||
onChange={(e) => patchDraft(genType, genOwner, { prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<GenerationReference>
|
||||
<Field label="参考图" width="wide">
|
||||
<Select value={genDraft.reference_asset_id} size="sm"
|
||||
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}
|
||||
title="选择已有定妆 / 三视图 / 场景素材,或临时上传一张图作为本次生成锚点,可显著提升跨镜头一致性。"
|
||||
className="flex-none border-accent-line text-success"
|
||||
onFiles={(files) => { const f = files[0]; if (f) void sendGenerationReference(genType, genOwner, f) }} />
|
||||
</GenerationReference>
|
||||
{genSuggestion && (
|
||||
<SuggestionBox text={genSuggestion} busy={!!busy}
|
||||
onApply={() => void applySuggestion(genSuggestType, genOwner)}
|
||||
onDismiss={dismissSuggestion} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 两条提示分开:选中那台未就绪只是黄条提醒,一台可用模型都没有才真正点不动生成 */}
|
||||
{genProviderUnready && (
|
||||
<ProviderWarning>当前模型未就绪,仍可选择;生成时会返回具体缺失节点或服务错误。</ProviderWarning>
|
||||
)}
|
||||
{!genProvidersReady && (
|
||||
<ProviderWarning>
|
||||
模型管理中心还没有可用的{genType === 'voice' ? '声音' : '图像'}模型,请先到
|
||||
<Link to="/models" className={cn('mx-1', LINK_CLS)}>模型管理</Link>
|
||||
登记并启用。
|
||||
</ProviderWarning>
|
||||
)}
|
||||
</div>
|
||||
{/* 两条提示分开:选中那台未就绪只是黄条提醒,一台可用模型都没有才真正点不动生成 */}
|
||||
{genProviderUnready && (
|
||||
<ProviderWarning>当前模型未就绪,仍可选择;生成时会返回具体缺失节点或服务错误。</ProviderWarning>
|
||||
)}
|
||||
{!genProvidersReady && (
|
||||
<ProviderWarning>
|
||||
模型管理中心还没有可用的{genType === 'voice' ? '声音' : '图像'}模型,请先到
|
||||
<Link to="/models" className={cn('mx-1', LINK_CLS)}>模型管理</Link>
|
||||
登记并启用。
|
||||
</ProviderWarning>
|
||||
)}
|
||||
</div>
|
||||
</FormGrid>
|
||||
</Drawer>
|
||||
)}
|
||||
</TabStack>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { notify } from '../../stores/notice'
|
|||
import { useAutoRefresh } from '../../hooks'
|
||||
import { Select } from '../../components/forms'
|
||||
import {
|
||||
Actions, Button, CardRow, Chip, Ctlbar, Divider, ErrorText, Field, FieldBlock, FormRow, Grid,
|
||||
Actions, Button, CardRow, Chip, Ctlbar, Divider, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid,
|
||||
Layout, LINK_CLS, LogBox, LogRow, MONO, MUTED, MUTED_MONO, Panel, PanelHead, Row, Stack, Stat,
|
||||
TabStack, Table, TableBox, Tag, TagGroup, Value, buttonCls, cellCenter, cellWrap
|
||||
} from '../../components/ui'
|
||||
|
|
@ -339,117 +339,119 @@ export default function Overview() {
|
|||
</Panel>
|
||||
|
||||
<Panel>
|
||||
<PanelHead
|
||||
title="项目设置"
|
||||
right={(
|
||||
<Row tight>
|
||||
<Tag tone={flowTagTone}>{flowTagText}</Tag>
|
||||
<Button variant="outline" size="sm" disabled={saving} onClick={() => setArchived(!isArchived)}
|
||||
title="项目状态由后端按镜头与任务真实进度回写,这里只提供归档开关;归档后不再自动推进流程节点。">
|
||||
{isArchived ? '取消归档' : '归档项目'}
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={() => setEditing(!editing)}>
|
||||
{editing ? '收起' : '编辑'}
|
||||
</Button>
|
||||
</Row>
|
||||
<FormGrid>
|
||||
<PanelHead
|
||||
title="项目设置"
|
||||
right={(
|
||||
<Row tight>
|
||||
<Tag tone={flowTagTone}>{flowTagText}</Tag>
|
||||
<Button variant="outline" size="sm" disabled={saving} onClick={() => setArchived(!isArchived)}
|
||||
title="项目状态由后端按镜头与任务真实进度回写,这里只提供归档开关;归档后不再自动推进流程节点。">
|
||||
{isArchived ? '取消归档' : '归档项目'}
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={() => setEditing(!editing)}>
|
||||
{editing ? '收起' : '编辑'}
|
||||
</Button>
|
||||
</Row>
|
||||
)}
|
||||
/>
|
||||
|
||||
{editing ? (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="名称">
|
||||
<input value={form.name} onChange={(e) => patch({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="题材">
|
||||
<input value={form.genre} placeholder="科幻 / 悬疑 / 公路"
|
||||
onChange={(e) => patch({ genre: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="目标总时长(秒)" title={durationRule}>
|
||||
<input type="number" min={1} value={form.target_duration}
|
||||
onChange={(e) => patch({ target_duration: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="默认转场">
|
||||
<Select value={form.default_transition} options={options('transition')}
|
||||
onChange={(v) => patch({ default_transition: v })} />
|
||||
</Field>
|
||||
{/* 旧站是 .span2:模型名带 provider,短栅格里挤成两行看不出选的是谁 */}
|
||||
<Field label="默认视频模型" className="col-span-2"
|
||||
title="镜头未单独指定模型时使用;决定可用的分辨率与帧率档位。">
|
||||
<Select value={videoRef} onChange={setVideoRef}
|
||||
options={[
|
||||
{ value: '', label: `跟随平台默认(${defaultVideoLabel})` },
|
||||
...videoModels.map((r) => ({
|
||||
value: refOf(r),
|
||||
label: `${r.display_name || `${r.provider} · ${r.model}`}`
|
||||
+ `${r.available ? '' : '(未就绪)'}${isMock(r) ? '(演练通道)' : ''}`
|
||||
}))
|
||||
]} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select value={form.aspect_ratio} options={options('aspect_ratio')}
|
||||
onChange={(v) => patch({ aspect_ratio: v })} />
|
||||
</Field>
|
||||
<Field label="分辨率">
|
||||
<Select value={form.resolution} options={resOptions}
|
||||
onChange={(v) => patch({ resolution: v })} />
|
||||
</Field>
|
||||
<Field label="帧率">
|
||||
<Select value={form.fps} onChange={(v) => patch({ fps: Number(v) })}
|
||||
options={fpsOptions.map((f) => ({ value: String(f), label: `${f} fps` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
<TagGroup>
|
||||
<Tag>生成模式 {modeLabels}</Tag>
|
||||
<Tag>可用档位 {videoCaps.resolutions.join(' / ') || '未声明'}</Tag>
|
||||
<Tag>帧率 {videoCaps.fps || '未声明'}fps</Tag>
|
||||
<Tag>单镜 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒</Tag>
|
||||
<Tag>参考图上限 {videoCaps.maxReferenceImages || '未声明'}</Tag>
|
||||
</TagGroup>
|
||||
{modelWarnings.map((w, i) => <ErrorText key={`mw${i}`}>{w}</ErrorText>)}
|
||||
|
||||
<FieldBlock label="简介">
|
||||
<textarea rows={2} value={form.description} onChange={(e) => patch({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="全局风格指南"
|
||||
title="只写画面感风格;音画一体模型会自动过滤画幅、水印、一致性这类元指令。">
|
||||
<textarea rows={2} value={form.style_guide} placeholder="只写画面风格:写实电影质感,35mm 浅景深……(音画一体模型会自动过滤画幅/水印/一致性等元指令)"
|
||||
onChange={(e) => patch({ style_guide: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="全局负面提示词(音画一体模型不下发)">
|
||||
<input value={form.global_negative_prompt} placeholder="字幕,水印,角色变形,多手多指"
|
||||
onChange={(e) => patch({ global_negative_prompt: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={saving} onClick={save}>{saving ? '保存中…' : '保存设置'}</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : (
|
||||
<Grid cols={3} steps={STAT_STEPS}>
|
||||
<div>
|
||||
<small className={MUTED}>风格指南</small>
|
||||
<Value>{project?.style_guide || '未设置'}</Value>
|
||||
</div>
|
||||
<div>
|
||||
<small className={MUTED}>负面提示词</small>
|
||||
<Value>{project?.global_negative_prompt || '未设置'}</Value>
|
||||
</div>
|
||||
<div>
|
||||
<small className={MUTED}>默认生成参数</small>
|
||||
<Value>
|
||||
{project?.default_model
|
||||
? `${project?.default_provider} / ${project?.default_model}`
|
||||
: `跟随平台默认(${defaultVideoLabel})`}
|
||||
{' · '}{project?.aspect_ratio} · {project?.resolution} @{project?.fps}fps
|
||||
{' · '}单镜时长区间 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒
|
||||
</Value>
|
||||
</div>
|
||||
</Grid>
|
||||
)}
|
||||
/>
|
||||
|
||||
{editing ? (
|
||||
<>
|
||||
<FormRow>
|
||||
<Field label="名称">
|
||||
<input value={form.name} onChange={(e) => patch({ name: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="题材">
|
||||
<input value={form.genre} placeholder="科幻 / 悬疑 / 公路"
|
||||
onChange={(e) => patch({ genre: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="目标总时长(秒)" title={durationRule}>
|
||||
<input type="number" min={1} value={form.target_duration}
|
||||
onChange={(e) => patch({ target_duration: Number(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="默认转场">
|
||||
<Select value={form.default_transition} options={options('transition')}
|
||||
onChange={(v) => patch({ default_transition: v })} />
|
||||
</Field>
|
||||
{/* 旧站是 .span2:模型名带 provider,短栅格里挤成两行看不出选的是谁 */}
|
||||
<Field label="默认视频模型" className="col-span-2"
|
||||
title="镜头未单独指定模型时使用;决定可用的分辨率与帧率档位。">
|
||||
<Select value={videoRef} onChange={setVideoRef}
|
||||
options={[
|
||||
{ value: '', label: `跟随平台默认(${defaultVideoLabel})` },
|
||||
...videoModels.map((r) => ({
|
||||
value: refOf(r),
|
||||
label: `${r.display_name || `${r.provider} · ${r.model}`}`
|
||||
+ `${r.available ? '' : '(未就绪)'}${isMock(r) ? '(演练通道)' : ''}`
|
||||
}))
|
||||
]} />
|
||||
</Field>
|
||||
<Field label="画幅">
|
||||
<Select value={form.aspect_ratio} options={options('aspect_ratio')}
|
||||
onChange={(v) => patch({ aspect_ratio: v })} />
|
||||
</Field>
|
||||
<Field label="分辨率">
|
||||
<Select value={form.resolution} options={resOptions}
|
||||
onChange={(v) => patch({ resolution: v })} />
|
||||
</Field>
|
||||
<Field label="帧率">
|
||||
<Select value={form.fps} onChange={(v) => patch({ fps: Number(v) })}
|
||||
options={fpsOptions.map((f) => ({ value: String(f), label: `${f} fps` }))} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
|
||||
<TagGroup>
|
||||
<Tag>生成模式 {modeLabels}</Tag>
|
||||
<Tag>可用档位 {videoCaps.resolutions.join(' / ') || '未声明'}</Tag>
|
||||
<Tag>帧率 {videoCaps.fps || '未声明'}fps</Tag>
|
||||
<Tag>单镜 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒</Tag>
|
||||
<Tag>参考图上限 {videoCaps.maxReferenceImages || '未声明'}</Tag>
|
||||
</TagGroup>
|
||||
{modelWarnings.map((w, i) => <ErrorText key={`mw${i}`}>{w}</ErrorText>)}
|
||||
|
||||
<FieldBlock label="简介">
|
||||
<textarea rows={2} value={form.description} onChange={(e) => patch({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="全局风格指南"
|
||||
title="只写画面感风格;音画一体模型会自动过滤画幅、水印、一致性这类元指令。">
|
||||
<textarea rows={2} value={form.style_guide} placeholder="只写画面风格:写实电影质感,35mm 浅景深……(音画一体模型会自动过滤画幅/水印/一致性等元指令)"
|
||||
onChange={(e) => patch({ style_guide: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="全局负面提示词(音画一体模型不下发)">
|
||||
<input value={form.global_negative_prompt} placeholder="字幕,水印,角色变形,多手多指"
|
||||
onChange={(e) => patch({ global_negative_prompt: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={saving} onClick={save}>{saving ? '保存中…' : '保存设置'}</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : (
|
||||
<Grid cols={3} steps={STAT_STEPS}>
|
||||
<div>
|
||||
<small className={MUTED}>风格指南</small>
|
||||
<Value>{project?.style_guide || '未设置'}</Value>
|
||||
</div>
|
||||
<div>
|
||||
<small className={MUTED}>负面提示词</small>
|
||||
<Value>{project?.global_negative_prompt || '未设置'}</Value>
|
||||
</div>
|
||||
<div>
|
||||
<small className={MUTED}>默认生成参数</small>
|
||||
<Value>
|
||||
{project?.default_model
|
||||
? `${project?.default_provider} / ${project?.default_model}`
|
||||
: `跟随平台默认(${defaultVideoLabel})`}
|
||||
{' · '}{project?.aspect_ratio} · {project?.resolution} @{project?.fps}fps
|
||||
{' · '}单镜时长区间 {videoCaps.minDuration || '?'}–{videoCaps.maxDuration || '?'} 秒
|
||||
</Value>
|
||||
</div>
|
||||
</Grid>
|
||||
)}
|
||||
<ErrorText>{error}</ErrorText>
|
||||
<ErrorText>{error}</ErrorText>
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
</Stack>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import { notify } from '../../stores/notice'
|
|||
import { openPreview, usePreviewOpen } from '../../stores/preview'
|
||||
import {
|
||||
Actions, BarRight, Between, Button, CARD_ROW, Check, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText,
|
||||
ExtLink, Field, FieldBlock, FilePick, FormRow, LINK_CLS, Loading, Mono, MUTED, MUTED_MONO, Notice,
|
||||
ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, LINK_CLS, Loading, Mono, MUTED, MUTED_MONO, Notice,
|
||||
Panel, PanelHead, Row, SectionTitle, Spinner, Status, TabStack, Table, TableBox, Tabs, Tag, TAG_DENSE, TagGroup, ViewBtn,
|
||||
buttonCls, cellCenter, cellRight, cellWrap, CloseButton, DRAWER_ACTIONS, DRAWER_BODY,
|
||||
DRAWER_HEAD
|
||||
|
|
@ -1457,385 +1457,389 @@ export default function Storyboard() {
|
|||
</div>
|
||||
|
||||
<div className={DRAWER_BODY}>
|
||||
{/* 四个页签全部保持挂载、只用 hidden 收起:
|
||||
「✎ 改文案」要拿到画面描述的 textarea(descRef),
|
||||
卸载式页签切过去才渲染,那个动作就会静默失败。 */}
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'shot' && 'hidden')}>
|
||||
<SectionTitle title="只改这一镜:保存后提示词与预检即时重算,不必重跑整份分镜">📝 本镜文案</SectionTitle>
|
||||
<FormRow cols={2}>
|
||||
<Field label="标题">
|
||||
<input value={draft.title} onChange={(e) => edit({ title: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="镜号">
|
||||
<input value={draft.code} placeholder="留空自动编号"
|
||||
onChange={(e) => edit({ code: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="画面描述" title="这段描述是生成提示词的主体">
|
||||
<textarea ref={descRef} data-field="description" rows={4} value={draft.description}
|
||||
placeholder="星舰舰桥,林澈凝视全息星图"
|
||||
onChange={(e) => edit({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="剧情梗概(可选)">
|
||||
<textarea rows={2} value={draft.synopsis} onChange={(e) => edit({ synopsis: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="本镜风格补充">
|
||||
<input value={draft.style_note} placeholder="只写这一镜与全片基调不同的地方"
|
||||
onChange={(e) => edit({ style_note: e.target.value })} />
|
||||
</FieldBlock>
|
||||
|
||||
<SectionTitle title="一句一行并标清说话人,系统按各自声线逐句配音;留空即这一镜没有人说话"
|
||||
action={(
|
||||
<>
|
||||
{draft.lines.length > 1
|
||||
? <Tag tone="ok" title="按说话人各自的声线逐句配音">本镜 {draft.lines.length} 人说话</Tag>
|
||||
: null}
|
||||
<Button variant="add" type="button" title="再加一句台词" onClick={addLine}>+ 加一句</Button>
|
||||
</>
|
||||
)}>
|
||||
🗣 台词与配音
|
||||
</SectionTitle>
|
||||
<div className="flex min-w-0 flex-col gap-[6px]">
|
||||
{draft.lines.map((row, i) => (
|
||||
<DialogueRow key={`line${i}`} index={i} row={row} total={draft.lines.length}
|
||||
characters={characters} issue={lineVoiceIssue(row)}
|
||||
onSpeaker={(next) => patchLine(i, { character_id: next })}
|
||||
onText={(next) => patchLine(i, { text: next })}
|
||||
onRemove={() => removeLine(i)} />
|
||||
))}
|
||||
{!draft.lines.length ? <div className={LINE_EMPTY}>这一镜没有台词</div> : null}
|
||||
</div>
|
||||
|
||||
<FieldBlock label="字幕文本" title="留空则自动取这一镜的台词">
|
||||
<textarea data-field="subtitle" rows={2} value={draft.subtitle_text}
|
||||
onChange={(e) => edit({ subtitle_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={2}>
|
||||
<Field label="环境声"
|
||||
title="听得见的东西,用名词短语(键盘敲击声、空调底噪),不要写成句子。模型直出声音时它除了给这一镜铺底噪,还能占住台词前后的空闲时间:MiniMax H3 的音轨和画面一样长,空着的地方它不会留静音,而是从提示词里挑一段画面描述念出来(成片开头那句听不懂的话就是这么来的)。没人说话的镜头同样该填。">
|
||||
<input value={draft.ambience} placeholder="键盘敲击声,办公室底噪"
|
||||
onChange={(e) => edit({ ambience: e.target.value })} />
|
||||
</Field>
|
||||
<Check className="self-center" checked={draft.subtitle_enabled}
|
||||
onChange={(next) => edit({ subtitle_enabled: next })}>启用字幕</Check>
|
||||
</FormRow>
|
||||
<div className="min-w-0">
|
||||
<SectionTitle className="mt-0"
|
||||
action={(
|
||||
<Button variant="add" type="button" disabled={!sfxAssets.length}
|
||||
onClick={addSfx}
|
||||
title={sfxAssets.length ? '后期叠加一个音效素材' : '项目里还没有音效素材:到「资产库 → 音效」上传'}>
|
||||
+ 添加音效
|
||||
</Button>
|
||||
)}>
|
||||
镜头音效
|
||||
</SectionTitle>
|
||||
<div className="flex min-w-0 flex-col gap-[6px]">
|
||||
{draft.sound_effects.map((row, i) => (
|
||||
<SfxRowView key={`sfx${i}`} row={row} assets={sfxAssets}
|
||||
onPick={(assetId) => pickSfx(i, assetId)}
|
||||
onPatch={(patch) => patchSfx(i, patch)}
|
||||
onRemove={() => removeSfx(i)} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SectionTitle title="时长等区间跟随这一镜实际使用的模型;改完点下方「保存镜头」">🎥 摄影与生成参数</SectionTitle>
|
||||
<SectionTitle className="mt-0">摄影</SectionTitle>
|
||||
<FormRow cols={4}>
|
||||
<Field label="景别">
|
||||
<Select value={draft.shot_size} onChange={(next) => edit({ shot_size: next })}
|
||||
options={options('shot_size')} />
|
||||
</Field>
|
||||
<Field label="视角">
|
||||
<Select value={draft.camera_angle} onChange={(next) => edit({ camera_angle: next })}
|
||||
options={options('camera_angle')} />
|
||||
</Field>
|
||||
<Field label="运镜">
|
||||
<Select value={draft.camera_movement} onChange={(next) => edit({ camera_movement: next })}
|
||||
options={options('camera_movement')} />
|
||||
</Field>
|
||||
<Field label="镜头备注">
|
||||
<input value={draft.lens_note} placeholder="35mm / 浅景深…"
|
||||
onChange={(e) => edit({ lens_note: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<SectionTitle className="mt-0">时长与转场</SectionTitle>
|
||||
<FormRow cols={3}>
|
||||
<Field label="时长(秒)" title={`模型支持区间 ${durationRange || '未声明'}`}>
|
||||
<input type="number" step="0.5" min={shotCaps.minDuration || 0.5}
|
||||
max={shotCaps.maxDuration || undefined} value={draft.duration}
|
||||
onChange={(e) => edit({ duration: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="出转场">
|
||||
<Select value={draft.transition_out} onChange={(next) => edit({ transition_out: next })}
|
||||
options={options('transition')} />
|
||||
</Field>
|
||||
<Field label="转场(ms)">
|
||||
<input type="number" min="0" step="50" value={draft.transition_duration_ms}
|
||||
onChange={(e) => edit({ transition_duration_ms: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<SectionTitle className="mt-0">生成</SectionTitle>
|
||||
<FormRow cols={4}>
|
||||
<Field label="生成模式">
|
||||
<Select value={draft.mode} onChange={(next) => edit({ mode: next })} options={modeOptions} />
|
||||
</Field>
|
||||
<Field label="种子">
|
||||
<input type="number" value={draft.seed} placeholder="留空随机"
|
||||
onChange={(e) => edit({ seed: e.target.value })} />
|
||||
</Field>
|
||||
{/* 模型覆盖占两格:这一项的标签最长(跟随项目:provider/model),
|
||||
单格会截成「跟随项目:…」,看不出到底跟的是哪个模型。 */}
|
||||
<Field label="模型覆盖" className="col-span-2">
|
||||
<Select value={modelRef} onChange={setModelRef} options={modelChoices} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<ChipBar className="mb-0">
|
||||
<Tag>{shotModelRow ? (shotModelRow.display_name || `${shotModelRow.provider}/${shotModelRow.model}`) : '模型未注册'}</Tag>
|
||||
{shotCaps.resolutions.length ? <Tag>分辨率 {shotCaps.resolutions.join(' / ')}</Tag> : null}
|
||||
{shotUpscaleTiers.length ? <Tag>放大交付 {shotUpscaleTiers.join(' / ')}</Tag> : null}
|
||||
{shotCaps.modes.length ? <Tag>模式 {shotCaps.modes.join(' / ')}</Tag> : null}
|
||||
{durationRange ? <Tag>时长 {durationRange}</Tag> : null}
|
||||
{shotCaps.fps ? <Tag>{shotCaps.fps}fps</Tag> : null}
|
||||
{shotCaps.maxReferenceImages ? <Tag>参考图 ≤ {shotCaps.maxReferenceImages}</Tag> : null}
|
||||
</ChipBar>
|
||||
{shotWarnings.map((w) => <ErrorText key={w}>{w}</ErrorText>)}
|
||||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'assets' && 'hidden')}>
|
||||
<h3>资产绑定</h3>
|
||||
<FormRow>
|
||||
<Field label="出镜人物">
|
||||
<MultiSelect value={binding.character_ids} ariaLabel="出镜人物" size="md"
|
||||
onChange={(next) => patchBinding({ character_ids: next })}
|
||||
options={characters.map((c) => ({ value: c.id, label: `${c.name} · ${c.role}` }))} />
|
||||
</Field>
|
||||
<Field label="场景">
|
||||
<MultiSelect value={binding.scene_ids} ariaLabel="场景"
|
||||
onChange={(next) => patchBinding({ scene_ids: next })}
|
||||
options={scenes.map((s) => ({ value: s.id, label: s.name }))} />
|
||||
</Field>
|
||||
<Field label="说话人">
|
||||
<Select value={binding.speaker_character_id}
|
||||
onChange={(next) => patchBinding({ speaker_character_id: next })}
|
||||
options={[{ value: null, label: '无台词' },
|
||||
...characters.map((c) => ({ value: c.id, label: c.name }))]} />
|
||||
</Field>
|
||||
<Field label="声线">
|
||||
<Select value={binding.voice_asset_id}
|
||||
onChange={(next) => patchBinding({ voice_asset_id: next })}
|
||||
options={[{ value: null, label: '使用说话人默认声线' },
|
||||
...voices.map((v) => ({ value: v.id, label: `${v.name} · ${v.provider}` }))]} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={!!busy || !selectedId} onClick={() => void saveBindings()}
|
||||
title="绑定后自动进入参考图与一致性提示词">保存绑定</Button>
|
||||
</Actions>
|
||||
|
||||
<Divider />
|
||||
<div className="rounded-[10px] border border-success-line bg-[linear-gradient(145deg,var(--c-bg-raised),var(--c-bg-shell)_65%)] p-[13px]">
|
||||
<Between>
|
||||
<b className="text-ui text-accent-bright">AI 生成关键帧</b>
|
||||
<Tag tone={keyframeModel?.available ? 'ok' : 'warn'}>
|
||||
{keyframeModel ? `${keyframeModel.provider}/${keyframeModel.model}` : '无可用图像模型'}
|
||||
</Tag>
|
||||
</Between>
|
||||
<FormRow>
|
||||
<Field label="图像模型">
|
||||
<Select value={keyframeGen.model_id} disabled={!imageProviders.length}
|
||||
title={imageProviders.length ? undefined : '没有启用的真实图像模型,先在模型控制台启用一个'}
|
||||
onChange={(next) => setKeyframeGen((prev) => ({ ...prev, model_id: next }))}
|
||||
options={imageProviders.map((p) => ({
|
||||
value: p.id,
|
||||
label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}`
|
||||
}))} />
|
||||
{/* 列边界由这一层 FormGrid 统一定义:四个页签里的 2/3/4 列字段
|
||||
以前各写各的轨道,标题散在 765/845/1003/1162/1241 五个位置。 */}
|
||||
<FormGrid>
|
||||
{/* 四个页签全部保持挂载、只用 hidden 收起:
|
||||
「✎ 改文案」要拿到画面描述的 textarea(descRef),
|
||||
卸载式页签切过去才渲染,那个动作就会静默失败。 */}
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'shot' && 'hidden')}>
|
||||
<SectionTitle title="只改这一镜:保存后提示词与预检即时重算,不必重跑整份分镜">📝 本镜文案</SectionTitle>
|
||||
<FormRow cols={2}>
|
||||
<Field label="标题">
|
||||
<input value={draft.title} onChange={(e) => edit({ title: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="生成尺寸">
|
||||
<input readOnly value={`${keyframeGen.width} × ${keyframeGen.height}`} />
|
||||
<Field label="镜号">
|
||||
<input value={draft.code} placeholder="留空自动编号"
|
||||
onChange={(e) => edit({ code: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="关键帧提示词">
|
||||
<textarea rows={5} spellCheck={false} value={keyframeGen.prompt}
|
||||
placeholder="描述这一镜的最终画面、机位、人物动作、光线与场景"
|
||||
onChange={(e) => setKeyframeGen((prev) => ({ ...prev, prompt: e.target.value }))} />
|
||||
<FieldBlock label="画面描述" title="这段描述是生成提示词的主体">
|
||||
<textarea ref={descRef} data-field="description" rows={4} value={draft.description}
|
||||
placeholder="星舰舰桥,林澈凝视全息星图"
|
||||
onChange={(e) => edit({ description: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="剧情梗概(可选)">
|
||||
<textarea rows={2} value={draft.synopsis} onChange={(e) => edit({ synopsis: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="本镜风格补充">
|
||||
<input value={draft.style_note} placeholder="只写这一镜与全片基调不同的地方"
|
||||
onChange={(e) => edit({ style_note: e.target.value })} />
|
||||
</FieldBlock>
|
||||
|
||||
<SectionTitle title="一句一行并标清说话人,系统按各自声线逐句配音;留空即这一镜没有人说话"
|
||||
action={(
|
||||
<>
|
||||
{draft.lines.length > 1
|
||||
? <Tag tone="ok" title="按说话人各自的声线逐句配音">本镜 {draft.lines.length} 人说话</Tag>
|
||||
: null}
|
||||
<Button variant="add" type="button" title="再加一句台词" onClick={addLine}>+ 加一句</Button>
|
||||
</>
|
||||
)}>
|
||||
🗣 台词与配音
|
||||
</SectionTitle>
|
||||
<div className="flex min-w-0 flex-col gap-[6px]">
|
||||
{draft.lines.map((row, i) => (
|
||||
<DialogueRow key={`line${i}`} index={i} row={row} total={draft.lines.length}
|
||||
characters={characters} issue={lineVoiceIssue(row)}
|
||||
onSpeaker={(next) => patchLine(i, { character_id: next })}
|
||||
onText={(next) => patchLine(i, { text: next })}
|
||||
onRemove={() => removeLine(i)} />
|
||||
))}
|
||||
{!draft.lines.length ? <div className={LINE_EMPTY}>这一镜没有台词</div> : null}
|
||||
</div>
|
||||
|
||||
<FieldBlock label="字幕文本" title="留空则自动取这一镜的台词">
|
||||
<textarea data-field="subtitle" rows={2} value={draft.subtitle_text}
|
||||
onChange={(e) => edit({ subtitle_text: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow cols={2}>
|
||||
<Field label="环境声"
|
||||
title="听得见的东西,用名词短语(键盘敲击声、空调底噪),不要写成句子。模型直出声音时它除了给这一镜铺底噪,还能占住台词前后的空闲时间:MiniMax H3 的音轨和画面一样长,空着的地方它不会留静音,而是从提示词里挑一段画面描述念出来(成片开头那句听不懂的话就是这么来的)。没人说话的镜头同样该填。">
|
||||
<input value={draft.ambience} placeholder="键盘敲击声,办公室底噪"
|
||||
onChange={(e) => edit({ ambience: e.target.value })} />
|
||||
</Field>
|
||||
<Check className="self-center" checked={draft.subtitle_enabled}
|
||||
onChange={(next) => edit({ subtitle_enabled: next })}>启用字幕</Check>
|
||||
</FormRow>
|
||||
<div className="min-w-0">
|
||||
<SectionTitle className="mt-0"
|
||||
action={(
|
||||
<Button variant="add" type="button" disabled={!sfxAssets.length}
|
||||
onClick={addSfx}
|
||||
title={sfxAssets.length ? '后期叠加一个音效素材' : '项目里还没有音效素材:到「资产库 → 音效」上传'}>
|
||||
+ 添加音效
|
||||
</Button>
|
||||
)}>
|
||||
镜头音效
|
||||
</SectionTitle>
|
||||
<div className="flex min-w-0 flex-col gap-[6px]">
|
||||
{draft.sound_effects.map((row, i) => (
|
||||
<SfxRowView key={`sfx${i}`} row={row} assets={sfxAssets}
|
||||
onPick={(assetId) => pickSfx(i, assetId)}
|
||||
onPatch={(patch) => patchSfx(i, patch)}
|
||||
onRemove={() => removeSfx(i)} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SectionTitle title="时长等区间跟随这一镜实际使用的模型;改完点下方「保存镜头」">🎥 摄影与生成参数</SectionTitle>
|
||||
<SectionTitle className="mt-0">摄影</SectionTitle>
|
||||
<FormRow cols={4}>
|
||||
<Field label="景别">
|
||||
<Select value={draft.shot_size} onChange={(next) => edit({ shot_size: next })}
|
||||
options={options('shot_size')} />
|
||||
</Field>
|
||||
<Field label="视角">
|
||||
<Select value={draft.camera_angle} onChange={(next) => edit({ camera_angle: next })}
|
||||
options={options('camera_angle')} />
|
||||
</Field>
|
||||
<Field label="运镜">
|
||||
<Select value={draft.camera_movement} onChange={(next) => edit({ camera_movement: next })}
|
||||
options={options('camera_movement')} />
|
||||
</Field>
|
||||
<Field label="镜头备注">
|
||||
<input value={draft.lens_note} placeholder="35mm / 浅景深…"
|
||||
onChange={(e) => edit({ lens_note: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<SectionTitle className="mt-0">时长与转场</SectionTitle>
|
||||
<FormRow cols={3}>
|
||||
<Field label="时长(秒)" title={`模型支持区间 ${durationRange || '未声明'}`}>
|
||||
<input type="number" step="0.5" min={shotCaps.minDuration || 0.5}
|
||||
max={shotCaps.maxDuration || undefined} value={draft.duration}
|
||||
onChange={(e) => edit({ duration: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="出转场">
|
||||
<Select value={draft.transition_out} onChange={(next) => edit({ transition_out: next })}
|
||||
options={options('transition')} />
|
||||
</Field>
|
||||
<Field label="转场(ms)">
|
||||
<input type="number" min="0" step="50" value={draft.transition_duration_ms}
|
||||
onChange={(e) => edit({ transition_duration_ms: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<SectionTitle className="mt-0">生成</SectionTitle>
|
||||
<FormRow cols={4}>
|
||||
<Field label="生成模式">
|
||||
<Select value={draft.mode} onChange={(next) => edit({ mode: next })} options={modeOptions} />
|
||||
</Field>
|
||||
<Field label="种子">
|
||||
<input type="number" value={draft.seed} placeholder="留空随机"
|
||||
onChange={(e) => edit({ seed: e.target.value })} />
|
||||
</Field>
|
||||
{/* 模型覆盖占两格:这一项的标签最长(跟随项目:provider/model),
|
||||
单格会截成「跟随项目:…」,看不出到底跟的是哪个模型。 */}
|
||||
<Field label="模型覆盖" className="col-span-2">
|
||||
<Select value={modelRef} onChange={setModelRef} options={modelChoices} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<ChipBar className="mb-0">
|
||||
<Tag>{shotModelRow ? (shotModelRow.display_name || `${shotModelRow.provider}/${shotModelRow.model}`) : '模型未注册'}</Tag>
|
||||
{shotCaps.resolutions.length ? <Tag>分辨率 {shotCaps.resolutions.join(' / ')}</Tag> : null}
|
||||
{shotUpscaleTiers.length ? <Tag>放大交付 {shotUpscaleTiers.join(' / ')}</Tag> : null}
|
||||
{shotCaps.modes.length ? <Tag>模式 {shotCaps.modes.join(' / ')}</Tag> : null}
|
||||
{durationRange ? <Tag>时长 {durationRange}</Tag> : null}
|
||||
{shotCaps.fps ? <Tag>{shotCaps.fps}fps</Tag> : null}
|
||||
{shotCaps.maxReferenceImages ? <Tag>参考图 ≤ {shotCaps.maxReferenceImages}</Tag> : null}
|
||||
</ChipBar>
|
||||
{shotWarnings.map((w) => <ErrorText key={w}>{w}</ErrorText>)}
|
||||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'assets' && 'hidden')}>
|
||||
<h3>资产绑定</h3>
|
||||
<FormRow>
|
||||
<Field label="出镜人物">
|
||||
<MultiSelect value={binding.character_ids} ariaLabel="出镜人物" size="md"
|
||||
onChange={(next) => patchBinding({ character_ids: next })}
|
||||
options={characters.map((c) => ({ value: c.id, label: `${c.name} · ${c.role}` }))} />
|
||||
</Field>
|
||||
<Field label="场景">
|
||||
<MultiSelect value={binding.scene_ids} ariaLabel="场景"
|
||||
onChange={(next) => patchBinding({ scene_ids: next })}
|
||||
options={scenes.map((s) => ({ value: s.id, label: s.name }))} />
|
||||
</Field>
|
||||
<Field label="说话人">
|
||||
<Select value={binding.speaker_character_id}
|
||||
onChange={(next) => patchBinding({ speaker_character_id: next })}
|
||||
options={[{ value: null, label: '无台词' },
|
||||
...characters.map((c) => ({ value: c.id, label: c.name }))]} />
|
||||
</Field>
|
||||
<Field label="声线">
|
||||
<Select value={binding.voice_asset_id}
|
||||
onChange={(next) => patchBinding({ voice_asset_id: next })}
|
||||
options={[{ value: null, label: '使用说话人默认声线' },
|
||||
...voices.map((v) => ({ value: v.id, label: `${v.name} · ${v.provider}` }))]} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={!!busy || !selectedId} onClick={() => void saveBindings()}
|
||||
title="绑定后自动进入参考图与一致性提示词">保存绑定</Button>
|
||||
</Actions>
|
||||
|
||||
<Divider />
|
||||
<div className="rounded-[10px] border border-success-line bg-[linear-gradient(145deg,var(--c-bg-raised),var(--c-bg-shell)_65%)] p-[13px]">
|
||||
<Between>
|
||||
<b className="text-ui text-accent-bright">AI 生成关键帧</b>
|
||||
<Tag tone={keyframeModel?.available ? 'ok' : 'warn'}>
|
||||
{keyframeModel ? `${keyframeModel.provider}/${keyframeModel.model}` : '无可用图像模型'}
|
||||
</Tag>
|
||||
</Between>
|
||||
<FormRow>
|
||||
<Field label="图像模型">
|
||||
<Select value={keyframeGen.model_id} disabled={!imageProviders.length}
|
||||
title={imageProviders.length ? undefined : '没有启用的真实图像模型,先在模型控制台启用一个'}
|
||||
onChange={(next) => setKeyframeGen((prev) => ({ ...prev, model_id: next }))}
|
||||
options={imageProviders.map((p) => ({
|
||||
value: p.id,
|
||||
label: `${p.display_name || p.model}${p.available ? '' : '(未就绪)'}`
|
||||
}))} />
|
||||
</Field>
|
||||
<Field label="生成尺寸">
|
||||
<input readOnly value={`${keyframeGen.width} × ${keyframeGen.height}`} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<FieldBlock label="关键帧提示词">
|
||||
<textarea rows={5} spellCheck={false} value={keyframeGen.prompt}
|
||||
placeholder="描述这一镜的最终画面、机位、人物动作、光线与场景"
|
||||
onChange={(e) => setKeyframeGen((prev) => ({ ...prev, prompt: e.target.value }))} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="负面提示词">
|
||||
<textarea rows={2} spellCheck={false} value={keyframeGen.negative_prompt}
|
||||
onChange={(e) => setKeyframeGen((prev) => ({ ...prev, negative_prompt: e.target.value }))} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="参考素材" title="可多选;默认取场景图、人物定妆图与镜头参考图">
|
||||
<MultiSelect value={keyframeGen.reference_asset_ids} ariaLabel="关键帧参考素材"
|
||||
onChange={(next) => setKeyframeGen((prev) => ({ ...prev, reference_asset_ids: next }))}
|
||||
options={imageReferences.map((a) => ({
|
||||
value: a.id,
|
||||
label: `${a.owner_label} · ${a.kind_label || a.kind} · ${a.name} v${a.version}`
|
||||
}))} />
|
||||
</FieldBlock>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={!!busy || !keyframeModel || !selectedId}
|
||||
onClick={() => void generateKeyframe()}
|
||||
title="使用当前镜头提示词与真实图像模型,生成后自动成为 i2v 首帧">▧ 生成并设为关键帧</Button>
|
||||
<Button variant="outline" disabled={!detail} onClick={() => syncKeyframeDraft(detail)}>
|
||||
恢复镜头提示词与默认参考
|
||||
</Button>
|
||||
</Actions>
|
||||
<ErrorText className="mt-[6px]">
|
||||
{imageProviders.length ? '' : '没有启用的真实图像模型。Mock 模型已禁用,请到模型控制台启用 Qwen-Image。'}
|
||||
</ErrorText>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">镜头素材</SectionTitle>
|
||||
<Actions className="mt-0">
|
||||
<FilePick label="⇪ 关键帧(首帧)" accept="image/*" title="上传后直接作为 i2v 首帧"
|
||||
onFiles={(files) => { void onAsset(files[0], 'keyframe', '关键帧') }} />
|
||||
<FilePick label="⇪ 尾帧" accept="image/*" title="首尾帧模式的最后一帧"
|
||||
onFiles={(files) => { void onAsset(files[0], 'last_frame', '尾帧') }} />
|
||||
<FilePick label="⇪ 参考图" accept="image/*" title="只作一致性参考,不进成片"
|
||||
onFiles={(files) => { void onAsset(files[0], 'reference_image', '参考图') }} />
|
||||
<FilePick label="⇪ 参考视频" accept="video/*" title="r2v 模式的参考视频"
|
||||
onFiles={(files) => { void onAsset(files[0], 'reference_video', '参考视频') }} />
|
||||
</Actions>
|
||||
{/* 720px 以下退成一列:270px 的地板在检查器最窄档(760 - padding)里会挤出三列,
|
||||
缩略图 + 名称 + 版本行全都开始截断。 */}
|
||||
<div className="mt-[10px] grid min-w-0 grid-cols-[repeat(auto-fit,minmax(270px,1fr))] gap-2 max-[720px]:grid-cols-[minmax(0,1fr)]">
|
||||
{(detail?.assets || []).map((a: any, ai: number) => (
|
||||
<AssetRow key={a.id} asset={a} queue={assetQueue} index={ai}
|
||||
onPreview={() => openPreview(assetQueue, ai)} />
|
||||
))}
|
||||
{!(detail?.assets || []).length
|
||||
? (
|
||||
<div className={MUTED} title="i2v / 首尾帧模式必须有对应帧图才能通过预检">该镜头暂无素材</div>
|
||||
)
|
||||
: null}
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'prompt' && 'hidden')}>
|
||||
<h3>提示词与版本</h3>
|
||||
<ChipBar>
|
||||
<Tag tone={promptForm.auto_sync ? 'ok' : 'warn'}>{promptForm.auto_sync ? '自动组装' : '人工覆盖'}</Tag>
|
||||
<Tag>正向 {promptForm.prompt.length} 字</Tag>
|
||||
<Tag>负面 {promptForm.negative_prompt.length} 字</Tag>
|
||||
</ChipBar>
|
||||
<FieldBlock label="正向提示词" title="勾选「跟随镜头参数自动组装」时这里是只读的:手工文本会在下一次保存时被自动组装覆盖">
|
||||
<textarea rows={7} spellCheck={false} value={promptForm.prompt}
|
||||
readOnly={promptForm.auto_sync}
|
||||
onChange={(e) => patchPrompt({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="负面提示词">
|
||||
<textarea rows={2} spellCheck={false} value={keyframeGen.negative_prompt}
|
||||
onChange={(e) => setKeyframeGen((prev) => ({ ...prev, negative_prompt: e.target.value }))} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="参考素材" title="可多选;默认取场景图、人物定妆图与镜头参考图">
|
||||
<MultiSelect value={keyframeGen.reference_asset_ids} ariaLabel="关键帧参考素材"
|
||||
onChange={(next) => setKeyframeGen((prev) => ({ ...prev, reference_asset_ids: next }))}
|
||||
options={imageReferences.map((a) => ({
|
||||
value: a.id,
|
||||
label: `${a.owner_label} · ${a.kind_label || a.kind} · ${a.name} v${a.version}`
|
||||
}))} />
|
||||
<textarea rows={2} spellCheck={false} value={promptForm.negative_prompt}
|
||||
readOnly={promptForm.auto_sync}
|
||||
onChange={(e) => patchPrompt({ negative_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="修改原因">
|
||||
<input value={promptForm.reason} placeholder="例如:加强角色一致性 / 按驳回原因修复"
|
||||
onChange={(e) => patchPrompt({ reason: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Check checked={promptForm.auto_sync} onChange={(next) => patchPrompt({ auto_sync: next })}>
|
||||
跟随镜头参数自动组装(勾选后人工文本只读)
|
||||
</Check>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={!!busy || !keyframeModel || !selectedId}
|
||||
onClick={() => void generateKeyframe()}
|
||||
title="使用当前镜头提示词与真实图像模型,生成后自动成为 i2v 首帧">▧ 生成并设为关键帧</Button>
|
||||
<Button variant="outline" disabled={!detail} onClick={() => syncKeyframeDraft(detail)}>
|
||||
恢复镜头提示词与默认参考
|
||||
</Button>
|
||||
<Button variant="primary" disabled={!!busy || !selectedId} onClick={() => void savePrompt()}>保存为新版本</Button>
|
||||
</Actions>
|
||||
<ErrorText className="mt-[6px]">
|
||||
{imageProviders.length ? '' : '没有启用的真实图像模型。Mock 模型已禁用,请到模型控制台启用 Qwen-Image。'}
|
||||
</ErrorText>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">镜头素材</SectionTitle>
|
||||
<Actions className="mt-0">
|
||||
<FilePick label="⇪ 关键帧(首帧)" accept="image/*" title="上传后直接作为 i2v 首帧"
|
||||
onFiles={(files) => { void onAsset(files[0], 'keyframe', '关键帧') }} />
|
||||
<FilePick label="⇪ 尾帧" accept="image/*" title="首尾帧模式的最后一帧"
|
||||
onFiles={(files) => { void onAsset(files[0], 'last_frame', '尾帧') }} />
|
||||
<FilePick label="⇪ 参考图" accept="image/*" title="只作一致性参考,不进成片"
|
||||
onFiles={(files) => { void onAsset(files[0], 'reference_image', '参考图') }} />
|
||||
<FilePick label="⇪ 参考视频" accept="video/*" title="r2v 模式的参考视频"
|
||||
onFiles={(files) => { void onAsset(files[0], 'reference_video', '参考视频') }} />
|
||||
</Actions>
|
||||
{/* 720px 以下退成一列:270px 的地板在检查器最窄档(760 - padding)里会挤出三列,
|
||||
缩略图 + 名称 + 版本行全都开始截断。 */}
|
||||
<div className="mt-[10px] grid min-w-0 grid-cols-[repeat(auto-fit,minmax(270px,1fr))] gap-2 max-[720px]:grid-cols-[minmax(0,1fr)]">
|
||||
{(detail?.assets || []).map((a: any, ai: number) => (
|
||||
<AssetRow key={a.id} asset={a} queue={assetQueue} index={ai}
|
||||
onPreview={() => openPreview(assetQueue, ai)} />
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">历史版本({revisions.length})</SectionTitle>
|
||||
{revisions.slice(0, 12).map((r) => (
|
||||
<RevisionCard key={r.id} rev={r} onUse={() => useRevision(r)} />
|
||||
))}
|
||||
{!(detail?.assets || []).length
|
||||
? (
|
||||
<div className={MUTED} title="i2v / 首尾帧模式必须有对应帧图才能通过预检">该镜头暂无素材</div>
|
||||
)
|
||||
: null}
|
||||
</div>
|
||||
</Panel>
|
||||
{!revisions.length ? <div className={MUTED}>尚无提示词版本记录。</div> : null}
|
||||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'prompt' && 'hidden')}>
|
||||
<h3>提示词与版本</h3>
|
||||
<ChipBar>
|
||||
<Tag tone={promptForm.auto_sync ? 'ok' : 'warn'}>{promptForm.auto_sync ? '自动组装' : '人工覆盖'}</Tag>
|
||||
<Tag>正向 {promptForm.prompt.length} 字</Tag>
|
||||
<Tag>负面 {promptForm.negative_prompt.length} 字</Tag>
|
||||
</ChipBar>
|
||||
<FieldBlock label="正向提示词" title="勾选「跟随镜头参数自动组装」时这里是只读的:手工文本会在下一次保存时被自动组装覆盖">
|
||||
<textarea rows={7} spellCheck={false} value={promptForm.prompt}
|
||||
readOnly={promptForm.auto_sync}
|
||||
onChange={(e) => patchPrompt({ prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FieldBlock label="负面提示词">
|
||||
<textarea rows={2} spellCheck={false} value={promptForm.negative_prompt}
|
||||
readOnly={promptForm.auto_sync}
|
||||
onChange={(e) => patchPrompt({ negative_prompt: e.target.value })} />
|
||||
</FieldBlock>
|
||||
<FormRow>
|
||||
<Field label="修改原因">
|
||||
<input value={promptForm.reason} placeholder="例如:加强角色一致性 / 按驳回原因修复"
|
||||
onChange={(e) => patchPrompt({ reason: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Check checked={promptForm.auto_sync} onChange={(next) => patchPrompt({ auto_sync: next })}>
|
||||
跟随镜头参数自动组装(勾选后人工文本只读)
|
||||
</Check>
|
||||
<Actions>
|
||||
<Button variant="primary" disabled={!!busy || !selectedId} onClick={() => void savePrompt()}>保存为新版本</Button>
|
||||
</Actions>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">历史版本({revisions.length})</SectionTitle>
|
||||
{revisions.slice(0, 12).map((r) => (
|
||||
<RevisionCard key={r.id} rev={r} onUse={() => useRevision(r)} />
|
||||
))}
|
||||
{!revisions.length ? <div className={MUTED}>尚无提示词版本记录。</div> : null}
|
||||
</Panel>
|
||||
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'output' && 'hidden')}>
|
||||
<h3>产物与质检</h3>
|
||||
{detail?.output_url ? (
|
||||
<>
|
||||
<video className="block max-h-[220px] w-full rounded-tile bg-deepest" controls
|
||||
src={shotVideoSrc} preload="metadata"
|
||||
onDoubleClick={() => previewShot(detail, shotOutputWhich(detail, preferVoiceoverAudio))} />
|
||||
<ChipBar top>
|
||||
<Status value={detail.status} />
|
||||
<Tag>实测 {(detail.output_duration || 0).toFixed(2)}s / 目标 {detail.duration}s</Tag>
|
||||
<Tag>生成于 {fmtTime(detail.generated_at)}</Tag>
|
||||
<Tag>尝试 {detail.attempts} 次</Tag>
|
||||
{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 variant="outline" 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')}>
|
||||
<Panel className={cn('bg-shell', inspectorTab !== 'output' && 'hidden')}>
|
||||
<h3>产物与质检</h3>
|
||||
{detail?.output_url ? (
|
||||
<>
|
||||
<video className="block max-h-[220px] w-full rounded-tile bg-deepest" controls
|
||||
src={shotVideoSrc} preload="metadata"
|
||||
onDoubleClick={() => previewShot(detail, shotOutputWhich(detail, preferVoiceoverAudio))} />
|
||||
<ChipBar top>
|
||||
<Status value={detail.status} />
|
||||
<Tag>实测 {(detail.output_duration || 0).toFixed(2)}s / 目标 {detail.duration}s</Tag>
|
||||
<Tag>生成于 {fmtTime(detail.generated_at)}</Tag>
|
||||
<Tag>尝试 {detail.attempts} 次</Tag>
|
||||
{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 variant="outline" 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')}>
|
||||
{detail.preview_ready
|
||||
? '正在播放平台配音'
|
||||
: (detail.native_audio && detail.voiceover_url ? '当前为模型原声' : '无模型音轨')}
|
||||
</Tag>
|
||||
{detail.preview_ready
|
||||
? '正在播放平台配音'
|
||||
: (detail.native_audio && detail.voiceover_url ? '当前为模型原声' : '无模型音轨')}
|
||||
</Tag>
|
||||
{detail.preview_ready
|
||||
? (
|
||||
<Button variant="outline" size="sm"
|
||||
onClick={() => setPreferVoiceoverAudio(!preferVoiceoverAudio)}>
|
||||
{preferVoiceoverAudio ? '听模型原声' : '听平台配音'}
|
||||
</Button>
|
||||
)
|
||||
: (detail.voiceover_url && detail.native_audio
|
||||
? (
|
||||
<Button variant="outline" size="sm" disabled={busy === '封装审片预览'}
|
||||
onClick={() => void buildShotPreview(true)}>封装审片预览</Button>
|
||||
<Button variant="outline" size="sm"
|
||||
onClick={() => setPreferVoiceoverAudio(!preferVoiceoverAudio)}>
|
||||
{preferVoiceoverAudio ? '听模型原声' : '听平台配音'}
|
||||
</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>
|
||||
) : null}
|
||||
{detail.voiceover_url ? (
|
||||
<>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">配音</SectionTitle>
|
||||
<AudioPlay src={detail.voiceover_url} label="本镜平台配音"
|
||||
durationMs={detail.voiceover_duration_ms} size="sm"
|
||||
hint="试听走平台统一音频引擎,切页/换镜头自动停上一段" />
|
||||
<Actions>
|
||||
<Button variant="outline" size="sm" onClick={() => previewShot(detail, 'voiceover')}>放大预览</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : null}
|
||||
<Actions>
|
||||
<Link to={`/projects/${projectId}/review?shot=${selectedId}`}
|
||||
className={buttonCls({ variant: 'primary' })}>前往审核 →</Link>
|
||||
<Link to={detail?.output_url ? dispatchLink(projectId, detail) : `/projects/${projectId}/dispatch?shot=${selectedId}`}
|
||||
className={buttonCls({ variant: 'outline' })}
|
||||
title="只把这一镜排进队列;已有产物时自动带上强制重建">重新生成 →</Link>
|
||||
</Actions>
|
||||
</>
|
||||
) : (
|
||||
<Empty>还没有产物。先在「资产」页签补齐关键帧并通过预检,再到调度中心入队生成。</Empty>
|
||||
)}
|
||||
{detail?.error_message
|
||||
? <ErrorText className="mt-[10px]">{detail.error_code} {detail.error_message}</ErrorText>
|
||||
: null}
|
||||
</Panel>
|
||||
: (detail.voiceover_url && detail.native_audio
|
||||
? (
|
||||
<Button variant="outline" size="sm" 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>
|
||||
) : null}
|
||||
{detail.voiceover_url ? (
|
||||
<>
|
||||
<Divider />
|
||||
<SectionTitle className="mt-0">配音</SectionTitle>
|
||||
<AudioPlay src={detail.voiceover_url} label="本镜平台配音"
|
||||
durationMs={detail.voiceover_duration_ms} size="sm"
|
||||
hint="试听走平台统一音频引擎,切页/换镜头自动停上一段" />
|
||||
<Actions>
|
||||
<Button variant="outline" size="sm" onClick={() => previewShot(detail, 'voiceover')}>放大预览</Button>
|
||||
</Actions>
|
||||
</>
|
||||
) : null}
|
||||
<Actions>
|
||||
<Link to={`/projects/${projectId}/review?shot=${selectedId}`}
|
||||
className={buttonCls({ variant: 'primary' })}>前往审核 →</Link>
|
||||
<Link to={detail?.output_url ? dispatchLink(projectId, detail) : `/projects/${projectId}/dispatch?shot=${selectedId}`}
|
||||
className={buttonCls({ variant: 'outline' })}
|
||||
title="只把这一镜排进队列;已有产物时自动带上强制重建">重新生成 →</Link>
|
||||
</Actions>
|
||||
</>
|
||||
) : (
|
||||
<Empty>还没有产物。先在「资产」页签补齐关键帧并通过预检,再到调度中心入队生成。</Empty>
|
||||
)}
|
||||
{detail?.error_message
|
||||
? <ErrorText className="mt-[10px]">{detail.error_code} {detail.error_message}</ErrorText>
|
||||
: null}
|
||||
</Panel>
|
||||
</FormGrid>
|
||||
</div>
|
||||
|
||||
{/* 保存条:抽屉级吸底(不是 body 内 sticky)——长表单滚到哪儿都能存,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ 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, FormRow, Grid, IssueRow, Layout, LineHint, MONO, MUTED, MUTED_MONO, Mono, Panel,
|
||||
FieldBlock, FilePick, FormGrid, FormRow, Grid, IssueRow, Layout, LineHint, MONO, MUTED, MUTED_MONO, Mono, Panel,
|
||||
PanelHead, Row, SectionTitle, Spinner, Status, TabStack, Table, TableBox, Tag, TagGroup, Value,
|
||||
cellCenter, cellRight
|
||||
} from '../../components/ui'
|
||||
|
|
@ -651,72 +651,74 @@ export default function Timeline() {
|
|||
|
||||
{/* ===== 音轨 ===== */}
|
||||
<Panel>
|
||||
<PanelHead title="音轨(配音 / BGM / 音效)"
|
||||
right={<>
|
||||
<Value>共 {clips.length} 条</Value>
|
||||
{/* 旧站这颗按钮漏了 @click,点了没反应;配音表单就在同一页下方,直接接上 addAudio */}
|
||||
<Button variant="add" disabled={!!busy || !timeline} onClick={addAudio}
|
||||
title="导出时按 lead/tail padding 与配音时长对齐字幕;缺配音会用视频原声并给出提醒。">+ 追加音轨</Button>
|
||||
</>} />
|
||||
{!clips.length && <Empty>暂无音轨。配音由「补齐缺失配音」生成,BGM 可在下方上传。</Empty>}
|
||||
{clips.map((c: any) => (
|
||||
<div key={c.id} className={cn(SUBLINE, 'grid-cols-[120px_minmax(0,1fr)_210px_auto] max-narrow:grid-cols-1')}>
|
||||
<Mono className={MUTED}>{fmtMs(c.start_ms)} · {fmtMs(c.duration_ms)}</Mono>
|
||||
<span>
|
||||
{c.label || c.kind}
|
||||
<Tag tone={c.kind === 'voiceover' ? 'info' : 'default'} className="ml-1">{statusLabel(c.kind)}</Tag>
|
||||
{c.ducking ? <span className={MUTED}> · 触发压低</span> : null}
|
||||
{c.loop ? <span className={MUTED}> · 循环</span> : null}
|
||||
{c.text ? <div className={MUTED}>{c.text}</div> : null}
|
||||
</span>
|
||||
<AudioPlay src={c.source_url} label={c.label || c.kind} durationMs={c.duration_ms}
|
||||
hint={`${fmtMs(c.start_ms)} 起`} size="sm" />
|
||||
<Mono className={MUTED}>{c.gain_db} dB</Mono>
|
||||
</div>
|
||||
))}
|
||||
<Divider />
|
||||
<FormRow>
|
||||
<Field label="类型">
|
||||
<Select ariaLabel="音轨类型" value={audio.kind} onChange={(v: any) => patchAudio({ kind: v })} options={AUDIO_KINDS} />
|
||||
</Field>
|
||||
<Field label="标签">
|
||||
<input value={audio.label} placeholder="例如:主旋律 BGM" onChange={(e) => patchAudio({ label: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="对齐镜头">
|
||||
<Select ariaLabel="音轨对齐镜头" value={audio.shot_id} onChange={(v: any) => patchAudio({ shot_id: v ?? '' })}
|
||||
options={[{ value: '', label: '(不绑定)' }, ...shotOptions]} />
|
||||
</Field>
|
||||
<Field label="起始 ms">
|
||||
<input type="number" min={0} step={50} value={audio.start_ms}
|
||||
onChange={(e) => patchAudio({ start_ms: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="时长 ms(0=自动)">
|
||||
<input type="number" min={0} step={50} value={audio.duration_ms}
|
||||
onChange={(e) => patchAudio({ duration_ms: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="增益 dB">
|
||||
<input type="number" step={0.5} value={audio.gain_db}
|
||||
onChange={(e) => patchAudio({ gain_db: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Check checked={audio.loop} onChange={(v) => patchAudio({ loop: v })} className="self-center">循环铺满</Check>
|
||||
<Check checked={audio.ducking} onChange={(v) => patchAudio({ ducking: v })} className="self-center">压低 BGM</Check>
|
||||
</FormRow>
|
||||
<Row tight>
|
||||
<FilePick label="🎵 选择音频文件" accept="audio/*"
|
||||
onFiles={(files) => patchAudio({ file: files[0] ?? null })} />
|
||||
{audio.file
|
||||
? <Chip as="span" active>{audio.file.name}</Chip>
|
||||
: <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>
|
||||
<FormGrid>
|
||||
<PanelHead title="音轨(配音 / BGM / 音效)"
|
||||
right={<>
|
||||
<Value>共 {clips.length} 条</Value>
|
||||
{/* 旧站这颗按钮漏了 @click,点了没反应;配音表单就在同一页下方,直接接上 addAudio */}
|
||||
<Button variant="add" disabled={!!busy || !timeline} onClick={addAudio}
|
||||
title="导出时按 lead/tail padding 与配音时长对齐字幕;缺配音会用视频原声并给出提醒。">+ 追加音轨</Button>
|
||||
</>} />
|
||||
{!clips.length && <Empty>暂无音轨。配音由「补齐缺失配音」生成,BGM 可在下方上传。</Empty>}
|
||||
{clips.map((c: any) => (
|
||||
<div key={c.id} className={cn(SUBLINE, 'grid-cols-[120px_minmax(0,1fr)_210px_auto] max-narrow:grid-cols-1')}>
|
||||
<Mono className={MUTED}>{fmtMs(c.start_ms)} · {fmtMs(c.duration_ms)}</Mono>
|
||||
<span>
|
||||
{c.label || c.kind}
|
||||
<Tag tone={c.kind === 'voiceover' ? 'info' : 'default'} className="ml-1">{statusLabel(c.kind)}</Tag>
|
||||
{c.ducking ? <span className={MUTED}> · 触发压低</span> : null}
|
||||
{c.loop ? <span className={MUTED}> · 循环</span> : null}
|
||||
{c.text ? <div className={MUTED}>{c.text}</div> : null}
|
||||
</span>
|
||||
<AudioPlay src={c.source_url} label={c.label || c.kind} durationMs={c.duration_ms}
|
||||
hint={`${fmtMs(c.start_ms)} 起`} size="sm" />
|
||||
<Mono className={MUTED}>{c.gain_db} dB</Mono>
|
||||
</div>
|
||||
))}
|
||||
</Row>
|
||||
<FormRow className="mt-3">
|
||||
<Field label="素材路径(可留空,或直接点上方已有素材)">
|
||||
<input value={audio.source_path} placeholder="media 相对路径,如 5/bgm/timeline-bgm_xxx.mp3"
|
||||
onChange={(e) => patchAudio({ source_path: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
<Divider />
|
||||
<FormRow>
|
||||
<Field label="类型">
|
||||
<Select ariaLabel="音轨类型" value={audio.kind} onChange={(v: any) => patchAudio({ kind: v })} options={AUDIO_KINDS} />
|
||||
</Field>
|
||||
<Field label="标签">
|
||||
<input value={audio.label} placeholder="例如:主旋律 BGM" onChange={(e) => patchAudio({ label: e.target.value })} />
|
||||
</Field>
|
||||
<Field label="对齐镜头">
|
||||
<Select ariaLabel="音轨对齐镜头" value={audio.shot_id} onChange={(v: any) => patchAudio({ shot_id: v ?? '' })}
|
||||
options={[{ value: '', label: '(不绑定)' }, ...shotOptions]} />
|
||||
</Field>
|
||||
<Field label="起始 ms">
|
||||
<input type="number" min={0} step={50} value={audio.start_ms}
|
||||
onChange={(e) => patchAudio({ start_ms: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="时长 ms(0=自动)">
|
||||
<input type="number" min={0} step={50} value={audio.duration_ms}
|
||||
onChange={(e) => patchAudio({ duration_ms: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Field label="增益 dB">
|
||||
<input type="number" step={0.5} value={audio.gain_db}
|
||||
onChange={(e) => patchAudio({ gain_db: numOf(e.target.value) })} />
|
||||
</Field>
|
||||
<Check checked={audio.loop} onChange={(v) => patchAudio({ loop: v })} className="self-center">循环铺满</Check>
|
||||
<Check checked={audio.ducking} onChange={(v) => patchAudio({ ducking: v })} className="self-center">压低 BGM</Check>
|
||||
</FormRow>
|
||||
<Row tight>
|
||||
<FilePick label="🎵 选择音频文件" accept="audio/*"
|
||||
onFiles={(files) => patchAudio({ file: files[0] ?? null })} />
|
||||
{audio.file
|
||||
? <Chip as="span" active>{audio.file.name}</Chip>
|
||||
: <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>
|
||||
))}
|
||||
</Row>
|
||||
<FormRow className="mt-3">
|
||||
<Field label="素材路径(可留空,或直接点上方已有素材)">
|
||||
<input value={audio.source_path} placeholder="media 相对路径,如 5/bgm/timeline-bgm_xxx.mp3"
|
||||
onChange={(e) => patchAudio({ source_path: e.target.value })} />
|
||||
</Field>
|
||||
</FormRow>
|
||||
</FormGrid>
|
||||
</Panel>
|
||||
|
||||
{/* ===== 版本 ===== */}
|
||||
|
|
|
|||
Loading…
Reference in New Issue