修复图片编辑器生图登录提示

调整编辑器 API 鉴权策略,允许通过 refresh cookie 静默补 access token

真实生图遇到未授权时显示登录提示,不再直接暴露 requestId

补充编辑器组件和客户端测试,并更新方案文档与跟踪记录
This commit is contained in:
2026-06-13 17:48:21 +08:00
parent 96c36f0b50
commit 3f4dba97ba
6 changed files with 68 additions and 13 deletions

View File

@@ -40,7 +40,10 @@ describe('editorProjectClient', () => {
'/api/editor/projects/recent',
{ method: 'GET' },
'读取图片画布工程失败',
expect.objectContaining({ authImpact: 'local' }),
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -70,7 +73,10 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ title: '未命名画布' }),
}),
'创建图片画布工程失败',
expect.objectContaining({ authImpact: 'local' }),
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -102,7 +108,10 @@ describe('editorProjectClient', () => {
}),
}),
'保存图片画布工程失败',
expect.objectContaining({ authImpact: 'local' }),
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -149,7 +158,10 @@ describe('editorProjectClient', () => {
}),
}),
'创建图片画布资源失败',
expect.objectContaining({ authImpact: 'local' }),
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -175,7 +187,10 @@ describe('editorProjectClient', () => {
body: JSON.stringify({ title: '角色设定板' }),
}),
'创建图片画布工程失败',
expect.objectContaining({ authImpact: 'local' }),
expect.objectContaining({
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
}),
);
});
@@ -204,7 +219,8 @@ describe('editorProjectClient', () => {
}),
'生成图片失败',
expect.objectContaining({
authImpact: 'local',
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),
@@ -242,7 +258,8 @@ describe('editorProjectClient', () => {
}),
'修改图片失败',
expect.objectContaining({
authImpact: 'local',
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
timeoutMs: 1_200_000,
retry: { maxRetries: 0 },
}),

View File

@@ -5,7 +5,8 @@ const EDITOR_IMAGE_GENERATION_API = '/api/editor/images/generations';
const EDITOR_IMAGE_EDIT_API = '/api/editor/images/edits';
const DEFAULT_PROJECT_TITLE = '未命名画布';
const EDITOR_PROJECT_REQUEST_OPTIONS = {
authImpact: 'local' as const,
clearAuthOnUnauthorized: false,
notifyAuthStateChange: false,
};
export type EditorCanvasViewport = {