This commit is contained in:
yujonglee 2024-10-11 22:48:56 +09:00 committed by GitHub
parent 8b00d2a25f
commit 42174fde4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 81 additions and 219 deletions

View file

@ -26,32 +26,6 @@ const config = {
defaultLocale: 'en',
locales: ['en'],
},
themes: [
[
require.resolve("@getcanary/docusaurus-theme-search-pagefind"),
{
styles: {
"--canary-color-primary-c": 0.1,
"--canary-color-primary-h": 270,
},
pagefind: {
ranking: {
// https://pagefind.app/docs/ranking
pageLength: 0.0,
termFrequency: 1.0,
termSimilarity: 1.0,
termSaturation: 2.0,
}
},
tabs: [
{ name: "All", pattern: "**/*" },
{ name: "Providers", pattern: "/docs/providers/**" },
{ name: "Proxy", pattern: "/docs/proxy/**" }
],
indexOnly: true,
},
],
],
plugins: [
[
'@docusaurus/plugin-ideal-image',

View file

@ -12,8 +12,7 @@
"@docusaurus/plugin-google-gtag": "^2.4.1",
"@docusaurus/plugin-ideal-image": "^2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@getcanary/docusaurus-theme-search-pagefind": "^0.0.13",
"@getcanary/web": "^0.0.101",
"@getcanary/web": "^1.0.6",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"docusaurus": "^1.14.7",
@ -3621,64 +3620,48 @@
}
},
"node_modules/@floating-ui/core": {
"version": "1.6.7",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.7.tgz",
"integrity": "sha512-yDzVT/Lm101nQ5TCVeK65LtdN7Tj4Qpr9RTXJ2vPFLqtLxwOrpoxAHAJI8J3yYWUc40J0BDBheaitK5SJmno2g==",
"version": "1.6.8",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.8.tgz",
"integrity": "sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA==",
"dependencies": {
"@floating-ui/utils": "^0.2.7"
"@floating-ui/utils": "^0.2.8"
}
},
"node_modules/@floating-ui/dom": {
"version": "1.6.10",
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.10.tgz",
"integrity": "sha512-fskgCFv8J8OamCmyun8MfjB1Olfn+uZKjOKZ0vhYF3gRmEUXcGOjxWL8bBr7i4kIuPZ2KD2S3EUIOxnjC8kl2A==",
"version": "1.6.11",
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.11.tgz",
"integrity": "sha512-qkMCxSR24v2vGkhYDo/UzxfJN3D4syqSjyuTFz6C7XcpU1pASPRieNI0Kj5VP3/503mOfYiGY891ugBX1GlABQ==",
"dependencies": {
"@floating-ui/core": "^1.6.0",
"@floating-ui/utils": "^0.2.7"
"@floating-ui/utils": "^0.2.8"
}
},
"node_modules/@floating-ui/utils": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.7.tgz",
"integrity": "sha512-X8R8Oj771YRl/w+c1HqAC1szL8zWQRwFvgDwT129k9ACdBoud/+/rX9V0qiMl6LWUdP9voC2nDVZYPMQQsb6eA=="
},
"node_modules/@getcanary/docusaurus-theme-search-pagefind": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@getcanary/docusaurus-theme-search-pagefind/-/docusaurus-theme-search-pagefind-0.0.13.tgz",
"integrity": "sha512-w/Jz4q98cJQQtTAq8KCDI1jAW1HnHpsYpFoXaIjplLt+RoBiUKkCXocxDEI0yfKzRtmkH77dvf6LyJIdqMDWZg==",
"dependencies": {
"cli-progress": "^3.12.0",
"micromatch": "^4.0.7",
"pagefind": "^1.1.0"
},
"peerDependencies": {
"@docusaurus/core": "^2.0.0 || ^3.0.0",
"@getcanary/web": "*",
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
}
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz",
"integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig=="
},
"node_modules/@getcanary/web": {
"version": "0.0.101",
"resolved": "https://registry.npmjs.org/@getcanary/web/-/web-0.0.101.tgz",
"integrity": "sha512-/GeoSpVKq0w2HmjeF855zOeKE8a6cFcdtAsLHC0/ATJTkrAjAuAaTn5We0WX2w0UGBdzHuc94bYXJCklbTEoCg==",
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@getcanary/web/-/web-1.0.6.tgz",
"integrity": "sha512-9JEDjBQVJHENjlI/n+HyK90QlLoibus8T4cRCqjiyaac9UiQEVmAS9sZhB3QHR+uYC2TT5K8YhRl2rPQv0SLGg==",
"dependencies": {
"@floating-ui/dom": "^1.6.8",
"@lit-labs/observers": "^2.0.2",
"@lit/context": "^1.1.2",
"@lit/task": "^1.0.1",
"@xstate/store": "^2.1.0",
"@xstate/store": "^2.5.0",
"best-effort-json-parser": "^1.1.2",
"lit": "^3.1.4",
"marked": "^14.0.0",
"marked-footnote": "^1.2.2",
"picomatch": "^4.0.2",
"prismjs": "^1.29.0"
}
},
"node_modules/@getcanary/web/node_modules/@xstate/store": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@xstate/store/-/store-2.3.0.tgz",
"integrity": "sha512-vdIlbI4TxtadYNrGrKezrR0Y0Hid2xYBm5ohk403ZsaU7p6IjCCaacF8t8tp9qUZnYuLYzldBMhiGwBuNzmCoA==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@xstate/store/-/store-2.6.0.tgz",
"integrity": "sha512-pHiGIn378yPSCY36f/8iFF1KtKTKpGINqUVJH/dYydzWT+uXc4zKUQ+XUk0qTHchTvBXQ/UivRox2Q19ZnzTjw==",
"peerDependencies": {
"react": "^18.2.0",
"solid-js": "^1.7.6"
@ -3814,9 +3797,9 @@
"integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw=="
},
"node_modules/@lit-labs/observers": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@lit-labs/observers/-/observers-2.0.3.tgz",
"integrity": "sha512-CeftEJ2TId9iohDJHLjUXiSBVndqjIBaALjeTt8OmgWLh2dnIzwlj4WtPCiJw15uR1s6D6wyCsw0AoJC5/9QXw==",
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@lit-labs/observers/-/observers-2.0.4.tgz",
"integrity": "sha512-x95jhDPGb+HtYU3hEdqkcLxb6v2JBP3tcajaiOijs1F/ZmOgRT0pRPn0v+jhhk8mAAbEO12SZJjPCmuysunssQ==",
"dependencies": {
"@lit/reactive-element": "^1.0.0 || ^2.0.0",
"lit-html": "^3.2.0"
@ -3828,9 +3811,9 @@
"integrity": "sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ=="
},
"node_modules/@lit/context": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@lit/context/-/context-1.1.2.tgz",
"integrity": "sha512-S0nw2C6Tkm7fVX5TGYqeROGD+Z9Coa2iFpW+ysYBDH3YvCqOY3wVQvSgwbaliLJkjTnSEYCBe9qFqKV8WUFpVw==",
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@lit/context/-/context-1.1.3.tgz",
"integrity": "sha512-Auh37F4S0PZM93HTDfZWs97mmzaQ7M3vnTc9YvxAGyP3UItSK/8Fs0vTOGT+njuvOwbKio/l8Cx/zWL4vkutpQ==",
"dependencies": {
"@lit/reactive-element": "^1.6.2 || ^2.0.0"
}
@ -4038,66 +4021,6 @@
"node": ">= 8"
}
},
"node_modules/@pagefind/darwin-arm64": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@pagefind/darwin-arm64/-/darwin-arm64-1.1.1.tgz",
"integrity": "sha512-tZ9tysUmQpFs2EqWG2+E1gc+opDAhSyZSsgKmFzhnWfkK02YHZhvL5XJXEZDqYy3s1FAKhwjTg8XDxneuBlDZQ==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@pagefind/darwin-x64": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@pagefind/darwin-x64/-/darwin-x64-1.1.1.tgz",
"integrity": "sha512-ChohLQ39dLwaxQv0jIQB/SavP3TM5K5ENfDTqIdzLkmfs3+JlzSDyQKcJFjTHYcCzQOZVeieeGq8PdqvLJxJxQ==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@pagefind/linux-arm64": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@pagefind/linux-arm64/-/linux-arm64-1.1.1.tgz",
"integrity": "sha512-H5P6wDoCoAbdsWp0Zx0DxnLUrwTGWGLu/VI1rcN2CyFdY2EGSvPQsbGBMrseKRNuIrJDFtxHHHyjZ7UbzaM9EA==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
]
},
"node_modules/@pagefind/linux-x64": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@pagefind/linux-x64/-/linux-x64-1.1.1.tgz",
"integrity": "sha512-yJs7tTYbL2MI3HT+ngs9E1BfUbY9M4/YzA0yEM5xBo4Xl8Yu8Qg2xZTOQ1/F6gwvMrjCUFo8EoACs6LRDhtMrQ==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"linux"
]
},
"node_modules/@pagefind/windows-x64": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@pagefind/windows-x64/-/windows-x64-1.1.1.tgz",
"integrity": "sha512-b7/qPqgIl+lMzkQ8fJt51SfguB396xbIIR+VZ3YrL2tLuyifDJ1wL5mEm+ddmHxJ2Fki340paPcDan9en5OmAw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
]
},
"node_modules/@polka/url": {
"version": "1.0.0-next.25",
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.25.tgz",
@ -5701,6 +5624,11 @@
"tweetnacl": "^0.14.3"
}
},
"node_modules/best-effort-json-parser": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/best-effort-json-parser/-/best-effort-json-parser-1.1.2.tgz",
"integrity": "sha512-RD7tyk24pNCDwEKFACauR6Lqp5m6BHUrehwyhN/pA8V3QYWq8Y+hk9vHZvKiThZsdEFTaUqN49duVsamgCd8/g=="
},
"node_modules/big-integer": {
"version": "1.6.52",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz",
@ -6721,35 +6649,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cli-progress": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz",
"integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==",
"dependencies": {
"string-width": "^4.2.3"
},
"engines": {
"node": ">=4"
}
},
"node_modules/cli-progress/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"node_modules/cli-progress/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/cli-table3": {
"version": "0.6.5",
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
@ -14325,9 +14224,9 @@
"integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ=="
},
"node_modules/lit": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lit/-/lit-3.2.0.tgz",
"integrity": "sha512-s6tI33Lf6VpDu7u4YqsSX78D28bYQulM+VAzsGch4fx2H0eLZnJsUBsPWmGYSGoKDNbjtRv02rio1o+UdPVwvw==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/lit/-/lit-3.2.1.tgz",
"integrity": "sha512-1BBa1E/z0O9ye5fZprPtdqnc0BFzxIxTTOO/tQFmyC/hj1O3jL4TfmLBw0WEwjAokdLwpclkvGgDJwTIh0/22w==",
"dependencies": {
"@lit/reactive-element": "^2.0.4",
"lit-element": "^4.1.0",
@ -14335,9 +14234,9 @@
}
},
"node_modules/lit-element": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.1.0.tgz",
"integrity": "sha512-gSejRUQJuMQjV2Z59KAS/D4iElUhwKpIyJvZ9w+DIagIQjfJnhR20h2Q5ddpzXGS+fF0tMZ/xEYGMnKmaI/iww==",
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.1.1.tgz",
"integrity": "sha512-HO9Tkkh34QkTeUmEdNYhMT8hzLid7YlMlATSi1q4q17HE5d9mrrEHJ/o8O2D0cMi182zK1F3v7x0PWFjrhXFew==",
"dependencies": {
"@lit-labs/ssr-dom-shim": "^1.2.0",
"@lit/reactive-element": "^2.0.4",
@ -14345,9 +14244,9 @@
}
},
"node_modules/lit-html": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.2.0.tgz",
"integrity": "sha512-pwT/HwoxqI9FggTrYVarkBKFN9MlTUpLrDHubTmW4SrkL3kkqW5gxwbxMMUnbbRHBC0WTZnYHcjDSCM559VyfA==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.2.1.tgz",
"integrity": "sha512-qI/3lziaPMSKsrwlxH/xMgikhQ0EGOX2ICU73Bi/YHFvz2j/yMCIrw4+puF2IpQ4+upd3EWbvnHM9+PnJn48YA==",
"dependencies": {
"@types/trusted-types": "^2.0.2"
}
@ -14750,9 +14649,9 @@
}
},
"node_modules/marked": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-14.1.0.tgz",
"integrity": "sha512-P93GikH/Pde0hM5TAXEd8I4JAYi8IB03n8qzW8Bh1BIEFpEyBoYxi/XWZA53LSpTeLBiMQOoSMj0u5E/tiVYTA==",
"version": "14.1.2",
"resolved": "https://registry.npmjs.org/marked/-/marked-14.1.2.tgz",
"integrity": "sha512-f3r0yqpz31VXiDB/wj9GaOB0a2PRLQl6vJmXiFrniNwjkKdvakqJRULhjFKJpxOchlCRiG5fcacoUZY5Xa6PEQ==",
"bin": {
"marked": "bin/marked.js"
},
@ -14760,14 +14659,6 @@
"node": ">= 18"
}
},
"node_modules/marked-footnote": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/marked-footnote/-/marked-footnote-1.2.3.tgz",
"integrity": "sha512-ATIAPjuTlaNx3T139KNNy5X16BaYauxFEAGB0DtjonxIwRQ2DExdP6tAvUuG7UTkMGPOf6OjgIKhwXpSv7MoAg==",
"peerDependencies": {
"marked": ">=7.0.0"
}
},
"node_modules/math-random": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz",
@ -15986,21 +15877,6 @@
"node": ">=4"
}
},
"node_modules/pagefind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pagefind/-/pagefind-1.1.1.tgz",
"integrity": "sha512-U2YR0dQN5B2fbIXrLtt/UXNS0yWSSYfePaad1KcBPTi0p+zRtsVjwmoPaMQgTks5DnHNbmDxyJUL5TGaLljK3A==",
"bin": {
"pagefind": "lib/runner/bin.cjs"
},
"optionalDependencies": {
"@pagefind/darwin-arm64": "1.1.1",
"@pagefind/darwin-x64": "1.1.1",
"@pagefind/linux-arm64": "1.1.1",
"@pagefind/linux-x64": "1.1.1",
"@pagefind/windows-x64": "1.1.1"
}
},
"node_modules/param-case": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz",

