Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/prompt-templates/create-local-circuit-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down