This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
export {
|
||||
listSquareHoleHistoryAssets,
|
||||
squareHoleAssetClient,
|
||||
type SquareHoleHistoryAsset,
|
||||
type SquareHoleImageAssetKind,
|
||||
} from './squareHoleAssetClient';
|
||||
export {
|
||||
deleteSquareHoleWork,
|
||||
getSquareHoleWorkDetail,
|
||||
listSquareHoleGallery,
|
||||
listSquareHoleWorks,
|
||||
publishSquareHoleWork,
|
||||
regenerateSquareHoleWorkImage,
|
||||
squareHoleWorksClient,
|
||||
updateSquareHoleWork,
|
||||
} from './squareHoleWorksClient';
|
||||
|
||||
46
src/services/square-hole-works/squareHoleAssetClient.ts
Normal file
46
src/services/square-hole-works/squareHoleAssetClient.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { ASSET_API_PATHS } from '../../editor/shared/editorApiClient';
|
||||
import { requestJson } from '../apiClient';
|
||||
|
||||
export type SquareHoleImageAssetKind =
|
||||
| 'square_hole_cover_image'
|
||||
| 'square_hole_background_image'
|
||||
| 'square_hole_shape_image'
|
||||
| 'square_hole_hole_image';
|
||||
|
||||
export type SquareHoleHistoryAsset = {
|
||||
assetObjectId: string;
|
||||
assetKind: SquareHoleImageAssetKind;
|
||||
imageSrc: string;
|
||||
ownerUserId?: string | null;
|
||||
ownerLabel: string;
|
||||
profileId?: string | null;
|
||||
entityId?: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* 读取当前账号的方洞图片历史素材。
|
||||
* 素材由后端图片生成链路写入正式资产索引,前端只负责按槽位展示和套用。
|
||||
*/
|
||||
export async function listSquareHoleHistoryAssets(payload: {
|
||||
kind: SquareHoleImageAssetKind;
|
||||
limit?: number;
|
||||
}) {
|
||||
const params = new URLSearchParams({ kind: payload.kind });
|
||||
if (payload.limit) {
|
||||
params.set('limit', String(payload.limit));
|
||||
}
|
||||
|
||||
const response = await requestJson<{ assets: SquareHoleHistoryAsset[] }>(
|
||||
`${ASSET_API_PATHS.assetHistory}?${params.toString()}`,
|
||||
{ method: 'GET' },
|
||||
'读取方洞历史图片失败',
|
||||
);
|
||||
|
||||
return response.assets;
|
||||
}
|
||||
|
||||
export const squareHoleAssetClient = {
|
||||
listHistoryAssets: listSquareHoleHistoryAssets,
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
PutSquareHoleWorkRequest,
|
||||
RegenerateSquareHoleWorkImageRequest,
|
||||
SquareHoleWorkDetailResponse,
|
||||
SquareHoleWorkMutationResponse,
|
||||
SquareHoleWorksResponse,
|
||||
@@ -91,6 +92,25 @@ export function publishSquareHoleWork(profileId: string) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 只重生成某一个方洞挑战图片槽位,不触发 Agent 草稿编译或整稿图片生成进度页。
|
||||
*/
|
||||
export function regenerateSquareHoleWorkImage(
|
||||
profileId: string,
|
||||
payload: RegenerateSquareHoleWorkImageRequest,
|
||||
) {
|
||||
return requestJson<SquareHoleWorkMutationResponse>(
|
||||
`${SQUARE_HOLE_WORKS_API_BASE}/${encodeURIComponent(profileId)}/images/regenerate`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
},
|
||||
'生成方洞挑战图片失败',
|
||||
{ retry: SQUARE_HOLE_WORKS_WRITE_RETRY },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前用户的方洞挑战作品,并返回删除后的列表。
|
||||
*/
|
||||
@@ -109,5 +129,6 @@ export const squareHoleWorksClient = {
|
||||
listGallery: listSquareHoleGallery,
|
||||
list: listSquareHoleWorks,
|
||||
publish: publishSquareHoleWork,
|
||||
regenerateImage: regenerateSquareHoleWorkImage,
|
||||
update: updateSquareHoleWork,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user