Revert "feat(docs): initialize WeKnora documentation site with VitePress"
This reverts commit 99c483f6eb.
main
parent
fefc2c1dc0
commit
09e900c779
|
|
@ -1,7 +0,0 @@
|
|||
# 仓库根 .gitignore 忽略了所有隐藏目录,这里把站点源码目录放回来
|
||||
!.vitepress/
|
||||
.vitepress/cache/
|
||||
.vitepress/dist/
|
||||
|
||||
node_modules/
|
||||
.shots/
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
import { readFileSync, readdirSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { defineConfig, type DefaultTheme } from 'vitepress'
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid'
|
||||
|
||||
const root = resolve(import.meta.dirname, '..')
|
||||
|
||||
const sections: { dir: string; label: string }[] = [
|
||||
{ dir: '01-getting-started', label: '快速开始' },
|
||||
{ dir: '02-architecture', label: '架构' },
|
||||
{ dir: '03-features', label: '功能模块' },
|
||||
{ dir: '04-api', label: 'API 参考' },
|
||||
{ dir: '05-clients', label: '客户端' },
|
||||
{ dir: '06-development', label: '开发指南' },
|
||||
]
|
||||
|
||||
/** 侧边栏条目文字:取正文一级标题,去掉冗余前后缀 */
|
||||
function itemText(dir: string, file: string): string {
|
||||
const raw = readFileSync(resolve(root, dir, file), 'utf-8')
|
||||
const heading = raw.match(/^#\s+(.+)$/m)?.[1] ?? file.replace(/\.md$/, '')
|
||||
return heading
|
||||
.replace(/^API 参考[::]\s*/, '')
|
||||
.replace(/\s*[((][^(())]*[))]\s*/g, ' ')
|
||||
.replace(/\s{2,}/g, ' ')
|
||||
.trim()
|
||||
}
|
||||
|
||||
function itemsOf(dir: string): DefaultTheme.SidebarItem[] {
|
||||
return readdirSync(resolve(root, dir))
|
||||
.filter((f) => f.endsWith('.md'))
|
||||
.sort()
|
||||
.map((f) => ({
|
||||
text: itemText(dir, f),
|
||||
link: `/${dir}/${f.replace(/\.md$/, '')}`,
|
||||
}))
|
||||
}
|
||||
|
||||
const sidebar: DefaultTheme.SidebarItem[] = sections.map((s) => ({
|
||||
text: s.label,
|
||||
collapsed: false,
|
||||
items: itemsOf(s.dir),
|
||||
}))
|
||||
|
||||
/** 本地搜索默认按空白分词,中文整段会被当作一个词,这里退化为字粒度切分 */
|
||||
function tokenize(text: string): string[] {
|
||||
const tokens: string[] = []
|
||||
for (const part of text.split(/[\s\n\r#%*,=/:;?[\]{}()&+\-!'"$·、,。:;?!()【】《》…—]+/)) {
|
||||
if (!part) continue
|
||||
if (/[\u4e00-\u9fa5]/.test(part)) {
|
||||
tokens.push(part, ...part.split(''))
|
||||
} else {
|
||||
tokens.push(part)
|
||||
}
|
||||
}
|
||||
return tokens
|
||||
}
|
||||
|
||||
const repo = 'https://github.com/Tencent/WeKnora'
|
||||
|
||||
export default withMermaid(
|
||||
defineConfig({
|
||||
title: 'WeKnora',
|
||||
titleTemplate: ':title · WeKnora 文档',
|
||||
description: 'WeKnora(维娜拉)官方文档 —— 腾讯开源的知识库与检索增强生成系统',
|
||||
lang: 'zh-CN',
|
||||
cleanUrls: true,
|
||||
lastUpdated: true,
|
||||
srcExclude: ['README.md'],
|
||||
metaChunk: true,
|
||||
|
||||
head: [
|
||||
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
|
||||
['meta', { name: 'theme-color', content: '#101f38' }],
|
||||
['meta', { property: 'og:type', content: 'website' }],
|
||||
['meta', { property: 'og:title', content: 'WeKnora 文档' }],
|
||||
[
|
||||
'meta',
|
||||
{
|
||||
property: 'og:description',
|
||||
content: '文档理解 · 知识索引 · 混合检索 · 智能体推理',
|
||||
},
|
||||
],
|
||||
],
|
||||
|
||||
markdown: {
|
||||
theme: { light: 'github-light', dark: 'github-dark' },
|
||||
lineNumbers: false,
|
||||
toc: { level: [2, 3] },
|
||||
},
|
||||
|
||||
themeConfig: {
|
||||
logo: { light: '/logo-mark.svg', dark: '/logo-mark-dark.svg', alt: 'WeKnora' },
|
||||
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/' },
|
||||
],
|
||||
|
||||
sidebar,
|
||||
|
||||
socialLinks: [{ icon: 'github', link: repo }],
|
||||
|
||||
outline: { level: [2, 3], label: '本页目录' },
|
||||
|
||||
docFooter: { prev: '上一篇', next: '下一篇' },
|
||||
returnToTopLabel: '回到顶部',
|
||||
sidebarMenuLabel: '目录',
|
||||
darkModeSwitchLabel: '外观',
|
||||
lightModeSwitchTitle: '切换到浅色',
|
||||
darkModeSwitchTitle: '切换到深色',
|
||||
|
||||
lastUpdated: {
|
||||
text: '最后更新',
|
||||
formatOptions: { dateStyle: 'medium', timeStyle: undefined },
|
||||
},
|
||||
|
||||
editLink: {
|
||||
pattern: `${repo}/edit/main/website-docs/:path`,
|
||||
text: '在 GitHub 上编辑此页',
|
||||
},
|
||||
|
||||
search: {
|
||||
provider: 'local',
|
||||
options: {
|
||||
translations: {
|
||||
button: { buttonText: '搜索文档', buttonAriaLabel: '搜索文档' },
|
||||
modal: {
|
||||
displayDetails: '展开详情',
|
||||
resetButtonTitle: '清除',
|
||||
backButtonTitle: '返回',
|
||||
noResultsText: '没有找到结果',
|
||||
footer: {
|
||||
selectText: '选择',
|
||||
navigateText: '切换',
|
||||
closeText: '关闭',
|
||||
},
|
||||
},
|
||||
},
|
||||
miniSearch: {
|
||||
options: { tokenize },
|
||||
searchOptions: {
|
||||
fuzzy: 0.2,
|
||||
prefix: true,
|
||||
boost: { title: 4, text: 2, titles: 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
footer: {
|
||||
message: '基于 WeKnora v0.7.1 源码整理 · Apache-2.0 License',
|
||||
copyright: '© Tencent WeKnora',
|
||||
},
|
||||
},
|
||||
|
||||
mermaid: {
|
||||
theme: 'base',
|
||||
fontFamily:
|
||||
'"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, sans-serif',
|
||||
themeVariables: {
|
||||
primaryColor: '#eef1f6',
|
||||
primaryTextColor: '#101f38',
|
||||
primaryBorderColor: '#9aa8bd',
|
||||
lineColor: '#7d8ba1',
|
||||
secondaryColor: '#faf7ef',
|
||||
tertiaryColor: '#f6f7f9',
|
||||
fontSize: '14px',
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,232 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { nextTick, onMounted, onUnmounted, ref } from 'vue'
|
||||
|
||||
const MIN = 0.3
|
||||
const MAX = 8
|
||||
|
||||
const open = ref(false)
|
||||
const scale = ref(1)
|
||||
const tx = ref(0)
|
||||
const ty = ref(0)
|
||||
const stage = ref<HTMLElement>()
|
||||
|
||||
let dragging = false
|
||||
let originX = 0
|
||||
let originY = 0
|
||||
|
||||
function reset() {
|
||||
scale.value = 1
|
||||
tx.value = 0
|
||||
ty.value = 0
|
||||
}
|
||||
|
||||
function close() {
|
||||
open.value = false
|
||||
document.documentElement.style.removeProperty('overflow')
|
||||
}
|
||||
|
||||
async function show(source: SVGElement) {
|
||||
reset()
|
||||
open.value = true
|
||||
document.documentElement.style.overflow = 'hidden'
|
||||
await nextTick()
|
||||
const host = stage.value
|
||||
if (!host) return
|
||||
host.replaceChildren()
|
||||
|
||||
// mermaid 的 svg 内联样式以 #id 作用域,且插件会对同 id 元素重新渲染,
|
||||
// 因此副本必须换一个 id 并同步改写内部样式表
|
||||
const clone = source.cloneNode(true) as SVGElement
|
||||
const oldId = source.id
|
||||
if (oldId) {
|
||||
const newId = `${oldId}-zoom`
|
||||
clone.id = newId
|
||||
clone.querySelectorAll('style').forEach((s) => {
|
||||
s.textContent = (s.textContent ?? '').split(`#${oldId}`).join(`#${newId}`)
|
||||
})
|
||||
}
|
||||
clone.removeAttribute('width')
|
||||
clone.removeAttribute('height')
|
||||
clone.style.maxWidth = 'none'
|
||||
clone.style.width = '100%'
|
||||
clone.style.height = '100%'
|
||||
host.appendChild(clone)
|
||||
}
|
||||
|
||||
function onDocClick(e: MouseEvent) {
|
||||
const block = (e.target as HTMLElement | null)?.closest?.('.vp-doc .mermaid')
|
||||
if (!block) return
|
||||
const svg = block.querySelector('svg')
|
||||
if (svg) show(svg as SVGElement)
|
||||
}
|
||||
|
||||
function onKey(e: KeyboardEvent) {
|
||||
if (!open.value) return
|
||||
if (e.key === 'Escape') close()
|
||||
if (e.key === '0') reset()
|
||||
}
|
||||
|
||||
function zoomBy(factor: number) {
|
||||
scale.value = Math.min(MAX, Math.max(MIN, scale.value * factor))
|
||||
}
|
||||
|
||||
function onWheel(e: WheelEvent) {
|
||||
e.preventDefault()
|
||||
zoomBy(e.deltaY < 0 ? 1.12 : 1 / 1.12)
|
||||
}
|
||||
|
||||
function onDown(e: MouseEvent) {
|
||||
dragging = true
|
||||
originX = e.clientX - tx.value
|
||||
originY = e.clientY - ty.value
|
||||
}
|
||||
|
||||
function onMove(e: MouseEvent) {
|
||||
if (!dragging) return
|
||||
tx.value = e.clientX - originX
|
||||
ty.value = e.clientY - originY
|
||||
}
|
||||
|
||||
function onUp() {
|
||||
dragging = false
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
document.addEventListener('click', onDocClick)
|
||||
document.addEventListener('keydown', onKey)
|
||||
window.addEventListener('mousemove', onMove)
|
||||
window.addEventListener('mouseup', onUp)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', onDocClick)
|
||||
document.removeEventListener('keydown', onKey)
|
||||
window.removeEventListener('mousemove', onMove)
|
||||
window.removeEventListener('mouseup', onUp)
|
||||
document.documentElement.style.removeProperty('overflow')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="zoom-fade">
|
||||
<div v-if="open" class="zoom" @wheel="onWheel" @mousedown.self="close">
|
||||
<div
|
||||
ref="stage"
|
||||
class="zoom-stage"
|
||||
:style="{ transform: `translate(${tx}px, ${ty}px) scale(${scale})` }"
|
||||
@mousedown.stop="onDown"
|
||||
/>
|
||||
|
||||
<div class="zoom-bar" @mousedown.stop>
|
||||
<button title="缩小" @click="zoomBy(1 / 1.35)">−</button>
|
||||
<span class="zoom-level">{{ Math.round(scale * 100) }}%</span>
|
||||
<button title="放大" @click="zoomBy(1.35)">+</button>
|
||||
<span class="zoom-sep" />
|
||||
<button class="zoom-word" @click="reset">重置</button>
|
||||
<button class="zoom-word" @click="close">关闭</button>
|
||||
</div>
|
||||
|
||||
<p class="zoom-hint">滚轮缩放 · 拖拽平移 · Esc 关闭</p>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.zoom {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--wk-paper);
|
||||
cursor: zoom-out;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.zoom-stage {
|
||||
width: min(1400px, 88vw);
|
||||
height: 82vh;
|
||||
cursor: grab;
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
.zoom-stage:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.zoom-bar {
|
||||
position: fixed;
|
||||
bottom: 28px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 8px;
|
||||
border: 1px solid var(--wk-rule);
|
||||
border-radius: 3px;
|
||||
background: var(--wk-paper);
|
||||
box-shadow: 0 6px 22px rgba(16, 31, 56, 0.08);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.zoom-bar button {
|
||||
min-width: 30px;
|
||||
height: 28px;
|
||||
padding: 0 8px;
|
||||
border-radius: 2px;
|
||||
font-size: 15px;
|
||||
line-height: 1;
|
||||
color: var(--wk-ink-soft);
|
||||
transition: background-color 0.18s ease, color 0.18s ease;
|
||||
}
|
||||
|
||||
.zoom-bar button:hover {
|
||||
background: var(--wk-paper-2);
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.zoom-word {
|
||||
font-size: 12.5px !important;
|
||||
}
|
||||
|
||||
.zoom-level {
|
||||
min-width: 46px;
|
||||
text-align: center;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.zoom-sep {
|
||||
width: 1px;
|
||||
height: 16px;
|
||||
margin: 0 4px;
|
||||
background: var(--wk-rule);
|
||||
}
|
||||
|
||||
.zoom-hint {
|
||||
position: fixed;
|
||||
top: 26px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
margin: 0;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.zoom-fade-enter-active,
|
||||
.zoom-fade-leave-active {
|
||||
transition: opacity 0.18s ease;
|
||||
}
|
||||
|
||||
.zoom-fade-enter-from,
|
||||
.zoom-fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import { h } from 'vue'
|
||||
import type { Theme } from 'vitepress'
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import Landing from './Landing.vue'
|
||||
import MermaidZoom from './MermaidZoom.vue'
|
||||
import './style.css'
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
Layout: () => h(DefaultTheme.Layout, null, { 'layout-bottom': () => h(MermaidZoom) }),
|
||||
enhanceApp({ app }) {
|
||||
app.component('Landing', Landing)
|
||||
},
|
||||
} satisfies Theme
|
||||
|
|
@ -1,678 +0,0 @@
|
|||
/* ==========================================================================
|
||||
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);
|
||||
--vp-font-family-mono: var(--wk-font-mono);
|
||||
|
||||
--vp-c-brand-1: var(--wk-ink);
|
||||
--vp-c-brand-2: #24395a;
|
||||
--vp-c-brand-3: var(--wk-gold);
|
||||
--vp-c-brand-soft: rgba(184, 134, 59, 0.14);
|
||||
|
||||
--vp-c-bg: var(--wk-paper);
|
||||
--vp-c-bg-alt: var(--wk-paper-2);
|
||||
--vp-c-bg-soft: var(--wk-paper-2);
|
||||
--vp-c-bg-elv: #ffffff;
|
||||
|
||||
--vp-c-text-1: var(--wk-ink);
|
||||
--vp-c-text-2: var(--wk-ink-soft);
|
||||
--vp-c-text-3: var(--wk-ink-mute);
|
||||
|
||||
--vp-c-divider: var(--wk-rule);
|
||||
--vp-c-gutter: var(--wk-rule);
|
||||
--vp-c-border: var(--wk-rule);
|
||||
|
||||
--vp-layout-max-width: 1680px;
|
||||
--vp-nav-height: 68px;
|
||||
--vp-sidebar-width: 288px;
|
||||
--vp-code-block-bg: #fbf9f5;
|
||||
|
||||
--vp-home-hero-name-color: var(--wk-ink);
|
||||
--vp-code-copy-copied-text-content: "已复制";
|
||||
}
|
||||
|
||||
.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;
|
||||
--vp-c-brand-3: var(--wk-gold);
|
||||
--vp-c-bg-elv: #101a2b;
|
||||
--vp-code-block-bg: #0d1626;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
font-feature-settings: "kern" 1, "liga" 1, "cv05" 1;
|
||||
}
|
||||
|
||||
::selection {
|
||||
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;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
侧边栏
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
/* 默认公式在视口窄于 layout-max-width 时会把侧栏压窄,这里给它一个下限 */
|
||||
@media (min-width: 1440px) {
|
||||
.VPSidebar {
|
||||
width: calc(
|
||||
max(0px, (100vw - (var(--vp-layout-max-width) - 64px)) / 2) + var(--vp-sidebar-width) - 32px
|
||||
) !important;
|
||||
}
|
||||
}
|
||||
|
||||
.VPSidebar {
|
||||
padding-top: 18px !important;
|
||||
background: transparent !important;
|
||||
border-right: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0 > .item > .text {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px !important;
|
||||
font-weight: 500 !important;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute) !important;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0 {
|
||||
padding-bottom: 22px;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-0:not(:first-child) {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1 .link .text {
|
||||
font-size: 13.5px;
|
||||
line-height: 1.6;
|
||||
color: var(--wk-ink-soft);
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1 .link:hover .text {
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active .link .text {
|
||||
color: var(--wk-ink) !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active > .item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.VPSidebarItem.level-1.is-active > .item::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: -14px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
border-radius: 50%;
|
||||
background: var(--wk-gold);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
正文排版
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
.VPDoc {
|
||||
padding-top: 44px !important;
|
||||
}
|
||||
|
||||
/* 默认主题用 scoped 选择器把正文锁死在 688px,覆盖它需要 !important */
|
||||
@media (min-width: 1280px) {
|
||||
.VPDoc .content-container {
|
||||
max-width: 780px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1600px) {
|
||||
.VPDoc .content-container {
|
||||
max-width: 880px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.vp-doc {
|
||||
font-size: 15.5px;
|
||||
line-height: 1.82;
|
||||
color: var(--wk-ink-soft);
|
||||
}
|
||||
|
||||
.vp-doc h1,
|
||||
.vp-doc h2,
|
||||
.vp-doc h3,
|
||||
.vp-doc h4 {
|
||||
color: var(--wk-ink);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.vp-doc h1 {
|
||||
font-family: var(--wk-font-serif);
|
||||
font-size: 42px;
|
||||
line-height: 1.22;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.02em;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.vp-doc h2 {
|
||||
font-family: var(--wk-font-serif);
|
||||
font-size: 27px;
|
||||
font-weight: 500;
|
||||
line-height: 1.35;
|
||||
margin-top: 66px;
|
||||
padding-top: 26px;
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.vp-doc h3 {
|
||||
font-size: 18.5px;
|
||||
font-weight: 650;
|
||||
margin-top: 42px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.vp-doc h4 {
|
||||
font-size: 15.5px;
|
||||
font-weight: 650;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.vp-doc h2 .header-anchor,
|
||||
.vp-doc h3 .header-anchor {
|
||||
color: var(--wk-gold);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.vp-doc p,
|
||||
.vp-doc li {
|
||||
color: var(--wk-ink-soft);
|
||||
}
|
||||
|
||||
.vp-doc strong {
|
||||
color: var(--wk-ink);
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.vp-doc a {
|
||||
color: var(--wk-ink);
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--wk-gold) 55%, transparent);
|
||||
padding-bottom: 1px;
|
||||
transition: border-color 0.2s ease, background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc a:hover {
|
||||
border-bottom-color: var(--wk-gold);
|
||||
background: rgba(184, 134, 59, 0.08);
|
||||
}
|
||||
|
||||
.vp-doc ul,
|
||||
.vp-doc ol {
|
||||
padding-left: 1.3em;
|
||||
}
|
||||
|
||||
.vp-doc li + li {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.vp-doc li::marker {
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.vp-doc blockquote {
|
||||
border-left: 2px solid var(--wk-gold);
|
||||
background: transparent;
|
||||
padding: 2px 0 2px 20px;
|
||||
margin: 26px 0;
|
||||
}
|
||||
|
||||
.vp-doc blockquote > p {
|
||||
font-size: 14.5px;
|
||||
color: var(--wk-ink-mute);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.vp-doc hr {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
margin: 52px 0;
|
||||
}
|
||||
|
||||
/* 代码 */
|
||||
|
||||
.vp-doc :not(pre) > code {
|
||||
font-size: 0.86em;
|
||||
font-family: var(--wk-font-mono);
|
||||
background: var(--wk-paper-2);
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 3px;
|
||||
padding: 2px 5px;
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.vp-doc div[class*="language-"] {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
background: var(--vp-code-block-bg);
|
||||
margin: 26px 0;
|
||||
}
|
||||
|
||||
.vp-doc div[class*="language-"] pre {
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] code {
|
||||
font-size: 13px;
|
||||
line-height: 1.72;
|
||||
}
|
||||
|
||||
/* 复制按钮:默认隐形,悬停时才出现的细线方钮 */
|
||||
.vp-doc [class*="language-"] > button.copy {
|
||||
top: 9px;
|
||||
right: 9px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 2px;
|
||||
background-color: transparent;
|
||||
background-size: 14px;
|
||||
background-position: 50%;
|
||||
opacity: 0;
|
||||
transform: translateY(-2px);
|
||||
transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease,
|
||||
background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"]:hover > button.copy,
|
||||
.vp-doc [class*="language-"] > button.copy:focus-visible {
|
||||
opacity: 1;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy:hover {
|
||||
border-color: var(--wk-gold);
|
||||
background-color: var(--wk-paper);
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy.copied,
|
||||
.vp-doc [class*="language-"] > button.copy:hover.copied {
|
||||
border-color: var(--wk-gold);
|
||||
background-color: var(--wk-paper);
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > button.copy.copied::before,
|
||||
.vp-doc [class*="language-"] > button.copy:hover.copied::before {
|
||||
top: -1px;
|
||||
height: 28px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 2px;
|
||||
background-color: var(--wk-paper);
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--wk-ink-mute);
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.vp-doc [class*="language-"] > span.lang {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
/* 表格 */
|
||||
|
||||
/* 宽表格在自身内部横向滚动,避免撑破正文列 */
|
||||
.vp-doc table {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
margin: 28px 0;
|
||||
font-size: 13.5px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.vp-doc table::-webkit-scrollbar {
|
||||
height: 6px;
|
||||
}
|
||||
|
||||
.vp-doc table::-webkit-scrollbar-thumb {
|
||||
background: var(--wk-rule);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.vp-doc th {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-weight: 500;
|
||||
color: var(--wk-ink-mute);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--wk-rule);
|
||||
padding: 10px 14px 10px 0;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.vp-doc td {
|
||||
border: none;
|
||||
border-bottom: 1px solid var(--wk-rule-soft);
|
||||
padding: 12px 14px 12px 0;
|
||||
vertical-align: top;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.vp-doc tr {
|
||||
background: transparent !important;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.vp-doc th:last-child,
|
||||
.vp-doc td:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
/* 自定义容器 */
|
||||
|
||||
.vp-doc .custom-block {
|
||||
border-radius: 3px;
|
||||
border: 1px solid var(--wk-rule);
|
||||
border-left-width: 2px;
|
||||
background: var(--wk-paper-2);
|
||||
font-size: 14px;
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
.vp-doc .custom-block.tip {
|
||||
border-left-color: var(--wk-gold);
|
||||
}
|
||||
|
||||
.vp-doc .custom-block-title {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Mermaid 图 */
|
||||
|
||||
.vp-doc .mermaid {
|
||||
position: relative;
|
||||
margin: 34px 0;
|
||||
padding: 28px 20px;
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 4px;
|
||||
background: var(--wk-paper-2);
|
||||
text-align: center;
|
||||
overflow-x: auto;
|
||||
cursor: zoom-in;
|
||||
transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc .mermaid:hover {
|
||||
border-color: var(--wk-rule);
|
||||
}
|
||||
|
||||
.vp-doc .mermaid::after {
|
||||
content: "点击放大";
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 10px;
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.14em;
|
||||
color: var(--wk-ink-mute);
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.vp-doc .mermaid:hover::after {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 页脚区 */
|
||||
|
||||
.VPDocFooter {
|
||||
margin-top: 72px;
|
||||
padding-top: 26px;
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
}
|
||||
|
||||
.VPDocFooter .prev-link .desc,
|
||||
.VPDocFooter .next-link .desc {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link {
|
||||
border: 1px solid var(--wk-rule-soft);
|
||||
border-radius: 3px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link:hover {
|
||||
border-color: var(--wk-gold);
|
||||
}
|
||||
|
||||
.VPDocFooter .pager-link .title {
|
||||
font-weight: 550;
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPDocAsideOutline .outline-title,
|
||||
.VPDocOutlineItem .outline-title {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 10.5px !important;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link {
|
||||
font-size: 12.8px;
|
||||
line-height: 1.65;
|
||||
padding: 6px 0;
|
||||
color: var(--wk-ink-mute);
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link.nested {
|
||||
padding-inline-start: 16px;
|
||||
}
|
||||
|
||||
.VPDocAside .VPDocAsideOutline .root {
|
||||
padding-inline-start: 2px;
|
||||
}
|
||||
|
||||
.VPDocAside .outline-link.active {
|
||||
color: var(--wk-ink);
|
||||
}
|
||||
|
||||
.VPDocAsideOutline .outline-marker {
|
||||
background-color: var(--wk-gold) !important;
|
||||
}
|
||||
|
||||
.VPFooter {
|
||||
border-top: 1px solid var(--wk-rule-soft);
|
||||
background: transparent !important;
|
||||
padding: 34px 24px;
|
||||
}
|
||||
|
||||
.VPFooter .message,
|
||||
.VPFooter .copyright {
|
||||
font-size: 12.5px;
|
||||
color: var(--wk-ink-mute);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.VPLastUpdated {
|
||||
font-family: var(--wk-font-mono);
|
||||
font-size: 11px !important;
|
||||
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;
|
||||
}
|
||||
.vp-doc h2 {
|
||||
font-size: 23px;
|
||||
margin-top: 52px;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,19 +4,6 @@ WeKnora(维娜拉)是腾讯开源的企业级知识库与 RAG(Retrieval-Au
|
|||
|
||||
本目录是 WeKnora 的完整官方文档,全部内容基于源码整理,按「入门 → 架构 → 功能 → API → 客户端 → 开发」六个部分组织。
|
||||
|
||||
## 文档站点
|
||||
|
||||
本目录同时是一个 VitePress 站点,Markdown 即页面,新增文件会自动进入侧边栏(标题取正文一级标题,目录顺序按文件名数字前缀)。
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev # 本地预览
|
||||
npm run build # 产物输出到 .vitepress/dist
|
||||
npm run preview # 预览构建产物
|
||||
```
|
||||
|
||||
主题位于 `.vitepress/theme/`:`style.css` 是排版与配色的单一来源,`Landing.vue` 是首页。
|
||||
|
||||
## 阅读路径建议
|
||||
|
||||
- **初次使用**:01 快速开始 四篇按顺序读完即可完成部署与首次问答。
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
layout: page
|
||||
title: 文档理解 · 知识索引 · 混合检索 · 智能体推理
|
||||
titleTemplate: WeKnora 文档
|
||||
pageClass: landing-page
|
||||
sidebar: false
|
||||
aside: false
|
||||
footer: false
|
||||
---
|
||||
|
||||
<Landing />
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"name": "weknora-docs-site",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vitepress dev",
|
||||
"build": "vitepress build",
|
||||
"preview": "vitepress preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mermaid": "^11.16.0",
|
||||
"playwright-core": "^1.62.0",
|
||||
"vitepress": "^1.6.4",
|
||||
"vitepress-plugin-mermaid": "^2.0.17",
|
||||
"vue": "^3.5.13"
|
||||
}
|
||||
}
|
||||
|
|
@ -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 |
|
|
@ -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 |
|
|
@ -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 |
|
|
@ -1,49 +0,0 @@
|
|||
import { chromium } from 'playwright-core'
|
||||
const b = await chromium.launch({ executablePath: process.env.HOME + '/Library/Caches/ms-playwright/chromium-1161/chrome-mac/Chromium.app/Contents/MacOS/Chromium' })
|
||||
const q = await b.newPage()
|
||||
|
||||
const geom = (page) => page.evaluate(() => {
|
||||
const g = (s) => { const e = document.querySelector(s); if (!e) return null; const r = e.getBoundingClientRect(); return [Math.round(r.left), Math.round(r.right)] }
|
||||
return { logo: g('.VPNavBarTitle'), search: g('.VPNavBarSearch button, .VPNavBarSearch .DocSearch-Button'), menu: g('.VPNavBarMenu'), sidebarItem: g('.VPSidebarItem .link .text') }
|
||||
})
|
||||
|
||||
const scanLine = async (page, label) => {
|
||||
const buf = await page.screenshot({ clip: { x: 0, y: 58, width: 1680, height: 20 } })
|
||||
const url = 'data:image/png;base64,' + buf.toString('base64')
|
||||
const hits = await q.evaluate(async (u) => {
|
||||
const img = new Image(); img.src = u; await img.decode()
|
||||
const c = document.createElement('canvas'); c.width = img.width; c.height = img.height
|
||||
const ctx = c.getContext('2d'); ctx.drawImage(img, 0, 0)
|
||||
const res = []
|
||||
for (const x of [60, 200, 400, 800, 1200, 1560, 1660]) {
|
||||
for (let y = 0; y < img.height; y++) {
|
||||
const d = ctx.getImageData(x, y, 1, 1).data
|
||||
if (d[0] < 248) res.push(`x${x} y${y + 58} ${d[0]},${d[1]},${d[2]}`)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}, url)
|
||||
console.log(' line@' + label, hits.length ? hits.join(' | ') : 'none')
|
||||
}
|
||||
|
||||
for (const w of [1440, 1680, 1920]) {
|
||||
for (const [name, path] of [['landing', '/'], ['doc ', '/03-features/07-agent']]) {
|
||||
const p = await b.newPage({ viewport: { width: w, height: 900 }, deviceScaleFactor: 1 })
|
||||
await p.goto('http://localhost:3011' + path, { waitUntil: 'networkidle' })
|
||||
await p.waitForTimeout(800)
|
||||
console.log(w, name, JSON.stringify(await geom(p)))
|
||||
await p.evaluate(() => window.scrollTo({ top: 1200, behavior: 'instant' }))
|
||||
await p.waitForTimeout(600)
|
||||
if (w === 1680) await scanLine(p, name.trim())
|
||||
await p.close()
|
||||
}
|
||||
}
|
||||
const s = await b.newPage({ viewport: { width: 1680, height: 900 }, deviceScaleFactor: 2 })
|
||||
for (const [name, path] of [['landing', '/'], ['doc', '/03-features/07-agent']]) {
|
||||
await s.goto('http://localhost:3011' + path, { waitUntil: 'networkidle' })
|
||||
await s.waitForTimeout(800)
|
||||
await s.evaluate(() => window.scrollTo({ top: 900, behavior: 'instant' }))
|
||||
await s.waitForTimeout(600)
|
||||
await s.screenshot({ path: `.shots/nav-${name}.png`, clip: { x: 0, y: 0, width: 1680, height: 120 } })
|
||||
}
|
||||
await b.close()
|
||||
Loading…
Reference in New Issue