Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
fix(docs): add error handling to getLLMText for llms.txt
Sushmithamalleshc3e4824b9735
diff --git a/docs/lib/source.ts b/docs/lib/source.tsindex 9ee5288f7..752baa128 100644--- a/docs/lib/source.ts+++ b/docs/lib/source.ts@@ -177,7 +177,33 @@ function mdxToCleanMarkdown(content: string): string {}export async function getLLMText(page: InferPageType<typeof source>) {- const content = await page.data.getText('raw');+ // Fall back to description if getText is not available+ if (typeof page.data.getText !== 'function') {+ return `# ${page.data.title} (${page.url})++${page.data.description || ''}`;+ }++ // Try 'processed' mode first (works in serverless), then 'raw' (works locally)+ // Both can fail in different environments, so handle gracefully+ let content: string | null = null;++ try {+ content = await page.data.getText('processed');+ } catch {+ try {+ content = await page.data.getText('raw');+ } catch {+ // Both failed, fall back to description+ }+ }++ if (!content) {+ return `# ${page.data.title} (${page.url})++${page.data.description || ''}`;+ }+const cleanContent = mdxToCleanMarkdown(content);return `# ${page.data.title} (${page.url})