From 2a80103327187798681ced64bab795c3ce77521c Mon Sep 17 00:00:00 2001 From: OYX-1 <13121812323@163.com> Date: Mon, 5 Aug 2024 09:22:04 +0000 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20ai=E5=8A=A0=E4=B8=8A=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E7=9A=84Provider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/strange-lemons-notice.md | 5 ++ apps/ai/src/app/clientLayout.tsx | 76 +++++++++++++++++------------ 2 files changed, 51 insertions(+), 30 deletions(-) create mode 100644 .changeset/strange-lemons-notice.md diff --git a/.changeset/strange-lemons-notice.md b/.changeset/strange-lemons-notice.md new file mode 100644 index 0000000000..5db857c2cb --- /dev/null +++ b/.changeset/strange-lemons-notice.md @@ -0,0 +1,5 @@ +--- +"@scow/ai": patch +--- + +ai 加上国际化的 Provider diff --git a/apps/ai/src/app/clientLayout.tsx b/apps/ai/src/app/clientLayout.tsx index d75d6251d5..dcd7c2f1a5 100644 --- a/apps/ai/src/app/clientLayout.tsx +++ b/apps/ai/src/app/clientLayout.tsx @@ -18,6 +18,9 @@ import { usePathname } from "next/navigation"; import { ErrorBoundary } from "src/components/ErrorBoundary"; import { Loading } from "src/components/Loading"; import { TopProgressBar } from "src/components/TopProgressBar"; +import { Provider } from "src/i18n"; +import en from "src/i18n/en"; +import zh_cn from "src/i18n/zh_cn"; import { AntdConfigProvider } from "src/layouts/AntdConfigProvider"; import { DarkModeCookie, DarkModeProvider } from "src/layouts/darkMode"; import { RootErrorContent } from "src/layouts/error/RootErrorContent"; @@ -28,6 +31,11 @@ import { trpc } from "src/utils/trpc"; import { UiConfigContext } from "./uiContext"; +const languagesMap = { + "zh_cn": zh_cn, + "en": en, +}; + export function ClientLayout(props: { children: React.ReactNode, initialDark?: DarkModeCookie, @@ -49,36 +57,44 @@ export function ClientLayout(props: { ?? primaryColor?.defaultColor ?? uiConfig.defaultPrimaryColor; return ( - - - - - { - useConfig.isLoading ? - - : ( - - - - - - - {props.children} - - - - - ) - } + + + + + + { + useConfig.isLoading ? + + : ( + + + + + + + {props.children} + + + + + ) + } + + + + + + - - - - ); } From 4d0d0403882de22a8053bcc6050d5c19ea33d390 Mon Sep 17 00:00:00 2001 From: OYX-1 <13121812323@163.com> Date: Tue, 6 Aug 2024 02:32:54 +0000 Subject: [PATCH 2/3] fix: jobShell --- apps/ai/src/server/setup/jobShell.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ai/src/server/setup/jobShell.ts b/apps/ai/src/server/setup/jobShell.ts index db1bab8393..13f1385404 100644 --- a/apps/ai/src/server/setup/jobShell.ts +++ b/apps/ai/src/server/setup/jobShell.ts @@ -179,7 +179,7 @@ wss.on("connection", async (ws: AliveCheckedWebSocket, req) => { }); const { job } = await asyncClientCall(client.job, "getJobById", { - fields: ["namespace", "pod"], + fields: ["containerJobInfo"], jobId: currentJobInfo.jobId, }); From f2f77656249cf3e90e43113e18c011d335d6d88f Mon Sep 17 00:00:00 2001 From: OYX-1 <13121812323@163.com> Date: Tue, 6 Aug 2024 03:25:46 +0000 Subject: [PATCH 3/3] fix --- apps/ai/src/server/setup/jobShell.ts | 2 +- apps/ai/src/server/trpc/route/jobs/apps.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ai/src/server/setup/jobShell.ts b/apps/ai/src/server/setup/jobShell.ts index 13f1385404..5083dd4539 100644 --- a/apps/ai/src/server/setup/jobShell.ts +++ b/apps/ai/src/server/setup/jobShell.ts @@ -179,7 +179,7 @@ wss.on("connection", async (ws: AliveCheckedWebSocket, req) => { }); const { job } = await asyncClientCall(client.job, "getJobById", { - fields: ["containerJobInfo"], + fields: ["container_job_info"], jobId: currentJobInfo.jobId, }); diff --git a/apps/ai/src/server/trpc/route/jobs/apps.ts b/apps/ai/src/server/trpc/route/jobs/apps.ts index ae1c41422c..f670f297a8 100644 --- a/apps/ai/src/server/trpc/route/jobs/apps.ts +++ b/apps/ai/src/server/trpc/route/jobs/apps.ts @@ -657,7 +657,7 @@ export const saveImage = const client = getAdapterClient(clusterId); const { job } = await asyncClientCall(client.job, "getJobById", { - fields: ["node", "container_id"], + fields: ["container_job_info"], jobId, });