View file

@ -18,8 +18,7 @@
"@docusaurus/plugin-google-gtag": "^2.4.1",
"@docusaurus/plugin-ideal-image": "^2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@getcanary/docusaurus-theme-search-pagefind": "^0.0.13",
"@getcanary/web": "^0.0.101",
"@getcanary/web": "^1.0.6",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"docusaurus": "^1.14.7",

View file

@ -1,35 +1,40 @@
import React from "react";
import SearchBar from "@theme-original/SearchBar";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { usePluginData } from "@docusaurus/useGlobalData";
export default function SearchBarWrapper(props) {
const { siteConfig } = useDocusaurusContext();
const { options } = usePluginData("docusaurus-theme-search-pagefind");
const [path, setPath] = React.useState("");
const [loaded, setLoaded] = React.useState(false);
React.useEffect(() => {
setPath(`${siteConfig.baseUrl}pagefind/pagefind.js`);
}, [siteConfig]);
React.useEffect(() => {
Promise.all([
import("@getcanary/web/components/canary-root"),
import("@getcanary/web/components/canary-provider-pagefind"),
import("@getcanary/web/components/canary-provider-cloud"),
import("@getcanary/web/components/canary-modal"),
import("@getcanary/web/components/canary-trigger-logo"),
import("@getcanary/web/components/canary-input"),
import("@getcanary/web/components/canary-content"),
import("@getcanary/web/components/canary-search"),
import("@getcanary/web/components/canary-search-input"),
import("@getcanary/web/components/canary-search-results-tabs"),
import("@getcanary/web/components/canary-search-results"),
import("@getcanary/web/components/canary-search-match-github-issue"),
import("@getcanary/web/components/canary-search-match-github-discussion"),
import("@getcanary/web/components/canary-ask"),
import("@getcanary/web/components/canary-ask-results"),
import("@getcanary/web/components/canary-filter-tabs-glob.js"),
import("@getcanary/web/components/canary-filter-tags.js"),
import("@getcanary/web/components/canary-footer.js"),
])
.then(() => setLoaded(true))
.catch(console.error);
}, []);
const PUBLIC_KEY = "cp1a506f13";
const TAGS = "All,Proxy";
const TABS = JSON.stringify([
{ name: "Docs", pattern: "**/docs.litellm.ai/**" },
{ name: "Github", pattern: "**/github.com/**" },
]);
return (
<div
style={{
@ -39,7 +44,7 @@ export default function SearchBarWrapper(props) {
gap: "6px",
}}
>
{!loaded || !path ? (
{!loaded ? (
<button
style={{
fontSize: "2rem",
@ -54,25 +59,33 @@ export default function SearchBarWrapper(props) {
</button>
) : (
<canary-root framework="docusaurus">
<canary-provider-pagefind options={JSON.stringify(options)}>
<canary-provider-cloud project-key={PUBLIC_KEY}>
<canary-modal>
<canary-trigger-logo slot="trigger"></canary-trigger-logo>
<canary-content slot="content">
<canary-filter-tags
slot="head"
tags={TAGS}
></canary-filter-tags>
<canary-input slot="input" autofocus></canary-input>
<canary-search slot="mode">
<canary-search-input slot="input"></canary-search-input>
<canary-search-results-tabs
slot="body"
tabs={JSON.stringify(options.tabs)}
group
></canary-search-results-tabs>
<canary-filter-tabs-glob
slot="head"
tabs={TABS}
></canary-filter-tabs-glob>
<canary-search-results slot="body"></canary-search-results>
</canary-search>
<canary-ask slot="mode">
<canary-ask-results slot="body"></canary-ask-results>
</canary-ask>
<canary-footer slot="footer"></canary-footer>
</canary-content>
</canary-modal>
</canary-provider-pagefind>
</canary-provider-cloud>
</canary-root>
)}
<SearchBar {...props} />
</div>
);
}
}