Files
OpenLLM/docs/theme.config.tsx
Aaron Pham fddd0bf95e feat: bootstrap documentation site (#252)
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
Signed-off-by: GutZuFusss <leon.ikinger@googlemail.com>
Co-authored-by: GutZuFusss <leon.ikinger@googlemail.com>
2023-09-12 12:28:29 -04:00

133 lines
15 KiB
TypeScript

import React from 'react'
import { useRouter } from 'next/router'
import { useConfig } from 'nextra-theme-docs'
import type { DocsThemeConfig } from 'nextra-theme-docs'
const openllmUrl = 'https://openllm.community'
const logo = (
<span>
<svg height="20" viewBox="0 0 373 60" xmlns="http://www.w3.org/2000/svg" fill="currentColor">
<path d="m59.56,3.16c-.11-.35-.26-.69-.45-.99-.23-.37-.5-.71-.82-1-.05-.05-.11-.1-.16-.14-.39-.32-.83-.58-1.31-.76s-1-.27-1.55-.27H14.94c-.09,0-.18,0-.27,0-.03,0-.05,0-.08,0-.07,0-.13.01-.2.02-.03,0-.06,0-.08.01-.08.01-.15.02-.23.04-.01,0-.02,0-.03,0-.09.02-.17.04-.26.06-.02,0-.05.01-.07.02-.06.02-.12.04-.19.06-.03,0-.05.02-.08.03-.07.02-.13.05-.2.08-.02,0-.03.01-.05.02-.08.03-.16.07-.24.11-.02,0-.04.02-.06.03-.06.03-.12.06-.18.09-.02.01-.05.03-.07.04-.06.03-.12.07-.17.11-.02.01-.03.02-.05.03-.07.05-.14.1-.21.15-.01.01-.03.02-.04.03-.06.04-.11.09-.16.13-.02.02-.04.03-.06.05-.05.04-.1.09-.15.13-.02.01-.03.03-.05.04-.03.03-.05.05-.08.08,0,0,0,0,0,0L1.12,10.91c-.72.72-1.12,1.69-1.12,2.7v42.57c0,2.11,1.71,3.82,3.82,3.82h42.57c1.01,0,1.99-.4,2.7-1.12l9.52-11.05c.17-.19.33-.4.47-.62,0,0,.01-.02.02-.02.03-.04.05-.09.08-.13,0-.02.02-.03.03-.05.02-.04.04-.08.06-.12.01-.02.02-.04.03-.07.02-.04.04-.08.05-.12.01-.03.02-.05.03-.08.02-.04.03-.07.05-.11.01-.03.02-.06.03-.09.01-.04.03-.07.04-.11.01-.03.02-.06.03-.09.01-.04.02-.07.03-.11,0-.03.02-.07.03-.1,0-.03.02-.07.03-.1,0-.04.02-.07.02-.11,0-.03.02-.07.02-.1,0-.04.01-.08.02-.12,0-.03.01-.06.02-.1,0-.04.01-.08.02-.13,0-.03,0-.06.01-.09,0-.05,0-.1.01-.14,0-.03,0-.05,0-.08,0-.07,0-.15,0-.22V4.5h0c0-.47-.07-.91-.2-1.34Zm-4.3-1.81c.54,0,1.05.14,1.5.38.22.12.43.27.62.44.04.03.07.07.11.1.07.07.14.15.2.22.06.08.12.16.18.24.34.5.54,1.11.54,1.76v40.33c0,.09,0,.18-.01.27,0,.01,0,.02,0,.03,0,.08-.02.17-.03.25,0,.01,0,.02,0,.04-.02.08-.03.16-.06.24,0,0,0,.02,0,.03-.02.08-.05.16-.08.24,0,0,0,0,0,0-.1.26-.23.5-.38.71h0c-.05.08-.11.15-.17.22-.04.04-.07.08-.11.12,0,0,0,0,0,0-.04.04-.07.08-.11.11,0,0,0,0,0,0-.04.04-.08.07-.12.11,0,0,0,0,0,0-.21.18-.44.33-.7.45,0,0-.01,0-.02,0-.04.02-.09.04-.13.06-.01,0-.02,0-.04.01-.04.02-.08.03-.12.04-.02,0-.03.01-.05.02-.04.01-.07.02-.11.03-.02,0-.04.01-.05.02-.03,0-.07.02-.1.03-.02,0-.04,0-.06.01-.03,0-.07.01-.1.02-.02,0-.04,0-.06.01-.04,0-.07.01-.11.02-.02,0-.04,0-.06,0-.04,0-.08,0-.12.01-.02,0-.03,0-.05,0-.06,0-.11,0-.17,0H14.94c-.87,0-1.66-.35-2.23-.92-.14-.14-.27-.3-.38-.47-.28-.42-.47-.91-.52-1.44-.01-.11-.02-.21-.02-.32V4.5c0-.06,0-.12,0-.18,0-.02,0-.04,0-.06,0-.04,0-.08.01-.12,0-.02,0-.04,0-.06,0-.04.01-.07.02-.11,0-.02,0-.04.01-.06,0-.04.01-.07.02-.11,0-.02,0-.04.01-.06.01-.04.02-.08.03-.12,0-.01,0-.03.01-.04.03-.11.07-.22.12-.32,0,0,0,0,0,0,.02-.05.04-.1.07-.15,0,0,0-.02.01-.02.02-.04.04-.09.07-.13,0,0,0-.02.01-.03.02-.04.05-.08.08-.13,0,0,0-.01.01-.02.03-.05.06-.09.09-.14,0,0,0,0,0,0,.17-.24.38-.45.61-.63.2-.16.42-.29.65-.39,0,0,0,0,.01,0,.07-.03.15-.06.23-.09,0,0,.01,0,.02,0,.15-.05.31-.09.47-.12.01,0,.03,0,.04,0,.08-.01.15-.02.23-.03.01,0,.03,0,.04,0,.08,0,.16-.01.25-.01h40.33Z" />
<g>
<circle cx="40.54" cy="24.66" r="2.74" />
<circle cx="29.67" cy="24.66" r="2.74" />
</g>
<path
d="M 277.203 46.203 L 276.543 46.863 L 271.263 46.863 L 270.603 46.203 L 270.603 14.523 L 269.943 14.523 L 256.743 46.203 L 256.083 46.863 L 250.143 46.863 L 249.483 46.203 L 236.283 14.523 L 235.623 14.523 L 235.623 46.203 L 234.963 46.863 L 229.683 46.863 L 229.023 46.203 L 229.023 1.323 L 229.683 0.663 L 236.943 0.663 L 237.603 1.323 L 252.783 38.283 L 253.443 38.283 L 268.623 1.323 L 269.283 0.663 L 276.543 0.663 L 277.203 1.323 L 277.203 46.203 Z M 149.163 46.203 L 148.503 46.863 L 143.223 46.863 L 142.563 46.203 L 142.563 27.063 C 142.563 24.156 142.071 20.363 138.11 19.382 A 8.93 8.93 0 0 0 135.963 19.143 C 131.036 19.143 128.419 21.319 127.638 26.51 A 26.058 26.058 0 0 0 127.383 30.363 L 127.383 46.203 L 126.723 46.863 L 121.443 46.863 L 120.783 46.203 L 120.783 14.523 L 121.443 13.863 L 126.063 13.863 L 126.723 14.523 L 127.383 17.163 L 128.043 17.163 A 9.62 9.62 0 0 1 131.066 14.582 A 11.514 11.514 0 0 1 136.623 13.203 A 16.563 16.563 0 0 1 140.917 13.721 C 146.911 15.328 149.163 20.52 149.163 27.063 L 149.163 46.203 Z M 113.523 37.623 A 10.534 10.534 0 0 1 110.493 43.788 C 109.205 45.077 107.529 46.115 105.488 46.766 A 16.942 16.942 0 0 1 100.323 47.523 C 93.105 47.523 88.353 44.13 86.069 38.821 A 21.4 21.4 0 0 1 84.483 30.363 A 25.097 25.097 0 0 1 84.83 26.131 C 86.082 18.83 90.762 13.203 99.663 13.203 A 17.952 17.952 0 0 1 103.701 13.639 C 107.917 14.61 110.854 17.138 112.65 20.533 A 21.076 21.076 0 0 1 114.843 30.363 L 114.843 32.343 L 114.183 33.003 L 92.403 33.003 L 91.743 33.663 A 5.259 5.259 0 0 0 91.749 33.899 C 91.819 35.446 92.605 40.378 98.162 41.398 A 11.967 11.967 0 0 0 100.323 41.583 C 102.386 41.583 104.448 41.18 105.881 39.43 A 6.823 6.823 0 0 0 106.923 37.623 L 107.583 36.963 L 112.863 36.963 L 113.523 37.623 Z M 106.923 27.723 L 107.583 27.063 C 107.583 25.297 107.058 20.378 101.789 19.338 A 10.968 10.968 0 0 0 99.663 19.143 A 11.608 11.608 0 0 0 98.143 19.239 C 93.018 19.916 91.959 24.027 91.777 26.259 A 9.964 9.964 0 0 0 91.743 27.063 L 92.403 27.723 L 106.923 27.723 Z M 187.443 46.203 L 186.783 46.863 L 158.403 46.863 L 157.743 46.203 L 157.743 1.323 L 158.403 0.663 L 163.683 0.663 L 164.343 1.323 L 164.343 40.263 L 165.003 40.923 L 186.783 40.923 L 187.443 41.583 L 187.443 46.203 Z M 223.083 46.203 L 222.423 46.863 L 194.043 46.863 L 193.383 46.203 L 193.383 1.323 L 194.043 0.663 L 199.323 0.663 L 199.983 1.323 L 199.983 40.263 L 200.643 40.923 L 222.423 40.923 L 223.083 41.583 L 223.083 46.203 Z M 57.423 17.163 A 9.62 9.62 0 0 1 60.446 14.582 A 11.514 11.514 0 0 1 66.003 13.203 A 16.933 16.933 0 0 1 67.185 13.244 C 75.692 13.839 80.523 20.893 80.523 30.363 C 80.523 40.263 75.243 47.523 66.003 47.523 A 13.102 13.102 0 0 1 65.404 47.509 C 62.739 47.387 60.76 46.465 59.469 45.543 C 58.677 44.949 58.017 44.289 57.423 43.563 L 56.763 43.563 L 56.763 59.403 L 56.103 60.063 L 50.823 60.063 L 50.163 59.403 L 50.163 14.523 L 50.823 13.863 L 55.443 13.863 L 56.103 14.523 L 56.763 17.163 L 57.423 17.163 Z M 73.495 34.537 A 18.852 18.852 0 0 0 73.923 30.363 C 73.923 27.559 73.44 25.257 72.547 23.484 A 7.597 7.597 0 0 0 65.343 19.143 C 60.063 19.143 56.763 22.443 56.763 30.363 A 22.943 22.943 0 0 0 56.951 33.405 C 57.72 39.138 60.798 41.583 65.343 41.583 A 7.579 7.579 0 0 0 71.926 38.294 C 72.628 37.272 73.158 36.017 73.495 34.537 Z M 18.324 47.305 C 6.613 45.782 0.003 36.425 0.003 23.763 C 0.003 13.747 4.139 5.799 11.664 2.161 A 23.046 23.046 0 0 1 21.783 0.003 A 26.817 26.817 0 0 1 25.242 0.221 C 36.953 1.744 43.563 11.101 43.563 23.763 C 43.563 33.779 39.427 41.727 31.902 45.365 A 23.046 23.046 0 0 1 21.783 47.523 A 26.817 26.817 0 0 1 18.324 47.305 Z M 7.808 15.823 A 24.607 24.607 0 0 0 6.603 23.763 A 25.23 25.23 0 0 0 7.586 31.014 C 8.831 35.154 11.245 38.312 14.755 40.057 A 15.628 15.628 0 0 0 21.783 41.583 C 28.938 41.583 33.679 37.792 35.759 31.703 A 24.607 24.607 0 0 0 36.963 23.763 A 25.23 25.23 0 0 0 35.98 16.512 C 34.736 12.373 32.322 9.214 28.812 7.469 A 15.628 15.628 0 0 0 21.783 5.943 C 14.629 5.943 9.887 9.734 7.808 15.823 Z"
vectorEffect="non-scaling-stroke"
stroke="currentColor"
strokeWidth="0.25"
transform="translate(80, 2.5)"
/>
</svg>
</span>
)
const theme: DocsThemeConfig = {
project: {
link: 'https://github.com/bentoml/OpenLLM'
},
editLink: { text: 'Edit this page on GitHub →' },
feedback: { content: 'Question? Send us your feedback →', labels: 'feedback' },
docsRepositoryBase: 'https://github.com/bentoml/OpenLLM/tree/main/docs',
chat: {
link: 'https://l.bentoml.com/join-openllm-discord'
},
logo,
head: function useHead() {
const { frontMatter, title } = useConfig()
// TODO: support locale
// https://nextjs.org/docs/pages/api-reference/functions/use-router
const { route } = useRouter()
const socialCard = route === '/' || !title ? `${openllmUrl}/og.png` : `${openllmUrl}/api/og?title=${title}`
const ogDescription = frontMatter.description || 'Fine-tune, serve and deploy LLMs in production'
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta httpEquiv="Content-Language" content="en" />
<meta name="description" content={ogDescription} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content={socialCard} />
<meta name="twitter:site:domain" content="openllm.community" />
<meta name="twitter:url" content="https://openllm.community" />
<meta name="og:title" content={title ? title + ' | OpenLLM' : 'OpenLLM'} />
<meta name="og:image" content={socialCard} />
<meta name="og:description" content={ogDescription} />
<meta name="apple-mobile-web-app-title" content="OpenLLM" />
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png" />
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg" />
<link rel="icon" type="image/x-icon" href="/favicon/favicon.ico" />
<link rel="icon" href="/favicon/favicon-dark.svg" type="image/svg+xml" media="(prefers-color-scheme: dark)" />
<link rel="icon" href="/favicon/favicon-dark.ico" type="image/x-icon" media="(prefers-color-scheme: dark)" />
<link rel="android-chrome" type="image/png" sizes="192x192" href="/favicon/android-chrome-192x192.png" />
<link rel="android-chrome" type="image/png" sizes="512x512" href="/favicon/android-chrome-512x512.png" />
<link rel="manifest" href="/favicon/site.webmanifest" />
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#000000" />
<meta name="msapplication-config" content="/favicon/browserconfig.xml" />
<meta name="msapplication-square150x150logo" content="/favicon/mstile-150x150.png" />
<meta name="msapplication-TileColor" content="#ffffff" />
</>
)
},
search: {
placeholder: 'Search website...'
},
toc: {
float: true
},
sidebar: {
titleComponent({ title, type }) {
if (type === 'separator') {
return <span className="cursor-default">{title}</span>
}
return <>{title}</>
},
defaultMenuCollapseLevel: 1,
toggleButton: true
},
gitTimestamp({ timestamp }) {
const { locale } = useRouter()
return (
<>
'last updated on '
<time dateTime={timestamp.toISOString()}>
{timestamp.toLocaleDateString(locale, {
day: 'numeric',
month: 'long',
year: 'numeric'
})}
</time>
</>
)
},
useNextSeoProps() {
const { asPath } = useRouter()
if (['/', '/docs'].includes(asPath)) {
return { titleTemplate: 'OpenLLM' }
}
return { titleTemplate: `%s | OpenLLM` }
},
footer: {
text: (
<div className="flex w-full items-center justify-between">
<div>© {new Date().getFullYear()} OpenLLM project</div>
<a href="https://vercel.com?utm_source=openllm" target="_blank" rel="noopener noreferrer">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 212 44" className="h-8" width="212">
<rect width="212" height="44" fill="#000" rx="8"></rect>
<path
fill="#fff"
d="M60.438 15.227V26.5h1.406v-4.023h2.836c2.117 0 3.625-1.493 3.625-3.602 0-2.148-1.477-3.648-3.61-3.648h-4.257zm1.406 1.25h2.484c1.633 0 2.531.851 2.531 2.398 0 1.492-.93 2.352-2.53 2.352h-2.485v-4.75zm11.5 10.171c2.399 0 3.883-1.656 3.883-4.359 0-2.71-1.484-4.36-3.883-4.36-2.398 0-3.883 1.65-3.883 4.36 0 2.703 1.485 4.36 3.883 4.36zm0-1.21c-1.594 0-2.492-1.157-2.492-3.149 0-2 .898-3.148 2.492-3.148 1.594 0 2.492 1.148 2.492 3.148 0 1.992-.898 3.148-2.492 3.148zm15.954-7.36h-1.352l-1.656 6.735h-.125l-1.883-6.735h-1.29l-1.882 6.735h-.125l-1.656-6.735h-1.36l2.36 8.422h1.36l1.874-6.516h.125l1.883 6.516h1.367l2.36-8.422zm4.523 1.04c1.336 0 2.227.984 2.258 2.476h-4.64c.101-1.492 1.039-2.477 2.382-2.477zm2.219 5.202c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.36-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.46 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H96.04zm3.242 2.18h1.344v-5.219c0-1.187.93-2.047 2.211-2.047.266 0 .75.047.86.078V17.97a5.77 5.77 0 00-.672-.04c-1.117 0-2.086.579-2.336 1.4h-.125v-1.25h-1.281V26.5zm8.899-7.383c1.336 0 2.227.985 2.258 2.477h-4.641c.102-1.492 1.04-2.477 2.383-2.477zm2.219 5.203c-.352.742-1.086 1.14-2.172 1.14-1.43 0-2.359-1.054-2.43-2.718v-.062h6.055v-.516c0-2.617-1.383-4.234-3.656-4.234-2.313 0-3.797 1.718-3.797 4.367 0 2.664 1.461 4.351 3.797 4.351 1.844 0 3.156-.89 3.547-2.328H110.4zm6.36 2.328c1.164 0 2.164-.554 2.695-1.492h.125V26.5h1.281V14.734h-1.343v4.672h-.118c-.476-.922-1.468-1.476-2.64-1.476-2.141 0-3.539 1.718-3.539 4.36 0 2.648 1.382 4.358 3.539 4.358zm.312-7.507c1.524 0 2.477 1.218 2.477 3.148 0 1.945-.946 3.148-2.477 3.148-1.539 0-2.461-1.18-2.461-3.148 0-1.96.93-3.148 2.461-3.148zm14.462 7.507c2.133 0 3.531-1.726 3.531-4.359 0-2.648-1.391-4.36-3.531-4.36-1.156 0-2.18.571-2.641 1.477h-.125v-4.672h-1.344V26.5h1.282v-1.344h.125c.531.938 1.531 1.492 2.703 1.492zm-.313-7.507c1.539 0 2.453 1.18 2.453 3.148 0 1.969-.914 3.148-2.453 3.148-1.531 0-2.484-1.203-2.484-3.148s.953-3.148 2.484-3.148zm6.04 10.406c1.492 0 2.164-.578 2.882-2.531l3.29-8.938h-1.43l-2.305 6.93h-.125l-2.312-6.93h-1.453l3.117 8.43-.157.5c-.351 1.015-.773 1.383-1.546 1.383-.188 0-.399-.008-.563-.04V29.5c.188.031.422.047.602.047zm17.391-3.047l3.898-11.273h-2.148l-2.813 8.921h-.132l-2.836-8.921h-2.227l3.938 11.273h2.32zm8.016-7.18c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078zm1.984 4.828c-.281.633-.945.985-1.906.985-1.273 0-2.094-.89-2.141-2.313v-.101h5.969v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.031 4.414c2.016 0 3.446-.969 3.797-2.524h-1.836zm3.547 2.352h1.938v-4.938c0-1.195.875-1.976 2.133-1.976.328 0 .843.055.992.11v-1.798c-.18-.054-.524-.085-.805-.085-1.101 0-2.023.625-2.258 1.468h-.132v-1.328h-1.868V26.5zm13.501-5.672c-.203-1.797-1.532-3.047-3.727-3.047-2.57 0-4.078 1.649-4.078 4.422 0 2.813 1.516 4.469 4.086 4.469 2.164 0 3.508-1.203 3.719-2.992h-1.844c-.203.89-.875 1.367-1.883 1.367-1.32 0-2.117-1.047-2.117-2.844 0-1.773.789-2.797 2.117-2.797 1.063 0 1.703.594 1.883 1.422h1.844zm5.117-1.508c1.164 0 1.93.813 1.969 2.078h-4.024c.086-1.25.899-2.078 2.055-2.078zm1.985 4.828c-.282.633-.946.985-1.907.985-1.273 0-2.093-.89-2.14-2.313v-.101h5.968v-.625c0-2.696-1.461-4.313-3.898-4.313-2.477 0-4.016 1.727-4.016 4.477s1.516 4.414 4.032 4.414c2.015 0 3.445-.969 3.796-2.524h-1.835zm3.625 2.352h1.937V14.648h-1.937V26.5zM23.325 13l9.325 16H14l9.325-16z"
></path>
<path stroke="#5E5E5E" d="M43.5 0v44"></path>
</svg>
</a>
</div>
)
}
}
export default theme