Files
clawpanel/src/locales/modules/dreaming.js
晴天 e710db6ffb feat(ux): 小白 UX 全面改造 - 错误友好度 + 致命操作强确认 + 空状态 + 新手引导 + 术语表
面向小白用户的产品定位重塑,从七大 UX 痛点逐一改造:

## U1 错误友好度(59 处改造)
- 新工具 src/lib/humanize-error.js:自动把后端原始错误(fetch failed、ENETUNREACH、ENOENT 等)
  映射成「主行 + hint 行动建议 + 折叠技术详情」三段式结构化对象
- toast 组件升级支持 { message, hint, raw } 结构化入参,向后完全兼容
- 14 个 page 文件中所有 toast(t('xxx.failed') + ': ' + e, 'error') 替换为 toast(humanizeError(e, t(...)), 'error')
- common.js 加 error.* / errorHint.* 共 13 个新 i18n 键(11 语言):
  网络/Gateway 未启动/命令缺失/权限/超时/限流/未找到/鉴权/服务繁忙/通用

## U2 致命操作强确认(14 处改造)
- showConfirm 升级支持结构化对象 { message, impact[], title, confirmText, cancelText, variant }
- 加 .modal-impact-list 红边样式(让小白看清楚删了会丢什么)
- 14 处致命操作改造,每处显示影响列表 + 红色「删除/移除/重置」按钮 + 灰色「保留」取消:
  · agents.js 删除 Agent(动态显示 N 个绑定影响)
  · channels.js 移除平台(动态算 N 个 binding)+ 移除 Agent binding
  · memory.js 删除记忆文件
  · services.js 卸载 Gateway(3 段影响)+ 删除备份
  · models.js 批量删模型
  · chat.js 删除会话 + 重置会话
  · dreaming.js 重置梦境日记 + 清空 grounded 短期记忆
  · agent-detail.js 解除渠道绑定
  · cron.js 删除任务(OpenClaw + Hermes 两端)
- skills.js 原生 confirm() 改 showConfirm
- hermes-cron.js 原生 confirm() 改 showConfirm,顺手修末尾多余 `}` 的 syntax 残留

## U3-C 空状态 emoji+CTA(5 页面)
- 通用 .empty-state 组件(大 emoji + 标题 + 副本 + CTA 按钮 + 紧凑变体)
- agents.js: 🤖 + 「+ 新建 Agent」CTA
- memory.js: 🧠 + 「+ 新建记忆文件」CTA(紧凑版)
- cron.js:  + 「+ 新建任务」CTA
- skills.js: 🛠️ + 「技能商店」CTA(点击切 Tab)
- channels.js: 💬 + 紧凑提示
- CTA 巧妙复用页面顶部已有按钮的 click,零重复逻辑

## U3-B Dashboard 新手任务卡片
- 蓝紫渐变卡片,4 步任务自动检测:启动 Gateway / 添加模型 / 创建 Agent / 第一次聊天
- 已完成:✓ 徽章 + 删除线 + 60% 透明
- 未完成:编号徽章 + 蓝色 CTA 按钮跳对应页面
- 全部完成 → 庆祝条「🎉 全部搞定!」+ 关闭按钮
- localStorage 标记,用户主动关闭后永久隐藏
- 14 个新 i18n 键,文案小白化(Gateway 是「发动机」/ Agent 是「分身」/ 模型给 AI 装「大脑」)

## U3-A 术语表页(/glossary)
- 25 个核心术语 × 4 大分类(核心 8 / 模型 6 / 接入 5 / 进阶 6)
- 搜索框实时过滤 + Tab 切换分类 + 卡片网格布局
- 每条术语:「比喻 + 一句话」描述(避免循环引用)+ 「打开页面 →」CTA 直达配置
- 3 语言(zh-CN / en / zh-TW)完整翻译,其他 8 语言 fallback
- 双引擎(OpenClaw + Hermes)共用路由
- dashboard quick-actions 加「📖 面板术语」入口

