fix(setup): make Hermes wizard phases clickable, stop auto-redirect

1. 已完成的步骤指示器可点击返回(检测/安装/配置/启动)
2. 已安装+Gateway 运行时不再自动跳转仪表盘,停在"完成"步骤
3. 用户从 About 页点"配置"进入向导后可自由浏览每个步骤
This commit is contained in:
晴天
2026-04-13 10:29:24 +08:00
parent 6971bd32e8
commit d8d671a221
2 changed files with 11 additions and 7 deletions

View File

@@ -85,7 +85,8 @@ export function render() {
const idx = phases.findIndex(p => p.id === phase)
return `<div class="hermes-phases">${phases.map((p, i) => {
const cls = i < idx ? 'done' : i === idx ? 'active' : ''
return `<div class="hermes-phase ${cls}">
const clickable = i < idx ? `data-goto-phase="${p.id}" style="cursor:pointer" title="${t('engine.hermesPhaseClickHint')}"` : ''
return `<div class="hermes-phase ${cls}" ${clickable}>
<span class="hermes-phase-dot">${i < idx ? ICONS.check : i + 1}</span>
<span class="hermes-phase-label">${p.label}</span>
</div>`
@@ -267,6 +268,13 @@ export function render() {
// --- 事件绑定 ---
function bind() {
// 点击已完成的阶段指示器,跳回该步骤
el.querySelectorAll('[data-goto-phase]').forEach(dot => {
dot.addEventListener('click', () => {
phase = dot.dataset.gotoPhase
draw()
})
})
// 安装按钮
el.querySelector('.hermes-install-btn')?.addEventListener('click', doInstall)
// 全选 extras
@@ -356,15 +364,10 @@ export function render() {
draw()
// 自动跳转
// 自动跳转到最合适的阶段(不自动离开向导,让用户可以查看和回退每一步)
await new Promise(r => setTimeout(r, 800))
if (hm.installed && hm.gatewayRunning) {
phase = 'complete'
// 更新引擎状态并自动跳转仪表盘
const engine = getActiveEngine()
if (engine?.detect) await engine.detect()
window.location.hash = '#/h/dashboard'
return
} else if (hm.installed && hm.configExists) {
phase = 'gateway'
} else if (hm.installed) {

View File

@@ -3,6 +3,7 @@ import { _ } from '../helper.js'
export default {
switchedTo: _('已切换到 {name} 模式', 'Switched to {name} mode', '已切換到 {name} 模式', '{name} モードに切り替えました', '{name} 모드로 전환됨'),
hermesSetupDesc: _('安装并配置 Hermes Agent', 'Install and configure Hermes Agent', '安裝並配置 Hermes Agent'),
hermesPhaseClickHint: _('点击可返回此步骤', 'Click to go back to this step', '點擊可返回此步驟', 'このステップに戻るにはクリック', '이 단계로 돌아가려면 클릭'),
hermesSetupIntro: _(
'Hermes Agent 是一个具有工具调用能力的 AI 助手框架。点击下方按钮一键安装,无需终端操作。',
'Hermes Agent is an AI assistant with tool-calling capabilities. Click the button below to install — no terminal needed.',