feat: improve gateway compatibility and complete i18n cleanup

This commit is contained in:
晴天
2026-04-01 15:06:25 +08:00
parent 57b8b25946
commit b427a6b000
59 changed files with 6830 additions and 964 deletions

View File

@@ -5,6 +5,7 @@
import { api, getRequestLogs, clearRequestLogs } from '../lib/tauri-api.js'
import { wsClient } from '../lib/ws-client.js'
import { isOpenclawReady, isGatewayRunning } from '../lib/app-state.js'
import { isForeignGatewayError, showGatewayConflictGuidance } from '../lib/gateway-ownership.js'
import { icon, statusIcon } from '../lib/icons.js'
import { toast } from '../components/toast.js'
import { navigate } from '../router.js'
@@ -76,6 +77,12 @@ export async function render() {
return page
}
async function openGatewayConflict(error = null) {
const services = await api.getServicesStatus().catch(() => [])
const gw = services?.find?.(s => s.label === 'ai.openclaw.gateway') || services?.[0] || null
await showGatewayConflictGuidance({ error, service: gw })
}
async function loadDebugInfo(page) {
const el = page.querySelector('#debug-content')
@@ -589,13 +596,27 @@ async function fixPairing(page) {
// 2. 停止 Gateway确保旧进程完全退出新进程能重新读取配置
addLog(`${icon('zap', 14)} ${t('chatDebug.fixStoppingGw')}`)
try { await api.stopService('ai.openclaw.gateway') } catch {}
try {
await api.stopService('ai.openclaw.gateway')
} catch (e) {
if (isForeignGatewayError(e)) {
await openGatewayConflict(e)
throw e
}
}
addLog(`${icon('clock', 14)} ${t('chatDebug.fixWaitExit')}`)
await new Promise(resolve => setTimeout(resolve, 3000))
// 3. 启动 Gateway重新加载 openclaw.json 配置)
addLog(`${icon('zap', 14)} ${t('chatDebug.fixStartingGw')}`)
await api.startService('ai.openclaw.gateway')
try {
await api.startService('ai.openclaw.gateway')
} catch (e) {
if (isForeignGatewayError(e)) {
await openGatewayConflict(e)
}
throw e
}
addLog(`${statusIcon('ok', 14)} ${t('chatDebug.fixGwStartSent')}`)
// 4. 等待 Gateway 就绪