修复编辑器登录和背景设置回归

恢复编辑器接口 401 / 403 触发登录弹窗

补齐未登录上传登录后续传和上传失败提示

恢复画布背景设置面板并支持预设色、自定义颜色、HEX 输入和默认恢复

补充编辑器回归测试和 TRACKING 验证记录
This commit is contained in:
2026-06-16 23:31:42 +08:00
parent da7388240e
commit f993651b5c
6 changed files with 3642 additions and 351 deletions
@@ -61,10 +61,6 @@ describe('editorProjectClient', () => {
'/api/editor/projects/recent',
{ method: 'GET' },
'读取图片画布工程失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -102,10 +98,6 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ title: '未命名画布' }),
}),
'创建图片画布工程失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -151,10 +143,6 @@ describe('editorProjectClient', () => {
}),
}),
'保存图片画布工程失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -187,10 +175,6 @@ describe('editorProjectClient', () => {
'/api/editor/projects',
{ method: 'GET' },
'读取图片画布工程列表失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -221,10 +205,6 @@ describe('editorProjectClient', () => {
'/api/editor/projects/editor-project-1',
{ method: 'GET' },
'读取图片画布工程失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -262,14 +242,12 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ title: '新标题' }),
}),
'重命名图片画布工程失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
2,
'/api/editor/projects/editor-project-1',
{ method: 'DELETE' },
'删除图片画布工程失败',
expect.any(Object),
);
});
@@ -316,10 +294,6 @@ describe('editorProjectClient', () => {
}),
}),
'创建图片画布资源失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -377,7 +351,6 @@ describe('editorProjectClient', () => {
'/api/editor/assets/library',
{ method: 'GET' },
'读取图片画布素材库失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
2,
@@ -387,7 +360,6 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ label: '角色', sortOrder: 100 }),
}),
'创建图片画布素材文件夹失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
3,
@@ -397,14 +369,12 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ label: '角色参考', collapsed: true }),
}),
'更新图片画布素材文件夹失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
4,
'/api/editor/assets/folders/folder-role',
{ method: 'DELETE' },
'删除图片画布素材文件夹失败',
expect.any(Object),
);
});
@@ -473,7 +443,6 @@ describe('editorProjectClient', () => {
}),
}),
'创建图片画布素材失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
2,
@@ -486,14 +455,12 @@ describe('editorProjectClient', () => {
}),
}),
'更新图片画布素材失败',
expect.any(Object),
);
expect(requestJsonMock).toHaveBeenNthCalledWith(
3,
'/api/editor/assets/asset-1',
{ method: 'DELETE' },
'删除图片画布素材失败',
expect.any(Object),
);
});
@@ -527,10 +494,6 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ title: '角色设定板' }),
}),
'创建图片画布工程失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -559,8 +522,6 @@ describe('editorProjectClient', () => {
}),
'生成图片失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),
@@ -648,8 +609,6 @@ describe('editorProjectClient', () => {
}),
'生成图标素材失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),
@@ -795,8 +754,6 @@ describe('editorProjectClient', () => {
}),
'生成角色动画失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),
@@ -838,8 +795,6 @@ describe('editorProjectClient', () => {
}),
'修改图片失败',
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),
@@ -10,10 +10,6 @@ const EDITOR_CHARACTER_ANIMATION_GENERATION_API =
'/api/editor/character-animations/generations';
const EDITOR_IMAGE_MODEL_NANOBANANA2 = 'gemini-3.1-flash-image-preview';
const DEFAULT_PROJECT_TITLE = '未命名画布';
const EDITOR_PROJECT_REQUEST_OPTIONS = {
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
};
export type EditorCanvasViewport = {
x: number;
@@ -299,7 +295,6 @@ export async function listEditorProjects() {
EDITOR_PROJECT_API_BASE,
{ method: 'GET' },
'读取图片画布工程列表失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.projects;
}
@@ -309,7 +304,6 @@ export async function loadRecentEditorProject() {
`${EDITOR_PROJECT_API_BASE}/recent`,
{ method: 'GET' },
'读取图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
}
@@ -322,7 +316,6 @@ export async function createEditorProject(
title: input.title?.trim() || DEFAULT_PROJECT_TITLE,
}),
'创建图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.project;
}
@@ -340,7 +333,6 @@ export async function loadEditorProject(projectId: string) {
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}`,
{ method: 'GET' },
'读取图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.project;
}
@@ -350,7 +342,6 @@ export async function renameEditorProject(projectId: string, title: string) {
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}/metadata`,
jsonRequest('PATCH', { title }),
'重命名图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.project;
}
@@ -360,7 +351,6 @@ export async function deleteEditorProject(projectId: string) {
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}`,
{ method: 'DELETE' },
'删除图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.deletedProjectId;
}
@@ -376,7 +366,6 @@ export async function saveEditorProjectLayout(
layers: input.layers,
}),
'保存图片画布工程失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.project;
}
@@ -389,7 +378,6 @@ export async function createEditorProjectResource(
`${EDITOR_PROJECT_API_BASE}/${encodeURIComponent(projectId)}/resources`,
jsonRequest('POST', { ...input }),
'创建图片画布资源失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.resource;
}
@@ -399,7 +387,6 @@ export async function loadEditorAssetLibrary() {
`${EDITOR_ASSET_API_BASE}/library`,
{ method: 'GET' },
'读取图片画布素材库失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.library;
}
@@ -412,7 +399,6 @@ export async function createEditorAssetFolder(
`${EDITOR_ASSET_API_BASE}/folders`,
jsonRequest('POST', { label, sortOrder }),
'创建图片画布素材文件夹失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.folder;
}
@@ -425,7 +411,6 @@ export async function updateEditorAssetFolder(
`${EDITOR_ASSET_API_BASE}/folders/${encodeURIComponent(folderId)}`,
jsonRequest('PATCH', input),
'更新图片画布素材文件夹失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.folder;
}
@@ -435,7 +420,6 @@ export async function deleteEditorAssetFolder(folderId: string) {
`${EDITOR_ASSET_API_BASE}/folders/${encodeURIComponent(folderId)}`,
{ method: 'DELETE' },
'删除图片画布素材文件夹失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.library;
}
@@ -445,7 +429,6 @@ export async function createEditorAsset(input: EditorAssetCreateInput) {
EDITOR_ASSET_API_BASE,
jsonRequest('POST', input),
'创建图片画布素材失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.asset;
}
@@ -458,7 +441,6 @@ export async function updateEditorAsset(
`${EDITOR_ASSET_API_BASE}/${encodeURIComponent(assetId)}`,
jsonRequest('PATCH', input),
'更新图片画布素材失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.asset;
}
@@ -468,7 +450,6 @@ export async function deleteEditorAsset(assetId: string) {
`${EDITOR_ASSET_API_BASE}/${encodeURIComponent(assetId)}`,
{ method: 'DELETE' },
'删除图片画布素材失败',
EDITOR_PROJECT_REQUEST_OPTIONS,
);
return response.asset;
}
@@ -489,7 +470,6 @@ export async function generateEditorImage(input: EditorImageGenerationInput) {
}),
'生成图片失败',
{
...EDITOR_PROJECT_REQUEST_OPTIONS,
timeoutMs: 1_200_000,
retry: {
maxRetries: 0,
@@ -512,7 +492,6 @@ export async function generateEditorIconSpritesheet(
}),
'生成图标素材失败',
{
...EDITOR_PROJECT_REQUEST_OPTIONS,
timeoutMs: 1_200_000,
retry: {
maxRetries: 0,
@@ -532,7 +511,6 @@ export async function editEditorImage(input: EditorImageEditInput) {
}),
'修改图片失败',
{
...EDITOR_PROJECT_REQUEST_OPTIONS,
timeoutMs: 1_200_000,
retry: {
maxRetries: 0,
@@ -549,7 +527,6 @@ export async function generateEditorCharacterAnimation(
jsonRequest('POST', input),
'生成角色动画失败',
{
...EDITOR_PROJECT_REQUEST_OPTIONS,
timeoutMs: 1_200_000,
retry: {
maxRetries: 0,