feat(short-drama-agent-front): 接入草案、首帧证据与审核继续
This commit is contained in:
1 parent
751106985e
commit
d0264c08ce
23 files changed
+990
-170
No files matched your search
@@ -114,40 +114,45 @@ describe('正式首帧 Vision 的费用与恢复边界', () => {
|
||||
expect(fetcher.mock.calls.filter(([, options]) => options?.method === 'POST')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('有正式可继续结论时使用原文字显式提交,保留已完成步骤', async () => {
|
||||
let accepted = 0
|
||||
const saved = history('failed', { recoveryRequired: false, resumeAvailable: true })
|
||||
it('新会话从正式历史恢复任务,只显式发送任务和指纹', async () => {
|
||||
const fingerprint = 'f'.repeat(64)
|
||||
const saved = {
|
||||
...history('failed'),
|
||||
allowedTexts: ['旧门牌'],
|
||||
requestFingerprint: fingerprint,
|
||||
recoveryRequired: false,
|
||||
resumeAvailable: true
|
||||
}
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (_url, options) => {
|
||||
if (options?.method === 'POST') {
|
||||
accepted++
|
||||
if (options?.method === 'POST')
|
||||
return response(
|
||||
{
|
||||
shotId,
|
||||
keyframeId: assetId,
|
||||
validationTaskId: taskId,
|
||||
executionId: accepted === 1 ? executionId : 'resume-execution',
|
||||
executionId: 'resume-execution',
|
||||
status: 'pending'
|
||||
},
|
||||
202
|
||||
)
|
||||
}
|
||||
return response([saved])
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
await submitKeyframeVision(shotId, assetId, ['旧门牌'], [])
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.resumeTexts.value).toEqual(['旧门牌'])
|
||||
const resume = { resumeValidationTaskId: taskId, expectedRequestFingerprint: fingerprint }
|
||||
expect(vision.resume.value).toEqual(resume)
|
||||
expect(vision.state.value.resumable?.steps?.map(item => item.status)).toEqual(['completed', 'received'])
|
||||
await expect(submitKeyframeVision(shotId, assetId, ['新门牌'], [saved])).rejects.toThrow('原审核参数')
|
||||
expect(accepted).toBe(1)
|
||||
await submitKeyframeVision(shotId, assetId, ['旧门牌'], [saved])
|
||||
expect(accepted).toBe(2)
|
||||
expect(
|
||||
fetcher.mock.calls
|
||||
.filter(([, options]) => options?.method === 'POST')
|
||||
.map(([, options]) => JSON.parse(String(options?.body)))
|
||||
).toEqual([{ allowedTexts: ['旧门牌'] }, { allowedTexts: ['旧门牌'] }])
|
||||
await expect(submitKeyframeVision(shotId, assetId, ['新门牌'], [saved])).rejects.toThrow('继续原审核')
|
||||
await expect(
|
||||
submitKeyframeVision(shotId, assetId, { ...resume, expectedRequestFingerprint: 'a'.repeat(64) }, [saved])
|
||||
).rejects.toThrow('任务状态已变化')
|
||||
expect(fetcher.mock.calls.filter(([, options]) => options?.method === 'POST')).toHaveLength(0)
|
||||
await submitKeyframeVision(shotId, assetId, resume, [saved], 'project/1')
|
||||
const writes = fetcher.mock.calls.filter(([, options]) => options?.method === 'POST')
|
||||
expect(writes).toHaveLength(1)
|
||||
expect(String(writes[0]?.[0])).toContain('?projectId=project%2F1')
|
||||
expect(JSON.parse(String(writes[0]?.[1]?.body))).toEqual(resume)
|
||||
})
|
||||
|
||||
it('409 活动审核只观察原编号,不能把当前表单参数当作原参数', async () => {
|
||||
@@ -168,7 +173,7 @@ describe('正式首帧 Vision 的费用与恢复边界', () => {
|
||||
const vision = observe()
|
||||
await flushPromises()
|
||||
expect(vision.execution.data.value?.id).toBe(executionId)
|
||||
expect(vision.resumeTexts.value).toBeNull()
|
||||
expect(vision.resume.value).toBeNull()
|
||||
expect(vision.blocked.value).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user