From ac2029b4af9dce6991e0fec534fa13996cee2908 Mon Sep 17 00:00:00 2001 From: mantrakp04 Date: Mon, 23 Mar 2026 12:06:20 -0700 Subject: [PATCH] Add LLM text retrieval route ### Summary of Changes - Introduced a new `GET` function in `route.ts` to aggregate and return LLM texts from both local and API sources. - Set `revalidate` to false to optimize static content delivery. - Implemented response formatting to return plain text with appropriate headers. This addition enhances the LLM functionality by consolidating text retrieval into a single endpoint, improving efficiency and usability. --- docs/src/app/llms-full.txt/route.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/src/app/llms-full.txt/route.ts diff --git a/docs/src/app/llms-full.txt/route.ts b/docs/src/app/llms-full.txt/route.ts new file mode 100644 index 000000000..aec6a2009 --- /dev/null +++ b/docs/src/app/llms-full.txt/route.ts @@ -0,0 +1,15 @@ +import { getLLMText } from '../../../lib/get-llm-text'; +import { apiSource, source } from '../../../lib/source'; + +export const revalidate = false; + +export async function GET() { + const pages = [...source.getPages(), ...apiSource.getPages()]; + const texts = await Promise.all(pages.map(getLLMText)); + + return new Response(texts.join('\n\n'), { + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + }, + }); +}