@yanghonghang asked on X for DeepSeek's open-source web chat page
(deepseek-ai/chat-demo) to run on magpie, with its search and link
reading served by magpie's own. magpie now serves it at
<gateway>/deepseek-chat/, with no setup:
- The page is the v0.1.1 release (MIT, LICENSE kept in the zip),
embedded and served from memory. Its API origin is rewritten to
location.origin+"/deepseek-chat", and magpie.js adds a model picker:
any magpie model answers, sent as the magpie_chat_model cookie.
- On this computer the page needs no key of the user's. Another
computer types a gateway key, as for every other route.
- POST anthropic/v1/messages maps deepseek_web_search to magpie's
web_search_20250305 and deepseek_read_url to a read_url tool magpie
runs itself with fetchPage between rounds. Each round goes through the
gateway's own Messages route, so routing, keys, limits and usage are
the same as an agent's.
- Files (images, PDFs, text) are kept in memory until a restart; Word,
PowerPoint and EPUB are refused with 415. ASR and TTS go to the speech
models set in magpie.
- Only the page's GET/HEAD static files are keyless (readOnlyRoutes and
lanGuard's chatPageOpen), served under a strict CSP. Its models, chat,
files and speech routes need a key from another computer, and a
read-only key is refused on each (readOnlyRefused).
Docs: docs/subsystems/gateway-routing.md, "DeepSeek's chat page".
Real use: a sandbox magpie (sandbox HOME, port 3486 on mote) served the
page in Chromium; a Claude answer with web search showed citations and
source chips, a DeepSeek link read answered from the page, and the
picker was checked in light and dark.
Run: go test -tags nogui -run 'TestChatPage|TestReadOnlyKeyEveryRoute'
./internal/gateway on mica, ok. Without this change every TestChatPage*
is red (the routes 404), and TestReadOnlyKeyEveryRoute is red with the
chat routes missing from readOnlyRefused.