Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

docs(website): add official site link and inject VERSION at build time

wizardchen0a310e532766
diff --git a/website-docs/.vitepress/config.mts b/website-docs/.vitepress/config.mts
index acdb20372..85b3a90c1 100644
--- a/website-docs/.vitepress/config.mts
+++ b/website-docs/.vitepress/config.mts
@@ -2,6 +2,8 @@ import { readFileSync, readdirSync } from 'node:fs'
import { resolve } from 'node:path'
import { defineConfig, type DefaultTheme } from 'vitepress'
import { withMermaid } from 'vitepress-plugin-mermaid'
+import './theme-config.d.ts'
+import { repoVersionLabel } from './version'
const root = resolve(import.meta.dirname, '..')
@@ -56,6 +58,7 @@ function tokenize(text: string): string[] {
}
const repo = 'https://github.com/Tencent/WeKnora'
+const site = 'https://weknora.weixin.qq.com'
export default withMermaid(
defineConfig({
@@ -106,8 +109,11 @@ export default withMermaid(
{ 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 },
],
+ weknoraVersion: repoVersionLabel,
+
sidebar,
socialLinks: [{ icon: 'github', link: repo }],
@@ -160,7 +166,7 @@ export default withMermaid(
},
footer: {
- message: '基于 WeKnora main 分支源码整理 · MIT License',
+ message: `基于 WeKnora ${repoVersionLabel} 源码整理 · MIT License`,
copyright: '© Tencent WeKnora',
},
},
diff --git a/website-docs/.vitepress/theme-config.d.ts b/website-docs/.vitepress/theme-config.d.ts
new file mode 100644
index 000000000..241b1c8ac
--- /dev/null
+++ b/website-docs/.vitepress/theme-config.d.ts
@@ -0,0 +1,8 @@
+import 'vitepress'
+
+declare module 'vitepress/dist/client/theme-default/config' {
+ export interface ThemeConfig {
+ /** 文档站点展示的 WeKnora 发布版本(来自仓库根 VERSION) */
+ weknoraVersion?: string
+ }
+}
diff --git a/website-docs/.vitepress/theme/Landing.vue b/website-docs/.vitepress/theme/Landing.vue
index e78367acc..08bcbcaa7 100644
--- a/website-docs/.vitepress/theme/Landing.vue
+++ b/website-docs/.vitepress/theme/Landing.vue
@@ -1,6 +1,10 @@
<script setup lang="ts">
+import { useData } from 'vitepress/client'
import Illus from './Illus.vue'
+const { theme } = useData()
+const versionLabel = theme.value.weknoraVersion ?? 'unknown'
+
const stats = [
{ value: '25', unit: '种', label: '文件格式:文档、网页、扫描件、图片、音频' },
{ value: '26', unit: '家+', label: '模型厂商,也可全部换成本地推理' },
@@ -266,7 +270,7 @@ const deployments = [
<section class="hero">
<div class="shell hero-grid">
<div class="hero-copy">
- <p class="eyebrow">Tencent 开源 · WeKnora v0.7.1 · 官方文档</p>
+ <p class="eyebrow">Tencent 开源 · WeKnora {{ versionLabel }} · 官方文档</p>
<h1 class="display">
开源的知识库问答系统
</h1>
@@ -275,6 +279,14 @@ const deployments = [
<div class="actions">
<a class="btn btn-solid" href="/01-getting-started/01-introduction">开始阅读</a>
<a class="btn btn-ghost" href="/02-architecture/01-overview">系统架构</a>
+ <a
+ class="btn btn-text"
+ href="https://weknora.weixin.qq.com"
+ target="_blank"
+ rel="noreferrer"
+ >
+ 官方网站 ↗
+ </a>
<a
class="btn btn-text"
href="https://github.com/Tencent/WeKnora"
diff --git a/website-docs/.vitepress/version.ts b/website-docs/.vitepress/version.ts
new file mode 100644
index 000000000..dda572c08
--- /dev/null
+++ b/website-docs/.vitepress/version.ts
@@ -0,0 +1,15 @@
+import { existsSync, readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+const versionFile = resolve(import.meta.dirname, '../../VERSION')
+
+/** 仓库根目录 VERSION 文件中的发布版本(与 scripts/get_version.sh 同源) */
+export function getRepoVersion(): string {
+ if (!existsSync(versionFile)) return 'unknown'
+ return readFileSync(versionFile, 'utf-8').trim() || 'unknown'
+}
+
+export const repoVersion = getRepoVersion()
+
+export const repoVersionLabel =
+ repoVersion === 'unknown' || repoVersion.startsWith('v') ? repoVersion : `v${repoVersion}`
diff --git a/website-docs/README.md b/website-docs/README.md
index a2e911d01..14a5d3290 100644
--- a/website-docs/README.md
+++ b/website-docs/README.md
@@ -213,4 +213,4 @@ flowchart LR
- 文中源码路径均相对仓库根目录,如 `internal/agent/engine.go`。
- API 路径默认带 `/api/v1` 前缀;认证方式见 [API 总览](04-api/01-api-overview.md)。
- 配置示例中的密钥均为占位符,生产环境务必替换(尤其 `JWT_SECRET`、`SYSTEM_AES_KEY`、数据库口令)。
-- 文档对应 `main` 分支(v0.7.1 及其后的提交),随代码变更同步维护。
+- 文档基于仓库根目录 `VERSION` 文件对应版本源码整理(VitePress 构建时自动读取),随代码变更同步维护。