diff --git a/lib/prompt-templates/create-local-circuit-prompt.ts b/lib/prompt-templates/create-local-circuit-prompt.ts index a93f11f..836b1c5 100644 --- a/lib/prompt-templates/create-local-circuit-prompt.ts +++ b/lib/prompt-templates/create-local-circuit-prompt.ts @@ -44,12 +44,28 @@ export const createLocalCircuitPrompt = async () => { .join("\n") .replace(/\n\n+/g, "\n\n") + // Pull in the auto-generated tscircuit docs feed. + // Resilient: if the fetch fails (offline, 5xx, etc.) we continue without it + // rather than breaking the whole prompt build. + let autoGeneratedDocs = "" + try { + autoGeneratedDocs = await fetchFileContent( + "https://docs.tscircuit.com/ai.txt", + ) + } catch { + autoGeneratedDocs = "" + } + + const autoGeneratedDocsSection = autoGeneratedDocs + ? `## Auto-generated tscircuit docs\n\n${autoGeneratedDocs}\n\n` + : "" + return ` You are an expert in electronic circuit design and tscircuit, and your job is to create a circuit board in tscircuit with the user-provided description. YOU MUST ABIDE BY THE RULES IN THE RULES SECTION -## tscircuit API overview +${autoGeneratedDocsSection}## tscircuit API overview Here's an overview of the tscircuit API: