feat(assets): 素材库与画布 - 新增可交互通用文件夹

This commit is contained in:
echoD886
2026-08-20 15:16:45 +08:00
parent 9ee71d4650
commit 935108edca
35 changed files with 2010 additions and 155 deletions

View File

@@ -56,10 +56,25 @@ export type ProjectAsset = {
primaryVersionId?: string;
versionCount: number;
usages: string[];
folderId?: string;
position: number;
storageKey?: string;
previewText?: string;
updatedAt: string;
character?: CharacterCardSummary;
};
export type ProjectAssetFolder = {
id: string;
projectId: string;
parentId?: string;
name: string;
style: "glass" | "stacked" | "midnight" | "paper" | "cinema" | "compact" | string;
position: number;
createdAt: string;
updatedAt: string;
};
export type CharacterRepresentation = {
id: string;
resourceId: string;
@@ -160,6 +175,7 @@ export type ProjectDetail = {
canvases: ProjectCanvas[];
canvasUnitLinks: CanvasUnitLink[];
assets: ProjectAsset[];
assetFolders: ProjectAssetFolder[];
workflows: ProjectWorkflow[];
shots: ProjectShot[];
shotReferences: ShotAssetReference[];
@@ -222,7 +238,7 @@ export function unlinkCanvasProject(projectId: string, canvasId: string) {
return request<{ canvasId: string }>(api.delete(`/projects/${encodeURIComponent(projectId)}/canvases/${encodeURIComponent(canvasId)}`));
}
export function linkProjectAsset(projectId: string, input: { assetId: string; category: string }, signal?: AbortSignal) {
export function linkProjectAsset(projectId: string, input: { assetId: string; category: string; folderId?: string }, signal?: AbortSignal) {
return request<{ asset: ProjectAsset }>(api.post(`/projects/${encodeURIComponent(projectId)}/assets`, input, { signal }));
}
@@ -234,6 +250,26 @@ export function updateProjectAssetCategory(projectId: string, assetId: string, c
return request<{ asset: ProjectAsset }>(api.patch(`/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`, { category }, { signal }));
}
export function moveProjectAsset(projectId: string, assetId: string, folderId: string, signal?: AbortSignal) {
return request<{ asset: ProjectAsset }>(api.patch(`/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}`, { folderId }, { signal }));
}
export function listProjectAssetFolders(projectId: string, signal?: AbortSignal) {
return request<{ folders: ProjectAssetFolder[] }>(api.get(`/projects/${encodeURIComponent(projectId)}/asset-folders`, { signal }));
}
export function createProjectAssetFolder(projectId: string, input: { name: string; parentId?: string; style?: ProjectAssetFolder["style"] }) {
return request<{ folder: ProjectAssetFolder }>(api.post(`/projects/${encodeURIComponent(projectId)}/asset-folders`, input));
}
export function updateProjectAssetFolder(projectId: string, folderId: string, input: { name?: string; parentId?: string; style?: ProjectAssetFolder["style"] }) {
return request<{ folder: ProjectAssetFolder }>(api.patch(`/projects/${encodeURIComponent(projectId)}/asset-folders/${encodeURIComponent(folderId)}`, input));
}
export function deleteProjectAssetFolder(projectId: string, folderId: string) {
return request<{ id: string }>(api.delete(`/projects/${encodeURIComponent(projectId)}/asset-folders/${encodeURIComponent(folderId)}`));
}
export function createProjectAssetVersion(projectId: string, assetId: string, input: { prompt?: string; definitionJson?: string; note?: string }) {
return request<{ version: { id: string; assetId: string; version: number; status: string } }>(api.post(`/projects/${encodeURIComponent(projectId)}/assets/${encodeURIComponent(assetId)}/versions`, input));
}