feat(website): add product homepage and unified docs deployment (#3297)

* feat(website): add product homepage and unified docs deployment

* fix(website): build the unified site in a multi-stage Docker image

* fix(website): reveal and highlight the active documentation sidebar item
main
lyingbug 2026-09-16 11:58:37 +08:00 committed by GitHub
parent 6f98ff80c3
commit 06e8022476
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
87 changed files with 8397 additions and 2551 deletions

View File

@ -301,7 +301,7 @@ WeKnora serves as the core technology framework for the [WeChat Dialog Open Plat
## 📘 API Reference
**Official product documentation**: [`website-docs/`](./website-docs/README.md) — the complete documentation set organized as Getting Started → Architecture → Features → API → Clients → Development, covering ~360 API endpoints, ~150 environment variables, and 9 extension points. The directory is also a VitePress site: run `cd website-docs && npm install && npm run dev` to preview locally, or deploy it standalone with the `Dockerfile` inside.
**Official website and product documentation**: [`website-docs/`](./website-docs/README.md) contains the product homepage and the complete documentation set organized as Getting Started → Architecture → Features → API → Clients → Development. With Node.js 24, run `cd website-docs && npm run setup && npm run build && npm run preview` to preview both together. The unified static output serves the homepage at `/` and documentation at `/docs/`; see the directory's README for Nginx and Docker deployment.
Troubleshooting FAQ: [Troubleshooting FAQ](./docs/QA.md)

View File

@ -381,18 +381,18 @@ SystemAdmin 可在 **系统管理 → 平台 API Key** 创建 `scope_type=platfo
0.7.2 新增了完整的官方产品文档,位于仓库 [`website-docs/`](../website-docs/README.md) 目录,按「入门 → 架构 → 功能 → API → 客户端 → 开发」六个板块组织,覆盖约 360 个 API 端点、约 150 个环境变量与 9 大扩展点。
该目录同时是一个 VitePress 站点,两种使用方式:
该目录现在包含官网与 VitePress 文档站,统一构建和部署。以下命令分别从仓库根目录执行:
```bash
# 本地预览
cd website-docs && npm install && npm run dev
# 本地预览(需要 Node.js 24)
(cd website-docs && npm run setup && npm run build && npm run preview)
# 独立容器部署(容器内 Nginx 监听 8081)
docker build -t weknora-docs website-docs
docker run -d -p 8081:8081 weknora-docs
# 独立容器部署(容器内完成构建,Nginx 监听 80)
docker build -t weknora-site website-docs
docker run -d -p 8081:80 weknora-site
```
站点的版本号在构建时自动读取仓库根目录的 `VERSION` 文件,因此升级版本后无需手动改文档。若某处截图显示为虚线占位框,说明 `website-docs/public/screenshots/` 下缺少同名图片,补图即可生效,不需要改 Markdown。
官网位于 `/`,文档位于 `/docs/`。从旧文档容器迁移时注意将反向代理目标端口改为 `80`,并让域名根路径指向同一容器。站点版本号在构建时读取 `website-docs/VERSION`,发布时需同步更新;该目录可独立复制构建。完整部署说明见 [website-docs/README.md](../website-docs/README.md)。若某处截图显示为虚线占位框,说明 `website-docs/public/screenshots/` 下缺少同名图片,补图即可生效,不需要改 Markdown。
`website-docs/sample-data/` 下还提供了 4 份 Markdown 样例文档与 1 份 FAQ 导入 JSON,可以直接用来跑一遍「建库 → 上传 → 问答」;`examples/mcp-demo/` 是一个可直接运行的本地 MCP 服务示例。

View File

@ -0,0 +1,12 @@
**/node_modules
**/.next
**/out
.vitepress/cache
.vitepress/dist
static-site
releases
**/.git
**/.DS_Store
**/.env*
**/npm-debug.log*
**/*.tsbuildinfo

View File

@ -1,7 +1,13 @@
# 仓库根 .gitignore 忽略了所有隐藏目录,这里把站点源码目录放回来
!.vitepress/
!.dockerignore
!.nvmrc
.vitepress/cache/
.vitepress/dist/
node_modules/
**/node_modules/
homepage/.next/
homepage/out/
static-site/
releases/
*.tsbuildinfo
.shots/
.DS_Store

View File

@ -0,0 +1 @@
24

View File

@ -58,7 +58,6 @@ function tokenize(text: string): string[] {
}
const repo = 'https://github.com/Tencent/WeKnora'
const site = 'https://weknora.weixin.qq.com'
export default withMermaid(
defineConfig({
@ -68,12 +67,17 @@ export default withMermaid(
lang: 'zh-CN',
base: '/docs/',
cleanUrls: true,
appearance: { storageKey: 'vitepress-theme-appearance' },
lastUpdated: true,
srcExclude: ['README.md'],
srcExclude: ['README.md', 'homepage/**', 'shared/**', 'scripts/**', 'deploy/**', 'static-site/**', 'releases/**'],
metaChunk: true,
transformPageData(pageData) {
// The shared masthead replaces the default documentation navbar.
pageData.frontmatter.navbar = false
},
head: [
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
['link', { rel: 'icon', href: '/docs/favicon.ico', type: 'image/x-icon' }],
['meta', { name: 'theme-color', content: '#101f38' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:title', content: 'WeKnora 文档' }],
@ -100,18 +104,10 @@ export default withMermaid(
},
themeConfig: {
logo: { light: '/logo-mark.svg', dark: '/logo-mark-dark.svg', alt: 'WeKnora' },
logoLink: { link: '/', target: '_self' },
siteTitle: 'WeKnora',
nav: [
{ text: '快速开始', link: '/01-getting-started/01-introduction', activeMatch: '/01-getting-started/' },
{ text: '架构', link: '/02-architecture/01-overview', activeMatch: '/02-architecture/' },
{ text: '功能', link: '/03-features/01-tenant-auth', activeMatch: '/03-features/' },
{ text: 'API', link: '/04-api/01-api-overview', activeMatch: '/04-api/' },
{ text: '客户端', link: '/05-clients/01-frontend', activeMatch: '/05-clients/' },
{ text: '开发', link: '/06-development/01-dev-guide', activeMatch: '/06-development/' },
{ text: '官网', link: site },
],
nav: [],
weknoraVersion: repoVersionLabel,

View File

@ -1,539 +0,0 @@
<script setup lang="ts">
/**
* 首页线描插画。用内联 SVG 而不是位图:墨线取 currentColor、点缀取 --wk-gold,
* 深浅色模式自动跟随,任意缩放不糊,整套加起来只有几 KB。
*/
defineProps<{ name: string }>()
const gold = 'var(--wk-gold)'
/**
* 首屏全景图右半部分:九个客户端沿一段椭圆弧展开,连线从核心圆的边缘出发。
* 角度、落点与曲线控制点都在这里算,避免在模板里堆一串手写坐标。
*/
const spokes = [-72, -54, -36, -18, 0, 18, 36, 54, 72].map((deg) => {
const t = (deg * Math.PI) / 180
const cx = 760 + 380 * Math.cos(t)
const cy = 122 + 100 * Math.sin(t)
const sx = 760 + 46 * Math.cos(t)
const sy = 122 + 46 * Math.sin(t)
const ex = cx - 15
// 控制点按两端距离取,近的线不会拧成结,远的线自然接近直线
const h = (ex - sx) * 0.45
const f = (n: number) => n.toFixed(1)
return {
cx: Number(cx.toFixed(1)),
cy: Number(cy.toFixed(1)),
d: `M${f(sx)} ${f(sy)}C${f(sx + h)} ${f(sy)} ${f(ex - h)} ${f(cy)} ${f(ex)} ${f(cy)}`,
}
})
/** 24×24 图标统一的线条参数 */
const s = {
fill: 'none',
stroke: 'currentColor',
'stroke-width': 1.4,
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
}
</script>
<template>
<!-- ============ 首屏全景图 ============
一张图讲完 WeKnora 与通用 RAG 示意图不一样的地方:
左边多源接入(文档 / 网页 / 音频 / 图片)收束成一次统一解析,
中间同一份内容并行写入四路索引(向量 / 关键词 / Wiki / 图谱),
右边同一套知识库与 Agent 再扇形展开成九种客户端。
版面规则:
1. 全图是「收束 → 展开 → 收束 → 展开」的节奏,观者顺着疏密变化走,不需要标注;
2. 连接一律走三次贝塞尔,控制点按两端距离取,不用直角折线;
3. 九个客户端落在同一段椭圆弧上(角度在 script 里算),保证间距均匀;
4. 笔触只有三档:主体 1.3、细节 1.1 且 opacity .45、连接线 opacity .3;
金色只给四处焦点:解析框、核心圆、每路索引各一个记号。 -->
<svg
v-if="name === 'flow'"
class="illus illus-flow"
viewBox="0 0 1200 240"
fill="none"
aria-hidden="true"
>
<!-- ---------- 左:四类来源 ---------- -->
<g transform="translate(66 45)" stroke="currentColor" stroke-linejoin="round">
<path stroke-width="1.3" d="M-8-13h10l6 6v20H-8z" />
<path stroke-width="1.3" d="M2-13v6h6" />
<path stroke-width="1.1" opacity="0.45" d="M-4 1h8M-4 6h5" />
</g>
<g transform="translate(66 100)" stroke="currentColor">
<circle stroke-width="1.3" cx="0" cy="0" r="11" />
<ellipse stroke-width="1.3" cx="0" cy="0" rx="4.6" ry="11" />
<path stroke-width="1.1" opacity="0.45" d="M-11 0h22" />
</g>
<g transform="translate(66 155)" stroke="currentColor" stroke-linecap="round">
<path stroke-width="1.3" d="M-9-3.5v7M-4.5-6v12M4.5-5.5v11M9-3v6" />
<path :stroke="gold" stroke-width="1.4" d="M0-8.5v17" />
</g>
<g transform="translate(66 210)" stroke="currentColor" stroke-linejoin="round">
<rect stroke-width="1.3" x="-11" y="-9" width="22" height="18" rx="2.5" />
<path stroke-width="1.1" opacity="0.5" d="M-7 6l5-6 3.5 4 3-3.5 4.5 5.5" />
<circle :fill="gold" stroke="none" cx="-5" cy="-3.5" r="1.8" />
</g>
<!-- 来源汇入解析 -->
<g stroke="currentColor" stroke-width="1.1" opacity="0.3">
<path d="M82 45C150 45 186 102 248 104" />
<path d="M82 100C150 100 190 114 248 116" />
<path d="M82 155C150 155 190 130 248 128" />
<path d="M82 210C150 210 186 140 248 140" />
</g>
<!-- ---------- 统一解析 ---------- -->
<rect x="248" y="82" width="64" height="80" rx="12" fill="none" :stroke="gold" stroke-width="1.4" />
<g stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.45">
<path d="M264 104h32M264 120h32M264 136h20" />
</g>
<!-- 解析分流到四路索引 -->
<g stroke="currentColor" stroke-width="1.1" opacity="0.3">
<path d="M312 104C368 104 402 45 462 45" />
<path d="M312 116C368 116 404 100 462 100" />
<path d="M312 128C368 128 404 155 462 155" />
<path d="M312 140C368 140 402 210 462 210" />
</g>
<!-- ---------- 四路索引 ---------- -->
<!-- 向量:均匀点阵 -->
<g :fill="gold" opacity="0.75">
<circle cx="470" cy="39" r="2" />
<circle cx="496" cy="39" r="2" />
<circle cx="522" cy="39" r="2" />
<circle cx="548" cy="39" r="2" />
<circle cx="574" cy="39" r="2" />
<circle cx="600" cy="39" r="2" />
<circle cx="470" cy="51" r="2" />
<circle cx="496" cy="51" r="2" />
<circle cx="522" cy="51" r="2" />
<circle cx="548" cy="51" r="2" />
<circle cx="574" cy="51" r="2" />
<circle cx="600" cy="51" r="2" />
</g>
<!-- 关键词:命中的词被标出来 -->
<g stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.45">
<path d="M470 94h130M534 106h66" />
</g>
<path d="M470 106h52" :stroke="gold" stroke-width="1.6" stroke-linecap="round" />
<!-- Wiki:互链的两页 -->
<g stroke="currentColor" stroke-width="1.3" stroke-linejoin="round">
<rect x="470" y="141" width="44" height="22" rx="4" />
<rect x="556" y="155" width="44" height="22" rx="4" />
</g>
<path d="M514 152C532 152 538 166 556 166" :stroke="gold" stroke-width="1.4" />
<!-- 图谱:实体与关系 -->
<g stroke="currentColor" stroke-width="1.1" opacity="0.4">
<path d="M484 204C500 206 516 206 529 207" />
<path d="M491 219C505 216 518 212 530 211" />
<path d="M543 206C556 204 570 202 584 201" />
<path d="M540 214C550 218 560 221 570 223" />
</g>
<g stroke="currentColor" stroke-width="1.3">
<circle cx="478" cy="202" r="6" />
<circle cx="486" cy="222" r="5.5" />
<circle cx="590" cy="200" r="5.5" />
<circle cx="575" cy="225" r="5" />
</g>
<circle cx="536" cy="208" r="7" fill="none" :stroke="gold" stroke-width="1.5" />
<!-- 四路索引汇入核心 -->
<g stroke="currentColor" stroke-width="1.1" opacity="0.3">
<path d="M612 45C672 45 700 104 716 106" />
<path d="M612 100C670 100 700 116 716 118" />
<path d="M612 155C670 155 700 128 716 126" />
<path d="M612 210C672 210 700 140 716 138" />
</g>
<!-- ---------- 核心:同一套知识库与 Agent ---------- -->
<circle cx="760" cy="122" r="53" fill="none" stroke="currentColor" stroke-width="1" opacity="0.16" />
<circle cx="760" cy="122" r="46" fill="none" :stroke="gold" stroke-width="1.5" />
<g stroke="currentColor" stroke-width="1.3" stroke-linecap="round" opacity="0.75">
<path d="M740 112h40M740 124h40M740 136h22" />
</g>
<circle cx="775" cy="136" r="3.4" :fill="gold" />
<!-- 核心扇形展开到九种客户端 -->
<g stroke="currentColor" stroke-width="1.1" opacity="0.3">
<path v-for="(sp, i) in spokes" :key="i" :d="sp.d" />
</g>
<!-- ---------- 右:九种客户端 ---------- -->
<!-- Web 控制台:窗口里是带出处标记的回答 -->
<g :transform="`translate(${spokes[0].cx} ${spokes[0].cy})`">
<rect x="-13" y="-10" width="26" height="20" rx="3.5" fill="none" stroke="currentColor" stroke-width="1.3" />
<path d="M-13-4h26" stroke="currentColor" stroke-width="1.1" opacity="0.45" />
<circle cx="-9" cy="-7" r="1.4" :fill="gold" />
<path d="M-9 1h13" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.4" />
<rect x="-9" y="4" width="7" height="4" rx="1.5" fill="none" :stroke="gold" stroke-width="1.2" />
</g>
<!-- 桌面客户端 -->
<g :transform="`translate(${spokes[1].cx} ${spokes[1].cy})`" fill="none">
<rect x="-13" y="-11" width="26" height="17" rx="3" stroke="currentColor" stroke-width="1.3" />
<path stroke="currentColor" stroke-width="1.3" stroke-linecap="round" d="M-5 11h10M0 6v5" />
<path :stroke="gold" stroke-width="1.2" stroke-linecap="round" d="M-8-5h11" />
</g>
<!-- Chrome 插件:网页右侧的问答边栏 -->
<g :transform="`translate(${spokes[2].cx} ${spokes[2].cy})`" fill="none">
<rect x="-13" y="-10" width="26" height="20" rx="3.5" stroke="currentColor" stroke-width="1.3" />
<path d="M-9-4h9M-9 1h6" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.4" />
<path :stroke="gold" stroke-width="1.3" d="M4-10v20" />
<path :stroke="gold" stroke-width="1.1" stroke-linecap="round" opacity="0.75" d="M7-3h4M7 2h4" />
</g>
<!-- 网页嵌入挂件:站点角上的悬浮问答 -->
<g :transform="`translate(${spokes[3].cx} ${spokes[3].cy})`" fill="none">
<rect x="-13" y="-11" width="26" height="22" rx="3.5" stroke="currentColor" stroke-width="1.3" />
<path d="M-9-6h10M-9-1h7" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.4" />
<path :stroke="gold" stroke-width="1.3" stroke-linejoin="round" d="M0 2h11v7H5l-3 2.6V9H0z" />
</g>
<!-- IM 机器人 -->
<g :transform="`translate(${spokes[4].cx} ${spokes[4].cy})`" fill="none">
<rect x="-11" y="-6" width="22" height="17" rx="5" stroke="currentColor" stroke-width="1.3" />
<path d="M0-10.5v4.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" />
<circle cx="0" cy="-12" r="1.6" stroke="currentColor" stroke-width="1.2" />
<g :fill="gold">
<circle cx="-4" cy="2.5" r="1.7" />
<circle cx="4" cy="2.5" r="1.7" />
</g>
</g>
<!-- 微信小程序 -->
<g :transform="`translate(${spokes[5].cx} ${spokes[5].cy})`" fill="none">
<rect x="-7" y="-12" width="14" height="24" rx="3.5" stroke="currentColor" stroke-width="1.3" />
<rect x="-4" y="-6" width="8" height="8" rx="2" :stroke="gold" stroke-width="1.3" />
<path d="M-2.5 8.5h5" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.45" />
</g>
<!-- 命令行 -->
<g :transform="`translate(${spokes[6].cx} ${spokes[6].cy})`" fill="none">
<rect x="-13" y="-10" width="26" height="20" rx="3.5" stroke="currentColor" stroke-width="1.3" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" d="M-7-3.5L-3.5 0-7 3.5" />
<path d="M0 4h7" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" opacity="0.45" />
</g>
<!-- REST API 与 SDK -->
<g :transform="`translate(${spokes[7].cx} ${spokes[7].cy})`" fill="none">
<g stroke="currentColor" stroke-width="1.3" stroke-linecap="round">
<path d="M-4-10c-2.8 0-3.2 1.4-3.2 3.4v2.6c0 2-1 3-2.6 3 1.6 0 2.6 1 2.6 3v2.6c0 2 .4 3.4 3.2 3.4" />
<path d="M4-10c2.8 0 3.2 1.4 3.2 3.4v2.6c0 2 1 3 2.6 3-1.6 0-2.6 1-2.6 3v2.6c0 2-.4 3.4-3.2 3.4" />
</g>
<circle cx="0" cy="1" r="1.8" :fill="gold" />
</g>
<!-- MCP:双向 -->
<g :transform="`translate(${spokes[8].cx} ${spokes[8].cy})`" fill="none">
<g stroke="currentColor" stroke-width="1.3">
<rect x="-13" y="-7" width="9" height="14" rx="2.5" />
<rect x="4" y="-7" width="9" height="14" rx="2.5" />
</g>
<path :stroke="gold" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" d="M-2.5-3h5.5M1-5l2 2-2 2" />
<path stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" opacity="0.6" d="M2.5 3h-5.5M-1 1l-2 2 2 2" />
</g>
</svg>
<!-- ==================== 处理流程 四枚 ==================== -->
<!-- 读懂文档:版式还原 -->
<svg v-else-if="name === 'read'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M5 3h9l5 5v13H5z" />
<path v-bind="s" d="M14 3v5h5" />
<path v-bind="s" opacity="0.5" d="M8 12h8M8 15.5h8" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" d="M8 19h5" />
</svg>
<!-- 切好知识:父块套子块 -->
<svg v-else-if="name === 'chunk'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="3" y="3.5" width="18" height="17" rx="2" />
<path v-bind="s" opacity="0.5" d="M3 9h18M3 15h18" />
<rect x="5.5" y="10" width="9" height="4" rx="1" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- 找准证据:两路召回汇合成一份排好序的结果 -->
<svg v-else-if="name === 'retrieve'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M2.5 5.5c5.5 0 3.5 6.5 8 6.5" />
<path v-bind="s" d="M2.5 18.5c5.5 0 3.5-6.5 8-6.5" />
<path :stroke="gold" stroke-width="1.6" stroke-linecap="round" d="M13.5 8.5h8" />
<path v-bind="s" opacity="0.55" d="M13.5 12.5h6M13.5 16.5h4" />
</svg>
<!-- 可核对的回答:气泡 + 出处角标 -->
<svg v-else-if="name === 'answer'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M4 4h16v12H9l-5 4z" />
<path v-bind="s" opacity="0.5" d="M7.5 8.5h9M7.5 12h5" />
<circle cx="17" cy="12" r="2" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- ==================== 核心能力 九枚 ==================== -->
<!-- Wiki:互链的页面 -->
<svg v-else-if="name === 'wiki'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="3" width="8" height="10" rx="1.5" />
<rect v-bind="s" x="13.5" y="11" width="8" height="10" rx="1.5" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" fill="none" d="M10.5 8h5a2 2 0 012 2v1" />
</svg>
<!-- 分块编辑与版本:历史堆叠 -->
<svg v-else-if="name === 'version'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" opacity="0.45" x="3" y="3" width="14" height="8" rx="1.5" />
<rect v-bind="s" x="7" y="9.5" width="14" height="8" rx="1.5" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" d="M6 21h12" />
</svg>
<!-- 多渠道:中心向外分发 -->
<svg v-else-if="name === 'channels'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<circle cx="12" cy="12" r="3" fill="none" :stroke="gold" stroke-width="1.4" />
<path v-bind="s" opacity="0.7" d="M12 9V4.8M12 15v4.2M9 12H4.8M15 12h4.2" />
<g v-bind="s" opacity="0.55">
<circle cx="12" cy="3.4" r="1.4" />
<circle cx="12" cy="20.6" r="1.4" />
<circle cx="3.4" cy="12" r="1.4" />
<circle cx="20.6" cy="12" r="1.4" />
</g>
</svg>
<!-- MCP:双向 -->
<svg v-else-if="name === 'mcp'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="6" width="7" height="12" rx="1.5" />
<rect v-bind="s" x="14.5" y="6" width="7" height="12" rx="1.5" />
<path
:stroke="gold"
stroke-width="1.4"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
d="M10 9.5h4.5M13 8l1.6 1.5"
/>
<path v-bind="s" d="M14 14.5H9.5M11.1 13l-1.6 1.5" />
</svg>
<!-- 多空间隔离与审计:盾 -->
<svg v-else-if="name === 'govern'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M12 2.8l7.5 3v6.4c0 4-3.2 7.4-7.5 9-4.3-1.6-7.5-5-7.5-9V5.8z" />
<path
:stroke="gold"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
d="M8.8 12.2l2.3 2.3 4.1-4.4"
/>
</svg>
<!-- 可插拔:底板上的可替换模块 -->
<svg v-else-if="name === 'pluggable'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="4" width="19" height="16" rx="2" />
<path v-bind="s" opacity="0.5" d="M2.5 9.5h5M2.5 14.5h5" />
<rect x="10" y="8" width="8" height="8" rx="1.5" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- 知识图谱:实体与关系 -->
<svg v-else-if="name === 'graph'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" opacity="0.5" d="M7.2 5.9l9.2 -1.4M6.4 8.7l9.6 8.2M9.9 19.4l5.4 -0.9" />
<circle v-bind="s" cx="5" cy="6.5" r="2.3" />
<circle v-bind="s" cx="7.6" cy="19.6" r="2.3" />
<circle v-bind="s" cx="17.6" cy="18.2" r="2.3" />
<circle cx="18.6" cy="4.4" r="2.4" fill="none" :stroke="gold" stroke-width="1.5" />
</svg>
<!-- 数据源:按计划同步 -->
<svg v-else-if="name === 'sync'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M20 12a8 8 0 10-2.6 5.9" />
<path
:stroke="gold"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
d="M20.6 7.6V12h-4.4"
/>
<path v-bind="s" opacity="0.5" d="M12 7.8V12l2.8 1.8" />
</svg>
<!-- ==================== 部署形态 三枚 ==================== -->
<!-- Docker Compose:一叠一起起来的服务 -->
<svg v-else-if="name === 'compose'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect x="3" y="3.5" width="18" height="5" rx="1.4" fill="none" :stroke="gold" stroke-width="1.4" />
<g v-bind="s">
<rect x="3" y="10.5" width="18" height="5" rx="1.4" />
<rect x="3" y="17.5" width="18" height="5" rx="1.4" />
</g>
<g :fill="gold" opacity="0.85">
<circle cx="6.6" cy="13" r="0.9" />
<circle cx="6.6" cy="20" r="0.9" />
</g>
</svg>
<!-- Helm / Kubernetes:舵轮 -->
<svg v-else-if="name === 'helm'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M12 2.6l8.2 4v7.6L12 21.4 3.8 14.2V6.6z" />
<circle cx="12" cy="12" r="2.4" fill="none" :stroke="gold" stroke-width="1.4" />
<path v-bind="s" opacity="0.55" d="M12 6.4v3.2M9.9 13.4l-2.6 1.9M14.1 13.4l2.6 1.9" />
</svg>
<!-- Lite:单机一台 -->
<svg v-else-if="name === 'lite'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="4" y="4" width="16" height="11" rx="1.8" />
<path v-bind="s" opacity="0.5" d="M2.5 18.5h19" />
<rect x="9" y="7.5" width="6" height="4" rx="1" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- ==================== 文档地图 六枚 ==================== -->
<!-- 快速开始:起播 -->
<svg v-else-if="name === 'start'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<circle v-bind="s" cx="12" cy="12" r="9" />
<path
:stroke="gold"
stroke-width="1.5"
stroke-linejoin="round"
stroke-linecap="round"
fill="none"
d="M10 8.4l6 3.6-6 3.6z"
/>
</svg>
<!-- 架构:自上而下的层级 -->
<svg v-else-if="name === 'arch'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect x="8.5" y="2.5" width="7" height="5" rx="1.2" fill="none" :stroke="gold" stroke-width="1.4" />
<rect v-bind="s" x="2.5" y="16" width="7" height="5" rx="1.2" />
<rect v-bind="s" x="14.5" y="16" width="7" height="5" rx="1.2" />
<path v-bind="s" opacity="0.6" d="M12 7.5v4M6 16v-4.5h12V16" />
</svg>
<!-- 功能模块:栅格 -->
<svg v-else-if="name === 'modules'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<g v-bind="s">
<rect x="3" y="3" width="7" height="7" rx="1.4" />
<rect x="3" y="14" width="7" height="7" rx="1.4" />
<rect x="14" y="14" width="7" height="7" rx="1.4" />
</g>
<rect x="14" y="3" width="7" height="7" rx="1.4" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- 客户端:多端 -->
<svg v-else-if="name === 'clients'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M14.5 17H3.5a1 1 0 01-1-1V5a1 1 0 011-1h15a1 1 0 011 1v2.5" />
<path v-bind="s" opacity="0.5" d="M7.5 20h5M10 17v3" />
<rect x="15" y="10" width="6.5" height="10" rx="1.5" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- 开发指南:源码尖括号 -->
<svg v-else-if="name === 'dev'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M8 7.5L3.5 12 8 16.5M16 7.5l4.5 4.5-4.5 4.5" />
<path :stroke="gold" stroke-width="1.5" stroke-linecap="round" d="M13.6 5.5l-3.2 13" />
</svg>
<!-- ==================== 客户端入口 九枚 ==================== -->
<!-- Web 控制台:浏览器窗口 -->
<svg v-else-if="name === 'console'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="4" width="19" height="16" rx="2" />
<path v-bind="s" d="M2.5 8.5h19" />
<circle :fill="gold" cx="5.6" cy="6.2" r="0.9" />
<path v-bind="s" opacity="0.45" d="M6 12.5h8M6 16h5" />
</svg>
<!-- Chrome 插件:网页右侧的问答边栏 -->
<svg v-else-if="name === 'extension'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="4" width="19" height="16" rx="2" />
<path v-bind="s" opacity="0.45" d="M5.5 8.5h6M5.5 12h4" />
<path :stroke="gold" stroke-width="1.4" d="M14.5 4v16" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" opacity="0.75" d="M17 9h2M17 12.5h2" />
</svg>
<!-- 网页嵌入挂件:站点角上的悬浮问答 -->
<svg v-else-if="name === 'embed'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="3.5" width="19" height="17" rx="2" />
<path v-bind="s" opacity="0.45" d="M6 8h7M6 11.5h5" />
<path
:stroke="gold"
stroke-width="1.4"
stroke-linejoin="round"
fill="none"
d="M12.5 13.5h6.5v3.5h-4l-2.5 1.9z"
/>
</svg>
<!-- 桌面客户端:显示器 -->
<svg v-else-if="name === 'desktop'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="4" width="19" height="12.5" rx="2" />
<path v-bind="s" d="M9.5 20h5M12 16.5V20" />
<path :stroke="gold" stroke-width="1.4" stroke-linecap="round" d="M6.5 8.5h7" />
</svg>
<!-- IM 机器人 -->
<svg v-else-if="name === 'bot'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="3.5" y="7.5" width="17" height="12" rx="3" />
<path v-bind="s" d="M12 4.2v3.3" />
<circle v-bind="s" cx="12" cy="3.2" r="1.2" />
<g :fill="gold">
<circle cx="9" cy="13.2" r="1.3" />
<circle cx="15" cy="13.2" r="1.3" />
</g>
</svg>
<!-- 微信小程序:手机 -->
<svg v-else-if="name === 'mobile'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="6" y="2.5" width="12" height="19" rx="2.5" />
<path v-bind="s" opacity="0.5" d="M10.6 19h2.8" />
<rect x="9" y="7" width="6" height="6" rx="1.4" fill="none" :stroke="gold" stroke-width="1.4" />
</svg>
<!-- 命令行 -->
<svg v-else-if="name === 'cli'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<rect v-bind="s" x="2.5" y="4" width="19" height="16" rx="2" />
<path
:stroke="gold"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
d="M6.5 9.5L9.5 12l-3 2.5"
/>
<path v-bind="s" opacity="0.5" d="M12 15h5.5" />
</svg>
<!-- REST API 与 SDK:花括号 -->
<svg v-else-if="name === 'api'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M9 3.5c-2.2 0-2.6 1.2-2.6 3v2.3c0 1.8-.8 2.6-2.4 3.2 1.6.6 2.4 1.4 2.4 3.2v2.3c0 1.8.4 3 2.6 3" />
<path v-bind="s" d="M15 3.5c2.2 0 2.6 1.2 2.6 3v2.3c0 1.8.8 2.6 2.4 3.2-1.6.6-2.4 1.4-2.4 3.2v2.3c0 1.8-.4 3-2.6 3" />
<circle :fill="gold" cx="12" cy="12" r="1.5" />
</svg>
<!-- FAQ:问答对 -->
<svg v-else-if="name === 'faq'" class="illus" viewBox="0 0 24 24" aria-hidden="true">
<path v-bind="s" d="M3 3.5h13v9H8l-5 4z" />
<path v-bind="s" opacity="0.5" d="M6 7h7M6 10h4" />
<path
:stroke="gold"
stroke-width="1.4"
stroke-linecap="round"
stroke-linejoin="round"
fill="none"
d="M21 15.5h-8.5v4.5H18l3 2.2z"
/>
</svg>
</template>
<style scoped>
.illus {
display: block;
width: 100%;
height: 100%;
overflow: visible;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
<script setup lang="ts">
import { nextTick, onMounted, ref, watch } from 'vue'
import { useData } from 'vitepress'
const { page } = useData()
const label = ref<HTMLElement>()
async function revealCurrentPage() {
// Wait for VitePress to mark the current link and expand its section.
await nextTick()
const sidebar = label.value?.closest<HTMLElement>('.VPSidebar')
const active = sidebar?.querySelector<HTMLElement>('.VPSidebarItem.is-active > .item > a')
if (!sidebar || !active) return
const bounds = sidebar.getBoundingClientRect()
const item = active.getBoundingClientRect()
const curtain = sidebar.querySelector<HTMLElement>('.curtain')?.getBoundingClientRect()
const top = Math.max(bounds.top, curtain?.bottom ?? bounds.top) + 16
const bottom = bounds.bottom - 16
if (item.top >= top && item.bottom <= bottom) return
// Move only the sidebar; scrollIntoView could also move the document body.
sidebar.scrollTop += item.top - (top + (bottom - top - item.height) / 2)
}
onMounted(revealCurrentPage)
watch(() => page.value.relativePath, revealCurrentPage, { flush: 'post' })
</script>
<template>
<p ref="label" class="wk-docs-label">使用文档</p>
</template>

View File

@ -0,0 +1,42 @@
<script setup lang="ts">
import { computed, h, ref, watch, onMounted, onUnmounted } from 'vue'
import { useData, useRoute } from 'vitepress'
import Search from 'vitepress/dist/client/theme-default/components/VPNavBarSearch.vue'
import { repositoryUrl, headerIcons } from '../../shared/header'
const { isDark } = useData()
const route = useRoute()
const docsNavigation = [
{ label: '快速开始', href: '/docs/01-getting-started/03-quickstart', section: '/docs/01-getting-started/' },
{ label: '架构', href: '/docs/02-architecture/01-overview', section: '/docs/02-architecture/' },
{ label: '功能', href: '/docs/03-features/01-tenant-auth', section: '/docs/03-features/' },
{ label: 'API', href: '/docs/04-api/01-api-overview', section: '/docs/04-api/' },
{ label: '客户端', href: '/docs/05-clients/01-frontend', section: '/docs/05-clients/' },
{ label: '开发', href: '/docs/06-development/01-dev-guide', section: '/docs/06-development/' },
]
const open = ref(false)
watch(() => route.path, () => open.value = false)
const menu = ref<HTMLButtonElement>()
const label = computed(() => isDark.value ? '切换到浅色' : '切换到深色')
const HeaderIcon = (props: { name: string }) => h('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', 'stroke-width': 1.4, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true' }, [h('path', { d: headerIcons[props.name] })])
function closeMenu(event: KeyboardEvent) {
if (event.key === 'Escape' && open.value) { open.value = false; menu.value?.focus() }
}
onMounted(() => document.addEventListener('keydown', closeMenu))
onUnmounted(() => document.removeEventListener('keydown', closeMenu))
</script>
<template>
<header class="wk-header wk-docs-header">
<div class="wk-header-inner">
<a class="wk-brand" href="/" target="_self" aria-label="WeKnora 首页"><span class="wk-logo"><img :src="'/brand/weknora-original.png'" alt="WeKnora" width="945" height="650"></span></a>
<nav id="main-navigation" class="wk-navigation" :class="{ 'is-open': open }" aria-label="文档导航">
<a v-for="item in docsNavigation" :key="item.href" :href="item.href" :aria-current="route.path.startsWith(item.section) ? 'page' : undefined" @click="open = false">{{ item.label }}</a>
<div class="wk-header-search"><Search /></div>
<a class="wk-mobile-github" :href="repositoryUrl" target="_blank" rel="noreferrer">GitHub <HeaderIcon name="external" /></a>
</nav>
<button class="wk-theme-toggle" type="button" role="switch" :aria-checked="isDark" :aria-label="label" :title="label" @click="isDark = !isDark"><HeaderIcon :name="isDark ? 'moon' : 'sun'" /></button>
<a class="wk-header-github" :href="repositoryUrl" target="_blank" rel="noreferrer"><HeaderIcon name="github" /><span>GitHub</span></a>
<button ref="menu" class="wk-menu-toggle" type="button" :aria-label="open ? '关闭导航' : '打开导航'" :aria-expanded="open" aria-controls="main-navigation" @click="open = !open"><HeaderIcon :name="open ? 'close' : 'menu'" /></button>
</div>
</header>
</template>

View File

@ -1,16 +1,20 @@
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import Landing from './Landing.vue'
import DefaultTheme from 'vitepress/theme-without-fonts'
import SiteHeader from './SiteHeader.vue'
import SidebarNavigationSync from './SidebarNavigationSync.vue'
import MermaidZoom from './MermaidZoom.vue'
import Screenshot from './Screenshot.vue'
import './style.css'
export default {
extends: DefaultTheme,
Layout: () => h(DefaultTheme.Layout, null, { 'layout-bottom': () => h(MermaidZoom) }),
Layout: () => h(DefaultTheme.Layout, null, {
'layout-bottom': () => h(MermaidZoom),
'layout-top': () => h(SiteHeader),
'sidebar-nav-before': () => h(SidebarNavigationSync),
}),
enhanceApp({ app }) {
app.component('Landing', Landing)
app.component('Screenshot', Screenshot)
},
} satisfies Theme

View File

@ -1,28 +1,13 @@
@import '../../shared/brand.css';
@import '../../shared/header.css';
/* ==========================================================================
WeKnora 文档站主题
墨蓝(logo 主色)· 纸白 · 鎏金(帆浪点缀)
========================================================================== */
:root {
--wk-ink: #101f38;
--wk-ink-deep: #0a1526;
--wk-ink-soft: #40536f;
--wk-ink-mute: #6d7d94;
--wk-gold: #b8863b;
--wk-gold-light: #d9a94f;
--wk-paper: #fdfcfa;
--wk-paper-2: #f5f3ee;
--wk-paper-3: #edeae2;
--wk-rule: rgba(16, 31, 56, 0.12);
--wk-rule-soft: rgba(16, 31, 56, 0.07);
--wk-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
"PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans CJK SC",
"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
--wk-font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
Georgia, "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "STSong", serif;
--wk-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
Consolas, "Liberation Mono", monospace;
/* —— 覆盖 VitePress 默认变量 —— */
--vp-font-family-base: var(--wk-font-sans);
@ -51,7 +36,7 @@
大片空白;给一个大于视口的定值又会让左内边距被钳到 0、正文钻到侧栏底下。
取 100vw 时右侧内边距为 0、左侧正好等于侧栏宽度。 */
--vp-layout-max-width: 100vw;
--vp-nav-height: 68px;
--vp-nav-height: 64px;
--vp-sidebar-width: 288px;
--vp-code-block-bg: #fbf9f5;
@ -60,16 +45,6 @@
}
.dark {
--wk-ink: #e6ecf5;
--wk-ink-soft: #a9b6c9;
--wk-ink-mute: #7d8ca2;
--wk-gold: #d9a94f;
--wk-gold-light: #e8c176;
--wk-paper: #0b1220;
--wk-paper-2: #101a2b;
--wk-paper-3: #16233a;
--wk-rule: rgba(190, 208, 232, 0.14);
--wk-rule-soft: rgba(190, 208, 232, 0.08);
--vp-c-brand-1: #e6ecf5;
--vp-c-brand-2: #c3d0e2;
@ -92,91 +67,6 @@ body {
background: rgba(184, 134, 59, 0.22);
}
/* --------------------------------------------------------------------------
顶栏
-------------------------------------------------------------------------- */
.VPNav {
backdrop-filter: saturate(140%) blur(14px);
}
.VPNavBar:not(.has-sidebar):not(.top) {
background-color: color-mix(in srgb, var(--wk-paper) 82%, transparent);
}
/* 导航栏与正文之间不要任何分隔线或渐变 */
.VPNavBar .divider,
.VPNavBar .curtain {
display: none;
}
/* 默认主题在有侧栏时把标题块撑到侧栏宽、搜索框推到正文列起点,
这里让它与首页(无侧栏)共用同一套居中容器,两种页面的 logo 与搜索位置才一致 */
@media (min-width: 960px) {
.VPNavBar.has-sidebar .wrapper {
padding: 0 32px;
}
.VPNavBar.has-sidebar .container {
max-width: calc(var(--vp-layout-max-width) - 64px);
}
.VPNavBar.has-sidebar .title {
position: static;
width: auto;
padding: 0;
}
.VPNavBar.has-sidebar .content {
padding-left: 0;
padding-right: 0;
}
}
.VPNavBarTitle .title {
font-family: var(--wk-font-sans);
font-weight: 600;
letter-spacing: 0.14em;
font-size: 15px;
text-transform: uppercase;
border-bottom: none !important;
}
.VPNavBarTitle .logo {
height: 22px;
margin-right: 10px;
}
.VPNavBarMenuLink {
position: relative;
font-size: 13.5px !important;
font-weight: 500;
letter-spacing: 0.04em;
color: var(--wk-ink-soft) !important;
}
.VPNavBarMenuLink.active,
.VPNavBarMenuLink:hover {
color: var(--wk-ink) !important;
}
.VPNavBarMenuLink.active::after {
content: "";
position: absolute;
left: 12px;
right: 12px;
bottom: 16px;
height: 1px;
background: var(--wk-gold);
}
.VPNavBarSearch .DocSearch-Button,
.VPNavBarSearch button {
border-radius: 2px;
border: 1px solid var(--wk-rule);
background: transparent;
}
/* --------------------------------------------------------------------------
侧边栏
-------------------------------------------------------------------------- */
@ -223,7 +113,7 @@ body {
/* 默认主题的 curtain 用负 margin 铺满侧栏宽度,会盖住滚动条顶部 */
@media (min-width: 960px) {
.VPSidebar .curtain {
/* 默认写死 -64px,本站 nav-height 为 68px,对齐以免 sticky 错位 */
/* Keep the sidebar curtain aligned with the shared masthead. */
top: calc(var(--vp-nav-height) * -1);
margin-right: 0;
width: calc(100% + 32px);
@ -300,24 +190,31 @@ body {
color: var(--wk-ink);
}
.VPSidebarItem.level-1 > .item {
margin-left: -10px;
padding: 0 10px;
width: calc(100% + 10px);
border-radius: 5px;
}
.VPSidebarItem.level-1.is-active .link .text {
color: var(--wk-ink) !important;
font-weight: 600;
color: var(--wk-accent-text) !important;
font-weight: 700;
}
.VPSidebarItem.level-1.is-active > .item {
position: relative;
background: color-mix(in srgb, var(--wk-gold) 16%, var(--wk-paper));
}
.VPSidebarItem.level-1.is-active > .item::before {
content: "";
position: absolute;
left: -14px;
top: 50%;
transform: translateY(-50%);
left: 0;
top: 6px;
bottom: 6px;
width: 3px;
height: 3px;
border-radius: 50%;
border-radius: 2px;
background: var(--wk-gold);
}
@ -733,23 +630,6 @@ body {
letter-spacing: 0.06em;
}
/* --------------------------------------------------------------------------
首页容器:去掉默认 page 布局的边距限制
-------------------------------------------------------------------------- */
.landing-page .VPPage {
padding: 0;
}
.landing-page .VPContent.is-home,
.landing-page .VPContent {
padding: 0 !important;
}
.landing-page .VPFooter {
display: none;
}
@media (max-width: 640px) {
.vp-doc h1 {
font-size: 32px;
@ -759,3 +639,28 @@ body {
margin-top: 52px;
}
}
/* Reserve the same masthead space in the default documentation layout. */
:root, .hide-nav, .hide-nav .VPSidebar { --vp-nav-height: 64px; }
.wk-docs-header { position: fixed; left: 0; top: 0; }
.VPLocalNav { top: var(--vp-nav-height); }
.wk-docs-label { margin: 0; padding: 24px 0 16px; color: var(--wk-ink-mute); font-size: 12px; letter-spacing: .08em; }
.wk-header-search .VPNavBarSearch { padding: 0; }
.wk-header-search .DocSearch-Button { width: 160px; height: 36px; padding: 0 10px; justify-content: space-between; border: 1px solid var(--wk-rule); border-radius: 4px; background: var(--wk-paper-2); }
.wk-header-search .DocSearch-Button-Placeholder { display: inline-block; padding: 0 8px; font-size: 12px; }
.wk-header-search .DocSearch-Button-Keys { display: flex; }
@media (min-width: 801px) and (max-width: 1280px) {
.wk-header-search .DocSearch-Button { width: 36px; justify-content: center; }
.wk-header-search .DocSearch-Button-Placeholder, .wk-header-search .DocSearch-Button-Keys { display: none; }
.wk-header-search .DocSearch-Search-Icon { margin: 0; }
}
@media (max-width: 800px) {
.wk-header-search { order: -1; margin-bottom: 10px; }
.wk-header-search, .wk-header-search #local-search, .wk-header-search .DocSearch-Button { width: 100%; }
}
@media (max-width: 959px) {
.Layout { padding-top: var(--vp-nav-height); }
.VPSidebar { top: var(--vp-nav-height); }
.wk-docs-label { padding-top: 0; }
}
@media (max-width: 800px) { :root, .hide-nav, .hide-nav .VPSidebar { --vp-nav-height: 64px; } }

View File

@ -1,9 +1,9 @@
import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
const versionFile = resolve(import.meta.dirname, '../../VERSION')
const versionFile = resolve(import.meta.dirname, '../VERSION')
/** 仓库根目录 VERSION 文件中的发布版本(与 scripts/get_version.sh 同源) */
/** website-docs/VERSION 中的站点发布版本,独立构建时无需读取父目录 */
export function getRepoVersion(): string {
if (!existsSync(versionFile)) return 'unknown'
return readFileSync(versionFile, 'utf-8').trim() || 'unknown'

View File

@ -41,11 +41,6 @@
开启自动标签后,系统在解析完成时从已有候选标签中选择匹配项。默认每篇最多关联 3 个,已有标签时跳过。配置只影响后续解析,不自动补齐历史文档,模型失败也不会阻塞文档完成。
<Screenshot
src="/screenshots/kb-folder-tree.png"
caption="文档列表的文件夹树:按目录浏览与重新归类"
hint="展示左侧文件夹树、当前目录下的文档列表,以及重命名/移动文件夹的操作入口。" />
<Screenshot
src="/screenshots/kb-batch-tag.png"
caption="批量打标签:已选文档的共有标签会被预选中"

View File

@ -4,11 +4,6 @@
该功能适用于人物、组织、产品或条款之间关系较多的资料。启用后会增加入库阶段的模型调用,并需要部署 Neo4j。
<Screenshot
src="/screenshots/kg-graph.png"
caption="知识图谱视图:实体与关系"
hint="展示知识库图谱页签中的实体关系图,节点可点击查看关联文档。" />
图谱存储使用 Neo4j,并依赖 APOC 插件。
## 开启配置

View File

@ -109,7 +109,7 @@ publish token 只保存在业务后端,页面通过 `data-token-endpoint` 指
A 网站嵌入 B 的 WeKnora 时,白名单填 A。标准 Nginx 使用 `/api/v1/embed-frame-policy` 获取渠道策略(无需 token,仅返回 CSP,不返回渠道配置),并在 `/embed/:channelId` 的 HTML 响应中设置 `frame-ancestors`;Lite 使用同一策略。该页面不缓存,策略获取失败时不返回嵌入 HTML。
升级时,过去仅填 B 的渠道需改填实际宿主 A,并同时更新前后端。自定义反向代理需保留 CSP、原始 Host(含端口)、协议及 `Sec-Fetch-Site`;详见 [embed-subdomain.md](../../docs/embed-subdomain.md)。白名单限制浏览器嵌入,不能代替访客认证或阻止持有 token 的非浏览器客户端;此类访问控制使用安全模式和限流。
升级时,过去仅填 B 的渠道需改填实际宿主 A,并同时更新前后端。自定义反向代理需保留 CSP、原始 Host(含端口)、协议及 `Sec-Fetch-Site`;详见 [embed-subdomain.md](https://github.com/Tencent/WeKnora/blob/main/docs/embed-subdomain.md)。白名单限制浏览器嵌入,不能代替访客认证或阻止持有 token 的非浏览器客户端;此类访问控制使用安全模式和限流。
### Token 交换(安全模式核心)

View File

@ -1,37 +1,23 @@
# Build from repository root:
# docker build --platform linux/amd64 -f website-docs/Dockerfile -t wechatopenai/weknora-docs:latest .
#
# Gateway (preserve /docs/ prefix):
# location /docs/ { proxy_pass http://weknora-docs:80/docs/; }
#
# VitePress reads VERSION from the repo root (see .vitepress/version.ts), so the
# builder stage mirrors the monorepo layout instead of flattening website-docs/.
FROM node:22-bookworm-slim AS builder
# Build from the repository root with:
# docker build -t weknora-site website-docs
# No host Node.js installation or prebuilt static-site/ is required.
FROM node:24-bookworm-slim AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
ENV NEXT_TELEMETRY_DISABLED=1
COPY VERSION VERSION
COPY website-docs/package.json website-docs/package-lock.json website-docs/
RUN cd website-docs && npm ci
# Install both locked dependency sets before copying source for layer caching.
COPY package.json package-lock.json ./
COPY homepage/package.json homepage/package-lock.json ./homepage/
RUN npm run setup
COPY website-docs/ website-docs/
RUN cd website-docs && npm run build
# Align with internal frontend image: stable-alpine + custom entrypoint + bash.
FROM nginx:stable-alpine AS production-stage
COPY --from=builder /build/website-docs/.vitepress/dist /usr/share/nginx/html
RUN apk add --no-cache bash
COPY website-docs/nginx.conf /etc/nginx/conf.d/default.conf
COPY website-docs/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY . .
RUN npm run build
FROM nginx:stable-alpine AS runtime
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=builder /build/static-site/ /usr/share/nginx/html/
EXPOSE 80
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@ -1,196 +1,132 @@
# WeKnora 文档
# WeKnora 官网与文档
WeKnora(维娜拉)是腾讯开源的企业级知识库与 RAG(Retrieval-Augmented Generation)系统:Go 单体后端 + Vue 3 前端 + Python 文档解析微服务(docreader),支持多租户、多知识库、混合检索、Agent 智能体、知识图谱、Wiki 生成、MCP 集成、多平台 IM 接入与网页嵌入等能力。
`website-docs/` 包含官网、文档、共享样式和全部构建部署脚本,可独立复制和构建,不依赖仓库外层文件。官网和文档共用一个域名、一次构建和一份部署产物。
本目录是 WeKnora 的官方文档,按「入门 → 架构 → 功能 → API → 客户端 → 开发」六个部分组织。
- `/`:产品首页。
- `/docs/`:直接进入“快速上手”。
- `/docs/…`:完整文档,保留分类导航、搜索和侧栏。
## 文档站点
顶栏高 64px、横向铺满。两边使用 README 原版商标,共用颜色、字体和深浅色偏好;Logo 在当前标签返回官网。官网和文档各自使用适合当前页面的导航。
本目录同时是一个 VitePress 站点,Markdown 即页面,新增文件会自动进入侧边栏(标题取正文一级标题,目录顺序按文件名数字前缀)。
## 发布方式:静态文件 + Nginx
### 1. 准备部署包
使用 Node.js 24,在仓库的 `website-docs/` 目录执行。首次构建或依赖锁文件变更后,先安装依赖:
```bash
npm install
npm run dev # 本地预览
npm run build # 产物输出到 .vitepress/dist
npm run preview # 预览构建产物
cd website-docs
npm run setup
npm run build
npm run package:site
```
主题位于 `.vitepress/theme/`:`style.css` 是排版与配色的单一来源,`Landing.vue` 是首页。
`build` 会编译官网、检查文档链接和 Mermaid、编译文档,并校验合并后的资源路径。全部通过后更新 `static-site/`;`package:site` 将其打包到 `releases/`。
## 写作约定
### 2. 上传并解压
- 首段直接说明功能、适用范围和操作结果。使用简洁、客观的表述,减少章节预告、反问、口语化比喻和设计辩解。
- 快速开始按准备、操作、预期结果组织;功能指南以用户任务为主线,配置影响与限制紧跟相关操作;客户端文档先说明连接和使用方式。
- API 参考先说明用途、认证和权限,再列请求、响应与错误;架构文档解释组件职责、数据流和设计约束;开发指南保留修改入口、实现步骤与验证方法。
- 每段围绕一个结论展开。连续段落用于解释行为与原因,列表用于操作步骤,表格用于参数、权限和选项比较。避免用字段清单代替功能说明。
- 接口、字段和默认值保持准确。功能页中的源码索引放在文末「实现参考」,详细实现与日常操作分节编排;迁移历史集中到开发文档或实现参考。
- 标题使用明确的主题或动作,避免手工章节编号。修改已有标题时保留原锚点,或同步修正文内链接;不要用「见第几节」代替链接。
- 涉及界面操作时使用 `<Screenshot>` 组件;只在有助于理解操作时增加截图。
只需把压缩包上传到服务器。服务器不需要 Node.js,也不需要 WeKnora 后端或独立文档服务。
## 截图
每次发布使用一个新的空目录,避免混入旧站点文件。下面的 `20260915-1` 是示例发布编号,后续发布换一个编号:
截图用全局组件 `<Screenshot>` 引用,图片放在 `public/screenshots/` 下:
```md
<Screenshot
src="/screenshots/kb-document-list.png"
caption="知识库文档列表:解析状态、标签与批量操作"
hint="展示文档列表页,包含解析状态列、标签列、顶部筛选栏与勾选后出现的批量操作栏。" />
```bash
sudo mkdir -p /srv/www/weknora/releases/20260915-1
sudo tar -xzf weknora-site-v0.8.0.tar.gz -C /srv/www/weknora/releases/20260915-1
```
图片文件不存在时,组件会渲染成一个带说明的虚线占位框,标出期望的文件路径与该图应当展示的内容;把同名图片放进 `website-docs/public/screenshots/` 即可自动生效,**不需要改 Markdown**。
解压后该目录下应直接有 `index.html`、`docs/`、`_next/`,无需再套一层 `static-site/`。
当前待补充的截图共 2 张:
### 3. 配置域名根目录
| 文件名(放在 `public/screenshots/` 下) | 出现位置 | 应当展示 |
| --- | --- | --- |
| `kb-folder-tree.png` | 知识库 | 文档列表的文件夹树 |
| `kg-graph.png` | 知识图谱 | 实体关系图 |
以 [deploy/nginx.conf](deploy/nginx.conf) 为模板添加站点配置,修改:
仓库 `docs/images/` 下已有一批现成的产品截图(`qa.png`、`knowledgebases.png`、`wiki-browser.png`、`wiki-graph.png`、`settings.png`、`agent-qa.png`、`graph1-3.png`、`langfuse.png`、`rbac-*.png` 等),补图时可以先看看能否直接复用。
## 阅读路径建议
- **初次使用**:01 快速开始 四篇按顺序读完即可完成部署与首次问答。
- **评估选型 / 了解原理**:02 架构 五篇给出系统全貌与两条核心流水线(文档入库、检索问答)。
- **使用某项具体功能**:直接查 03 功能模块 对应章节。
- **对接 API / 写集成**:04 API 参考 + 05 客户端(CLI / Go SDK)。
- **二次开发 / 贡献代码**:06 开发指南,尤其是扩展点指南。
## 目录
### 快速开始 {#_01-快速开始}
| 文档 | 内容 |
| --- | --- |
| [产品介绍](01-getting-started/01-introduction.md) | WeKnora 是什么、核心概念(租户/知识库/知识/分块/会话/Agent 等)、功能总览与系统组件图 |
| [安装部署](01-getting-started/02-installation.md) | docker-compose(含 12 个可选 profile)、开发模式、Helm、Lite 单二进制与桌面应用、Homebrew |
| [快速上手](01-getting-started/03-quickstart.md) | 注册 → 初始化向导 → 配置模型 → 建库 → 上传 → 问答的完整路径,含可直接执行的 curl 链路 |
| [配置详解](01-getting-started/04-configuration.md) | config.yaml 全字段、约 150 个环境变量、prompt 模板、内置模型与内置 Agent 配置 |
### 架构 {#_02-架构}
| 文档 | 内容 |
| --- | --- |
| [总体架构](02-architecture/01-overview.md) | 组件构成、技术栈、进程间通信、顶层目录导览 |
| [Go 后端设计](02-architecture/02-backend-design.md) | 四层架构、uber/dig 依赖注入、启动与优雅退出、路由与中间件、领域模型 ER 图 |
| [文档入库流程](02-architecture/03-document-pipeline.md) | 上传/URL/手动创建 → 存储 → 解析 → 分块 → 向量化 → 索引 → 后处理的全链路与状态机 |
| [检索问答流程](02-architecture/04-rag-pipeline.md) | chat_pipeline 插件流水线、跨库检索与融合、重排、流式输出(SSE)与引用生成 |
| [异步任务系统](02-architecture/05-async-tasks.md) | asynq 队列拓扑、6 个 worker pool、Lite 同步模式、死信与任务巡检、事件总线 |
### 功能模块 {#_03-功能模块}
| 文档 | 内容 |
| --- | --- |
| [租户、用户与认证授权](03-features/01-tenant-auth.md) | 多租户模型、JWT / API Key / OIDC、RBAC 角色矩阵、组织与共享空间 |
| [知识库与知识管理](03-features/02-knowledge-base.md) | 知识库类型与全部可配置项、树形文件夹、多标签、自动标签与批量打标、分块编辑与版本历史、自定义元数据、预览安全、复制与移动、活动流、配额 |
| [文档解析服务 docreader](03-features/03-document-parsing.md) | gRPC 接口、三引擎注册表、解析器矩阵(含 HTML / MHTML / Excel 表头模式)、并发模型、部署与扩容 |
| [分块机制](03-features/04-chunking.md) | 自适应分块架构(heading/heuristic/recursive)、父子分块、语义边界重叠、ContextHeader、调试端点 |
| [检索引擎与向量存储](03-features/05-retrieval-engines.md) | 各检索引擎(向量/BM25/全文/混合)能力对比、驱动选择、维度管理、打分归一化 |
| [模型管理](03-features/06-models.md) | 5 类模型、26 个厂商 Provider、内置模型机制、Ollama 本地模型、限流与用量 |
| [Agent 引擎](03-features/07-agent.md) | ReAct 循环、内置与动态工具、上下文与记忆管理、技能系统与沙箱、自定义 Agent、建议问题 |
| [MCP 集成](03-features/08-mcp.md) | MCP 客户端管理、OAuth 2.0 + PKCE 全流程、工具启停与审批、WeKnora MCP Server(`tencent-weknora-mcp`,31 个工具) |
| [知识图谱](03-features/09-knowledge-graph.md) | 两级开关、LLM 实体关系抽取、Neo4j 存储、图谱增强检索 |
| [数据源导入](03-features/10-datasource.md) | 连接器体系(飞书/Lark/GitLab/IMA/Notion/语雀/RSS)、凭据加密、同步调度与增量更新 |
| [网络搜索与网页抓取](03-features/11-web-search.md) | 13 个搜索引擎、SSRF 防护、web_fetch 双实现、SearXNG 自托管 |
| [IM 集成](03-features/12-im-integration.md) | 10 个 IM 平台适配、消息处理流水线、内置命令、流式渲染、多实例协同 |
| [网页嵌入 Embed Channel](03-features/13-embed-channel.md) | 嵌入渠道配置、匿名会话与 token 交换、安全模式、webhook、接入示例 |
| [Wiki 能力](03-features/14-wiki.md) | 基于知识库的 LLM Wiki 站点生成、四阶段管道、slug 机制、人工编辑与版本回滚、issue 闭环、变更并入知识库活动流 |
| [评估能力](03-features/15-evaluation.md) | 评估任务、Parquet 数据集格式、12 项检索/生成指标 |
| [可观测性与审计](03-features/16-observability.md) | 日志体系、Langfuse 追踪、审计日志与保留策略、限流、健康检查 |
| [FAQ 能力](03-features/17-faq.md) | FAQ 条目模型、批量导入与去重、检索命中策略、克隆同步 |
| [会话与对话体验](03-features/18-chat-experience.md) | 进度条、问题大纲与引用面板、生成文件、导出对话、会话内临时附件、渠道会话可见性、跨会话历史搜索 |
| [存储后端](03-features/19-storage-backends.md) | 多实例注册、空间默认与按库绑定、连通性测试、legacy 别名迁移 |
| [平台管理与系统管理员](03-features/20-platform-admin.md) | 平台级身份与空间 Owner 的边界、首个管理员引导、创建用户、控制台四分区、运行时系统设置 |
| [图片与文件的对外访问](03-features/21-file-access.md) | 四种 URL 形式、各渠道怎么取、IM/API 图片不显示的排查表 |
| [技能目录与沙箱](03-features/22-skills-sandbox.md) | 目录/安装、Docker/Cube/E2B、网络策略、个人变量、生成文件 |
| [跨会话长期记忆](03-features/23-memory.md) | 空间/个人开关、自动提取、待确认项、主题/文档偏好与整理 |
### API 参考 {#_04-api-参考}
按资源分组列出端点、权限、参数、响应与 curl 示例。
| 文档 | 内容 |
| --- | --- |
| [API 总览](04-api/01-api-overview.md) | Base URL、三种认证方式、通用响应包与错误码、分页规范、SSE 协议、限流 |
| [认证与用户](04-api/02-api-auth.md) | /auth 注册登录、token 刷新、邀请 |
| [租户与成员](04-api/02-api-tenant.md) | 租户、成员、邀请、API Key、审计 |
| [组织与共享](04-api/02-api-org.md) | 组织、知识库共享、Agent 共享 |
| [知识库与知识](04-api/02-api-knowledge.md) | 知识库、知识、文件夹 |
| [分块与标签](04-api/02-api-chunks.md) | 分块读写与版本、生成问题、标签、分块预览 |
| [FAQ 与 Wiki](04-api/02-api-faq-wiki.md) | FAQ 管理与导入、Wiki 读写 |
| [会话与聊天](04-api/02-api-chat.md) | 会话、消息、知识问答与 Agent 对话(SSE) |
| [模型与初始化](04-api/02-api-model-system.md) | 模型、初始化向导、WeKnoraCloud、评估 |
| [系统与平台管理](04-api/02-api-system.md) | 系统信息、全局设置、运行时队列、平台 API Key、系统审计 |
| [基础设施与数据源](04-api/02-api-infra.md) | 向量存储、存储后端、Web 搜索、数据源 |
| [Agent 与 MCP](04-api/02-api-agent-mcp.md) | Agent、MCP 服务、OAuth、技能、收藏 |
| [IM、Embed 与文件](04-api/02-api-channels.md) | IM 回调与渠道、微信扫码、Embed、文件服务 |
| [沙箱、技能与个人变量](04-api/02-api-sandbox-skills.md) | 配置、模板、库存、安装与进度、目录、个人变量 |
| [长期记忆](04-api/02-api-memory.md) | 空间配置、个人设置/条目、主题、文档偏好、导出与整理 |
### 客户端 {#_05-客户端}
| 文档 | 内容 |
| --- | --- |
| [Web 前端](05-clients/01-frontend.md) | Vue 3 + TDesign 技术栈、页面路由、状态管理、i18n、部署 |
| [命令行工具 CLI](05-clients/02-cli.md) | 17 个命令组、多 profile 配置、输出格式与退出码、脚本化用法 |
| [Go SDK](05-clients/03-go-sdk.md) | 资源与方法覆盖、流式对话、错误处理、完整示例 |
| [微信小程序](05-clients/04-miniprogram.md) | 页面结构、后端地址与 API Key 配置、构建发布 |
| [桌面端](05-clients/05-desktop.md) | 单机桌面应用(未正式发布)、数据目录与端口设置、偏好设置与自动更新 |
| [Chrome 插件](05-clients/06-chrome-extension.md) | 网页侧边栏问答、剪藏与速记,凭证配置与排查 |
| [Claw Skill](05-clients/07-claw-skill.md) | ClawHub 上的 WeKnora Skill、环境变量配置、与 MCP 的取舍 |
| [DeepSeek Harness 插件](05-clients/08-deepseek-harness.md) | 安装与凭证、4 个工具、范围选择、引用图片与排查 |
### 开发指南 {#_06-开发指南}
| 文档 | 内容 |
| --- | --- |
| [开发指南](06-development/01-dev-guide.md) | 环境要求、Makefile 全目标、开发模式、四条测试线、CI 与代码规范、调试技巧 |
| [数据库与迁移](06-development/02-database-schema.md) | 40+ 张表结构与 ER 图、golang-migrate 双路径(versioned / sqlite)、新增迁移步骤、故障排查 |
| [扩展点指南](06-development/03-extension-points.md) | 9 大扩展点:解析器/分块策略/检索引擎/模型 Provider/搜索引擎/数据源连接器/IM 适配器/Agent 工具/存储后端 |
## 系统组件速览
```mermaid
flowchart LR
subgraph Clients["客户端"]
FE["Web 前端 Vue 3"]
CLI["CLI weknora"]
SDK["Go SDK"]
MINI["微信小程序"]
EMBED["网页嵌入挂件"]
IM["IM 平台 x10"]
end
subgraph Core["核心服务"]
APP["app 主服务 Go/Gin :8080"]
DR["docreader 解析服务 Python gRPC :50051"]
end
subgraph Infra["基础设施"]
PG[("PostgreSQL / ParadeDB")]
RD[("Redis + asynq")]
VS[("向量/检索引擎 可选多种")]
OBJ[("对象存储 local/minio/cos/oss/s3 等")]
NEO[("Neo4j 知识图谱 可选")]
end
LLM["LLM / Embedding / Rerank / VLM 多厂商"]
FE --> APP
CLI --> APP
SDK --> APP
MINI --> APP
EMBED --> APP
IM --> APP
APP --> DR
APP --> PG
APP --> RD
APP --> VS
APP --> OBJ
APP --> NEO
APP --> LLM
```nginx
server_name 你的域名;
root /srv/www/weknora/releases/20260915-1;
```
## 文档约定
如果域名已有 HTTPS 配置,保留原来的证书及监听设置,把模板中的 `root`、`index` 和 `location` 规则合入现有站点配置。域名应指向这台服务器。
- 文中源码路径均相对仓库根目录,如 `internal/agent/engine.go`。
- API 路径默认带 `/api/v1` 前缀;认证方式见 [API 总览](04-api/01-api-overview.md)。
- 配置示例中的密钥均为占位符,生产环境务必替换(尤其 `JWT_SECRET`、`SYSTEM_AES_KEY`、数据库口令)。
- 文档基于仓库根目录 `VERSION` 文件对应版本源码整理(VitePress 构建时自动读取),随代码变更同步维护。
必须保留文档的 `.html` 路由解析规则;不要把所有未知路径回退到官网 `index.html`。当前构建部署在域名根路径,不支持直接放进 `/weknora/` 等子目录。
检查配置后重载:
```bash
sudo nginx -t
sudo nginx -s reload
```
### 4. 确认上线
访问以下路径:
- `/`:官网。
- `/docs/`:快速上手。
- `/docs/03-features/23-memory`:长期记忆文档,直接打开和刷新均正常。
- `/docs/not-found`:返回 404。
再确认搜索、深浅色切换和 Logo 返回官网正常。
后续更新重复构建、打包、上传到新目录,再修改 Nginx `root` 并重载。需要回滚时,将 `root` 改回上一发布目录。确认新版本稳定后再清理旧发布目录。
## 可选:Docker 部署
从干净源码即可构建,无需在宿主机安装 Node.js 或提前生成静态文件。Dockerfile 使用两个阶段:Node.js 24 按两份锁文件安装依赖并构建官网与文档,最终 Nginx 镜像只包含静态产物和服务配置。
在仓库根目录执行:
```bash
docker build -t weknora-site:0.8.0 website-docs
docker run -d --name weknora-site --restart unless-stopped -p 8080:80 weknora-site:0.8.0
```
访问 `http://服务器地址:8080/`。如使用域名和 HTTPS,让现有反向代理转发到该端口即可。镜像内已经包含官网、文档和 Nginx 路由配置。
也可以只复制 `website-docs/` 目录,在该目录执行 `docker build -t weknora-site:0.8.0 .`。构建上下文必须是 `website-docs/`,宿主机的依赖、旧构建产物和部署包由 `.dockerignore` 排除。
从旧文档镜像迁移时,将容器端口映射或反向代理目标端口从 `8081` 改为 `80`(宿主机端口可自行选择,例如 `-p 8081:80`)。域名根路径 `/` 现在提供官网,`/docs/` 提供文档,反向代理需覆盖整个站点并保留请求路径。容器使用 Nginx 官方镜像的默认入口,无需额外的 `docker-entrypoint.sh`。
构建后可在安装了 Node.js 24 和 Docker 的机器上执行以下检查,无需安装 npm 依赖。检查会临时启动容器并自动清理,验证两站路由、静态资源、404、压缩和响应头:
```bash
cd website-docs
npm run test:docker -- weknora-site:0.8.0
```
## 本地开发
使用 Node.js 24 LTS(目录内提供 `.nvmrc`,使用 nvm 时可执行 `nvm use`)。首次获取源码后安装依赖(分别按文档和官网的锁文件安装):
```bash
cd website-docs
npm run setup
npm run build
npm run preview
```
预览地址:`http://127.0.0.1:3000/`。修改源码后重新构建并刷新;可用 `npm run preview -- --port 8080` 指定其他端口。
```bash
npm run check
npm run test:integration
```
集成检查需要安装 Google Chrome,验证主题同步、两边导航、搜索、手机端控件及直达文档路由。可用 `SITE_TEST_URL` 指定待验证的站点。
开发时可分别使用 `npm run dev:homepage`(官网)和 `npm run dev:docs`(文档)获得热更新;完整站内跳转请使用统一构建后的 `npm run preview`。
`npm run build:docs` 只编译文档,`npm run build:homepage` 只编译官网;正式发布使用 `npm run build`,输出会同时包含两者。`VERSION` 是这份站点构建使用的发布版本。
## 工程目录(相对于 website-docs)
- `homepage/`:Next.js 官网源码、品牌素材及独立依赖锁文件。
- `01-getting-started/` 至 `06-development/`:文档正文,原有路径不变。
- `.vitepress/`:文档站配置与主题。
- `public/`、`sample-data/`:文档截图和示例。
- `shared/`:品牌变量、顶栏样式及共用图标。
- `scripts/`:统一构建、检查、预览和打包。
- `static-site/`:唯一的部署目录,由构建生成。
- `deploy/`、`Dockerfile`:Nginx 和 Docker 部署配置。
- `releases/`:生成的部署压缩包。
品牌素材来源见 [homepage/BRAND-ASSETS.md](homepage/BRAND-ASSETS.md)。产品视频使用 README 中的 GitHub 原始附件,播放需要访问 GitHub;页面、文档和截图随包部署。

View File

@ -0,0 +1 @@
0.8.0

View File

@ -0,0 +1,30 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Preserve the public scheme and port when served behind a proxy or Docker.
absolute_redirect off;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css text/javascript application/javascript application/json
application/xml application/rss+xml image/svg+xml font/ttf font/otf;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
location = /docs { return 308 /docs/; }
location /docs/ {
try_files $uri $uri.html $uri/ =404;
error_page 404 /docs/404.html;
}
location / {
try_files $uri $uri/ =404;
error_page 404 /404.html;
}
}

View File

@ -1,4 +0,0 @@
#!/bin/sh
set -e
exec nginx -g 'daemon off;'

View File

@ -0,0 +1,16 @@
# Brand asset sources
Logos identify supported integrations; their names and marks belong to their respective owners.
- WeKnora logo: `docs/images/logo.png` from the WeKnora repository (the README logo), copied unchanged to `public/brand/weknora-original.png`. The site preserves all lettering, graphics and proportions. CSS hides only the empty outer canvas and blends the white background into the page; dark mode uses an inverted presentation with hue rotation. The source image remains unchanged.
- WeKnora browser icon: copied unchanged from the existing product's `frontend/public/favicon.ico` into the homepage and documentation. The replacement square sail SVG is no longer shipped.
- Feishu, GitLab, Tencent IMA, Notion, Yuque, RSS, WeCom, Slack, Telegram: copied unchanged from the WeKnora frontend asset library.
- OpenAI, DeepSeek, Qwen, Hunyuan, Gemini, Ollama, MCP: static SVGs from [Lobe Icons](https://github.com/lobehub/lobe-icons), `@lobehub/icons-static-svg@1.95.0`. Upstream MIT license included with assets.
- Chrome: [official Chrome website asset](https://www.google.com/chrome/static/images/chrome-logo-m100.svg).
- File formats, REST API, CLI: generic interface icons, not brand logos.
- LiteLLM: [official documentation favicon](https://docs.litellm.ai/img/favicon.ico).
## Product screenshots
- Wiki browser: copied unchanged from `../public/screenshots/wiki-browser.png` to `public/product/wiki-browser.png`. Shows the actual Wiki directory, linked page and source references using sample company policies.
- Wiki graph and revision history: copied unchanged from `../public/screenshots/wiki-graph.png` and `wiki-revision-history.png` to matching files in `public/product/`, for the horizontal Wiki gallery.

View File

@ -0,0 +1,11 @@
# WeKnora homepage source
The Next.js homepage is one part of the unified site. Run `npm run setup`, `npm run build`, and `npm run preview` from the parent directory to include both the homepage and the complete `/docs/` site. Deployment instructions are in the parent README.
- `app/page.tsx`: product content and same-origin documentation links.
- `app/home.module.css`: homepage layout.
- `app/interactive.tsx`: responsive navigation, theme switch, and on-demand README video.
- `app/theme.ts`: VitePress-compatible theme persistence and pre-paint initialization.
- `../shared/brand.css`: shared light/dark design tokens.
`npm run dev` can still preview the homepage alone during development. `/docs/` requires the combined preview from the parent directory.

View File

@ -0,0 +1,6 @@
import Image from "next/image";
/** Show the complete original artwork; the viewport only trims blank canvas. */
export function BrandLogo({ priority = false }: { priority?: boolean }) {
return <span className="wk-logo"><Image src="/brand/weknora-original.png" alt="WeKnora" width={945} height={650} priority={priority} /></span>;
}

View File

@ -0,0 +1,45 @@
import Image from "next/image";
import { Icon } from "./ui";
type Integration = { name: string; logo: string } | { name: string; icon: string };
export const dataSources: Integration[] = [
{ name: "PDF / Office", icon: "file" },
{ name: "飞书", logo: "feishu.ico" },
{ name: "GitLab", logo: "gitlab.png" },
{ name: "腾讯 IMA", logo: "ima.png" },
{ name: "Notion", logo: "notion.ico" },
{ name: "语雀", logo: "yuque.ico" },
{ name: "RSS", logo: "rss.svg" },
];
export const clients: Integration[] = [
{ name: "企业微信", logo: "wecom.svg" },
{ name: "飞书", logo: "feishu.ico" },
{ name: "Slack", logo: "slack.svg" },
{ name: "Telegram", logo: "telegram.svg" },
{ name: "Chrome", logo: "chrome.svg" },
{ name: "MCP", logo: "mcp.svg" },
{ name: "API", icon: "code" },
{ name: "CLI", icon: "terminal" },
{ name: "DeepSeek Harness", logo: "deepseek-color.svg" },
];
export const modelProviders: Integration[] = [
{ name: "OpenAI", logo: "openai.svg" },
{ name: "DeepSeek", logo: "deepseek-color.svg" },
{ name: "Qwen", logo: "qwen-color.svg" },
{ name: "混元", logo: "hunyuan-color.svg" },
{ name: "Gemini", logo: "gemini-color.svg" },
{ name: "Ollama", logo: "ollama.svg" },
{ name: "LiteLLM", logo: "litellm.ico" },
];
export function IntegrationMark({ item }: { item: Integration }) {
return <>
{"logo" in item
? <Image src={`/brands/${item.logo}`} alt="" aria-hidden="true" width={22} height={22} />
: <Icon name={item.icon} />}
{item.name}
</>;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,13 @@
@import "tailwindcss";
@import "../../shared/brand.css";
@import "../../shared/header.css";
:root { background: var(--wk-paper); color: var(--wk-ink); }
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--wk-font-sans); -webkit-font-smoothing: antialiased; }
html { scroll-behavior: smooth; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
a { text-decoration: none; }
::selection { background: var(--wk-accent-border); color: var(--wk-ink); }
:focus-visible { outline: 2px solid #b8863b; outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

View File

@ -0,0 +1,260 @@
.site {
--ink: var(--wk-ink);
--soft: var(--wk-ink-soft);
--mute: var(--wk-ink-mute);
--gold: var(--wk-gold);
--paper: var(--wk-paper);
--paper2: var(--wk-paper-2);
--rule: var(--wk-rule);
--serif: var(--wk-font-serif);
color: var(--ink);
background: var(--paper);
font-size: 16px;
line-height: 1.75;
}
.site svg { flex-shrink: 0; }
.site section[id], .videoFigure { scroll-margin-top: 105px; }
.shell { width: calc(100% - 112px); max-width: 1600px; margin-inline: auto; }
.skipLink { position: fixed; left: 20px; top: -100px; z-index: 30; padding: 12px 20px; background: var(--ink); color: var(--paper); }
.skipLink:focus { top: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); flex-shrink: 0; }
.hero { padding-top: 51px; }
.releaseLink { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 13px; color: var(--soft); font-size: 14px; }
.releaseLink > span { border: 1px solid var(--wk-accent-border); padding: 3px 10px; color: var(--wk-accent-text); font-family: ui-monospace, monospace; font-size: 12px; }
.releaseLink svg { width: 17px; height: 17px; transition: transform .2s; }
.releaseLink:hover svg { transform: translateX(4px); }
.heroGrid { display: grid; grid-template-columns: 1.2fr 1fr; align-items: end; gap: 6vw; margin: 28px 0 50px; }
.hero h1 { font-family: var(--serif); font-size: clamp(42px, 4.5vw, 80px); font-weight: 500; line-height: 1.17; letter-spacing: -.045em; margin: 0; }
.hero h1 em { font-style: normal; color: var(--gold); }
.heroAside { padding-bottom: 6px; }
.eyebrow { font-family: ui-monospace, "SF Mono", monospace; color: var(--gold); font-size: 12px; letter-spacing: .14em; font-weight: 500; margin: 0 0 20px; }
.heroDescription { font-size: clamp(16px, 1.32vw, 21px); line-height: 1.85; color: var(--soft); margin: 0; max-width: 550px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 28px; font-size: 15px; font-weight: 550; min-height: 49px; padding: 12px 23px; border: 1px solid var(--ink); border-radius: 3px; transition: background .2s, color .2s, transform .2s; }
.primary { color: var(--paper); background: var(--ink); }
.primary:hover { background: var(--wk-button-hover); transform: translateY(-2px); }
.secondary { color: var(--ink); background: transparent; border-color: var(--rule); gap: 11px; }
.secondary:hover { border-color: var(--gold); background: var(--paper2); }
.primary svg, .secondary svg { width: 18px; height: 18px; }
.heroNote { color: var(--mute); font-size: 13px; margin: 19px 0 0; letter-spacing: .02em; }
.videoFigure { margin: 0; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; box-shadow: 0 22px 55px -35px rgba(16, 31, 56, .28); background: var(--wk-surface); }
.videoTop { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 22px; color: var(--soft); background: var(--paper2); font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: .1em; }
.videoTop > span { display: inline-flex; align-items: center; gap: 10px; }
.videoDot { margin-inline: 5px; color: var(--gold); }
.videoStage { position: relative; aspect-ratio: 16 / 8.5; background: #14191e; }
.videoStage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.videoCover { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; background: linear-gradient(180deg, rgba(18,22,26,.24), rgba(18,22,26,.6)); transition: background .2s; }
.playCircle { width: 82px; height: 82px; display: flex; align-items: center; justify-content: center; background: #fdfcfa; color: #101f38; border-radius: 50%; box-shadow: 0 4px 24px #0002; transition: transform .2s; }
.playCircle svg { width: 29px; height: 29px; transform: translateX(-2px); fill: #101f38; stroke-width: 0; }
.videoCover:hover .playCircle { transform: scale(1.08); }
.videoCoverTitle { font-size: clamp(18px, 2vw, 30px); font-weight: 500; letter-spacing: .07em; margin-top: 24px; }
.videoCoverHint { font-size: 14px; margin-top: 8px; color: #eee8dc; }
.videoError { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--paper2); color: var(--ink); gap: 18px; }
.videoError a { display: inline-flex; gap: 8px; align-items: center; text-decoration: underline; }
.videoError svg { width: 18px; height: 18px; }
.videoCaption { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px 22px; font-size: 13px; color: var(--soft); }
.videoCaption a { color: var(--mute); display: inline-flex; align-items: center; gap: 9px; }
.videoCaption svg { height: 14px; width: 14px; }
.trustBar { display: flex; justify-content: center; align-items: center; gap: 7vw; padding: 30px 0; font-size: 13px; color: var(--soft); border-bottom: 1px solid var(--rule); }
.trustBar span { display: flex; align-items: center; gap: 10px; }
.trustBar svg { width: 18px; height: 18px; color: var(--mute); }
.section { padding-block: 104px; }
.sectionHeading { display: flex; justify-content: space-between; align-items: end; gap: 40px; margin-bottom: 45px; }
.sectionHeading h2, .closing h2 { font-family: var(--serif); font-size: clamp(32px, 3.1vw, 50px); font-weight: 500; line-height: 1.35; letter-spacing: -.03em; margin: 0; }
.sectionHeading > p { font-size: 16px; color: var(--soft); line-height: 1.9; margin: 0 0 3px; }
.modeGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--rule); }
.mode { padding: 35px 35px 32px; display: flex; flex-direction: column; }
.mode:first-child { padding-left: 0; }
.mode:last-child { padding-right: 0; }
.mode + .mode { border-left: 1px solid var(--rule); }
.modeTop { display: flex; justify-content: space-between; align-items: center; margin-bottom: 31px; }
.modeTop > svg { width: 33px; height: 33px; stroke-width: 1.1; }
.modeTop > span { font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: .11em; color: var(--gold); }
.mode h3 { font-size: clamp(20px, 1.7vw, 26px); font-weight: 550; line-height: 1.5; margin: 0 0 15px; }
.mode > p { font-size: 16px; line-height: 1.85; color: var(--soft); margin: 0 0 23px; }
.tags { display: flex; gap: 9px; flex-wrap: wrap; padding: 0; list-style: none; margin: auto 0 31px; }
.tags li { color: var(--soft); background: var(--paper2); padding: 3px 9px; font-size: 12px; border-radius: 2px; }
.textLink { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); font-size: 14px; min-height: 32px; width: fit-content; }
.textLink svg { width: 17px; height: 17px; transition: transform .2s; }
.textLink:hover { color: var(--wk-accent-text); }
.textLink:hover svg { transform: translateX(3px); }
.release { padding-block: 93px 44px; background: var(--paper2); border-block: 1px solid var(--rule); }
.releaseGrid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 58px; align-items: center; }
.artifactFigure { margin: 0; min-width: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 5px; box-shadow: 0 18px 45px -35px #101f3844; overflow: hidden; }
.artifactHeading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 20px; font-size: 13px; border-bottom: 1px solid var(--rule); }
.artifactHeading > span { display: inline-flex; align-items: center; gap: 8px; }
.artifactHeading > span:last-child { font-family: ui-monospace, monospace; letter-spacing: .07em; font-size: 12px; color: var(--mute); }
.artifactHeading svg { width: 17px; height: 17px; color: var(--gold); }
.artifactImage img { display: block; width: 100%; height: auto; }
.artifactFigure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 14px 20px; font-size: 12px; color: var(--soft); border-top: 1px solid var(--rule); }
.artifactFigure figcaption > span:last-child { color: var(--mute); }
.releaseFeatures article { display: grid; grid-template-columns: 27px 1fr; gap: 18px; padding-block: 25px; border-bottom: 1px solid var(--rule); }
.releaseFeatures article:first-child { padding-top: 0; }
.releaseFeatures article:last-child { border: 0; padding-bottom: 0; }
.releaseFeatures article > svg { margin-top: 4px; width: 26px; height: 26px; stroke-width: 1.3; }
.featureLabel { color: var(--wk-accent-text); font-size: 12px; letter-spacing: .08em; }
.releaseFeatures h3 { font-size: 20px; font-weight: 550; line-height: 1.5; margin: 5px 0 10px; }
.releaseFeatures p { font-size: 15px; line-height: 1.85; color: var(--soft); margin: 0 0 7px; }
.releaseFeatures .textLink { font-size: 13px; }
.releaseExtras { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-top: 29px; margin-top: 48px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--soft); }
.releaseExtras > span { color: var(--mute); }
.releaseExtras p { margin: 0; }
.site .wiki { border-bottom: 1px solid var(--rule); padding-block: 48px; scroll-margin-top: 64px; }
.site section.wiki[id] { scroll-margin-top: 64px; }
.wiki .sectionHeading { margin-bottom: 24px; }
.wiki .eyebrow { margin-bottom: 12px; }
.wikiGallery { min-width: 0; }
.wikiGalleryToolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.wikiGalleryTabs { display: flex; gap: 8px; flex-wrap: wrap; }
.wikiGalleryTabs button { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; min-height: 44px; border: 1px solid transparent; border-radius: 3px; color: var(--soft); background: transparent; font-size: 14px; }
.wikiGalleryTabs button[aria-pressed="true"] { color: var(--ink); border-color: var(--rule); background: var(--paper2); }
.wikiGalleryTabs button:hover { color: var(--wk-accent-text); }
.wikiGalleryTabs svg { width: 19px; height: 19px; }
.wikiGalleryTrack { --wiki-slide-width: min(84%, 720px); --wiki-slide-gap: 24px; display: flex; gap: var(--wiki-slide-gap); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; padding-bottom: 16px; }
.wikiSlide { flex: 0 0 var(--wiki-slide-width); scroll-snap-align: center; box-shadow: none; }
.wikiSlide .artifactHeading { padding-block: 10px; }
.wikiSlide .artifactHeading .textLink { font-size: 12px; min-height: 24px; color: var(--soft); }
.wikiSlide .wikiSlideCaption { display: block; padding: 18px 24px; }
.wikiSlideCaption h3 { margin: 0 0 8px; color: var(--ink); font-size: 22px; font-weight: 550; line-height: 1.5; }
.wikiSlideCaption p { margin: 0; max-width: 780px; color: var(--soft); font-size: 15px; line-height: 1.85; }
.wikiGalleryControls { margin-left: auto; color: var(--mute); font-size: 13px; }
.wikiGalleryControls > div { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.wikiGalleryControls > div > span { font-family: ui-monospace, monospace; color: var(--soft); }
.wikiGalleryControls button { display: grid; place-items: center; height: 44px; width: 44px; border: 1px solid var(--rule); border-radius: 50%; color: var(--ink); background: var(--paper); }
.wikiGalleryControls button:first-child svg { transform: rotate(180deg); }
.wikiGalleryControls button:disabled { opacity: .3; cursor: default; }
.wikiGalleryControls button:hover:not(:disabled) { color: var(--wk-accent-text); border-color: var(--gold); }
@media (min-width: 1100px) {
.wikiGalleryToolbar { display: none; }
.wikiGalleryTrack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; scroll-snap-type: none; padding-bottom: 0; }
.wikiSlideCaption h3 { font-size: 20px; }
.wikiSlide .wikiSlideCaption { padding: 20px; }
.wikiSlide .artifactHeading { padding-inline: 16px; }
}
.ecosystem { display: grid; grid-template-columns: 1fr .85fr 1fr; gap: 48px; padding: 38px 0 46px; border-block: 1px solid var(--rule); }
.ecosystemColumn > svg { width: 29px; height: 29px; color: var(--gold); }
.ecosystemColumn h3 { font-size: 23px; font-weight: 550; margin: 18px 0 7px; }
.ecosystemColumn > p { color: var(--soft); font-size: 15px; margin: 0 0 20px; }
.integrations { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.integrations span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--rule); font-size: 13px; background: var(--wk-surface); border-radius: 3px; }
.integrations img, .integrations svg { display: block; width: 20px; height: 20px; flex-shrink: 0; object-fit: contain; }
.ecosystemCore { position: relative; display: flex; justify-content: center; align-items: center; flex-direction: column; border-inline: 1px solid var(--rule); gap: 5px; text-align: center; }
.ecosystemCore > strong { font-size: 28px; margin-top: 10px; font-weight: 550; letter-spacing: -.03em; }
.ecosystemCore > span:not(:global(.wk-logo)) { font-size: 14px; color: var(--soft); }
.ecosystemCore > div { font-size: 12px; color: var(--gold); margin-top: 18px; }
.models { display: flex; align-items: center; justify-content: space-between; gap: 16px 25px; flex-wrap: wrap; padding-top: 28px; }
.models > span { color: var(--mute); font-size: 13px; }
.models > p { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; color: var(--soft); font-weight: 550; margin: 0; }
.models img { display: block; width: 24px; height: 24px; flex-shrink: 0; object-fit: contain; }
.models a { display: flex; align-items: center; min-height: 40px; min-width: 40px; color: var(--soft); }
.enterprise { background: var(--paper2); border-block: 1px solid var(--rule); padding-block: 87px; }
.enterpriseGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 50px; border-top: 1px solid var(--rule); padding-top: 37px; }
.enterpriseGrid article > svg { color: var(--gold); width: 29px; height: 29px; }
.enterpriseGrid h3 { margin: 22px 0 12px; font-size: 22px; font-weight: 550; }
.enterpriseGrid p { margin: 0; color: var(--soft); font-size: 16px; line-height: 1.9; }
.closing { padding-block: 95px; display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.closing h2 { font-size: clamp(30px, 2.8vw, 43px); }
.closing .primary { flex-shrink: 0; }
.footer { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding-block: 28px; border-top: 1px solid var(--rule); }
.footer > p { color: var(--mute); font-size: 12px; margin: 0; }
.footer nav { margin-left: auto; display: flex; gap: 28px; }
.footer nav a { display: flex; align-items: center; gap: 4px; min-height: 44px; color: var(--soft); font-size: 13px; }
@media (min-width: 1800px) { .heroGrid { margin-bottom: 62px; } .hero { padding-top: 70px; } }
@media (max-width: 1100px) {
.shell { width: calc(100% - 64px); }
.heroGrid { gap: 32px; grid-template-columns: 1.1fr 1fr; }
.hero h1 { font-size: clamp(36px, 4.2vw, 48px); }
.heroDescription { font-size: 16px; }
.section { padding-block: 78px; }
.sectionHeading { gap: 30px; }
.sectionHeading > p { max-width: 370px; font-size: 15px; }
.mode { padding-inline: 23px; }
.mode h3 { font-size: 20px; }
.releaseGrid { gap: 32px; grid-template-columns: 1.15fr 1fr; }
.releaseFeatures h3 { font-size: 18px; }
.ecosystem { gap: 28px; grid-template-columns: 1fr .7fr 1fr; }
}
@media (max-width: 800px) {
.wikiGalleryTrack { --wiki-slide-width: 92%; --wiki-slide-gap: 14px; }
.wikiSlide .wikiSlideCaption { padding: 18px; }
.wikiSlideCaption h3 { font-size: 20px; }
.navigationOpen { display: flex; position: absolute; left: 0; top: 72px; right: 0; padding: 20px 32px 26px; background: var(--paper); border-bottom: 1px solid var(--rule); flex-direction: column; align-items: stretch; gap: 4px; box-shadow: 0 15px 20px #101f380a; }
.navigationOpen a { font-size: 16px; }
.hero { padding-top: 34px; }
.heroGrid { align-items: start; grid-template-columns: 1fr; gap: 28px; margin-top: 26px; margin-bottom: 35px; }
.hero h1 { font-size: clamp(38px, 6.2vw, 68px); }
.heroAside > .eyebrow { display: none; }
.heroDescription { max-width: 100%; }
.heroNote { margin-top: 17px; }
.videoTop { padding: 11px 15px; font-size: 12px; }
.videoCaption { align-items: start; flex-direction: column; padding: 13px 15px; gap: 3px; }
.videoCaption a { font-size: 12px; }
.trustBar { gap: 16px 24px; flex-wrap: wrap; justify-content: flex-start; padding: 24px 0; }
.sectionHeading { flex-direction: column; align-items: start; gap: 20px; margin-bottom: 34px; }
.sectionHeading > p { max-width: none; }
.modeGrid { grid-template-columns: 1fr; }
.mode, .mode:first-child, .mode:last-child { padding: 29px 0; }
.mode + .mode { border-left: 0; border-top: 1px solid var(--rule); }
.modeTop { margin-bottom: 18px; }
.mode h3 { font-size: 24px; }
.mode > p { margin-bottom: 18px; }
.tags { margin-bottom: 17px; }
.release { padding-block: 65px 35px; }
.releaseGrid { grid-template-columns: 1fr; gap: 35px; }
.releaseFeatures h3 { font-size: 22px; }
.releaseFeatures p { font-size: 16px; }
.releaseExtras { justify-content: flex-start; margin-top: 28px; padding-top: 23px; }
.releaseExtras > span { flex-basis: 100%; }
.ecosystem { grid-template-columns: 1fr 1fr; gap: 32px; }
.ecosystemCore { grid-row: 1; grid-column: 1 / -1; border-inline: 0; border-bottom: 1px solid var(--rule); padding-bottom: 30px; }
.ecosystemColumn h3 { font-size: 22px; }
.enterprise { padding-block: 65px; }
.enterpriseGrid { grid-template-columns: 1fr; gap: 32px; }
.enterpriseGrid h3 { margin-top: 14px; }
.closing { flex-direction: column; align-items: start; padding-block: 68px; gap: 27px; }
.footer { gap: 14px 25px; }
.footer nav { margin-left: 0; width: 100%; gap: 26px; }
}
@media (max-width: 480px) {
.site .wiki { padding-block: 28px; }
.wiki .sectionHeading { gap: 12px; margin-bottom: 18px; }
.wiki .sectionHeading h2 { font-size: 28px; }
.wikiGalleryTabs { gap: 2px; }
.wikiGalleryTabs button { padding-inline: 9px; gap: 6px; font-size: 13px; }
.wikiGalleryTabs svg { width: 16px; height: 16px; }
.wikiSlide .wikiSlideCaption { padding: 18px 14px; }
.shell { width: calc(100% - 40px); }
.hero h1 { font-size: clamp(28px, 7.9vw, 38px); }
.releaseLink { font-size: 12px; gap: 8px; }
.heroDescription br { display: none; }
.videoTop { letter-spacing: 0; padding-inline: 10px; }
.videoTop > span { gap: 6px; }
.videoTop > span:last-child { display: none; }
.videoDot { margin: 0; }
.playCircle { height: 52px; width: 52px; }
.playCircle svg { width: 22px; height: 22px; }
.videoCoverTitle { font-size: 17px; margin-top: 13px; }
.videoCoverHint { font-size: 12px; margin-top: 4px; }
.trustBar { font-size: 12px; gap: 13px; }
.trustBar span { gap: 7px; }
.section { padding-block: 60px; }
.sectionHeading h2 { font-size: 32px; }
.eyebrow { font-size: 12px; letter-spacing: .09em; margin-bottom: 15px; }
.ecosystem { grid-template-columns: 1fr; padding-top: 28px; }
.ecosystemCore { grid-column: 1; }
.ecosystemColumn + .ecosystemColumn { border-top: 1px solid var(--rule); padding-top: 26px; }
.models { justify-content: flex-start; gap: 15px 22px; }
.models > span { flex-basis: 100%; }
.models > p { font-size: 15px; }
.releaseFeatures article { grid-template-columns: 24px 1fr; gap: 14px; }
.releaseFeatures h3 { font-size: 20px; }
.artifactHeading { padding-inline: 12px; }
.artifactHeading > span:last-child { font-size: 12px; }
.artifactFigure figcaption { padding-inline: 12px; }
.closing h2 { font-size: 30px; }
.footer > p { font-size: 12px; }
}
:global(.dark) .integrations img, :global(.dark) .models img { background: var(--wk-logo-ground); padding: 2px; border-radius: 3px; }
.ecosystemCore > :global(.wk-logo) { margin-bottom: 18px; }

View File

@ -0,0 +1,57 @@
"use client";
import Link from "next/link";
import { BrandLogo } from "./brand-logo";
import { useRef, useState, useSyncExternalStore } from "react";
import { Icon } from "./ui";
import { getThemeSnapshot, subscribeToTheme, toggleTheme } from "./theme";
import { siteNavigation, repositoryUrl, headerIcons } from "../../shared/header";
import s from "./home.module.css";
const videoUrl = "https://github.com/user-attachments/assets/2819598d-3140-4623-814a-8162a22b653c";
function HeaderIcon({ name }: { name: string }) {
return <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d={headerIcons[name]} /></svg>;
}
function ThemeToggle() {
const dark = useSyncExternalStore(subscribeToTheme, getThemeSnapshot, () => false);
const label = dark ? "切换到浅色" : "切换到深色";
return <button className="wk-theme-toggle" type="button" role="switch" aria-checked={dark} aria-label={label} title={label} onClick={toggleTheme}><HeaderIcon name={dark ? "moon" : "sun"} /></button>;
}
export function Header() {
const [open, setOpen] = useState(false);
const menu = useRef<HTMLButtonElement>(null);
return <header className="wk-header" onKeyDown={event => { if (event.key === "Escape" && open) { setOpen(false); menu.current?.focus(); } }}>
<div className="wk-header-inner">
<Link className="wk-brand" href="/" aria-label="WeKnora 首页"><BrandLogo priority /></Link>
<nav id="main-navigation" className={`wk-navigation ${open ? "is-open" : ""}`} aria-label="主导航" onClick={() => setOpen(false)}>
{siteNavigation.map(item => <a key={item.href} href={item.href}>{item.label}{item.badge && <span className="wk-new-label">{item.badge}</span>}</a>)}
<a className="wk-mobile-github" href={repositoryUrl} target="_blank" rel="noreferrer">GitHub <HeaderIcon name="external" /></a>
</nav>
<ThemeToggle />
<a className="wk-header-github" href={repositoryUrl} target="_blank" rel="noreferrer"><HeaderIcon name="github" /><span>GitHub</span></a>
<button ref={menu} type="button" className="wk-menu-toggle" aria-label={open ? "关闭导航" : "打开导航"} aria-expanded={open} aria-controls="main-navigation" onClick={() => setOpen(!open)}><HeaderIcon name={open ? "close" : "menu"} /></button>
</div>
</header>;
}
export function ProductVideo() {
const player = useRef<HTMLVideoElement>(null);
const [started, setStarted] = useState(false);
const [failed, setFailed] = useState(false);
function play() {
setStarted(true);
const video = player.current;
if (video) {
video.src = videoUrl;
video.play().catch(() => { /* Keep native controls available when another playback gesture is required. */ });
video.focus();
}
}
return <figure id="demo" className={s.videoFigure}>
<div className={s.videoTop}><span>产品演示 <span className={s.videoDot}>/</span> PRODUCT FILM</span><span>02:25 <span className={s.videoDot}>/</span> 1080P</span></div>
<div className={s.videoStage}>
<video ref={player} controls={started} playsInline preload="none" poster="/product/agent-chat.png" aria-label="WeKnora 产品介绍,英文旁白,中英字幕" aria-describedby="video-caption" tabIndex={started ? 0 : -1} onError={() => setFailed(true)} />
{!started && <button className={s.videoCover} onClick={play} aria-label="播放 WeKnora 产品介绍视频,2 分 25 秒"><span className={s.playCircle}><Icon name="play" /></span><span className={s.videoCoverTitle}>WeKnora 产品演示</span><span className={s.videoCoverHint}>播放产品介绍 · 2 分 25 秒</span></button>}
{failed && <div className={s.videoError} role="status"><p>视频暂时无法加载</p><a href={videoUrl} target="_blank" rel="noreferrer">在 GitHub 打开原视频 <Icon name="external" /></a></div>}
</div>
<figcaption id="video-caption" className={s.videoCaption}><span>知识问答、Agent 推理与 Wiki 整理</span><a href={videoUrl} target="_blank" rel="noreferrer">README 产品视频 · 英文旁白 / 中英字幕 <Icon name="external" /></a></figcaption>
</figure>;
}

View File

@ -0,0 +1,21 @@
import type { Metadata } from "next";
import "./globals.css";
import { themeInitializationScript } from "./theme";
export const metadata: Metadata = {
title: "WeKnora — 帮你找到答案,并将知识付诸实践",
description: "腾讯开源知识框架 WeKnora,集 RAG 问答、Agent 推理与自动 Wiki 于一体。v0.8.0 带来技能目录、会话级沙箱和跨会话长期记忆,支持私有化部署。",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="zh-CN" className="h-full antialiased" suppressHydrationWarning>
<head><script dangerouslySetInnerHTML={{ __html: themeInitializationScript }} /></head>
<body className="min-h-full flex flex-col">{children}</body>
</html>
);
}

View File

@ -0,0 +1,83 @@
import Image from "next/image";
import Link from "next/link";
import { BrandLogo } from "./brand-logo";
import { Icon } from "./ui";
import { WikiGallery } from "./wiki-gallery";
import { Header, ProductVideo } from "./interactive";
import { clients, dataSources, modelProviders, IntegrationMark } from "./brands";
import s from "./home.module.css";
const repo = "https://github.com/Tencent/WeKnora";
const docs = "/docs/";
const guide = (path: string) => `${docs}${path}.html`;
const modes = [
{ number: "01", icon: "search", label: "RAG", title: "回答有据可查", description: "结合语义与关键词检索查找相关资料,回答附带来源引用,可打开原文核对。", tags: ["混合检索", "多模态解析", "原文引用"], link: "03-features/05-retrieval-engines" },
{ number: "02", icon: "agent", label: "Agent", title: "用知识和工具完成任务", description: "智能体根据任务检索知识库、搜索网页、调用 MCP 工具与技能,并在沙箱中处理文件、运行脚本。", tags: ["多步推理", "工具调用", "技能执行"], link: "03-features/07-agent" },
{ number: "03", icon: "wiki", label: "Wiki", title: "把文档整理成 Wiki", description: "从原始文档生成相互链接的 Wiki 页面与知识图谱,支持浏览、编辑和版本回滚。", tags: ["自动组织", "知识图谱", "版本回滚"], link: "03-features/14-wiki" },
];
const release = [
{ icon: "skills", title: "安装、管理和复用技能", text: "从 ClawHub、SkillHub、Git 或 ZIP 安装技能。在空间内统一管理,查看安装进度,浏览与编辑技能文件。", link: "03-features/22-skills-sandbox", label: "空间技能目录" },
{ icon: "sandbox", title: "在同一沙箱中继续执行任务", text: "支持 Docker、E2B、Cube 三种后端。同一会话中的多轮任务共用一个沙箱工作区,生成的文件可预览与下载。", link: "03-features/22-skills-sandbox", label: "会话级沙箱" },
{ icon: "memory", title: "跨会话保留偏好和任务信息", text: "在后续对话中使用已保存的偏好、事实与任务信息。自动提取的记忆由你确认,也可随时管理或关闭。", link: "03-features/23-memory", label: "长期记忆" },
];
export default function Home() {
return <div className={s.site}>
<a className={s.skipLink} href="#main">跳至正文</a>
<Header />
<main id="main">
<section className={`${s.shell} ${s.hero}`} aria-labelledby="hero-title">
<a href="#release" className={s.releaseLink}><span>v0.8.0</span> 技能、沙箱与长期记忆 <Icon name="arrow" /></a>
<div className={s.heroGrid}>
<h1 id="hero-title">帮你找到答案,<br /><em>并将知识付诸实践。</em></h1>
<div className={s.heroAside}>
<p className={s.eyebrow}>TENCENT OPEN SOURCE · WEKNORA</p>
<p className={s.heroDescription}>腾讯开源的企业级知识管理框架。<br />汇集团队资料,用于知识问答、任务执行和 Wiki 整理。</p>
<div className={s.actions}><a className={s.primary} href={guide("01-getting-started/02-installation")}>开始使用 <Icon name="arrow" /></a><a className={s.secondary} href={repo} target="_blank" rel="noreferrer"><Icon name="github" /> GitHub</a></div>
<p className={s.heroNote}>RAG 问答 / Agent 推理 / 自动 Wiki</p>
</div>
</div>
<ProductVideo />
<div className={s.trustBar}><span><Icon name="github" /> 腾讯开源 · MIT License</span><span><Icon name="server" /> 支持私有化部署</span><span><Icon name="model" /> 自由选择模型与存储</span></div>
</section>
<section id="capabilities" className={`${s.shell} ${s.section}`} aria-labelledby="capabilities-title">
<div className={s.sectionHeading}><div><p className={s.eyebrow}>01 / KNOWLEDGE AT WORK</p><h2 id="capabilities-title">知识问答、任务执行与自动 Wiki</h2></div><p>查询资料用 RAG,处理多步任务用 Agent,<br />整理知识用 Wiki。三种能力共享同一知识库。</p></div>
<div className={s.modeGrid}>{modes.map(mode => <article className={s.mode} key={mode.label}>
<div className={s.modeTop}><Icon name={mode.icon} /><span>{mode.number} / {mode.label.toUpperCase()}</span></div>
<h3>{mode.title}</h3><p>{mode.description}</p><ul className={s.tags}>{mode.tags.map(tag => <li key={tag}>{tag}</li>)}</ul>
<a className={s.textLink} href={mode.label === "Wiki" ? "#wiki" : guide(mode.link)}>了解 {mode.label} <Icon name="arrow" /></a>
</article>)}</div>
</section>
<section id="release" className={s.release} aria-labelledby="release-title"><div className={s.shell}>
<div className={s.sectionHeading}><div><p className={s.eyebrow}>02 / INTRODUCING v0.8.0</p><h2 id="release-title">智能体可以运行技能,<br />也能生成文件。</h2></div><a className={s.textLink} href={`${repo}/blob/main/CHANGELOG.md#080---2026-09-03`} target="_blank" rel="noreferrer">查看版本更新 <Icon name="arrow" /></a></div>
<div className={s.releaseGrid}>
<figure className={s.artifactFigure}><div className={s.artifactHeading}><span><Icon name="file" /> 在对话中预览生成的文件</span><span>AGENT → ARTIFACT</span></div><div className={s.artifactImage}><Image src="/product/skill-sandbox-chat.png" alt="WeKnora 实际界面:智能体根据知识库生成 Word 文档,并在对话旁打开产物预览" width={3840} height={2112} sizes="(max-width: 960px) 100vw, 60vw" /></div><figcaption><span>检索知识 → 执行任务 → 生成文档</span><span>产品实景</span></figcaption></figure>
<div className={s.releaseFeatures}>{release.map(feature => <article key={feature.title}><Icon name={feature.icon} /><div><span className={s.featureLabel}>{feature.label}</span><h3>{feature.title}</h3><p>{feature.text}</p><a className={s.textLink} href={guide(feature.link)}>了解更多 <Icon name="arrow" /></a></div></article>)}</div>
</div>
<div className={s.releaseExtras}><span>本次更新还包括</span><p>GitLab / 腾讯 IMA 数据源</p><p>anydoc Office 解析</p><p>DeepSeek Harness 插件</p><p>LiteLLM 接入</p></div>
</div></section>
<section id="wiki" className={`${s.shell} ${s.section} ${s.wiki}`} aria-labelledby="wiki-title">
<div className={s.sectionHeading}>
<div><p className={s.eyebrow}>03 / AUTOMATIC WIKI</p><h2 id="wiki-title">把文档整理成可浏览的 Wiki。</h2></div>
<a className={s.textLink} href={guide("03-features/14-wiki")}>了解 Wiki 的使用方式 <Icon name="arrow" /></a>
</div>
<WikiGallery />
</section>
<section id="ecosystem" className={`${s.shell} ${s.section}`} aria-labelledby="ecosystem-title">
<div className={s.sectionHeading}><div><p className={s.eyebrow}>04 / INTEGRATIONS</p><h2 id="ecosystem-title">数据源与工具集成</h2></div><p>同步飞书、GitLab 等平台的资料,<br />通过 IM、浏览器插件或 API 查询和使用。</p></div>
<div className={s.ecosystem}>
<div className={s.ecosystemColumn}><Icon name="sources" /><h3>导入与同步资料</h3><p>上传文件、导入网页,或连接外部数据源。</p><div className={s.integrations}>{dataSources.map(item => <span key={item.name}><IntegrationMark item={item} /></span>)}</div><a className={s.textLink} href={guide("03-features/10-datasource")}>数据源集成 <Icon name="arrow" /></a></div>
<div className={s.ecosystemCore}><BrandLogo /><span>团队知识库与智能体</span><div>理解 · 检索 · 推理 · 行动</div></div>
<div className={s.ecosystemColumn}><Icon name="channels" /><h3>在常用工具中访问</h3><p>支持 IM 问答、浏览器插件和开发工具集成。</p><div className={s.integrations}>{clients.map(item => <span key={item.name}><IntegrationMark item={item} /></span>)}</div><a className={s.textLink} href={guide("03-features/12-im-integration")}>客户端与渠道 <Icon name="arrow" /></a></div>
</div>
<div className={s.models}><span>模型由你选择</span>{modelProviders.map(item => <p key={item.name}><IntegrationMark item={item} /></p>)}<a href={guide("03-features/06-models")} aria-label="查看全部模型厂商"><Icon name="arrow" /></a></div>
</section>
<section id="enterprise" className={s.enterprise} aria-labelledby="enterprise-title"><div className={s.shell}>
<div className={s.sectionHeading}><div><p className={s.eyebrow}>05 / BUILT FOR YOUR TEAM</p><h2 id="enterprise-title">私有化部署,<br />按团队需要管理权限。</h2></div><p>配置数据存储与成员权限,<br />查看操作记录和任务运行状态。</p></div>
<div className={s.enterpriseGrid}><article><Icon name="server" /><h3>部署与存储</h3><p>支持 Docker、Kubernetes 与 Helm。模型、向量数据库和存储后端可按需替换,支持本地推理。</p></article><article><Icon name="shield" /><h3>空间与资源权限</h3><p>多空间隔离与四级角色矩阵。API Key 按能力和知识库限定范围,支持 OIDC 身份集成。</p></article><article><Icon name="trace" /><h3>审计与运行监控</h3><p>空间审计日志、运行时任务队列面板与 Langfuse 追踪,帮助团队定位问题、管理运行状态。</p></article></div>
</div></section>
<section className={`${s.shell} ${s.closing}`} aria-labelledby="closing-title"><div><p className={s.eyebrow}>GET STARTED</p><h2 id="closing-title">搭建团队自己的知识库。</h2></div><a className={s.primary} href={guide("01-getting-started/02-installation")}>部署 WeKnora <Icon name="arrow" /></a></section>
</main>
<footer className={`${s.shell} ${s.footer}`}><Link className={s.brand} href="/" aria-label="WeKnora 首页"><BrandLogo /></Link><p>Tencent Open Source · MIT License</p><nav aria-label="页脚导航"><a href={docs}>文档</a><a href={repo} target="_blank" rel="noreferrer">GitHub <Icon name="external" /></a><a href={`${repo}/blob/main/CHANGELOG.md`} target="_blank" rel="noreferrer">更新日志</a></nav></footer>
</div>;
}

View File

@ -0,0 +1,39 @@
// VitePress uses this same key and the values light / dark / auto.
export const themeStorageKey = "vitepress-theme-appearance";
export const themeInitializationScript = `(function(){var t='auto';try{t=localStorage.getItem('${themeStorageKey}')||'auto'}catch(e){}document.documentElement.classList.toggle('dark',t==='dark'||(t!=='light'&&matchMedia('(prefers-color-scheme: dark)').matches))})()`;
export function getThemeSnapshot() {
return document.documentElement.classList.contains("dark");
}
export function subscribeToTheme(notify: () => void) {
const media = window.matchMedia("(prefers-color-scheme: dark)");
const applyPreference = () => {
let preference = "auto";
try { preference = localStorage.getItem(themeStorageKey) || "auto"; } catch { /* Storage can be disabled. */ }
document.documentElement.classList.toggle("dark", preference === "dark" || (preference !== "light" && media.matches));
notify();
};
const onStorage = (event: StorageEvent) => {
if (event.key === themeStorageKey || event.key === null) applyPreference();
};
const observer = new MutationObserver(notify);
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
media.addEventListener("change", applyPreference);
window.addEventListener("storage", onStorage);
window.addEventListener("pageshow", applyPreference);
applyPreference();
return () => {
observer.disconnect();
media.removeEventListener("change", applyPreference);
window.removeEventListener("storage", onStorage);
window.removeEventListener("pageshow", applyPreference);
};
}
export function toggleTheme() {
const dark = !getThemeSnapshot();
document.documentElement.classList.toggle("dark", dark);
try { localStorage.setItem(themeStorageKey, dark ? "dark" : "light"); } catch { /* The current page still switches. */ }
}

View File

@ -0,0 +1,30 @@
import type { ReactNode } from "react";
const paths: Record<string, ReactNode> = {
arrow: <path d="M4 12h15m-6-6 6 6-6 6" />,
external: <path d="M8 5H5v14h14v-3M12 5h7v7M10 14 19 5" />,
play: <path d="m9 5 11 7-11 7Z" />,
search: <><circle cx="10.5" cy="10.5" r="6.5" /><path d="m16 16 5 5M8 8h5M8 11h3" /></>,
agent: <><rect x="5" y="7" width="14" height="13" rx="3" /><path d="M12 3v4M2 11v5m20-5v5M9 12v1m6-1v1m-6 4h6" /><circle cx="12" cy="2.5" r=".5" /></>,
wiki: <><path d="M12 6C9 3 5 3 2 4v15c4-1 7 0 10 2 3-2 6-3 10-2V4c-3-1-7-1-10 2v15" /><path d="M5 8h3m-3 4h3m8-4h3m-3 4h3" /></>,
history: <><path d="M3 11a9 9 0 1 1 2.6 7.4M3 4v7h7M12 7v5l3 2" /></>,
skills: <><rect x="3" y="3" width="7" height="7" rx="1" /><rect x="14" y="3" width="7" height="7" rx="1" /><rect x="3" y="14" width="7" height="7" rx="1" /><path d="M14 17.5h7m-3.5-3.5v7" /></>,
sandbox: <><path d="m12 2 9 5v10l-9 5-9-5V7l9-5Zm0 10 9-5M12 12 3 7m9 5v10" /><path d="m7 4.8 10 5.5" /></>,
memory: <><path d="M12 7c-1-5-7-5-7 0-4 1-4 7 0 8-1 5 5 7 7 3 2 4 8 2 7-3 4-1 4-7 0-8 0-5-6-5-7 0Zm0 0v11M5 7c0 2 2 3 3 3m11-3c0 2-2 3-3 3M5 15l3-1m11 1-3-1" /></>,
file: <><path d="M14 2H5v20h14V7l-5-5Zm0 0v5h5M8 12h8m-8 4h6" /></>,
sources: <><path d="M3 7h7l2 3h9v10H3V7Zm3 0V3h11l3 3v4" /><path d="M7 14h10m-10 3h6" /></>,
channels: <><rect x="7" y="2" width="10" height="7" rx="1" /><rect x="2" y="16" width="8" height="6" rx="1" /><rect x="14" y="16" width="8" height="6" rx="1" /><path d="M12 9v4m-6 3v-3h12v3" /></>,
server: <><rect x="3" y="3" width="18" height="7" rx="1" /><rect x="3" y="14" width="18" height="7" rx="1" /><path d="M7 6.5h.01M7 17.5h.01M12 6.5h5m-5 11h5" /></>,
model: <><path d="m12 2 10 5-10 5L2 7l10-5Zm-10 10 10 5 10-5M2 17l10 5 10-5" /></>,
shield: <><path d="m12 2 9 4v6c0 5-5 8-9 10-4-2-9-5-9-10V6l9-4Z" /><path d="m8 12 3 3 5-6" /></>,
trace: <><path d="M3 3v18h18M6 15l4-5 4 3 6-8" /><circle cx="10" cy="10" r="1" /><circle cx="14" cy="13" r="1" /></>,
menu: <path d="M4 6h16M4 12h16M4 18h16" />,
close: <path d="m5 5 14 14M5 19 19 5" />,
code: <path d="m7 7-5 5 5 5m10-10 5 5-5 5m-3-14-4 18" />,
terminal: <><rect x="2" y="3" width="20" height="18" rx="2" /><path d="m6 8 4 4-4 4m7 0h5" /></>,
sun: <><circle cx="12" cy="12" r="4" /><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5" /></>,
moon: <path d="M20.8 13A9 9 0 0 1 11 3.2 9 9 0 1 0 20.8 13Z" />,
github: <path d="M9 19c-4.3 1.3-4.3-2.2-6-2.7m12 5v-3.5c0-1 .1-1.4-.5-2 3.4-.4 7-1.7 7-7.5a5.7 5.7 0 0 0-1.5-4 5.4 5.4 0 0 0-.1-4S18.6-.1 15.5 2a14 14 0 0 0-7 0C5.4-.1 4.1.3 4.1.3A5.4 5.4 0 0 0 4 4.3a5.7 5.7 0 0 0-1.5 4c0 5.8 3.6 7.1 7 7.5-.6.6-.6 1.2-.5 2V21" />,
};
export function Icon({ name }: { name: string }) {
return <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">{paths[name]}</svg>;
}

View File

@ -0,0 +1,73 @@
"use client";
import Image from "next/image";
import { useRef, useState, useSyncExternalStore } from "react";
import { Icon } from "./ui";
import s from "./home.module.css";
const slides = [
{ name: "页面浏览", icon: "wiki", image: "wiki-browser", title: "按主题整理,保留出处", description: "开启 Wiki 后,从知识库文档中提取人物、产品和概念,生成带来源引用的页面,按目录浏览。", alt: "Wiki 浏览器:按主题组织的目录、年假页面、关联条目和原始文档引用" },
{ name: "知识图谱", icon: "channels", image: "wiki-graph", title: "顺着链接,查看相关知识", description: "在知识图谱中查看页面之间的关系。点击条目,即可阅读相关内容。", alt: "Wiki 知识图谱:日常费用报销条目与相关页面的链接关系,右侧展示条目详情" },
{ name: "版本历史", icon: "history", image: "wiki-revision-history", title: "随时编辑,改动可回溯", description: "直接修订页面,也可让智能体协助维护。查看版本差异,必要时恢复到历史内容。", alt: "Wiki 版本历史:年假页面的历史版本列表、内容差异和回滚入口" },
];
const wideLayoutQuery = "(min-width: 1100px)";
function subscribeToLayout(notify: () => void) {
const query = window.matchMedia(wideLayoutQuery);
query.addEventListener("change", notify);
return () => query.removeEventListener("change", notify);
}
const getWideLayout = () => window.matchMedia(wideLayoutQuery).matches;
const getServerLayout = () => false;
// Center intermediate slides; clamp the first and last to the real track edges.
function slidePosition(element: HTMLDivElement, index: number) {
const slide = element.children[index] as HTMLElement;
const first = element.children[0] as HTMLElement;
const centered = slide.offsetLeft - first.offsetLeft + slide.offsetWidth / 2 - element.clientWidth / 2;
return Math.max(0, Math.min(element.scrollWidth - element.clientWidth, centered));
}
export function WikiGallery() {
const track = useRef<HTMLDivElement>(null);
const [active, setActive] = useState(0);
const wide = useSyncExternalStore(subscribeToLayout, getWideLayout, getServerLayout);
function goTo(index: number) {
const element = track.current;
if (!element) return;
const next = Math.max(0, Math.min(slides.length - 1, index));
element.scrollTo({ left: slidePosition(element, next), behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth" });
}
function syncActive() {
const element = track.current;
if (!element) return;
const distances = slides.map((_, index) => Math.abs(slidePosition(element, index) - element.scrollLeft));
setActive(distances.indexOf(Math.min(...distances)));
}
return <div className={s.wikiGallery} role="region" aria-label="Wiki 产品图集" aria-roledescription={wide ? undefined : "轮播图"}>
<div className={s.wikiGalleryToolbar}>
<div className={s.wikiGalleryTabs} aria-label="选择 Wiki 截图">
{slides.map((slide, index) => <button key={slide.image} type="button" aria-pressed={active === index} aria-controls="wiki-gallery-track" onClick={() => goTo(index)}><Icon name={slide.icon} />{slide.name}</button>)}
</div>
<div className={s.wikiGalleryControls}>
<div><button type="button" aria-label="上一张 Wiki 截图" aria-controls="wiki-gallery-track" disabled={active === 0} onClick={() => goTo(active - 1)}><Icon name="arrow" /></button><span aria-live="polite" aria-atomic="true">{String(active + 1).padStart(2, "0")} / 03</span><button type="button" aria-label="下一张 Wiki 截图" aria-controls="wiki-gallery-track" disabled={active === slides.length - 1} onClick={() => goTo(active + 1)}><Icon name="arrow" /></button></div>
</div>
</div>
<div id="wiki-gallery-track" className={s.wikiGalleryTrack} ref={track} tabIndex={wide ? -1 : 0} aria-label={wide ? "Wiki 的三项能力" : "Wiki 截图,可左右滑动或使用方向键切换"} onScroll={syncActive} onKeyDown={event => {
if (wide || event.target !== event.currentTarget) return;
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
event.preventDefault();
goTo(event.key === "Home" ? 0 : event.key === "End" ? slides.length - 1 : active + (event.key === "ArrowRight" ? 1 : -1));
}}>
{slides.map((slide, index) => <figure key={slide.image} className={`${s.artifactFigure} ${s.wikiSlide}`} role="group" aria-roledescription={wide ? undefined : "幻灯片"} aria-label={`${index + 1} / ${slides.length}:${slide.name}`}>
<div className={s.artifactHeading}><span><Icon name={slide.icon} />{slide.name}</span><a className={s.textLink} href={`/product/${slide.image}.png`} target="_blank" rel="noreferrer" aria-label={`查看${slide.name}原图(新窗口)`}>查看原图 <Icon name="external" /></a></div>
<div className={s.artifactImage}><Image src={`/product/${slide.image}.png`} alt={slide.alt} width={3840} height={2112} sizes="(min-width: 1100px) 33vw, (max-width: 800px) 90vw, 720px" /></div>
<figcaption className={s.wikiSlideCaption}><h3>{slide.title}</h3><p>{slide.description}</p></figcaption>
</figure>)}
</div>
</div>;
}

View File

@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);
export default eslintConfig;

View File

@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@ -0,0 +1,19 @@
import type { NextConfig } from "next";
import { resolve } from "node:path";
const nextConfig: NextConfig = {
turbopack: { root: resolve(__dirname, "..") },
output: "export",
trailingSlash: true,
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
},
],
},
};
export default nextConfig;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
{
"name": "weknora_home_page",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"lint": "eslint",
"audit:content": "node scripts/audit-content.mjs"
},
"dependencies": {
"next": "16.2.9",
"react": "19.2.4",
"react-dom": "19.2.4"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.2.9",
"tailwindcss": "^4",
"typescript": "^5"
}
}

