接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。 统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。 验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
68 lines
2.8 KiB
TypeScript
68 lines
2.8 KiB
TypeScript
import { request } from '../../lib/http'
|
|
import type { GenerationOptions } from '../generation-config/types'
|
|
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
|
|
|
/** 人工确认的相对眼位;只提交用户选择,不能从画面区域猜测。 */
|
|
export interface RelativeGazeGeometry {
|
|
subjectRef: string
|
|
targetDescription: string
|
|
horizontal: 'left' | 'right' | 'center' | 'unknown'
|
|
vertical: 'above' | 'below' | 'level' | 'unknown'
|
|
targetFocusRegion?: 'upper' | 'center' | 'lower' | 'whole'
|
|
gazeAlignmentStrategy?: 'eyes_only' | 'head_assisted' | 'upper_body_assisted'
|
|
source: 'manual'
|
|
}
|
|
|
|
/** 本次首帧编辑参数,不修改项目默认配置。 */
|
|
export interface KeyframeEditInput {
|
|
editInstruction: string
|
|
editMode: 'subject_only' | 'composition_assisted'
|
|
allowBackgroundDeemphasis?: boolean
|
|
relativeGazeGeometry?: RelativeGazeGeometry[]
|
|
provider?: string
|
|
generationOptions?: GenerationOptions
|
|
}
|
|
|
|
/** 后端编译的真实编辑输入。 */
|
|
export interface KeyframeEditPreview {
|
|
shotId: string
|
|
sourceKeyframeId: string
|
|
provider: string
|
|
model: string
|
|
editInstruction: string
|
|
editMode: KeyframeEditInput['editMode']
|
|
sourceImageSlots: number
|
|
maxInputImages: number | null
|
|
selected: Array<{ subjectRef: string; role: string; imageId: string }>
|
|
omitted: Array<{ subjectRef: string; role: string; imageId: string }>
|
|
}
|
|
|
|
/** 预览和后台编辑使用完全相同的业务参数。 */
|
|
export const keyframeEditApi = {
|
|
/**
|
|
* 只读编译实际编辑指令和参考图名额。
|
|
* @param shotId 正式镜头 ID
|
|
* @param sourceId 当前镜头有效源图 ID
|
|
* @param input 本次人工确认的编辑参数
|
|
* @param signal 查询取消信号
|
|
* @returns 实际模型输入
|
|
*/
|
|
preview: (shotId: string, sourceId: string, input: KeyframeEditInput, signal?: AbortSignal) =>
|
|
request<KeyframeEditPreview>(
|
|
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(sourceId)}/edit/preview`,
|
|
{ method: 'POST', body: input, signal, timeoutMs: 0 }
|
|
),
|
|
/**
|
|
* 启动持久化编辑任务,结果由后台真实终态确认。
|
|
* @param shotId 正式镜头 ID
|
|
* @param sourceId 已核对的编辑源图 ID
|
|
* @param input 已预览并确认费用的参数
|
|
* @returns 后台首帧质量任务观察句柄
|
|
*/
|
|
start: (shotId: string, sourceId: string, input: KeyframeEditInput) =>
|
|
request<WorkflowExecutionStart & { projectId: string; shotId: string; sourceKeyframeId: string }>(
|
|
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(sourceId)}/edit`,
|
|
{ method: 'POST', body: input, timeoutMs: 0 }
|
|
)
|
|
}
|