feat(short-drama-agent-front): 完善视觉资产审核流程
This commit is contained in:
1 parent
dc8bb17a23
commit
b88ad8770f
45 files changed
+2258
-352
No files matched your search
@@ -13,7 +13,7 @@ import { ImagePlus, RefreshCw } from '@lucide/vue'
|
||||
import { AssetImage } from '../../../components/ui'
|
||||
import { usePolling } from '../../../composables/usePolling'
|
||||
import { useQuery } from '../../../composables/useQuery'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import { ApiError, errorMessage } from '../../../lib/http'
|
||||
import { candidateDialogWidth } from '../../../lib/candidate-layout'
|
||||
import type { DesignedShot } from '../../storyboard/types'
|
||||
import { storyboardApi } from '../../storyboard/api'
|
||||
@@ -328,7 +328,7 @@ const canGeneratePrompt = computed(
|
||||
const canGenerateKeyframe = computed(
|
||||
() =>
|
||||
!assetBlocked.value &&
|
||||
!keyframes.value.some(item => ['pending', 'generating'].includes(item.status)) &&
|
||||
!keyframes.value.some(item => item.recoveryRequired || ['pending', 'generating'].includes(item.status)) &&
|
||||
!!props.keyframeReadiness &&
|
||||
props.keyframeReadiness.issues.length === 0
|
||||
)
|
||||
@@ -442,15 +442,38 @@ async function generatePrompt() {
|
||||
await refreshAll()
|
||||
}
|
||||
|
||||
/** 调用图片模型生成单镜头首帧;成功后重新读取候选和主图。 */
|
||||
/**
|
||||
* 提交已确认的首帧输入,并刷新该镜头候选。
|
||||
* @param input 预览绑定的生成参数
|
||||
* @returns 真实提交结果与可能的冲突
|
||||
*/
|
||||
async function generateKeyframe(input: GenerateKeyframeInput) {
|
||||
if (!canGenerateKeyframe.value) return
|
||||
if (!canGenerateKeyframe.value || !input.expectedPreviewFingerprint) return { accepted: false }
|
||||
const shotId = props.shot.shotId
|
||||
await runOperation(props.projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
|
||||
const projectId = props.projectId
|
||||
const accepted = await runOperation(projectId, `生成镜头 ${props.shot.shotNo} 首帧`, async () => {
|
||||
const result = await productionApi.generateKeyframe(shotId, input)
|
||||
if (!result || result.shotId !== shotId) throw new Error('接口未确认首帧生成结果。')
|
||||
if (!result || result.shotId !== shotId) throw new ApiError('首帧生成结果待核对。', 200)
|
||||
})
|
||||
await refreshAll()
|
||||
const cause = getOperation(projectId).cause
|
||||
if (props.projectId === projectId && props.shot.shotId === shotId) await refreshAll()
|
||||
return { accepted, cause }
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复原候选下载,只在服务明确有可恢复结果时允许。
|
||||
* @param item 当前候选
|
||||
*/
|
||||
async function recoverSavedKeyframe(item: ShotKeyframe) {
|
||||
if (assetBlocked.value || !item.canRecoverSavedResult || item.shotId !== props.shot.shotId) return
|
||||
const projectId = props.projectId
|
||||
const shotId = props.shot.shotId
|
||||
await runOperation(projectId, `恢复已生成首帧 ${item.id}`, async () => {
|
||||
const result = await productionApi.recoverSavedKeyframe(shotId, item.id)
|
||||
if (result.id !== item.id || result.shotId !== shotId || result.status !== 'completed')
|
||||
throw new Error('下载结果待核对,请刷新候选。')
|
||||
})
|
||||
if (projectId === props.projectId && shotId === props.shot.shotId) await refreshAll()
|
||||
}
|
||||
|
||||
/** 切换主首帧不调用模型,但会改变后续视频生成输入。 */
|
||||
@@ -966,6 +989,8 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:shot-id="shot.shotId"
|
||||
:review-revision="reviewRevision"
|
||||
:item="item"
|
||||
:recovering="isOperationRunning(getOperation(projectId), `恢复已生成首帧 ${item.id}`)"
|
||||
@recover="recoverSavedKeyframe(item)"
|
||||
:editing="
|
||||
editSource?.id === item.id &&
|
||||
isOperationRunning(getOperation(projectId), `编辑镜头 ${shot.shotId} 首帧`)
|
||||
@@ -1054,8 +1079,10 @@ defineExpose({ inspectSpecs, inspecting })
|
||||
:shot-title="shot.title"
|
||||
:project-id="projectId"
|
||||
:replace-primary="keyframeStale"
|
||||
:direction="shot.direction"
|
||||
:visual-state="shot.visualState"
|
||||
:disabled="!canGenerateKeyframe"
|
||||
@generate="generateKeyframe"
|
||||
:submit-generation="generateKeyframe"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user