feat(short-drama-agent-front): 接入有限图片授权与候选修订
This commit is contained in:
1 parent
f6edc4eb70
commit
b15a6011ce
37 files changed
+3569
-76
No files matched your search
@@ -540,7 +540,7 @@ describe('质量面板渐进展示', () => {
|
||||
expect(data.fetcher).not.toHaveBeenCalled()
|
||||
await wrapper.get('button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('qwen-image · 当前启用')
|
||||
expect(wrapper.text()).toContain('qwen-image · 默认推荐')
|
||||
expect(wrapper.text()).toContain('最多 3 张参考图')
|
||||
expect(data.posts()).toHaveLength(0)
|
||||
})
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import ModelCapabilities from '@/features/production/components/ModelCapabilities.vue'
|
||||
import KeyframePreviewChecks from '@/features/production/components/KeyframePreviewChecks.vue'
|
||||
import KeyframeCard from '@/features/production/components/KeyframeCard.vue'
|
||||
import KeyframeValidationHistory from '@/features/production/components/KeyframeValidationHistory.vue'
|
||||
import { additionalImageFixture } from '../../fixtures/image-additional'
|
||||
import { AssetImage } from '@/components/ui'
|
||||
import { keyframeFixture } from '@/features/production/testing/fixtures'
|
||||
import { imagePreviewFixture } from '../../fixtures/image-preview'
|
||||
|
||||
describe('V8-10免费输入与独立门禁', () => {
|
||||
it('旧图片按需查看原费用与来源,切换项目/候选后不混入其它记录或未执行计划', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>(async url => {
|
||||
const path = String(url)
|
||||
if (path.endsWith('/image-authorizations')) {
|
||||
const projectId = path.includes('/second-project/') ? 'second-project' : 'original-project',
|
||||
list = additionalImageFixture(projectId)
|
||||
list.requests[0]!.input.targetId = 'history-shot'
|
||||
list.requests[0]!.input.candidateId = projectId === 'second-project' ? 'second-image' : 'old-image'
|
||||
list.requests.push({
|
||||
...structuredClone(list.requests[0]!),
|
||||
id: 'another-candidate-request',
|
||||
input: { ...list.requests[0]!.input, candidateId: 'unrelated-image' }
|
||||
})
|
||||
return Response.json({ data: list })
|
||||
}
|
||||
return Response.json({
|
||||
data: path.includes('/quality-review')
|
||||
? {
|
||||
shotId: 'history-shot',
|
||||
keyframeId: 'old-image',
|
||||
qualityDecision: 'failed',
|
||||
effectiveQualityStatus: 'stale',
|
||||
validationTaskId: null,
|
||||
historicalGazePreview: [],
|
||||
manualReview: null,
|
||||
manualReviewAvailable: false
|
||||
}
|
||||
: []
|
||||
})
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const wrapper = mount(KeyframeValidationHistory, {
|
||||
props: {
|
||||
projectId: 'original-project',
|
||||
shotId: 'history-shot',
|
||||
keyframeId: 'old-image',
|
||||
initialOpen: true,
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
try {
|
||||
await flushPromises()
|
||||
expect(fetcher.mock.calls.some(([url]) => String(url).endsWith('/image-authorizations'))).toBe(false)
|
||||
await wrapper
|
||||
.findAll('.n-collapse-item__header-main')
|
||||
.find(row => row.text() === '原图片生成来源与费用')!
|
||||
.trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('原预留 USD 0.5')
|
||||
expect(wrapper.text()).toContain('实际账单 未知')
|
||||
expect(wrapper.text()).toContain('历史审核未通过,当前来源已变化')
|
||||
expect(wrapper.text()).not.toContain('another-candidate-request')
|
||||
await wrapper.setProps({ projectId: 'second-project', keyframeId: 'second-image' })
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).not.toContain('原预留 USD 0.5')
|
||||
await wrapper
|
||||
.findAll('.n-collapse-item__header-main')
|
||||
.find(row => row.text() === '原图片生成来源与费用')!
|
||||
.trigger('click')
|
||||
await flushPromises()
|
||||
expect(
|
||||
fetcher.mock.calls.some(([url]) => String(url) === '/api/projects/second-project/image-authorizations')
|
||||
).toBe(true)
|
||||
expect(fetcher.mock.calls.every(([, init]) => !init?.method || init.method === 'GET')).toBe(true)
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
})
|
||||
it.each(['failed', 'passed'] as const)(
|
||||
'保留原机器%s、当前stale及已有Primary图,不允许旧通过晋升',
|
||||
async machine => {
|
||||
const fetcher = vi.fn<typeof fetch>(async url =>
|
||||
Response.json({
|
||||
data: String(url).includes('/quality-review')
|
||||
? {
|
||||
shotId: 'quality-shot',
|
||||
keyframeId: 'old-image',
|
||||
qualityDecision: machine,
|
||||
effectiveQualityStatus: 'stale',
|
||||
validationTaskId: 'original-machine-task',
|
||||
manualReviewAvailable: false,
|
||||
historicalGazePreview: [],
|
||||
manualReview: null
|
||||
}
|
||||
: []
|
||||
})
|
||||
)
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const wrapper = mount(KeyframeCard, {
|
||||
props: {
|
||||
item: keyframeFixture({
|
||||
id: 'old-image',
|
||||
shotId: 'quality-shot',
|
||||
isPrimary: true,
|
||||
imageUrl: '/mock.png'
|
||||
}),
|
||||
projectId: 'quality-project',
|
||||
shotId: 'quality-shot',
|
||||
shotNo: 1,
|
||||
stale: false,
|
||||
blocked: true,
|
||||
validationPassed: true,
|
||||
confirming: false,
|
||||
readonly: true
|
||||
}
|
||||
})
|
||||
try {
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain(
|
||||
machine === 'failed' ? '历史审核未通过,当前来源已变化' : '历史审核通过,当前来源已变化'
|
||||
)
|
||||
expect(wrapper.text()).toContain('主首帧')
|
||||
expect(wrapper.getComponent(AssetImage).props('src')).toBe('/mock.png')
|
||||
expect(wrapper.text()).not.toContain('质量通过')
|
||||
expect(wrapper.text()).not.toContain('设为主首帧')
|
||||
expect(wrapper.findAll('button').some(row => row.attributes('aria-label') === '质量检查')).toBe(false)
|
||||
expect(fetcher.mock.calls.every(([, input]) => !input?.method || input.method === 'GET')).toBe(true)
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
}
|
||||
)
|
||||
it('同一Provider再次检查容量409时清除旧成功记录,保留实际阻断与模型限制', async () => {
|
||||
let blocked = false
|
||||
const fetcher = vi.fn<typeof fetch>(async url => {
|
||||
if (String(url).endsWith('/image-providers/capabilities'))
|
||||
return Response.json({
|
||||
data: [
|
||||
{
|
||||
provider: 'test-provider',
|
||||
active: true,
|
||||
capabilities: { references: { supported: true, maxReferenceImages: 3 } }
|
||||
}
|
||||
]
|
||||
})
|
||||
return blocked
|
||||
? Response.json(
|
||||
{
|
||||
code: 'IMAGE_REFERENCE_CAPACITY_EXCEEDED',
|
||||
message: '必需参考实际需要6张,当前Provider限制3张',
|
||||
details: { code: 'IMAGE_REFERENCE_CAPACITY_EXCEEDED' }
|
||||
},
|
||||
{ status: 409 }
|
||||
)
|
||||
: Response.json({
|
||||
data: {
|
||||
provider: 'test-provider',
|
||||
valid: true,
|
||||
referenceCount: 7,
|
||||
maxReferenceImages: 3,
|
||||
plannedReferenceCount: 3,
|
||||
omittedReferenceCount: 4,
|
||||
requiresPlanning: true,
|
||||
strategy: 'all'
|
||||
}
|
||||
})
|
||||
})
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const wrapper = mount(ModelCapabilities, { props: { shotId: 'capacity-shot', provider: 'test-provider' } })
|
||||
try {
|
||||
await wrapper.get('button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('本次计划输入 3 张')
|
||||
blocked = true
|
||||
await wrapper.get('button').trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('必需参考实际需要6张')
|
||||
expect(wrapper.text()).toContain('最多 3 张参考图')
|
||||
expect(wrapper.text()).not.toContain('本次计划输入 3 张')
|
||||
expect(wrapper.get('button').attributes('disabled')).toBeUndefined()
|
||||
expect(fetcher.mock.calls.every(([, input]) => !input?.method || input.method === 'GET')).toBe(true)
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
})
|
||||
it('已确认规划只解释场景衔接,真实视频末态仍未验证且其它阻断继续展示', () => {
|
||||
const base = imagePreviewFixture()
|
||||
const wrapper = mount(KeyframePreviewChecks, {
|
||||
props: {
|
||||
preview: {
|
||||
...base,
|
||||
generationConfig: { options: {} },
|
||||
continuity: {
|
||||
previousShotId: 'previous',
|
||||
sameScene: true,
|
||||
previousClosingState: null,
|
||||
subjects: [],
|
||||
reviewIssues: [{ code: 'character_form_transition_unconfirmed', subjectRef: '@CH0001' }],
|
||||
sceneTransition: {
|
||||
previousShotId: 'previous',
|
||||
subjectRef: '@SC0001',
|
||||
subjectFormId: 'form',
|
||||
basis: 'confirmed_plan',
|
||||
fingerprint: 'a'.repeat(64),
|
||||
requestFingerprint: 'b'.repeat(64),
|
||||
verifiedVideoEndState: false
|
||||
}
|
||||
},
|
||||
specConsistencySummary: {
|
||||
blocking: true,
|
||||
warningCount: 0,
|
||||
hasWarnings: false,
|
||||
requiresManualReview: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
try {
|
||||
expect(wrapper.text()).toContain('人工规划衔接已确认,视频末态尚未验证')
|
||||
expect(wrapper.text()).toContain('暂不能生成')
|
||||
expect(wrapper.text()).toContain('角色形态变化待确认')
|
||||
expect(wrapper.text()).not.toContain('质量通过')
|
||||
} finally {
|
||||
wrapper.unmount()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user