diff --git a/invokeai/frontend/web/public/locales/zh_CN.json b/invokeai/frontend/web/public/locales/zh_CN.json index b0151b8e76..ee12f2ad07 100644 --- a/invokeai/frontend/web/public/locales/zh_CN.json +++ b/invokeai/frontend/web/public/locales/zh_CN.json @@ -1119,7 +1119,10 @@ "deletedInvalidEdge": "已删除无效的边缘 {{source}} -> {{target}}", "unknownInput": "未知输入:{{name}}", "prototypeDesc": "此调用是一个原型 (prototype)。它可能会在本项目更新期间发生破坏性更改,并且随时可能被删除。", - "betaDesc": "此调用尚处于测试阶段。在稳定之前,它可能会在项目更新期间发生破坏性更改。本项目计划长期支持这种调用。" + "betaDesc": "此调用尚处于测试阶段。在稳定之前,它可能会在项目更新期间发生破坏性更改。本项目计划长期支持这种调用。", + "newWorkflow": "新建工作流", + "newWorkflowDesc": "是否创建一个新的工作流?", + "newWorkflowDesc2": "当前工作流有未保存的更改。" }, "controlnet": { "resize": "直接缩放", @@ -1635,7 +1638,7 @@ "openWorkflow": "打开工作流", "clearWorkflowSearchFilter": "清除工作流检索过滤器", "workflowLibrary": "工作流库", - "downloadWorkflow": "下载工作流", + "downloadWorkflow": "保存到文件", "noRecentWorkflows": "无最近工作流", "workflowSaved": "已保存工作流", "workflowIsOpen": "工作流已打开", @@ -1648,8 +1651,9 @@ "deleteWorkflow": "删除工作流", "workflows": "工作流", "noDescription": "无描述", - "uploadWorkflow": "上传工作流", - "userWorkflows": "我的工作流" + "uploadWorkflow": "从文件中加载", + "userWorkflows": "我的工作流", + "newWorkflowCreated": "已创建新的工作流" }, "app": { "storeNotInitialized": "商店尚未初始化" diff --git a/invokeai/frontend/web/src/app/store/store.ts b/invokeai/frontend/web/src/app/store/store.ts index 5651641afd..6b31f6f8d4 100644 --- a/invokeai/frontend/web/src/app/store/store.ts +++ b/invokeai/frontend/web/src/app/store/store.ts @@ -34,6 +34,7 @@ import { actionSanitizer } from './middleware/devtools/actionSanitizer'; import { actionsDenylist } from './middleware/devtools/actionsDenylist'; import { stateSanitizer } from './middleware/devtools/stateSanitizer'; import { listenerMiddleware } from './middleware/listenerMiddleware'; +import { authToastMiddleware } from 'services/api/authToastMiddleware'; const allReducers = { canvas: canvasReducer, @@ -96,6 +97,7 @@ export const createStore = (uniqueStoreKey?: string, persist = true) => }) .concat(api.middleware) .concat(dynamicMiddlewares) + .concat(authToastMiddleware) .prepend(listenerMiddleware.middleware), enhancers: (getDefaultEnhancers) => { const _enhancers = getDefaultEnhancers().concat(autoBatchEnhancer()); diff --git a/invokeai/frontend/web/src/services/api/authToastMiddleware.ts b/invokeai/frontend/web/src/services/api/authToastMiddleware.ts index 59db2d0b89..a9cf775383 100644 --- a/invokeai/frontend/web/src/services/api/authToastMiddleware.ts +++ b/invokeai/frontend/web/src/services/api/authToastMiddleware.ts @@ -5,12 +5,10 @@ import { t } from 'i18next'; import { z } from 'zod'; const zRejectedForbiddenAction = z.object({ - action: z.object({ - payload: z.object({ - status: z.literal(403), - data: z.object({ - detail: z.string(), - }), + payload: z.object({ + status: z.literal(403), + data: z.object({ + detail: z.string(), }), }), }); @@ -22,8 +20,8 @@ export const authToastMiddleware: Middleware = const parsed = zRejectedForbiddenAction.parse(action); const { dispatch } = api; const customMessage = - parsed.action.payload.data.detail !== 'Forbidden' - ? parsed.action.payload.data.detail + parsed.payload.data.detail !== 'Forbidden' + ? parsed.payload.data.detail : undefined; dispatch( addToast({ @@ -32,7 +30,7 @@ export const authToastMiddleware: Middleware = description: customMessage, }) ); - } catch { + } catch (error) { // no-op } }