feat: 同步最新生图与身份能力

This commit is contained in:
GouJ
2026-09-22 19:56:12 +08:00
parent 65e8f9c3ba
commit be06caaa9f
18 changed files with 583 additions and 69 deletions
@@ -70,6 +70,41 @@ describe('形态图片选择与操作', () => {
expect(document.body.textContent).toContain('母版')
expect(document.body.textContent).not.toContain('道具形态生图暂不自动引用')
})
it('按需预览正式形态的实际参考图和 Provider Prompt,不触发生图事件', async () => {
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(
new Response(
JSON.stringify({
data: {
subjectFormId: 'form-db-1',
provider: 'seedream',
model: 'image-model',
generationConfig: { width: 2048 },
references: [
{
imageNumber: 1,
role: 'identity-anchor',
imageId: 'anchor-1',
imageUrl: '/storage/anchor.png'
}
],
providerPrompt: '最终形态 Prompt'
}
})
)
)
vi.stubGlobal('fetch', fetcher)
wrapper = mount(GenerateImageDialog, {
attachTo: document.body,
props: { open: true, form: formFixture(), disabled: false }
})
await flushPromises()
button('预览实际生成输入').click()
await flushPromises()
expect(fetcher.mock.calls[0]?.[0]).toBe('/api/subject-forms/form-db-1/images/preview')
expect(document.body.textContent).toContain('seedream / image-model')
expect(document.body.textContent).toContain('最终形态 Prompt')
expect(wrapper.emitted('generate')).toBeUndefined()
})
it('已有主图优先于新候选图和失败记录,无主图才回退到成功候选图', () => {
const form = formFixture()
form.images.unshift(