Zhiliao is a modern web frontend for zhihu-cli. It turns the CLI into a calm, visual knowledge workspace: browse hot topics, search Zhihu or global sources, inspect quick answers, explore your own Zhihu content, and manage authentication from one local web app.
- Hot topics — The home page calls
zhihu-cli hotand presents topics as responsive cards. Thumbnails and original links are shown when available. - Search — Choose between the Zhihu and global search scopes, then submit a query. Zhiliao calls the corresponding
search zhihuorsearch globalsubcommand and callsanswerin parallel for a quick answer. - My Zhihu — The Me page maps to the CLI
mecommands and provides tabs for your content, followees, and recent favorites. Content can be filtered by all, answers, articles, pins, or questions. Each content card can use the configured LLM to extract keywords, search Zhihu, rank matches, and show up to three transient relevant posts. - Settings — Store and verify the Zhihu access token through
auth setfollowed byinit. The page also shows the CLI version and controls hot-topic count and Me-page size. - AI agent — Open the collapsible assistant in the bottom-right corner to ask questions in Chinese. Before answering, the agent must call the local
zhihuCLItool to retrieve relevant information and will not answer from its own world knowledge. - Raw data access — Cards keep the original CLI fields available in expandable JSON sections, so the visual presentation does not hide the source response.
- Go 1.22 or later, when building from source.
- A supported installation of
zhihu-cli. - Windows or macOS, matching the platform installer script in
scripts/.
On first launch, Zhiliao checks for the CLI in the expected local installation directory. If it is missing, open Settings and approve installation. Zhiliao runs:
- Windows:
powershell -ExecutionPolicy Bypass -File scripts/setup.ps1 - macOS:
bash scripts/setup.sh
Installation and CLI execution details are printed in the backend log, including command arguments, duration, exit status, and a capped output preview.
From the project root:
.\zhiliao.exeThen open the link printed by the serverhttp://127.0.0.1:8787.
go run .The default port is 8787. Set PORT to use another port:
$env:PORT = "9000"
go run .- Open Settings.
- Paste your Zhihu access token.
- Set the desired hot-topic count and Me-page size.
- Click 保存并验证.
The token is passed to zhihu-cli auth set through standard input and then verified with zhihu-cli init. Zhiliao does not store the token in its own settings file; the CLI manages the credential.
- Open Settings.
- Enter an OpenAI-compatible Chat Completions endpoint, such as
https://api.example.com/v1. - Enter the model name and API key.
- Click 测试连接 (Test connection) to verify the provider, then click 保存代理设置 (Save agent settings).
- Open 问知了 (Ask Zhiliao) in the bottom-right corner and submit a question.
The agent always uses the zhihuCLI tool before producing an answer. It can retrieve hot topics, search Zhihu or global sources, request a Zhihu answer, read the authenticated user's content, followees, and favorites, or inspect CLI status and version. The agent always responds in simplified Chinese, regardless of the language used in the question.
The LLM endpoint, model, and API key are stored in the local zhiliao-settings.json file. Keep this file private because it contains the configured API key.
.
├── main.go Go HTTP server and zhihu-cli adapter
├── web/
│ ├── index.html HTML shell
│ ├── app.js UI rendering and interactions
│ └── styles.css Zhiliao visual theme
├── scripts/
│ ├── setup.ps1 Windows installer
│ └── setup.sh macOS installer
├── zhiliao.png Application logo
├── manifest.json zhihu-cli package metadata
└── go.mod Go module definition
go test ./...
go build -o zhiliao.exe .The executable is intentionally ignored by Git. Build it locally when you need a distributable Windows binary.
Zhiliao is a local web server. Its API routes execute the CLI on the same machine and return the CLI JSON to the browser. External links from content cards open in a new browser tab.
