优化: aichat 体验收尾(useAiEvents拆分4子域 + AIC-FIX P1队列/mutex/缓存 + i18n残留抽取)

This commit is contained in:
lxy
2026-08-08 20:38:33 +08:00
parent 4092a8d5bb
commit 65c0f6b2b6
21 changed files with 882 additions and 913 deletions
+21 -21
View File
@@ -3,10 +3,10 @@
<div class="dep-graph__toolbar">
<span class="dep-graph__title">{{ $t('dependencyGraph.title') }}</span>
<div class="dep-graph__actions">
<button v-if="modules.length >= 2" class="btn btn-ghost btn-sm" @click="showAddDep = true">+ 依赖</button>
<button v-if="dependencies.length > 0" class="btn btn-ghost btn-sm" @click="checkCycles">🔍 环检测</button>
<button class="btn btn-ghost btn-sm" @click="exportPNG">📷 导出</button>
<button class="btn btn-ghost btn-sm" @click="fitContent">适应内容</button>
<button v-if="modules.length >= 2" class="btn btn-ghost btn-sm" @click="showAddDep = true">{{ $t('dependencyGraph.addDep') }}</button>
<button v-if="dependencies.length > 0" class="btn btn-ghost btn-sm" @click="checkCycles">{{ $t('dependencyGraph.checkCycles') }}</button>
<button class="btn btn-ghost btn-sm" @click="exportPNG">{{ $t('dependencyGraph.exportImage') }}</button>
<button class="btn btn-ghost btn-sm" @click="fitContent">{{ $t('dependencyGraph.fitContent') }}</button>
<button class="btn btn-ghost btn-sm" @click="zoomIn">+</button>
<button class="btn btn-ghost btn-sm" @click="zoomOut">-</button>
</div>
@@ -36,32 +36,32 @@
<!-- 添加依赖弹窗 -->
<div v-if="showAddDep" class="dep-graph__modal-overlay" @click.self="showAddDep = false">
<div class="dep-graph__modal">
<h3>添加工程依赖</h3>
<h3>{{ $t('dependencyGraph.addDepTitle') }}</h3>
<div class="dep-graph__modal-field">
<label>源工程(依赖方)</label>
<label>{{ $t('dependencyGraph.sourceLabel') }}</label>
<select v-model="depFrom" class="dep-graph__modal-input">
<option v-for="m in modules" :key="m.id" :value="m.id">{{ m.name }}</option>
</select>
</div>
<div class="dep-graph__modal-field">
<label>目标工程(被依赖)</label>
<label>{{ $t('dependencyGraph.targetLabel') }}</label>
<select v-model="depTo" class="dep-graph__modal-input">
<option v-for="m in modules" :key="m.id" :value="m.id">{{ m.name }}</option>
</select>
</div>
<div class="dep-graph__modal-field">
<label>依赖类型</label>
<label>{{ $t('dependencyGraph.depTypeLabel') }}</label>
<select v-model="depType" class="dep-graph__modal-input">
<option value="library">类库</option>
<option value="api">API 调用</option>
<option value="mq">消息队列</option>
<option value="shared">共享资源</option>
<option value="custom">自定义</option>
<option value="library">{{ $t('dependencyGraph.typeLibrary') }}</option>
<option value="api">{{ $t('dependencyGraph.typeApi') }}</option>
<option value="mq">{{ $t('dependencyGraph.typeMq') }}</option>
<option value="shared">{{ $t('dependencyGraph.typeShared') }}</option>
<option value="custom">{{ $t('dependencyGraph.typeCustom') }}</option>
</select>
</div>
<div class="dep-graph__modal-actions">
<button class="btn btn-ghost btn-sm" @click="showAddDep = false">取消</button>
<button class="btn btn-primary btn-sm" :disabled="!depFrom || !depTo || depFrom === depTo" @click="onAddDep">确认</button>
<button class="btn btn-ghost btn-sm" @click="showAddDep = false">{{ $t('common.cancel') }}</button>
<button class="btn btn-primary btn-sm" :disabled="!depFrom || !depTo || depFrom === depTo" @click="onAddDep">{{ $t('dependencyGraph.confirm') }}</button>
</div>
</div>
</div>
@@ -257,13 +257,13 @@ async function checkCycles() {
cycleNodes.value = new Set(cycles)
renderGraph()
if (cycles.length > 0) {
Message.warning(`检测到 ${cycles.length} 个环节点(已红框高亮)`)
Message.warning(t('dependencyGraph.cycleWarning', { n: cycles.length }))
} else {
Message.success('未检测到环形依赖')
Message.success(t('dependencyGraph.noCycle'))
}
} catch (e) {
console.error('[DependencyGraph] 环检测失败:', e)
Message.error('环检测失败')
Message.error(t('dependencyGraph.cycleError'))
}
}
@@ -286,17 +286,17 @@ async function exportPNG() {
async function confirmRemoveDep(dep: ModuleDependencyRecord) {
const fromName = modules.value.find(m => m.id === dep.from_module_id)?.name ?? dep.from_module_id
const toName = modules.value.find(m => m.id === dep.to_module_id)?.name ?? dep.to_module_id
const ok = await confirmDialog(`确定删除「${fromName}${toName}」的依赖吗?此操作不可撤销。`, t('common.delete'))
const ok = await confirmDialog(t('dependencyGraph.deleteConfirm', { from: fromName, to: toName }), t('common.delete'))
if (!ok) return
try {
await moduleApi.removeModuleDependency(dep.id)
Message.info('依赖已删除')
Message.info(t('dependencyGraph.deleteSuccess'))
await loadModules()
renderGraph()
bindEdgeDeleteButtons()
} catch (e) {
console.error('[DependencyGraph] 删除依赖失败:', e)
Message.error('删除依赖失败')
Message.error(t('dependencyGraph.deleteError'))
}
}