WeKnora deployment source with the reviewed wiki identity, summary and recovery fixes
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-weknora) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-weknora) / End-to-end inside dsh (latest, advisory) (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Build & Publish (dsh-weknora) / Publish to npm (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { resolve, dirname } from 'node:path'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { execSync } from 'node:child_process'
|
||||
import { createRequire } from 'node:module'
|
||||
import { defineConfig, type Plugin } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import { loginRoutePreload } from './build/loginRoutePreload'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
const pkg = require('./package.json') as { version?: string }
|
||||
const FRONTEND_VERSION = pkg.version ?? 'unknown'
|
||||
|
||||
function resolveFrontendCommit(): string {
|
||||
const fromEnv = process.env.VITE_FRONTEND_COMMIT || process.env.GITHUB_SHA
|
||||
if (fromEnv) {
|
||||
return fromEnv.slice(0, 7)
|
||||
}
|
||||
try {
|
||||
return execSync('git rev-parse --short HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
|
||||
.toString()
|
||||
.trim()
|
||||
} catch {
|
||||
return 'unknown'
|
||||
}
|
||||
}
|
||||
|
||||
const FRONTEND_COMMIT = resolveFrontendCommit()
|
||||
|
||||
/** Dev parity with nginx: serve embed.html for /embed/:channelId (not the main SPA). */
|
||||
function embedHtmlDevFallback(): Plugin {
|
||||
return {
|
||||
name: 'embed-html-dev-fallback',
|
||||
configureServer(server) {
|
||||
server.middlewares.use((req, _res, next) => {
|
||||
const raw = req.url ?? ''
|
||||
const qIdx = raw.indexOf('?')
|
||||
const path = qIdx >= 0 ? raw.slice(0, qIdx) : raw
|
||||
const qs = qIdx >= 0 ? raw.slice(qIdx) : ''
|
||||
if (path.startsWith('/embed/') && path !== '/embed.html' && !path.includes('.')) {
|
||||
req.url = `/embed.html${qs}`
|
||||
}
|
||||
next()
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
const DEV_PROXY_TARGET =
|
||||
process.env.VITE_DEV_PROXY_TARGET ||
|
||||
process.env.FRONTEND_BACKEND_URL ||
|
||||
'http://localhost:8080'
|
||||
|
||||
function resolveVueOfficePptxEntry(): string {
|
||||
try {
|
||||
const pkgDir = dirname(require.resolve('@vue-office/pptx/package.json'))
|
||||
const candidates = [
|
||||
resolve(pkgDir, 'lib/v3/index.js'),
|
||||
resolve(pkgDir, 'lib/index.js'),
|
||||
resolve(pkgDir, 'lib/v3/vue-office-pptx.mjs'),
|
||||
]
|
||||
const matched = candidates.find((candidate) => existsSync(candidate))
|
||||
return matched ?? '@vue-office/pptx'
|
||||
} catch {
|
||||
return '@vue-office/pptx'
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__FRONTEND_VERSION__: JSON.stringify(FRONTEND_VERSION),
|
||||
__FRONTEND_COMMIT__: JSON.stringify(FRONTEND_COMMIT),
|
||||
},
|
||||
build: {
|
||||
modulePreload: {
|
||||
resolveDependencies(_filename, deps, { hostId }) {
|
||||
// Embed iframe bootstraps with token exchange only; defer heavy chat chunks.
|
||||
if (hostId?.includes('embed')) {
|
||||
return deps.filter((dep) => !(
|
||||
dep.includes('vendor-mermaid')
|
||||
|| dep.includes('vendor-highlight')
|
||||
|| dep.includes('vendor-markdown')
|
||||
|| dep.includes('vendor-tdesign')
|
||||
|| dep.includes('botmsg')
|
||||
|| dep.includes('usermsg')
|
||||
|| dep.includes('EmbedBotMessage')
|
||||
|| dep.includes('EmbedUserMessage')
|
||||
|| dep.includes('AgentStreamDisplay')
|
||||
|| dep.includes('EmbedChatCore')
|
||||
|| dep.includes('vendor-markdown')
|
||||
|| dep.includes('fonts-')
|
||||
))
|
||||
}
|
||||
return deps
|
||||
},
|
||||
},
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'index.html'),
|
||||
embed: resolve(__dirname, 'embed.html'),
|
||||
},
|
||||
output: {
|
||||
// Shared dependencies must not pull lazy renderers into the entry graph.
|
||||
onlyExplicitManualChunks: true,
|
||||
manualChunks(id) {
|
||||
if (!id.includes('node_modules')) return
|
||||
if (id.includes('mermaid') || id.includes('/dagre') || id.includes('cytoscape')) {
|
||||
return 'vendor-mermaid'
|
||||
}
|
||||
if (id.includes('marked') || id.includes('katex')) {
|
||||
return 'vendor-markdown'
|
||||
}
|
||||
if (id.includes('highlight.js')) {
|
||||
return 'vendor-highlight'
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
embedHtmlDevFallback(),
|
||||
loginRoutePreload(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
'@vue-office/pptx': resolveVueOfficePptxEntry(),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
host: true,
|
||||
// 代理配置,用于开发环境
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: DEV_PROXY_TARGET,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
'/files': {
|
||||
target: DEV_PROXY_TARGET,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
// `vite preview` 用生产构建产物(dist)本地起服务,是最接近 release 镜像的环境:
|
||||
// 同样的压缩 / 拆包 / CSS 加载顺序,可提前暴露只在生产构建出现的问题
|
||||
// (如主题变量被打包顺序覆盖)。用法:npm run build && npm run preview
|
||||
preview: {
|
||||
port: 4173,
|
||||
host: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: DEV_PROXY_TARGET,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
'/files': {
|
||||
target: DEV_PROXY_TARGET,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user