feat: initial release v0.3.0

This commit is contained in:
saturn
2026-03-08 03:15:27 +08:00
commit 881ed44996
1311 changed files with 225407 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest'
import { usePanelTaskStatus } from '@/app/[locale]/workspace/[projectId]/modes/novel-promotion/components/video/panel-card/runtime/hooks/usePanelTaskStatus'
describe('panel task status error code mapping', () => {
it('uses explicit error code for user-facing panel error display', () => {
const result = usePanelTaskStatus({
panel: {
storyboardId: 'sb-1',
panelIndex: 0,
videoErrorCode: 'EXTERNAL_ERROR',
videoErrorMessage: 'raw upstream message',
},
hasVisibleBaseVideo: false,
tCommon: (key) => key,
})
expect(result.panelErrorDisplay?.code).toBe('EXTERNAL_ERROR')
expect(result.panelErrorDisplay?.message).toBe('raw upstream message')
})
it('shows fixed unsupported-format message for VIDEO_API_FORMAT_UNSUPPORTED', () => {
const result = usePanelTaskStatus({
panel: {
storyboardId: 'sb-1',
panelIndex: 0,
videoErrorCode: 'VIDEO_API_FORMAT_UNSUPPORTED',
videoErrorMessage: 'VIDEO_API_FORMAT_UNSUPPORTED: OPENAI_COMPAT_VIDEO_TEMPLATE_TASK_ID_NOT_FOUND',
},
hasVisibleBaseVideo: false,
tCommon: (key) => key,
})
expect(result.panelErrorDisplay?.code).toBe('VIDEO_API_FORMAT_UNSUPPORTED')
expect(result.panelErrorDisplay?.message).toBe('当前视频接口格式暂不支持。')
})
})