A docs portal at /docs and a client developer's guide
The manual the binary carries, rendered on the client port: a sidebar of the documents in the console's reading order (now one list, llmgw.Manual, for both), heading anchors, links between documents kept in the portal and links to files outside the binary sent to the repository, no script. Public by default; landing.docs_sign_in sends visitors to sign in first. docs/clients.md shows the official OpenAI and Anthropic SDKs against llmgw in Python, TypeScript, Go and curl, with llmgw's headers; the portal's index, the landing page and the account page link to it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e59ff52932
commit
bd439aca29
17 files changed
+1328
-56
No files matched your search
@@ -2,7 +2,6 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -24,60 +23,17 @@ type docTopic struct {
|
||||
src func() string
|
||||
}
|
||||
|
||||
// docOrder is the documents in the order someone new reads them.
|
||||
var docOrder = []string{"console", "quick-install", "install", "node-onboarding", "onboarding",
|
||||
"guardrails", "choosing-models", "fabrics", "facility-aware-placement", "data", "reference", "development"}
|
||||
|
||||
// docTopics is the manual: the documents in llmgw.Manual's order, which the
|
||||
// gateway's docs portal shares, with a page for the commands after the
|
||||
// configuration reference — the one page only the command tree can write.
|
||||
func docTopics() []docTopic {
|
||||
read := func(path string) func() string {
|
||||
return func() string {
|
||||
b, err := fs.ReadFile(llmgw.Docs, path)
|
||||
if err != nil {
|
||||
return "# " + path + "\n\nNot in this build."
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
}
|
||||
titleOf := func(path string) string {
|
||||
b, _ := fs.ReadFile(llmgw.Docs, path)
|
||||
for _, l := range strings.Split(string(b), "\n") {
|
||||
if strings.HasPrefix(l, "# ") {
|
||||
return strings.TrimPrefix(l, "# ")
|
||||
}
|
||||
}
|
||||
return path
|
||||
}
|
||||
var out []docTopic
|
||||
seen := map[string]bool{}
|
||||
add := func(key, path string) {
|
||||
if seen[key] {
|
||||
return
|
||||
}
|
||||
if _, err := fs.Stat(llmgw.Docs, path); err != nil {
|
||||
return
|
||||
}
|
||||
seen[key] = true
|
||||
out = append(out, docTopic{key: key, title: titleOf(path), src: read(path)})
|
||||
}
|
||||
for _, k := range docOrder {
|
||||
add(k, "docs/"+k+".md")
|
||||
if k == "reference" {
|
||||
for _, d := range llmgw.Manual() {
|
||||
out = append(out, docTopic{key: d.Key, title: d.Title, src: d.Source})
|
||||
if d.Key == "reference" {
|
||||
out = append(out, docTopic{key: "commands", title: "Commands", src: commandsManual})
|
||||
seen["commands"] = true
|
||||
}
|
||||
}
|
||||
// Any document not placed above, so a new one is never missing.
|
||||
entries, _ := fs.ReadDir(llmgw.Docs, "docs")
|
||||
var rest []string
|
||||
for _, e := range entries {
|
||||
rest = append(rest, strings.TrimSuffix(e.Name(), ".md"))
|
||||
}
|
||||
sort.Strings(rest)
|
||||
for _, k := range rest {
|
||||
add(k, "docs/"+k+".md")
|
||||
}
|
||||
add("readme", "README.md")
|
||||
add("changes", "CHANGELOG.md")
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user