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:
@@ -6,6 +6,10 @@ import path from "path";
|
||||
import os from "os";
|
||||
import { execSync } from "child_process";
|
||||
import { generateAppFilesSnapshotData } from "./generateAppFilesSnapshotData";
|
||||
import {
|
||||
BUILD_SYSTEM_POSTFIX,
|
||||
BUILD_SYSTEM_PREFIX,
|
||||
} from "@/prompts/system_prompt";
|
||||
|
||||
const showDebugLogs = process.env.DEBUG_LOGS === "true";
|
||||
|
||||
@@ -1144,6 +1148,8 @@ function prettifyDump(
|
||||
const content = Array.isArray(message.content)
|
||||
? JSON.stringify(message.content)
|
||||
: message.content
|
||||
.replace(BUILD_SYSTEM_PREFIX, "\n${BUILD_SYSTEM_PREFIX}")
|
||||
.replace(BUILD_SYSTEM_POSTFIX, "${BUILD_SYSTEM_POSTFIX}")
|
||||
// Normalize line endings to always use \n
|
||||
.replace(/\r\n/g, "\n")
|
||||
// We remove package.json because it's flaky.
|
||||
|
||||
Reference in New Issue
Block a user