mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-06 08:09:54 +08:00
fix: auto-set mode:local after Gateway install + dashboard self-heal
- Setup flow: write mode:'local' to openclaw.json after Gateway install - Dashboard: auto-heal missing mode field on load for existing users
This commit is contained in:
@@ -76,6 +76,12 @@ async function loadDashboardData(page) {
|
||||
if (servicesRes.status === 'rejected') toast('服务状态加载失败', 'error')
|
||||
if (versionRes.status === 'rejected') toast('版本信息加载失败', 'error')
|
||||
|
||||
// 自愈:如果 openclaw.json 没有 mode 字段,自动设为 local,否则 Gateway 启动不了
|
||||
if (config && !config.mode) {
|
||||
config.mode = 'local'
|
||||
api.writeOpenclawConfig(config).catch(() => {})
|
||||
}
|
||||
|
||||
renderStatCards(page, services, version, [], config, null)
|
||||
bindActions(page)
|
||||
|
||||
|
||||
@@ -287,6 +287,18 @@ function bindEvents(page, nodeOk) {
|
||||
modal.appendLog('⚠️ Gateway 安装失败: ' + e)
|
||||
}
|
||||
|
||||
// 确保 openclaw.json 有 mode: "local",否则 Gateway 启动不了
|
||||
try {
|
||||
const config = await api.readOpenclawConfig()
|
||||
if (config && !config.mode) {
|
||||
config.mode = 'local'
|
||||
await api.writeOpenclawConfig(config)
|
||||
modal.appendLog('✅ 已设置 Gateway 运行模式为 local')
|
||||
}
|
||||
} catch (e) {
|
||||
modal.appendLog('⚠️ 配置 mode 失败: ' + e)
|
||||
}
|
||||
|
||||
toast('OpenClaw 安装成功', 'success')
|
||||
setTimeout(() => window.location.reload(), 1500)
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user