refactor(workflows): 统一替换 yingdao 目录引用为 workflows

1.  将所有文档、代码中对 `yingdao/` 目录的引用替换为 `workflows/`,统一影刀版代码的命名空间
2.  调整 workflows/share 模块内的路径引用与文档注释,确保一致性
3.  同步更新测试代码与配置文件中的旧目录引用
This commit is contained in:
2026-09-08 16:16:35 +08:00
parent be07de0e92
commit 9d067c0646
74 changed files with 5895 additions and 151 deletions
+12
View File
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>37du 业务场景工具集</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
+1382
View File
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
{
"name": "37du-webhost-frontend",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"vite": "^6.0.3"
},
"allowScripts": {
"esbuild@0.25.12": true
}
}
+180
View File
@@ -0,0 +1,180 @@
<template>
<div class="__app">
<!-- 顶部:品牌 + 平台登录态 + 进度 -->
<header class="topbar panel">
<div class="brand">
<span class="logo">37</span>
<div class="brand-meta">
<strong>{{ store.appName }}</strong>
<span>{{ wsText }}</span>
</div>
</div>
<div class="divider"></div>
<div class="band">
<span class="band-label">平台登录态</span>
<button
v-for="p in store.platforms"
:key="p.id"
class="chip"
:class="{ online: p.online }"
:disabled="busyLogin === p.id"
@click="login(p.id)"
:title="p.online ? '已登录,点击刷新' : '未登录,点击登录'"
>
<i class="dot"></i>
<span>{{ busyLogin === p.id ? '登录中…' : p.label }}</span>
</button>
</div>
<div class="spacer"></div>
<div class="run-state">
<span v-if="store.running" class="run-label">{{ store.progress }}%</span>
<div v-show="store.running" class="progress"><div :style="{ width: store.progress + '%' }"></div></div>
</div>
</header>
<!-- 主体:左场景 | 右插件页 + 日志 -->
<div class="body">
<aside class="panel side">
<div class="side-head">
<span class="sec-title">场景</span>
<span class="count">{{ store.plugins.length }}</span>
</div>
<ul class="scene-list">
<li
v-for="(p, i) in store.plugins"
:key="p.id"
:class="{ active: p.id === store.selectedId }"
@click="store.selectedId = p.id"
>
<span class="scene-icon" :style="{ background: PALETTE[i % PALETTE.length] }">
{{ p.name.slice(0, 1) }}
</span>
<span class="scene-name">{{ p.name }}</span>
<em>v{{ p.version }}</em>
</li>
</ul>
<div class="side-foot">场景以插件方式接入</div>
</aside>
<main class="main">
<div class="page-scroll panel">
<PluginPage />
</div>
<LogPanel />
</main>
</div>
</div>
</template>
<script setup>
import { computed, onMounted, ref } from 'vue'
import PluginPage from './components/PluginPage.vue'
import LogPanel from './components/LogPanel.vue'
import { store, handleEvent, clearLogs } from './store'
import { connectWS, fetchMeta, loginPlatform } from './api'
const PALETTE = ['#3b6cff', '#7c5cff', '#12a4d8', '#22b07a', '#e88a3a', '#e5484d']
const wsText = computed(() =>
store.wsOn ? '服务已连接' : '连接中断,正在重连…')
onMounted(async () => {
const meta = await fetchMeta()
store.appName = meta.appName
store.platforms = meta.platforms
store.plugins = meta.plugins
store.selectedId = meta.plugins[0]?.id || ''
clearLogs()
if (window.__ws) window.__ws.close()
const ws = connectWS(handleEvent)
window.__ws = ws
ws.onopen = () => (store.wsOn = true)
ws.onclose = () => { store.wsOn = false; setTimeout(() => (location.reload()), 2500) }
})
const busyLogin = ref('')
async function login(id) {
if (busyLogin.value) return
busyLogin.value = id
try {
const r = await loginPlatform(id)
const p = store.platforms.find((x) => x.id === id)
if (p) p.online = !!r.online
} catch (e) {
alert('登录失败:' + (e.message || e))
} finally {
busyLogin.value = ''
}
}
</script>
<style scoped>
.topbar {
display: flex; align-items: center; gap: 16px;
padding: 12px 18px;
flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
width: 36px; height: 36px; border-radius: 10px;
display: grid; place-items: center;
background: var(--primary-grad); color: #fff;
font-size: 14px; font-weight: 800;
box-shadow: 0 4px 12px -3px rgba(59,108,255,.6);
}
.brand-meta { display: flex; flex-direction: column; line-height: 1.2; }
.brand-meta strong { font-size: 14px; }
.brand-meta span { font-size: 11px; color: var(--text-faint); }
.divider { width: 1px; height: 26px; background: var(--border); }
.band { display: flex; align-items: center; gap: 6px; }
.band-label { font-size: 12px; color: var(--text-faint); margin-right: 4px; }
.chip {
display: inline-flex; align-items: center; gap: 7px;
border: 1px solid var(--border-strong); background: var(--surface);
color: var(--text-sub); padding: 5px 12px; border-radius: 999px;
cursor: pointer; font-size: 12.5px; transition: all .15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: #c6ccdc; }
.chip.online { border-color: transparent; background: var(--ok-weak); color: #1a8f63; }
.chip.online .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,176,122,.18); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip:disabled { opacity: .55; cursor: not-allowed; }
.chip:disabled:hover { border-color: var(--border-strong); color: var(--text-sub); }
.spacer { flex: 1; }
.run-state { display: flex; align-items: center; gap: 10px; }
.run-label { font-size: 12px; color: var(--primary); font-weight: 600; min-width: 38px; text-align: right; }
.body { flex: 1; display: flex; gap: 14px; min-height: 0; margin-top: 14px; }
.side { width: 232px; flex-shrink: 0; display: flex; flex-direction: column; padding: 14px 12px; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.count { font-size: 11px; color: var(--text-faint); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.scene-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.scene-list li {
display: flex; align-items: center; gap: 10px;
padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
transition: background .13s;
}
.scene-list li:hover { background: var(--surface-2); }
.scene-list li.active { background: var(--primary-weak); }
.scene-list li.active .scene-name { color: var(--primary); font-weight: 600; }
.scene-icon {
width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700;
}
.scene-name { flex: 1; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-list li.active .scene-name { color: var(--primary); }
.scene-list em { font-style: normal; font-size: 10px; color: var(--text-faint); }
.side-foot { font-size: 10px; color: var(--text-faint); text-align: center; padding-top: 10px; border-top: 1px dashed var(--border); margin-top: 8px; }
.main { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.page-scroll { flex: 1; min-height: 0; padding: 20px 24px; overflow: auto; }
</style>
+40
View File
@@ -0,0 +1,40 @@
// 与 FastAPI 后端交互 + WebSocket 实时流
const WS_BASE = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host
async function j(url, opts) {
const res = await fetch(url, opts)
if (!res.ok) {
let msg = `HTTP ${res.status}`
try { msg = (await res.json()).detail || msg } catch (e) {}
throw new Error(msg)
}
return res.json()
}
export async function fetchMeta() {
return j('/api/meta')
}
export async function loginPlatform(id) {
return j(`/api/platforms/${id}/login`, { method: 'POST' })
}
export async function startRun(pluginId, fields) {
return j('/api/runs', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ plugin_id: pluginId, fields }),
})
}
export async function getRun(runId) {
return j(`/api/runs/${runId}`)
}
export function connectWS(onEvent) {
const ws = new WebSocket(WS_BASE + '/ws')
ws.onmessage = (e) => {
try { onEvent(JSON.parse(e.data)) } catch (_) {}
}
return ws
}
@@ -0,0 +1,53 @@
<template>
<div class="panel log-wrap">
<div class="log-head">
<div class="log-title">
<i class="status" :class="store.wsOn ? 'on' : 'off'"></i>
<span>运行日志</span>
<span v-if="store.running" class="live">●</span>
</div>
<button class="btn mini" @click="clear">清空</button>
</div>
<div ref="box" class="log-box">
<div v-if="store.logs.length === 0" class="log-empty">暂无日志,点击「一键执行」开始</div>
<div v-for="(l, i) in store.logs" :key="i" class="log-line">
<span class="t">{{ l.time }}</span>
<span class="lv" :class="'s-' + (l.level || 'INFO')">[{{ l.level || 'INFO' }}]</span>
<span>{{ l.msg }}</span>
</div>
</div>
</div>
</template>
<script setup>
import { nextTick, ref, watch } from 'vue'
import { store, clearLogs } from '../store'
const box = ref(null)
watch(
() => store.logs.length,
async () => {
await nextTick()
if (box.value) box.value.scrollTop = box.value.scrollHeight
}
)
function clear() {
clearLogs()
}
</script>
<style scoped>
.log-wrap { display: flex; flex-direction: column; height: 190px; flex-shrink: 0; overflow: hidden; position: relative; }
.log-head {
display: flex; align-items: center; justify-content: space-between;
padding: 9px 14px; border-bottom: 1px solid var(--border);
}
.log-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.status { width: 9px; height: 9px; border-radius: 50%; }
.status.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-weak); }
.status.off { background: #c6ccdc; }
.live { color: var(--ok); font-size: 10px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.log-empty { color: var(--text-faint); padding: 14px; font-family: var(--mono); font-size: 12px; }
.btn.mini { padding: 4px 12px; font-size: 12px; }
</style>
@@ -0,0 +1,176 @@
<template>
<div v-if="plugin" class="plugin-page">
<!-- 页头 -->
<div class="head">
<div class="ident">
<span class="avatar" :style="{ background: avatarBg }">{{ plugin.name.slice(0, 1) }}</span>
<div class="ident-meta">
<h2>{{ plugin.name }}</h2>
<p>{{ plugin.description }}</p>
</div>
</div>
<div v-if="plugin?.uses_month" class="month">
<span class="field-label">执行月份</span>
<select v-model="month" class="input month-sel">
<option v-for="m in months" :key="m" :value="m">{{ m }}</option>
</select>
</div>
</div>
<!-- 结果横幅 -->
<transition name="fade">
<div v-if="store.lastResult" class="banner" :class="store.lastResult.ok ? 'ok' : 'err'">
<span class="b-ic">{{ store.lastResult.ok ? '✓' : '✕' }}</span>
<span class="b-text">
{{ store.lastResult.ok ? (store.lastSummary || '执行完成') : '执行失败:' + store.lastResult.error }}
</span>
<button class="b-close" @click="closeBanner">×</button>
</div>
</transition>
<!-- 参数 -->
<div class="sec-title">参数配置</div>
<div class="form-card">
<div class="fields">
<div v-for="f in plugin.fields" :key="f.key" class="fgroup">
<label class="field-label">{{ f.label }}</label>
<input
v-if="f.type === 'int'"
class="input"
type="number"
v-model.number="form[f.key]"
:placeholder="String(f.default ?? 0)"
/>
<input
v-else-if="f.type === 'text'"
class="input"
type="text"
v-model="form[f.key]"
:placeholder="f.default || ''"
/>
<select v-else class="input" v-model="form[f.key]">
<option v-for="opt in f.options" :key="opt" :value="opt">{{ opt }}</option>
</select>
</div>
</div>
<div class="actions">
<button class="btn primary run-btn" :disabled="store.running" @click="run">
<span v-if="store.running" class="spin"></span>
{{ store.running ? '执行中…' : '一键执行' }}
</button>
</div>
</div>
<p class="hint">执行日志与进度实时显示在下方日志区,结果完成后自动汇总于此。</p>
</div>
<div v-else class="empty">未选择场景</div>
</template>
<script setup>
import { computed, ref, watch } from 'vue'
import { store } from '../store'
import { startRun, getRun } from '../api'
const months = computed(() => {
const now = new Date()
const list = []
for (let off = 1; off <= 6; off++) {
const d = new Date(now.getFullYear(), now.getMonth() - off, 1)
list.push(`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`)
}
return list
})
const month = ref(months.value[0])
const PALETTE = ['#3b6cff', '#7c5cff', '#12a4d8', '#22b07a', '#e88a3a', '#e5484d']
const idx = computed(() => Math.max(0, store.plugins.findIndex((p) => p.id === store.selectedId)))
const avatarBg = computed(() => PALETTE[idx.value % PALETTE.length])
const plugin = computed(() => store.plugins.find((p) => p.id === store.selectedId) || null)
const form = ref({})
watch(
() => plugin.value?.id,
(id) => {
form.value = {}
const p = store.plugins.find((x) => x.id === id)
if (p) p.fields.forEach((f) => (form.value[f.key] = f.default ?? (f.type === 'int' ? 0 : '')))
},
{ immediate: true }
)
async function run() {
if (!plugin.value || store.running) return
store.running = true
store.progress = 0
store.currentRun = ''
store.lastResult = null
store.lastSummary = ''
const payload = { ...form.value }
if (plugin.value.uses_month) payload.ref_month = month.value // 仅月度插件注入月份
const r = await startRun(plugin.value.id, payload)
store.lastRunId = r.run_id
}
// 完成时拉取后端摘要填充横幅
watch(
() => store.lastResult,
async (res) => {
if (res && res.ok && store.lastRunId) {
try {
const run = await getRun(store.lastRunId)
store.lastSummary = run.result?.summary || ''
} catch (e) {}
}
}
)
function closeBanner() {
store.lastResult = null
}
</script>
<style scoped>
.plugin-page { display: flex; flex-direction: column; gap: 18px; min-height: 100%; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ident { display: flex; align-items: center; gap: 14px; }
.avatar {
width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 700;
box-shadow: var(--shadow-md);
}
.ident-meta { display: flex; flex-direction: column; gap: 2px; }
.ident-meta h2 { margin: 0; font-size: 17px; }
.ident-meta p { margin: 0; font-size: 12px; color: var(--text-sub); }
.month { display: flex; align-items: center; gap: 8px; }
.month-sel { min-width: 110px; }
.banner {
display: flex; align-items: center; gap: 10px;
padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px;
}
.banner.ok { background: var(--ok-weak); color: #156d4e; border: 1px solid #bfe8d5; }
.banner.err { background: var(--err-weak); color: #a83a3e; border: 1px solid #f3c4c5; }
.b-ic { font-weight: 800; font-size: 15px; }
.b-text { flex: 1; }
.b-close { border: none; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .5; }
.b-close:hover { opacity: 1; }
.form-card {
display: flex; flex-direction: column; gap: 16px;
background: var(--surface-2); border: 1px solid var(--border);
border-radius: var(--radius-sm); padding: 16px;
}
.fields { display: flex; gap: 24px; flex-wrap: wrap; }
.fgroup { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.fgroup .input { width: 150px; }
.actions { display: flex; justify-content: flex-end; }
.run-btn { min-width: 128px; height: 38px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font-size: 12px; color: var(--text-faint); margin: 0; padding-left: 2px; }
.empty { color: var(--text-faint); padding: 40px; }
</style>
+5
View File
@@ -0,0 +1,5 @@
import { createApp } from 'vue'
import App from './App.vue'
import './style.css'
createApp(App).mount('#app')
+53
View File
@@ -0,0 +1,53 @@
import { reactive } from 'vue'
export const store = reactive({
appName: '',
platforms: [],
plugins: [],
selectedId: '',
logs: [], // {time, level, msg}
progress: 0,
running: false,
currentRun: '', // 当前接收日志/进度的 run_id
lastRunId: '', // 最近一次执行的 run_id
lastResult: null, // {ok, error}
lastSummary: '', // 完成时后端返回的摘要
wsOn: false,
})
export function clearLogs() {
store.logs = []
store.lastResult = null
store.lastSummary = ''
}
export function log(level, msg) {
const time = new Date().toLocaleTimeString('zh-CN', { hour12: false })
store.logs.push({ time, level, msg })
if (store.logs.length > 500) store.logs.splice(0, store.logs.length - 500)
}
export function handleEvent(ev) {
switch (ev.t) {
case 'run_start':
store.currentRun = ev.run_id
if (!store.running) { clearLogs() }
break
case 'log':
if (ev.run_id === store.currentRun || !store.currentRun) {
log(ev.level || 'INFO', ev.msg)
}
break
case 'progress':
if (ev.run_id === store.currentRun) store.progress = ev.pct
break
case 'run_done':
store.running = false
store.progress = 100
store.lastResult = { ok: ev.ok, error: ev.error || '' }
if (ev.ok) log('INFO', '===== 执行完成 =====')
else log('ERROR', `执行失败:${ev.error}`)
store.currentRun = ''
break
}
}
+146
View File
@@ -0,0 +1,146 @@
/* ============ 37du Web Host 设计系统(亮色) ============ */
:root {
--bg: #eef2f9;
--bg-grad: linear-gradient(180deg, #f4f7fc 0%, #e9eef7 100%);
--surface: #ffffff;
--surface-2: #f7f9fd;
--border: #e5eaf3;
--border-strong: #cdd6e6;
--text: #1f2633;
--text-sub: #5b6477;
--text-faint: #98a0b3;
--primary: #3b6cff;
--primary-2: #6f8dff;
--primary-grad: linear-gradient(135deg, #4c79ff 0%, #3b6cff 100%);
--primary-weak: #eef2ff;
--primary-weak-2: #e2e9ff;
--ok: #22b07a;
--ok-weak: #e6f7f0;
--err: #e5484d;
--err-weak: #fdecec;
--warn: #d99a1b;
--shadow-sm: 0 1px 2px rgba(24, 39, 75, 0.05);
--shadow-md: 0 6px 24px -8px rgba(24, 39, 75, 0.18);
--radius: 14px;
--radius-sm: 9px;
--mono: "JetBrains Mono", "Consolas", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
font-family: "Inter", "Microsoft YaHei UI", "PingFang SC", -apple-system, sans-serif;
font-size: 13px;
color: var(--text);
-webkit-font-smoothing: antialiased;
}
.__app {
height: 100%;
background: var(--bg-grad);
padding: 16px 18px 18px;
display: flex;
flex-direction: column;
}
/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4dae8; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c1c9dc; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
/* 通用白卡 */
.panel {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
}
/* 分节标题 */
.sec-title {
font-size: 11px;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--text-faint);
}
/* 按钮 */
.btn {
border: 1px solid var(--border-strong);
background: var(--surface);
color: var(--text-sub);
border-radius: 8px;
padding: 7px 16px;
font-size: 13px;
font-family: inherit;
cursor: pointer;
transition: all .15s ease;
}
.btn:hover { color: var(--text); border-color: #b9c3d8; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { color: #c0c6d4; border-color: var(--border); background: #f4f6fb; cursor: not-allowed; transform: none; }
.btn.primary {
background: var(--primary-grad);
color: #fff;
border: 1px solid transparent;
font-weight: 600;
box-shadow: 0 4px 14px -4px rgba(59, 108, 255, 0.55);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 20px -6px rgba(59, 108, 255, 0.65); color: #fff; }
.btn.primary:disabled { background: #b9c6f0; box-shadow: none; }
/* 输入 / 选择 */
.input {
height: 34px;
border: 1px solid var(--border-strong);
border-radius: 8px;
background: var(--surface);
color: var(--text);
padding: 0 12px;
font-size: 13px;
font-family: inherit;
outline: none;
transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
select.input { padding-right: 30px; appearance: none; cursor: pointer;
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8497' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat; background-position: right 10px center; }
.field-label { color: var(--text-sub); font-size: 13px; }
/* 进度条 */
.progress { height: 8px; width: 180px; background: #e8ecf5; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px;
background: var(--primary-grad);
transition: width .25s ease;
box-shadow: 0 0 6px rgba(59,108,255,.5); }
/* 日志 */
.log-box {
font-family: var(--mono);
font-size: 12px;
line-height: 1.75;
color: var(--text);
padding: 12px 14px;
overflow: auto;
white-space: pre-wrap;
word-break: break-all;
}
.log-line:hover { background: #f7f9fd; }
.log-box .t { color: var(--text-faint); margin-right: 10px; user-select: none; }
.log-box .lv { margin-right: 6px; font-weight: 700; }
.log-box .s-INFO { color: var(--primary); }
.log-box .s-ERROR { color: var(--err); }
.log-box .s-WARN { color: var(--warn); }
/* 过渡 */
.fade-enter-active, .fade-leave-active { transition: opacity .18s ease, transform .18s ease; }
.fade-enter-from { opacity: 0; transform: translateY(4px); }
.fade-leave-to { opacity: 0; }
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// dev 时把 /api 与 /ws 代理到 FastAPI 后端,实现前后端分离开发
export default defineConfig({
plugins: [vue()],
server: {
port: 5173,
strictPort: true,
proxy: {
'/api': { target: 'http://127.0.0.1:8799', changeOrigin: true },
'/ws': { target: 'ws://127.0.0.1:8799', ws: true },
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
})