File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { source } from "@/lib/source"
2+ import { getLLMText } from "@/lib/get-llm-text"
3+
4+ export const revalidate = false
5+
6+ export async function GET ( ) {
7+ const scan = source . getPages ( ) . map ( getLLMText )
8+ const scanned = await Promise . all ( scan )
9+
10+ return new Response ( scanned . join ( "\n\n" ) )
11+ }
Original file line number Diff line number Diff line change 1+ import { remark } from "remark"
2+ import remarkGfm from "remark-gfm"
3+ import remarkMdx from "remark-mdx"
4+ import { remarkInclude } from "fumadocs-mdx/config"
5+ import { source } from "@/lib/source"
6+ import type { InferPageType } from "fumadocs-core/source"
7+
8+ const processor = remark ( ) . use ( remarkMdx ) . use ( remarkInclude ) . use ( remarkGfm )
9+
10+ export async function getLLMText ( page : InferPageType < typeof source > ) {
11+ const processed = await processor . process ( {
12+ path : page . data . _file . absolutePath ,
13+ value : page . data . content ,
14+ } )
15+
16+ return `# ${ page . data . title }
17+ URL: ${ page . url }
18+
19+ ${ page . data . description }
20+
21+ ${ processed . value } `
22+ }
You can’t perform that action at this time.
0 commit comments