## U3-D 术语 ⓘ tooltip
- 通用 src/lib/term-tooltip.js helper:termHelpHtml(id) + attachTermTooltips(root)
- 8 个高频术语精简表(OAuth / Webhook / Bot Token / API Key / Token / Context Window / Binding / Scope)
- channels.js 字段 label 智能匹配关键词自动追加 ⓘ(覆盖 8 个渠道全部敏感字段)
- models.js 添加/编辑 provider 的 API Key label 也加 ⓘ
- 点 ⓘ → 弹小型 modal 含解释 + 「打开术语表 →」CTA
- attachTermTooltips 内部去重,可安全多次调用

## 累计交付
- 4 个新文件(humanize-error.js / term-tooltip.js / glossary.js page / glossary.js i18n)
- 6 个升级文件(toast / modal / components.css / dashboard / channels / models)
- 14 个 page 错误 toast 友好化(59 处)
- 14 处致命操作强确认
- 5 处空状态升级 + Dashboard 新手卡片 + 术语表 + ⓘ tooltip
- 109 个新 i18n 键(11 语言)
- Build 全程通过
2026-05-14 03:38:47 +08:00

83 lines
9.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { _ } from '../helper.js'
export default {
title: _('梦境模式', 'Dreaming'),
desc: _('查看 OpenClaw 4.9 的 Dreaming 状态、梦境日记与记忆沉淀情况', 'View OpenClaw 4.9 Dreaming status, dream diary, and memory consolidation'),
viewScene: _('场景', 'Scene'),
viewDiary: _('日记', 'Diary'),
refresh: _('刷新', 'Refresh'),
gwConnecting: _('Gateway 连接中...', 'Connecting to Gateway...'),
gwWait: _('等待 Gateway 就绪后自动加载 Dreaming 数据', 'Will auto-load Dreaming data once Gateway is ready'),
loadFailed: _('加载失败', 'Load failed'),
loadFailedHint: _('需要 OpenClaw 2026.4.9+ 且启用 memory-core Dreaming 功能', 'Requires OpenClaw 2026.4.9+ with memory-core Dreaming enabled'),
unsupportedHint: _('当前 Gateway 或记忆插件不支持 Dreaming 能力', 'The current Gateway or memory plugin does not support Dreaming'),
toggleOn: _('启用梦境模式', 'Enable Dreaming'),
toggleOff: _('关闭梦境模式', 'Disable Dreaming'),
enabled: _('梦境模式已启用', 'Dreaming enabled'),
disabled: _('梦境模式已关闭', 'Dreaming disabled'),
toggleFailed: _('切换失败', 'Toggle failed'),
backfill: _('回填梦境日记', 'Backfill Dream Diary'),
resetDiary: _('重置梦境日记', 'Reset Dream Diary'),
clearGrounded: _('清空 grounded 短期记忆', 'Clear grounded short-term memory'),
backfillDone: _('梦境日记已回填', 'Dream diary backfilled'),
resetDiaryDone: _('梦境日记已重置', 'Dream diary reset'),
clearGroundedDone: _('grounded 短期记忆已清空', 'Grounded short-term memory cleared'),
confirmResetDiary: _('确定要重置梦境日记吗?这会清空现有 DREAMS.md 内容。', 'Reset the dream diary? This will clear existing DREAMS.md content.'),
resetDiaryTitle: _('重置梦境日记', 'Reset dream diary', '重置夢境日記', '夢日記をリセット', '꿈 일기 초기화', 'Khôi phục nhật ký giấc mơ', 'Restablecer diario de sueños', 'Redefinir diário de sonhos', 'Сбросить дневник снов', 'Réinitialiser le journal de rêves', 'Traumtagebuch zurücksetzen'),
resetDiaryBtn: _('重置', 'Reset', '重置', 'リセット', '초기화', 'Khôi phục', 'Restablecer', 'Redefinir', 'Сбросить', 'Réinitialiser', 'Zurücksetzen'),
resetDiaryCancel: _('保留', 'Keep', '保留', '保持', '유지', 'Giữ lại', 'Conservar', 'Manter', 'Оставить', 'Conserver', 'Behalten'),
resetDiaryImpactContent: _('DREAMS.md 内容将清空,所有梦境记录将丢失', 'DREAMS.md will be emptied and all dream records will be lost', 'DREAMS.md 內容將清空,所有夢境紀錄將遺失', 'DREAMS.md が空になり、すべての夢の記録が失われます', 'DREAMS.md가 비워지고 모든 꿈 기록이 손실됩니다', 'DREAMS.md sẽ bị xoá và mọi ghi chép giấc mơ sẽ mất', 'DREAMS.md se vaciará y se perderán todos los registros de sueños', 'DREAMS.md será esvaziado e todos os registros de sonhos serão perdidos', 'Файл DREAMS.md будет очищен и все записи о снах будут утеряны', 'DREAMS.md sera vidé et tous les enregistrements de rêves seront perdus', 'DREAMS.md wird geleert und alle Traumaufzeichnungen gehen verloren'),
resetDiaryImpactReplay: _('下次 Dreaming 周期会重新生成新的梦境', 'The next Dreaming cycle will regenerate new dreams from scratch', '下次 Dreaming 週期會重新產生新的夢境', '次回の Dreaming サイクルで新しい夢が一から生成されます', '다음 Dreaming 사이클에서 새 꿈이 처음부터 다시 생성됩니다', 'Chu kỳ Dreaming tiếp theo sẽ sinh lại giấc mơ mới từ đầu', 'El próximo ciclo de Dreaming regenerará nuevos sueños desde cero', 'O próximo ciclo de Dreaming gerará novos sonhos do zero', 'Следующий цикл Dreaming сгенерирует новые сны с нуля', 'Le prochain cycle Dreaming générera de nouveaux rêves à partir de zéro', 'Der nächste Dreaming-Zyklus erzeugt neue Träume von Grund auf'),
confirmClearGrounded: _('确定要清空 grounded 短期记忆吗?', 'Clear grounded short-term memory?'),
clearGroundedTitle: _('清空短期记忆', 'Clear short-term memory', '清空短期記憶', '短期記憶をクリア', '단기 기억 비우기', 'Xoá ký ức ngắn hạn', 'Borrar memoria a corto plazo', 'Limpar memória de curto prazo', 'Очистить кратковременную память', 'Effacer la mémoire à court terme', 'Kurzzeitgedächtnis leeren'),
clearGroundedBtn: _('清空', 'Clear', '清空', 'クリア', '비우기', 'Xoá', 'Borrar', 'Limpar', 'Очистить', 'Effacer', 'Leeren'),
clearGroundedCancel: _('保留', 'Keep', '保留', '保持', '유지', 'Giữ lại', 'Conservar', 'Manter', 'Оставить', 'Conserver', 'Behalten'),
clearGroundedImpact: _('grounded 短期记忆将立刻清空,最近一段对话上下文会丢失', 'Grounded short-term memory will be cleared immediately and recent conversation context will be lost', 'grounded 短期記憶將立即清空,最近一段對話上下文會遺失', 'grounded の短期記憶が直ちにクリアされ、直近の会話コンテキストが失われます', 'grounded 단기 기억이 즉시 비워지고 최근 대화 맥락이 사라집니다', 'Ký ức ngắn hạn grounded sẽ bị xoá ngay, ngữ cảnh trò chuyện gần đây sẽ mất', 'La memoria a corto plazo de grounded se borrará de inmediato y se perderá el contexto de las conversaciones recientes', 'A memória de curto prazo do grounded será limpa imediatamente e o contexto recente das conversas será perdido', 'Кратковременная память grounded будет немедленно очищена, и контекст недавних бесед будет утерян', 'La mémoire à court terme grounded sera effacée immédiatement et le contexte des conversations récentes sera perdu', 'Das grounded-Kurzzeitgedächtnis wird sofort geleert und der jüngste Gesprächskontext geht verloren'),
clearGroundedImpactNext: _('下一次对话开始时上下文将重建', 'Context will be rebuilt at the start of the next conversation', '下一次對話開始時上下文將重建', '次の会話開始時にコンテキストが再構築されます', '다음 대화 시작 시 컨텍스트가 다시 구축됩니다', 'Ngữ cảnh sẽ được xây dựng lại khi bắt đầu cuộc trò chuyện tiếp theo', 'El contexto se reconstruirá al iniciar la próxima conversación', 'O contexto será reconstruído no início da próxima conversa', 'Контекст будет восстановлен при начале следующей беседы', 'Le contexte sera reconstruit au début de la prochaine conversation', 'Der Kontext wird zu Beginn des nächsten Gesprächs neu aufgebaut'),
openMemory: _('打开记忆文件页', 'Open Memory Page'),
heroActive: _('正在整理上下文、筛选线索、沉淀长期记忆', 'Consolidating context, filtering signals, and promoting long-term memory'),
heroIdle: _('Dreaming 当前处于空闲状态,等待下一轮整理', 'Dreaming is idle and waiting for the next sweep'),
sceneTitle: _('梦境星图', 'Dream Constellation'),
sceneDesc: _('把短期记忆、grounded 信号与高频线索编织成长期记忆的可视化场景。', 'A visual scene where short-term memories, grounded signals, and recurring traces are woven into long-term memory.'),
sceneConstellation: _('梦境星簇', 'Constellation'),
sceneSignals: _('信号波纹', 'Signal Ripples'),
scenePromotions: _('提升轨迹', 'Promotion Trail'),
sceneQueue: _('待沉淀线索', 'Pending Traces'),
statusEnabled: _('已启用', 'Enabled'),
statusDisabled: _('未启用', 'Disabled'),
nextRun: _('下一次运行', 'Next run'),
timezone: _('时区', 'Timezone'),
storageMode: _('存储模式', 'Storage mode'),
promotedToday: _('今日提升', 'Promoted today'),
promotedTotal: _('累计提升', 'Promoted total'),
shortTerm: _('短期记忆', 'Short-term'),
grounded: _('Grounded', 'Grounded'),
signals: _('信号总数', 'Signals'),
diary: _('梦境日记', 'Dream Diary'),
diaryEmpty: _('还没有梦境日记', 'No dream diary yet'),
diaryEmptyHint: _('可以先运行一次回填,或等待 Dreaming 周期自然写入', 'Try backfilling once, or wait for the next Dreaming cycle to write entries'),
diaryLoadFailed: _('梦境日记加载失败', 'Dream diary failed to load'),
diarySections: _('梦境片段', 'Diary Sections'),
diaryRaw: _('原始 Markdown', 'Raw Markdown'),
diarySection: _('片段', 'Section'),
diaryPath: _('日记路径', 'Diary path'),
memoryPath: _('记忆文件', 'Memory file'),
phaseLight: _('Light', 'Light'),
phaseDeep: _('Deep', 'Deep'),
phaseRem: _('REM', 'REM'),
cron: _('计划', 'Schedule'),
notScheduled: _('未计划', 'Not scheduled'),
entriesShortTerm: _('短期条目', 'Short-term entries'),
entriesPromoted: _('已提升条目', 'Promoted entries'),
entriesSignals: _('高信号条目', 'High-signal entries'),
noEntries: _('暂无条目', 'No entries yet'),
phaseHits: _('阶段命中', 'Phase hits'),
groundedLed: _('grounded 主导', 'Grounded-led'),
source: _('来源', 'Source'),
retry: _('重试', 'Retry'),
configUnavailable: _('无法获取在线配置快照,请稍后重试', 'Unable to load live config snapshot, please retry'),
actionRunning: _('处理中...', 'Working...'),
pluginUnsupported: _('当前记忆插件可能不支持 Dreaming 配置', 'The current memory plugin may not support Dreaming config'),
rpcUnsupported: _('当前 Gateway 版本不支持部分 Dreaming 操作,请升级到 OpenClaw 2026.4.9+', 'Current Gateway version does not support some Dreaming operations, please upgrade to OpenClaw 2026.4.9+'),
}