收紧生成任务轮询与资产读取路径

空生成任务列表不再保持四秒轮询

读取资源字节优先通过read-url直连OSS

保留read-bytes作为OSS读取失败兜底

更新资产导出与项目记忆文档口径
This commit is contained in:
2026-06-25 23:01:24 +08:00
parent a61e604921
commit c5295a619c
9 changed files with 387 additions and 47 deletions
@@ -27,14 +27,29 @@ describe('match3dGeneratedModelCache', () => {
test('预加载生成模型字节并复用本地缓存', async () => {
setStoredAccessToken('test-access-token', { emit: false });
vi.spyOn(globalThis, 'fetch').mockResolvedValue(
new Response(new Uint8Array([103, 108, 84, 70]), {
status: 200,
headers: {
'Content-Type': 'model/gltf-binary',
},
}),
);
vi.spyOn(globalThis, 'fetch')
.mockResolvedValueOnce(
new Response(
JSON.stringify({
read: {
signedUrl: 'https://oss.example.com/model.glb',
expiresAt: new Date(Date.now() + 60_000).toISOString(),
},
}),
{
status: 200,
headers: { 'Content-Type': 'application/json' },
},
),
)
.mockResolvedValueOnce(
new Response(new Uint8Array([103, 108, 84, 70]), {
status: 200,
headers: {
'Content-Type': 'model/gltf-binary',
},
}),
);
await preloadMatch3DGeneratedModelAssets(
[
@@ -61,7 +76,13 @@ describe('match3dGeneratedModelCache', () => {
);
expect(Array.from(new Uint8Array(bytes))).toEqual([103, 108, 84, 70]);
expect(globalThis.fetch).toHaveBeenCalledTimes(1);
expect(globalThis.fetch).toHaveBeenCalledTimes(2);
expect(String(vi.mocked(globalThis.fetch).mock.calls[0]?.[0])).toContain(
'/api/assets/read-url',
);
expect(String(vi.mocked(globalThis.fetch).mock.calls[1]?.[0])).toBe(
'https://oss.example.com/model.glb',
);
});
test('模型源列表会去重并兼容 modelObjectKey', () => {