Skip to content

Commit 82054ac

Browse files
add project file
1 parent 0e4c3c4 commit 82054ac

File tree

197 files changed

+5285
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+5285
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# 在针对 `main` 分支的推送上运行。如果你
7+
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
8+
push:
9+
branches: [main]
10+
11+
# 允许你从 Actions 选项卡手动运行此工作流程
12+
workflow_dispatch:
13+
14+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
21+
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# 构建工作
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
35+
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释
36+
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
37+
- name: Setup Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm # 或 pnpm / yarn
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Install dependencies
45+
run: npm ci # 或 pnpm install / yarn install / bun install
46+
- name: Build with VitePress
47+
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: .vitepress/dist
52+
53+
# 部署工作
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
needs: build
59+
runs-on: ubuntu-latest
60+
name: Deploy
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.vitepress/dist
3+
.vitepress/cache
4+
.DS_Store

.postcssrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"plugins": {
3+
"postcss-rtlcss": {
4+
"ltrPrefix": ":where([dir=\"ltr\"])",
5+
"rtlPrefix": ":where([dir=\"rtl\"])"
6+
}
7+
}
8+
}

.vitepress/config/en.ts

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
import { createRequire } from 'module'
2+
import { defineConfig, type DefaultTheme } from 'vitepress'
3+
4+
const require = createRequire(import.meta.url)
5+
const pkg = require('vitepress/package.json')
6+
7+
export const en = defineConfig({
8+
lang: 'en-US',
9+
description: 'BotSharp is an open source application framework',
10+
11+
themeConfig: {
12+
nav: nav(),
13+
14+
sidebar: {
15+
'/guide/': { base: '/guide/', items: sidebarGuide() },
16+
'/reference/': { base: '/reference/', items: sidebarReference() }
17+
},
18+
19+
editLink: {
20+
pattern: 'https://github.com/GreenShadeZhang/botsharp-doc/:path',
21+
text: 'Edit this page on GitHub'
22+
},
23+
24+
footer: {
25+
message: 'Released under the MIT License.',
26+
copyright: 'Copyright Since 2018, SciSharp STACK.'
27+
}
28+
}
29+
})
30+
31+
function nav(): DefaultTheme.NavItem[] {
32+
return [
33+
{
34+
text: 'Guide',
35+
link: '/guide/quick-start/get-started',
36+
activeMatch: '/guide/'
37+
},
38+
{
39+
text: 'Reference',
40+
link: '/reference/cli',
41+
activeMatch: '/reference/'
42+
},
43+
{
44+
text: '4.0',
45+
items: [
46+
{
47+
text: 'Changelog',
48+
link: 'https://github.com/SciSharp/BotSharp/releases/'
49+
},
50+
{
51+
text: 'Contributing',
52+
link: 'https://github.com/SciSharp/BotSharp/graphs/contributors'
53+
}
54+
]
55+
}
56+
]
57+
}
58+
59+
function sidebarGuide(): DefaultTheme.SidebarItem[] {
60+
return [
61+
{
62+
text: 'Get Started with BotSharp',
63+
collapsed: false,
64+
items: [
65+
{ text: 'Overview', link: 'quick-start/overview' },
66+
{ text: 'Get Started', link: 'quick-start/get-started' },
67+
{ text: 'Installation', link: 'quick-start/installation' },
68+
]
69+
},
70+
{
71+
text: 'Agent',
72+
collapsed: false,
73+
items: [
74+
{ text: 'Agent Introduction', link: 'agent/intro' },
75+
{ text: 'Router', link: 'agent/router' },
76+
{ text: 'Agent Hook', link: 'agent/hook' }
77+
]
78+
},
79+
{
80+
text: 'Conversation',
81+
collapsed: false,
82+
items: [
83+
{ text: 'Conversation', link: 'conversation/intro' },
84+
{
85+
text: 'Conversation State',
86+
link: 'conversation/state'
87+
},
88+
{ text: 'Conversation Hook', link: 'conversation/hook' }
89+
]
90+
},
91+
{
92+
text: 'Interactive Channels',
93+
collapsed: false,
94+
items: [
95+
{ text: 'Channel Introduction', link: 'channels/intro' },
96+
{ text: 'Messaging Components', link: 'channels/components' },
97+
{ text: 'Messenger', link: 'channels/messenger' },
98+
{ text: 'WeChat', link: 'channels/wechat' }
99+
]
100+
},
101+
{
102+
text: 'Knowledge Base',
103+
collapsed: false,
104+
items: [
105+
{ text: 'Text Embedding', link: 'knowledge-base/text-embedding' },
106+
{ text: 'Vector Database', link: 'knowledge-base/vector-database' },
107+
{ text: 'Similarity Search', link: 'knowledge-base/similarity-search' },
108+
{ text: 'Build Q&A Bot', link: 'knowledge-base/build-qa-bot' }
109+
]
110+
},
111+
{
112+
text: 'Prompt Engineering',
113+
collapsed: false,
114+
items: [
115+
{ text: 'Prompt Engineering', link: 'llm/prompt' },
116+
{ text: 'Template', link: 'llm/template' },
117+
{ text: 'Function', link: 'llm/function' },
118+
{ text: 'Few-Shot Learning', link: 'llm/few-shot-learning' }
119+
]
120+
},
121+
{
122+
text: 'Use Local LLM Models',
123+
collapsed: false,
124+
items: [
125+
{ text: 'Config LLamaSharp', link: 'llama-sharp/config-llamasharp' },
126+
{ text: 'Use LLamaSharp in BotSharp', link: 'llama-sharp/use-llamasharp-in-ui' }
127+
]
128+
},
129+
{
130+
text: 'Architecture',
131+
collapsed: false,
132+
items: [
133+
{ text: 'Authentication', link: 'architecture/authentication' },
134+
{ text: 'Plug-in', link: 'architecture/plugin' },
135+
{ text: 'Hooks', link: 'architecture/hooks' },
136+
{ text: 'Routing', link: 'architecture/routing' },
137+
{ text: 'Agent Utility', link: 'architecture/agent-utility' },
138+
{ text: 'Logging', link: 'architecture/logging' },
139+
{ text: 'Data Storage', link: 'architecture/data-persistence' }
140+
]
141+
},
142+
{
143+
text: 'Utilities',
144+
collapsed: false,
145+
items: [
146+
{ text: 'Local Whisper', link: 'utilities/local-whisper' }
147+
]
148+
},
149+
]
150+
}
151+
152+
function sidebarReference(): DefaultTheme.SidebarItem[] {
153+
return [
154+
{
155+
text: 'Reference',
156+
items: [
157+
{ text: 'CLI', link: 'cli' }
158+
]
159+
}
160+
]
161+
}

.vitepress/config/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from 'vitepress'
2+
import { shared } from './shared'
3+
import { en } from './en'
4+
import { zh } from './zh'
5+
6+
export default defineConfig({
7+
...shared,
8+
locales: {
9+
root: { label: 'English', ...en },
10+
zh: { label: '简体中文', ...zh },
11+
}
12+
})

.vitepress/config/shared.ts

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import { defineConfig } from 'vitepress'
2+
import { search as zhSearch } from './zh'
3+
import {
4+
groupIconMdPlugin,
5+
groupIconVitePlugin,
6+
localIconLoader
7+
} from 'vitepress-plugin-group-icons'
8+
9+
export const shared = defineConfig({
10+
title: 'BotSharp',
11+
12+
rewrites: {
13+
'en/:rest*': ':rest*'
14+
},
15+
16+
lastUpdated: true,
17+
cleanUrls: true,
18+
metaChunk: true,
19+
20+
markdown: {
21+
math: true,
22+
codeTransformers: [
23+
// We use `[!!code` in demo to prevent transformation, here we revert it back.
24+
{
25+
postprocess(code) {
26+
return code.replace(/\[\!\!code/g, '[!code')
27+
}
28+
}
29+
],
30+
config(md) {
31+
// TODO: remove when https://github.com/vuejs/vitepress/issues/4431 is fixed
32+
const fence = md.renderer.rules.fence!
33+
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
34+
const { localeIndex = 'root' } = env
35+
const codeCopyButtonTitle = (() => {
36+
switch (localeIndex) {
37+
38+
case 'zh':
39+
return '复制代码'
40+
default:
41+
return 'Copy code'
42+
}
43+
})()
44+
return fence(tokens, idx, options, env, self).replace(
45+
'<button title="Copy Code" class="copy"></button>',
46+
`<button title="${codeCopyButtonTitle}" class="copy"></button>`
47+
)
48+
}
49+
md.use(groupIconMdPlugin)
50+
}
51+
},
52+
53+
sitemap: {
54+
hostname: 'https://botsharp.verdure-hiro.cn',
55+
transformItems(items) {
56+
return items.filter((item) => !item.url.includes('migration'))
57+
}
58+
},
59+
60+
/* prettier-ignore */
61+
head: [
62+
['link', { rel: 'icon', type: 'image/png', href: '/Logo.png' }],
63+
['link', { rel: 'icon', type: 'image/png', href: '/Logo.png' }],
64+
['meta', { name: 'theme-color', content: '#5f67ee' }],
65+
['meta', { property: 'og:type', content: 'website' }],
66+
['meta', { property: 'og:locale', content: 'en' }],
67+
['meta', { property: 'og:title', content: 'BotSharp | The Open Source LLM Application Framework' }],
68+
['meta', { property: 'og:site_name', content: 'BotSharp' }],
69+
['meta', { property: 'og:image', content: 'https://botsharp.verdure-hiro.cn/Logo.png' }],
70+
['meta', { property: 'og:url', content: 'https://botsharp.verdure-hiro.cn/' }],
71+
['script', { src: 'https://cdn.usefathom.com/script.js', 'data-site': 'AZBRSFGG', 'data-spa': 'auto', defer: '' }]
72+
],
73+
74+
themeConfig: {
75+
logo: { src: '/Logo.png', width: 24, height: 24 },
76+
77+
socialLinks: [
78+
{ icon: 'github', link: 'https://github.com/SciSharp/BotSharp' }
79+
],
80+
81+
search: {
82+
provider: 'algolia',
83+
options: {
84+
appId: '8J64VVRP8K',
85+
apiKey: '52f578a92b88ad6abde815aae2b0ad7c',
86+
indexName: 'vitepress',
87+
locales: {
88+
...zhSearch,
89+
}
90+
}
91+
},
92+
93+
//carbonAds: { code: 'CEBDT27Y', placement: 'vuejsorg' }
94+
},
95+
vite: {
96+
plugins: [
97+
groupIconVitePlugin({
98+
customIcon: {
99+
vitepress: localIconLoader(
100+
import.meta.url,
101+
'../../public/Logo.png'
102+
),
103+
firebase: 'logos:firebase'
104+
}
105+
})
106+
]
107+
}
108+
})

0 commit comments

Comments
 (0)