贡献 / #1783
#1783 web: add persistent chats and MCP management
open · @VykosX · 0 评论 · 去 GitHub 看
说明
## Summary Adds a native-feeling persistence and MCP-management layer to Strata's existing Web UI without changing the inference engine or model-specific defaults. ## What changed - Persist Web UI conversations as JSON under `conversations/`, with a docked conversation list, switching, New Chat creating a new conversation instead of clearing history, and delete confirmation. - Add a dedicated **MCP** tab between Monitor and About. - Manage any number of MCP servers using either transport Strata already supports: - Streamable HTTP via `url`. - stdio via `command`, JSON `args`, optional `cwd`, and JSON `env`. - Show per-server connection state, transport, and enumerated tools. - Add exact context usage through Strata's current template/tokenizer path, displayed as a semi-circular used/total gauge. - Add dependency-free syntax highlighting for fenced code blocks while preserving the existing Markdown renderer and Strata styling. ### MCP configuration safety The UI is a frontend for Strata's existing MCP backend rather than a parallel protocol implementation. - HTTP header values and stdio environment values are never returned to the browser. - Hidden HTTP headers are preserved only while the URL is unchanged. - Hidden stdio env values are preserved only while command/args/cwd are unchanged; changing the launch identity drops them instead of silently forwarding credentials to a different process. - Editing/removing one named server leaves the others untouched. - stdio is explicitly described as starting a local process with the user's rights. - Changes are persisted to the current run config and take effect after restarting Strata. ### Conversation persistence - UUID-backed IDs are validated before becoming paths. - Writes use a unique temporary file followed by atomic replace. - Conversation files are capped at 64 MiB. - `/conversations/` is gitignored. - The existing browser-local chat remains only as a fallback/migration path. ### Context meter `/context-count` runs the current OpenAI-shaped Web UI history through Strata's own conversion/template/tokenizer path, including MCP tool schemas when enabled. The displayed count is therefore the actual prompt shape Strata will send, not a character estimate. ## Validation Clean worktree based on current `origin/main`: - `serve.test_local_ui`: **9/9 passed** - `serve.test_server`: **271/271 passed** - `serve.test_mcp`: **25/25 passed** - `serve.test_runconfig`: **9/9 passed** - `node --check serve/web/app.js`: passed - Python compile checks: passed - `git diff --check`: passed A live acceptance test also added a stdio server beside an existing HTTP server, verified both were listed together, confirmed secret env values were not returned to the browser, verified the preserve/drop rules across edits, removed only the temporary server, and confirmed the original server remained unchanged. ## Screenshots  
本站相关内容
相关页面的快捷入口。