mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
feat: make llms text endpoints spec compliant
Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
This commit is contained in:
parent
0814755e88
commit
d20adaeef5
20
docs/src/app/llms-full.txt/route.ts
Normal file
20
docs/src/app/llms-full.txt/route.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { getLLMText } from 'lib/get-llm-text';
|
||||
import { apiSource, source } from 'lib/source';
|
||||
|
||||
// cached forever
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET() {
|
||||
const docsPages = source.getPages();
|
||||
const apiPages = apiSource.getPages();
|
||||
|
||||
const docsPromises = docsPages.map(getLLMText);
|
||||
const apiPromises = apiPages.map(getLLMText);
|
||||
|
||||
const [docsContent, apiContent] = await Promise.all([
|
||||
Promise.all(docsPromises),
|
||||
Promise.all(apiPromises)
|
||||
]);
|
||||
|
||||
return new Response([...docsContent, ...apiContent].join('\n\n'));
|
||||
}
|
||||
@ -1,25 +1,36 @@
|
||||
import { getLLMText } from 'lib/get-llm-text';
|
||||
import { apiSource, source } from 'lib/source';
|
||||
|
||||
// cached forever
|
||||
export const revalidate = false;
|
||||
|
||||
function formatPageListItem(page: {
|
||||
data: {
|
||||
title: string;
|
||||
description?: string;
|
||||
};
|
||||
url: string;
|
||||
}) {
|
||||
const description = page.data.description?.trim();
|
||||
const notes = description ? `: ${description.replace(/\n+/g, ' ')}` : '';
|
||||
return `- [${page.data.title}](https://docs.hexclave.com${page.url}.md)${notes}`;
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
// Get all pages from both main docs and API docs
|
||||
const docsPages = source.getPages();
|
||||
const apiPages = apiSource.getPages();
|
||||
|
||||
// Process all pages
|
||||
const docsPromises = docsPages.map(getLLMText);
|
||||
const apiPromises = apiPages.map(getLLMText);
|
||||
const docs = docsPages.map(formatPageListItem).join('\n');
|
||||
const api = apiPages.map(formatPageListItem).join('\n');
|
||||
|
||||
const [docsContent, apiContent] = await Promise.all([
|
||||
Promise.all(docsPromises),
|
||||
Promise.all(apiPromises)
|
||||
]);
|
||||
return new Response(`# Hexclave
|
||||
|
||||
// Combine all content
|
||||
const allContent = [...docsContent, ...apiContent];
|
||||
> Hexclave is an authentication and user management platform for SaaS apps, with teams, RBAC, payments, and analytics. Formerly Stack Auth.
|
||||
|
||||
return new Response(allContent.join('\n\n'));
|
||||
## Docs
|
||||
|
||||
${docs}
|
||||
|
||||
## API Reference
|
||||
|
||||
${api}`);
|
||||
}
|
||||
|
||||
@ -6,7 +6,16 @@ import { buildSkillSitePrompt, skillSitePrompt } from "../unified-prompts/skill-
|
||||
export const llmsTxt = deindent`
|
||||
# Hexclave
|
||||
|
||||
> Hexclave is an authentication and user management platform for SaaS apps, with teams, RBAC, payments, and analytics. Formerly Stack Auth.
|
||||
|
||||
${remindersPrompt}
|
||||
|
||||
## Docs
|
||||
|
||||
- [Full documentation](https://skill.hexclave.com/full): LLM-optimized Hexclave documentation
|
||||
- [Ask questions](https://skill.hexclave.com/ask): Q&A endpoint for Hexclave
|
||||
- [Human documentation](https://docs.hexclave.com): Browse the docs, or add \`.md\` to a page URL for markdown
|
||||
- [MCP server](https://mcp.hexclave.com): Hexclave documentation for MCP clients
|
||||
`;
|
||||
|
||||
export const llmsFullTxt = skillSitePrompt;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user