Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jobShell connect container #1386

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strange-lemons-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/ai": patch
---

ai 加上国际化的 Provider
76 changes: 46 additions & 30 deletions apps/ai/src/app/clientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand All @@ -49,36 +57,44 @@ export function ClientLayout(props: {
?? primaryColor?.defaultColor ?? uiConfig.defaultPrimaryColor;

return (
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<StyledComponentsRegistry>
<AntdStyleRegistry>
<body>
{
useConfig.isLoading ?
<Loading />
: (
<DarkModeProvider initial={props.initialDark}>
<AntdConfigProvider color={color}>
<GlobalStyle />
<TopProgressBar />
<ErrorBoundary Component={RootErrorContent} pathname={pathname ?? ""}>
<UiConfigContext.Provider
value={{
hostname,
uiConfig,
}}
>
{props.children}
</UiConfigContext.Provider>
</ErrorBoundary>
</AntdConfigProvider>
</DarkModeProvider>
)
}
<Provider initialLanguage={{
// ai还未开发国际化,先直接写zh_cn
id: "zh_cn",
definitions: languagesMap.zh_cn,
}}
>
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
<StyledComponentsRegistry>
<AntdStyleRegistry>
<body>
{
useConfig.isLoading ?
<Loading />
: (
<DarkModeProvider initial={props.initialDark}>
<AntdConfigProvider color={color}>
<GlobalStyle />
<TopProgressBar />
<ErrorBoundary Component={RootErrorContent} pathname={pathname ?? ""}>
<UiConfigContext.Provider
value={{
hostname,
uiConfig,
}}
>
{props.children}
</UiConfigContext.Provider>
</ErrorBoundary>
</AntdConfigProvider>
</DarkModeProvider>
)
}

</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</StyleProvider>
</Provider>

</body>
</AntdStyleRegistry>
</StyledComponentsRegistry>
</StyleProvider>
);
}
2 changes: 1 addition & 1 deletion apps/ai/src/server/setup/jobShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ wss.on("connection", async (ws: AliveCheckedWebSocket, req) => {
});

const { job } = await asyncClientCall(client.job, "getJobById", {
fields: ["namespace", "pod"],
fields: ["container_job_info"],
jobId: currentJobInfo.jobId,
});

Expand Down
2 changes: 1 addition & 1 deletion apps/ai/src/server/trpc/route/jobs/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
Loading