feat(P1): Add align-prompt feature for better text-image relevance

This commit is contained in:
empty
2026-01-06 23:29:41 +08:00
parent 2978622f7f
commit 1d343e55ba
4 changed files with 166 additions and 0 deletions

View File

@@ -197,6 +197,31 @@ class EditorApiClient {
return response.json()
}
/**
* Align image prompt with narration - regenerate prompt based on narration
*/
async alignPrompt(
storyboardId: string,
frameId: string,
narration?: string
): Promise<{ image_prompt: string; success: boolean }> {
const response = await fetch(
`${this.baseUrl}/editor/storyboard/${storyboardId}/frames/${frameId}/align-prompt`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ narration }),
}
)
if (!response.ok) {
const error = await response.json().catch(() => ({ detail: response.statusText }))
throw new Error(error.detail || `Failed to align prompt: ${response.statusText}`)
}
return response.json()
}
/**
* Inpaint (局部重绘) image for a frame
*/