ww 369001824e feat(chat): 支持思考块实时流式与历史展示 (#191)
* feat: 添加文件下载功能,支持多 Terminal Backend

实现基于 FileProvider 抽象的文件下载能力,支持 local、Docker、SSH、
Singularity 四种 backend。

主要变更:
- 新增 FileProvider 接口及四种后端实现(含 SSH 命令注入防护)
- 新增 GET /api/hermes/download 下载路由(含 MIME 类型检测)
- 前端 Markdown 文件链接拦截下载 + 附件下载按钮
- 中英文 i18n 翻译
- 更新 README、CLAUDE.md 和设计文档

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: 添加文件浏览器与下载功能,支持目录浏览、文件编辑、预览和上传

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* build: add prepare script so 'npm install git+url' auto-builds dist/

Allows installing this package directly from git without a pre-built dist/.
When cloned via npm, prepare runs 'npm run build' if dist/ is missing,
producing the artifacts declared in the files[] field before packing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: use clipboard fallback for non-secure HTTP contexts

navigator.clipboard is undefined on HTTP intranet deployments (only
available in secure contexts). The previous synchronous calls threw
silently and the success toast still fired, making 'copy' actions
appear broken.

- Add packages/client/src/utils/clipboard.ts with execCommand fallback
  via a hidden textarea
- Use the helper in FileContextMenu (copy file path), CodexLoginModal
  (copy user code), NousLoginModal (copy user code), ChatPanel (copy
  session id)
- Each call now awaits the result and shows success/failure based on
  the actual outcome

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* i18n: backfill files/download translations for de, es, fr, ja, ko, pt

Add nav.files, files.* (39 keys), and download.* (9 keys) so the file
browser UI is fully localized in these six locales instead of falling
back to English.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(files): close preview when navigating or affected file changes

Opening a preview and then navigating directories, deleting the
previewed file, or renaming it left the preview pane stuck on stale
content because previewFile was never cleared.

- stores/hermes/files.ts:
  - fetchEntries clears previewFile on path change (in-place refresh
    keeps the preview).
  - deleteEntry / renameEntry clear preview/editor state when the
    affected entry matches the previewed/edited file or its parent.
  - Add isAffected(target, changed, isDir) helper.
- components/hermes/files/FilePreview.vue: replace the misleading
  common.cancel close button with a dedicated files.closePreview key
  plus an X icon and quaternary style.
- i18n: add files.closePreview to all 8 locales.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: 清理已完成功能的计划与设计文档

文件浏览器与文件下载功能均已被上游合并,对应的开发计划
与设计稿不再需要在 fork 中保留:
- plans/2025-07-20-file-browser.md
- plans/2026-04-20-file-download.md
- specs/2025-07-20-file-browser-design.md
- specs/2026-04-20-file-download-design.md

清理后本 fork 与 upstream/main 代码层面完全对齐。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: 添加 thinking 块分离与折叠展示设计稿(#164)

针对上游 issue #164,设计 assistant 消息中 <think>/<thinking>/<reasoning>
标签的识别、分离与可折叠展示方案。

关键决策(经 rubber-duck 审查修订):
- 不修改 Message.content 与持久化字段,确保 localStorage 向前兼容
- 耗时摘要改为纯运行时派生(store 内 Map),避免刷新/重连丢失
- 首版即实现代码块保护,避免误识别
- 流结束时未闭合标签降级为正文,防止吞答案
- 解析 computed 与 duration interval 分离,规避性能风险
- 解析器放置 packages/client/src/utils/ 避免反向依赖
- 显式不支持同名嵌套(罕见场景文档化)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: 添加 thinking 块分离与折叠实施计划(#164)

12 Task TDD 计划:
- Task 1-7:utils/thinking-parser.ts 纯函数模块 + 单元测试
- Task 8-9:chat store thinkingObservation Map 接入 SSE
- Task 10:8 语言 i18n 新增 6 条 key
- Task 11:MessageItem.vue 渲染折叠 UI + SCSS
- Task 12:构建/测试/手动验证/推送

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(thinking-parser): 首个闭合 <think> 标签拆分

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(thinking-parser): 覆盖多段/变体标签/大小写/空输入

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(thinking-parser): 流式 pending 与终止态降级

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(thinking-parser): 代码块保护避免误识别伪标签

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(thinking-parser): 同名嵌套与 chunk 边界行为

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(thinking-parser): countThinkingChars 辅助函数

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(thinking-parser): detectThinkingBoundary 边界检测

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(chat-store): 新增 thinkingObservation 运行时 Map

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(chat-store): message.delta 写入 thinking 边界 + switchSession 清理

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* i18n: 新增 thinking 块 6 条 key(8 语言)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(chat): MessageItem 渲染 thinking 折叠区

- 复用 tool-line 风格 chevron
- 两条响应链:parse computed + duration interval
- 流式+pending 强制展开
- show_reasoning 控制默认态

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(chat): 支持思考块实时流式与历史展示

- 扩展 Message 接口增加 reasoning 字段,mapHermesMessages 从
  HermesMessage.reasoning 透传历史会话的思考内容。
- RunEvent 类型新增 text 字段,chat store 处理三个新 SSE 事件:
  reasoning.delta / thinking.delta / reasoning.available。
- 思考时长观察:仅在 reasoning.delta 累积时记录起始时间戳,
  reasoning.available 时记录结束时间戳;无实时 delta 时不显示时长。
- MessageItem 采用双源渲染(reasoning 字段优先,<think> 标签作
  fallback),duration > 0 才展示耗时。
- 新增 3 条单测覆盖三个 SSE 事件;测试 32/32 通过。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(chat): reasoning 块不再短暂展示正文

根因:上游 hermes-agent run_agent.py:11275 在每次模型响应结束时用
assistant content[:500] 作为 reasoning.available 的 preview 负载,
致使 Web UI 把正文写入 last.reasoning,思考块短暂显示正文直到会话
轮询/刷新从 session DB 读回正确的 reasoning 字段。

修复:
- reasoning.available 事件不再写入 last.reasoning,仅用于标记计时
  结束(noteReasoningEnd);真实推理由 reasoning.delta 或会话 DB
  提供
- 新增 scrubBuggyReasoningInCache:hydration 时治愈 localStorage 里
  已被污染的 assistant 消息(reasoning == content 或前缀时丢弃)
- 两个 cache 加载入口(loadSessions / switchSession)均接入 scrubber

测试:新增 4 条单测,全套 280/280 通过。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-25 08:46:50 +08:00
2026-04-18 08:27:40 +08:00
2026-04-11 15:59:14 +08:00
2026-04-11 15:59:14 +08:00

Hermes Web UI 中文

A full-featured web dashboard for Hermes Agent.
Manage AI chat sessions, monitor usage & costs, configure platform channels,
schedule cron jobs, browse skills — all from a clean, responsive web interface.

npm install -g hermes-web-ui && hermes-web-ui start

Hermes Web UI Demo

Mobile

npm version license stars


Features

AI Chat

  • Real-time streaming via SSE with async run support
  • Multi-session management — create, rename, delete, switch between sessions
  • Session grouping by source (Telegram, Discord, Slack, etc.) with collapsible accordion
  • Active session indicator — live sessions pin to top with spinner icon
  • Sessions sorted by latest message time
  • Markdown rendering with syntax highlighting and code copy
  • Tool call detail expansion (arguments / result)
  • File upload support
  • File download support — download user-uploaded files and agent-generated files across local, Docker, SSH, and Singularity backends
  • Session search — Ctrl+K global search across all conversations
  • Global model selector — discovers models from ~/.hermes/auth.json credential pool
  • Per-session model display badge and context token usage

Platform Channels

Unified configuration for 8 platforms in one page:

Platform Features
Telegram Bot token, mention control, reactions, free-response chats
Discord Bot token, mention, auto-thread, reactions, channel allow/ignore lists
Slack Bot token, mention control, bot message handling
WhatsApp Enable/disable, mention control, mention patterns
Matrix Access token, homeserver, auto-thread, DM mention threads
Feishu (Lark) App ID / Secret, mention control
WeChat QR code login (scan in browser, auto-save credentials)
WeCom Bot ID / Secret
  • Credential management writes to ~/.hermes/.env
  • Channel behavior settings write to ~/.hermes/config.yaml
  • Auto gateway restart on config change
  • Per-platform configured/unconfigured status detection

Usage Analytics

  • Total token usage breakdown (input / output)
  • Session count with daily average
  • Estimated cost tracking & cache hit rate
  • Model usage distribution chart
  • 30-day daily trend (bar chart + data table)

Scheduled Jobs

  • Create, edit, pause, resume, delete cron jobs
  • Trigger immediate execution
  • Cron expression quick presets

Model Management

  • Auto-discover models from credential pool (~/.hermes/auth.json)
  • Fetch available models from each provider endpoint (/v1/models)
  • Add, update, and delete providers (preset & custom OpenAI-compatible)
  • OpenAI Codex & Nous Portal OAuth login
  • Provider URL auto-detection for non-v1 API versions (e.g. /v4)
  • Provider-level model grouping with default model switching

Multi-Profile & Gateway

  • Create, rename, delete, and switch between Hermes profiles
  • Clone existing profile or import from archive (.tar.gz)
  • Export profile for backup or sharing
  • Multi-gateway management — start, stop, and monitor gateway per profile
  • Auto port conflict resolution
  • Profile-scoped configuration and cache isolation

File Browser

  • Browse files on remote backends (local, Docker, SSH, Singularity)
  • Upload, download, rename, copy, move, and delete files
  • Create directories
  • View file content with syntax highlighting

Group Chat

  • Multi-agent chat rooms with real-time messaging via Socket.IO
  • @mention routing — mention an agent to trigger a contextual reply
  • Context compression — automatic conversation summarization when history exceeds token threshold
  • Typing status and reply progress indicators
  • Room creation, deletion, and invite code management
  • Agent management — add/remove agents from rooms with per-agent profiles
  • SQLite message persistence
  • Mobile responsive with collapsible sidebar

Skills & Memory

  • Browse and search installed skills
  • View skill details and attached files
  • User notes and profile management

Logs

  • View agent / gateway / error logs
  • Filter by log level, log file, and keyword
  • Structured log parsing with HTTP access log highlighting

Authentication

  • Token-based auth (auto-generated on first run or set via AUTH_TOKEN env var)
  • Optional username/password login — set via settings page after initial token auth
  • Auth can be disabled with AUTH_DISABLED=1

Settings

  • Display (streaming, compact mode, reasoning, cost display)
  • Agent (max turns, timeout, tool enforcement)
  • Memory (enable/disable, char limits)
  • Session reset (idle timeout, scheduled reset)
  • Privacy (PII redaction)
  • Model settings (default model & provider)
  • API server configuration

Web Terminal

  • Integrated terminal powered by node-pty and @xterm/xterm
  • Multi-session support — create, switch between, and close terminal sessions
  • Real-time keyboard input and PTY output streaming via WebSocket
  • Window resize support

Quick Start

npm install -g hermes-web-ui
hermes-web-ui start

Open http://localhost:8648

One-line Setup (Auto-detect OS)

Automatically installs Node.js (if missing) and hermes-web-ui on Debian/Ubuntu/macOS:

bash <(curl -fsSL https://raw.githubusercontent.com/EKKOLearnAI/hermes-web-ui/main/scripts/setup.sh)

WSL

bash <(curl -fsSL https://raw.githubusercontent.com/EKKOLearnAI/hermes-web-ui/main/scripts/setup.sh)
hermes-web-ui start

WSL auto-detects and uses hermes gateway run for background startup (no launchd/systemd).

Docker Compose

Run Web UI together with Hermes Agent:

# Use pre-built image (Recommended)
WEBUI_IMAGE=ekkoye8888/hermes-web-ui:latest docker compose up -d hermes-agent hermes-webui

# Or build from source
docker compose up -d --build hermes-agent hermes-webui

docker compose logs -f hermes-webui

Open http://localhost:6060

  • Persistent Hermes data is stored in ./hermes_data
  • Web UI auth token is stored in ./hermes_data/hermes-web-ui/.token
  • On first run with auth enabled, the token is printed to container logs
  • All runtime settings are environment-variable driven in docker-compose.yml

For detailed notes and troubleshooting, see docs/docker.md.

CLI Commands

Command Description
hermes-web-ui start Start in background (daemon mode)
hermes-web-ui start --port 9000 Start on custom port
hermes-web-ui stop Stop background process
hermes-web-ui restart Restart background process
hermes-web-ui status Check if running
hermes-web-ui update Update to latest version & restart
hermes-web-ui -v Show version number
hermes-web-ui -h Show help message

Auto Configuration

On startup the BFF server automatically:

  • Validates ~/.hermes/config.yaml and fills missing api_server fields
  • Backs up original config to config.yaml.bak if modified
  • Detects and starts the gateway if needed
  • Resolves port conflicts (kills stale processes)
  • Opens browser on successful startup

Development

git clone https://github.com/EKKOLearnAI/hermes-web-ui.git
cd hermes-web-ui
npm install
npm run dev
npm run build   # outputs to dist/

Architecture

Browser → BFF (Koa, :8648) → Hermes Gateway (:8642)
                ↓
           Hermes CLI (sessions, logs, version)
                ↓
           ~/.hermes/config.yaml  (channel behavior)
           ~/.hermes/auth.json    (credential pool)
           Tencent iLink API      (WeChat QR login)

The frontend is designed with multi-agent extensibility — all Hermes-specific code is namespaced under hermes/ directories (API, components, views, stores), making it straightforward to add new agent integrations alongside.

The BFF layer handles API proxy (with path rewriting), SSE streaming, file upload and download (multi-backend: local/Docker/SSH/Singularity), session CRUD via CLI, config/credential management, WeChat QR login, model discovery, skills/memory management, log reading, and static file serving.

Tech Stack

Frontend: Vue 3 + TypeScript + Vite + Naive UI + Pinia + Vue Router + vue-i18n + SCSS + markdown-it + highlight.js

Backend: Koa 2 (BFF server) + node-pty (web terminal)

Star History

Star History Chart

Sponsor

如果你觉得这个项目对你有帮助,欢迎支持我:

Sponsor

License

MIT

Languages
TypeScript 72.7%
Vue 23%
Python 2.7%
JavaScript 1.1%
SCSS 0.3%