docs: add agent setup prompt endpoint

This commit is contained in:
Andrey Avtomonov 2026-05-19 15:10:35 +02:00
parent b42f418adc
commit df0dde02e4
5 changed files with 238 additions and 1 deletions

View file

@ -3,6 +3,11 @@ import {
getLlmDocsPages,
getPageMarkdown,
} from "@/lib/llm-docs";
import {
agentSetupSlug,
isAgentSetupSlug,
readAgentSetupMarkdown,
} from "@/lib/agent-setup-markdown";
export const dynamic = "force-static";
@ -11,6 +16,14 @@ export async function GET(
props: { params: Promise<{ slug?: string[] }> },
) {
const params = await props.params;
if (isAgentSetupSlug(params.slug)) {
return new Response(await readAgentSetupMarkdown(), {
headers: {
"Content-Type": "text/markdown; charset=utf-8",
},
});
}
const page = getLlmDocsPage(params.slug);
if (!page) {
return new Response("Documentation page not found.\n", {
@ -29,5 +42,8 @@ export async function GET(
}
export function generateStaticParams() {
return getLlmDocsPages().map((page) => ({ slug: page.slug }));
return [
...getLlmDocsPages().map((page) => ({ slug: page.slug })),
{ slug: [...agentSetupSlug] },
];
}