优化 AI 设计任务失败提示
问题:客户端直接展示 policy_blocked 等内部错误码。 实现:统一转换为中文设计语言提示,并补充策略拦截场景回归测试。
This commit is contained in:
@@ -482,6 +482,21 @@ describe('ImageCanvas Workspace-first design experience', () => {
|
||||
expect(confirmImageWorkspaceGenerationMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('renders policy-blocked generation tasks with a user-facing design message', async () => {
|
||||
fetchImageWorkspaceTasksMock.mockResolvedValue([{
|
||||
...taskFixture,
|
||||
status: 'failed',
|
||||
failureCode: 'policy_blocked',
|
||||
resultAssets: [],
|
||||
}]);
|
||||
|
||||
render(<MemoryRouter><ImageCanvas /></MemoryRouter>);
|
||||
|
||||
const alert = await screen.findByRole('alert');
|
||||
expect(alert).toHaveTextContent('内容可能涉及版权或安全风险,请调整设计后重试');
|
||||
expect(alert).not.toHaveTextContent('policy_blocked');
|
||||
});
|
||||
|
||||
it('renders a new task pushed by the design event stream without repeated polling', async () => {
|
||||
const queuedTask = {
|
||||
...taskFixture,
|
||||
|
||||
Reference in New Issue
Block a user