View File

@ -0,0 +1,7 @@
const config = {
plugins: {
"@tailwindcss/postcss": {},
},
};
export default config;

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 LobeHub
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
<svg fill="none" height="63" viewBox="0 0 63 63" width="63" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="34.9087" x2="7.63224" y1="61.029" y2="13.7847"><stop offset="0" stop-color="#1e8e3e"/><stop offset="1" stop-color="#34a853"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="26.9043" x2="54.1808" y1="63.0788" y2="15.8345"><stop offset="0" stop-color="#fcc934"/><stop offset="1" stop-color="#fbbc04"/></linearGradient><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="4.22145" x2="58.7745" y1="19.6884" y2="19.6884"><stop offset="0" stop-color="#d93025"/><stop offset="1" stop-color="#ea4335"/></linearGradient><path d="m31.499 47.2466c8.6985 0 15.75-7.0515 15.75-15.75s-7.0515-15.75-15.75-15.75-15.75 7.0515-15.75 15.75 7.0515 15.75 15.75 15.75z" fill="#fff"/><path d="m17.8591 39.3751-13.63772-23.6212c-2.76527 4.788-4.22118922 10.2197-4.22137998 15.7489s1.45535998 10.961 4.22028998 15.7492c2.76494 4.7882 6.74181 8.7641 11.53071 11.5279 4.7889 2.7637 10.221 4.2179 15.7502 4.2164l13.6377-23.6212v-.0041c-1.3813 2.3954-3.369 4.3848-5.7632 5.7681s-5.1104 2.1118-7.8755 2.1122-5.4816-.7272-7.8762-2.1099c-2.3945-1.3826-4.3829-3.3714-5.7649-5.7663z" fill="url(#a)"/><path d="m45.1379 39.3741-13.6376 23.6212c5.5292.0008 10.9611-1.4542 15.7496-4.2187 4.7885-2.7644 8.7648-6.7408 11.5291-11.5294 2.7642-4.7887 4.219-10.2207 4.2181-15.7499-.001-5.5292-1.4577-10.9606-4.2237-15.7483h-27.2754l-.0034.0021c2.7651-.0014 5.4818.7254 7.8769 2.1071 2.3951 1.3818 4.3841 3.3698 5.767 5.7643 1.3829 2.3944 2.1109 5.1108 2.1109 7.8758-.0001 2.7651-.7283 5.4814-2.1113 7.8758z" fill="url(#b)"/><path d="m31.499 43.9688c6.8863 0 12.4688-5.5825 12.4688-12.4688s-5.5825-12.4688-12.4688-12.4688-12.4687 5.5825-12.4687 12.4688 5.5824 12.4688 12.4687 12.4688z" fill="#1a73e8"/><path d="m31.4991 15.75h27.2754c-2.764-4.7888-6.74-8.76553-11.5283-11.53029-4.7883-2.76475-10.2202-4.22010235-15.7494-4.21970992s-10.9608 1.45650992-15.7487 4.22194992c-4.788 2.76543-8.76341 6.74275-11.52666 11.53185l13.63766 23.6212.0035.0019c-1.3837-2.394-2.1127-5.11-2.1136-7.8751s.7264-5.4817 2.1086-7.8765c1.3821-2.3948 3.3706-4.3835 5.7652-5.7659 2.3947-1.3825 5.1112-2.11 7.8763-2.1094z" fill="url(#c)"/></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z" fill="#4D6BFE"></path></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Gemini</title><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-0-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-1-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-0-_R_0_" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-1-_R_0_" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-2-_R_0_" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

