Skip to content

feat(dashboard): add chat interface via API server proxy#9903

Open
SHL0MS wants to merge 1 commit into
NousResearch:mainfrom
SHL0MS:feat/dashboard-chat
Open

feat(dashboard): add chat interface via API server proxy#9903
SHL0MS wants to merge 1 commit into
NousResearch:mainfrom
SHL0MS:feat/dashboard-chat

Conversation

@SHL0MS

@SHL0MS SHL0MS commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Chat tab to the dashboard. Proxies to the gateway's existing API server (/v1/chat/completions) — no new agent lifecycle code, no new dependencies.

Backend — 2 endpoints, 110 lines

POST /api/chat/send — SSE streaming proxy to localhost:8642/v1/chat/completions

  • Forwards messages + optional X-Hermes-Session-Id for session continuity
  • Passes API_SERVER_KEY to the API server when set
  • Handles empty stream (agent internal errors): detects finish_reason without content, falls back to a non-streaming request to surface the actual error message
  • Respects API_SERVER_PORT env var

GET /api/chat/status — health check, hits the API server's /health endpoint

Both are protected by the existing auth middleware (#9800).

Frontend — ChatPage.tsx, 212 lines

  • SSE stream parsing (OpenAI-compatible choices[0].delta.content chunks)
  • Markdown rendering via existing Markdown component
  • Session continuity (stores session ID from first response, sends on subsequent messages)
  • Auto-scroll to bottom on new content
  • Auto-resize textarea, Enter to send, Shift+Enter for newline
  • When gateway isn't running: "Chat unavailable" with hermes gateway start instruction
  • i18n: English + Chinese translations

Requires

The gateway must be running with the api_server platform enabled:

# ~/.hermes/config.yaml
platforms:
  api_server:
    enabled: true

Then hermes gateway start. The Chat tab detects this automatically and shows setup instructions if not configured.

Files changed

File Lines What
hermes_cli/web_server.py +110 Chat proxy endpoints
web/src/pages/ChatPage.tsx +212 Chat UI (new file)
web/src/App.tsx +4 Add Chat route + nav item
web/src/lib/api.ts +4 checkChatStatus() method
web/src/i18n/types.ts +9 Chat string types
web/src/i18n/en.ts +8 English strings
web/src/i18n/zh.ts +8 Chinese strings

Adds a Chat tab to the dashboard that proxies to the gateway's existing
API server (/v1/chat/completions) with SSE streaming.

Backend (web_server.py):
- POST /api/chat/send — proxies to API server with streaming, falls
  back to non-streaming request when stream returns empty content
  (surfaces agent errors instead of hanging)
- GET /api/chat/status — health check for API server availability

Frontend (ChatPage.tsx):
- SSE stream parsing (OpenAI-compatible chunks)
- Markdown rendering for assistant responses
- Session continuity via X-Hermes-Session-Id header
- Auto-scroll, auto-resize textarea, Enter to send
- Unavailable state with setup instructions when gateway not running

Requires the gateway running with api_server platform enabled.
i18n: en + zh translations for chat UI strings.
@alt-glitch alt-glitch mentioned this pull request Apr 22, 2026
11 tasks
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants