WeKnora/website-docs/embed.go

13 lines
511 B
Go
Raw Normal View History

feat(agent): let the WeKnora assistant read the bundled documentation (#4303) * feat(agent): let the WeKnora assistant read the bundled documentation Embeds the website-docs pages (01-07) into the server and adds search_weknora_docs / read_weknora_doc for the built-in assistant, so it answers how WeKnora works from the docs of the running version. - pages split into sections with the site's VitePress anchors; Mermaid dropped, screenshots reduced to captions, links rewritten to public URLs - in-memory BM25 over sections, with Han character pairs and whole identifiers such as OLLAMA_BASE_URL or v0.8.3 - granted to the built-in assistant by ID, like the operation tools; the docs are public, so no signed-in user is required - tests check every embedded page parses and every internal link resolves * fix(agent): read long doc sections to the end and keep docs on a broken page - read_weknora_doc takes an offset: a section too long for one read is cut at a line break and returns next_offset, so leaf sections such as the model field reference are readable to the end instead of losing the tail. - Reads follow the registry's output budget (capped at 8000 runes). - Percent-encoded anchors, as a browser copies them, and http:// doc URLs resolve. - productdocs.Load leaves out a page it cannot parse and reports it, so one broken page no longer withholds the documentation tools. - App CI runs on changes to the embedded doc pages and the sidebar config, where the parse and link tests now apply.
2026-10-15 05:06:58 +00:00
// Package websitedocs embeds the published documentation pages so the server
// can read the docs of its own version. Only the pages under the numbered
// sections are embedded; the site build, homepage and sample data are not.
package websitedocs
import "embed"
// Pages holds the published Markdown pages, named "<section>/<page>.md".
//
//go:embed 01-getting-started/*.md 02-architecture/*.md 03-features/*.md 04-api/*.md
//go:embed 05-clients/*.md 06-development/*.md 07-releases/*.md
var Pages embed.FS