mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-13 13:10:29 +00:00
Co-authored-by: 夏姜 <wenfengjiang.jwf@digital-engine.com> Co-authored-by: yhjun1026 <460342015@qq.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: wb-lh513319 <wb-lh513319@alibaba-inc.com>
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { createCache, StyleProvider } from '@ant-design/cssinjs';
|
|
import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document';
|
|
import { doExtraStyle } from '../genAntdCss';
|
|
|
|
class MyDocument extends Document {
|
|
static async getInitialProps(ctx: DocumentContext) {
|
|
const cache = createCache();
|
|
let fileName = '';
|
|
const originalRenderPage = ctx.renderPage;
|
|
ctx.renderPage = () =>
|
|
originalRenderPage({
|
|
enhanceApp: (App) => (props) =>
|
|
(
|
|
<StyleProvider cache={cache} hashPriority="high">
|
|
<App {...props} />
|
|
</StyleProvider>
|
|
),
|
|
});
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
|
|
fileName = doExtraStyle({
|
|
cache,
|
|
});
|
|
|
|
return {
|
|
...initialProps,
|
|
styles: (
|
|
<>
|
|
{initialProps.styles}
|
|
{/* 1.2 inject css */}
|
|
{fileName && <link rel="stylesheet" href={`/${fileName}`} />}
|
|
</>
|
|
),
|
|
};
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html lang="en">
|
|
<Head>
|
|
<link rel="icon" href="/favicon.ico" />
|
|
<meta name="description" content="Revolutionizing Database Interactions with Private LLM Technology" />
|
|
<meta property="og:description" content="eosphoros-ai" />
|
|
<meta property="og:title" content="DB-GPT" />
|
|
</Head>
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default MyDocument;
|