init with react+axum+spacetimedb
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-26 18:06:23 +08:00
commit cbc27bad4a
20199 changed files with 883714 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
import { requestJson } from './apiClient';
import type { CustomWorldCoverCropRect, CustomWorldProfile } from '../types';
const CUSTOM_WORLD_COVER_API_BASE = '/api/runtime/custom-world';
export interface CustomWorldCoverAssetResult {
imageSrc: string;
assetId: string;
sourceType: 'uploaded' | 'generated';
model?: string;
size?: string;
taskId?: string;
prompt?: string;
actualPrompt?: string;
}
export interface GenerateCustomWorldCoverImageRequest {
profile: CustomWorldProfile;
userPrompt?: string;
referenceImageSrc?: string;
characterRoleIds?: string[];
size?: string;
}
export interface UploadCustomWorldCoverImageRequest {
profileId: string;
worldName: string;
imageDataUrl: string;
cropRect: CustomWorldCoverCropRect;
}
export async function generateCustomWorldCoverImage(
payload: GenerateCustomWorldCoverImageRequest,
) {
return requestJson<CustomWorldCoverAssetResult>(
`${CUSTOM_WORLD_COVER_API_BASE}/cover-image`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'生成作品封面失败',
);
}
export async function uploadCustomWorldCoverImage(
payload: UploadCustomWorldCoverImageRequest,
) {
return requestJson<CustomWorldCoverAssetResult>(
`${CUSTOM_WORLD_COVER_API_BASE}/cover-upload`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
},
'上传作品封面失败',
);
}