fix(automation): Switch to Build Mode for Backend Generation
- Modified Views.tsx to keep the user in GlobalMode.Build instead of switching to Chat when generating a backend. - Added intelligent system prompt routing in LayoutComponents.tsx for [BACKEND_REQUEST] to ensure the AI knows how to generate a server.js file.
This commit is contained in:
@@ -2470,7 +2470,19 @@ Format: { "ideas": [{ "title": "Short Title", "subtitle": "One line", "tag": "To
|
||||
(window as any)._redesignApprovedSessions[state.activeProject.id] = true;
|
||||
}
|
||||
|
||||
if (isQaFailureArtifact) {
|
||||
const isBackendRequest = userPrompt.includes('[BACKEND_REQUEST]');
|
||||
|
||||
if (isBackendRequest) {
|
||||
// --- BACKEND GENERATION MODE ---
|
||||
systemPrompt = `[SYSTEM INSTRUCTION]: BACKEND GENERATION REQUEST.
|
||||
|
||||
The user wants to generate a server-side implementation for the existing frontend.
|
||||
1. Analyze the provided frontend code in the user prompt.
|
||||
2. Identify all API endpoints and data structures.
|
||||
3. Propose a plan to create a 'server.js' (Node.js/Express) file.
|
||||
4. The plan MUST start with '[PLAN]'.
|
||||
5. Do NOT modify the frontend code. Only build the backend.`;
|
||||
} else if (isQaFailureArtifact) {
|
||||
// --- REPAIR MODE (F3: Retention & Match) ---
|
||||
// "Broken frontend is treated as a REPAIR task"
|
||||
const originalIntent = state.activeProject?.originalPrompt || "Unknown Intent";
|
||||
|
||||
@@ -1452,8 +1452,8 @@ Start with "# 🔧 Repair Plan" and be concise.`;
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch to Chat to show progress
|
||||
dispatch({ type: 'SET_MODE', mode: GlobalMode.Chat });
|
||||
// Switch to Build mode (Plan tab) to show progress
|
||||
dispatch({ type: 'SET_MODE', mode: GlobalMode.Build });
|
||||
dispatch({ type: 'SET_TAB', tab: TabId.Plan });
|
||||
|
||||
const prompt = `[BACKEND_REQUEST]
|
||||
|
||||
Reference in New Issue
Block a user