mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
17 lines
554 B
TypeScript
17 lines
554 B
TypeScript
import type { Route } from './+types/mdx';
|
|
import { getLLMText, source } from '@/lib/source';
|
|
|
|
export async function loader({ params }: Route.LoaderArgs) {
|
|
const slugs = params['*'].split('/').filter((v) => v.length > 0);
|
|
// remove the appended "content.md"
|
|
slugs.pop();
|
|
const page = source.getPage(slugs);
|
|
if (!page) {
|
|
return new Response('not found', { status: 404 });
|
|
}
|
|
return new Response(await getLLMText(page), {
|
|
headers: {
|
|
'Content-Type': 'text/markdown; charset=utf-8',
|
|
},
|
|
});
|
|
} |