修复生成确认与素材导出

补齐外部生成确认请求的 JSON Content-Type

本地屏蔽已确认终态任务避免轮询重复弹窗

单素材导出改为读取 Blob 后触发浏览器下载

序列帧导出按 frame objectKey 换签读取
This commit is contained in:
2026-06-24 20:35:03 +08:00
parent b6c5fdeb30
commit db056423de
7 changed files with 250 additions and 50 deletions
@@ -0,0 +1,35 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { requestJson } from '../apiClient';
import { acknowledgeExternalGenerationTasks } from './externalGenerationClient';
vi.mock('../apiClient', () => ({
BACKGROUND_AUTH_REQUEST_OPTIONS: {
skipAuth: false,
},
requestJson: vi.fn(),
}));
const requestJsonMock = vi.mocked(requestJson);
describe('externalGenerationClient', () => {
beforeEach(() => {
requestJsonMock.mockReset();
requestJsonMock.mockResolvedValue({ acknowledgedTasks: [] });
});
it('posts acknowledge requests as JSON', async () => {
await acknowledgeExternalGenerationTasks({ jobIds: ['job-1'] });
expect(requestJsonMock).toHaveBeenCalledWith(
'/api/runtime/external-generation/jobs/acknowledge',
expect.objectContaining({
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ jobIds: ['job-1'] }),
}),
'确认生成任务通知失败',
expect.any(Object),
);
});
});
@@ -83,6 +83,7 @@ export async function acknowledgeExternalGenerationTasks(
`${EXTERNAL_GENERATION_API_BASE}/jobs/acknowledge`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
signal,
},