feat: Add inpainting (局部重绘) feature for timeline editor

- Add canvas-based mask drawing tools (brush, eraser, rect, lasso)
- Add undo/redo history support for mask editing
- Integrate inpainting UI into preview player
- Add backend API endpoint for inpainting requests
- Add MediaService.inpaint method with ComfyUI workflow support
- Add Flux inpainting workflows for selfhost and RunningHub

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2026-01-05 23:44:51 +08:00
parent 56db9bf9d2
commit 79a6c2ef3e
17 changed files with 1444 additions and 5 deletions

View File

@@ -31,6 +31,11 @@ export interface PreviewResponse {
frames_count: number
}
export interface InpaintResponse {
image_path: string
success: boolean
}
class EditorApiClient {
private baseUrl: string
@@ -191,6 +196,37 @@ class EditorApiClient {
return response.json()
}
/**
* Inpaint (局部重绘) image for a frame
*/
async inpaintImage(
storyboardId: string,
frameId: string,
mask: string,
prompt?: string,
denoiseStrength?: number
): Promise<InpaintResponse> {
const response = await fetch(
`${this.baseUrl}/editor/storyboard/${storyboardId}/frames/${frameId}/inpaint`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
mask,
prompt,
denoise_strength: denoiseStrength ?? 0.8,
}),
}
)
if (!response.ok) {
const error = await response.json().catch(() => ({ detail: response.statusText }))
throw new Error(error.detail || `Failed to inpaint image: ${response.statusText}`)
}
return response.json()
}
}
// Export singleton instance