mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-31 13:20:10 +08:00
fix: 修复多项关键 Bug,与 openclaw 上游协议对齐
- main.js: wsClient.connect 传参格式错误(完整 ws:// URL → host:port) - ws-client.js: request() 等待重连时不处理 onReady 握手失败 - gateway.js: bind 写入非法值 'all',改为 openclaw 合法值 'lan' - device.rs: connect payload 从 v2 升级到 v3,补充 platform/deviceFamily - config.rs: macOS reload_gateway 在 async fn 中用同步 Command 阻塞 tokio - service.rs: Windows check_service_status 端口硬编码 18789,改为读配置 - extensions.rs: parse_cftunnel_status 全角冒号解析失败,添加 split_after_colon - tauri-api.js: cachedInvoke miss 时 logRequest 被记录两次 - tauri-api.js: mock 补充 list_agents / restart_gateway - chat.js: 附件对象冗余 data 字段(双倍内存)+ 缩进修复 - services.js: 服务操作缺少操作中 toast 反馈
This commit is contained in:
@@ -64,7 +64,7 @@ export async function render() {
|
||||
<div style="margin-bottom:var(--space-md)">
|
||||
<input class="form-input" id="model-search" placeholder="搜索模型(按 ID 或名称过滤)" style="max-width:360px">
|
||||
</div>
|
||||
<div id="providers-list" class="loading-text">加载中...</div>
|
||||
<div id="providers-list"></div>
|
||||
`
|
||||
|
||||
const state = { config: null, search: '', undoStack: [] }
|
||||
@@ -83,7 +83,6 @@ export async function render() {
|
||||
|
||||
async function loadConfig(page, state) {
|
||||
const listEl = page.querySelector('#providers-list')
|
||||
listEl.innerHTML = '<div class="loading-text">加载中...</div>'
|
||||
try {
|
||||
state.config = await api.readOpenclawConfig()
|
||||
renderDefaultBar(page, state)
|
||||
@@ -360,8 +359,23 @@ async function doAutoSave(state) {
|
||||
const primary = getCurrentPrimary(state.config)
|
||||
if (primary) applyDefaultModel(state)
|
||||
await api.writeOpenclawConfig(state.config)
|
||||
// Gateway 会自动检测配置变化并热重载,无需手动 kickstart
|
||||
toast('已自动保存', 'success')
|
||||
|
||||
// 提示用户需要重启 Gateway
|
||||
const restartBtn = document.createElement('button')
|
||||
restartBtn.className = 'btn btn-sm btn-primary'
|
||||
restartBtn.textContent = '立即重启'
|
||||
restartBtn.style.marginLeft = '8px'
|
||||
restartBtn.onclick = async () => {
|
||||
try {
|
||||
toast('正在重启 Gateway...', 'info')
|
||||
await api.restartGateway()
|
||||
toast('Gateway 重启成功', 'success')
|
||||
} catch (e) {
|
||||
toast('重启失败: ' + e.message, 'error')
|
||||
}
|
||||
}
|
||||
|
||||
toast('配置已保存,需要重启 Gateway 生效', 'warning', { action: restartBtn })
|
||||
} catch (e) {
|
||||
toast('自动保存失败: ' + e, 'error')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user