Skip to content

Commit

Permalink
Switch to AI Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 10, 2023
1 parent ded9020 commit d8f5052
Show file tree
Hide file tree
Showing 5 changed files with 5,237 additions and 79 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/release-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,6 @@ jobs:
# Use 8107/tcp as port.
sed -i 's/host.docker.internal:3000/host.docker.internal:8107/g' /root/search/scraper.json
#
# Restart typesense
cat << END > /root/restart_docs-typesense.sh
docker rm -f docs-typesense || sleep 1
docker run -d -it --restart always --privileged --name docs-typesense \\
-v /root/search/data:/data -p $SRS_DROPLET_PIP:8108:8108 \\
--log-driver=json-file --log-opt=max-size=500m --log-opt=max-file=3 \\
registry.cn-hangzhou.aliyuncs.com/ossrs/typesense:0.22.1 \\
--enable-cors --data-dir /data --api-key=$SEARCH_APIKEY
END
bash /root/restart_docs-typesense.sh
#
# Restart search scraper
echo "Something wrong for search scraper, ignore it."
#
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/release-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,6 @@ jobs:
# Use 8107/tcp as port.
sed -i 's/host.docker.internal:3000/host.docker.internal:8107/g' /root/search/scraper.json
#
# Restart typesense
cat << END > /root/restart_docs-typesense.sh
docker rm -f docs-typesense || sleep 1
docker run -d -it --restart always --privileged --name docs-typesense \\
-v /root/search/data:/data -p $SRS_DROPLET_PIP:8108:8108 \\
--log-driver=json-file --log-opt=max-size=500m --log-opt=max-file=3 \\
typesense/typesense:0.22.1 \\
--enable-cors --data-dir /data --api-key=$SEARCH_APIKEY
END
bash /root/restart_docs-typesense.sh
#
# Restart search scraper
echo "Something wrong for search scraper, ignore it."
#
Expand Down
33 changes: 5 additions & 28 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const versions = require('./versions.json');
const versionsArchived = require('./versionsArchived.json');

const typesenseHttpsHost = process.env.SEARCH_HTTPS_HOST;
const typesenseHttpsPort = process.env.SEARCH_HTTPS_PORT;
const typesenseHttpHost = process.env.SEARCH_HTTP_HOST || 'localhost';
const typesenseHttpPort = process.env.SEARCH_HTTP_PORT || 8108;
const typesenseApiKey = process.env.SEARCH_APIKEY || 'test';
const regionConfig = process.env.REGION === 'zh-cn' ? require('./config/zh-cn') : require('./config/default');
const url = process.env.URL || regionConfig.url;
const baseUrl = process.env.BASE_URL || regionConfig.baseUrl;
Expand Down Expand Up @@ -83,8 +78,6 @@ const config = {
],
],

themes: ['docusaurus-theme-search-typesense'],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
Expand Down Expand Up @@ -177,29 +170,13 @@ const config = {
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://chat.openai.com/g/g-FxEZ7G0XX-srs',
label: 'AI Search',
position: 'right',
},
],
},
typesense: {
// See https://typesense.org/docs/guide/docsearch.html#step-2-add-a-search-bar-to-your-documentation-site
typesenseCollectionName: 'srs-docs',
typesenseServerConfig: {
nodes: [
typesenseHttpsHost && {
host: typesenseHttpsHost,
port: typesenseHttpsPort,
protocol: 'https',
},
typesenseHttpHost && {
host: typesenseHttpHost,
port: typesenseHttpPort,
protocol: 'http',
},
].filter((e) => e),
apiKey: typesenseApiKey,
},
// Optional
contextualSearch: true,
},
footer: {
style: 'dark',
links: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dependencies": {
"@docusaurus/core": "2.0.0-beta.14",
"@docusaurus/preset-classic": "2.0.0-beta.14",
"@docusaurus/theme-classic": "^3.0.0",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1",
"docusaurus-theme-search-typesense": "^0.2.0",
Expand Down
Loading

0 comments on commit d8f5052

Please sign in to comment.