View File

@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Hunyuan</title><circle cx="12" cy="12" fill="#0055E9" r="12"></circle><path d="M12 0c.518 0 1.028.033 1.528.096A6.188 6.188 0 0112.12 12.28l-.12.001c-2.99 0-5.242 2.179-5.554 5.11-.223 2.086.353 4.412 2.242 6.146C3.672 22.1 0 17.479 0 12 0 5.373 5.373 0 12 0z" fill="#A8DFF5"></path><path d="M5.286 5a2.438 2.438 0 01.682 3.38c-3.962 5.966-3.215 10.743 2.648 15.136C3.636 22.056 0 17.452 0 12c0-1.787.39-3.482 1.09-5.006.253-.435.525-.872.817-1.311A2.438 2.438 0 015.286 5z" fill="#0055E9"></path><path d="M12.98.04c.272.021.543.053.81.093.583.106 1.117.254 1.538.44 6.638 2.927 8.07 10.052 1.748 15.642a4.125 4.125 0 01-5.822-.358c-1.51-1.706-1.3-4.184.357-5.822.858-.848 3.108-1.223 4.045-2.441 1.257-1.634 2.122-6.009-2.523-7.506L12.98.039z" fill="#00BCFF"></path><path d="M13.528.096A6.187 6.187 0 0112 12.281a5.75 5.75 0 00-1.71.255c.147-.905.595-1.784 1.321-2.501.858-.848 3.108-1.223 4.045-2.441 1.27-1.651 2.14-6.104-2.676-7.554.184.014.367.033.548.056z" fill="#ECECEE"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ModelContextProtocol</title><path d="M15.688 2.343a2.588 2.588 0 00-3.61 0l-9.626 9.44a.863.863 0 01-1.203 0 .823.823 0 010-1.18l9.626-9.44a4.313 4.313 0 016.016 0 4.116 4.116 0 011.204 3.54 4.3 4.3 0 013.609 1.18l.05.05a4.115 4.115 0 010 5.9l-8.706 8.537a.274.274 0 000 .393l1.788 1.754a.823.823 0 010 1.18.863.863 0 01-1.203 0l-1.788-1.753a1.92 1.92 0 010-2.754l8.706-8.538a2.47 2.47 0 000-3.54l-.05-.049a2.588 2.588 0 00-3.607-.003l-7.172 7.034-.002.002-.098.097a.863.863 0 01-1.204 0 .823.823 0 010-1.18l7.273-7.133a2.47 2.47 0 00-.003-3.537z"></path><path d="M14.485 4.703a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a4.115 4.115 0 000 5.9 4.314 4.314 0 006.016 0l7.12-6.982a.823.823 0 000-1.18.863.863 0 00-1.204 0l-7.119 6.982a2.588 2.588 0 01-3.61 0 2.47 2.47 0 010-3.54l7.12-6.982z"></path></svg>

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Ollama</title><path d="M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z"></path></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1 @@
<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Qwen</title><path d="M12.604 1.34c.393.69.784 1.382 1.174 2.075a.18.18 0 00.157.091h5.552c.174 0 .322.11.446.327l1.454 2.57c.19.337.24.478.024.837-.26.43-.513.864-.76 1.3l-.367.658c-.106.196-.223.28-.04.512l2.652 4.637c.172.301.111.494-.043.77-.437.785-.882 1.564-1.335 2.34-.159.272-.352.375-.68.37-.777-.016-1.552-.01-2.327.016a.099.099 0 00-.081.05 575.097 575.097 0 01-2.705 4.74c-.169.293-.38.363-.725.364-.997.003-2.002.004-3.017.002a.537.537 0 01-.465-.271l-1.335-2.323a.09.09 0 00-.083-.049H4.982c-.285.03-.553-.001-.805-.092l-1.603-2.77a.543.543 0 01-.002-.54l1.207-2.12a.198.198 0 000-.197 550.951 550.951 0 01-1.875-3.272l-.79-1.395c-.16-.31-.173-.496.095-.965.465-.813.927-1.625 1.387-2.436.132-.234.304-.334.584-.335a338.3 338.3 0 012.589-.001.124.124 0 00.107-.063l2.806-4.895a.488.488 0 01.422-.246c.524-.001 1.053 0 1.583-.006L11.704 1c.341-.003.724.032.9.34zm-3.432.403a.06.06 0 00-.052.03L6.254 6.788a.157.157 0 01-.135.078H3.253c-.056 0-.07.025-.041.074l5.81 10.156c.025.042.013.062-.034.063l-2.795.015a.218.218 0 00-.2.116l-1.32 2.31c-.044.078-.021.118.068.118l5.716.008c.046 0 .08.02.104.061l1.403 2.454c.046.081.092.082.139 0l5.006-8.76.783-1.382a.055.055 0 01.096 0l1.424 2.53a.122.122 0 00.107.062l2.763-.02a.04.04 0 00.035-.02.041.041 0 000-.04l-2.9-5.086a.108.108 0 010-.113l.293-.507 1.12-1.977c.024-.041.012-.062-.035-.062H9.2c-.059 0-.073-.026-.043-.077l1.434-2.505a.107.107 0 000-.114L9.225 1.774a.06.06 0 00-.053-.031zm6.29 8.02c.046 0 .058.02.034.06l-.832 1.465-2.613 4.585a.056.056 0 01-.05.029.058.058 0 01-.05-.029L8.498 9.841c-.02-.034-.01-.052.028-.054l.216-.012 6.722-.012z" fill="url(#lobe-icons-qwen-_R_0_)" fill-rule="nonzero"></path><defs><linearGradient id="lobe-icons-qwen-_R_0_" x1="0%" x2="100%" y1="0%" y2="0%"><stop offset="0%" stop-color="#6336E7" stop-opacity=".84"></stop><stop offset="100%" stop-color="#6F69F7" stop-opacity=".84"></stop></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" role="img" aria-label="RSS">
<circle cx="14" cy="34" r="4" fill="#FF6600"/>
<path d="M10 22a18 18 0 0 1 18 18" fill="none" stroke="#FF6600" stroke-width="4" stroke-linecap="round"/>
<path d="M10 14a26 26 0 0 1 26 26" fill="none" stroke="#FF6600" stroke-width="4" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 361 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="#e01e5a" d="M53.841 161.32c0 14.832-11.987 26.82-26.819 26.82S.203 176.152.203 161.32c0-14.831 11.987-26.818 26.82-26.818H53.84zm13.41 0c0-14.831 11.987-26.818 26.819-26.818s26.819 11.987 26.819 26.819v67.047c0 14.832-11.987 26.82-26.82 26.82c-14.83 0-26.818-11.988-26.818-26.82z"/><path fill="#36c5f0" d="M94.07 53.638c-14.832 0-26.82-11.987-26.82-26.819S79.239 0 94.07 0s26.819 11.987 26.819 26.819v26.82zm0 13.613c14.832 0 26.819 11.987 26.819 26.819s-11.987 26.819-26.82 26.819H26.82C11.987 120.889 0 108.902 0 94.069c0-14.83 11.987-26.818 26.819-26.818z"/><path fill="#2eb67d" d="M201.55 94.07c0-14.832 11.987-26.82 26.818-26.82s26.82 11.988 26.82 26.82s-11.988 26.819-26.82 26.819H201.55zm-13.41 0c0 14.832-11.988 26.819-26.82 26.819c-14.831 0-26.818-11.987-26.818-26.82V26.82C134.502 11.987 146.489 0 161.32 0s26.819 11.987 26.819 26.819z"/><path fill="#ecb22e" d="M161.32 201.55c14.832 0 26.82 11.987 26.82 26.818s-11.988 26.82-26.82 26.82c-14.831 0-26.818-11.988-26.818-26.82V201.55zm0-13.41c-14.831 0-26.818-11.988-26.818-26.82c0-14.831 11.987-26.818 26.819-26.818h67.25c14.832 0 26.82 11.987 26.82 26.819s-11.988 26.819-26.82 26.819z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><defs><linearGradient id="SVG6DaOZcwt" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#2aabee"/><stop offset="100%" stop-color="#229ed9"/></linearGradient></defs><path fill="url(#SVG6DaOZcwt)" d="M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"/><path fill="#fff" d="M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 1024 1024"><path fill="#0082EF" fill-rule="evenodd" d="M909.784 729.585a135.9 135.9 0 0 0-47.042 19.049a114.24 114.24 0 0 1-51.41 31.075c2.613-17.554 11.313-33.577 24.455-45.418a169.3 169.3 0 0 0 23.409-55.017c-.061-27.838 22.44-50.459 50.265-50.534c27.827-.076 50.45 22.423 50.539 50.26c.089 27.839-22.39 50.482-50.215 50.585zM817.568 608.83a168.8 168.8 0 0 0-54.808-23.68c-27.836 0-50.402-22.575-50.402-50.423s22.566-50.423 50.402-50.423s50.402 22.575 50.402 50.423a137.5 137.5 0 0 0 18.817 47.211a114.8 114.8 0 0 1 30.764 51.656a76.08 76.08 0 0 1-45.026-24.763h-.186zm-83.033-177.713C719.34 303.789 587.548 204.026 428.09 204.026c-169.874 0-308.088 113.097-308.088 252.19c2.72 78.1 43.941 149.778 110.063 191.385a311 311 0 0 0 33.602 21.588l-13.664 54.569c4.928 2.316 9.706 4.78 14.746 6.91l68.996-34.512c10.08 2.615 20.683 4.295 31.21 6.088c6.721 1.195 13.442 2.428 20.35 3.25a354.8 354.8 0 0 0 128.805-7.396a249 249 0 0 0 10.154 55.055a425.6 425.6 0 0 1-96.175 11.242a418 418 0 0 1-86.392-9.524l-125.186 62.526a27.62 27.62 0 0 1-29.98-3.137a28.02 28.02 0 0 1-9.67-28.611l22.401-90.239C117.176 643.186 66.463 553.506 64 456.216C64 285.973 227.004 148 428.09 148c190.93 0 347.29 124.527 362.521 282.818a245 245 0 0 0-26.47-2.614c-9.893.374-19.787 1.307-29.607 2.876zM618.237 629.934c16.764-3.362 32.706-9.786 47.042-19.049a114.24 114.24 0 0 1 51.447-31.001a76.47 76.47 0 0 1-24.491 45.344c-11.014 16.807-18.929 35.483-23.409 55.054c.041 27.833-22.468 50.435-50.29 50.497s-50.43-22.44-50.514-50.273c-.082-27.833 22.393-50.469 50.215-50.572m90.798 121.314c16.652 11.168 35.17 19.236 54.659 23.904c20.386 0 38.764 12.286 46.565 31.127s3.49 40.53-10.926 54.95a50.38 50.38 0 0 1-54.927 10.931c-18.834-7.804-31.114-26.19-31.114-46.585a136.7 136.7 0 0 0-18.668-47.285a114.7 114.7 0 0 1-30.54-51.805a76 76 0 0 1 44.951 25.062z"/></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 KiB

