Files
ProxyPool/WebUI/vite.config.js
祀梦 7bc6d4e4de feat: JSON 配置、质量分与仪表盘,及设置与爬取流程
- 后端改为 config/app.json;pytest 使用 config/app.test.json 与 set_config_file,不再依赖环境变量;移除 pydantic-settings。

- 前端 API/WebSocket 由 config/webui.json 经 Vite define 注入。

- 代理分数按延迟与随机取用次数计算,新增 use_count 与 proxy_scoring;保存设置时同步调度器启停。

- 仪表盘双饼图(可用/待验证协议);设置页去掉调度器启停按钮并移动立即验证;爬取全部结束后自动提交全量验证。

- 删除 script/settings_maintain.py(此前已标记删除)。

Made-with: Cursor
2026-04-05 16:08:32 +08:00

53 lines
1.5 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 { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const webuiConfigPath = path.resolve(__dirname, '../config/webui.json')
let webui = { api_base_url: 'http://127.0.0.1:18080', ws_url: '' }
try {
webui = { ...webui, ...JSON.parse(fs.readFileSync(webuiConfigPath, 'utf-8')) }
} catch {
console.warn('[vite] 未读取 config/webui.json使用默认 API 地址')
}
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
define: {
__WEBUI_API_BASE_URL__: JSON.stringify(String(webui.api_base_url || '').trim() || 'http://127.0.0.1:18080'),
__WEBUI_WS_URL__: JSON.stringify(webui.ws_url != null ? String(webui.ws_url) : ''),
},
server: {
port: 18081,
// 支持 Vue Router 的 history 模式
historyApiFallback: true,
host: '127.0.0.1'
},
preview: {
port: 18081,
historyApiFallback: true,
host: '127.0.0.1'
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules/echarts')) {
return 'echarts'
}
if (id.includes('node_modules/element-plus')) {
return 'element-plus'
}
if (id.includes('node_modules/vue') || id.includes('node_modules/vue-router') || id.includes('node_modules/pinia')) {
return 'vue-vendor'
}
}
}
},
chunkSizeWarningLimit: 600
}
})