mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-19 08:28:06 +02:00
feat(docs-site): add agent-readable docs routes
This commit is contained in:
parent
b440c75092
commit
dfa4651ebc
6 changed files with 211 additions and 1 deletions
11
docs-site/app/llms-full.txt/route.ts
Normal file
11
docs-site/app/llms-full.txt/route.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { buildLlmsFullTxt } from "@/lib/llm-docs";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export async function GET() {
|
||||
return new Response(await buildLlmsFullTxt(), {
|
||||
headers: {
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
27
docs-site/app/llms.mdx/docs/[[...slug]]/route.ts
Normal file
27
docs-site/app/llms.mdx/docs/[[...slug]]/route.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import {
|
||||
getLlmDocsPage,
|
||||
getLlmDocsPages,
|
||||
getPageMarkdown,
|
||||
} from "@/lib/llm-docs";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export async function GET(
|
||||
_request: Request,
|
||||
props: { params: Promise<{ slug?: string[] }> },
|
||||
) {
|
||||
const params = await props.params;
|
||||
const page = getLlmDocsPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return new Response(await getPageMarkdown(page), {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getLlmDocsPages().map((page) => ({ slug: page.slug }));
|
||||
}
|
||||
11
docs-site/app/llms.txt/route.ts
Normal file
11
docs-site/app/llms.txt/route.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { buildLlmsTxt } from "@/lib/llm-docs";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export function GET() {
|
||||
return new Response(buildLlmsTxt(), {
|
||||
headers: {
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue