This commit is contained in:
2026-05-13 00:28:07 +08:00
parent ef4f91a75e
commit 01c5ab985a
101 changed files with 10635 additions and 2292 deletions

View File

@@ -1,9 +1,17 @@
import type {
GenerateMatch3DBackgroundImageRequest,
GenerateMatch3DBackgroundImageResponse,
GenerateMatch3DCoverImageRequest,
GenerateMatch3DCoverImageResponse,
GenerateMatch3DItemAssetsRequest,
GenerateMatch3DItemAssetsResponse,
GenerateMatch3DWorkTagsRequest,
GenerateMatch3DWorkTagsResponse,
Match3DWorkDetailResponse,
Match3DWorkMutationResponse,
Match3DWorksResponse,
PersistMatch3DGeneratedModelRequest,
PersistMatch3DGeneratedModelResponse,
PutMatch3DAudioAssetsRequest,
PutMatch3DWorkRequest,
} from '../../../packages/shared/src/contracts/match3dWorks';
@@ -103,10 +111,100 @@ export function updateMatch3DGeneratedItemAssets(
export const updateMatch3DAudioAssets = updateMatch3DGeneratedItemAssets;
/**
* 将历史外部 GLB 链接转存为抓大鹅私有模型资产;新草稿不再调用。
*/
export function persistMatch3DGeneratedModel(
profileId: string,
payload: PersistMatch3DGeneratedModelRequest,
) {
return requestJson<PersistMatch3DGeneratedModelResponse>(
`${MATCH3D_WORKS_API_BASE}/${encodeURIComponent(profileId)}/generated-models`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'保存抓大鹅历史模型失败',
{
retry: MATCH3D_WORKS_WRITE_RETRY,
timeoutMs: 240_000,
},
);
}
/**
* 生成并保存抓大鹅作品封面图。
*/
export function generateMatch3DCoverImage(
profileId: string,
payload: GenerateMatch3DCoverImageRequest,
) {
return requestJson<GenerateMatch3DCoverImageResponse>(
`${MATCH3D_WORKS_API_BASE}/${encodeURIComponent(profileId)}/cover-image`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'生成抓大鹅封面图失败',
{
retry: MATCH3D_WORKS_WRITE_RETRY,
timeoutMs: 240_000,
},
);
}
/**
* 按画面描述重新生成并保存抓大鹅局内 UI 背景图。
*/
export function generateMatch3DBackgroundImage(
profileId: string,
payload: GenerateMatch3DBackgroundImageRequest,
) {
return requestJson<GenerateMatch3DBackgroundImageResponse>(
`${MATCH3D_WORKS_API_BASE}/${encodeURIComponent(profileId)}/background-image`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'生成抓大鹅背景图失败',
{
retry: MATCH3D_WORKS_WRITE_RETRY,
timeoutMs: 240_000,
},
);
}
/**
* 按名称批量生成抓大鹅 2D 五视角物品图片。
*/
export function generateMatch3DItemAssets(
profileId: string,
payload: GenerateMatch3DItemAssetsRequest,
) {
return requestJson<GenerateMatch3DItemAssetsResponse>(
`${MATCH3D_WORKS_API_BASE}/${encodeURIComponent(profileId)}/item-assets`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'生成抓大鹅物品素材失败',
{
retry: MATCH3D_WORKS_WRITE_RETRY,
timeoutMs: 20 * 60 * 1000,
},
);
}
/**
* 根据当前作品名称与题材生成发布标签。
*/
export function generateMatch3DWorkTags(payload: GenerateMatch3DWorkTagsRequest) {
export function generateMatch3DWorkTags(
payload: GenerateMatch3DWorkTagsRequest,
) {
return requestJson<GenerateMatch3DWorkTagsResponse>(
`${MATCH3D_WORKS_API_BASE}/tags`,
{
@@ -145,10 +243,14 @@ export function deleteMatch3DWork(profileId: string) {
export const match3dWorksClient = {
delete: deleteMatch3DWork,
generateBackgroundImage: generateMatch3DBackgroundImage,
generateCoverImage: generateMatch3DCoverImage,
generateItemAssets: generateMatch3DItemAssets,
generateTags: generateMatch3DWorkTags,
getDetail: getMatch3DWorkDetail,
listGallery: listMatch3DGallery,
list: listMatch3DWorks,
persistGeneratedModel: persistMatch3DGeneratedModel,
publish: publishMatch3DWork,
updateAudioAssets: updateMatch3DAudioAssets,
updateGeneratedItemAssets: updateMatch3DGeneratedItemAssets,