387a1c26e3
清理已跟踪原始日志与个人本地配置 修复前后端有效门禁、测试和构建问题 补齐生产 Jenkins、SpacetimeDB 本地命令与文档约束 收紧图片编辑器状态、附件与媒体引用测试 排除已下线旧创作入口测试并清理 warning
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import type { CustomWorldCoverCropRect, CustomWorldProfile } from '../types';
|
|
import { requestJson } from './apiClient';
|
|
|
|
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),
|
|
},
|
|
'上传作品封面失败',
|
|
);
|
|
}
|