Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zhiliao logo

Zhiliao(知了)

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.

What it does

  • Hot topics — The home page calls zhihu-cli hot and 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 zhihu or search global subcommand and calls answer in parallel for a quick answer.
  • My Zhihu — The Me page maps to the CLI me commands 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 set followed by init. 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 zhihuCLI tool 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.

Requirements

  • 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.

Run Zhiliao

Run the included executable

From the project root:

.\zhiliao.exe

Then open the link printed by the serverhttp://127.0.0.1:8787.

Run from source

go run .

The default port is 8787. Set PORT to use another port:

$env:PORT = "9000"
go run .

Authenticate

  1. Open Settings.
  2. Paste your Zhihu access token.
  3. Set the desired hot-topic count and Me-page size.
  4. 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.

Configure the AI agent

  1. Open Settings.
  2. Enter an OpenAI-compatible Chat Completions endpoint, such as https://api.example.com/v1.
  3. Enter the model name and API key.
  4. Click 测试连接 (Test connection) to verify the provider, then click 保存代理设置 (Save agent settings).
  5. 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.

Project layout

.
├── 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

Build

go test ./...
go build -o zhiliao.exe .

The executable is intentionally ignored by Git. Build it locally when you need a distributable Windows binary.

Notes

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.

About

Zhiliao is a frontend for the recently released ZhihuCLI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages