2023-09-27 16:06:49 +08:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
import type { FC } from 'react'
|
|
|
|
import { useContext } from 'use-context-selector'
|
|
|
|
import TemplateEn from './template/template.en.mdx'
|
|
|
|
import TemplateZh from './template/template.zh.mdx'
|
|
|
|
import I18n from '@/context/i18n'
|
2024-01-24 11:08:11 +08:00
|
|
|
import { LanguagesSupportedUnderscore, getModelRuntimeSupported } from '@/utils/language'
|
2023-09-27 16:06:49 +08:00
|
|
|
|
|
|
|
type DocProps = {
|
|
|
|
apiBaseUrl: string
|
|
|
|
}
|
|
|
|
const Doc: FC<DocProps> = ({
|
|
|
|
apiBaseUrl,
|
|
|
|
}) => {
|
|
|
|
const { locale } = useContext(I18n)
|
2024-01-24 11:08:11 +08:00
|
|
|
const language = getModelRuntimeSupported(locale)
|
2023-09-27 16:06:49 +08:00
|
|
|
return (
|
2023-11-27 11:47:48 +08:00
|
|
|
<article className='mx-1 px-4 sm:mx-12 pt-16 bg-white rounded-t-xl prose prose-xl'>
|
2023-09-27 16:06:49 +08:00
|
|
|
{
|
2024-01-24 11:08:11 +08:00
|
|
|
language !== LanguagesSupportedUnderscore[1]
|
2023-09-27 16:06:49 +08:00
|
|
|
? <TemplateEn apiBaseUrl={apiBaseUrl} />
|
|
|
|
: <TemplateZh apiBaseUrl={apiBaseUrl} />
|
|
|
|
}
|
|
|
|
</article>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Doc
|