Skip to content

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

fix(frontend): link docs to the public docs site instead of GitHub

wizardchen9253b2c1dc8f
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index a8d0150d4..73cd1dbd2 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: WeKnora Documentation
- url: https://github.com/Tencent/WeKnora/blob/main/website-docs/01-getting-started/05-troubleshooting.md
+ url: https://weknora.weixin.qq.com/docs/01-getting-started/05-troubleshooting
about: Check WeKnora FAQ
- name: Discussions
url: https://github.com/Tencent/WeKnora/discussions
diff --git a/frontend/src/components/ModelEditorDialog.vue b/frontend/src/components/ModelEditorDialog.vue
index 8992c1549..ed53f38a3 100644
--- a/frontend/src/components/ModelEditorDialog.vue
+++ b/frontend/src/components/ModelEditorDialog.vue
@@ -646,6 +646,7 @@ import CredentialResource, {
} from '@/components/credentials/CredentialResource.vue'
import { shouldShowOllamaUnavailableTip } from '@/components/modelEditorSourceState'
import { WEKNORA_CLOUD_PROVIDER, WKC_MODEL_KINDS, WKC_MODEL_NAME_BY_KIND } from '@/utils/weknoraCloudModels'
+import { docsUrl } from '@/utils/docsUrl'
interface CustomHeaderItem {
key: string
@@ -703,8 +704,7 @@ const PROTOCOL_OPTIONS = [
] as const
/** Field reference for parameters.spec.compat, per protocol and model type. */
-const COMPAT_DOC_URL =
- 'https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/06-models.md#协议兼容覆盖-compat-json'
+const COMPAT_DOC_URL = docsUrl('modelsCompat')
/** Legacy thinking_control values still honoured by catalog.Resolve. */
const LEGACY_THINKING_CONTROL_VALUES = ['none', 'enable_thinking', 'thinking_type', 'chat_template_kwargs'] as const
diff --git a/frontend/src/components/SandboxConfigEditorDrawer.vue b/frontend/src/components/SandboxConfigEditorDrawer.vue
index bfb646490..a8a3ed701 100644
--- a/frontend/src/components/SandboxConfigEditorDrawer.vue
+++ b/frontend/src/components/SandboxConfigEditorDrawer.vue
@@ -765,6 +765,7 @@ import { useI18n } from 'vue-i18n'
import SettingDrawer from '@/components/settings/SettingDrawer.vue'
import SandboxBackendBadge from '@/components/settings/SandboxBackendBadge.vue'
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities'
+import { docsUrl } from '@/utils/docsUrl'
import {
checkSandboxConfig,
createSandboxConfig,
@@ -816,7 +817,7 @@ const isMaskedSecret = (value?: string) => value === secretPlaceholder
// the sandbox account cannot write.
const defaultDockerImage = 'wechatopenai/weknora-sandbox:main'
-const clusterGuideUrl = 'https://github.com/Tencent/WeKnora/blob/main/website-docs/06-development/04-sandbox-deployment.md'
+const clusterGuideUrl = docsUrl('sandboxDeployment')
const e2bApiKeysUrl = 'https://e2b.dev/dashboard?tab=keys'
const backendOptions = computed(() => {
diff --git a/frontend/src/components/UserMenu.vue b/frontend/src/components/UserMenu.vue
index 0b7ebf59e..e377569e3 100644
--- a/frontend/src/components/UserMenu.vue
+++ b/frontend/src/components/UserMenu.vue
@@ -215,6 +215,7 @@ import { useRoleLabel, useHomeTenant } from '@/composables/useRoleLabel'
import { getRootZoom, rectToCssPx, cssViewportSize } from '@/utils/zoom'
import { openNewUserGuide } from '@/config/contextualGuides'
import { SETTINGS_MANAGEMENT_SHORTCUT_MIN_ROLE } from '@/config/settingsAccess'
+import { docsUrl } from '@/utils/docsUrl'
const { t } = useI18n()
const router = useRouter()
@@ -493,7 +494,7 @@ const reopenGuide = () => {
const openDocs = () => {
menuVisible.value = false
- window.open('https://github.com/Tencent/WeKnora/tree/main/website-docs', '_blank')
+ window.open(docsUrl('home'), '_blank')
}
// 打开 GitHub
diff --git a/frontend/src/components/modelEditorFlow.test.ts b/frontend/src/components/modelEditorFlow.test.ts
index 46ea698e0..08d0d449e 100644
--- a/frontend/src/components/modelEditorFlow.test.ts
+++ b/frontend/src/components/modelEditorFlow.test.ts
@@ -85,6 +85,7 @@ async function fixture(options: {
if (name === '@/stores/modelProviders') return { useModelProvidersStore: () => providersStore }
if (name === '@/api/model') return { getWeKnoraCloudStatus: async () => ({ has_models: true, needs_reinit: false }) }
if (name === '@/utils/weknoraCloudModels') return require('../utils/weknoraCloudModels.ts')
+ if (name === '@/utils/docsUrl') return require('../utils/docsUrl.ts')
if (name === '@/stores/modelProvidersState') return require('../stores/modelProvidersState.ts')
if (name === '@/utils/reasoningEffort') return require('../utils/reasoningEffort.ts')
if (name === '@/utils/contextWindow') return require('../utils/contextWindow.ts')
diff --git a/frontend/src/utils/docsUrl.test.ts b/frontend/src/utils/docsUrl.test.ts
new file mode 100644
index 000000000..8e415f909
--- /dev/null
+++ b/frontend/src/utils/docsUrl.test.ts
@@ -0,0 +1,46 @@
+import { strict as assert } from 'node:assert'
+import { existsSync, readFileSync } from 'node:fs'
+import { dirname, resolve } from 'node:path'
+import { test } from 'node:test'
+import { fileURLToPath } from 'node:url'
+import { DOC_PAGES, docsUrl } from './docsUrl'
+
+const WEBSITE_DOCS = resolve(dirname(fileURLToPath(import.meta.url)), '../../../website-docs')
+
+// VitePress default slugify for the headings we link to: explicit `{#id}`
+// wins, otherwise lowercase with whitespace and punctuation collapsed to `-`.
+function headingIds(markdown: string): Set<string> {
+ const ids = new Set<string>()
+ for (const line of markdown.split('\n')) {
+ const m = /^#{1,6}\s+(.*?)\s*$/.exec(line)
+ if (!m) continue
+ const explicit = /\{#([^}]+)\}$/.exec(m[1])
+ if (explicit) {
+ ids.add(explicit[1])
+ continue
+ }
+ ids.add(
+ m[1]
+ .toLowerCase()
+ .replace(/[\s~`!@#$%^&*()+=[\]{}|\\;:'",.<>/?]+/g, '-')
+ .replace(/^-+|-+$/g, ''),
+ )
+ }
+ return ids
+}
+
+test('every linked doc page and anchor exists in website-docs', () => {
+ for (const [key, target] of Object.entries(DOC_PAGES)) {
+ const [page, anchor] = target.split('#')
+ const file = resolve(WEBSITE_DOCS, page ? `${page}.md` : 'index.md')
+ assert.ok(existsSync(file), `${key}: ${file} not found`)
+ if (anchor) {
+ assert.ok(headingIds(readFileSync(file, 'utf8')).has(anchor), `${key}: #${anchor} not found in ${file}`)
+ }
+ }
+})
+
+test('docsUrl points at the public docs site', () => {
+ assert.equal(docsUrl('home'), 'https://weknora.weixin.qq.com/docs/')
+ assert.equal(docsUrl('models'), 'https://weknora.weixin.qq.com/docs/03-features/06-models')
+})
diff --git a/frontend/src/utils/docsUrl.ts b/frontend/src/utils/docsUrl.ts
new file mode 100644
index 000000000..06b627002
--- /dev/null
+++ b/frontend/src/utils/docsUrl.ts
@@ -0,0 +1,24 @@
+/** Public deployment of website-docs (VitePress, base `/docs/`). */
+export const DOCS_BASE_URL = 'https://weknora.weixin.qq.com/docs/'
+
+/**
+ * Doc pages linked from the UI, as website-docs paths without the `.md`
+ * suffix. docsUrl.test.ts checks each one (and its anchor) still exists.
+ */
+export const DOC_PAGES = {
+ home: '',
+ tenantAuth: '03-features/01-tenant-auth',
+ models: '03-features/06-models',
+ modelsCompat: '03-features/06-models#协议兼容覆盖-compat-json',
+ knowledgeGraph: '03-features/09-knowledge-graph',
+ imIntegration: '03-features/12-im-integration',
+ apiOverview: '04-api/01-api-overview',
+ troubleshootingMigrations: '01-getting-started/05-troubleshooting#database-migrations',
+ sandboxDeployment: '06-development/04-sandbox-deployment',
+} as const
+
+export type DocPage = keyof typeof DOC_PAGES
+
+export function docsUrl(page: DocPage): string {
+ return DOCS_BASE_URL + DOC_PAGES[page]
+}
diff --git a/frontend/src/views/integrations/ApiIntegrationSettings.vue b/frontend/src/views/integrations/ApiIntegrationSettings.vue
index 960400ceb..eefb9c01e 100644
--- a/frontend/src/views/integrations/ApiIntegrationSettings.vue
+++ b/frontend/src/views/integrations/ApiIntegrationSettings.vue
@@ -702,6 +702,7 @@ import {
} from '@/config/apiKeyCapabilities'
import { normalizeAPIKeyKnowledgeBaseIDs } from './apiKeyScope'
import { consumeApiPlaygroundSSE } from './apiPlaygroundSSE'
+import { docsUrl } from '@/utils/docsUrl'
const { t } = useI18n()
@@ -1431,7 +1432,7 @@ const saveDesktopPort = async () => {
}
function openApiDoc() {
- window.open('https://github.com/Tencent/WeKnora/blob/main/website-docs/04-api/01-api-overview.md', '_blank')
+ window.open(docsUrl('apiOverview'), '_blank')
}
function openCreateAPIKeyDialog() {
diff --git a/frontend/src/views/integrations/IntegrationSettingsSection.vue b/frontend/src/views/integrations/IntegrationSettingsSection.vue
index bcc842272..1251b92a1 100644
--- a/frontend/src/views/integrations/IntegrationSettingsSection.vue
+++ b/frontend/src/views/integrations/IntegrationSettingsSection.vue
@@ -7,7 +7,7 @@
<p class="section-description">
{{ $t('agentEditor.im.description') }}
<a
- href="https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/12-im-integration.md"
+ :href="docsUrl('imIntegration')"
target="_blank"
rel="noopener noreferrer"
class="doc-link"
@@ -62,6 +62,7 @@ import ChromeExtensionLanding from '@/views/integrations/ChromeExtensionLanding.
import ClawSkillLanding from '@/views/integrations/ClawSkillLanding.vue'
import CliIntegrationLanding from '@/views/integrations/CliIntegrationLanding.vue'
import type { IntegrationTab } from '@/config/integrations'
+import { docsUrl } from '@/utils/docsUrl'
const filterAgentId = ref('')
diff --git a/frontend/src/views/knowledge/settings/GraphSettings.vue b/frontend/src/views/knowledge/settings/GraphSettings.vue
index ba274f040..ce8db16b4 100644
--- a/frontend/src/views/knowledge/settings/GraphSettings.vue
+++ b/frontend/src/views/knowledge/settings/GraphSettings.vue
@@ -326,6 +326,7 @@ import { useI18n } from 'vue-i18n'
import { extractTextRelations, fabriText, fabriTag, type Node, type Relation } from '@/api/initialization'
import { useEditorResourcesStore } from '@/stores/editorResources'
import { useAuthStore } from '@/stores/auth'
+import { docsUrl } from '@/utils/docsUrl'
const { t } = useI18n()
const authStore = useAuthStore()
@@ -587,8 +588,7 @@ const loadSystemInfo = async (force = false) => {
}
const graphGuideUrl =
- import.meta.env.VITE_KG_GUIDE_URL ||
- 'https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/09-knowledge-graph.md'
+ import.meta.env.VITE_KG_GUIDE_URL || docsUrl('knowledgeGraph')
// Open guide documentation to show how to enable graph database
const handleOpenGraphGuide = () => {
diff --git a/frontend/src/views/settings/ModelSettings.vue b/frontend/src/views/settings/ModelSettings.vue
index d48c7bb26..7219e7dc7 100644
--- a/frontend/src/views/settings/ModelSettings.vue
+++ b/frontend/src/views/settings/ModelSettings.vue
@@ -41,7 +41,7 @@
? 'modelSettings.builtinModels.descriptionAdmin'
: 'modelSettings.builtinModels.description') }}
</p>
- <a class="doc-link" href="https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/06-models.md" target="_blank"
+ <a class="doc-link" :href="docsUrl('models')" target="_blank"
rel="noopener noreferrer">
{{ $t('modelSettings.builtinModels.viewGuide') }}
<t-icon name="link" class="link-icon" />
@@ -311,6 +311,7 @@ import { useUIStore } from '@/stores/ui'
import { focusKbEditorSection } from '@/config/contextualGuides'
import { useChatResourcesStore } from '@/stores/chatResources'
import { useModelProvidersStore } from '@/stores/modelProviders'
+import { docsUrl } from '@/utils/docsUrl'
import {
formatContextWindow,
isDefaultContextWindow,
diff --git a/frontend/src/views/settings/SandboxSettings.vue b/frontend/src/views/settings/SandboxSettings.vue
index e453e7027..0f13f3755 100644
--- a/frontend/src/views/settings/SandboxSettings.vue
+++ b/frontend/src/views/settings/SandboxSettings.vue
@@ -218,6 +218,7 @@ import SettingDrawer from '@/components/settings/SettingDrawer.vue'
import { useConfirmDelete } from '@/components/settings/useConfirmDelete'
import { getSession } from '@/api/chat/index'
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities'
+import { docsUrl } from '@/utils/docsUrl'
import {
deleteSandboxConfig,
getSandboxConfigInventory,
@@ -238,7 +239,7 @@ const dockerBackendEnabled = computed(() =>
deploymentCapabilities.isSupported('settings.sandbox.docker'),
)
-const sandboxGuideUrl = 'https://github.com/Tencent/WeKnora/blob/main/website-docs/06-development/04-sandbox-deployment.md'
+const sandboxGuideUrl = docsUrl('sandboxDeployment')
const backendTypes = [...NAMED_SANDBOX_BACKEND_TYPES]
diff --git a/frontend/src/views/settings/SystemInfo.vue b/frontend/src/views/settings/SystemInfo.vue
index 97dc49abb..8e6c93c31 100644
--- a/frontend/src/views/settings/SystemInfo.vue
+++ b/frontend/src/views/settings/SystemInfo.vue
@@ -198,6 +198,7 @@
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { getSystemInfo, type SystemInfo } from '@/api/system'
import { useI18n } from 'vue-i18n'
+import { docsUrl } from '@/utils/docsUrl'
const { t, locale } = useI18n()
@@ -245,8 +246,7 @@ function formatUptime(totalSeconds: number): string {
return parts.join(' ')
}
-const troubleshootingDocsURL =
- 'https://github.com/Tencent/WeKnora/blob/main/website-docs/01-getting-started/05-troubleshooting.md#database-migrations'
+const troubleshootingDocsURL = docsUrl('troubleshootingMigrations')
// Pre-fills a new issue with the current migration error so users don't have to
// paste it manually. Body is intentionally minimal — the bug template will fill
diff --git a/frontend/src/views/settings/TenantMembers.vue b/frontend/src/views/settings/TenantMembers.vue
index d2a4334de..fb106d06d 100644
--- a/frontend/src/views/settings/TenantMembers.vue
+++ b/frontend/src/views/settings/TenantMembers.vue
@@ -54,7 +54,7 @@
{{ $t('tenantMember.sectionDescription') }}
<a
class="doc-link"
- href="https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/01-tenant-auth.md"
+ :href="docsUrl('tenantAuth')"
target="_blank"
rel="noopener noreferrer"
>
@@ -535,6 +535,7 @@ import {
revokeInvitation,
type TenantInvitation,
} from '@/api/tenant/invitations'
+import { docsUrl } from '@/utils/docsUrl'
import {
listAuditLog,
type AuditLog,