Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame contribute delete
831 Bytes
import { docs } from "@/.velite"
import { BASE_URL } from "@/lib/constants"
export const dynamic = "force-static"
export async function GET() {
const baseUrl = `${BASE_URL}/llms-component`
const components = new Set<{ id: string; path: string; fullPath: string }>()
docs
.filter(
(doc) =>
doc.slug.startsWith("docs/components/") &&
!doc.slug.includes("concepts"),
)
.forEach((doc) => {
const parts = doc.slug.split("/")
const component = parts[2]
components.add({
id: component,
path: `${baseUrl}/${component}.txt`,
fullPath: `${baseUrl}/${component}-full.txt`,
})
})
return Response.json(Array.from(components), {
headers: {
"Content-Type": "application/json",
"Cache-Control": "public, max-age=3600",
},
})
}