mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-30 21:00:30 +08:00
chore(release): v0.13.3
- 修复 #212 AI 消息气泡空白 - 修复 #215 HTTPS 下 WebSocket Mixed Content - 修复 #219 多实例版本检测错误 - 修复引擎切换后仪表盘无限加载 - 修复热更新假更新循环(macOS/Linux) - CI release 构建前自动同步版本号
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* 引擎管理器
|
||||
* 管理多引擎(OpenClaw / Hermes Agent / ...)的注册、切换和状态
|
||||
*/
|
||||
import { api } from './tauri-api.js'
|
||||
import { api, invalidate } from './tauri-api.js'
|
||||
import { registerRoute, setDefaultRoute } from '../router.js'
|
||||
|
||||
const _engines = {}
|
||||
@@ -72,9 +72,12 @@ export async function activateEngine(id, persist = true) {
|
||||
return
|
||||
}
|
||||
|
||||
// 清理旧引擎
|
||||
if (_activeEngine && _activeEngine.id !== id && _activeEngine.cleanup) {
|
||||
try { _activeEngine.cleanup() } catch {}
|
||||
// 清理旧引擎 + 重置 API 缓存与 in-flight,避免旧引擎 pending 请求阻塞新引擎页面
|
||||
if (_activeEngine && _activeEngine.id !== id) {
|
||||
if (_activeEngine.cleanup) {
|
||||
try { _activeEngine.cleanup() } catch {}
|
||||
}
|
||||
try { invalidate() } catch {}
|
||||
}
|
||||
|
||||
_activeEngine = engine
|
||||
@@ -90,8 +93,13 @@ export async function activateEngine(id, persist = true) {
|
||||
|
||||
// 切换时启动新引擎(检测安装状态等),初始化由 main.js 处理
|
||||
if (persist && engine.boot) {
|
||||
try { await engine.boot() } catch (e) {
|
||||
console.warn('[engine-manager] boot 失败:', e)
|
||||
try {
|
||||
await Promise.race([
|
||||
engine.boot(),
|
||||
new Promise((_, reject) => setTimeout(() => reject(new Error('engine boot timeout')), 10000))
|
||||
])
|
||||
} catch (e) {
|
||||
console.warn('[engine-manager] boot 失败或超时:', e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,11 +92,15 @@ function cachedInvoke(cmd, args = {}, ttl = CACHE_TTL) {
|
||||
function invalidate(...cmds) {
|
||||
if (!cmds.length) {
|
||||
_cache.clear()
|
||||
_inflight.clear()
|
||||
return
|
||||
}
|
||||
for (const [k] of _cache) {
|
||||
if (cmds.some(c => k.startsWith(c))) _cache.delete(k)
|
||||
}
|
||||
for (const [k] of _inflight) {
|
||||
if (cmds.some(c => k.startsWith(c))) _inflight.delete(k)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出 invalidate 供外部使用
|
||||
@@ -364,7 +368,7 @@ export const api = {
|
||||
|
||||
// 前端热更新
|
||||
checkFrontendUpdate: () => invoke('check_frontend_update'),
|
||||
downloadFrontendUpdate: (url, expectedHash) => invoke('download_frontend_update', { url, expectedHash: expectedHash || '' }),
|
||||
downloadFrontendUpdate: (url, expectedHash, version) => invoke('download_frontend_update', { url, expectedHash: expectedHash || '', version: version || '' }),
|
||||
rollbackFrontendUpdate: () => invoke('rollback_frontend_update'),
|
||||
getUpdateStatus: () => invoke('get_update_status'),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user