Files
xiaowang 27182fc7d2 feat: 交付任务005-021全量改动(自动化/AI/联系人中心、消息中心改造、运维与容器化)
- 自动化中心:规则引擎、流程画布与触发器(V7/V10/V12/V18/V21)、测试全流程、安全边界、执行记录
- AI 中心:服务商/模型/调用与工具授权/治理(V8/V17)及配套前端页面
- 联系人中心:联系人目录、分组/标签、同步幂等(V19)与实装页面
- 消息中心:三栏布局重做、头像昵称服务端抓取与缓存(V16 conversation_profile)、出站归属修复
- 接入管理:NapCat 反向 WS/HTTP 回调多通道发送传输、连接状态统一口径
- 运维中心:备份保留与恢复确认(V13/V22/V24)、监控告警(V23)、日志与审计
- 全局:账号上下文切换(V20 account_profile)、统一 UI 基础组件、分页样式、Flyway 增量迁移护栏
- 部署:Dockerfile/docker-compose/Nginx 容器化编排与 CI 校验脚本
- 文档:任务 005-021 交付记录、设计画板导出、接口/数据库/架构文档同步
2026-11-17 17:29:06 +08:00

73 lines
2.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import fs from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// 浏览器会以 CORS 为由拒绝从 file:// 加载外部 module 脚本,
// 因此构建结束后把唯一的 JS/CSS 内联进 index.html,让 dist/index.html 可以直接双击预览。
// 这不会改变接口路径或运行逻辑;通过后端静态托管时同样可用。
function inlineDistPlugin() {
let outDir = ''
return {
name: 'qlinker-inline-dist',
apply: 'build',
configResolved(config) {
outDir = path.resolve(config.root, config.build.outDir)
},
closeBundle() {
const htmlPath = path.join(outDir, 'index.html')
if (!fs.existsSync(htmlPath)) return
let html = fs.readFileSync(htmlPath, 'utf8')
html = html.replace(/<script[^>]*src="\.\/([^"]+\.js)"[^>]*><\/script>/g, (match, src) => {
const js = fs
.readFileSync(path.join(outDir, src), 'utf8')
.replace(/<\/script/gi, '<\\/script')
return `<script type="module">\n${js}\n</script>`
})
html = html.replace(/<link[^>]*rel="stylesheet"[^>]*href="\.\/([^"]+\.css)"[^>]*>/g, (match, href) => {
const css = fs.readFileSync(path.join(outDir, href), 'utf8').replace(/<\/style/gi, '<\\/style')
return `<style>\n${css}\n</style>`
})
fs.writeFileSync(htmlPath, html, 'utf8')
console.log('[qlinker] JS/CSS 已内联到 dist/index.html,可直接双击打开做静态预览')
}
}
}
// 开发期通过代理访问后端,避免在生产配置里写死后端地址。
export default defineConfig({
// Element Plus 按需引入:模板里出现的 el-* 组件与 ElMessage / ElMessageBox 等 API
// 都由这两个插件在编译期按需注入组件代码与对应样式,不做全量引入。
plugins: [
vue(),
AutoImport({ resolvers: [ElementPlusResolver()], dts: false }),
// dirs 置空:src/components 下的自绘组件均由页面显式 import,避免与按需组件重名。
Components({ resolvers: [ElementPlusResolver()], dirs: [] }),
inlineDistPlugin()
],
// 相对 base:dist 资源使用 ./assets 前缀,可直接双击 dist/index.html 预览。
base: './',
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true
}
}
},
// 预览构建产物时同样把 /api 转发到本地后端,便于在 4173 上做真实联调。
preview: {
port: 4173,
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true
}
}
}
})