mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
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.
This commit is contained in:
parent
adbbe44dbf
commit
ac2029b4af
15
docs/src/app/llms-full.txt/route.ts
Normal file
15
docs/src/app/llms-full.txt/route.ts
Normal file
@ -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',
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user