feat(short-drama-agent-front): 完善质量规则确认与中文交互

This commit is contained in:
GJ committed 2026-10-17 22:09:28 +08:00
1 parent 190333d4f9
commit c4b43b9725
85 files changed
+2059 -480

No files matched your search

+2 -2
View File
@@ -75,9 +75,9 @@ describe('WorkflowExecution 前端契约', () => {
expect(wrapper.text()).toContain('更新时间')
wrapper.unmount()
})
it('保留未知阶段并限制真实进度范围', () => {
it('未知阶段以待确认展示且不影响真实进度范围', () => {
expect(executionStageLabel('repairing')).toBe('自动修复')
expect(executionStageLabel('new_backend_stage')).toBe('new_backend_stage')
expect(executionStageLabel('new_backend_stage')).toBe('状态待确认')
expect(executionPercentage(1, 2)).toBe(50)
expect(executionPercentage(4, 2)).toBe(100)
expect(executionPercentage(1, 0)).toBe(0)
+18 -12
View File
@@ -37,6 +37,7 @@ import { identityFixture, identityImageFixture } from '@/features/subject-identi
import { getIdentitySession } from '@/features/subject-identity/model'
import { drawerPanel, expandSections, selectControl } from '@/testing/naive'
import ProductionPage from '@/features/production/ProductionPage.vue'
import RawDataDetails from '@/components/ui/RawDataDetails.vue'
import { getProductionSession } from '@/features/production/model'
/**
@@ -353,7 +354,7 @@ describe('内容级滚动下的生产反馈', () => {
expect(wrapper.find('.workspace-tools-drawer').exists()).toBe(false)
const alert = wrapper.get('.workspace-split [role="alert"]')
expect(alert.element.closest('.workspace-tools-drawer')).toBeNull()
expect(alert.text()).toContain('无法连接后端')
expect(alert.text()).toContain('暂时无法连接服务')
})
it('回执返回时自动展开总览,部分失败诊断不会留在折叠区内', async () => {
@@ -827,7 +828,7 @@ describe('视觉风格与主体身份工作区', () => {
await new DOMWrapper(document.body).get('[aria-label="风格图片地址"]').setValue('javascript:alert(1)')
button('添加参考图').click()
await flushPromises()
expect(document.querySelector('.n-form-item-feedback--error')?.textContent).toContain('请填写有效的')
expect(document.querySelector('.n-form-item-feedback--error')?.textContent).toContain('请填写可访问的图片链接')
expect(fetcher.mock.calls.some(([, init]) => init?.method === 'POST')).toBe(false)
await new DOMWrapper(document.body).get('[aria-label="风格图片地址"]').setValue('/storage/style.png')
button('添加参考图').click()
@@ -894,7 +895,7 @@ describe('视觉风格与主体身份工作区', () => {
expect(button('确认AI 重新生成风格').disabled).toBe(true)
expect(fetcher.mock.calls.some(([, init]) => init?.method === 'POST')).toBe(false)
})
it('视觉风格首次查询为空时可人工保存,JSON 校验和锁定字段准确传递', async () => {
it('视觉风格首次查询为空时可人工保存,画面要求与锁定字段准确传递', async () => {
let style: ReturnType<typeof styleFixture> | null = null
const fetcher = vi.fn<typeof fetch>().mockImplementation(async (_url, init) => {
if (init?.method === 'PUT') style = styleFixture(JSON.parse(init.body as string))
@@ -906,12 +907,7 @@ describe('视觉风格与主体身份工作区', () => {
await expandSections()
expect(wrapper!.text()).toContain('默认采用中国人物选角基线')
expect(wrapper!.text()).toContain('人物风格与选角背景')
await wrapper!.get('#style-constraints').setValue('{"不应静默丢弃":true}')
button('保存视觉风格').click()
await flushPromises()
expect(document.querySelector('.n-form-item-feedback--error')?.textContent).toContain('JSON 字符串数组')
expect(fetcher.mock.calls.some(([, init]) => init?.method === 'PUT')).toBe(false)
await wrapper!.get('#style-constraints').setValue('["真人写实"]')
await wrapper!.get('#style-constraints').setValue('真人写实')
await wrapper!.get('#style-lock').trigger('click')
await wrapper!.get('#style-name').setValue('雨夜风格')
button('保存视觉风格').click()
@@ -1347,7 +1343,7 @@ describe('视觉风格与主体身份工作区', () => {
button('AI 生成主体身份').click()
await flushPromises()
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'POST')).toHaveLength(1)
expect(getOperation(fixture.id).error).toContain('无法连接后端')
expect(getOperation(fixture.id).error).toContain('暂时无法连接服务')
provided.data.value!.project = { ...fixture, status: 'generating' }
await flushPromises()
expect(new DOMWrapper(document.body).get('#identity-description').attributes('disabled')).toBeDefined()
@@ -1669,8 +1665,10 @@ describe('工作台页面交互', () => {
expect(wrapper.text()).toContain('图片不可用')
expect(wrapper.find('.reference-card a').exists()).toBe(false)
expect(wrapper.find('.reference-card img').exists()).toBe(false)
button('读取生成规格').click()
button('整理生成方案').click()
await flushPromises()
expect(wrapper.find('pre').exists()).toBe(false)
await wrapper.getComponent(RawDataDetails).get('.n-collapse-item__header-main').trigger('click')
expect(wrapper.get('pre').text()).toContain('form-db')
expect(wrapper.get('pre').text()).toContain('地面积水')
expect(fetcher.mock.calls[2]?.[0]).toBe('/api/storyboard-shots/shot-db-1-1/generation-spec')
@@ -1971,7 +1969,7 @@ describe('工作台页面交互', () => {
)
await flushPromises()
expect(wrapper.text()).not.toContain('旧镜头人物')
expect(button('读取生成规格').disabled).toBe(true)
expect(button('整理生成方案').disabled).toBe(true)
})
it('提示词必须确认才 POST,使用正式 Shot ID,返回内容以纯文本显示', async () => {
@@ -2083,6 +2081,9 @@ describe('工作台页面交互', () => {
return new Response(
'{"data":{"episodeCount":1,"groupCount":1,"estimatedTaskCount":3,"groups":[],"tasks":[],"modules":["character","scene","prop"],"groupSize":2}}'
)
if (String(url).includes('quality-policy')) return new Response(JSON.stringify({ data: { projectId: 'page-test-project', policy: {
version: 1, physicsMode: 'realistic', allowExaggeratedMotion: false, allowNonPhysicalActions: false, allowSupernaturalAbilities: false, customRules: []
} } }))
return new Response('{"data":{"workflowExecution":{"status":"completed"}}}')
})
stubFetch(fetcher)
@@ -2101,6 +2102,11 @@ describe('工作台页面交互', () => {
await flushPromises()
button('生成拆解候选').click()
await flushPromises()
const acknowledgement = Array.from(document.querySelectorAll<HTMLElement>('[role="checkbox"]')).find(input => input.textContent?.includes('我已核对'))!
acknowledgement.click()
await flushPromises()
button('确认规则并继续').click()
await flushPromises()
button('确认生成拆解候选').click()
await flushPromises()
const post = fetcher.mock.calls.find(call => call[1]?.method === 'POST')