View File

@ -0,0 +1,36 @@
import assert from 'node:assert/strict';
import { readFile, stat } from 'node:fs/promises';
import { join } from 'node:path';
const output = join(process.cwd(), 'out');
const html = await readFile(join(output, 'index.html'), 'utf8');
const visible = html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, '').replace(/<[^>]+>/g, '');
assert.equal((html.match(/<h1\b/g) || []).length, 1, 'The homepage must have one main heading');
for (const term of ['帮你找到答案', '并将知识付诸实践', 'v0.8.0', 'RAG', 'Agent', 'Wiki', 'ClawHub', 'SkillHub', 'Docker', 'E2B', 'Cube', '长期记忆', '由你确认', 'GitLab', '腾讯 IMA', 'anydoc', 'LiteLLM', 'DeepSeek Harness']) {
assert.ok(visible.includes(term), `Missing product content: ${term}`);
}
for (const term of ['三套', '方案选择', '历史 Demo', '18K+', '成为行动力', '从零散文档', '到鲜活知识']) {
assert.ok(!visible.includes(term), `Retired content still visible: ${term}`);
}
assert.match(html, /<video[^>]+preload="none"/, 'Video should not load before user interaction');
assert.match(html, /https:\/\/github.com\/user-attachments\/assets\/2819598d-3140-4623-814a-8162a22b653c/, 'Use the README video');
assert.ok(!/<video[^>]+autoplay/i.test(html), 'Do not autoplay the product film');
const wiki = html.match(/<section id="wiki"[\s\S]*?<\/section>/)?.[0];
assert.ok(wiki, 'The homepage must include a dedicated Wiki section');
for (const term of ['/product/wiki-browser.png', '/product/wiki-graph.png', '/product/wiki-revision-history.png', 'wiki-gallery-track', '/docs/03-features/14-wiki.html', '来源引用', '知识图谱', '版本差异']) {
assert.ok(wiki.includes(term), `Missing Wiki showcase content: ${term}`);
}
const ids = new Set([...html.matchAll(/\bid="([^"]+)"/g)].map(match => match[1]));
for (const [, anchor] of html.matchAll(/href="#([^"]+)"/g)) {
assert.ok(ids.has(anchor), `Missing navigation target: #${anchor}`);
}
const assets = new Set([...html.matchAll(/(?:src|href|poster)="(\/[^"?#]*)/g)].map(match => match[1]));
for (const asset of assets) {
const path = join(output, decodeURIComponent(asset));
let file = await stat(path);
if (file.isDirectory()) file = await stat(join(path, 'index.html'));
assert.ok(file.isFile() && file.size > 0, `Missing local asset: ${asset}`);
}
assert.match(html, /aria-controls="main-navigation"/);
assert.match(html, /aria-label="播放 WeKnora 产品介绍视频/);
console.log(`Homepage audit passed: product content, README video, navigation anchors, ${assets.size} local assets, and retired design choices.`);

View File

@ -0,0 +1,42 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": [
"./*"
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": [
"node_modules"
]
}

View File

@ -1,11 +1,22 @@
---
layout: page
title: 开源的知识库问答系统
titleTemplate: WeKnora 文档
pageClass: landing-page
title: 快速上手
sidebar: false
aside: false
footer: false
search: false
head:
- - meta
- http-equiv: refresh
content: '0;url=/docs/01-getting-started/03-quickstart.html'
- - link
- rel: canonical
href: /docs/01-getting-started/03-quickstart.html
---
<Landing />
<script setup>
import { onMounted } from 'vue'
onMounted(() => window.location.replace('/docs/01-getting-started/03-quickstart.html' + window.location.search + window.location.hash))
</script>
[进入快速上手](/01-getting-started/03-quickstart)

View File

@ -1,45 +0,0 @@
server {
listen 8081;
server_name localhost;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css text/javascript application/javascript application/json
application/xml application/rss+xml image/svg+xml font/ttf font/otf;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log;
# 独立容器时根路径重定向到文档前缀;经网关反代 /docs/ 时通常不会命中。
location = / {
return 302 /docs/;
}
# VitePress base=/docs/:磁盘上是 dist/assets/...,URL 为 /docs/assets/...
location /docs {
alias /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ $uri.html /docs/index.html;
add_header Cache-Control "no-cache, must-revalidate" always;
}
location ^~ /docs/assets/ {
alias /usr/share/nginx/html/assets/;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
error_page 404 /docs/404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@ -1,10 +1,12 @@
{
"name": "weknora-docs-site",
"version": "0.8.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "weknora-docs-site",
"version": "0.8.0",
"devDependencies": {
"jsdom": "^28.0.0",
"mermaid": "^11.16.0",
@ -12,6 +14,9 @@
"vitepress": "^1.6.4",
"vitepress-plugin-mermaid": "^2.0.17",
"vue": "^3.5.13"
},
"engines": {
"node": "^22.13.0 || >=24.0.0"
}
},
"node_modules/@acemir/cssom": {

View File

@ -3,12 +3,22 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview",
"setup": "npm ci && npm --prefix homepage ci",
"dev": "node scripts/serve-site.mjs",
"dev:docs": "vitepress dev",
"dev:homepage": "npm --prefix homepage run dev",
"build": "node scripts/build-site.mjs",
"build:docs": "vitepress build",
"build:homepage": "npm --prefix homepage run build",
"preview": "node scripts/serve-site.mjs",
"check:mermaid": "node scripts/check-mermaid.mjs",
"check:links": "node scripts/check-links.mjs",
"check": "npm run check:links && npm run check:mermaid"
"check:docs": "npm run check:links && npm run check:mermaid",
"check:site": "node scripts/check-site.mjs",
"check": "npm run check:docs && npm run check:site",
"package:site": "node scripts/package-site.mjs",
"test:integration": "node scripts/test-integration.mjs",
"test:docker": "node scripts/test-docker.mjs"
},
"devDependencies": {
"mermaid": "^11.16.0",
@ -17,5 +27,9 @@
"vitepress-plugin-mermaid": "^2.0.17",
"vue": "^3.5.13",
"jsdom": "^28.0.0"
},
"version": "0.8.0",
"engines": {
"node": "^22.13.0 || >=24.0.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,6 +0,0 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="32" height="32" rx="6" fill="#101f38"/>
<path d="M19.9 6.4c.35-.48 1.12-.2 1.09.38l-.5 9.1-6.2-.05c-.58 0-.83-.7-.39-1.08L19.9 6.4z" fill="#fdfcfa"/>
<path d="M4 19.6c5.6-1.6 10.7-.9 15.8.35 3.7.9 7 1.35 11.1.1" stroke="#fdfcfa" stroke-width="2" stroke-linecap="round"/>
<path d="M6.4 23.4c4.9-1.15 9.4-.6 14 .45 3.3.75 6.2 1.05 9.8.1" stroke="#d9a94f" stroke-width="1.4" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 521 B

View File

@ -1,5 +0,0 @@
<svg width="34" height="26" viewBox="0 0 34 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.6 3.2c.36-.5 1.16-.22 1.13.39l-.53 10.2-6.9-.05c-.6 0-.86-.75-.4-1.13L20.6 3.2z" fill="#e6ecf5"/>
<path d="M1.5 18.4c6.4-1.9 12.2-1.1 18.1.35 4.3 1.05 8.2 1.6 12.9.1" stroke="#e6ecf5" stroke-width="2.1" stroke-linecap="round"/>
<path d="M4.4 22.1c5.6-1.35 10.8-.7 16 .5 3.8.87 7.2 1.2 11.3.15" stroke="#d9a94f" stroke-width="1.4" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 477 B

View File

@ -1,5 +0,0 @@
<svg width="34" height="26" viewBox="0 0 34 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.6 3.2c.36-.5 1.16-.22 1.13.39l-.53 10.2-6.9-.05c-.6 0-.86-.75-.4-1.13L20.6 3.2z" fill="#101f38"/>
<path d="M1.5 18.4c6.4-1.9 12.2-1.1 18.1.35 4.3 1.05 8.2 1.6 12.9.1" stroke="#101f38" stroke-width="2.1" stroke-linecap="round"/>
<path d="M4.4 22.1c5.6-1.35 10.8-.7 16 .5 3.8.87 7.2 1.2 11.3.15" stroke="#c79a45" stroke-width="1.4" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 477 B

View File

@ -0,0 +1,26 @@
import { spawnSync } from 'node:child_process';
import { cpSync, rmSync, existsSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
function run(dir, script) {
const result = spawnSync('npm', ['run', script], { cwd: resolve(root, dir), stdio: 'inherit' });
if (result.status !== 0) process.exit(result.status || 1);
}
for (const dir of ['homepage', '.']) {
if (!existsSync(resolve(root, dir, 'node_modules'))) throw new Error('Dependencies missing. Run npm run setup first.');
}
run('homepage', 'build');
run('.', 'check:docs');
run('.', 'build:docs');
const output = resolve(root, 'homepage/out');
rmSync(resolve(output, 'docs'), { recursive: true, force: true });
cpSync(resolve(root, '.vitepress/dist'), resolve(output, 'docs'), { recursive: true });
run('homepage', 'audit:content');
const check = spawnSync(process.execPath, ['scripts/check-site.mjs', output], { cwd: root, stdio: 'inherit' });
if (check.status !== 0) process.exit(check.status || 1);
// Update the deployment directory only after both applications and their links pass.
const destination = resolve(root, 'static-site');
rmSync(destination, { recursive: true, force: true });
cpSync(output, destination, { recursive: true });
console.log('Unified site ready: static-site/ (homepage + /docs/).');

View File

@ -8,7 +8,7 @@ const root = join(dirname(fileURLToPath(import.meta.url)), '..')
function walk(dir, out = []) {
for (const name of readdirSync(dir)) {
if (name === 'node_modules' || name.startsWith('.')) continue
if (['node_modules', 'homepage', 'shared', 'scripts', 'deploy', 'static-site', 'releases'].includes(name) || name.startsWith('.')) continue
const path = join(dir, name)
if (statSync(path).isDirectory()) walk(path, out)
else if (name.endsWith('.md')) out.push(path)

View File

@ -23,7 +23,7 @@ mermaid.initialize({ startOnLoad: false, securityLevel: 'loose' })
function walk(dir, out = []) {
for (const name of readdirSync(dir)) {
if (name === 'node_modules' || name.startsWith('.')) continue
if (['node_modules', 'homepage', 'shared', 'scripts', 'deploy', 'static-site', 'releases'].includes(name) || name.startsWith('.')) continue
const path = join(dir, name)
if (statSync(path).isDirectory()) walk(path, out)
else if (name.endsWith('.md')) out.push(path)

View File

@ -0,0 +1,42 @@
import assert from 'node:assert/strict';
import { readFile, readdir } from 'node:fs/promises';
import { dirname, resolve, relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import { resolveSiteFile } from './site-files.mjs';
const project = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const root = resolve(process.argv[2] || resolve(project, 'static-site'));
async function walk(dir) {
const result = [];
for (const entry of await readdir(dir, { withFileTypes: true })) {
const path = resolve(dir, entry.name);
if (entry.isDirectory()) result.push(...await walk(path));
else if (entry.name.endsWith('.html')) result.push(path);
}
return result;
}
for (const retired of ['/demo/', '/demo/1/', '/redesign/', '/redesign/1/', '/demo6/preview.html', '/brand/weknora.svg', '/icon.svg', '/docs/favicon.svg', '/docs/README.html', '/docs/homepage/README.html', '/docs/homepage/BRAND-ASSETS.html', '/docs/static-site/', '/docs/releases/']) {
assert.equal(await resolveSiteFile(root, retired), null, `Retired demo must not be published: ${retired}`);
}
const failures = [];
const checked = new Map();
const pages = await walk(root);
for (const file of pages) {
const html = await readFile(file, 'utf8');
const route = '/' + relative(root, file).replaceAll('\\', '/');
const base = new URL(route, 'https://weknora.test');
for (const match of html.matchAll(/<(?:a|link|img|script|source|video)\b[^>]*>/g)) {
const tag = match[0];
for (const [, raw] of tag.matchAll(/(?:href|src|poster)="([^"]+)"/g)) {
const url = new URL(raw.replaceAll('&amp;', '&'), base);
if (url.origin !== base.origin) continue;
if (!checked.has(url.pathname)) checked.set(url.pathname, !!await resolveSiteFile(root, url.pathname));
if (!checked.get(url.pathname)) failures.push(`${route}: missing ${url.pathname}`);
if (url.pathname === '/' && tag.startsWith('<a') && /target="_blank"/.test(tag)) failures.push(`${route}: homepage link opens a new tab`);
}
}
if (/11\.141\.160\.83/.test(html)) failures.push(`${route}: stale private docs host`);
if (route.startsWith('/docs/') && !route.endsWith('/404.html') && !/class="wk-brand"[^>]*href="\/"[^>]*target="_self"/.test(html)) failures.push(`${route}: documentation logo must navigate to the main site`);
}
for (const path of ['/docs/', '/docs/03-features/22-skills-sandbox.html', '/docs/03-features/23-memory.html']) assert.ok(await resolveSiteFile(root, path), path);
assert.equal(failures.length, 0, [...new Set(failures)].join('\n'));
console.log(`Unified site check passed: ${pages.length} pages, ${checked.size} local routes/assets, same-tab homepage links and documentation logos.`);

View File

@ -0,0 +1,13 @@
import { mkdirSync, readFileSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { spawnSync } from 'node:child_process';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const check = spawnSync(process.execPath, ['scripts/check-site.mjs'], { cwd: root, stdio: 'inherit' });
if (check.status !== 0) process.exit(check.status || 1);
mkdirSync(resolve(root, 'releases'), { recursive: true });
const version = readFileSync(resolve(root, 'VERSION'), 'utf8').trim();
const output = resolve(root, `releases/weknora-site-v${version}.tar.gz`);
const packed = spawnSync('tar', ['-czf', output, '-C', resolve(root, 'static-site'), '.'], { stdio: 'inherit', env: { ...process.env, COPYFILE_DISABLE: '1' } });
if (packed.status !== 0) process.exit(packed.status || 1);
console.log(`Deployable archive: ${output}`);

View File

@ -0,0 +1,24 @@
import { createServer } from 'node:http';
import { createReadStream } from 'node:fs';
import { resolve, dirname, extname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { resolveSiteFile } from './site-files.mjs';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '../static-site');
const portIndex = process.argv.indexOf('--port');
const port = Number(portIndex < 0 ? 3000 : process.argv[portIndex + 1]);
const types = { '.html': 'text/html; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.css': 'text/css; charset=utf-8', '.json': 'application/json', '.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.ico': 'image/x-icon', '.woff2': 'font/woff2', '.txt': 'text/plain; charset=utf-8' };
const server = createServer(async (request, response) => {
try {
if (!['GET', 'HEAD'].includes(request.method)) { response.writeHead(405, { Allow: 'GET, HEAD' }).end(); return; }
const url = new URL(request.url, 'http://localhost');
if (url.pathname === '/docs') { response.writeHead(308, { Location: '/docs/' + url.search }).end(); return; }
let file = await resolveSiteFile(root, url.pathname);
const status = file ? 200 : 404;
if (!file) file = await resolveSiteFile(root, url.pathname.startsWith('/docs/') ? '/docs/404.html' : '/404.html');
if (!file) { response.writeHead(404).end('Not found'); return; }
response.writeHead(status, { 'Content-Type': types[extname(file.path)] || 'application/octet-stream', 'Content-Length': file.info.size, 'Cache-Control': 'no-cache', 'X-Content-Type-Options': 'nosniff' });
if (request.method === 'HEAD') response.end();
else createReadStream(file.path).pipe(response);
} catch { response.writeHead(500).end('Unable to serve this page'); }
});
server.listen(port, '127.0.0.1', () => console.log(`WeKnora unified preview: http://127.0.0.1:${port}/`));

View File

@ -0,0 +1,14 @@
import { stat } from 'node:fs/promises';
import { resolve, sep } from 'node:path';
export async function resolveSiteFile(root, pathname) {
let decoded;
try { decoded = decodeURIComponent(pathname); } catch { return null; }
if (decoded.includes('\0') || decoded.includes('\\')) return null;
const path = resolve(root, `.${decoded}`);
if (path !== root && !path.startsWith(root + sep)) return null;
for (const candidate of [path, `${path}.html`, resolve(path, 'index.html')]) {
const info = await stat(candidate).catch(() => null);
if (info?.isFile()) return { path: candidate, info };
}
return null;
}

View File

@ -0,0 +1,66 @@
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { setTimeout } from 'node:timers/promises';
const image = process.argv[2] || 'weknora-site:0.8.0';
const name = `weknora-site-test-${randomUUID()}`;
function docker(...args) {
const result = spawnSync('docker', args, { encoding: 'utf8' });
if (result.error) throw result.error;
assert.equal(result.status, 0, `docker ${args.join(' ')}\n${result.stderr}`);
return result.stdout.trim();
}
try {
docker('run', '-d', '--name', name, '-p', '127.0.0.1::80', image);
const origin = `http://${docker('port', name, '80/tcp')}`;
docker('exec', name, 'nginx', '-t');
docker('exec', name, 'sh', '-c', '! command -v node && test ! -d /build && test ! -e /usr/share/nginx/html/package.json');
let ready = false;
for (let attempt = 0; attempt < 30; attempt++) {
try {
ready = (await fetch(origin, { signal: AbortSignal.timeout(2000) })).ok;
if (ready) break;
} catch { /* Nginx may still be starting. */ }
await setTimeout(200);
}
assert.ok(ready, 'Container did not become ready');
const redirect = await fetch(`${origin}/docs`, { redirect: 'manual' });
assert.equal(redirect.status, 308);
assert.equal(new URL(redirect.headers.get('location'), origin).origin, origin);
assert.equal(new URL(redirect.headers.get('location'), origin).pathname, '/docs/');
const assets = new Set(['/brand/weknora-original.png', '/product/wiki-browser.png', '/docs/favicon.ico']);
for (const path of ['/', '/docs/', '/docs/03-features/14-wiki', '/docs/03-features/14-wiki.html']) {
const response = await fetch(origin + path);
assert.equal(response.status, 200, path);
assert.match(response.headers.get('content-type'), /text\/html/);
assert.equal(response.headers.get('x-content-type-options'), 'nosniff');
assert.equal(response.headers.get('x-frame-options'), 'SAMEORIGIN');
assert.equal(response.headers.get('referrer-policy'), 'strict-origin-when-cross-origin');
const html = await response.text();
assert.match(html, /WeKnora/i, path);
for (const [, asset] of html.matchAll(/(?:src|href)="([^"?#]+\.(?:js|css))"/g)) {
const url = new URL(asset, origin + path);
if (url.origin === origin) assets.add(url.pathname);
}
}
assert.ok([...assets].some(path => path.startsWith('/_next/')), 'Homepage scripts are missing');
assert.ok([...assets].some(path => path.startsWith('/docs/assets/')), 'Documentation scripts are missing');
for (const asset of assets) {
const response = await fetch(origin + asset);
assert.equal(response.status, 200, asset);
assert.doesNotMatch(response.headers.get('content-type'), /text\/html/, asset);
}
const compressed = await fetch(origin + '/', { headers: { 'Accept-Encoding': 'gzip' } });
assert.equal(compressed.headers.get('content-encoding'), 'gzip');
for (const path of ['/not-found', '/docs/not-found']) {
const response = await fetch(origin + path);
assert.equal(response.status, 404, path);
assert.equal(response.headers.get('x-content-type-options'), 'nosniff');
}
console.log(`Docker site check passed: homepage, docs routes, ${assets.size} assets, redirects, 404s, compression, headers and runtime isolation.`);
} finally {
spawnSync('docker', ['rm', '-f', name], { stdio: 'ignore' });
}

View File

@ -0,0 +1,189 @@
import assert from 'node:assert/strict';
import { chromium } from 'playwright-core';
const origin = process.env.SITE_TEST_URL || 'http://127.0.0.1:3000';
const key = 'vitepress-theme-appearance';
const browser = await chromium.launch({ channel: 'chrome', headless: true });
const context = await browser.newContext({ colorScheme: 'light', viewport: { width: 1440, height: 1000 } });
const page = await context.newPage();
const errors = [];
context.on('page', p => p.on('pageerror', error => errors.push(error.message)));
page.on('pageerror', error => errors.push(error.message));
async function expectTheme(p, dark) {
await p.waitForFunction(expected => document.documentElement.classList.contains('dark') === expected, dark);
}
async function homepage(p = page) {
await p.waitForSelector('#hero-title');
assert.equal(new URL(p.url()).pathname, '/');
}
async function checkVisibleControl(p, selector) {
await p.waitForFunction(selector => {
const box = document.querySelector(selector)?.getBoundingClientRect();
return box && box.width > 0 && box.x >= 0 && box.right <= innerWidth + 1;
}, selector);
const box = await p.locator(selector).boundingBox();
assert.ok(box && box.width > 0 && box.x >= 0 && box.x + box.width <= p.viewportSize().width + 1, `${selector} must fit in the viewport`);
}
async function headerGeometry(p) {
return p.locator('.wk-header').evaluate(header => ({
links: [...header.querySelectorAll('#main-navigation a')].map(a => [a.textContent.trim(), a.getAttribute('href')]),
controls: [...header.querySelectorAll('.wk-header-inner, .wk-brand, .wk-theme-toggle, .wk-header-github')].map(el => {
const box = el.getBoundingClientRect();
return [Math.round(box.x), Math.round(box.y), Math.round(box.width), Math.round(box.height)];
}),
}));
}
async function currentSidebarLinkVisible(p) {
await p.waitForFunction(() => {
const sidebar = document.querySelector('.VPSidebar');
const active = sidebar?.querySelector('.VPSidebarItem.is-active > .item > a');
if (!active) return false;
const bounds = sidebar.getBoundingClientRect();
const item = active.getBoundingClientRect();
return item.height > 0 && item.top >= bounds.top && item.bottom <= bounds.bottom;
});
}
try {
assert.equal((await page.goto(origin + '/')).status(), 200);
await expectTheme(page, false);
const masthead = await headerGeometry(page);
await page.getByRole('switch', { name: '切换到深色' }).click();
await expectTheme(page, true);
assert.equal(await page.evaluate(k => localStorage.getItem(k), key), 'dark');
await page.reload();
await expectTheme(page, true);
await page.locator('#main-navigation').getByRole('link', { name: '文档', exact: true }).click();
await page.waitForSelector('.VPDoc h1');
await expectTheme(page, true);
assert.equal(new URL(page.url()).pathname, '/docs/01-getting-started/03-quickstart.html');
assert.match(await page.locator('.VPDoc h1').innerText(), /快速上手/);
assert.equal(await page.getByRole('link', { name: '文档首页', exact: true }).count(), 0);
assert.deepEqual((await headerGeometry(page)).controls, masthead.controls);
assert.deepEqual((await headerGeometry(page)).links.map(link => link[0]), ['快速开始', '架构', '功能', 'API', '客户端', '开发', 'GitHub']);
assert.equal(await page.locator('.wk-header').evaluate(el => el.getBoundingClientRect().height), 64);
assert.equal(context.pages().length, 1);
// Switching distant sections must reveal the selected sidebar item in both directions.
for (const section of ['客户端', '开发', '快速开始', '功能', '架构']) {
await page.locator('#main-navigation').getByRole('link', { name: section, exact: true }).click();
await page.waitForFunction(section => document.querySelector('#main-navigation a[aria-current="page"]')?.textContent.trim() === section, section);
await currentSidebarLinkVisible(page);
assert.ok(await page.evaluate(() => window.scrollY < 2), 'Sidebar synchronization must not scroll the document');
}
// Manual sidebar scrolling must remain untouched until navigation occurs.
await page.locator('.VPSidebar').evaluate(el => el.scrollTop = el.scrollHeight);
await page.locator('.wk-theme-toggle').click();
assert.ok(await page.locator('.VPSidebar').evaluate(el => el.scrollTop > 500));
await page.locator('.wk-theme-toggle').click();
await page.locator('#main-navigation').getByRole('link', { name: 'API', exact: true }).click();
await page.waitForFunction(() => location.pathname.includes('/04-api/'));
await page.waitForSelector('.VPDoc h1');
await page.waitForFunction(() => document.querySelector('#main-navigation a[aria-current="page"]')?.textContent.trim() === 'API');
const palette = await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--wk-paper').trim());
assert.equal(palette, '#0b1220');
await page.locator('.wk-header-search button').click();
await page.locator('#localsearch-input').fill('长期记忆');
await page.waitForSelector('.VPLocalSearchBox .result');
await page.keyboard.press('Escape');
await page.locator('.wk-theme-toggle').click();
await expectTheme(page, false);
await page.locator('.wk-brand').click();
await homepage();
await expectTheme(page, false);
assert.equal(context.pages().length, 1);
// Navigation to new v0.8.0 docs, returning through the explicit home link.
await page.locator('#release').getByRole('link', { name: '了解更多', exact: true }).last().click();
await page.waitForSelector('.VPDoc h1');
assert.match(await page.locator('.VPDoc h1').innerText(), /记忆/);
await page.locator('.wk-brand').click();
await homepage();
assert.equal(context.pages().length, 1);
// Preferences propagate between open homepage and docs tabs in both directions.
const docs = await context.newPage();
await docs.goto(origin + '/docs/');
await docs.waitForSelector('.VPDoc h1');
await docs.locator('.wk-theme-toggle').click();
await expectTheme(docs, true);
await expectTheme(page, true);
await page.getByRole('switch', { name: '切换到浅色' }).click();
await expectTheme(page, false);
await expectTheme(docs, false);
await docs.close();
// With no explicit selection, follow the operating-system preference.
const automatic = await browser.newContext({ colorScheme: 'dark' });
const autoPage = await automatic.newPage();
await autoPage.goto(origin + '/');
await expectTheme(autoPage, true);
await autoPage.emulateMedia({ colorScheme: 'light' });
await expectTheme(autoPage, false);
await autoPage.goto(origin + '/docs/');
await autoPage.waitForSelector('.VPDoc h1');
await expectTheme(autoPage, false);
await autoPage.emulateMedia({ colorScheme: 'dark' });
await expectTheme(autoPage, true);
await automatic.close();
// Switch and return links remain reachable on a narrow phone viewport.
await page.setViewportSize({ width: 320, height: 800 });
await page.goto(origin + '/');
await checkVisibleControl(page, 'button[role="switch"]');
await page.getByRole('switch', { name: '切换到深色' }).click();
await expectTheme(page, true);
await page.getByRole('button', { name: '打开导航' }).click();
await page.locator('#main-navigation').getByRole('link', { name: '文档', exact: true }).click();
await page.waitForSelector('.VPDoc h1');
await expectTheme(page, true);
await checkVisibleControl(page, '.wk-brand');
await page.locator('.wk-theme-toggle').click();
await page.getByRole('button', { name: '打开导航' }).click();
await checkVisibleControl(page, '.wk-header-search button');
await page.locator('.wk-header-search button').click();
await page.locator('#localsearch-input').fill('长期记忆');
await page.waitForSelector('.VPLocalSearchBox .result');
await page.keyboard.press('Escape');
await page.keyboard.press('Escape');
await page.locator('.VPLocalNav button.menu').click();
await checkVisibleControl(page, '.VPSidebar.open');
await page.keyboard.press('Escape');
// A deep link must reveal its entry after hydration, including the mobile drawer.
await page.goto(origin + '/docs/05-clients/01-frontend.html');
await page.locator('.VPLocalNav button.menu').click();
await currentSidebarLinkVisible(page);
await page.keyboard.press('Escape');
await expectTheme(page, false);
await page.locator('.wk-brand').click();
await homepage();
await expectTheme(page, false);
assert.equal(context.pages().length, 1);
for (const path of ['/docs/03-features/22-skills-sandbox', '/docs/03-features/22-skills-sandbox.html', '/docs/03-features/23-memory.html']) {
const response = await context.request.get(origin + path);
assert.equal(response.status(), 200, path);
assert.ok(!(await response.text()).includes('id="hero-title"'), 'A missing docs route must not fall back to the homepage');
}
assert.equal((await context.request.get(origin + '/docs/this-page-does-not-exist')).status(), 404);
for (const width of [320, 801, 1024, 1920]) {
await page.setViewportSize({ width, height: 900 });
for (const path of ['/', '/docs/01-getting-started/02-installation.html']) {
await page.goto(origin + path);
await page.waitForSelector('.wk-header');
const dimensions = await page.locator('.wk-header').evaluate(el => ({ width: el.getBoundingClientRect().width, height: el.getBoundingClientRect().height, scrollWidth: el.scrollWidth }));
assert.equal(dimensions.height, 64);
assert.equal(dimensions.width, width);
assert.equal(dimensions.scrollWidth, width);
await checkVisibleControl(page, '.wk-brand');
await page.waitForFunction(() => {
const image = document.querySelector('.wk-brand img');
return image?.complete && image.naturalWidth === 945 && image.naturalHeight === 650;
});
assert.equal(await page.locator('.wk-brand img').getAttribute('src'), '/brand/weknora-original.png');
await checkVisibleControl(page, '.wk-theme-toggle');
}
}
assert.deepEqual(errors, []);
console.log('Integration checks passed: compact full-width mastheads, distinct product/docs navigation, quickstart entry, header search, theme toggle, reload, shared preferences, system theme, same-tab docs/home/logo navigation, mobile controls, and direct docs/404 routes.');
} finally {
await browser.close();
}

View File

@ -0,0 +1,52 @@
/* Shared by the product homepage and VitePress documentation. */
:root {
color-scheme: light;
--wk-ink: #101f38;
--wk-ink-deep: #0a1526;
--wk-ink-soft: #40536f;
--wk-ink-mute: #6d7d94;
--wk-gold: #b8863b;
--wk-gold-light: #d9a94f;
--wk-paper: #fdfcfa;
--wk-paper-2: #f5f3ee;
--wk-paper-3: #edeae2;
--wk-rule: rgba(16, 31, 56, .12);
--wk-rule-soft: rgba(16, 31, 56, .07);
--wk-surface: #fff;
--wk-header: rgba(253, 252, 250, .96);
--wk-button-hover: #24395a;
--wk-accent-text: #886025;
--wk-accent-border: #dfd1b9;
--wk-logo-ground: #fff;
--wk-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans CJK SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
--wk-font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", "STSong", serif;
--wk-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
html.dark {
color-scheme: dark;
--wk-ink: #e6ecf5;
--wk-ink-soft: #a9b6c9;
--wk-ink-mute: #9aaac0;
--wk-gold: #d9a94f;
--wk-gold-light: #e8c176;
--wk-paper: #0b1220;
--wk-paper-2: #101a2b;
--wk-paper-3: #16233a;
--wk-rule: rgba(190, 208, 232, .14);
--wk-rule-soft: rgba(190, 208, 232, .08);
--wk-surface: #101a2b;
--wk-header: rgba(11, 18, 32, .96);
--wk-button-hover: #c3d0e2;
--wk-accent-text: #e8c176;
--wk-accent-border: #685638;
}
/* Original README artwork, copied byte-for-byte. Only blank outer canvas is
hidden (source viewport: x=0, y=208, width=945, height=238). Keep the full
lettering, sail and waves. Blend away the blank background in light mode;
the user-approved inverted presentation is applied only in dark mode. */
.wk-logo { position: relative; display: inline-block; width: 164px; aspect-ratio: 945 / 238; overflow: hidden; flex-shrink: 0; vertical-align: middle; mix-blend-mode: multiply; }
html.dark .wk-logo { mix-blend-mode: screen; }
html.dark .wk-logo img { filter: invert(1) hue-rotate(180deg); }
.wk-logo img { position: absolute; display: block; left: 0; top: -87.394958%; width: 100%; max-width: none; height: auto; }
@media (max-width: 480px) { .wk-brand .wk-logo { width: 148px; } }

View File

@ -0,0 +1,39 @@
/* Keep the masthead identical across the product site and documentation. */
.wk-header { position: sticky; top: 0; z-index: 30; width: 100%; border-bottom: 1px solid var(--wk-rule); background: var(--wk-header); backdrop-filter: blur(16px); color: var(--wk-ink); font-family: var(--wk-font-sans); font-feature-settings: normal; line-height: 1.75; }
.wk-header *, .wk-header *::before, .wk-header *::after { box-sizing: border-box; }
.wk-header a { text-decoration: none; }
.wk-header button { font: inherit; cursor: pointer; padding: 0; }
.wk-header-inner { width: 100%; padding-inline: 32px; margin-inline: auto; height: 63px; display: flex; align-items: center; gap: 28px; }
.wk-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--wk-ink); flex-shrink: 0; }
.wk-navigation { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 2.2vw, 40px); flex: 1; }
.wk-navigation a { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; color: var(--wk-ink-soft); transition: color .2s; }
.wk-navigation a:hover, .wk-navigation a[aria-current="page"] { color: var(--wk-gold); }
.wk-header svg { width: 24px; height: 24px; flex-shrink: 0; }
.wk-navigation svg { width: 14px; height: 14px; }
.wk-new-label { font-size: 12px; font-weight: 650; color: var(--wk-accent-text); letter-spacing: .03em; border: 1px solid var(--wk-accent-border); padding: 0 4px; line-height: 1.6; }
.wk-header-github { font-size: 14px; display: flex; align-items: center; gap: 9px; color: var(--wk-ink); padding-left: 28px; border-left: 1px solid var(--wk-rule); min-height: 30px; }
.wk-header-github svg { width: 20px; height: 20px; }
.wk-header .wk-menu-toggle { display: none; border: 0; background: none; width: 44px; height: 44px; color: var(--wk-ink); align-items: center; justify-content: center; }
.wk-header .wk-theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border: 1px solid var(--wk-rule); border-radius: 20px; background: var(--wk-paper-2); color: var(--wk-ink-soft); }
.wk-theme-toggle:hover { color: var(--wk-gold); border-color: var(--wk-gold); }
.wk-theme-toggle svg { width: 19px; height: 19px; }
.wk-navigation .wk-mobile-github { display: none; }
.wk-header :focus-visible { outline: 2px solid var(--wk-gold); outline-offset: 5px; }
@media (max-width: 1100px) {
.wk-header-inner { padding-inline: 24px; gap: 14px; }
.wk-navigation { gap: 14px; }
.wk-navigation a { font-size: 13px; }
.wk-header-github { padding-left: 18px; }
.wk-header-github span { display: none; }
}
@media (max-width: 800px) {
.wk-header-inner { gap: 12px; }
.wk-header-github { display: none; }
.wk-header .wk-menu-toggle { display: flex; }
.wk-theme-toggle { margin-left: auto; }
.wk-navigation { display: none; }
.wk-navigation.is-open { display: flex; position: absolute; left: 0; top: 63px; max-height: calc(100dvh - 64px); overflow-y: auto; right: 0; padding: 20px 32px 26px; background: var(--wk-paper); border-bottom: 1px solid var(--wk-rule); flex-direction: column; align-items: stretch; gap: 4px; box-shadow: 0 15px 20px #101f380a; }
.wk-navigation a { font-size: 16px; }
.wk-navigation .wk-mobile-github { display: inline-flex; }
}
@media (max-width: 480px) { .wk-header-inner { padding-inline: 20px; } }

View File

@ -0,0 +1,17 @@
// Product navigation and shared masthead icons.
export const siteNavigation = [
{ label: '产品能力', href: '/#capabilities', badge: '' },
{ label: 'v0.8.0', href: '/#release', badge: 'NEW' },
{ label: '生态集成', href: '/#ecosystem', badge: '' },
{ label: '企业部署', href: '/#enterprise', badge: '' },
{ label: '文档', href: '/docs/', badge: '' },
];
export const repositoryUrl = 'https://github.com/Tencent/WeKnora';
export const headerIcons: Record<string, string> = {
sun: 'M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5',
moon: 'M20.8 13A9 9 0 0 1 11 3.2 9 9 0 1 0 20.8 13Z',
menu: 'M4 6h16M4 12h16M4 18h16',
close: 'm5 5 14 14M5 19 19 5',
external: 'M8 5H5v14h14v-3M12 5h7v7M10 14 19 5',
github: 'M9 19c-4.3 1.3-4.3-2.2-6-2.7m12 5v-3.5c0-1 .1-1.4-.5-2 3.4-.4 7-1.7 7-7.5a5.7 5.7 0 0 0-1.5-4 5.4 5.4 0 0 0-.1-4S18.6-.1 15.5 2a14 14 0 0 0-7 0C5.4-.1 4.1.3 4.1.3A5.4 5.4 0 0 0 4 4.3a5.7 5.7 0 0 0-1.5 4c0 5.8 3.6 7.1 7 7.5-.6.6-.6 1.2-.5 2V21',
};