-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e4c3c4
commit 82054ac
Showing
197 changed files
with
5,285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 | ||
# | ||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
# 在针对 `main` 分支的推送上运行。如果你 | ||
# 使用 `master` 分支作为默认分支,请将其更改为 `master` | ||
push: | ||
branches: [main] | ||
|
||
# 允许你从 Actions 选项卡手动运行此工作流程 | ||
workflow_dispatch: | ||
|
||
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列 | ||
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成 | ||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# 构建工作 | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | ||
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释 | ||
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm # 或 pnpm / yarn | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Install dependencies | ||
run: npm ci # 或 pnpm install / yarn install / bun install | ||
- name: Build with VitePress | ||
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: .vitepress/dist | ||
|
||
# 部署工作 | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.vitepress/dist | ||
.vitepress/cache | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"plugins": { | ||
"postcss-rtlcss": { | ||
"ltrPrefix": ":where([dir=\"ltr\"])", | ||
"rtlPrefix": ":where([dir=\"rtl\"])" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
import { createRequire } from 'module' | ||
import { defineConfig, type DefaultTheme } from 'vitepress' | ||
|
||
const require = createRequire(import.meta.url) | ||
const pkg = require('vitepress/package.json') | ||
|
||
export const en = defineConfig({ | ||
lang: 'en-US', | ||
description: 'BotSharp is an open source application framework', | ||
|
||
themeConfig: { | ||
nav: nav(), | ||
|
||
sidebar: { | ||
'/guide/': { base: '/guide/', items: sidebarGuide() }, | ||
'/reference/': { base: '/reference/', items: sidebarReference() } | ||
}, | ||
|
||
editLink: { | ||
pattern: 'https://github.com/GreenShadeZhang/botsharp-doc/:path', | ||
text: 'Edit this page on GitHub' | ||
}, | ||
|
||
footer: { | ||
message: 'Released under the MIT License.', | ||
copyright: 'Copyright Since 2018, SciSharp STACK.' | ||
} | ||
} | ||
}) | ||
|
||
function nav(): DefaultTheme.NavItem[] { | ||
return [ | ||
{ | ||
text: 'Guide', | ||
link: '/guide/quick-start/get-started', | ||
activeMatch: '/guide/' | ||
}, | ||
{ | ||
text: 'Reference', | ||
link: '/reference/cli', | ||
activeMatch: '/reference/' | ||
}, | ||
{ | ||
text: '4.0', | ||
items: [ | ||
{ | ||
text: 'Changelog', | ||
link: 'https://github.com/SciSharp/BotSharp/releases/' | ||
}, | ||
{ | ||
text: 'Contributing', | ||
link: 'https://github.com/SciSharp/BotSharp/graphs/contributors' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
function sidebarGuide(): DefaultTheme.SidebarItem[] { | ||
return [ | ||
{ | ||
text: 'Get Started with BotSharp', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Overview', link: 'quick-start/overview' }, | ||
{ text: 'Get Started', link: 'quick-start/get-started' }, | ||
{ text: 'Installation', link: 'quick-start/installation' }, | ||
] | ||
}, | ||
{ | ||
text: 'Agent', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Agent Introduction', link: 'agent/intro' }, | ||
{ text: 'Router', link: 'agent/router' }, | ||
{ text: 'Agent Hook', link: 'agent/hook' } | ||
] | ||
}, | ||
{ | ||
text: 'Conversation', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Conversation', link: 'conversation/intro' }, | ||
{ | ||
text: 'Conversation State', | ||
link: 'conversation/state' | ||
}, | ||
{ text: 'Conversation Hook', link: 'conversation/hook' } | ||
] | ||
}, | ||
{ | ||
text: 'Interactive Channels', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Channel Introduction', link: 'channels/intro' }, | ||
{ text: 'Messaging Components', link: 'channels/components' }, | ||
{ text: 'Messenger', link: 'channels/messenger' }, | ||
{ text: 'WeChat', link: 'channels/wechat' } | ||
] | ||
}, | ||
{ | ||
text: 'Knowledge Base', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Text Embedding', link: 'knowledge-base/text-embedding' }, | ||
{ text: 'Vector Database', link: 'knowledge-base/vector-database' }, | ||
{ text: 'Similarity Search', link: 'knowledge-base/similarity-search' }, | ||
{ text: 'Build Q&A Bot', link: 'knowledge-base/build-qa-bot' } | ||
] | ||
}, | ||
{ | ||
text: 'Prompt Engineering', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Prompt Engineering', link: 'llm/prompt' }, | ||
{ text: 'Template', link: 'llm/template' }, | ||
{ text: 'Function', link: 'llm/function' }, | ||
{ text: 'Few-Shot Learning', link: 'llm/few-shot-learning' } | ||
] | ||
}, | ||
{ | ||
text: 'Use Local LLM Models', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Config LLamaSharp', link: 'llama-sharp/config-llamasharp' }, | ||
{ text: 'Use LLamaSharp in BotSharp', link: 'llama-sharp/use-llamasharp-in-ui' } | ||
] | ||
}, | ||
{ | ||
text: 'Architecture', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Authentication', link: 'architecture/authentication' }, | ||
{ text: 'Plug-in', link: 'architecture/plugin' }, | ||
{ text: 'Hooks', link: 'architecture/hooks' }, | ||
{ text: 'Routing', link: 'architecture/routing' }, | ||
{ text: 'Agent Utility', link: 'architecture/agent-utility' }, | ||
{ text: 'Logging', link: 'architecture/logging' }, | ||
{ text: 'Data Storage', link: 'architecture/data-persistence' } | ||
] | ||
}, | ||
{ | ||
text: 'Utilities', | ||
collapsed: false, | ||
items: [ | ||
{ text: 'Local Whisper', link: 'utilities/local-whisper' } | ||
] | ||
}, | ||
] | ||
} | ||
|
||
function sidebarReference(): DefaultTheme.SidebarItem[] { | ||
return [ | ||
{ | ||
text: 'Reference', | ||
items: [ | ||
{ text: 'CLI', link: 'cli' } | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { shared } from './shared' | ||
import { en } from './en' | ||
import { zh } from './zh' | ||
|
||
export default defineConfig({ | ||
...shared, | ||
locales: { | ||
root: { label: 'English', ...en }, | ||
zh: { label: '简体中文', ...zh }, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { search as zhSearch } from './zh' | ||
import { | ||
groupIconMdPlugin, | ||
groupIconVitePlugin, | ||
localIconLoader | ||
} from 'vitepress-plugin-group-icons' | ||
|
||
export const shared = defineConfig({ | ||
title: 'BotSharp', | ||
|
||
rewrites: { | ||
'en/:rest*': ':rest*' | ||
}, | ||
|
||
lastUpdated: true, | ||
cleanUrls: true, | ||
metaChunk: true, | ||
|
||
markdown: { | ||
math: true, | ||
codeTransformers: [ | ||
// We use `[!!code` in demo to prevent transformation, here we revert it back. | ||
{ | ||
postprocess(code) { | ||
return code.replace(/\[\!\!code/g, '[!code') | ||
} | ||
} | ||
], | ||
config(md) { | ||
// TODO: remove when https://github.com/vuejs/vitepress/issues/4431 is fixed | ||
const fence = md.renderer.rules.fence! | ||
md.renderer.rules.fence = function (tokens, idx, options, env, self) { | ||
const { localeIndex = 'root' } = env | ||
const codeCopyButtonTitle = (() => { | ||
switch (localeIndex) { | ||
|
||
case 'zh': | ||
return '复制代码' | ||
default: | ||
return 'Copy code' | ||
} | ||
})() | ||
return fence(tokens, idx, options, env, self).replace( | ||
'<button title="Copy Code" class="copy"></button>', | ||
`<button title="${codeCopyButtonTitle}" class="copy"></button>` | ||
) | ||
} | ||
md.use(groupIconMdPlugin) | ||
} | ||
}, | ||
|
||
sitemap: { | ||
hostname: 'https://botsharp.verdure-hiro.cn', | ||
transformItems(items) { | ||
return items.filter((item) => !item.url.includes('migration')) | ||
} | ||
}, | ||
|
||
/* prettier-ignore */ | ||
head: [ | ||
['link', { rel: 'icon', type: 'image/png', href: '/Logo.png' }], | ||
['link', { rel: 'icon', type: 'image/png', href: '/Logo.png' }], | ||
['meta', { name: 'theme-color', content: '#5f67ee' }], | ||
['meta', { property: 'og:type', content: 'website' }], | ||
['meta', { property: 'og:locale', content: 'en' }], | ||
['meta', { property: 'og:title', content: 'BotSharp | The Open Source LLM Application Framework' }], | ||
['meta', { property: 'og:site_name', content: 'BotSharp' }], | ||
['meta', { property: 'og:image', content: 'https://botsharp.verdure-hiro.cn/Logo.png' }], | ||
['meta', { property: 'og:url', content: 'https://botsharp.verdure-hiro.cn/' }], | ||
['script', { src: 'https://cdn.usefathom.com/script.js', 'data-site': 'AZBRSFGG', 'data-spa': 'auto', defer: '' }] | ||
], | ||
|
||
themeConfig: { | ||
logo: { src: '/Logo.png', width: 24, height: 24 }, | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/SciSharp/BotSharp' } | ||
], | ||
|
||
search: { | ||
provider: 'algolia', | ||
options: { | ||
appId: '8J64VVRP8K', | ||
apiKey: '52f578a92b88ad6abde815aae2b0ad7c', | ||
indexName: 'vitepress', | ||
locales: { | ||
...zhSearch, | ||
} | ||
} | ||
}, | ||
|
||
//carbonAds: { code: 'CEBDT27Y', placement: 'vuejsorg' } | ||
}, | ||
vite: { | ||
plugins: [ | ||
groupIconVitePlugin({ | ||
customIcon: { | ||
vitepress: localIconLoader( | ||
import.meta.url, | ||
'../../public/Logo.png' | ||
), | ||
firebase: 'logos:firebase' | ||
} | ||
}) | ||
] | ||
} | ||
}) |
Oops, something went wrong.