Parameterize sys prompt (#1082)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Parameterized the system prompt and tokenized it in e2e dumps to make
snapshots smaller and stable. No runtime behavior changes; future prompt
edits won’t churn tests.
- **Refactors**
- Exported BUILD_SYSTEM_PREFIX and BUILD_SYSTEM_POSTFIX from
system_prompt.ts.
- Updated test_helper to replace the full prompt with
${BUILD_SYSTEM_PREFIX}/${BUILD_SYSTEM_POSTFIX} tokens in message dumps.
- Regenerated e2e snapshots to use tokens, reducing ~270 lines per
snapshot.
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
@@ -56,7 +56,7 @@ This structured thinking ensures you:
|
||||
4. Maintain a consistent approach to problem-solving
|
||||
`;
|
||||
|
||||
const BUILD_SYSTEM_PROMPT = `
|
||||
export const BUILD_SYSTEM_PREFIX = `
|
||||
<role> You are Dyad, an AI editor that creates and modifies web applications. You assist users by chatting with them and making changes to their code in real-time. You understand that users can see a live preview of their application in an iframe on the right side of the screen while you make code changes.
|
||||
You make efficient and effective changes to codebases while following best practices for maintainability and readability. You take pride in keeping things simple and elegant. You are friendly and helpful, always aiming to provide clear explanations. </role>
|
||||
|
||||
@@ -315,11 +315,9 @@ Coding guidelines
|
||||
- Don't catch errors with try/catch blocks unless specifically requested by the user. It's important that errors are thrown since then they bubble back to you so that you can fix them.
|
||||
|
||||
DO NOT OVERENGINEER THE CODE. You take great pride in keeping things simple and elegant. You don't start by writing very complex error handling, fallback mechanisms, etc. You focus on the user's request and make the minimum amount of changes needed.
|
||||
DON'T DO MORE THAN WHAT THE USER ASKS FOR.
|
||||
DON'T DO MORE THAN WHAT THE USER ASKS FOR.`;
|
||||
|
||||
[[AI_RULES]]
|
||||
|
||||
Directory names MUST be all lower-case (src/pages, src/components, etc.). File names may use mixed-case if you like.
|
||||
export const BUILD_SYSTEM_POSTFIX = `Directory names MUST be all lower-case (src/pages, src/components, etc.). File names may use mixed-case if you like.
|
||||
|
||||
# REMEMBER
|
||||
|
||||
@@ -333,6 +331,12 @@ Directory names MUST be all lower-case (src/pages, src/components, etc.). File n
|
||||
> Do NOT use <dyad-file> tags in the output. ALWAYS use <dyad-write> to generate code.
|
||||
`;
|
||||
|
||||
export const BUILD_SYSTEM_PROMPT = `${BUILD_SYSTEM_PREFIX}
|
||||
|
||||
[[AI_RULES]]
|
||||
|
||||
${BUILD_SYSTEM_POSTFIX}`;
|
||||
|
||||
const DEFAULT_AI_RULES = `# Tech Stack
|
||||
- You are building a React application.
|
||||
- Use TypeScript.
|
||||
|
||||
Reference in New Issue
Block a user