mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
- 新增迁移 20260413030000:标记 billing_status、finalized_at、request_headers 等列为 DEPRECATED - 更新 baseline_v2.sql 同步废弃注释,BASELINE_V2_CUTOFF_VERSION 升至 20260413030000 - usage/sql.rs:inline body 阈值归零,强制所有 body 走 blob 存储;upsert 时清空 legacy header/output_price 列 - 查询层优先读 usage_settlement_snapshots 的 billing_status、finalized_at、output_price_per_1m - runtime.rs:stale usage 处理同步写入 usage_settlement_snapshots;SELECT FOR UPDATE 改为 FOR UPDATE OF usage - 前端:PerformanceAnalysis 页面重构为实时面板,新增 prometheus 工具函数与 monitoring API
88 lines
2.3 KiB
TypeScript
88 lines
2.3 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
import { execSync } from 'child_process'
|
|
|
|
function getGitVersion(): string {
|
|
try {
|
|
return execSync('git describe --tags --always').toString().trim()
|
|
} catch {
|
|
return '0.0.0.dev0'
|
|
}
|
|
}
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const rootEnv = loadEnv(mode, path.resolve(__dirname, '..'), '')
|
|
const appPort = rootEnv.APP_PORT || process.env.APP_PORT || '8084'
|
|
const gatewayTarget = `http://127.0.0.1:${appPort}`
|
|
|
|
return {
|
|
// GitHub Pages 部署时使用仓库名作为 base
|
|
base: process.env.GITHUB_PAGES === 'true' ? '/Aether/' : '/',
|
|
plugins: [vue()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(getGitVersion()),
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
build: {
|
|
// 使用 esbuild 进行压缩(默认)
|
|
minify: 'esbuild',
|
|
rollupOptions: {
|
|
output: {
|
|
// 手动分块以优化加载性能
|
|
manualChunks: {
|
|
// Vue 核心库
|
|
'vue-vendor': ['vue', 'vue-router', 'pinia'],
|
|
// UI 组件库
|
|
'ui-vendor': ['radix-vue', 'lucide-vue-next'],
|
|
// 工具库
|
|
'utils-vendor': ['axios', 'marked', 'dompurify'],
|
|
// 图表库
|
|
'chart-vendor': ['chart.js', 'vue-chartjs'],
|
|
},
|
|
},
|
|
},
|
|
// esbuild 配置用于移除 console
|
|
target: 'es2015',
|
|
},
|
|
esbuild: {
|
|
// 生产环境移除 console 和 debugger
|
|
drop: mode === 'production' ? ['console', 'debugger'] : [],
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
// 只代理真正的 API 路径;目标端口由根目录 APP_PORT 控制
|
|
'/api/': {
|
|
target: gatewayTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/v1/': {
|
|
target: gatewayTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/health': {
|
|
target: gatewayTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/_gateway/': {
|
|
target: gatewayTarget,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
preview: {
|
|
port: 5173,
|
|
},
|
|
}
|
|
})
|